:root {
  --bg: #f3f3f5; --panel: #fff; --ink: #141414; --ink-2: #3f3f46; --muted: #8a8a93; --line: #ececef; --line-2: #e2e2e6;
  --accent: #141414; --accent-ink: #fff; --soft: #f5f5f7;
  --orange: #e8743b; --pink: #d9577f; --green: #4fae7b; --purple: #7c73e6;
  --pink-soft: #f7e6ec; --neg: #e5484d; --ok: #2f9e62;
  --radius: 16px;
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans Devanagari", "Kohinoor Devanagari", sans-serif;
  font-size: 14px; color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: inherit; text-decoration: none; }
h1 { font-size: 22px; font-weight: 600; letter-spacing: -.01em; margin: 0; }
h2 { font-size: 15px; font-weight: 600; margin: 0; }
h3 { font-size: 14px; font-weight: 600; margin: 14px 0 8px; }
.muted { color: var(--muted); } .small { font-size: 12px; } .nowrap { white-space: nowrap; } .pre { white-space: pre-wrap; }
.center { text-align: center; } .num { text-align: right; font-variant-numeric: tabular-nums; }
.neg { color: var(--neg) !important; } .ok { color: var(--ok); }
.row-between { display: flex; justify-content: space-between; gap: 8px; }

/* ---------- App shell: sidebar + content ---------- */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--panel); border-right: 1px solid var(--line); padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; scrollbar-width: thin; }
.side-brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: -.02em; padding: 4px 8px 12px; }
.logo-mark { width: 34px; height: 34px; border-radius: 10px; background: var(--ink); display: grid; place-items: center; flex: none; }
.logo-mark span { width: 14px; height: 14px; border: 3px solid #fff; border-radius: 50%; }
.side-group { display: flex; flex-direction: column; gap: 1px; padding: 8px 0; border-top: 1px solid var(--line); }
.side-group:first-of-type { border-top: 0; }
.side-title { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 4px 10px 6px; }
.side-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--ink-2); font-weight: 500; }
.side-link:hover { background: var(--soft); }
.side-link.active { background: var(--ink); color: #fff; }
.side-link .ico { width: 20px; height: 20px; display: grid; place-items: center; font-size: 13px; border-radius: 6px; background: var(--soft); color: var(--ink-2); flex: none; }
.side-link.active .ico { background: rgba(255,255,255,.14); color: #fff; }
.side-link .lbl { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: var(--neg); color: #fff; font-size: 11px; font-weight: 600; display: grid; place-items: center; }
.side-foot { margin-top: auto; padding-top: 12px; }
.side-tenant { display: flex; flex-direction: column; gap: 2px; padding: 10px 12px; background: var(--soft); border-radius: 12px; font-size: 13px; }
.side-tenant span { color: var(--muted); font-size: 12px; }

.content { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 12px 24px; background: rgba(243,243,245,.88); backdrop-filter: blur(10px); }
.crumb { display: flex; gap: 8px; align-items: center; font-size: 14px; min-width: 0; white-space: nowrap; overflow: hidden; }
.crumb .sep { color: var(--line-2); }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.search { display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; color: var(--muted); height: 38px; }
.search input { border: 0; padding: 0; width: 160px; outline: none; background: transparent; }

/* Themed dropdowns (details/summary popovers) */
.dd { position: relative; }
.dd > summary { list-style: none; cursor: pointer; }
.dd > summary::-webkit-details-marker { display: none; }
.dd-btn { display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; font-weight: 500; max-width: 260px; }
.dd-btn:hover, .dd[open] > .dd-btn { border-color: var(--line-2); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.dd-ico { width: 22px; height: 22px; border-radius: 6px; background: var(--soft); display: grid; place-items: center; font-size: 12px; flex: none; }
.dd-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chev { width: 8px; height: 8px; border-right: 1.5px solid var(--muted); border-bottom: 1.5px solid var(--muted); transform: rotate(45deg) translateY(-2px); flex: none; margin-left: 2px; transition: transform .15s; }
.dd[open] .chev { transform: rotate(-135deg) translate(-2px, 0); }
.dd-pop { position: absolute; left: 0; top: calc(100% + 6px); min-width: 260px; max-height: 60vh; overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: 0 16px 40px rgba(20,20,20,.12); padding: 6px; z-index: 40; display: flex; flex-direction: column; gap: 1px; }
.dd-pop.narrow { min-width: 180px; }
.dd-pop.right { left: auto; right: 0; }
.dd-head { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 8px 10px 6px; }
.dd-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 9px; background: none; border: 0; font: inherit; color: var(--ink); cursor: pointer; width: 100%; text-align: left; justify-content: flex-start; }
.dd-opt:hover { background: var(--soft); }
.dd-opt.sel { background: var(--soft); font-weight: 600; }
.dd-opt.sel::after { content: "✓"; margin-left: auto; color: var(--ink); }
.dd-opt.add { color: var(--muted); border-top: 1px solid var(--line); border-radius: 0 0 9px 9px; margin-top: 4px; }
.dd-av { width: 26px; height: 26px; border-radius: 8px; background: var(--ink); color: #fff; display: grid; place-items: center; font-size: 12px; font-weight: 600; flex: none; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, #2b2b2b, #5b5b64); color: #fff; display: grid; place-items: center; font-weight: 600; }
.menu-head { display: flex; flex-direction: column; gap: 2px; padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.seg-mini { display: flex; gap: 2px; background: var(--soft); border-radius: 10px; padding: 3px; margin: 6px 4px; }
.seg-mini a { flex: 1; text-align: center; padding: 6px; border-radius: 8px; color: var(--muted); font-size: 13px; }
.seg-mini a.active { background: var(--panel); color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.form-pop { min-width: 240px; padding: 12px; gap: 10px; }
.sep-top { border-top: 1px solid var(--line); padding-top: 10px; }
.inline-act > summary.btn { list-style: none; }

/* Native selects, themed to match */
select { appearance: none; -webkit-appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M3 4.5l3 3 3-3' fill='none' stroke='%238a8a93' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; background-size: 12px; }
select:hover { border-color: #cfcfd6; }
option { font: inherit; }

.main { padding: 8px 24px 40px; max-width: 1440px; }

/* ---------- Cards & grids ---------- */
.card { background: var(--panel); border-radius: var(--radius); padding: 20px; margin-bottom: 16px; border: 1px solid transparent; }
.card.flush { padding: 0; overflow: auto; }
.card .pad, .card-head.pad { padding: 18px 20px 6px; }
.card h2 + p { margin: 4px 0 0; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 14px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid-4 .card, .grid-main .card, .grid-3 .card { margin-bottom: 0; }
.grid-main { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.grid2 { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: start; }
.banner { background: #fff7ed; border-radius: 12px; padding: 12px 16px; margin-bottom: 16px; display: flex; gap: 12px; align-items: center; }
.empty-state { text-align: center; padding: 60px 20px; display: flex; flex-direction: column; align-items: center; gap: 10px; }

/* Stat cards with tick bars */
.stat-card { display: flex; flex-direction: column; gap: 6px; transition: border-color .15s; }
a.stat-card:hover { border-color: var(--line-2); }
.stat-top { display: flex; justify-content: space-between; font-weight: 500; }
.dots { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; color: var(--ink-2); font-size: 14px; }
.stat-value { font-size: 28px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; margin: 2px 0 4px; }
.stat-sub { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }
.ticks { --p: 0%; --c: var(--orange); position: relative; height: 22px; margin-top: 4px;
  background: repeating-linear-gradient(90deg, #e4e4e8 0 2px, transparent 2px 5px); }
.ticks i { position: absolute; inset: 0 auto 0 0; width: var(--p);
  background: repeating-linear-gradient(90deg, var(--c) 0 2px, transparent 2px 5px); }

/* Legacy stat tiles (inner pages) */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 16px; }
.stat { background: var(--panel); border-radius: 14px; padding: 16px; color: var(--muted); font-size: 12px; display: flex; flex-direction: column; gap: 2px; }
.stat span { font-size: 20px; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; }
a.stat:hover { box-shadow: inset 0 0 0 1px var(--line-2); }
.stat.warn span { color: var(--orange); }

/* Bar chart */
.legend { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12px; flex-wrap: wrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-left: 6px; }
.dot.sales { background: var(--pink); } .dot.purchases { background: #b9b3f3; } .dot.grey { background: #e4e4e8; }
.chart { display: grid; grid-template-columns: 40px 1fr; gap: 8px; height: 250px; }
.chart-axis { display: flex; flex-direction: column; justify-content: space-between; padding-bottom: 22px; color: var(--muted); font-size: 11px; }
.chart-bars { display: grid; grid-template-columns: repeat(12, 1fr); gap: 8px; align-items: end; }
.bar-col { display: flex; flex-direction: column; align-items: center; height: 100%; position: relative; }
.bars { flex: 1; width: 100%; display: flex; align-items: flex-end; gap: 3px; border-radius: 10px; background: #faf5f7; padding: 0; overflow: hidden; }
.bar { flex: 1; border-radius: 8px 8px 0 0; min-height: 2px; transition: height .3s; }
.bar.sales { background: #f1d3de; } .bar.purchases { background: #e1def9; }
.bar-col.current .bar.sales { background: linear-gradient(180deg, var(--pink), #f3c0d1); }
.bar-col.current .bar.purchases { background: linear-gradient(180deg, var(--purple), #d6d2f8); }
.bar-label { margin-top: 8px; font-size: 11px; color: var(--muted); background: var(--soft); padding: 2px 7px; border-radius: 999px; white-space: nowrap; }
.bar-tip { position: absolute; top: -6px; left: 50%; transform: translate(-50%, -100%); background: var(--ink); color: #fff; font-size: 11px; padding: 3px 8px; border-radius: 6px; white-space: nowrap; z-index: 2; }

/* Distribution */
.dist { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; height: 250px; align-items: end; }
.dist-col { display: flex; flex-direction: column; align-items: center; height: 100%; justify-content: flex-end; gap: 4px; text-align: center; }
.dist-col strong { font-size: 20px; font-weight: 600; margin-bottom: 8px; }
.dist-bar { width: 100%; border-radius: 10px 10px 4px 4px; }
.dist-bar.orange { background: linear-gradient(180deg, #f08a55, #fde3d3); }
.dist-bar.green { background: linear-gradient(180deg, #5bb888, #d7f0e2); }
.dist-bar.purple { background: linear-gradient(180deg, #8f86ef, #e3e0fb); }

/* People insights */
.people-list { display: flex; flex-direction: column; gap: 14px; }
.person-row { display: grid; grid-template-columns: 40px minmax(0, 1fr) minmax(0, 1.1fr); gap: 12px; align-items: center; }
.person-name { display: flex; flex-direction: column; min-width: 0; }
.person-name strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-ph { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 600; color: #fff; }
.c0 { --c: var(--orange); } .c1 { --c: var(--green); } .c2 { --c: var(--purple); } .c3 { --c: var(--pink); }
.avatar-ph.c0 { background: linear-gradient(135deg, #f5a47a, var(--orange)); } .avatar-ph.c1 { background: linear-gradient(135deg, #8fd3ad, var(--green)); }
.avatar-ph.c2 { background: linear-gradient(135deg, #b3adf5, var(--purple)); } .avatar-ph.c3 { background: linear-gradient(135deg, #eca0b9, var(--pink)); }
.hbar { height: 12px; background: #efeff2; border-radius: 4px; overflow: hidden; margin-bottom: 4px; }
.hbar i { display: block; height: 100%; background: var(--c); border-radius: 4px; }

/* Gauge */
.gauge { position: relative; max-width: 260px; margin: 0 auto; }
.gauge svg { width: 100%; display: block; }
.gauge-value { position: absolute; left: 0; right: 0; bottom: 4px; display: flex; flex-direction: column; align-items: center; }
.gauge-value strong { font-size: 26px; font-weight: 600; }
.trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 14px; text-align: center; }
.trio > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.trio strong { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Company card */
.pager { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.pager-btn { width: 28px; height: 28px; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; }
.pager-btn.disabled { opacity: .35; pointer-events: none; }
.company-card { display: grid; grid-template-columns: 52px 1fr auto; gap: 12px; align-items: center; margin-bottom: 14px; }
.big-name { font-size: 17px; font-weight: 600; display: block; }
.icon-btn { width: 32px; height: 32px; border: 1px solid var(--line); border-radius: 8px; display: grid; place-items: center; }
.capbar { height: 12px; border-radius: 4px; background: #efeff2; overflow: hidden; margin: 6px 0; }
.capbar i { display: block; height: 100%; background: linear-gradient(90deg, #f3c0d1, var(--pink)); border-radius: 4px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 14px 0 0; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; text-align: right; font-weight: 500; }

/* Page head (inner pages) */
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin: 8px 0 18px; flex-wrap: wrap; }
.title-block { display: flex; gap: 14px; align-items: center; }
.logo { width: 52px; height: 52px; object-fit: contain; border-radius: 12px; background: #fff; }
.logo-ph { width: 44px; height: 44px; border-radius: 12px; background: var(--ink); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 18px; }
.logo-ph.big { width: 52px; height: 52px; font-size: 22px; }
.crumbs { font-size: 12px; color: var(--muted); }
.segmented { display: flex; background: #e9e9ec; border-radius: 12px; padding: 3px; gap: 2px; overflow-x: auto; }
.segmented a { padding: 7px 12px; border-radius: 9px; color: var(--ink-2); white-space: nowrap; font-weight: 500; font-size: 13px; }
.segmented a.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.alert { background: #fdecec; color: #b42318; padding: 12px 16px; border-radius: 12px; margin-bottom: 16px; }
.alert pre { margin: 6px 0 0; white-space: pre-wrap; font-size: 12px; }
.pill { display: inline-block; font-size: 11px; font-weight: 500; padding: 3px 9px; border-radius: 999px; background: var(--soft); color: var(--ink-2); white-space: nowrap; }
.pill.active, .pill.resolved, .pill.signed_off { background: #e3f5ea; color: var(--ok); }
.pill.inactive, .pill.struck_off, .pill.liquidating { background: #f1f1f3; color: var(--muted); }
.pill.open { background: #fff1e7; color: #c2571f; }
.pill.responded, .pill.fieldwork, .pill.review { background: #ecebfc; color: #5b52d1; }
.pill.sale { background: var(--pink-soft); color: #b83a63; } .pill.purchase { background: #ecebfc; color: #5b52d1; }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 16px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.table th { font-size: 12px; color: var(--muted); font-weight: 500; }
.table tr:last-child td { border-bottom: 0; }
.table th.num, .table td.num { text-align: right; }
.table tfoot th, .table tfoot td { background: #fafafb; border-bottom: 0; }
.table.hover tr:hover td { background: #fafafb; cursor: pointer; }
.table .empty { color: var(--muted); text-align: center; padding: 36px; }
tr.dim td { opacity: .55; } tr.warn-row td { background: #fff7ed; }
.lines input, .lines select { width: 100%; }
.dl { display: grid; grid-template-columns: 170px 1fr; gap: 10px 12px; margin: 0; }
.dl dt { color: var(--muted); } .dl dd { margin: 0; }

/* Forms */
label { display: flex; flex-direction: column; gap: 6px; font-size: 12px; color: var(--ink-2); font-weight: 500; }
input, select, textarea { font: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 10px; background-color: #fff; color: var(--ink); min-width: 0; }
input:focus, select:focus, textarea:focus { outline: 3px solid #ececf0; border-color: #c9c9d0; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; font-size: 14px; }
fieldset { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.checks { display: flex; flex-wrap: wrap; gap: 6px 16px; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px 16px; align-items: end; }
.form-grid .full, .form-grid h2 { grid-column: 1 / -1; }
.form-grid h2 { margin: 10px 0 0; }
.actions { display: flex; gap: 8px; }
.row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; } .row.grow { flex: 1; }
.toolbar { display: flex; gap: 8px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-size: 13px; font-weight: 500; padding: 9px 14px; border-radius: 10px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--soft); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: #333; }
.btn.danger { color: var(--neg); border-color: #f6caca; }
.btn.small { padding: 5px 11px; font-size: 12px; border-radius: 8px; }
button.link { background: none; border: 0; color: var(--muted); padding: 0; cursor: pointer; font: inherit; }
.inline-upload input[type=file] { font-size: 11px; max-width: 170px; padding: 2px; border: 0; }
.sig { max-height: 36px; display: block; }
.preview-img { max-width: 100%; max-height: 180px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; display: block; }
.preview-img.letterhead { max-height: 320px; }
.dropzone { border: 2px dashed var(--line-2); border-radius: 14px; padding: 20px; display: flex; flex-direction: column; gap: 6px; align-items: center; color: var(--muted); margin-bottom: 12px; }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; }
.thumb { border: 1px solid var(--line); border-radius: 12px; padding: 6px; display: flex; flex-direction: column; gap: 4px; overflow: hidden; }
.thumb img { width: 100%; height: 110px; object-fit: cover; border-radius: 8px; }
.thumb .pdf { height: 110px; display: grid; place-items: center; background: #fdecec; color: var(--neg); font-weight: 700; border-radius: 8px; }
.steps { display: flex; gap: 4px; background: var(--soft); padding: 3px; border-radius: 12px; }
.step { font: inherit; font-size: 12px; font-weight: 500; padding: 7px 12px; border: 0; background: transparent; border-radius: 9px; cursor: pointer; color: var(--ink-2); }
.step.current { background: var(--ink); color: #fff; }
.step:disabled { cursor: default; }
.audit-items .w-status { width: 110px; } .audit-items .w-actions { width: 390px; }
.audit-items tr.resolved td { opacity: .6; }
.response { margin-top: 6px; padding: 8px 10px; background: var(--soft); border-radius: 8px; }
.tpl-list { display: flex; flex-direction: column; gap: 6px; }
.tpl-choice { border: 1px solid var(--line); border-radius: 12px; padding: 12px; }
.tpl-choice:hover { border-color: var(--line-2); background: var(--soft); }

/* Auth */
.auth-body { display: grid; place-items: center; min-height: 100vh; background: var(--bg); }
.auth-card { width: 390px; background: #fff; border-radius: 20px; padding: 32px; display: flex; flex-direction: column; gap: 12px; }
.brand.big { font-size: 26px; font-weight: 700; letter-spacing: -.02em; }
.langs { display: flex; gap: 8px; color: var(--muted); } .langs.center { justify-content: center; }
.tenant-choice { width: 100%; text-align: left; font: inherit; padding: 12px; border: 1px solid var(--line); background: #fff; border-radius: 12px; cursor: pointer; display: flex; flex-direction: column; gap: 2px; }
.tenant-choice:hover, .tenant-choice.current { border-color: var(--ink); }
.error-page { max-width: 520px; margin: 80px auto; text-align: center; }

/* Format builder */
.title-input { font-size: 17px; font-weight: 600; flex: 1; }
.w-cat { width: 130px; }
.builder-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr) minmax(0, 1fr); gap: 14px; align-items: start; }
.builder-left .card { padding: 16px; }
.builder-main textarea { width: 100%; height: calc(100vh - 160px); font: 13px/1.55 ui-monospace, "SF Mono", Menlo, monospace; resize: vertical; background: #17171a; color: #e7e7ea; border-color: #17171a; border-radius: var(--radius); padding: 16px; }
.builder-preview iframe { width: 100%; height: calc(100vh - 200px); border: 0; border-radius: var(--radius); background: #e9e9ec; margin-top: 8px; }
.chips { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 8px; }
.chips button { font: inherit; font-size: 12px; padding: 5px 9px; border-radius: 8px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
.chips button:hover { background: var(--soft); }
.field-chip { background: #ecebfc !important; color: #5b52d1; border-color: transparent !important; }
.fields td { padding: 3px; border: 0; } .fields input, .fields select { width: 100%; font-size: 12px; padding: 6px; }
details pre { white-space: pre-wrap; background: var(--soft); padding: 10px; border-radius: 8px; font-size: 11px; }

/* Compliance */
.pill.st-filed { background: #e3f5ea; color: var(--ok); } .pill.st-overdue { background: #fdecec; color: var(--neg); }
.pill.st-due_soon { background: #fff1e7; color: #c2571f; } .pill.st-upcoming { background: var(--soft); color: var(--ink-2); }
.grid-main.rev { grid-template-columns: minmax(0, 1.65fr) minmax(0, 1fr); }
.deadlines { display: flex; flex-direction: column; gap: 4px; }
.deadline { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px; border-radius: 12px; }
.deadline:hover { background: var(--soft); }
.area { font-size: 11px; font-weight: 600; padding: 4px 8px; border-radius: 8px; }
.area.tax { background: #fff1e7; color: #c2571f; } .area.ocr { background: #ecebfc; color: #5b52d1; }
.dl-name, .dl-due { display: flex; flex-direction: column; gap: 2px; min-width: 0; } .dl-due { align-items: flex-end; }
.dl-name strong { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 1200px) { .grid-3 { grid-template-columns: 1fr 1fr; } .search { display: none; } }
@media (max-width: 1000px) { .grid-4 { grid-template-columns: 1fr 1fr; } .grid-main, .grid2, .builder-grid { grid-template-columns: 1fr; }
  .app { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } }
@media (max-width: 640px) { .grid-4, .grid-3 { grid-template-columns: 1fr; } .main, .topbar { padding-left: 12px; padding-right: 12px; } }

/* BS date picker */
input[data-bs] { padding-right: 34px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238a8a93' stroke-width='2' stroke-linecap='round'%3E%3Crect x='3' y='5' width='18' height='16' rx='3'/%3E%3Cpath d='M3 10h18M8 3v4M16 3v4'/%3E%3C/svg%3E") no-repeat right 11px center; font-variant-numeric: tabular-nums; }
.bs-pop { position: absolute; z-index: 100; width: 296px; background: var(--panel); border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 18px 44px rgba(20,20,20,.16); padding: 12px; font-size: 13px; }
.bs-head { display: flex; align-items: center; gap: 6px; }
.bs-title { flex: 1; display: flex; gap: 6px; justify-content: center; }
.bs-title select { padding: 6px 28px 6px 10px; font-weight: 600; border-radius: 9px; background-position: right 8px center; }
.bs-nav { width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; border-radius: 9px; cursor: pointer; font-size: 16px; }
.bs-nav:hover { background: var(--soft); }
.bs-sub { text-align: center; color: var(--muted); font-size: 11px; margin: 6px 0 8px; }
.bs-week, .bs-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.bs-week span { text-align: center; font-size: 11px; color: var(--muted); padding: 4px 0; }
.bs-week span:last-child { color: var(--neg); }
.bs-grid button { position: relative; height: 36px; border: 0; background: none; border-radius: 9px; cursor: pointer; font: inherit; }
.bs-grid button b { font-weight: 500; font-size: 13px; }
.bs-grid button i { position: absolute; right: 4px; bottom: 2px; font-style: normal; font-size: 9px; color: var(--muted); }
.bs-grid button:hover { background: var(--soft); }
.bs-grid button.sat b { color: var(--neg); }
.bs-grid button.today { box-shadow: inset 0 0 0 1.5px var(--ink); }
.bs-grid button.sel { background: var(--ink); } .bs-grid button.sel b, .bs-grid button.sel i { color: #fff; }
.bs-foot { display: flex; justify-content: space-between; margin-top: 8px; border-top: 1px solid var(--line); padding-top: 8px; }
.bs-foot button { border: 0; background: none; font: inherit; font-weight: 600; cursor: pointer; padding: 6px 8px; border-radius: 8px; }
.bs-foot button:hover { background: var(--soft); } .bs-clear { color: var(--muted); }

/* Parties */
.party-cell { display: flex; gap: 10px; align-items: center; }
.avatar-ph.sm { width: 32px; height: 32px; font-size: 13px; }
.pill.supplier { background: #ecebfc; color: #5b52d1; } .pill.customer { background: var(--pink-soft); color: #b83a63; } .pill.both { background: var(--soft); }
.banner.soft { background: #ecebfc; color: #4a42b8; font-size: 13px; }

/* Themed select (JS-enhanced; native <select> stays in the DOM for forms) */
select { background-color: #fff; }
.xsel { position: relative; display: block; min-width: 0; }
.xsel > select { position: absolute; inset: 0; opacity: 0; pointer-events: none; }
.xsel-btn { width: 100%; display: flex; align-items: center; gap: 8px; font: inherit; font-size: 14px; font-weight: 400; text-align: left; color: var(--ink);
  padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 10px; background: #fff; cursor: pointer; min-height: 40px; }
.xsel-btn:hover { border-color: #cfcfd6; }
.xsel.open .xsel-btn, .xsel-btn:focus-visible { outline: 3px solid #ececf0; border-color: #c9c9d0; }
.xsel-btn .xsel-val { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.xsel-btn .xsel-val.ph { color: var(--muted); }
.xsel.open .chev { transform: rotate(-135deg) translate(-2px, 0); }
.xsel-pop { position: fixed; z-index: 60; max-width: 420px; max-height: 300px; overflow-y: auto;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 16px 40px rgba(20,20,20,.12); padding: 5px; }
.xsel-search { width: 100%; margin-bottom: 4px; padding: 7px 10px; font-size: 13px; }
.xsel-opt { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; border: 0; background: none; border-radius: 8px; font: inherit; font-size: 14px; text-align: left; cursor: pointer; color: var(--ink); }
.xsel-opt:hover, .xsel-opt.hl { background: var(--soft); }
.xsel-opt.on { font-weight: 600; } .xsel-opt.on::after { content: "✓"; margin-left: auto; }
.xsel-opt[disabled] { color: var(--muted); cursor: default; }
.xsel-empty { padding: 8px 10px; color: var(--muted); font-size: 13px; }
.xsel.small .xsel-btn { padding: 5px 9px; min-height: 32px; font-size: 13px; }
td .xsel { min-width: 90px; }
.lines td:first-child .xsel { min-width: 170px; }
.lines td { vertical-align: middle; }

/* Table cells must stay table-cells: flex layouts go in an inner wrapper. */
.table td.actions-cell, .table th.actions-cell { width: 1%; white-space: nowrap; text-align: right; }
.cell-actions { display: grid; grid-template-columns: 96px 76px 32px; gap: 6px; justify-content: end; align-items: center; }
.btn.icon { width: 32px; padding-left: 0; padding-right: 0; }
.parties-table td { vertical-align: middle; }
.parties-table th { white-space: normal; vertical-align: bottom; }
.party-cell .avatar-ph { flex: none; }
.party-cell strong { display: block; }
.parties-table th, .parties-table td { padding-left: 12px; padding-right: 12px; }
.parties-table td:first-child, .parties-table th:first-child { padding-left: 18px; }
.parties-table td.actions-cell { padding-right: 16px; }
.cell-actions > .btn { width: 100%; }

/* Payroll */
.cell-actions.two { grid-template-columns: auto 32px; }
.cell-status { display: flex; align-items: center; gap: 6px; }
.table-scroll { overflow-x: auto; }
.table.salary td, .table.salary th { padding: 10px 10px; white-space: nowrap; vertical-align: middle; }
.w-num { width: 60px; padding: 5px 6px; } .w-amt { width: 100px; padding: 5px 6px; } .w-rate { width: 70px; padding: 5px 6px; }
.table.compact td, .table.compact th { padding: 6px 8px; } .table.compact input { width: 100%; padding: 6px 8px; }
.slabs h3 { margin-top: 0; }
.cell-actions.admin { grid-template-columns: auto auto; }

/* Single company window */
.section-nav { position: sticky; top: 62px; z-index: 15; display: flex; gap: 2px; background: #e9e9ec; border-radius: 12px; padding: 3px; margin-bottom: 18px; width: fit-content; max-width: 100%; overflow-x: auto; box-shadow: 0 4px 14px rgba(243,243,245,.9); }
.section-nav a { padding: 7px 14px; border-radius: 9px; color: var(--ink-2); font-weight: 500; font-size: 13px; white-space: nowrap; }
.section-nav a.active { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.page-section { scroll-margin-top: 120px; padding-top: 6px; }
.page-section + .page-section { margin-top: 18px; border-top: 1px dashed var(--line-2); padding-top: 22px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 0 0 14px; }
.section-title h2 { font-size: 17px; }
.side-sub { display: none; flex-direction: column; margin: 2px 0 4px 30px; border-left: 1px solid var(--line); }
.side-sub.open { display: flex; }
.side-sub a { padding: 5px 12px; font-size: 13px; color: var(--muted); border-radius: 0 8px 8px 0; }
.side-sub a:hover, .side-sub a.active { color: var(--ink); background: var(--soft); }
[hidden] { display: none !important; }

/* Folded panels (occasional actions) */
.fold-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-top: -4px; }
.fold > summary { list-style: none; cursor: pointer; }
.fold > summary::-webkit-details-marker { display: none; }
.fold[open] { flex-basis: 100%; }
.fold[open] > summary { background: var(--ink); color: #fff; border-color: var(--ink); }
.fold-body { margin: 10px 0 0; }

/* Themed uploads */
.upload-form { display: flex; flex-direction: column; gap: 10px; }
.upload-form > .btn { align-self: flex-start; }
.upload-form .row { align-items: end; }
.up { position: relative; display: block; cursor: pointer; font-weight: 400; }
.up > input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.up-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 22px 16px; border: 1.5px dashed var(--line-2); border-radius: 14px; background: #fafafb; text-align: center; transition: border-color .15s, background .15s; }
.up:hover .up-empty, .up.drag .up-empty { border-color: var(--ink); background: var(--soft); }
.up-icon { width: 42px; height: 42px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); display: grid; place-items: center; color: var(--ink-2); }
.up-text { font-size: 14px; color: var(--ink); } .up-text u { text-underline-offset: 3px; font-weight: 600; }
.up-hint { font-size: 12px; color: var(--muted); }
.up-file { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--line-2); border-radius: 14px; background: var(--panel); }
.up-thumb { width: 48px; height: 48px; border-radius: 10px; background: var(--soft); display: grid; place-items: center; font-size: 11px; font-weight: 700; color: var(--ink-2); overflow: hidden; flex: none; }
.up-thumb img { width: 100%; height: 100%; object-fit: cover; }
.up-meta { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.up-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-size { font-size: 12px; color: var(--muted); }
.up.up-error .up-file { border-color: #f6caca; background: #fff7f7; } .up.up-error .up-size { color: var(--neg); }
.up.busy { opacity: .6; pointer-events: none; }
.up-compact { display: inline-block; }
.up-pill { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1px solid var(--line-2); border-radius: 8px; background: #fff; font-size: 12px; font-weight: 500; color: var(--ink-2); white-space: nowrap; }
.up-pill svg { width: 14px; height: 14px; }
.up-compact:hover .up-pill { background: var(--soft); }
.inline-upload { display: inline-flex; align-items: center; gap: 8px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.upload-form + form { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }

/* Sectioned forms */
.form-sections { background: var(--panel); border-radius: var(--radius); }
.form-section { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 24px; padding: 24px; border-bottom: 1px solid var(--line); }
.fs-head h2 { font-size: 15px; margin-bottom: 4px; } .fs-head p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.fs-body { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; align-content: start; }
.fs-body.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.fs-body > label, .fs-body > div { min-width: 0; }
.fs-body .span-2 { grid-column: span 2; } .fs-body .span-all { grid-column: 1 / -1; }
.fs-body input, .fs-body .xsel-btn, .fs-body select { min-height: 42px; width: 100%; }
.fs-body textarea { width: 100%; resize: vertical; }
.req { color: var(--neg); font-style: normal; }
.form-footer { position: sticky; bottom: 0; display: flex; align-items: center; gap: 10px; padding: 16px 24px; background: rgba(255,255,255,.94); backdrop-filter: blur(8px); border-radius: 0 0 var(--radius) var(--radius); }
.form-footer .spacer { flex: 1; }
.prefixed { display: flex; align-items: stretch; border: 1px solid var(--line-2); border-radius: 10px; overflow: hidden; background: #fff; }
.prefixed > span { display: grid; place-items: center; padding: 0 12px; background: var(--soft); color: var(--muted); font-size: 13px; border-right: 1px solid var(--line-2); }
.prefixed input { border: 0; border-radius: 0; flex: 1; font-variant-numeric: tabular-nums; }
.prefixed:focus-within { outline: 3px solid #ececf0; border-color: #c9c9d0; }
.money-preview { font-size: 12px; color: var(--muted); min-height: 16px; font-weight: 400; }
.switch-field { justify-content: flex-start; }
.switch { display: flex; align-items: center; gap: 10px; min-height: 42px; font-weight: 400; font-size: 14px; color: var(--ink); cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { width: 40px; height: 24px; border-radius: 999px; background: #d9d9de; position: relative; transition: background .15s; flex: none; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.2); transition: transform .15s; }
.switch input:checked + .switch-ui { background: var(--ink); }
.switch input:checked + .switch-ui::after { transform: translateX(16px); }
.switch input:focus-visible + .switch-ui { outline: 3px solid #d9d9e3; }
.radio-pills { display: flex; flex-wrap: wrap; gap: 6px; background: var(--soft); padding: 4px; border-radius: 12px; width: fit-content; }
.radio-pill { cursor: pointer; }
.radio-pill input { position: absolute; opacity: 0; }
.radio-pill span { display: block; padding: 8px 14px; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--ink-2); }
.radio-pill input:checked + span { background: var(--panel); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
@media (max-width: 1000px) { .form-section { grid-template-columns: 1fr; gap: 12px; } .fs-body.cols-3 { grid-template-columns: 1fr 1fr; } }

/* Roles & approvals */
.pill.role-owner, .pill.role-superadmin { background: var(--ink); color: #fff; }
.pill.role-admin { background: #ecebfc; color: #5b52d1; }
.pill.role-auditor { background: #fff1e7; color: #c2571f; }
.pill.role-data_entry { background: #e3f5ea; color: var(--ok); }
.role-legend { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.role-card { background: var(--panel); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.member-pop { min-width: 300px; }
.checks.col { flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.table.members td { vertical-align: middle; }
.side-note { display: flex; flex-direction: column; gap: 6px; align-items: flex-start; padding: 10px 12px; margin: 6px 0; background: #fff7ed; border-radius: 12px; }
.card.approval .kv.cols { grid-template-columns: auto 1fr auto 1fr auto 1fr; gap: 8px 14px; }
.card.approval .kv.cols dd { text-align: left; }
.decision { display: flex; gap: 8px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.decision input { flex: 1; }
@media (max-width: 1000px) { .role-legend { grid-template-columns: 1fr; } .card.approval .kv.cols { grid-template-columns: auto 1fr; } }

/* Checkboxes/radios never inherit text-input sizing */
input[type=checkbox], input[type=radio], .fs-body input[type=checkbox], .fs-body input[type=radio] { width: 16px; height: 16px; min-height: 0; padding: 0; margin: 0; accent-color: var(--ink); flex: none; }
.checks .check { font-size: 13px; }

/* Reports */
.report-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.report-tile { display: flex; flex-direction: column; gap: 4px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; transition: border-color .15s, background .15s; }
.report-tile:hover { border-color: var(--ink); background: var(--soft); }
.rt-icon { width: 30px; height: 30px; border-radius: 9px; background: var(--soft); display: grid; place-items: center; font-weight: 700; margin-bottom: 4px; }
.w-cat-sel { width: 170px; } .w-sh-sel { width: 210px; }
.alert.info { background: #e3f5ea; color: var(--ok); }
.slab-strip { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 2px; }
.slab-strip span { font-size: 11px; background: var(--soft); border-radius: 6px; padding: 2px 6px; font-variant-numeric: tabular-nums; }
.slab-table h3 { margin: 4px 0 8px; }
.slab-table td { vertical-align: middle; }

/* Download panels */
.dl-pop { min-width: 280px; }
.dl-head { display: flex; flex-direction: column; gap: 2px; }
.dl-tile { position: relative; }
.dl-tile .dl-panel { margin-top: 8px; }
.dl-panel .radio-pills { width: 100%; }
.dl-panel .radio-pill { flex: 1; text-align: center; }

/* Activity feed */
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.feed li { display: grid; grid-template-columns: 10px minmax(0, 1fr); gap: 10px; align-items: start; }
.feed li > div { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.feed strong { font-weight: 500; font-size: 13px; }
.feed-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin-top: 6px; }
.feed li:first-child .feed-dot { background: var(--ink); }

/* Salary sheet table fits the page */
.table.salary { font-size: 13px; }
.table.salary td, .table.salary th { padding: 9px 7px; }
.table.salary th { white-space: normal; vertical-align: bottom; }
.table.salary .w-amt { width: 82px; } .table.salary .w-num { width: 46px; }

/* Dashboard shareholder rows */
.person-row { grid-template-columns: 36px minmax(0, 1fr) minmax(84px, 0.9fr); }
.avatar-ph { flex: none; }

/* Smaller laptops (≤ 1240px): tighter layout so tables and figures fit without spilling */
@media (max-width: 1240px) {
  .app { grid-template-columns: 216px minmax(0, 1fr); }
  .sidebar { padding: 14px 10px; }
  .main { padding: 8px 18px 36px; }
  .topbar { padding: 12px 18px; }
  .table { font-size: 13px; }
  .table th, .table td { padding: 9px 10px; }
  .card { padding: 16px; }
  .stat-value { font-size: 22px; }
  .stat span { font-size: 18px; }
  .grid-main, .grid-main.rev { grid-template-columns: minmax(0, 1fr); }
  .hide-md { display: none; }
  .form-section { grid-template-columns: 200px minmax(0, 1fr); padding: 20px; }
  .cell-actions { grid-template-columns: 88px 68px 30px; }
}
/* Big money figures never overflow their card */
.stat-value { overflow-wrap: anywhere; line-height: 1.15; }
@media (max-width: 1240px) { .table.salary td, .table.salary th { padding: 8px 5px; } .table.salary { font-size: 12.5px; } .table.salary .w-amt { width: 74px; } }

.dim-row td { background: #fafafa; }
.dim-row td strong { color: var(--muted); }
.cell-actions.wide { grid-template-columns: auto auto; }
.tenant-choice.disabled, .tenant-choice:disabled { opacity: .55; cursor: not-allowed; }
.actions-cell .dd-pop, .actions-cell .form-pop { text-align: left; white-space: normal; }

/* ---------- Animated sales & purchases chart ---------- */
.chart { position: relative; }
.chart-bars { background: repeating-linear-gradient(to top, transparent 0 calc(25% - 1px), rgba(0,0,0,.035) calc(25% - 1px) 25%); background-size: 100% calc(100% - 26px); background-repeat: no-repeat; }
.bar-col { cursor: pointer; outline: none; }
.bar-col .bars { transition: background .25s ease; }
.bar { transform-origin: bottom; animation: bar-grow .8s cubic-bezier(.2, .9, .25, 1) both; animation-delay: calc(var(--i, 0) * 55ms);
       transition: filter .25s ease, opacity .25s ease, background .25s ease; }
.bar.purchases { animation-delay: calc(var(--i, 0) * 55ms + 90ms); }
@keyframes bar-grow { from { transform: scaleY(0); opacity: .3; } to { transform: scaleY(1); opacity: 1; } }
.bar-label { transition: background .2s ease, color .2s ease; }
/* Focus the hovered month, fade the rest */
.chart-bars:hover .bar-col:not(:hover) .bar, .chart-bars:focus-within .bar-col:not(:focus) .bar { opacity: .35; }
.bar-col:hover .bars, .bar-col:focus .bars { background: #f6e9ef; }
.bar-col:hover .bar.sales, .bar-col:focus .bar.sales { background: linear-gradient(180deg, var(--pink), #f3c0d1); }
.bar-col:hover .bar.purchases, .bar-col:focus .bar.purchases { background: linear-gradient(180deg, var(--purple), #d6d2f8); }
.bar-col:hover .bar-label, .bar-col:focus .bar-label { background: var(--ink); color: #fff; }
/* Tooltip */
.chart-tip { position: absolute; z-index: 5; pointer-events: none; min-width: 170px; padding: 10px 12px; border-radius: 12px;
  background: var(--ink); color: #fff; font-size: 12px; box-shadow: 0 10px 28px rgba(0,0,0,.18);
  transform: translate(-50%, -100%); transition: left .18s ease, top .18s ease, opacity .15s ease; }
.chart-tip strong { display: block; font-size: 13px; margin-bottom: 6px; }
.chart-tip .row-t { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.chart-tip .row-t + .row-t { margin-top: 3px; }
.chart-tip .sw { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 6px; }
.chart-tip .sw.s { background: var(--pink); } .chart-tip .sw.p { background: #b9b3f3; }
.chart-tip .net { border-top: 1px solid rgba(255,255,255,.18); margin-top: 6px; padding-top: 6px; }
.chart-tip .neg { color: #ffb4b4 !important; }
.chart-tip::after { content: ""; position: absolute; left: 50%; bottom: -5px; width: 10px; height: 10px; background: var(--ink); transform: translateX(-50%) rotate(45deg); }
@media (prefers-reduced-motion: reduce) { .bar, .chart-tip { animation: none; transition: none; } }

/* =====================================================================
   Theme v3 — flat "frame" panels, hairline rules, light sidebar
   (after the reference admin panel design)
   ===================================================================== */
:root {
  --bg: #f5f5f5; --panel: #fff; --panel-2: #f8f8f8; --band: #efefef;
  --ink: #191919; --ink-strong: #000; --ink-2: #4c4c4c; --muted: #6b6b6b; --faint: #8f8f8f; --fainter: #a3a3a3;
  --line: #e3e3e3; --line-2: #cfcfcf; --soft: #efefef; --fill: rgba(0,0,0,.05);
  --rule-hi: #fff; --rule-lo: #dcdcdc;
  --hair-b: inset 0 -1px 0 var(--rule-lo), inset 0 -2px 0 var(--rule-hi);
  --hair-t: inset 0 1px 0 var(--rule-hi), inset 0 2px 0 var(--rule-lo);
  --hair-r: inset -1px 0 0 var(--rule-lo), inset -2px 0 0 var(--rule-hi);
  --raise: 0 1px 2px rgba(0,0,0,.06);
  --ease: cubic-bezier(.33, 1, .68, 1);
  --radius: 0px;
  font-family: "Geist", "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", "Noto Sans Devanagari", sans-serif;
  color: var(--ink); background: var(--bg);
}
body { background: var(--bg); letter-spacing: -0.1px; }

/* Frame: double hairline rule that runs 10px past each corner (crosshair marks). */
.frame, .card, .grid-4, .stats, .form-sections, .role-legend { position: relative; }
.frame::before, .card::before, .grid-4::before, .stats::before, .form-sections::before {
  content: ""; position: absolute; inset: -10px; pointer-events: none; z-index: 0;
  background-repeat: no-repeat;
  background-image: linear-gradient(var(--rule-hi), var(--rule-hi)), linear-gradient(var(--rule-lo), var(--rule-lo)),
                    linear-gradient(var(--rule-hi), var(--rule-hi)), linear-gradient(var(--rule-lo), var(--rule-lo)),
                    linear-gradient(var(--rule-hi), var(--rule-hi)), linear-gradient(var(--rule-lo), var(--rule-lo)),
                    linear-gradient(var(--rule-hi), var(--rule-hi)), linear-gradient(var(--rule-lo), var(--rule-lo));
  background-size: 100% 1px, 100% 1px, 100% 1px, 100% 1px, 1px 100%, 1px 100%, 1px 100%, 1px 100%;
  background-position: 0 10px, 0 11px, 0 calc(100% - 11px), 0 calc(100% - 10px), 10px 0, 11px 0, calc(100% - 11px) 0, calc(100% - 10px) 0;
}
/* (no z-index on panel children: open pop-ups must be able to rise above later panels) */

/* ---------- Sidebar ---------- */
.app { grid-template-columns: 264px minmax(0, 1fr); background: var(--bg); }
.sidebar { background: #efefef; border-right: 0; padding: 16px 12px 12px; gap: 0; position: sticky; }
.sidebar::after { content: ""; position: absolute; top: 0; bottom: 0; right: 0; width: 1px; background: var(--rule-hi); box-shadow: 1px 0 0 var(--rule-lo); }
.side-brand { font-size: 15px; font-weight: 600; letter-spacing: -0.3px; padding: 4px 10px 14px; gap: 10px; }
.side-brand .logo-mark { width: 28px; height: 28px; border-radius: 8px; }
.side-brand .logo-mark span { width: 11px; height: 11px; border-width: 2.5px; }
.side-group { border-top: 0; padding: 0 0 8px; gap: 2px; }
.side-title { font-size: 11px; font-weight: 500; letter-spacing: .66px; color: var(--faint); padding: 12px 10px 6px; }
.side-link { height: 34px; padding: 0 10px; gap: 10px; border-radius: 8px; border: 1px solid transparent; font-size: 14px; font-weight: 500;
  letter-spacing: -0.28px; color: var(--ink-2); transition: background-color .16s var(--ease), color .16s var(--ease); }
.side-link:hover { background: var(--fill); color: var(--ink-strong); }
.side-link.active { background: #fff; color: var(--ink-strong); border-color: rgba(0,0,0,.07); box-shadow: var(--raise); }
.side-link .ico { width: 16px; height: 16px; background: none; border-radius: 0; fill: none; stroke: currentColor; stroke-width: 1.75;
  stroke-linecap: round; stroke-linejoin: round; color: var(--muted); flex: none; }
.side-link:hover .ico, .side-link.active .ico { color: var(--ink-strong); background: none; }
.side-link .badge { height: 18px; min-width: 18px; font-size: 10.5px; }
.side-sub { margin: 2px 0 6px 20px; border-left: 1px solid var(--rule-lo); box-shadow: -1px 0 0 var(--rule-hi); }
.side-sub a { font-size: 13px; color: var(--muted); padding: 5px 12px; }
.side-sub a:hover, .side-sub a.active { background: var(--fill); color: var(--ink-strong); }
.side-foot { padding-top: 10px; }
.side-tenant { background: transparent; border-radius: 0; padding: 12px 10px 4px; box-shadow: var(--hair-t); }
.side-note { background: rgba(180, 83, 9, .06); border-radius: 8px; }

/* ---------- Top bar ---------- */
.topbar { height: 60px; padding: 0 32px; background: rgba(245,245,245,.9); backdrop-filter: saturate(1.2) blur(10px); }
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 1px; background: var(--rule-hi); box-shadow: 0 1px 0 var(--rule-lo); }
.crumb { font-size: 14px; letter-spacing: -0.2px; } .crumb .muted { color: var(--faint); } .crumb strong { font-weight: 500; color: var(--ink-strong); }
.dd-btn, .search { height: 36px; background: #fff; border: 1px solid var(--line); border-radius: 8px; box-shadow: none; }
.dd-btn:hover, .dd[open] > .dd-btn { border-color: var(--line-2); box-shadow: none; }
.dd-ico { background: var(--soft); border-radius: 6px; }
.avatar { width: 34px; height: 34px; background: #191919; font-size: 13px; }
.dd-pop { border-radius: 12px; border-color: var(--line); box-shadow: 0 12px 32px rgba(0,0,0,.12), 0 0 0 1px rgba(0,0,0,.02); }

/* ---------- Main + panels ---------- */
.main { max-width: 1600px; padding: 28px 32px 72px; }
.card { background: transparent; border: 0; border-radius: 0; padding: 22px; margin-bottom: 30px; }
.card.flush { padding: 0; overflow: visible; }
.card-head { margin-bottom: 14px; }
.card.flush > .card-head, .card-head.pad { padding: 15px 22px 14px; margin: 0; box-shadow: var(--hair-b); align-items: center; }
.card h2, .card-head h2 { font-size: 15px; font-weight: 500; letter-spacing: -0.3px; color: var(--ink-strong); }
.card-head p.muted.small, .card h2 + p { color: var(--faint); }
.grid-4, .grid-3, .grid-main, .grid2 { gap: 30px; }
.grid-4, .grid-3, .grid-main { margin-bottom: 30px; }
.page-section + .page-section { border-top: 0; box-shadow: var(--hair-t); }

/* Stat tiles: one frame, split by hairlines */
.grid-4 { gap: 0; }
.grid-4 > .card { margin: 0; padding: 18px 22px 20px; box-shadow: var(--hair-r); }
.grid-4 > .card:last-child { box-shadow: none; }
.grid-4 > .card::before { display: none; }
.stat-top { font-size: 13px; font-weight: 400; color: var(--muted); }
.stat-top .dots { display: none; }
.stat-value { font-size: 34px; font-weight: 500; letter-spacing: -1.2px; color: var(--ink-strong); margin: 8px 0 4px; }
.stat-sub { font-size: 12px; color: var(--faint); }
a.stat-card:hover { border-color: transparent; background: rgba(255,255,255,.55); }
.stats { gap: 0; margin-bottom: 30px; }
.stat { background: transparent; border-radius: 0; padding: 16px 20px; box-shadow: var(--hair-r); color: var(--muted); }
.stat:last-child { box-shadow: none; }
.stat span { font-size: 24px; font-weight: 500; letter-spacing: -0.8px; color: var(--ink-strong); }

/* ---------- Tables ---------- */
.table th, .table td { border-bottom: 0; }
.table th { height: 38px; padding: 0 14px; background: var(--band); font-size: 11px; font-weight: 500; letter-spacing: .66px; text-transform: uppercase;
  color: var(--muted); box-shadow: var(--hair-b); vertical-align: middle; }
.table td { padding: 12px 14px 13px; font-size: 13px; box-shadow: var(--hair-b); }
.table tr:last-child td { box-shadow: none; }
.table tfoot th, .table tfoot td { background: var(--panel-2); box-shadow: var(--hair-t); text-transform: none; letter-spacing: 0; font-size: 13px; color: var(--ink); }
.table.hover tr:hover td { background: rgba(255,255,255,.6); }
.table .empty { color: var(--faint); }

/* ---------- Controls ---------- */
.btn { height: 36px; padding: 0 14px; border-radius: 8px; border: 1px solid var(--line); background: #fff; color: var(--ink-strong);
  font-size: 14px; font-weight: 500; letter-spacing: -0.2px; transition: background-color .16s var(--ease), border-color .16s var(--ease); }
.btn:hover { background: #fafafa; border-color: var(--line-2); }
.btn.primary { background: #191919; border-color: #191919; color: #fff; }
.btn.primary:hover { background: #000; border-color: #000; }
.btn.small { height: 30px; padding: 0 10px; font-size: 13px; border-radius: 7px; }
.btn.danger { color: #b42318; border-color: #f0d6d2; }
input, select, textarea, .xsel-btn { border-color: var(--line); border-radius: 8px; background-color: #fff; }
input:focus, select:focus, textarea:focus, .xsel.open .xsel-btn, .xsel-btn:focus-visible { outline: 3px solid rgba(0,0,0,.05); border-color: var(--line-2); }
label { color: var(--ink-2); }
.pill { font-size: 11.5px; font-weight: 500; padding: 2px 8px; background: rgba(0,0,0,.05); color: var(--ink-2); }
.pill.st-due_soon, .pill.open { background: rgba(180, 83, 9, .08); color: #b45309; }
.segmented, .section-nav, .radio-pills, .seg-mini { background: var(--fill); border-radius: 10px; }
.segmented a.active, .section-nav a.active, .radio-pill input:checked + span, .seg-mini a.active { background: #fff; box-shadow: var(--raise), 0 0 0 1px rgba(0,0,0,.06); }
.section-nav { box-shadow: none; }
.alert { border-radius: 8px; }

/* ---------- Page heads ---------- */
.page-head { margin: 0 0 24px; }
.page-head h1 { font-size: 30px; font-weight: 500; letter-spacing: -1px; color: var(--ink-strong); }
.title-block h1 { font-size: 26px; letter-spacing: -0.8px; }
.logo, .logo-ph { border-radius: 10px; }
.eyebrow { display: flex; align-items: center; gap: 10px; font-size: 11px; font-weight: 500; letter-spacing: .66px; text-transform: uppercase; color: var(--faint); margin-bottom: 10px; }
.eyebrow i { width: 24px; height: 1px; background: var(--rule-lo); box-shadow: 0 1px 0 var(--rule-hi); }

/* ---------- Dashboard hero (like the reference overview) ---------- */
.hero { padding: 0; margin-bottom: 30px; }
.hero-main { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px 40px; padding: 30px 30px 26px; }
.hero-main h1 { font-size: 34px; font-weight: 500; letter-spacing: -1.1px; color: var(--ink-strong); margin: 0 0 8px; }
.hero-main p { margin: 0; color: var(--muted); font-size: 14px; }
.hero-side { min-width: 220px; padding-left: 24px; box-shadow: inset 1px 0 0 var(--rule-hi), inset 2px 0 0 var(--rule-lo); }
.hero-side strong { display: block; font-size: 18px; font-weight: 500; letter-spacing: -0.5px; color: var(--ink-strong); margin: 2px 0 4px; }
.hero-side span { font-size: 13px; color: var(--muted); }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 12px 30px; box-shadow: var(--hair-t); background: rgba(0,0,0,.02); }
.hero-actions .spacer { flex: 1; }
.hero-actions .link { font-size: 13px; color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }
.hero-actions .link .live { width: 7px; height: 7px; border-radius: 50%; background: #2f9e62; }
.btn .ic, .hero-actions .ic { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Forms (sectioned) ---------- */
.form-sections { background: transparent; border-radius: 0; margin-bottom: 30px; }
.form-section { border-bottom: 0; box-shadow: var(--hair-b); }
.form-footer { background: rgba(245,245,245,.92); border-radius: 0; box-shadow: var(--hair-t); }
.role-legend { gap: 0; margin-bottom: 30px; }
.role-card { background: transparent; border-radius: 0; box-shadow: var(--hair-r); }
.role-card:last-child { box-shadow: none; }

/* Folded panels, drop zones, tiles */
.fold-body.card { padding: 18px; }
.up-empty { background: rgba(255,255,255,.5); border-color: var(--line-2); border-radius: 10px; }
.report-tile { background: rgba(255,255,255,.55); border-color: var(--line); border-radius: 10px; }
.report-tile:hover { background: #fff; border-color: var(--line-2); }
.chart-bars .bars { background: rgba(0,0,0,.025); }

/* Auth screens */
.auth-body { background: var(--bg); }
.auth-card { background: transparent; border-radius: 0; position: relative; }
.auth-card::before { content: ""; position: absolute; inset: -10px; pointer-events: none;
  background-repeat: no-repeat;
  background-image: linear-gradient(var(--rule-hi), var(--rule-hi)), linear-gradient(var(--rule-lo), var(--rule-lo)), linear-gradient(var(--rule-hi), var(--rule-hi)), linear-gradient(var(--rule-lo), var(--rule-lo)), linear-gradient(var(--rule-hi), var(--rule-hi)), linear-gradient(var(--rule-lo), var(--rule-lo)), linear-gradient(var(--rule-hi), var(--rule-hi)), linear-gradient(var(--rule-lo), var(--rule-lo));
  background-size: 100% 1px, 100% 1px, 100% 1px, 100% 1px, 1px 100%, 1px 100%, 1px 100%, 1px 100%;
  background-position: 0 10px, 0 11px, 0 calc(100% - 11px), 0 calc(100% - 10px), 10px 0, 11px 0, calc(100% - 11px) 0, calc(100% - 10px) 0; }
.auth-card > * { position: relative; }

@media (max-width: 1240px) {
  .app { grid-template-columns: 232px minmax(0, 1fr); }
  .main { padding: 24px 24px 64px; } .topbar { padding: 0 24px; }
  .stat-value { font-size: 26px; }
  .hero-main h1 { font-size: 28px; }
}

/* Theme v3 — compact tables on smaller laptops (must follow the theme rules) */
@media (max-width: 1360px) {
  .table.salary td, .table.salary th { padding-left: 6px; padding-right: 6px; }
  .parties-table th, .parties-table td { padding-left: 10px; padding-right: 10px; }
}
@media (max-width: 1240px) {
  .table th, .table td { padding-left: 10px; padding-right: 10px; }
  .table td { padding-top: 10px; padding-bottom: 11px; }
  .table.salary td, .table.salary th { padding: 8px 4px; }
  .table.salary { font-size: 12px; }
  .cell-actions { grid-template-columns: auto auto 30px; gap: 4px; }
  .btn.small { padding: 0 8px; font-size: 12.5px; }
  .parties-table .pill { white-space: normal; }
}

/* Pop-ups are solid and always on top */
.dd-pop, .xsel-pop, .bs-pop, .form-pop, .menu-pop { background: #fff; z-index: 60; }
details[open] > .dd-pop { z-index: 60; }
.bs-pop { z-index: 100; }

/* OCR filings */
.filing-docs { margin: 8px 0 0; padding-left: 20px; display: grid; gap: 2px; font-size: 13px; color: var(--ink-2); }
.filing-actions { margin-top: 16px; padding-top: 16px; }

/* ---------- Format editor (WYSIWYG) ---------- */
.ed-grid { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 14px; align-items: start; }
.ed-side { display: flex; flex-direction: column; gap: 12px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; scrollbar-width: thin; }
.ed-side .card { padding: 16px; }
.ed-side h3 { margin-top: 0; }
.ed-side h4 { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 12px 0 6px; }
.ed-palette .chips button { background: var(--panel); }
.stack-label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); margin-top: 10px; }
.ed-main { min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.ed-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.ed-toolbar { position: sticky; top: 0; z-index: 30; display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 6px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,.04); }
.tb-group { display: flex; align-items: center; gap: 2px; padding-right: 6px; border-right: 1px solid var(--line); }
.tb-group:last-of-type { border-right: 0; }
.ed-toolbar button, .tb-dd > summary { font: inherit; font-size: 13px; min-width: 30px; height: 30px; padding: 0 8px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 4px; }
.ed-toolbar button:hover, .tb-dd > summary:hover, .tb-dd[open] > summary { background: var(--soft); }
.ed-toolbar svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; }
.ed-toolbar .xsel { min-width: 0; }
.ed-toolbar .xsel-btn { height: 30px; padding: 0 8px; font-size: 13px; border-radius: 8px; }
.ed-toolbar .xsel:has(#tb-block) { width: 118px; }
.ed-toolbar .xsel:has(#tb-font) { width: 170px; } .ed-toolbar .xsel:has(#tb-size) { width: 88px; } .ed-toolbar .xsel:has(#tb-line) { width: 118px; }
.tb-dd { position: relative; list-style: none; }
.tb-dd > summary { list-style: none; } .tb-dd > summary::-webkit-details-marker { display: none; }
.tb-pop { min-width: 250px; padding: 10px; gap: 8px; }
.tb-menu { display: grid; grid-template-columns: 1fr 1fr; gap: 2px; }
.tb-menu:empty { display: none; }
.tb-menu button { justify-content: flex-start !important; height: auto !important; padding: 7px 9px !important; text-align: left; font-size: 12.5px !important; }
.tb-menu button.danger { color: var(--neg); }
#repeat-menu, #repeat-inputs { grid-template-columns: 1fr; }
.tb-grid { display: grid; grid-template-columns: repeat(8, 20px); gap: 3px; }
.tb-grid button { width: 20px !important; min-width: 0 !important; height: 20px !important; padding: 0 !important; border: 1px solid var(--line-2) !important; border-radius: 3px !important; background: #fff !important; }
.tb-grid button.on { background: #ecebfc !important; border-color: var(--purple) !important; }
.tb-status { margin-left: auto; padding-right: 6px; color: var(--purple); }

/* The page: an A4 sheet with the print margins, so what you see is what prints. */
.ed-canvas { background: #e4e4e8; border-radius: var(--radius); padding: 28px 16px; overflow-x: auto; }
.ed-page { width: 210mm; min-height: 297mm; margin: 0 auto; padding: 20mm 20mm 20mm 22mm; background: #fff; color: #000; box-shadow: 0 2px 12px rgba(0,0,0,.12);
  font-family: "Kalimati", "Noto Sans Devanagari", serif; font-size: 12.5pt; line-height: 1.6; outline: none; box-sizing: border-box;
  background-image: repeating-linear-gradient(to bottom, transparent 0, transparent calc(297mm - 1px), #c9c9d1 calc(297mm - 1px), #c9c9d1 297mm); }
.ed-page p { margin: 0 0 8pt; }
.ed-page h1 { font-size: 1.6em; font-weight: 700; margin: 0 0 10pt; letter-spacing: 0; }
.ed-page h2 { font-size: 1.3em; font-weight: 700; margin: 0 0 8pt; }
.ed-page h3 { font-size: 1.1em; font-weight: 700; margin: 0 0 6pt; }
.ed-page table { border-collapse: collapse; width: 100%; margin: 6pt 0; }
.ed-page td, .ed-page th { padding: 3pt 6pt; vertical-align: top; outline: 1px dashed #d4d4dc; outline-offset: -1px; min-width: 2em; }
.ed-page table.bordered td, .ed-page table.bordered th { border: 1px solid #000; outline: 0; }
.ed-page th { text-align: left; }
.ed-page .center { text-align: center; } .ed-page .right { text-align: right; }
.ed-page .sign { margin-top: 36pt; display: inline-block; text-align: center; }
.ed-page .page-break { position: relative; height: 0; margin: 18pt -20mm 18pt -22mm; border-top: 2px dashed #8f88e8; user-select: none; }
.ed-page .page-break::after { content: "⤓ " attr(data-l); position: absolute; left: 50%; top: -10px; transform: translateX(-50%); background: #fff; color: #7c73e6; font: 600 10px/18px Inter, system-ui, sans-serif; padding: 0 8px; border-radius: 99px; border: 1px solid #d9d6fb; }
.ed-page .tok { display: inline-block; padding: 0 5px; margin: 0 1px; border-radius: 5px; background: #ecebfc; color: #4b43c4; font-size: .92em; line-height: 1.35; white-space: nowrap; cursor: pointer; user-select: all; }
.ed-page .tok[data-fmt]::after { content: attr(data-fmt); margin-left: 4px; font-size: .75em; opacity: .7; }
.ed-page .tok:hover { background: #dedcfa; }
.ed-page .ctl { display: inline-block; padding: 0 4px; border-radius: 4px; background: #f1f1f4; color: #6b6b75; font: 11px/1.5 ui-monospace, Menlo, monospace; }
.ed-page [data-for] { background: #f7f6ff; }
.ed-page tr[data-for] > :first-child { box-shadow: inset 3px 0 0 #7c73e6; }
.ed-page li[data-for] { box-shadow: -8px 0 0 -5px #7c73e6; }
.ed-preview iframe { width: 100%; height: calc(100vh - 150px); border: 0; border-radius: var(--radius); background: #e9e9ec; }
#tpl-body:not([hidden]) { width: 100%; min-height: calc(100vh - 170px); font: 13px/1.55 ui-monospace, "SF Mono", Menlo, monospace; background: #17171a; color: #e7e7ea; border: 0; border-radius: var(--radius); padding: 16px; resize: vertical; }
.ed-help pre { white-space: pre-wrap; }
.tok-pop { position: absolute; z-index: 70; width: 280px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 32px rgba(0,0,0,.14); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.tok-pop[hidden] { display: none; }
.tok-pop label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.tok-pop input { font: 12px ui-monospace, Menlo, monospace; }
.builder { position: relative; }
@media (max-width: 1100px) { .ed-grid { grid-template-columns: 1fr; } .ed-side { position: static; max-height: none; } }
.ed-side table.fields, .ed-side table.fields tbody { display: block; }
.ed-side table.fields tr { display: grid; grid-template-columns: 1fr 1fr 30px; gap: 4px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.ed-side table.fields td { display: block; padding: 0; border: 0; }
.ed-side table.fields td:nth-child(3) { grid-column: 1 / 3; }
.ed-side table.fields td:nth-child(4) { grid-column: 3; grid-row: 1; }
.ed-side table.fields input { width: 100%; }
.sh-field { display: flex; flex-direction: column; gap: 6px; }
.sh-label { font-size: 13px; color: var(--ink-2); font-weight: 500; }
.radio-pill input:disabled + span { opacity: .4; cursor: not-allowed; }

/* Person profile (OCR shareholder layout) */
.person-head { display: flex; flex-direction: column; gap: 6px; margin: 4px 0 10px; }
.person-head h2 { font-size: 20px; }
.tabs-line { display: flex; flex-wrap: wrap; gap: 4px 18px; border-bottom: 1px solid var(--line-2); margin-bottom: 14px; }
.tabs-line a { padding: 8px 2px 10px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs-line a:hover { color: var(--ink); }
.tabs-line a.on { color: var(--ink); border-bottom-color: var(--ink); }
.tabs-line .count { font-size: 11px; background: var(--soft); border-radius: 99px; padding: 1px 7px; margin-left: 3px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-grid .span-2 { grid-column: span 2; }
.person-page .card + .card, form > .card + .card { margin-top: 12px; }
form > .actions { margin-top: 12px; }
.form-grid input:disabled, .form-grid select:disabled { background: var(--soft); color: var(--ink); }
@media (max-width: 900px) { .form-grid.cols-3, .form-grid.cols-4 { grid-template-columns: 1fr 1fr; } }
.date-checks { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--panel-2, #fafafa); }
.date-checks h3 { margin: 0 0 8px; }
.date-checks ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.date-checks li { display: flex; gap: 8px; align-items: baseline; }
.date-checks li em { color: var(--muted); font-style: normal; font-size: 12px; }
.date-checks .mark { width: 18px; height: 18px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; flex: none; color: #fff; }
.date-checks li.ok .mark { background: var(--ok); } .date-checks li.bad .mark { background: var(--neg); }
.date-checks li.bad { color: var(--neg); }
.date-checks .override { margin-top: 10px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.grid2 > .full-row { grid-column: 1 / -1; order: 3; }
.checks-table input, .checks-table select { width: 100%; }
/* Table inputs */
.table-field { border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.table-field legend { font-weight: 600; padding: 0 4px; }
.trows { display: flex; flex-direction: column; gap: 10px; }
.trow { position: relative; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px 12px; padding: 12px 40px 12px 12px; background: var(--soft); border-radius: 10px; }
.trow label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--ink-2); }
.trow label.wide { grid-column: span 3; }
.trow .trow-del { position: absolute; top: 8px; right: 8px; }
.preset-chips button { background: var(--panel); }
@media (max-width: 800px) { .trow { grid-template-columns: 1fr; } .trow label.wide { grid-column: auto; } }
/* Nepali phonetic input */
.ime-wrap { position: relative; display: block; }
.ime-wrap > input, .ime-wrap > textarea { width: 100%; padding-right: 34px; }
.ime-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); width: 24px; height: 22px; border: 1px solid var(--line-2); border-radius: 6px; background: var(--panel); font: 600 12px/1 "Noto Sans Devanagari", system-ui, sans-serif; color: var(--purple); cursor: pointer; padding: 0; }
.ime-wrap.ta .ime-toggle { top: 8px; transform: none; }
.ime-toggle.off { color: var(--muted); }
.ime-pop { position: fixed; z-index: 90; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 10px 28px rgba(0,0,0,.14); padding: 4px; display: flex; flex-direction: column; min-width: 150px; font-family: "Noto Sans Devanagari", system-ui, sans-serif; }
.ime-roman { font: 11px ui-monospace, Menlo, monospace; color: var(--muted); padding: 2px 8px 4px; border-bottom: 1px solid var(--line); margin-bottom: 2px; }
.ime-pop button { display: flex; gap: 8px; align-items: center; text-align: left; border: 0; background: transparent; padding: 5px 8px; border-radius: 6px; font: inherit; font-size: 15px; cursor: pointer; color: var(--ink); }
.ime-pop button span { font: 11px ui-monospace, Menlo, monospace; color: var(--muted); width: 10px; }
.ime-pop button.on, .ime-pop button:hover { background: #ecebfc; }
