/* Palette taken from avp.bcciodms.com */
:root {
    --primary: #1976d2; --secondary: #dc004e; --success: #2e7d32; --error: #d32f2f; --warning: #ed6c02; --info: #0288d1;
    --indigo-900: #1e1b4b; --indigo-800: #312e81; --indigo-600: #4338ca; --slate: #1e293b; --muted: #6b7280;
    --text: rgba(0,0,0,.87); --text-2: rgba(0,0,0,.6); --divider: rgba(0,0,0,.12); --bg: #fafafa; --paper: #fff;
    --grad: linear-gradient(135deg, #1e1b4b 0%, #312e81 50%, #4338ca 100%);
}
* { box-sizing: border-box; }
body { font-family: Roboto, Helvetica, Arial, sans-serif; background: var(--bg); color: var(--text); margin: 0; font-size: 14px; }
[x-cloak] { display: none !important; }

/* ---- login ---- */
.login { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; background: var(--grad); }
.login .hero { color: #fff; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 32px; }
.login .hero h1 { font-size: 40px; font-weight: 700; margin: 0 0 6px; }
.login .hero .sub { font-weight: 500; margin-bottom: 28px; }
.login .hero p { max-width: 340px; font-size: 13px; opacity: .9; }
.login .panel { display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(135deg, rgba(49,46,129,.0), rgba(67,56,202,.9)); }
.login .box { background: var(--paper); border-radius: 12px; padding: 24px; width: 100%; max-width: 400px; box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.login .box small { color: var(--text-2); }
.crest { width: 110px; height: 110px; border-radius: 50%; border: 3px solid #d4af37; display: flex; align-items: center; justify-content: center; font-size: 34px; font-weight: 700; color: #d4af37; margin-bottom: 22px; }
@media (max-width: 800px) { .login { grid-template-columns: 1fr; } .login .hero { padding: 24px 16px; } }

/* ---- shell ---- */
.topbar { background: var(--grad); color: #fff; height: 56px; display: flex; align-items: center; padding: 0 20px; gap: 16px; position: sticky; top: 0; z-index: 20; }
.topbar .brand { font-weight: 700; font-size: 17px; }
.topbar .brand small { font-weight: 400; opacity: .8; margin-left: 8px; }
.topbar .spacer { flex: 1; }
.topbar .who { text-align: right; line-height: 1.2; font-size: 12px; }
.topbar .burger { display: none; background: none; border: 0; color: #fff; font-size: 22px; }
.layout { display: flex; min-height: calc(100vh - 56px); }
.side { width: 230px; background: var(--paper); border-right: 1px solid var(--divider); padding: 12px 0; flex-shrink: 0; }
.side a { display: block; padding: 10px 20px; color: var(--slate); text-decoration: none; cursor: pointer; border-left: 3px solid transparent; font-weight: 500; }
.side a:hover { background: #f1f1fb; }
.side a.on { background: #eef0ff; color: var(--indigo-600); border-left-color: var(--indigo-600); }
.main { flex: 1; padding: 24px; min-width: 0; }
@media (max-width: 800px) { .topbar .burger { display: block; } .side { position: fixed; top: 56px; bottom: 0; left: 0; z-index: 15; transform: translateX(-100%); transition: .2s; } .side.open { transform: none; box-shadow: 4px 0 20px rgba(0,0,0,.2); } .main { padding: 14px; } }

h2.title { font-size: 22px; font-weight: 500; margin: 0 0 16px; color: var(--indigo-800); }
.cardx { background: var(--paper); border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 1px 2px rgba(0,0,0,.08); padding: 18px; margin-bottom: 18px; }
.cardx h3 { font-size: 16px; font-weight: 500; margin: 0 0 12px; }
.grid { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.stat { border-radius: 12px; padding: 16px; color: #fff; background: var(--grad); }
.stat b { font-size: 26px; display: block; }
.stat span { opacity: .85; font-size: 12px; }

label { font-size: 12px; color: var(--text-2); display: block; margin-bottom: 3px; }
input, select, textarea { width: 100%; border: 1px solid rgba(0,0,0,.23); border-radius: 6px; padding: 8px 10px; font: inherit; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--primary); border-color: var(--primary); }
input[type=checkbox] { width: auto; }
textarea { font-family: Consolas, monospace; font-size: 12px; }
.btn { border: 0; border-radius: 6px; padding: 8px 16px; font: inherit; font-weight: 500; cursor: pointer; background: var(--primary); color: #fff; text-transform: uppercase; letter-spacing: .4px; font-size: 12px; }
.btn:hover { filter: brightness(1.08); } .btn:disabled { background: rgba(0,0,0,.12); color: rgba(0,0,0,.38); cursor: not-allowed; }
.btn.indigo { background: var(--indigo-600); } .btn.success { background: var(--success); } .btn.danger { background: var(--error); } .btn.warn { background: var(--warning); }
.btn.ghost { background: transparent; color: var(--primary); border: 1px solid var(--primary); } .btn.sm { padding: 4px 10px; font-size: 11px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; } .row > div { flex: 1; min-width: 150px; } .row > .auto { flex: 0 0 auto; min-width: 0; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--divider); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 9px 16px; cursor: pointer; color: var(--text-2); font-weight: 500; border-bottom: 2px solid transparent; }
.tabs a.on { color: var(--indigo-600); border-bottom-color: var(--indigo-600); }

.tablewrap { overflow-x: auto; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; background: #f1f1fb; color: var(--indigo-800); padding: 9px 10px; white-space: nowrap; font-weight: 500; }
table.t td { padding: 9px 10px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
table.t tr:hover td { background: #fafaff; } .r { text-align: right; } .muted { color: var(--text-2); }
.badge { display: inline-block; padding: 2px 10px; border-radius: 12px; font-size: 11px; font-weight: 500; color: #fff; background: #9e9e9e; }
.b-Pending { background: var(--warning); } .b-Verified { background: var(--info); } .b-Approved { background: var(--success); } .b-Rejected { background: var(--error); } .b-Paid { background: var(--indigo-600); } .b-Draft { background: #9e9e9e; }
.b-Open { background: var(--success); } .b-Closed { background: var(--slate); } .b-confirmed { background: var(--success); } .b-uploaded { background: var(--warning); } .b-returned { background: var(--error); }
.pager { display: flex; align-items: center; gap: 10px; margin-top: 12px; justify-content: flex-end; flex-wrap: wrap; }

.toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; padding: 12px 18px; border-radius: 8px; color: #fff; max-width: 420px; box-shadow: 0 4px 16px rgba(0,0,0,.3); }
.toast.ok { background: var(--success); } .toast.err { background: var(--error); }
.modalbg { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 30px 12px; overflow: auto; }
.modal { background: var(--paper); border-radius: 12px; width: 100%; max-width: 820px; padding: 22px; }
.modal h3 { margin: 0 0 12px; color: var(--indigo-800); font-weight: 500; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 8px 16px; margin-bottom: 12px; } .kv div span { display: block; font-size: 11px; color: var(--text-2); }
.totals { margin-left: auto; max-width: 340px; } .totals div { display: flex; justify-content: space-between; padding: 3px 0; } .totals .g { border-top: 2px solid var(--indigo-800); font-weight: 700; font-size: 15px; margin-top: 4px; padding-top: 6px; }
.note { font-size: 12px; color: var(--text-2); background: #eef0ff; border-radius: 6px; padding: 8px 12px; margin-bottom: 12px; }
.crest-img { width: 150px; height: auto; margin-bottom: 22px; filter: drop-shadow(0 4px 14px rgba(0,0,0,.35)); }
.brand-img { height: 34px; width: auto; vertical-align: middle; margin-right: 10px; }
.topbar .brand { display: flex; align-items: center; }
