:root {
  --bg: #f6f8f3; --surface: #ffffff; --line: #e1e6dc; --text: #1d2a1f; --muted: #5f6d62;
  --brand: #2e7d32; --brand-ink: #ffffff; --brand-soft: #e3f1e3;
  --warn: #9a6700; --warn-soft: #fff4d6; --bad: #b3261e; --bad-soft: #fde7e5; --ok: #1b6e2a;
  --radius: 10px;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Telugu", sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.error { color: var(--bad); min-height: 1.2em; }
button, .btn { font: inherit; border: 1px solid var(--brand); background: var(--brand); color: var(--brand-ink);
  padding: 7px 14px; border-radius: 8px; cursor: pointer; }
button:disabled { opacity: .5; cursor: wait; }
button.secondary { background: var(--surface); color: var(--brand); }
button.danger { background: var(--surface); color: var(--bad); border-color: var(--bad); }
button.link { background: none; border: none; color: var(--brand); padding: 4px; text-decoration: underline; }
button.icon { background: none; border: none; color: var(--text); font-size: 22px; padding: 4px 8px; }
input, select, textarea { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--text); }
textarea { width: 100%; min-height: 160px; font-family: ui-monospace, Consolas, monospace; font-size: 13px; }
label { display: grid; gap: 6px; margin-bottom: 12px; font-weight: 600; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 28px; }
.login-card .brand { margin-bottom: 20px; }
.login-card button[type=submit] { width: 100%; padding: 10px; }

/* shell */
.brand { font-weight: 800; font-size: 19px; color: var(--brand); }
.brand span { color: var(--muted); font-weight: 600; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 10px 20px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .who { margin-left: auto; color: var(--muted); }
#menu-toggle { display: none; }
#app { display: grid; grid-template-columns: 210px 1fr; grid-template-rows: auto 1fr; min-height: 100vh; }
.topbar { grid-column: 1 / -1; }
nav { padding: 14px 10px; border-right: 1px solid var(--line); background: var(--surface); }
nav a { display: flex; justify-content: space-between; padding: 9px 12px; border-radius: 8px; color: var(--text); text-decoration: none; margin-bottom: 2px; }
nav a:hover { background: var(--bg); }
nav a.active { background: var(--brand-soft); color: var(--brand); font-weight: 700; }
.badge { background: var(--bad); color: #fff; border-radius: 99px; font-size: 12px; padding: 0 7px; }
.badge:empty { display: none; }
main { padding: 24px; min-width: 0; }
h1 { margin: 0 0 16px; font-size: 22px; }
h2 { font-size: 17px; margin: 24px 0 10px; }

/* blocks */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; }
.card .v { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; }
.card .k { color: var(--muted); font-size: 13px; }
.card.alert .v { color: var(--bad); }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs button { background: var(--surface); color: var(--text); border-color: var(--line); }
.tabs button.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font-size: 13px; color: var(--muted); font-weight: 600; background: #fafbf8; white-space: nowrap; }
tr:last-child td { border-bottom: none; }
td.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td .actions { display: flex; gap: 6px; flex-wrap: wrap; }
.pill { display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: var(--bg); border: 1px solid var(--line); white-space: nowrap; }
.pill.PENDING, .pill.OPEN, .pill.REQUESTED { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pill.VERIFIED, .pill.APPROVED, .pill.COMPLETED, .pill.RESOLVED, .pill.CONFIRMED { background: var(--brand-soft); color: var(--ok); border-color: transparent; }
.pill.REJECTED, .pill.SUSPENDED, .pill.CANCELLED, .pill.DISPUTED, .pill.HIDDEN { background: var(--bad-soft); color: var(--bad); border-color: transparent; }
.pill.demo { background: #eef; color: #335; }
.empty { padding: 28px; text-align: center; color: var(--muted); }
.note { background: var(--warn-soft); border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
pre { white-space: pre-wrap; word-break: break-word; margin: 0; font-size: 13px; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--text); color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 50; max-width: 90vw; }
.toast.bad { background: var(--bad); }

@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; }
  #menu-toggle { display: block; }
  nav { display: none; border-right: none; border-bottom: 1px solid var(--line); }
  nav.open { display: block; }
  main { padding: 16px; }
  .topbar .who span { display: none; }
}
