:root {
  --navy: #1b2a4a; --navy-2: #24365c; --gold: #c9a227;
  --bg: #f4f5f7; --card: #fff; --line: #dfe3e8;
  --text: #1c1f26; --muted: #6b7280;
  --green: #1a7f37; --red: #b42318; --amber: #92400e;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Helvetica, Arial, sans-serif;
       background: var(--bg); color: var(--text); font-size: 15px; }
a { color: var(--navy-2); }

nav { background: var(--navy); color: #fff; display: flex; align-items: center;
      gap: 22px; padding: 0 22px; min-height: 60px; }
nav .brand { display: inline-flex; flex-direction: column; line-height: 1.04;
             font-weight: 700; letter-spacing: .5px; }
nav .brand .brand-name { font-size: 28px; }
nav .brand .brand-sub { font-size: 11px; font-weight: 600; letter-spacing: 1.5px;
                        text-transform: uppercase; color: #aab4c6; margin-top: 3px; }
nav .brand .badge { color: var(--gold); }
nav a.navlink { color: #cfd6e4; text-decoration: none; padding: 16px 2px; }
nav a.navlink.active, nav a.navlink:hover { color: #fff; box-shadow: inset 0 -3px var(--gold); }
nav .spacer { flex: 1; }
nav .who { color: #cfd6e4; font-size: 13px; }
nav form { margin: 0; }
nav button { background: none; border: 1px solid #46587e; color: #cfd6e4;
             border-radius: 6px; padding: 5px 10px; cursor: pointer; }

main { max-width: 1100px; margin: 26px auto; padding: 0 20px; }
h1 { font-size: 21px; margin: 0 0 16px; }
h2 { font-size: 15px; text-transform: uppercase; letter-spacing: 1px;
     color: var(--muted); margin: 22px 0 8px; }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; }
.card .num { font-size: 30px; font-weight: 700; }
.card .lbl { color: var(--muted); font-size: 13px; }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: 10px;
         padding: 18px; margin-bottom: 18px; }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.filters input, .filters select { padding: 8px 10px; border: 1px solid var(--line);
  border-radius: 7px; font-size: 14px; background: #fff; }
.filters input[name=q] { flex: 1; min-width: 220px; }

table { width: 100%; border-collapse: collapse; background: var(--card);
        border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .5px;
     color: var(--muted); padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfc; }
td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.rowlink { cursor: pointer; }
tr.rowlink:hover { background: #f6f8fb; }
td a { text-decoration: none; font-weight: 600; }

.pill { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px;
        font-weight: 700; line-height: 17px; letter-spacing: .04em; text-transform: uppercase;
        white-space: nowrap; vertical-align: middle; }
.pill.issued, .pill.submitted { background: #e6f4ea; color: var(--green); }
.pill.voided { background: #fdecea; color: var(--red); }
.pill.draft { background: #fef3c7; color: var(--amber); }

.btn { display: inline-block; border: none; border-radius: 7px; padding: 9px 16px;
       font-size: 14px; font-weight: 600; cursor: pointer; text-decoration: none; }
.btn.sm { padding: 5px 12px; font-size: 13px; }

/* Denser table for list pages whose rows carry badges + inline actions. */
table.tight th, table.tight td { padding: 8px 10px; }
.btn.primary { background: var(--navy); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: #fff; color: var(--navy); border: 1px solid var(--line); }

dl.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
            gap: 10px 18px; margin: 0; }
dl.fields dt { font-size: 11px; text-transform: uppercase; color: var(--muted); }
dl.fields dd { margin: 1px 0 0; min-height: 18px; font-weight: 500; }

.audit { list-style: none; margin: 0; padding: 0; }
.audit li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.audit li:last-child { border-bottom: none; }
.audit .when { color: var(--muted); font-size: 12px; }

.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.detail-head h1 { margin: 0; }
.detail-head .actions { margin-left: auto; display: flex; gap: 8px; }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 22px; max-width: 440px; }
dialog::backdrop { background: rgba(20, 28, 45, .45); }
dialog textarea { width: 100%; min-height: 80px; margin: 10px 0 14px; padding: 8px;
                  border: 1px solid var(--line); border-radius: 7px; font: inherit; }

.messages { list-style: none; padding: 0; margin: 0 0 16px; }
.messages li { padding: 10px 14px; border-radius: 8px; margin-bottom: 8px; }
.messages .success { background: #e6f4ea; color: var(--green); }
.messages .error { background: #fdecea; color: var(--red); }

.login-wrap { max-width: 360px; margin: 90px auto; }
.login-wrap .brand { display: flex; flex-direction: column; align-items: center;
                     line-height: 1.04; color: var(--navy); margin-bottom: 22px; }
.login-wrap .brand .brand-name { font-size: 44px; font-weight: 700; letter-spacing: .5px; }
.login-wrap .brand .brand-name .badge { color: var(--gold); }
.login-wrap .brand .brand-sub { font-size: 12px; font-weight: 600; letter-spacing: 2px;
                                text-transform: uppercase; color: var(--muted); margin-top: 6px; }
.login-wrap label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
.login-wrap input { width: 100%; padding: 10px; border: 1px solid var(--line);
                    border-radius: 7px; font-size: 15px; }
.login-wrap .btn { width: 100%; margin-top: 18px; }
.errorlist { color: var(--red); font-size: 13px; padding-left: 18px; }

.pagination { margin: 14px 0; display: flex; gap: 10px; align-items: center; color: var(--muted); font-size: 14px; }
.empty { color: var(--muted); text-align: center; padding: 28px !important; }
