/* Khatabahi FS — navy & gold, built for speed and dense financial tables */
:root {
  --navy: #13294b; --navy2: #1d3a66; --gold: #c9a14a; --gold-soft: #f6efdf;
  --ink: #1d2433; --muted: #5d6779; --line: #dfe3ea; --bg: #f4f6f9; --card: #fff;
  --ok: #1f7a4a; --ok-bg: #e7f5ed; --warn: #8a5a00; --warn-bg: #fff4dc; --err: #a32020; --err-bg: #fdeaea;
  --radius: 8px;
}
* { box-sizing: border-box; }
html { font-size: 14px; }
body { margin: 0; font-family: -apple-system, "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif; color: var(--ink); background: var(--bg); line-height: 1.45; }
a { color: var(--navy2); }
h1 { font-size: 1.45rem; margin: .2rem 0 1rem; color: var(--navy); }
h2 { font-size: 1.12rem; margin: 1.4rem 0 .6rem; color: var(--navy); }
h3 { font-size: 1rem; margin: 1rem 0 .4rem; }
small, .muted { color: var(--muted); }

.top { background: var(--navy); color: #fff; display: flex; align-items: center; gap: 18px; padding: 0 16px; min-height: 54px; flex-wrap: wrap; border-bottom: 3px solid var(--gold); }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; }
.brand small { display: block; font-size: .72rem; color: #c8d2e3; font-weight: 400; max-width: 220px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.brand b { color: var(--gold); }
.logo-mark { width: 32px; height: 32px; border-radius: 6px; background: var(--gold); color: var(--navy); display: grid; place-items: center; font-weight: 800; font-family: Georgia, serif; font-size: 1.2rem; }
.logo-img { height: 34px; border-radius: 4px; background: #fff; }
nav.main { display: flex; gap: 2px; flex: 1; flex-wrap: wrap; }
nav.main a { color: #dfe6f2; text-decoration: none; padding: 16px 12px 14px; border-bottom: 3px solid transparent; margin-bottom: -3px; }
nav.main a:hover { color: #fff; }
nav.main a.on { color: #fff; border-bottom-color: #fff; }
.who { font-size: .85rem; color: #c8d2e3; display: flex; gap: 12px; align-items: center; }
.who a { color: #fff; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 18px 16px 40px; }
.wrap.wide { max-width: 1500px; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 8px; }
.foot { text-align: center; color: var(--muted); font-size: .8rem; padding: 16px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; }
.card h2:first-child, .card h3:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.row > * { flex: 1 1 180px; }
.right { margin-left: auto; }
.spacer { flex: 1; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; border: 1px solid; }
.flash.ok { background: var(--ok-bg); border-color: #b9e0c9; color: var(--ok); }
.flash.warn { background: var(--warn-bg); border-color: #f0d79a; color: var(--warn); }
.flash.err { background: var(--err-bg); border-color: #f2b9b9; color: var(--err); }

label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 3px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=file], select, textarea {
  width: 100%; padding: 8px 10px; border: 1px solid #c9d0db; border-radius: 6px; font: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 90px; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9db6dd; border-color: var(--navy2); }
.check { display: flex; align-items: center; gap: 6px; color: var(--ink); font-size: .92rem; }
.check input { width: auto; }
.field { margin-bottom: 12px; }

.btn, button { display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 6px; border: 1px solid var(--navy); background: var(--navy); color: #fff; font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover, button:hover { background: var(--navy2); }
.btn.gold, button.gold { background: var(--gold); border-color: #b48a33; color: var(--navy); font-weight: 600; }
.btn.light, button.light { background: #fff; color: var(--navy); border-color: #c9d0db; }
.btn.light:hover, button.light:hover { background: #eef2f8; }
.btn.danger, button.danger { background: #fff; color: var(--err); border-color: #e6b3b3; }
.btn.danger:hover, button.danger:hover { background: var(--err-bg); }
.btn.sm, button.sm { padding: 4px 9px; font-size: .85rem; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
form.inline { display: inline; }

table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f0f3f8; color: var(--navy); font-weight: 600; font-size: .85rem; position: sticky; top: 0; z-index: 1; }
td.n, th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
tr:hover td { background: #fafbfd; }
.tbl-wrap { overflow: auto; border: 1px solid var(--line); border-radius: var(--radius); max-height: 70vh; }
.tbl-wrap.free { max-height: none; }

.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: .78rem; background: #eef2f8; color: var(--navy2); }
.badge.ok { background: var(--ok-bg); color: var(--ok); }
.badge.warn { background: var(--warn-bg); color: var(--warn); }
.badge.err { background: var(--err-bg); color: var(--err); }
.badge.new { background: var(--gold-soft); color: #7a5b17; }

.steps { display: flex; gap: 4px; margin: 0 0 16px; flex-wrap: wrap; align-items: center; }
.steps a { padding: 8px 14px; background: #fff; border: 1px solid var(--line); border-radius: 6px; text-decoration: none; color: var(--navy2); }
.steps a.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.status { margin-left: auto; padding: 4px 10px; border-radius: 12px; font-size: .82rem; font-weight: 600; }
.st-draft { background: #eef2f8; color: var(--navy2); }
.st-review { background: var(--warn-bg); color: var(--warn); }
.st-approved, .st-locked { background: var(--ok-bg); color: var(--ok); }

.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.kpi div { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.kpi b { display: block; font-size: 1.4rem; color: var(--navy); }

.checks { list-style: none; padding: 0; margin: 0; }
.checks li { padding: 6px 0; border-bottom: 1px dashed var(--line); }
.checks li::before { content: "✔"; color: var(--ok); margin-right: 8px; }
.checks li.bad::before { content: "✖"; color: var(--err); }
.checks li.warn::before { content: "!"; color: var(--warn); font-weight: 800; margin-right: 12px; }

.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 14px; flex-wrap: wrap; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tabs a.on { color: var(--navy); border-bottom-color: var(--gold); font-weight: 600; }

/* mapping screen */
tr.unmapped td { background: #fff8e8; }
tr.newl td:first-child { box-shadow: inset 3px 0 0 var(--gold); }
.map-sel { min-width: 260px; }
.src { font-size: .75rem; color: var(--muted); }

/* statement preview */
.fs { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 26px; font-family: "Times New Roman", Times, serif; font-size: 15px; }
.fs h2, .fs h3 { font-family: inherit; color: #000; text-align: center; margin: 4px 0; }
.fs .subh { text-align: center; margin-bottom: 10px; }
.fs table { font-size: 14.5px; }
.fs th { background: #fff; color: #000; border-bottom: 1.5px solid #000; position: static; font-size: 14px; }
.fs td { border-bottom: 1px solid #eee; padding: 3px 6px; }
.fs tr.hd td { font-weight: 700; padding-top: 10px; }
.fs tr.tot td { font-weight: 700; border-top: 1px solid #000; border-bottom: 2px double #000; }
.fs tr.sub td { font-weight: 700; border-top: 1px solid #999; }
.fs td.ind1 { padding-left: 22px; } .fs td.ind2 { padding-left: 40px; } .fs td.ind3 { padding-left: 58px; }
.fs td.nt { text-align: center; width: 50px; }
.fs a.amt { color: inherit; text-decoration: none; border-bottom: 1px dotted #9aa; }
.fs .note { margin-top: 18px; }
.fs .note p { margin: 4px 0; text-align: justify; }
.fs .flagged td { background: #fff8e8; }
.fs .ledger td { color: #555; font-size: 13px; }
.sign { display: flex; justify-content: space-between; margin-top: 28px; gap: 20px; font-size: 14px; }
.sign div { min-width: 220px; }

.login-box { max-width: 380px; margin: 8vh auto; }
.login-box .brand-big { text-align: center; margin-bottom: 18px; color: var(--navy); }
.login-box .brand-big .logo-mark { width: 54px; height: 54px; margin: 0 auto 8px; font-size: 1.8rem; }

.drop { border: 2px dashed #b8c3d6; border-radius: var(--radius); padding: 26px; text-align: center; background: #fafcff; }
.drop.over { background: var(--gold-soft); border-color: var(--gold); }
.hint { font-size: .85rem; color: var(--muted); }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
.hide { display: none !important; }

@media (max-width: 720px) {
  .who span { display: none; }
  .fs { padding: 12px; }
  .wrap { padding: 12px 10px 30px; }
}

.fs table.grid.small th, .fs table.grid.small td { font-size: 12px; padding: 2px 4px; }
table.tight td { padding: 3px 8px; }
table.tight td.n { text-align: right; white-space: nowrap; }
.comment { border-left: 3px solid #c9a14a; padding: 6px 10px; margin: 8px 0; background: #fbf8f1; }
.comment.done { border-left-color: #9bb59b; background: #f4f8f4; opacity: .8; }
.comment .meta { font-size: 12px; color: #666; }
button.link { background: none; border: 0; padding: 0; color: #a33; cursor: pointer; text-decoration: underline; }
.report table.ta { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.report table.ta th, .report table.ta td { border: 1px solid #ccd; padding: 4px 6px; vertical-align: top; text-align: left; }
.report table.ta th { background: #eef1f6; }
.report table.ta td.cl { width: 7%; font-weight: 600; white-space: nowrap; }
.report table.ta td.pt { width: 42%; }
.report table.grid { width: 100%; border-collapse: collapse; margin: 4px 0; font-size: 12px; }
.report table.grid th, .report table.grid td { border: 1px solid #dde; padding: 2px 4px; }
.report table.grid td.n, .report table.grid th.n { text-align: right; }
.report .part { font-weight: 700; text-align: center; margin: 12px 0 4px; }
.report .c { text-align: center; margin: 2px 0; }
.report table.acct { border-collapse: collapse; min-width: 50%; } .report table.acct td { border: 1px solid #dde; padding: 2px 6px; }
.report ul.rb { padding-left: 22px; } .report ul.rb li { margin: 3px 0; }
.topsearch { flex: 1; max-width: 360px; margin: 0 14px; }
.topsearch input { width: 100%; padding: 6px 10px; border-radius: 6px; border: 1px solid rgba(255,255,255,.25); background: rgba(255,255,255,.12); color: #fff; }
.topsearch input::placeholder { color: rgba(255,255,255,.7); }
ul.links { margin: 0; padding-left: 18px; } ul.links li { margin: 5px 0; }
@media (max-width: 800px) { .topsearch { order: 3; max-width: none; margin: 6px 0; flex-basis: 100%; } }
.sfbox{border:1px solid #e3e6ea;border-radius:8px;padding:12px 14px;margin:12px 0;background:#fafbfc}
.sfbox.new{background:#fffdf5;border-style:dashed}
.sfbox .prow{margin:6px 0}
/* manual entry window */
.man-tot{display:flex;flex-wrap:wrap;gap:18px;align-items:center;position:sticky;top:0;z-index:5}
.man-tot>div{flex:0 0 auto}.man-tot span{display:block;font-size:12px;color:#6b7280}.man-tot b{font-size:16px}
.man-tot .sep{width:1px;align-self:stretch;background:#e3e6ea}
.mantbl{width:100%}.mantbl td{padding:4px 8px;vertical-align:middle}.mantbl th.n,.mantbl td.n{width:170px}
.mantbl input.amt{text-align:right;width:100%}.mantbl tr.mgrp td{background:#f5f6f8;padding-top:8px}
.mantbl tr.mgrp .addln{float:right}.mantbl .dc{float:right;font-size:11px;color:#9aa1ab;margin-left:6px}
.mantbl tr.mrow td:first-child{padding-left:18px}.mantbl tr.mrow input[type=text]:not(.amt){width:80%}
@media (max-width:640px){.mantbl th.n,.mantbl td.n{width:110px}.man-tot{gap:10px}}
