:root {
  --brand: #0B3C5D; --brand2: #145A8A; --accent: #F4A300; --bg: #F4F6F9; --card: #fff; --text: #1d2733; --muted: #6b7785;
  --line: #e3e8ee; --ok: #2E7D32; --warn: #E6A100; --bad: #C62828; --info: #1565C0;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: Arial, Helvetica, sans-serif; background: var(--bg); color: var(--text); font-size: 14px; }
.hidden { display: none !important; }
.small { font-size: 12.5px; } .tiny { font-size: 11px; } .muted { color: var(--muted); }
h1 { font-size: 18px; margin: 0; } h2 { font-size: 20px; color: var(--brand); margin: 0 0 8px; } h3 { margin: 0 0 10px; color: var(--brand); font-size: 16px; } h4 { margin: 14px 0 6px; }
a { color: var(--brand2); }
label { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; }
input, select, textarea { width: 100%; padding: 8px 10px; border: 1px solid #cdd5de; border-radius: 6px; font-size: 14px; font-family: inherit; background: #fff; }
textarea { min-height: 70px; resize: vertical; }
input[type=checkbox] { width: auto; }
.btn { border: 1px solid #cdd5de; background: #fff; color: var(--text); padding: 8px 14px; border-radius: 6px; cursor: pointer; font-size: 14px; white-space: nowrap; }
.btn:hover { background: #f0f3f7; } .btn.primary { background: var(--brand); color: #fff; border-color: var(--brand); } .btn.primary:hover { background: var(--brand2); }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #222; } .btn.danger { color: var(--bad); border-color: #f0c4c4; }
.btn.sm { padding: 4px 9px; font-size: 12.5px; } .btn.block { width: 100%; margin-top: 14px; padding: 11px; font-weight: bold; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { background: none; border: 0; font-size: 18px; cursor: pointer; color: inherit; }

/* login */
.login { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 16px; background: linear-gradient(135deg, var(--brand), #071f31); }
.login-card { background: #fff; width: 100%; max-width: 420px; border-radius: 12px; padding: 26px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.brand-row { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.logo-dot { width: 38px; height: 38px; border-radius: 9px; background: var(--accent); color: #222; display: flex; align-items: center; justify-content: center; font-weight: bold; flex: none; }

/* layout */
#app { display: flex; min-height: 100%; }
#side { width: 240px; background: var(--brand); color: #dbe7f1; flex: none; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side-brand { display: flex; gap: 10px; align-items: center; padding: 16px; color: #fff; border-bottom: 1px solid rgba(255,255,255,.1); }
#nav { flex: 1; padding: 8px 0; }
#nav .grp { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #8fb1cc; padding: 14px 16px 4px; }
#nav a { display: block; padding: 8px 16px; color: #dbe7f1; text-decoration: none; font-size: 13.5px; border-left: 3px solid transparent; }
#nav a:hover { background: rgba(255,255,255,.06); } #nav a.active { background: rgba(255,255,255,.12); border-left-color: var(--accent); color: #fff; }
#nav a.soon { opacity: .45; } #nav a .tag { float: right; font-size: 10px; background: rgba(255,255,255,.15); padding: 1px 6px; border-radius: 8px; }
.side-foot { padding: 10px 16px; color: #8fb1cc; }
#mainCol { flex: 1; min-width: 0; }
#top { display: flex; align-items: center; gap: 12px; background: #fff; border-bottom: 1px solid var(--line); padding: 10px 18px; position: sticky; top: 0; z-index: 5; }
#top h1 { flex: 1; } #clientSel { width: auto; max-width: 260px; } #menuBtn { display: none; }
main { padding: 18px; max-width: 1400px; }

/* components */
.card { background: var(--card); border-radius: 10px; padding: 16px; box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 14px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 12px; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 12px; }
.kpi { background: #fff; border-radius: 10px; padding: 14px; box-shadow: 0 1px 4px rgba(0,0,0,.06); border-top: 4px solid var(--brand2); }
.kpi .v { font-size: 26px; font-weight: bold; } .kpi .l { font-size: 12px; color: var(--muted); margin-top: 4px; }
.kpi.ok { border-top-color: var(--ok); } .kpi.warn { border-top-color: var(--warn); } .kpi.bad { border-top-color: var(--bad); }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; } .toolbar .grow { flex: 1; min-width: 160px; }
.tbl-wrap { overflow-x: auto; background: #fff; border-radius: 10px; box-shadow: 0 1px 4px rgba(0,0,0,.06); }
table.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; background: #eef2f6; padding: 8px 10px; font-size: 12px; color: #3b4856; position: sticky; top: 0; }
.tbl td { padding: 8px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.tbl tr.dim td { opacity: .55; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 10px; font-size: 11.5px; font-weight: bold; background: #e7ecf1; color: #3b4856; white-space: nowrap; }
.pill.ok { background: #e3f3e4; color: var(--ok); } .pill.warn { background: #fff3d6; color: #8a6100; } .pill.bad { background: #fde5e5; color: var(--bad); } .pill.info { background: #e3eefb; color: var(--info); }
.tabs { display: flex; gap: 4px; border-bottom: 2px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 9px 14px; cursor: pointer; font-size: 14px; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--accent); font-weight: bold; }
.empty { padding: 30px; text-align: center; color: var(--muted); }
.banner { background: #eef5fb; border-left: 4px solid var(--brand2); padding: 10px 14px; border-radius: 6px; margin-bottom: 14px; font-size: 13px; }
.banner.warn { background: #fff8e6; border-left-color: var(--warn); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; } .chip { background: #eef2f6; border-radius: 12px; padding: 3px 10px; font-size: 12px; }
.doc-view { background: #fff; padding: 24px; border-radius: 10px; line-height: 1.55; }
.doc-view .h { font-weight: bold; color: var(--brand); margin: 18px 0 6px; font-size: 15px; }
.doc-view p { margin: 4px 0; } .doc-view .l2 { padding-left: 18px; } .doc-view .l3 { padding-left: 36px; } .doc-view .l4 { padding-left: 54px; }
.doc-view table { border-collapse: collapse; width: 100%; margin: 8px 0 12px; font-size: 12.5px; } .doc-view td { border: 1px solid #cfd8e1; padding: 5px 7px; vertical-align: top; white-space: pre-wrap; }
.doc-view tr:first-child td { background: #eef2f6; font-weight: bold; }

/* modal, busy, toast */
.modal { position: fixed; inset: 0; background: rgba(10,25,40,.55); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 30px 12px; overflow-y: auto; }
.modal-box { background: #fff; border-radius: 12px; width: 100%; max-width: 640px; box-shadow: 0 10px 40px rgba(0,0,0,.3); }
.modal-box.wide { max-width: 980px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-body { padding: 4px 18px 16px; max-height: 70vh; overflow-y: auto; } .modal-foot { padding: 12px 18px; border-top: 1px solid var(--line); display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
.busy { position: fixed; inset: 0; background: rgba(255,255,255,.75); z-index: 80; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.spinner { width: 40px; height: 40px; border: 4px solid #d5dee7; border-top-color: var(--brand); border-radius: 50%; animation: spin 1s linear infinite; } @keyframes spin { to { transform: rotate(360deg); } }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: #22313f; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 90; max-width: 90%; }
.toast.err { background: var(--bad); }

@media (max-width: 860px) {
  #side { position: fixed; left: -260px; z-index: 40; transition: left .2s; } #side.open { left: 0; }
  #menuBtn { display: inline-block; } #who { display: none; } main { padding: 12px; }
}

.login-logo { text-align: center; margin-bottom: 18px; } .login-logo img { width: 100%; max-width: 300px; display: block; margin: 0 auto 6px; }
.side-brand { flex-direction: column; align-items: flex-start; gap: 4px; } .side-brand img { width: 100%; max-width: 200px; display: block; }

.bell-wrap { position: relative; } .bell-n { position: absolute; top: -4px; right: -6px; background: var(--bad); color: #fff; border-radius: 9px; font-size: 10.5px; padding: 1px 5px; font-weight: bold; }
.bell-box { position: absolute; right: 0; top: 34px; width: 360px; max-height: 460px; overflow-y: auto; background: #fff; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.2); z-index: 30; }
.bell-box .it { padding: 10px 14px; border-bottom: 1px solid var(--line); cursor: pointer; } .bell-box .it.unread { background: #f1f7fd; } .bell-box .it:hover { background: #f4f6f9; }
.bell-box .hd { display: flex; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); font-weight: bold; }
.person { display: flex; gap: 12px; align-items: center; } .person img, .person .ph { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; background: #e7ecf1; display: flex; align-items: center; justify-content: center; color: var(--muted); flex: none; }
.sig { max-height: 50px; max-width: 160px; background: #fff; border: 1px dashed #cdd5de; padding: 2px; }
a.btn { text-decoration: none; display: inline-block; }
