:root {
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --text: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #1d4ed8;
  --brand-ink: #ffffff;
  --ok: #15803d; --ok-bg: #dcfce7;
  --warn: #a16207; --warn-bg: #fef3c7;
  --bad: #b91c1c; --bad-bg: #fee2e2;
  --info: #1d4ed8; --info-bg: #dbeafe;
  --free: #0f766e; --free-bg: #ccfbf1;
  --owner: #6d28d9; --owner-bg: #ede9fe;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .05);
  --font: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0b1020; --surface: #121a2e; --surface-2: #19223a; --text: #e5e9f2; --muted: #94a3b8; --line: #243049;
    --brand: #3b82f6;
    --ok: #4ade80; --ok-bg: #12301f; --warn: #fbbf24; --warn-bg: #352a0c; --bad: #f87171; --bad-bg: #3a1515;
    --info: #93c5fd; --info-bg: #172554; --free: #5eead4; --free-bg: #0f2f2c; --owner: #c4b5fd; --owner-bg: #2a1f4d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 6px 20px rgba(0, 0, 0, .25);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 var(--font); min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .4em; letter-spacing: -.01em; }
h1 { font-size: 26px; font-weight: 800; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 1em; }
.wrap { width: 100%; max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.main { flex: 1; padding-top: 24px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); font-size: .92em; }
.nowrap { white-space: nowrap; }
.pre { white-space: pre-line; }
.mt { margin-top: 22px; }
.right { text-align: right; }
.grow { flex: 1; min-width: 0; }
.bad { color: var(--bad); }

/* top bar */
.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.topbar-in { display: flex; align-items: center; gap: 20px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 16px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, #1d4ed8, #0f766e); color: #fff; font-size: 17px; }
.nav { display: flex; gap: 4px; flex: 1; }
.nav a { color: var(--muted); font-weight: 600; padding: 8px 12px; border-radius: 9px; white-space: nowrap; }
.nav a:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav a.on { color: var(--text); background: var(--surface-2); }
.nav-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; margin-left: 4px; border-radius: 10px; background: var(--bad); color: #fff; font-size: 11px; }
.nav-toggle { display: none; margin-left: auto; background: none; border: 1px solid var(--line); border-radius: 9px; width: 40px; height: 38px; font-size: 18px; color: var(--text); cursor: pointer; }
.me { position: relative; margin-left: auto; }
.me-btn { display: flex; align-items: center; gap: 8px; background: none; border: 1px solid var(--line); border-radius: 22px; padding: 3px 12px 3px 3px; cursor: pointer; color: var(--text); font: 600 14px var(--font); }
.me-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.me-menu { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 6px; }
.me-menu a, .me-menu button { display: block; width: 100%; text-align: left; padding: 9px 12px; border-radius: 8px; color: var(--text); background: none; border: 0; font: 500 14px var(--font); cursor: pointer; }
.me-menu a:hover, .me-menu button:hover { background: var(--surface-2); text-decoration: none; }
.me-head { padding: 10px 12px; border-bottom: 1px solid var(--line); margin-bottom: 4px; display: grid; gap: 2px; }
.me-head span { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex: none; }
.avatar.lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-txt { display: inline-grid; place-items: center; background: var(--info-bg); color: var(--info); font-weight: 700; font-size: 12px; }
.announce { background: var(--warn-bg); color: var(--warn); font-weight: 600; font-size: 14px; padding: 9px 0; }

/* footer */
.footer { border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.footer-in { display: flex; flex-wrap: wrap; gap: 10px 24px; justify-content: space-between; padding-top: 18px; padding-bottom: 18px; }
.footer-links { display: flex; gap: 18px; flex-wrap: wrap; }

/* building blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.cols > .card { margin-bottom: 0; }
.cols + .card, .cols + .cols { margin-top: 18px; }
.stack { display: grid; gap: 14px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.back { display: inline-block; margin-bottom: 14px; font-weight: 600; font-size: 14px; }
.section-title { margin: 28px 0 12px; display: flex; align-items: center; gap: 8px; }
.section-sub { margin-top: -6px; }
.count { font-size: 12px; background: var(--surface-2); color: var(--muted); border-radius: 10px; padding: 1px 8px; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 8px; vertical-align: 1px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--text); font: 600 14px var(--font); cursor: pointer; white-space: nowrap; text-decoration: none; }
.btn:hover { background: var(--surface-2); text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand); filter: brightness(1.08); }
.btn-danger { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 35%, var(--line)); }
.btn-danger:hover { background: var(--bad-bg); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 13px 22px; font-size: 16px; }
.btn-block { width: 100%; }

.tag { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.tag-ok { background: var(--ok-bg); color: var(--ok); }
.tag-warn { background: var(--warn-bg); color: var(--warn); }
.tag-bad { background: var(--bad-bg); color: var(--bad); }
.tag-muted { background: var(--surface-2); color: var(--muted); }
.tag-info { background: var(--info-bg); color: var(--info); }
.tag-free { background: var(--free-bg); color: var(--free); }
.tag-owner { background: var(--owner-bg); color: var(--owner); font-style: normal; }

.flash { padding: 12px 16px; border-radius: 11px; margin-bottom: 14px; font-size: 14px; border: 1px solid transparent; }
.flash-ok { background: var(--ok-bg); color: var(--ok); }
.flash-warn { background: var(--warn-bg); color: var(--warn); }
.flash-error { background: var(--bad-bg); color: var(--bad); }
.flash-info { background: var(--info-bg); color: var(--info); }
.flash a { color: inherit; font-weight: 700; text-decoration: underline; }

.field { display: grid; gap: 5px; font-size: 14px; }
.field > span { font-weight: 600; }
.field em { font-style: normal; color: var(--muted); font-size: 12px; font-weight: 400; }
.field > span em { color: var(--bad); margin-left: 4px; }
input, select, textarea { font: 14px var(--font); color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: 9px; padding: 9px 11px; width: 100%; min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 45%, transparent); outline-offset: 0; border-color: var(--brand); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--brand); }
input[type=color] { padding: 3px; height: 40px; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.inline-form label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.inline-form input[type=text] { flex: 1; min-width: 160px; }
.inline-form select, .inline-form input { width: auto; }
.inline { display: inline; }

/* tables */
.table-wrap { overflow-x: auto; margin: 0 -4px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tfoot th { font-size: 14px; text-transform: none; letter-spacing: 0; color: var(--text); border-top: 2px solid var(--line); border-bottom: 0; }
.table.compact td { padding: 7px 8px; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.table .btn + .btn, .table form + form { margin-left: 4px; }
.table td form.inline + form.inline { margin-left: 4px; }
.user-cell { display: flex; align-items: center; gap: 10px; color: var(--text); }
.user-cell > span { display: grid; }
.user-cell:hover { text-decoration: none; }

/* login */
.page-login .main { display: flex; align-items: center; }
.login { display: grid; grid-template-columns: 1.15fr .85fr; gap: 48px; align-items: center; width: 100%; padding: 24px 0; }
.login h1 { font-size: clamp(28px, 4vw, 42px); line-height: 1.12; }
.eyebrow { color: var(--brand); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; font-size: 12px; margin-bottom: 10px; }
.lead { font-size: 17px; color: var(--muted); max-width: 560px; }
.login-apps { list-style: none; padding: 0; margin: 22px 0 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.login-apps li { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14px; }
.login-card { padding: 30px; }
.btn-google { display: flex; align-items: center; justify-content: center; gap: 12px; width: 100%; padding: 13px 18px; margin: 18px 0; border-radius: 11px; border: 1px solid var(--line); background: #fff; color: #1f2937; font: 700 15px var(--font); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.btn-google:hover { text-decoration: none; background: #f8fafc; }
.ticks { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 9px; font-size: 14px; }
.ticks li { padding-left: 24px; position: relative; color: var(--muted); }
.ticks li::before { content: '✓'; position: absolute; left: 0; color: var(--ok); font-weight: 800; }
.ticks b { color: var(--text); }
.fine { font-size: 12px; color: var(--muted); margin: 0; }

/* app cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 16px; }
.app-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; position: relative; overflow: hidden; }
.app-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--accent); }
.app-card h3 { font-size: 17px; margin: 10px 0 2px; }
.app-card p { color: var(--muted); font-size: 14px; flex: 1; }
.app-card.locked { box-shadow: none; }
.app-card.locked .app-icon { filter: grayscale(.4); opacity: .85; }
.app-card-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.app-card-meta { display: grid; justify-items: end; gap: 6px; }
.cat { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); font-weight: 700; }
.app-card-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.app-icon { display: grid; place-items: center; width: 46px; height: 46px; border-radius: 13px; background: var(--accent); color: #fff; font-weight: 800; font-size: 16px; letter-spacing: -.02em; flex: none; box-shadow: inset 0 -3px 0 rgba(0,0,0,.15); }
.app-icon.sm { width: 32px; height: 32px; border-radius: 9px; font-size: 12px; }

/* request page */
.request { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 18px; align-items: start; }
.request-app { display: flex; gap: 16px; align-items: center; margin-bottom: 18px; }
.request-app h1 { margin: 0; }
.request-app p { margin: 0; }
.step { display: flex; align-items: center; gap: 10px; margin: 24px 0 12px; }
.step span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; font-size: 13px; }
.plans { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.plan { position: relative; cursor: pointer; }
.plan input { position: absolute; opacity: 0; }
.plan-body { display: grid; gap: 2px; padding: 16px; border: 2px solid var(--line); border-radius: 12px; transition: border-color .15s, background .15s; }
.plan input:checked + .plan-body { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 7%, var(--surface)); }
.plan input:focus-visible + .plan-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.plan-price { font-size: 24px; font-weight: 800; }
.pay-online { display: grid; gap: 8px; justify-items: start; }
.pay-manual { margin-top: 18px; border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; }
.pay-manual summary { cursor: pointer; font-weight: 700; }
.pay-manual[open] summary { margin-bottom: 14px; }
.pay-manual .field { margin-bottom: 12px; }
.pay-manual-grid { display: grid; gap: 14px; margin-bottom: 14px; }
.upi { display: flex; gap: 18px; align-items: center; flex-wrap: wrap; }
.qr { background: #fff; padding: 8px; border-radius: 10px; border: 1px solid var(--line); min-width: 186px; min-height: 186px; }
.kv { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.kv > span { color: var(--muted); width: 64px; font-size: 13px; }
.bank pre { margin: 6px 0 0; font: 14px var(--mono); background: var(--surface-2); padding: 12px; border-radius: 9px; white-space: pre-wrap; }
.request-side .card h3 { margin-bottom: 12px; }

/* account */
.profile { display: flex; gap: 14px; align-items: center; margin-bottom: 18px; }
.profile h1 { font-size: 22px; margin: 0 0 2px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.meter { height: 10px; background: var(--surface-2); border-radius: 6px; overflow: hidden; margin: 10px 0 6px; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, #1d4ed8, #0f766e); }

/* admin */
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.subnav a { padding: 10px 14px; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.subnav a:hover { color: var(--text); text-decoration: none; }
.subnav a.on { color: var(--text); border-bottom-color: var(--brand); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; display: grid; gap: 2px; box-shadow: var(--shadow); }
.stat span { color: var(--muted); font-size: 13px; font-weight: 600; }
.stat b { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.stat em { font-style: normal; color: var(--muted); font-size: 13px; }
.stat-alert { border-color: var(--warn); background: var(--warn-bg); }
.req-row { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.req-row:last-child { border-bottom: 0; }
.req-actions { display: flex; gap: 6px; align-items: flex-start; }
.req-card-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.req-what { margin-top: 4px; font-size: 15px; }
.req-detail { display: flex; flex-wrap: wrap; gap: 6px 22px; color: var(--muted); font-size: 13px; margin: 12px 0; }
.req-forms { display: grid; gap: 10px; padding-top: 12px; border-top: 1px solid var(--line); }
.pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.pills a { padding: 7px 13px; border-radius: 20px; border: 1px solid var(--line); background: var(--surface); color: var(--muted); font-weight: 600; font-size: 13px; }
.pills a span { margin-left: 4px; opacity: .7; }
.pills a.on { background: var(--text); color: var(--surface); border-color: var(--text); }
.pills a:hover { text-decoration: none; }
.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.search { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search input[type=search] { width: 280px; }
.search select, .search input[type=date] { width: auto; }
.search label { display: flex; gap: 6px; align-items: center; font-size: 13px; color: var(--muted); }
.add-user { position: relative; }
.add-user summary { list-style: none; }
.add-user summary::-webkit-details-marker { display: none; }
.add-user[open] > form { position: absolute; right: 0; top: calc(100% + 8px); width: min(360px, 90vw); z-index: 5; }
.user-head { display: grid; gap: 14px; }
.user-head .profile { margin: 0; }
.user-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.note-form input[type=text] { min-width: 240px; }
.grant-form { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.grant-form select { width: auto; max-width: 270px; }
.grant-form input { width: 120px; padding: 6px 9px; font-size: 13px; }
.grant-form select { padding: 6px 9px; font-size: 13px; }
.access-table td { vertical-align: middle; }
.app-admin-head { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.app-admin-head h2 { margin: 0; }
.app-admin .tags { display: flex; gap: 6px; align-items: center; }
.app-admin details { margin: 14px 0; }
.app-admin summary { cursor: pointer; font-weight: 600; color: var(--brand); }
.app-admin h3 { margin-top: 14px; }
.grid-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 12px; }
.grid-form .wide { grid-column: 1 / -1; }
.plans-table input { padding: 6px 8px; font-size: 13px; }
.plans-table input[type=number] { width: 100px; }
.new-row td { background: var(--surface-2); }
.total { font-size: 15px; }
.pager { display: flex; gap: 6px; flex-wrap: wrap; margin: 6px 0 20px; }
.pager a, .pager span { min-width: 34px; height: 34px; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13px; padding: 0 8px; }
.pager a.on { background: var(--brand); color: #fff; border-color: var(--brand); }
.pager span { border: 0; background: none; }
.checks td:first-child { font-weight: 600; }
.prose { max-width: 780px; }
.prose h2 { margin-top: 1.2em; }

/* receipt */
.receipt-page { background: var(--bg); padding: 24px 16px; display: block; }
.receipt { max-width: 760px; margin: 0 auto; padding: 36px; }
.receipt-head { display: flex; justify-content: space-between; gap: 20px; flex-wrap: wrap; border-bottom: 2px solid var(--line); padding-bottom: 18px; margin-bottom: 18px; }
.receipt-head h1 { font-size: 22px; margin-bottom: 4px; }
.receipt-head h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.receipt-to { display: grid; gap: 2px; margin-bottom: 18px; }
.noprint { margin-top: 22px; display: flex; gap: 8px; }
@media print {
  .noprint { display: none; }
  .receipt-page { background: #fff; padding: 0; }
  .receipt { box-shadow: none; border: 0; }
}

/* small screens */
@media (max-width: 900px) {
  .cols, .request, .login { grid-template-columns: minmax(0, 1fr); }
  .login { gap: 24px; }
  .nav { display: none; position: absolute; top: 62px; left: 0; right: 0; background: var(--surface); border-bottom: 1px solid var(--line); flex-direction: column; padding: 8px 16px 14px; }
  .nav.open { display: flex; }
  .nav-toggle { display: block; }
  .me { margin-left: 0; }
  .me-name { display: none; }
  .me-btn { padding: 3px; }
  .grid-form { grid-template-columns: minmax(0, 1fr); }
  .search input[type=search] { width: 100%; }
}
@media (max-width: 560px) {
  h1 { font-size: 22px; }
  .card { padding: 16px; }
  .brand-name { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }
  .login-apps { grid-template-columns: minmax(0, 1fr); }
  .req-row { flex-direction: column; }
  .receipt { padding: 20px; }
}
