/* KADTEK Client Portal — navy & gold */
:root {
  --navy: #0B1930;
  --navy-2: #13254A;
  --navy-3: #1E3462;
  --gold: #C5A059;
  --gold-2: #B08A44;
  --gold-soft: #F6F0E3;
  --bg: #F4F5F7;
  --card: #FFFFFF;
  --line: #E4E7EC;
  --line-2: #EEF0F3;
  --ink: #101828;
  --ink-2: #344054;
  --muted: #667085;
  --ok: #067647;
  --warn: #B54708;
  --bad: #B42318;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05);
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); font-size: 14px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--navy-3); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 15px; font-weight: 600; }
h3 { font-size: 13px; font-weight: 600; }
small, .muted { color: var(--muted); }
.mono { white-space: nowrap; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { width: 248px; flex-shrink: 0; background: var(--navy); color: #C9D1DE; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; z-index: 40; }
.brand { display: flex; align-items: center; gap: 12px; padding: 22px 20px 20px; border-bottom: 1px solid rgba(255,255,255,.06); }
.mark { width: 36px; height: 36px; border-radius: 8px; background: linear-gradient(145deg, var(--gold), var(--gold-2)); color: var(--navy); font-weight: 800; font-size: 18px; display: grid; place-items: center; }
.brand strong { display: block; color: #fff; letter-spacing: .14em; font-size: 15px; }
.brand small { color: var(--gold); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.sidebar nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 7px; color: #B4BFD0; font-weight: 500; text-decoration: none; }
.sidebar nav a:hover { background: rgba(255,255,255,.05); color: #fff; }
.sidebar nav a.active { background: rgba(197,160,89,.13); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.sidebar nav a.active svg { color: var(--gold); }
.side-foot { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,.06); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.side-foot .who strong { display: block; color: #fff; font-size: 13px; font-weight: 600; }
.side-foot .who small { color: #8F9AB0; font-size: 12px; }
.btn-link { background: none; border: 0; color: var(--gold); font: inherit; font-size: 12.5px; cursor: pointer; padding: 4px 0; }
.btn-link:hover { text-decoration: underline; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar { height: 64px; background: #fff; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 14px; padding: 0 28px; position: sticky; top: 0; z-index: 30; }
.topbar h1 { font-size: 17px; font-weight: 600; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hamburger { display: none; border: 1px solid var(--line); background: #fff; border-radius: 8px; width: 38px; height: 38px; font-size: 18px; cursor: pointer; color: var(--navy); }
.role-pill { font-size: 12px; font-weight: 600; color: var(--navy); background: var(--gold-soft); border: 1px solid #EADCBD; padding: 4px 10px; border-radius: 999px; white-space: nowrap; }
.content { padding: 26px 28px 48px; max-width: 1320px; width: 100%; }
.backdrop { display: none; }

/* ---------- toast ---------- */
.toast { position: fixed; top: 76px; right: 24px; z-index: 60; max-width: 420px; padding: 12px 16px 12px 14px; border-radius: 9px; background: #fff; border: 1px solid var(--line); border-left: 4px solid var(--ok); box-shadow: 0 10px 30px rgba(16,24,40,.12); font-weight: 500; transition: opacity .3s, transform .3s; }
.toast-error { border-left-color: var(--bad); }
.toast-info { border-left-color: var(--gold); }
.toast.hide { opacity: 0; transform: translateY(-8px); pointer-events: none; }

/* ---------- cards & layout ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card-b { padding: 18px 20px; }
.card + .card, .stack > * + * { margin-top: 18px; }
.grid > .card + .card, .grid > * + * { margin-top: 0; }
.grid > * { min-width: 0; }
.grid { display: grid; gap: 18px; }
.g-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g-3 { grid-template-columns: 2fr 1fr; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head p { margin: 4px 0 0; color: var(--muted); }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; position: relative; box-shadow: var(--shadow); }
.stat::before { content: ''; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--line); }
.stat.accent::before { background: var(--gold); }
.stat.warn::before { background: #F79009; }
.stat.ok::before { background: #12B76A; }
.stat .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.stat .v { font-size: clamp(18px, 1.55vw, 24px); overflow-wrap: anywhere; font-weight: 700; color: var(--navy); margin-top: 4px; letter-spacing: -0.02em; }
.stat .s { font-size: 12px; color: var(--muted); margin-top: 2px; }
a.stat { color: inherit; text-decoration: none; }
a.stat:hover { border-color: #D0D5DD; }

/* ---------- buttons & forms ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: 8px; border: 1px solid var(--navy); background: var(--navy); color: #fff; font: inherit; font-weight: 600; font-size: 13.5px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: var(--navy-2); text-decoration: none; }
.btn-gold { background: var(--gold); border-color: var(--gold); color: var(--navy); }
.btn-gold:hover { background: var(--gold-2); border-color: var(--gold-2); }
.btn-ghost { background: #fff; color: var(--ink-2); border-color: #D0D5DD; }
.btn-ghost:hover { background: #F9FAFB; }
.btn-danger { background: #fff; color: var(--bad); border-color: #FDA29B; }
.btn-danger:hover { background: #FEF3F2; }
.btn-sm { height: 32px; padding: 0 11px; font-size: 12.5px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
.field { margin-bottom: 14px; }
.hint { font-size: 12px; color: var(--muted); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], input[type=search], select, textarea {
  width: 100%; height: 40px; border: 1px solid #D0D5DD; border-radius: 8px; padding: 0 12px; font: inherit; color: var(--ink); background: #fff; outline: none;
}
textarea { height: auto; min-height: 88px; padding: 10px 12px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(197,160,89,.18); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 16px; }
.form-grid .full { grid-column: 1 / -1; }
.alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; border: 1px solid; }
.alert-error { background: #FEF3F2; border-color: #FECDCA; color: #912018; }
.alert-info { background: var(--gold-soft); border-color: #EADCBD; color: #6B4E16; }
.check-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.check { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; cursor: pointer; font-weight: 500; margin: 0; }
.check input { margin-top: 3px; accent-color: var(--navy); }
.check:has(input:checked) { border-color: var(--gold); background: var(--gold-soft); }
.check small { display: block; font-weight: 400; }

/* filters */
.filters { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--line-2); align-items: flex-end; }
.filters .f { flex: 1 1 150px; min-width: 130px; }
.filters .f-wide { flex: 2 1 240px; }
.filters label { font-size: 11.5px; color: var(--muted); font-weight: 600; margin-bottom: 4px; }
.filters input, .filters select { height: 36px; font-size: 13px; }

/* ---------- drop zone ---------- */
.drop { border: 1.5px dashed #C7CDD6; border-radius: 10px; padding: 20px; text-align: center; background: #FAFBFC; cursor: pointer; transition: .15s; position: relative; }
.drop:hover, .drop.over { border-color: var(--gold); background: var(--gold-soft); }
.drop input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; }
.drop .ico { color: var(--gold-2); }
.drop strong { display: block; color: var(--navy); margin-top: 4px; }
.drop .files { margin-top: 8px; font-size: 12.5px; color: var(--ink-2); text-align: left; }
.drop .files div { padding: 3px 0; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 600; padding: 11px 16px; background: #F9FAFB; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr.link-row { cursor: pointer; }
tbody tr.link-row:hover td { background: #FAFBFC; }
td.num, th.num { text-align: right; white-space: nowrap; }
td .sub { display: block; font-size: 12px; color: var(--muted); }
.empty { padding: 36px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink-2); margin-bottom: 4px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 999px; white-space: nowrap; border: 1px solid transparent; }
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.b-grey { background: #F2F4F7; color: #475467; }
.b-blue { background: #EFF8FF; color: #175CD3; border-color: #D1E9FF; }
.b-amber { background: #FFFAEB; color: #B54708; border-color: #FEDF89; }
.b-orange { background: #FEF6EE; color: #C4320A; border-color: #F9DBAF; }
.b-indigo { background: #EEF4FF; color: #3538CD; border-color: #C7D7FE; }
.b-green { background: #ECFDF3; color: #067647; border-color: #ABEFC6; }
.b-red { background: #FEF3F2; color: #B42318; border-color: #FECDCA; }
.b-navy { background: #E8EBF2; color: var(--navy); border-color: #C9D0DE; }

/* ---------- application detail ---------- */
.meta-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px 20px; }
.meta-grid .k { font-size: 12px; color: var(--muted); font-weight: 500; }
.meta-grid .v { font-weight: 600; margin-top: 2px; }
.progress { display: flex; gap: 0; margin: 4px 0 2px; overflow-x: auto; padding-bottom: 4px; }
.progress .step { flex: 1; min-width: 92px; text-align: center; position: relative; font-size: 11.5px; color: var(--muted); font-weight: 500; padding-top: 26px; }
.progress .step::before { content: ''; position: absolute; top: 8px; left: 50%; width: 16px; height: 16px; margin-left: -8px; border-radius: 50%; background: #fff; border: 2px solid #D0D5DD; z-index: 2; box-sizing: border-box; }
.progress .step::after { content: ''; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px; background: #E4E7EC; z-index: 1; }
.progress .step:first-child::after { display: none; }
.progress .step.done { color: var(--ink-2); }
.progress .step.done::before { background: var(--navy); border-color: var(--navy); }
.progress .step.done::after, .progress .step.current::after { background: var(--navy); }
.progress .step.current { color: var(--navy); font-weight: 700; }
.progress .step.current::before { background: var(--gold); border-color: var(--gold); box-shadow: 0 0 0 4px rgba(197,160,89,.22); }
.progress .step.stop::before { background: var(--bad); border-color: var(--bad); box-shadow: 0 0 0 4px rgba(180,35,24,.15); }
.progress .step.stop { color: var(--bad); font-weight: 700; }

.request { border: 1px solid #F9DBAF; background: #FFFCF5; border-radius: 10px; padding: 14px 16px; }
.request + .request { margin-top: 12px; }
.request .rh { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.request .rh strong { color: var(--navy); font-size: 14px; }
.request p { margin: 6px 0 10px; color: var(--ink-2); }
.request.closed { background: #fff; border-color: var(--line); }
.due-late { color: var(--bad); font-weight: 600; }

.doc-row { display: flex; align-items: center; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--line-2); }
.doc-row:last-child { border-bottom: 0; }
.doc-ico { width: 36px; height: 36px; border-radius: 8px; background: var(--gold-soft); color: var(--gold-2); display: grid; place-items: center; flex-shrink: 0; font-size: 10px; font-weight: 700; }
.doc-row .info { flex: 1; min-width: 0; }
.doc-row .info strong { display: block; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-row .info small { display: block; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; }
.timeline li::before { content: ''; position: absolute; left: 4px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--gold); }
.timeline li::after { content: ''; position: absolute; left: 7.5px; top: 16px; bottom: 0; width: 1px; background: var(--line); }
.timeline li:last-child::after { display: none; }
.timeline strong { font-weight: 600; font-size: 13px; }
.timeline .d { font-size: 12.5px; color: var(--ink-2); }
.timeline small { display: block; font-size: 11.5px; }

.note { background: var(--gold-soft); border: 1px solid #EADCBD; border-radius: 8px; padding: 10px 12px; }
.note + .note { margin-top: 10px; }
.note p { margin: 0 0 4px; white-space: pre-wrap; }
.lock { display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; color: #6B4E16; background: var(--gold-soft); border: 1px solid #EADCBD; padding: 2px 8px; border-radius: 999px; font-weight: 600; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; text-decoration: none; white-space: nowrap; }
.tabs a.active { color: var(--navy); border-bottom-color: var(--gold); }

details.inline-form summary { cursor: pointer; list-style: none; }
details.inline-form summary::-webkit-details-marker { display: none; }
details.inline-form[open] { background: #FAFBFC; border-radius: 8px; padding: 10px; margin-top: 6px; }

.chart-box { position: relative; height: 260px; }
.inv-lines td { padding: 8px 10px; }
.inv-lines input { height: 36px; }
.total-line { display: flex; justify-content: flex-end; gap: 20px; padding: 14px 10px 4px; font-size: 15px; }
.total-line strong { color: var(--navy); font-size: 20px; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; }
.kv .k { color: var(--muted); }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: #fff; }
.login-art { background: var(--navy); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ''; position: absolute; right: -120px; bottom: -120px; width: 420px; height: 420px; border-radius: 50%; border: 1px solid rgba(197,160,89,.25); box-shadow: 0 0 0 60px rgba(197,160,89,.04), 0 0 0 120px rgba(197,160,89,.03); }
.login-art h2 { font-size: 34px; line-height: 1.15; font-weight: 700; max-width: 440px; letter-spacing: -0.02em; }
.login-art h2 span { color: var(--gold); }
.login-art p { color: #AEB8C9; max-width: 420px; font-size: 15px; }
.login-art .brand { padding: 0; border: 0; }
.login-art ul { list-style: none; padding: 0; margin: 26px 0 0; color: #D5DBE6; }
.login-art li { padding: 6px 0 6px 26px; position: relative; }
.login-art li::before { content: ''; position: absolute; left: 0; top: 12px; width: 14px; height: 2px; background: var(--gold); }
.login-form { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.login-box { width: 100%; max-width: 380px; }
.login-box h1 { font-size: 24px; font-weight: 700; color: var(--navy); }
.login-box > p { color: var(--muted); margin: 6px 0 26px; }
.login-box .btn { width: 100%; height: 44px; margin-top: 6px; }
.demo-box { margin-top: 24px; border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: #FAFBFC; }
.demo-box h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: 8px; }
.demo-box button { display: flex; width: 100%; justify-content: space-between; align-items: center; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; margin-top: 6px; cursor: pointer; font: inherit; text-align: left; }
.demo-box button:hover { border-color: var(--gold); }
.demo-box button strong { color: var(--navy); font-size: 13px; }
.demo-box button small { font-size: 12px; }
.credit { margin-top: 22px; text-align: center; font-size: 11.5px; color: #98A2B3; }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .g-3 { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; transform: translateX(-100%); transition: transform .22s ease; box-shadow: 0 0 40px rgba(0,0,0,.25); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(11,25,48,.45); z-index: 35; }
  .hamburger { display: inline-grid; place-items: center; }
  .topbar { padding: 0 16px; }
  .content { padding: 18px 16px 40px; }
  .g-2 { grid-template-columns: 1fr; }
  .login-page { grid-template-columns: 1fr; }
  .login-art { display: none; }
}
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 13px 14px; }
  .stat .v { font-size: 20px; }
  .role-pill { display: none; }
  .card-h { padding: 14px 16px; }
  .card-b { padding: 16px; }
  .toast { left: 16px; right: 16px; top: 72px; }
  th, td { padding: 10px 12px; }
  .hide-sm { display: none; }
  .kv { grid-template-columns: 110px 1fr; }
  .page-head .btn { width: 100%; }
}
@media print {
  .sidebar, .topbar, .btn, .filters { display: none !important; }
  .content { padding: 0; }
}
