/* SAP Practice Manager - styles. Same family as saptax.lk: logo green, a touch of gold. */
:root {
  --green-950: #062B15; --green-900: #0A3D1C; --green-800: #0D4F25; --green-700: #0F5E2D; --green-600: #157239;
  --green-100: #E3EFE6; --green-50: #F1F7F2;
  --gold: #C9961F; --gold-600: #A97C14; --gold-50: #FBF5E4;
  --ink: #16211A; --text: #2B3630; --muted: #5F6B64; --line: #E4E8E4; --bg: #F7F8F6; --surface: #FFFFFF;
  --ok: #1F7A4D; --ok-bg: #E3F3EA; --warn: #8A5A00; --warn-bg: #FBF0DC; --bad: #B0302B; --bad-bg: #FBE7E5;
  --font-display: "Libre Baskerville", Georgia, "Times New Roman", serif;
  --font-body: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, monospace;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(10,30,18,.05), 0 10px 30px -14px rgba(10,30,18,.22);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 15px/1.6 var(--font-body); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--green-700); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { color: var(--green-950); margin: 0; line-height: 1.25; text-wrap: balance; }
h1 { font-family: var(--font-display); font-size: 1.7rem; }
h2 { font-size: 1.05rem; font-weight: 700; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
[hidden] { display: none !important; }
.num { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100%; }
.side { background: var(--green-950); color: #CFE0D4; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; color: #fff; text-decoration: none; }
.side .brand img { width: 34px; height: 34px; }
.side .brand b { font-family: var(--font-display); font-size: 1.05rem; display: block; line-height: 1.1; }
.side .brand span { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: var(--gold); }
.side nav { padding: 8px 10px 16px; display: grid; gap: 2px; }
.side .grp { font-size: .68rem; letter-spacing: .16em; text-transform: uppercase; color: #7FA08A; padding: 14px 10px 4px; }
.side a.nav { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; color: #DCE9E0; text-decoration: none; font-weight: 500; }
.side a.nav svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.side a.nav:hover { background: rgba(255,255,255,.06); }
.side a.nav.on { background: var(--green-800); color: #fff; box-shadow: inset 3px 0 0 var(--gold); }
.side a.nav.soon { color: #7FA08A; }
.side a.nav .tag { margin-left: auto; font-size: .65rem; border: 1px solid #335a40; border-radius: 999px; padding: 0 6px; color: #9CB8A5; }
.side .who { margin-top: auto; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); font-size: .85rem; }
.side .who b { color: #fff; display: block; }
.side .who button { background: none; border: 0; color: var(--gold); padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

.main { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; background: rgba(247,248,246,.94); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 10px 28px; }
.top .menu { display: none; }
.search { position: relative; flex: 1; max-width: 520px; }
.search input { width: 100%; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; padding: 9px 12px 9px 36px; }
.search svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted); }
.search .results { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); max-height: 60vh; overflow: auto; }
.search .results a { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; text-decoration: none; color: var(--ink); border-bottom: 1px solid var(--line); }
.search .results a:last-child { border-bottom: 0; }
.search .results a:hover, .search .results a.hi { background: var(--green-50); }
.top .spacer { flex: 1; }
.content { padding: 24px 28px 64px; max-width: 1240px; width: 100%; }

/* ---------- common ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 9px 16px; border-radius: 9px; border: 1.5px solid transparent; font-weight: 700; font-size: .9rem; cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2; }
.btn svg { width: 16px; height: 16px; }
.btn.primary { background: var(--green-800); color: #fff; }
.btn.primary:hover { background: var(--green-900); }
.btn.gold { background: var(--gold); color: #fff; }
.btn.ghost { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.ghost:hover { border-color: var(--green-600); }
.btn.danger { background: var(--surface); border-color: #E7C2BF; color: var(--bad); }
.btn.link { background: none; border: 0; padding: 0; color: var(--green-700); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
.btn:disabled { opacity: .55; cursor: default; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 12px 20px; margin-bottom: 20px; }
.page-head p { margin: 4px 0 0; color: var(--muted); }
.eyebrow { font-size: .72rem; font-weight: 700; letter-spacing: .16em; text-transform: uppercase; color: var(--gold-600); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; }
.card h2 { margin-bottom: 10px; }
.grid { display: grid; gap: 16px; }
.grid + .grid { margin-top: 16px; }
.g2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.g4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; display: block; }
a.tile:hover { border-color: var(--green-600); }
.tile .n { font-family: var(--font-display); font-size: 1.9rem; color: var(--green-900); line-height: 1.1; }
.tile .l { color: var(--muted); font-size: .85rem; }
.pill { display: inline-flex; align-items: center; gap: 4px; font-size: .74rem; font-weight: 700; padding: 1px 8px; border-radius: 999px; white-space: nowrap; background: var(--green-100); color: var(--green-800); }
.pill.gold { background: var(--gold-50); color: var(--gold-600); }
.pill.warn { background: var(--warn-bg); color: var(--warn); }
.pill.bad { background: var(--bad-bg); color: var(--bad); }
.pill.grey { background: #EEF0EE; color: var(--muted); }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.list { display: grid; }
.list > * { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.list > *:last-child { border-bottom: 0; }
a.row-link { text-decoration: none; color: var(--ink); }
a.row-link:hover b { color: var(--green-700); text-decoration: underline; }
.bar { height: 8px; background: var(--green-50); border-radius: 999px; overflow: hidden; flex: 1; min-width: 60px; }
.bar i { display: block; height: 100%; background: var(--green-600); border-radius: 999px; }

/* table */
.tbl-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
th { font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 700; background: #FAFBFA; position: sticky; top: 0; }
tr:last-child td { border-bottom: 0; }
tbody tr.click { cursor: pointer; }
tbody tr.click:hover td { background: var(--green-50); }
.sub { display: block; color: var(--muted); font-size: .8rem; font-weight: 400; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 12px; }
.toolbar input, .toolbar select, .field input, .field select, .field textarea {
  border: 1px solid #D5DCD6; background: var(--surface); border-radius: 9px; padding: 8px 11px; min-width: 0; }
.toolbar input { flex: 1; min-width: 200px; max-width: 340px; }
.field textarea { resize: vertical; min-height: 80px; }
.toolbar .count { margin-left: auto; color: var(--muted); font-size: .85rem; }

/* client page */
.client-head { display: flex; flex-wrap: wrap; gap: 14px 24px; align-items: flex-start; justify-content: space-between; margin-bottom: 16px; }
.client-head h1 { font-size: 1.6rem; }
.client-head .meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.client-head .acts { display: flex; flex-wrap: wrap; gap: 8px; }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; margin-bottom: 18px; }
.summary > div { background: var(--surface); padding: 12px 16px; min-width: 0; }
.summary .k { font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.summary .v { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); font-weight: 600; border-bottom: 2.5px solid transparent; white-space: nowrap; }
.tabs a.on { color: var(--green-900); border-bottom-color: var(--gold); }
.tabs a .c { font-size: .75rem; color: var(--muted); margin-left: 4px; }
dl.details { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 8px 16px; margin: 0; }
dl.details dt { color: var(--muted); }
dl.details dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }
.cred { display: grid; gap: 12px; }
.cred .card { display: grid; gap: 10px; }
.cred .top-line { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; align-items: center; }
.secret { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; background: var(--green-50); border: 1px dashed #BFD6C6; border-radius: 9px; padding: 10px 12px; }
.secret .val { font-family: var(--mono); font-size: 1.05rem; letter-spacing: .08em; color: var(--green-950); flex: 1; min-width: 140px; overflow-wrap: anywhere; }
.secret.shown { background: var(--gold-50); border-color: var(--gold); }
.timer { font-size: .8rem; color: var(--gold-600); font-weight: 700; }
.timeline { display: grid; }
.timeline > div { display: grid; grid-template-columns: 150px minmax(0,1fr); gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.timeline > div:last-child { border-bottom: 0; }
.empty { text-align: center; padding: 28px 16px; color: var(--muted); }
.empty b { display: block; color: var(--ink); margin-bottom: 4px; }
.note { background: var(--gold-50); border: 1px solid #EBD9A8; border-radius: var(--radius-sm); padding: 10px 14px; font-size: .9rem; }
.note.bad { background: var(--bad-bg); border-color: #EBC4C1; }
.note.ok { background: var(--ok-bg); border-color: #BEE0CB; }

/* forms & modal */
.form { display: grid; gap: 12px; }
.form .row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; }
.field { display: grid; gap: 4px; min-width: 0; }
.field label, .field .lbl { font-size: .82rem; font-weight: 700; color: var(--ink); }
.field .hint { font-size: .78rem; color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.checks label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; }
.modal-bg { position: fixed; inset: 0; background: rgba(6,43,21,.45); z-index: 50; display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px 16px; overflow-y: auto; }
.modal { background: var(--surface); border-radius: 14px; width: 100%; max-width: 640px; box-shadow: 0 30px 80px -20px rgba(0,0,0,.4); }
.modal.narrow { max-width: 440px; }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal header button { background: none; border: 0; font-size: 1.4rem; line-height: 1; cursor: pointer; color: var(--muted); }
.modal .body { padding: 18px 20px; }
.modal footer { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--line); background: #FAFBFA; border-radius: 0 0 14px 14px; }
.err { color: var(--bad); font-size: .88rem; font-weight: 600; }
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--green-950); color: #fff; padding: 10px 18px; border-radius: 10px; z-index: 60; box-shadow: var(--shadow); font-weight: 600; }
.toast.bad { background: var(--bad); }

/* sign-in */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background: radial-gradient(1200px 600px at 10% -10%, var(--green-100), transparent), var(--bg); }
.auth .box { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow); padding: 28px; }
.auth .logo { width: 220px; margin: 0 auto 18px; display: block; }
.auth h1 { font-size: 1.3rem; text-align: center; margin-bottom: 4px; }
.auth p.sub { text-align: center; color: var(--muted); margin: 0 0 18px; font-size: .9rem; }
.auth .qr { display: grid; place-items: center; margin: 8px 0; }
.auth .qr img { width: 180px; height: 180px; }
.loading { display: grid; place-items: center; min-height: 40vh; color: var(--muted); }

@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .side { position: fixed; inset: 0 auto 0 0; width: 260px; z-index: 40; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; box-shadow: 0 0 0 100vmax rgba(6,43,21,.4); }
  .top { padding: 10px 16px; }
  .top .menu { display: inline-flex; }
  .content { padding: 18px 16px 48px; }
  dl.details { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  dl.details dd { margin-bottom: 8px; }
  .timeline > div { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .hide-sm { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
