:root {
  --bg: #f3f8f7;
  --card: #ffffff;
  --text: #172033;
  --muted: #667085;
  --line: #dde8e6;
  --accent: #0f766e;
  --accent-2: #0e9aa7;
  --accent-soft: #e6f4f1;
  --accent-text: #ffffff;
  --error: #d92d20;
  --ok: #067647;
  --ok-soft: #e7f6ee;
  --bad-soft: #fdecea;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --radius: 14px;
}
@media all {
  :root[data-theme="dark"] {
    --bg: #101216;
    --card: #181b21;
    --text: #e7e9ee;
    --muted: #9aa1ae;
    --line: #2a2e37;
    --accent: #34c7b3;
    --accent-2: #3aa8d8;
    --accent-soft: #1a2b2d;
    --accent-text: #06201c;
    --error: #f2786e;
    --ok: #5fd08a;
    --ok-soft: #17281f;
    --bad-soft: #2e1b1d;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
  }
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.55 Inter, system-ui, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
h1, h2, h3 { letter-spacing: -.01em; }

/* top bar */
.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 28px; background: color-mix(in srgb, var(--card) 85%, transparent); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line); }
.brand { font-weight: 700; display: flex; align-items: center; gap: 10px; }
.brand::before { content: ""; width: 28px; height: 28px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 2px 8px rgba(15, 118, 110, .35); }
.who { color: var(--muted); font-size: 14px; display: flex; align-items: center; gap: 10px; }
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; font-weight: 500; padding: 4px 8px;
  border-radius: 8px; transition: background .15s; }
.link:hover { background: var(--accent-soft); }

main { padding: 24px 28px 48px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 32px; margin: 10vh auto 0;
  box-shadow: var(--shadow); }
.narrow { max-width: 420px; }
h1 { margin: 0 0 16px; font-size: 24px; }
label { display: block; margin-bottom: 14px; font-size: 13px; font-weight: 500; color: var(--muted); }
input { display: block; width: 100%; margin-top: 6px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; transition: border-color .15s, box-shadow .15s; }
input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.btn:focus-visible, .cat-item:focus-visible, .link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.error { color: var(--error); min-height: 1.5em; margin: 0 0 8px; font-size: 14px; }
.muted { color: var(--muted); }
.center { text-align: center; }

/* buttons */
.btn { font: inherit; font-weight: 500; padding: 10px 18px; border-radius: 10px; border: 1px solid var(--line); background: var(--card);
  color: var(--text); cursor: pointer; transition: transform .1s, box-shadow .15s, border-color .15s; }
.btn:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.btn:active { transform: translateY(1px); }
.btn.primary { width: 100%; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-text);
  border-color: transparent; font-weight: 600; }
.btn.primary:hover { box-shadow: 0 6px 18px rgba(15, 118, 110, .35); }
.btn.big { padding: 16px 28px; font-size: 16px; font-weight: 600; white-space: nowrap; border-radius: 12px; box-shadow: var(--shadow); }
.btn.big[aria-expanded="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
#btn-add { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-text); border-color: transparent; }
#btn-add::before { content: "+ "; font-weight: 700; }

/* home: category strip */
.home { max-width: 1400px; margin: 0 auto; }
.choices { display: flex; align-items: stretch; gap: 14px; flex-wrap: wrap; }
.menu-btn { background: none; border: 1px solid var(--line); border-radius: 8px; width: 38px; height: 38px; font-size: 20px;
  line-height: 1; cursor: pointer; color: var(--text); font-family: inherit; margin-right: 10px; }
.menu-btn:hover { border-color: var(--accent); color: var(--accent); }
.topbar .brand { margin-right: auto; }
.backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 19; }
.sidebar { position: fixed; top: 0; left: 0; bottom: 0; width: 280px; max-width: 85vw; z-index: 20; background: var(--card);
  border-right: 1px solid var(--line); box-shadow: var(--shadow); padding: 18px 14px; display: flex; flex-direction: column; gap: 12px;
  transform: translateX(-100%); transition: transform .22s ease; overflow-y: auto; }
.sidebar.open { transform: none; }
.sidebar h2 { font-size: 15px; margin: 4px 6px 0; }
.cat-list { display: flex; flex-direction: column; gap: 6px; }
.cat-item { text-align: left; padding: 10px 12px; border-radius: 8px; background: none; border: 1px solid transparent;
  font: inherit; font-weight: 600; font-size: 14px; color: var(--text); cursor: pointer; }
.cat-item:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.side-actions { margin-top: auto; display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }

.card.inline { margin-top: 24px; }
.panel { margin-top: 28px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow); }
.panel h2 { font-size: 22px; margin: 0 0 16px; }
.panel h3 { font-size: 16px; margin: 20px 0 8px; }

/* tables */
.table-scroll { overflow: auto; max-height: 60vh; border: 1px solid var(--line); border-radius: 12px; background: var(--card); }
table { border-collapse: collapse; width: 100%; font-size: 14px; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
th { position: sticky; top: 0; background: var(--bg); color: var(--muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: .04em; }
tbody tr { transition: background .1s; }
tbody tr:hover { background: var(--accent-soft); }
tbody tr:last-child td { border-bottom: 0; }
#licenses th, #licenses td { white-space: normal; overflow-wrap: anywhere; vertical-align: top; padding: 10px 8px; font-size: 13px; }
#licenses th { position: sticky; top: 0; }
td .link { padding-left: 0; }

.search { display: flex; align-items: center; gap: 8px; max-width: 420px; margin: 0 0 14px auto; font-size: 13px; }
.search input { margin: 0; border-radius: 999px; padding-left: 16px; }
.toolbar { margin: 0 0 8px; text-align: right; }
.heading-edit { margin: 0; padding: 4px 6px; font-size: 13px; font-weight: 600; text-transform: none; letter-spacing: 0; }

.sources { margin-top: 24px; }
.sources summary { cursor: pointer; color: var(--accent); font-weight: 500; margin-bottom: 12px; }
.upload-bar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.upload-bar input { width: auto; margin: 0; }
.doc-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; padding: 8px 0; border-bottom: 1px solid var(--line, #e5e7eb); }
.doc-row .doc-text { flex: 1 1 220px; min-width: 0; overflow-wrap: anywhere; }
.uploads { list-style: none; padding: 0; margin: 0; }
.uploads li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.uploads .link { padding-left: 0; margin-right: 16px; }

/* status pills */
.badge { padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 0; color: var(--muted);
  background: var(--bg); }
.badge.ok { color: var(--ok); background: var(--ok-soft); }
.badge.bad { color: var(--error); background: var(--bad-soft); }

/* manual entry form */
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 16px; }
#row-form { max-width: none; margin: 0 0 18px; padding: 20px; background: var(--accent-soft); box-shadow: none; }
#row-form h3 { margin: 0 0 14px; }
#row-form .btn.primary { width: auto; }

@media (max-width: 640px) {
  main { padding: 16px 14px 40px; }
  .topbar { padding: 10px 14px; }
  .panel { padding: 16px; }
  .search { max-width: none; }
}

/* inline entry: the table itself is the form */
.cell-input { margin: 0; padding: 6px 8px; font-size: 13px; background: transparent; border-color: transparent; border-radius: 8px; min-width: 0; }
.cell-input:hover { border-color: var(--line); }
.cell-input:focus { background: var(--card); }
tr.entry td { background: var(--accent-soft); vertical-align: middle; }
tr.entry .cell-input { background: var(--card); border-color: var(--line); }
.btn.small { padding: 6px 14px; font-size: 13px; }
.link.danger { color: var(--error); }
.link.danger:hover { background: var(--bad-soft); }
.icon-btn { display: inline-flex; padding: 6px; border: 0; border-radius: 8px; background: none; cursor: pointer; }
.icon-btn.danger { color: var(--error); }
.icon-btn.danger:hover { background: var(--bad-soft); }

/* one-line box that opens to the full text on hover or focus */
.pop { position: relative; height: 34px; min-width: 70px; }
.pop textarea { position: absolute; top: 0; left: 0; width: 100%; height: 100%; margin: 0; padding: 6px 8px; resize: none; overflow: hidden;
  font: inherit; font-size: 13px; line-height: 20px; color: var(--text); text-transform: none; letter-spacing: 0; white-space: nowrap;
  text-overflow: ellipsis; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
.pop.open { z-index: 6; }
.pop.open textarea { width: max(100%, 280px); height: auto; white-space: normal; overflow-wrap: anywhere; border-color: var(--accent);
  box-shadow: 0 8px 24px rgba(16, 24, 40, .18); }
.pop textarea:focus { outline: none; box-shadow: 0 0 0 3px var(--accent-soft), 0 8px 24px rgba(16, 24, 40, .18); }
th .pop { font-weight: 600; }
th:has(.pop.open) { z-index: 7; }  /* sticky headers each form their own layer; lift the one being edited above its neighbours */

/* compact table: smaller type, tighter cells, no mid-word breaks in headings or status */
#licenses { font-size: 12px; }
#licenses th { font-size: 10.5px; padding: 8px 5px; overflow-wrap: normal; word-break: normal; line-height: 1.25; vertical-align: middle; }
#licenses td { padding: 5px 4px; font-size: 12px; vertical-align: middle; }
#licenses .cell-input, #licenses .pop textarea { font-size: 12px; padding: 4px 6px; border-radius: 6px; }
#licenses .cell-input { height: 28px; }
#licenses .pop { height: 28px; min-width: 60px; }
#licenses .pop textarea { line-height: 18px; }
#licenses input[type="date"] { min-width: 112px; padding-right: 2px; }
#licenses input[type="date"]::-webkit-calendar-picker-indicator { width: 12px; margin-left: 0; padding: 0; opacity: .6; }
#licenses td:nth-last-child(-n+3) { white-space: nowrap; }
#licenses .badge { font-size: 11px; padding: 1px 8px; white-space: nowrap; }
#licenses .btn.small { padding: 4px 10px; font-size: 12px; }
#licenses .link { font-size: 12px; }
#licenses .icon-btn { padding: 4px; }
#licenses .icon-btn svg { width: 15px; height: 15px; }

/* keep the sticky header above rows scrolling underneath it */
#licenses th { z-index: 5; }
.pop.open { z-index: 4; }
#licenses th:has(.pop.open) { z-index: 7; }

/* dashboard */
a.brand { color: inherit; text-decoration: none; cursor: pointer; }
.dash h1 { font-size: 22px; margin: 6px 0 4px; }
.dash-sub { font-size: 16px; margin: 28px 0 8px; }
.dash table { width: 100%; }
.dash tr.clickable { cursor: pointer; }
.dash tr.clickable:hover td { background: var(--accent-soft); }
.due-soon { color: #b45309; font-weight: 600; }
.due-past { color: #b91c1c; font-weight: 600; }
.cat-grid { display: flex; gap: 12px; margin: 16px 0; overflow-x: auto; padding: 2px 2px 10px; cursor: grab; user-select: none;
  -webkit-user-select: none; touch-action: pan-x; scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
.cat-grid.dragging { cursor: grabbing; }
.cat-grid .cat-card { flex: 0 0 auto; cursor: inherit; }
.cat-card { padding: 9px 16px; border-radius: 999px; white-space: nowrap; background: var(--card); border: 1px solid var(--line); box-shadow: var(--shadow);
  font: inherit; font-weight: 600; font-size: 14px; color: var(--text); cursor: pointer; text-align: center; }
.cat-card:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }

/* ---- modern UI layer ---- */
:root { --radius: 14px; --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06); --warn: #b45309; --warn-soft: #fef3c7; }
:root[data-theme="dark"] { --warn: #fbbf24; --warn-soft: #3a2e0b; }
body { letter-spacing: -.005em; -webkit-font-smoothing: antialiased; }
h1 { letter-spacing: -.02em; }
.logo { display: inline-block; width: 28px; height: 28px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex: none; }
.logo.big { width: 52px; height: 52px; border-radius: 14px; }
.sidebar { padding: 0; gap: 0; width: 272px; }
.side-head { display: flex; align-items: center; gap: 10px; padding: 18px 18px 14px; font-weight: 700; font-size: 15px; border-bottom: 1px solid var(--line); }
.side-nav { display: flex; flex-direction: column; gap: 4px; padding: 14px 10px; flex: 1; }
.nav-item { display: flex; align-items: center; gap: 12px; text-align: left; padding: 11px 12px; border-radius: 10px; background: none; border: 0;
  font: inherit; font-weight: 600; font-size: 14px; color: var(--muted); cursor: pointer; }
.nav-item svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.nav-item:hover { background: var(--accent-soft); color: var(--accent); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); }
.nav-item:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.side-foot { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-top: 1px solid var(--line); }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; color: #fff; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); flex: none; }
.side-user { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.side-user strong, .side-user small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-user small { color: var(--muted); }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { margin: 0 0 4px; font-size: 28px; }
.page-head p { margin: 0; }
.crumbs { margin: 0; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--accent); text-decoration: none; font-weight: 600; }
.crumbs span { color: var(--text); font-weight: 600; }
.cat-title { font-size: 24px; letter-spacing: -.02em; }
.login-brand { text-align: center; margin-bottom: 18px; }
.login-brand h1 { font-size: 24px; margin: 14px 0 6px; line-height: 1.2; }
.login-brand p { margin: 0; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.kpi { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 4px; border-top: 3px solid var(--accent); }
.kpi span { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.kpi strong { font-size: 34px; line-height: 1.1; letter-spacing: -.03em; }
.kpi small { color: var(--muted); font-size: 12px; }
.kpi.ok { border-top-color: var(--ok); } .kpi.warn { border-top-color: #f59e0b; } .kpi.warn2 { border-top-color: #f97316; } .kpi.bad { border-top-color: var(--error); }
.dash-sub { font-size: 17px; margin: 30px 0 12px; letter-spacing: -.01em; }
.cat-stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.stat { text-align: left; font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; box-shadow: var(--shadow); transition: transform .12s, border-color .12s; }
.stat:hover { border-color: var(--accent); transform: translateY(-2px); }
.stat strong { font-size: 15px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat div { margin-top: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.stat em, .stat i, .stat b { font-style: normal; font-weight: 600; font-size: 11px; padding: 3px 9px; border-radius: 999px; }
.stat em { background: var(--bad-soft); color: var(--error); }
.stat i { background: var(--warn-soft); color: var(--warn); }
.stat b { background: var(--ok-soft); color: var(--ok); }
th { font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
tbody tr:hover td { background: var(--accent-soft); }
.table-scroll { box-shadow: var(--shadow); }
.btn.primary, #btn-add { box-shadow: 0 2px 8px rgba(37,99,235,.25); }
@media (max-width: 640px) { .page-head h1 { font-size: 23px; } .kpi strong { font-size: 28px; } main { padding-left: 16px; padding-right: 16px; } }

.head-left { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.btn.back { background: var(--card); color: var(--text); border: 1px solid var(--line); padding: 8px 14px; font-size: 14px; box-shadow: none; }
.btn.back:hover { border-color: var(--accent); color: var(--accent); }
.panel > .btn.back { margin-bottom: 14px; }

.cat-card.active { background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: #fff; border-color: transparent; }
#cat-panel .page-head { margin-bottom: 12px; align-items: center; }
#cat-panel .page-head h2 { margin: 0; }

/* ---- approvals, users, roles ---- */
.count-badge { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: 999px; background: var(--error); color: #fff; font-size: 11px; font-weight: 700; text-align: center; }
.seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--bg); border: 1px solid var(--line); border-radius: 999px; }
.seg button { border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: var(--muted); padding: 6px 14px; border-radius: 999px; cursor: pointer; }
.seg button.active { background: var(--card); color: var(--accent); box-shadow: var(--shadow); }
.cards { display: flex; flex-direction: column; gap: 12px; }
.cards .card { margin: 0; max-width: none; padding: 16px 18px; box-shadow: var(--shadow); }
.card.appr { border-left: 4px solid var(--line); }
.card.appr.add { border-left-color: var(--ok); }
.card.appr.edit { border-left-color: #f59e0b; }
.card.appr.delete { border-left-color: var(--error); }
.appr-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.appr-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.appr-actions input { flex: 1 1 220px; margin: 0; }
.badge.kind-add { color: var(--ok); background: var(--ok-soft); }
.badge.kind-edit { color: var(--warn); background: var(--warn-soft); }
.badge.kind-delete { color: var(--error); background: var(--bad-soft); }
.badge.flag { color: var(--error); background: var(--bad-soft); white-space: nowrap; }
.btn.danger { background: var(--card); color: var(--error); border: 1px solid var(--error); box-shadow: none; }
.btn.danger:hover { background: var(--bad-soft); }
.muted.small, .small.muted { font-size: 12px; margin: 6px 0 0; }
tr.flagged td { background: var(--bad-soft); }
tr.flagged:hover td { background: var(--bad-soft); }
.card.role { display: flex; flex-direction: column; gap: 8px; }
.card.role input[type="text"] { margin: 0; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 8px 16px; margin-top: 6px; }
.perm-grid label { display: flex; align-items: center; gap: 8px; font-size: 14px; margin: 0; }
.perm-grid input { width: auto; margin: 0; }
.card.inline { max-width: 640px; margin: 0 0 18px; }
.row-actions { display: flex; gap: 14px; }
td select { margin: 0; padding: 6px 8px; width: auto; }
input[readonly].cell-input, .pop textarea[readonly] { cursor: default; }

/* settings: administration links */
.admin-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.admin-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 12px 14px; font: inherit; font-weight: 600; text-align: left; color: inherit; background: var(--surface, #fff); border: 1px solid var(--line, #e2e8f0); border-radius: 10px; cursor: pointer; }
.admin-link:hover { background: #f1f5f9; }
.admin-link svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---- responsive layout ---- */
html { -webkit-text-size-adjust: 100%; }
img, svg { max-width: 100%; }
main { max-width: 1600px; margin: 0 auto; width: 100%; }
.narrow { width: 100%; }
.table-scroll { max-height: 65vh; max-height: 65dvh; -webkit-overflow-scrolling: touch; }
.card { margin-top: clamp(16px, 8vh, 10vh); }
.brand { min-width: 0; }
.cat-stats { grid-template-columns: repeat(auto-fill, minmax(min(220px, 100%), 1fr)); }
.kpis { grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
.perm-grid { grid-template-columns: repeat(auto-fill, minmax(min(210px, 100%), 1fr)); }
@media (max-width: 1024px) {
  main { padding: 20px 20px 40px; }
  .page-head h1 { font-size: 25px; }
}
@media (max-width: 640px) {
  .brand { font-size: 14px; }
  .brand::before { width: 22px; height: 22px; }
  .who { font-size: 13px; gap: 6px; }
  #who { display: none; }
  .card { padding: 20px; }
  .page-head { align-items: stretch; }
  .page-head > .btn, .page-head > .seg { align-self: flex-start; }
  .btn.big { padding: 12px 20px; font-size: 15px; }
  .toolbar { text-align: left; }
  .table-scroll { max-height: 70dvh; }
  .appr-actions input { flex-basis: 100%; }
  .card.inline { max-width: none; }
  .cards .card { padding: 14px; }
}
@media (max-width: 400px) {
  main { padding-left: 12px; padding-right: 12px; }
  .kpi strong { font-size: 24px; }
}

/* settings page fills the width */
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(380px, 100%), 1fr)); gap: 20px; align-items: start; }
.settings-grid .card { margin: 0; max-width: none; }
.settings-grid .dash-sub { margin-top: 0; }
.admin-list { margin-bottom: 0; }

/* edit popup and approval diff */
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .icon-btn { margin-left: 2px; }
.modal-back { position: fixed; inset: 0; z-index: 50; background: rgba(16, 24, 40, .45); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal { width: min(760px, 100%); max-height: 92vh; overflow: auto; margin: 0; }
.modal-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px 16px; margin: 14px 0; }
.modal-grid label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; }
.modal-grid input, .modal-grid textarea { font-weight: 400; margin: 0; width: 100%; }
.modal-actions { display: flex; align-items: center; gap: 14px; }
table.diff { width: 100%; margin-top: 10px; font-size: 13px; }
table.diff td.was { background: #fef2f2; color: #991b1b; text-decoration: line-through; }
table.diff td.now { background: #f0fdf4; color: #166534; font-weight: 600; }

/* the table shows every value in full; only the entry row at the top holds inputs */
#licenses td { white-space: normal; overflow-wrap: anywhere; vertical-align: middle; line-height: 1.35; padding: 8px 6px; }
#licenses tr.entry textarea { height: 28px; resize: none; overflow: hidden; }
#licenses td.row-actions { white-space: nowrap; min-width: 64px; }
#licenses .row-actions .icon-btn svg { width: 17px; height: 17px; }

/* larger edit and delete buttons */
#licenses td.row-actions { min-width: 96px; }
#licenses td.row-actions .icon-btn { width: 38px; height: 38px; padding: 0; align-items: center; justify-content: center; border: 1px solid var(--line, #d0d5dd); border-radius: 10px; margin-left: 6px; }
#licenses td.row-actions .icon-btn svg { width: 22px; height: 22px; flex: none; }
#licenses td.row-actions .icon-btn.danger { border-color: var(--error); }
#licenses td.row-actions .icon-btn:hover { background: var(--bad-soft, #eef); }

/* compact: the table always fits its container */
#licenses { table-layout: auto; width: 100%; font-size: 11.5px; }
#licenses th { font-size: 9.5px; padding: 6px 3px; letter-spacing: 0; }
#licenses td { font-size: 11.5px; padding: 5px 3px; line-height: 1.25; }
#licenses .cell-input, #licenses .pop textarea { width: 100%; min-width: 0; font-size: 11px; padding: 3px 4px; }
#licenses .pop { min-width: 0; }
#licenses input[type="date"] { min-width: 0; width: 100%; padding: 3px 2px; font-size: 10px; }
#licenses input[type="date"] { min-width: 96px; cursor: pointer; }
#licenses input[type="date"]::-webkit-calendar-picker-indicator { display: inline-block; width: 14px; height: 14px; opacity: .75; cursor: pointer; }
#licenses td:nth-last-child(-n+3) { white-space: normal; }
#licenses td.row-actions { min-width: 0; width: 1%; white-space: nowrap; }
#licenses td.row-actions .icon-btn { width: 30px; height: 30px; margin-left: 3px; }
#licenses td.row-actions .icon-btn svg { width: 18px; height: 18px; }
#licenses .btn.small { padding: 3px 7px; font-size: 11px; }

/* edit popup: refined look */
.modal-back { background: rgba(15, 23, 42, .55); backdrop-filter: blur(6px); animation: fadein .15s ease; }
.modal { padding: 0; border-radius: 20px; border: 1px solid var(--line); box-shadow: 0 30px 80px rgba(15, 23, 42, .35); animation: popin .18s ease; display: flex; flex-direction: column; }
.modal h2 { margin: 0; padding: 22px 28px 4px; font-size: 20px; letter-spacing: -.01em; }
.modal > .muted { margin: 0; padding: 0 28px 16px; border-bottom: 1px solid var(--line); font-size: 13px; }
.modal-grid { gap: 16px 18px; margin: 0; padding: 20px 28px; overflow: auto; }
.modal-grid label { gap: 6px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.modal-grid input, .modal-grid textarea { font: 500 14px/1.4 inherit; font-family: inherit; letter-spacing: 0; text-transform: none; color: var(--text, inherit);
  padding: 10px 12px; min-height: 42px; resize: none; overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); transition: border-color .15s, box-shadow .15s; }
.modal-grid input:focus, .modal-grid textarea:focus { outline: none; border-color: var(--accent); background: var(--card); box-shadow: 0 0 0 3px rgba(15, 118, 110, .2); }
.modal .error { margin: 0; padding: 0 28px; }
.modal-actions { flex-direction: row-reverse; justify-content: flex-start; padding: 16px 28px 22px; border-top: 1px solid var(--line); background: var(--bg); border-radius: 0 0 20px 20px; }
.modal-actions .btn { width: auto; padding: 10px 24px; }
.modal-actions .link { padding: 10px 16px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.modal-actions .link:hover { background: var(--line); }
@keyframes fadein { from { opacity: 0 } }
@keyframes popin { from { opacity: 0; transform: translateY(10px) scale(.98) } }
.modal-grid label { justify-content: flex-end; }

/* ADD license sits top right of the Category page, as tall as a category pill */
#view-cats > .page-head { align-items: flex-start; }
#view-cats #btn-add { padding: 9px 22px; font: inherit; font-weight: 600; font-size: 14px; border: 1px solid transparent; border-radius: 999px; box-shadow: var(--shadow); align-self: flex-start; }
#cat-panel .page-head:empty, #cat-panel .page-head { margin-bottom: 8px; }

/* Headings chosen when a category is created */
.heads { margin: 14px 0 6px; }
.heads-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.head-row { display: flex; gap: 6px; align-items: center; min-width: 0; }
.head-row input { flex: 1; width: 100%; min-width: 0; padding: 8px 10px; font: inherit; font-size: 13px; border: 1px solid var(--border, #dfe2ec); border-radius: 10px; background: transparent; color: inherit; }
.head-row:not(.on) input { opacity: .5; }
.head-num { flex: none; width: 32px; height: 32px; padding: 0; border-radius: 9px; border: 2px solid var(--border, #c9cde0); background: transparent; color: #fff; font: inherit; font-size: 13px; font-weight: 700; cursor: pointer; }
.head-row.on .head-num { background: var(--accent); border-color: var(--accent); }
@media (max-width: 560px) { .heads-list { grid-template-columns: 1fr; } }

.badge.wait { background: #fef3c7; color: #92400e; }
#licenses tr.waiting td { background: rgba(245, 158, 11, .08); }
.head-row select { flex: 0 0 auto; max-width: 150px; padding: 8px; font: inherit; font-size: 13px; border: 1px solid var(--border, #dfe2ec); border-radius: 10px; background: transparent; color: inherit; }

/* row actions: quiet, corporate icon buttons */
#licenses td.row-actions .icon-btn { width: 28px; height: 28px; margin-left: 2px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #64748b; transition: background .12s, color .12s, border-color .12s; }
#licenses td.row-actions .icon-btn svg { width: 16px; height: 16px; stroke-width: 1.6; }
#licenses td.row-actions .icon-btn:hover { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
#licenses td.row-actions .icon-btn.danger { color: #94a3b8; border-color: transparent; }
#licenses td.row-actions .icon-btn.danger:hover { background: var(--bad-soft); color: var(--error); }
#licenses td.row-actions .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* notifications */
.bell-wrap { position: relative; margin-left: auto; }
.bell { position: relative; background: none; border: 0; padding: 6px; cursor: pointer; color: inherit; }
.bell svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.bell .count-badge { position: absolute; top: -2px; right: -4px; }
.bell-panel { position: absolute; right: 0; top: 100%; width: min(340px, 90vw); max-height: 60vh; overflow: auto; background: #fff; color: #1f2937;
  border: 1px solid #d9dee7; border-radius: 8px; box-shadow: 0 8px 24px rgba(0,0,0,.15); z-index: 50; padding: 6px; }
.bell-panel p { margin: 0; padding: 8px 10px; font-size: 13px; border-radius: 6px; }
.bell-panel .unread { background: #eef4ff; font-weight: 600; }

/* upload: per-sheet send */
.sheet-up { margin-left: auto; width: 36px; height: 36px; align-items: center; justify-content: center; border: 1px solid var(--line, #d0d5dd); border-radius: 10px; color: var(--accent); }
.sheet-up svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.sheet-up:hover:not(:disabled) { background: var(--accent-soft); }
.sheet-up:disabled { opacity: .45; cursor: default; }
.sheet-done { opacity: .75; }
.appr-top input[type=text] { flex: 1 1 220px; min-width: 0; }

.cat-card.deleting { opacity: .6; text-decoration: line-through; }
.cat-card.deleting::after { content: " (deletion pending)"; font-size: 12px; }
.confirm-box { width: min(440px, 100%); }
.confirm-box > .muted { border-bottom: 0; padding-bottom: 22px; font-size: 14px; line-height: 1.5; }
.confirm-box .btn.danger { background: var(--error); border-color: var(--error); color: #fff; }

.dash-search { margin-bottom: 18px; }
.dash-search input { width: 100%; font: inherit; padding: 12px 14px 12px 40px; border: 1px solid var(--line); border-radius: var(--radius);
  background: var(--card) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 13px center; color: var(--text); }
.dash-search input:focus { outline: 2px solid var(--accent, #2563eb); outline-offset: 1px; }
#search-results { margin-top: 12px; }
#search-info { margin: 0 0 6px; }

/* Users page: teal / amber palette */
#view-users { --u: #0f766e; --u-soft: #e6f4f1; --u-line: #d5e6e2; }
:root[data-theme="dark"] #view-users { --u: #34c7b3; --u-soft: #1a2b2d; --u-line: #284246; }
.ustats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(200px, 100%), 1fr)); gap: 14px; margin-bottom: 18px; }
.ustat { background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--u); border-radius: var(--radius); padding: 14px 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 4px; }
.ustat span { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.ustat strong { font-size: 28px; line-height: 1.1; }
.ustat.s1 { border-left-color: #16a34a; } .ustat.s2 { border-left-color: #d97706; } .ustat.s3 { border-left-color: #0369a1; }
.ubox { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.utools { display: flex; flex-wrap: wrap; gap: 10px; padding: 14px; border-bottom: 1px solid var(--line); }
.utools input, .utools select { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; }
.utools input { flex: 1 1 240px; }
.utools input:focus, .utools select:focus { outline: 2px solid var(--u); outline-offset: 1px; }
.utable { width: 100%; border-collapse: collapse; }
.utable th { text-align: left; font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); background: var(--u-soft); padding: 11px 16px; }
.utable td { padding: 12px 16px; border-top: 1px solid var(--line); vertical-align: middle; }
.utable tbody tr:hover { background: var(--u-soft); }
.usercell { display: flex; align-items: center; gap: 12px; }
.avatar { width: 38px; height: 38px; flex: none; border-radius: 50%; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.who { display: flex; flex-direction: row; align-items: center; gap: 10px; min-width: 0; white-space: nowrap; }
.topbar { padding: 6px 28px; }
.topbar .brand-logo { height: 28px; }
.topbar .menu-btn { width: 34px; height: 34px; }
.who small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.rolepick { font: inherit; font-size: 12px; font-weight: 600; color: var(--u); background: var(--u-soft); border: 1px solid var(--u-line); border-radius: 999px; padding: 5px 10px; }
.upill { display: inline-block; font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 999px; }
.upill.on { background: #dcfce7; color: #166534; } .upill.off { background: #fee2e2; color: #991b1b; } .upill.wait { background: var(--warn-soft); color: var(--warn); }
:root[data-theme="dark"] .upill.on { background: #17281f; color: #4ade80; } :root[data-theme="dark"] .upill.off { background: #2e1b1d; color: #f97066; }
#view-users .row-actions { text-align: right; white-space: nowrap; }
.ubtn { font: inherit; font-size: 12px; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 6px 11px; cursor: pointer; margin-left: 6px; }
.ubtn:hover { border-color: var(--u); color: var(--u); }
#users-empty { padding: 16px; margin: 0; }

.ask-input { width: 100%; font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; margin: 4px 0 14px; }
.ask-input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Dialog polish: solid card surface, readable text, clear buttons */
.modal { background: var(--card); color: var(--text); overflow: hidden; }
.modal > .muted { color: var(--muted); }
.confirm-box { width: min(420px, 100%); }
.confirm-box h2 { padding: 26px 28px 8px; font-size: 19px; }
.confirm-box > .muted { padding: 0 28px 24px; font-size: 14px; line-height: 1.55; }
.confirm-box .modal-actions { justify-content: flex-start; gap: 8px; }
.confirm-box .modal-actions .btn { min-width: 150px; border-radius: 10px; font-weight: 600; box-shadow: none; }
.confirm-box .modal-actions .link { border: 1px solid var(--line); background: var(--card); color: var(--text); }
.confirm-box .modal-actions .link:hover { background: var(--accent-soft); border-color: var(--accent); }
.confirm-box .btn.danger { background: var(--error); border-color: var(--error); color: #fff; }
.confirm-box .btn.danger:hover { filter: brightness(.93); }
.ask-input { margin: 0 28px 22px; width: calc(100% - 56px); }

/* Duplicate rows */
.dup-flag { color: #b45309; font-weight: 600; }
:root[data-theme="dark"] .dup-flag { color: #fbbf24; }
.dup-box { width: min(560px, 100%); }
.dup-box h2 { padding: 24px 28px 6px; }
.dup-box > .muted { padding: 0 28px 14px; font-size: 14px; }
.dup-list { padding: 8px 28px; overflow: auto; max-height: 50vh; display: flex; flex-direction: column; gap: 8px; }
.dup-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; cursor: pointer; }
.dup-item:hover { background: var(--accent-soft); }
.dup-item span { display: flex; flex-direction: column; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.dup-item small { color: var(--muted); }
.dup-box .modal-actions { justify-content: flex-start; }

/* ===== Modern component layer: stat cards, toolbars, tables, pills ===== */
:root { --radius: 16px; --band: color-mix(in srgb, var(--bg) 70%, var(--line)); --warn2: #c2410c; --warn2-soft: #ffedd5; }
:root[data-theme="dark"] { --warn2: #fb923c; --warn2-soft: #3b2412; }

/* stat cards: label and number on the left, tinted icon tile on the right */
.kpi, .ustat, .stat { flex-direction: row; align-items: flex-start; justify-content: space-between; gap: 14px; border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px 20px; }
.kpi { border-top: 1px solid var(--line); }
.ustat { border-left: 1px solid var(--line); }
.kpi-text, .stat-text { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.kpi span, .ustat span { font-size: 11px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.kpi strong, .ustat strong { font-size: 30px; font-weight: 800; line-height: 1.15; letter-spacing: -.02em; }
.icon-tile { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--accent); background: var(--accent-soft); }
.icon-tile svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.kpi.ok .icon-tile, .ustat.s1 .icon-tile { color: var(--ok); background: var(--ok-soft); }
.kpi.warn .icon-tile, .ustat.s2 .icon-tile { color: var(--warn); background: var(--warn-soft); }
.kpi.warn2 .icon-tile { color: var(--warn2); background: var(--warn2-soft); }
.kpi.bad .icon-tile { color: var(--error); background: var(--bad-soft); }
.ustat.s3 .icon-tile { color: var(--accent-2); background: var(--accent-soft); }
.stat { text-align: left; }
.stat:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(16,24,40,.1); }

/* toolbars: one bordered bar holding a wide search and the filters */
.ubox, .panel { border-radius: var(--radius); }
.utools { background: var(--card); padding: 14px 16px; gap: 12px; align-items: center; }
.utools input, .utools select, .dash-search input, .search input {
  background-color: var(--bg); border: 1px solid var(--line); border-radius: 12px; padding: 11px 14px; }
.utools input[type="search"], .search input { padding-left: 40px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='18' height='18' viewBox='0 0 24 24' fill='none' stroke='%238a94a6' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 13px center; }
.utools select { padding-right: 12px; cursor: pointer; }
.dash-search input { border-radius: 14px; box-shadow: var(--shadow); background-color: var(--card); }
.search { display: block; max-width: none; margin: 0 0 14px; font-size: 0; }
.search input { font-size: 14px; border-radius: 12px; margin: 0; width: 100%; }

/* tables: tinted header band, airy rows, hairline dividers */
.table-scroll { border: 1px solid var(--line); border-radius: var(--radius); box-shadow: none; background: var(--card); }
.ubox .table-scroll { border: 0; border-radius: 0; }
th { background: var(--band); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .08em; padding: 13px 16px; border-bottom: 1px solid var(--line); }
td { padding: 14px 16px; }
.dash table td { font-size: 14px; }
.dash table td:first-child { font-weight: 600; }
tbody tr:hover td { background: color-mix(in srgb, var(--accent-soft) 60%, transparent); }
.utable th { background: var(--band); }
.utable tbody tr:hover { background: transparent; }
.utable td { padding: 14px 16px; }
#licenses th { padding: 10px 6px; }
#licenses td { padding: 9px 6px; }

/* status pills with a leading dot */
.badge, .upill { display: inline-flex; align-items: center; gap: 6px; padding: 3px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.upill::before, .badge.ok::before, .badge.bad::before, .badge.wait::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.rolepick { text-transform: uppercase; letter-spacing: .04em; font-size: 11px; padding: 5px 12px; border-radius: 999px; }
.due-soon, .due-past { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; }
.due-soon { background: var(--warn-soft); color: var(--warn); }
.due-past { background: var(--bad-soft); color: var(--error); }

/* action buttons: bordered, with a hint of lift */
.ubtn, .btn.small { border-radius: 10px; padding: 7px 13px; font-weight: 500; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
.ubtn:hover, .btn.small:not(.primary):not(.danger):hover { background: var(--accent-soft); }
.btn { border-radius: 12px; }

/* cards and panels share the same surface */
.card, .panel, .ubox, .kpi, .ustat, .stat, .table-scroll { border-color: var(--line); }
.cards .card { border-radius: var(--radius); }
.cat-card { border-radius: 12px; padding: 10px 18px; }
.cat-card.active { box-shadow: 0 4px 14px rgba(15,118,110,.25); }
.page-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.seg { border-radius: 12px; } .seg button { border-radius: 9px; }
.modal { border-radius: 20px; }
.pdf-box { width: min(980px, 100%); height: 92vh; max-height: 92vh; }
.pdf-head { display: flex; gap: 10px; align-items: center; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.pdf-head strong { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.pdf-frame { flex: 1; width: 100%; border: 0; background: #fff; min-height: 0; }

/* "Reading your files": a compact strip with a small book whose pages keep turning while a light scans the text */
.reading { position: relative; display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 18px; margin: 14px 0 4px; padding: 14px 20px 16px; border-radius: 16px; overflow: hidden; text-align: left;
  background: radial-gradient(120% 120% at 50% 0%, rgba(20, 184, 166, .16), transparent 60%), linear-gradient(180deg, rgba(15, 118, 110, .06), transparent); border: 1px solid rgba(15, 118, 110, .18); }
.reading[hidden] { display: none; }
.reading p { margin: 0; font-weight: 600; letter-spacing: .01em; color: inherit; }
.reading p::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.4s steps(4, end) infinite; content: "..."; clip-path: inset(0 100% 0 0); }
@keyframes dots { to { clip-path: inset(0 0 0 0); } }
.reading::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: linear-gradient(90deg, rgba(20, 184, 166, .15) 0, #2dd4bf 50%, rgba(20, 184, 166, .15) 100%) 0 0 / 200% 100%; animation: sweep 1.6s linear infinite; }
@keyframes sweep { to { background-position: -200% 0; } }

.book { position: relative; width: 150px; height: 96px; perspective: 900px; zoom: .45; margin: 4px 10px; flex: none; animation: float 3.2s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-5px); } }
.book .cover { position: absolute; inset: -7px -9px -9px -9px; border-radius: 10px; background: linear-gradient(135deg, #0f766e, #14b8a6 55%, #22d3ee); box-shadow: 0 18px 28px -10px rgba(13, 148, 136, .55); }
.book .cover::after { content: ""; position: absolute; left: 50%; top: 6px; bottom: 6px; width: 2px; margin-left: -1px; background: rgba(0, 0, 0, .18); border-radius: 2px; }
.book::before, .book::after, .book .pg { content: ""; position: absolute; top: 0; width: 50%; height: 100%; border: 0;
  background:
    linear-gradient(#c9dedc, #c9dedc) 14% 18px / 62% 4px no-repeat,
    linear-gradient(#d9e8e6, #d9e8e6) 14% 30px / 72% 4px no-repeat,
    linear-gradient(#d9e8e6, #d9e8e6) 14% 42px / 54% 4px no-repeat,
    linear-gradient(#d9e8e6, #d9e8e6) 14% 54px / 68% 4px no-repeat,
    linear-gradient(#d9e8e6, #d9e8e6) 14% 66px / 44% 4px no-repeat,
    linear-gradient(#fff, #f4faf9); }
.book::before { left: 0; border-radius: 6px 0 0 6px; z-index: 1; box-shadow: inset -14px 0 14px -10px rgba(0, 0, 0, .22); }
.book::after { left: 50%; border-radius: 0 6px 6px 0; z-index: 1; box-shadow: inset 14px 0 14px -10px rgba(0, 0, 0, .22); }
.book .pg { left: 50%; z-index: 2; border-radius: 0 6px 6px 0; transform-origin: left center; animation: turn 2.4s infinite cubic-bezier(.5, .05, .3, 1); box-shadow: 0 0 10px rgba(0, 0, 0, .08); }
.book .p2 { animation-delay: .28s; } .book .p3 { animation-delay: .56s; } .book .p4 { animation-delay: .84s; } .book .p5 { animation-delay: 1.12s; }
@keyframes turn {
  0% { transform: rotateY(0); z-index: 3; filter: brightness(1); }
  50% { transform: rotateY(-90deg); filter: brightness(.88); }
  72% { transform: rotateY(-180deg); z-index: 3; filter: brightness(1); opacity: 1; }
  100% { transform: rotateY(-180deg); z-index: 2; opacity: 0; }
}
.book .cover::before { content: ""; position: absolute; left: 9px; right: 9px; top: 7px; height: 3px; border-radius: 3px; z-index: 5; background: linear-gradient(90deg, transparent, #67e8f9, transparent); box-shadow: 0 0 14px 4px rgba(34, 211, 238, .75); animation: scan 1.8s ease-in-out infinite alternate; }
@keyframes scan { from { transform: translateY(0); } to { transform: translateY(88px); } }
/* "Uploading": pages fly from one folder to the other, like the old Windows copy dialog */
.sending { position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 14px 0 4px; padding: 14px 20px 16px; border-radius: 16px; overflow: hidden;
  background: radial-gradient(120% 120% at 50% 0%, rgba(20, 184, 166, .16), transparent 60%); border: 1px solid rgba(15, 118, 110, .18); }
.sending[hidden] { display: none; }
.sending p { margin: 0; font-weight: 600; }
.sending p::after { content: "..."; display: inline-block; animation: dots 1.4s steps(4, end) infinite; clip-path: inset(0 100% 0 0); }
.xfer { display: flex; align-items: center; gap: 10px; width: 360px; max-width: 100%; }
.fold { width: 44px; height: 36px; flex: none; fill: #f59e0b; stroke: #b45309; stroke-width: 2; stroke-linejoin: round; }
.fold.to { fill: #2dd4bf; stroke: #0f766e; animation: gulp 1.6s ease-in-out infinite; transform-origin: 50% 100%; }
@keyframes gulp { 0%, 100% { transform: scale(1); } 85% { transform: scale(1.08); } }
.lane { position: relative; flex: 1; height: 36px; }
.fl { position: absolute; left: 0; top: 50%; width: 16px; height: 20px; margin-top: -10px; border-radius: 2px; background: linear-gradient(#fff, #e6f2f0); border: 1px solid #7aa9a4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .25); opacity: 0; animation: fly 1.6s linear infinite; }
.fl::before { content: ""; position: absolute; left: 3px; right: 3px; top: 4px; height: 2px; background: #9cc5c0; box-shadow: 0 4px 0 #9cc5c0, 0 8px 0 #9cc5c0; }
.fl.f2 { animation-delay: .4s; } .fl.f3 { animation-delay: .8s; } .fl.f4 { animation-delay: 1.2s; }
@keyframes fly {
  0% { left: 0; transform: translate(0, 6px) rotate(-12deg) scale(.6); opacity: 0; }
  12% { opacity: 1; }
  50% { left: calc(50% - 8px); transform: translate(0, -10px) rotate(6deg) scale(1); }
  88% { opacity: 1; }
  100% { left: calc(100% - 16px); transform: translate(0, 6px) rotate(14deg) scale(.5); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) { .fl, .fold.to, .sending p::after { animation-duration: 6s; } }
@media (prefers-reduced-motion: reduce) { .book, .book .pg, .book .cover::before, .reading::after, .reading p::after { animation-duration: 8s; } }

.appr-bulk { display: flex; align-items: center; gap: 12px; margin: 0 0 12px; flex-wrap: wrap; }
.appr-bulk[hidden] { display: none; }
.appr-bulk .btn { width: auto; flex: none; padding: 8px 18px; font-size: 14px; border-radius: 10px; margin: 0; }
.appr-bulk .btn.danger { font-weight: 600; }
.appr-bulk .btn[hidden] { display: none; }
.appr-bulk { gap: 8px; }
.appr-bulk .btn { padding: 5px 12px; font-size: 12.5px; border-radius: 8px; min-height: 0; line-height: 1.3; }
.theme-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }

/* ---- dark mode touch-ups: components that had light colours written in ---- */
:root[data-theme="dark"] { color-scheme: dark; --surface: var(--card); }
:root[data-theme="dark"] .admin-link { background: var(--card); border-color: var(--line); color: var(--text); }
:root[data-theme="dark"] .admin-link:hover { background: var(--accent-soft); border-color: var(--accent); }
:root[data-theme="dark"] .bell-panel { background: var(--card); color: var(--text); border-color: var(--line); box-shadow: 0 12px 32px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] .bell-panel .unread { background: var(--accent-soft); }
:root[data-theme="dark"] table.diff td.was { background: #2e1b1d; color: #f2a39c; }
:root[data-theme="dark"] table.diff td.now { background: #17281f; color: #86e0a6; }
:root[data-theme="dark"] .badge.wait { background: #3a2e0b; color: #fbbf24; }
:root[data-theme="dark"] .modal-back { background: rgba(0, 0, 0, .65); }
:root[data-theme="dark"] .modal { box-shadow: 0 30px 80px rgba(0, 0, 0, .6); }
:root[data-theme="dark"] .modal-actions .link:hover { background: var(--line); }
:root[data-theme="dark"] .reading, :root[data-theme="dark"] .sending { border-color: var(--line); }
:root[data-theme="dark"] .book::before, :root[data-theme="dark"] .book::after, :root[data-theme="dark"] .book .pg { background: linear-gradient(#e9efee, #cfdad8); }
:root[data-theme="dark"] .fl { background: linear-gradient(#e9efee, #b9cbc8); }
:root[data-theme="dark"] .stat:hover { box-shadow: 0 8px 24px rgba(0, 0, 0, .45); }
:root[data-theme="dark"] .pop textarea:focus, :root[data-theme="dark"] .pop.open textarea { box-shadow: 0 8px 24px rgba(0, 0, 0, .5); }
:root[data-theme="dark"] input, :root[data-theme="dark"] select, :root[data-theme="dark"] textarea { color: var(--text); }

/* upload bar: compact buttons, file picker that follows the theme */
.upload-bar .btn { width: auto; flex: none; padding: 9px 20px; font-size: 14px; border-radius: 10px; margin: 0; }
input[type="file"]::file-selector-button { margin-right: 10px; padding: 6px 14px; font: inherit; font-size: 13px; font-weight: 600; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
input[type="file"]::file-selector-button:hover { border-color: var(--accent); }

/* approval cards: Approve / Reject sit side by side at normal size */
.card.appr .btn { width: auto; display: inline-block; align-self: flex-start; padding: 6px 16px; font-size: 13px; border-radius: 9px; margin: 8px 8px 0 0; }

.pdf-pick { padding: 6px 10px; border: 1px solid var(--line); border-radius: 9px; background: var(--card); color: var(--text); font: inherit; font-size: 13px; }
.pdf-head .btn { width: auto; }

tr.has-doc { cursor: pointer; }
.pdf-pages { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; background: var(--bg); display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pdf-page { background: #fff; box-shadow: var(--shadow, 0 2px 10px rgba(0,0,0,.25)); max-width: 100%; height: auto; }
.pdf-pages .pdf-frame { height: 100%; min-height: 60vh; }
.pdf-note { margin: 30px 0; }

/* dashboard search: keep room for the magnifier icon */
.dash-search input { padding-left: 42px; }

/* clickable dashboard cards + their big popup */
button.kpi { font: inherit; color: inherit; text-align: left; cursor: pointer; width: auto; transition: transform .12s, box-shadow .12s, border-color .12s; }
button.kpi:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: var(--accent); }
button.kpi:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kpi-pop .pdf-head { gap: 12px; }
.kpi-pop .pdf-head strong { flex: 1; font-size: 17px; }
.kpi-filter { width: min(320px, 40%); padding: 8px 12px; }
.kpi-body { flex: 1; min-height: 0; overflow: auto; padding: 8px 16px 16px; background: var(--card); }
.kpi-body table { width: 100%; }
.kpi-body thead th { position: sticky; top: 0; background: var(--card); z-index: 1; }
.kpi-body p { margin: 30px 0; text-align: center; color: var(--muted); }

/* licence detail popup (about a third of the screen) */
.detail-back { z-index: 60; }
.modal-back:has(.confirm-box) { z-index: 90; }
.detail-box { width: min(480px, 100%); max-width: 100%; max-height: 90vh; overflow: auto; padding: 18px 20px; display: flex; flex-direction: column; gap: 12px; }
.detail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.detail-head strong { display: block; font-size: 18px; }
.detail-head small { color: var(--muted); }
.detail-head .btn, .detail-actions .btn { width: auto; }
.detail-box .badge { align-self: flex-start; }
.detail-list { margin: 0; display: grid; grid-template-columns: 40% 1fr; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.detail-list dt, .detail-list dd { margin: 0; padding: 9px 12px; border-bottom: 1px solid var(--line); font-size: 14px; word-break: break-word; }
.detail-list dt { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; background: var(--bg); }
.detail-list dt:nth-last-of-type(1), .detail-list dd:last-of-type { border-bottom: 0; }
.detail-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.modal-back:has(.pdf-box:not(.kpi-pop)) { z-index: 70; }

/* upload drop box */
.dropzone { display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center; padding: 28px 18px; border: 2px dashed var(--line); border-radius: 14px; background: var(--accent-soft); color: var(--text); cursor: pointer; transition: background .2s, border-color .2s, transform .2s; }
.dropzone:hover { border-color: var(--accent); }
.dropzone input[type="file"] { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.dropzone .dz-icon { width: 40px; height: 40px; color: var(--accent); transition: transform .25s; }
.dropzone.over { border-color: var(--accent); border-style: solid; background: color-mix(in srgb, var(--accent) 22%, var(--card)); transform: scale(1.015); }
.dropzone.over .dz-icon { animation: dz-bob .7s ease-in-out infinite; }
.dropzone.landed { animation: dz-pop .6s ease; }
@keyframes dz-bob { 50% { transform: translateY(-8px); } }
@keyframes dz-pop { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 55%, transparent); } 100% { box-shadow: 0 0 0 18px transparent; } }
.picked { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 6px; }
.picked li { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 6px 10px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; }
.picked li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#view-upload .upload-bar { margin-top: 12px; display: flex; gap: 10px; }

.icon-close { flex: none; width: 38px; height: 38px; display: inline-grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 50%; background: var(--card); color: var(--muted, #64748b); cursor: pointer; transition: background .15s, color .15s, border-color .15s, transform .2s; }
.icon-close svg { width: 18px; height: 18px; }
.icon-close:hover { background: var(--accent-soft); color: var(--accent); border-color: var(--accent); transform: rotate(90deg); }
.icon-close:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.detail-actions .btn { padding: 9px 18px; border-radius: 10px; font-weight: 600; }

.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 14px; margin-top: 14px; border-top: 1px solid var(--line); }
.detail-actions .btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 10px; font-size: 13px; font-weight: 600; border-radius: 9px; box-shadow: none; white-space: nowrap; }
.detail-actions .btn svg { width: 16px; height: 16px; flex: none; }
.detail-actions .btn.primary:hover:not(:disabled) { filter: brightness(1.08); }
.detail-actions .btn:not(.primary) { background: transparent; color: var(--text); }
.detail-actions .btn:not(.primary):hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* details popup: roomier, nothing clipped, quieter labels */
.detail-box { width: min(560px, 100%); padding: 24px 26px; gap: 16px; }
.detail-box > * { flex: none; }
.detail-list { grid-template-columns: 38% 1fr; }
.detail-list dt, .detail-list dd { padding: 12px 16px; line-height: 1.4; }
.detail-list dt { text-transform: none; letter-spacing: 0; font-size: 13px; font-weight: 600; }
.detail-list dd { font-size: 14.5px; color: var(--text); }
.detail-actions { margin-top: 4px; padding-top: 18px; gap: 12px; }
.detail-actions .btn { padding: 11px 14px; }

/* keep the details popup short: tight rows, labels on one line */
.detail-box { width: min(600px, 100%); padding: 16px 22px; gap: 10px; }
.detail-list { grid-template-columns: 42% 1fr; }
.detail-list dt, .detail-list dd { padding: 6px 14px; line-height: 1.3; font-size: 13.5px; }
.detail-actions { margin-top: 0; padding-top: 10px; gap: 10px; }
.detail-actions .btn { padding: 8px 12px; }

/* ---- Dashboard redesign ---- */
#view-dash .page-head h1 { font-size: 30px; letter-spacing: -.03em; }
#view-dash .dash-sub { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 34px 0 14px; display: flex; align-items: center; gap: 12px; }
#view-dash .dash-sub::after { content: ""; flex: 1; height: 1px; background: var(--line); }
#view-dash .kpis { grid-template-columns: repeat(auto-fit, minmax(min(190px, 100%), 1fr)); gap: 16px; }
#view-dash .kpi { position: relative; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; padding: 18px 20px 20px; box-shadow: 0 1px 2px rgba(16,24,40,.04), 0 8px 24px -12px rgba(16,24,40,.12); background: linear-gradient(160deg, var(--card) 55%, var(--accent-soft)); }
#view-dash .kpi.ok { background: linear-gradient(160deg, var(--card) 55%, var(--ok-soft)); }
#view-dash .kpi.warn { background: linear-gradient(160deg, var(--card) 55%, var(--warn-soft)); }
#view-dash .kpi.warn2 { background: linear-gradient(160deg, var(--card) 55%, var(--warn2-soft)); }
#view-dash .kpi.bad { background: linear-gradient(160deg, var(--card) 55%, var(--bad-soft)); }
#view-dash .kpi:hover { transform: translateY(-3px); box-shadow: 0 14px 32px -14px rgba(16,24,40,.28); }
#view-dash .kpi strong { font-size: 40px; font-weight: 800; letter-spacing: -.04em; }
#view-dash .kpi small { font-size: 13px; }
#view-dash .kpi .icon-tile { width: 42px; height: 42px; border-radius: 50%; }
.kpi-share { height: 5px; margin-top: 12px; border-radius: 99px; background: color-mix(in srgb, var(--muted) 18%, transparent); overflow: hidden; }
.kpi-share i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .6s ease; }
.kpi.ok .kpi-share i { background: var(--ok); } .kpi.warn .kpi-share i { background: var(--warn); } .kpi.warn2 .kpi-share i { background: var(--warn2); } .kpi.bad .kpi-share i { background: var(--error); }
#view-dash .cat-stats { grid-template-columns: repeat(auto-fill, minmax(min(250px, 100%), 1fr)); gap: 16px; }
#view-dash .stat { border-radius: 16px; padding: 16px 18px; gap: 6px; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
#view-dash .stat:hover { box-shadow: 0 12px 28px -14px rgba(16,24,40,.25); }
#view-dash .stat strong { font-size: 16px; letter-spacing: -.01em; }
#view-dash .stat .icon-tile { width: 38px; height: 38px; border-radius: 12px; }
.stat-bar { display: flex; gap: 2px; height: 6px; margin-top: 10px !important; border-radius: 99px; overflow: hidden; }
.stat-bar i { display: block; height: 100%; padding: 0 !important; border-radius: 0 !important; }
.stat-bar .r { background: var(--error) !important; } .stat-bar .y { background: var(--warn2) !important; } .stat-bar .g { background: var(--ok) !important; }
#view-dash .table-scroll { border: 1px solid var(--line); border-radius: 16px; overflow: auto; box-shadow: 0 1px 2px rgba(16,24,40,.04); }
#view-dash th { text-transform: none; letter-spacing: 0; font-size: 12.5px; font-weight: 600; padding: 12px 14px; background: color-mix(in srgb, var(--accent-soft) 60%, var(--card)); }
#view-dash td { padding: 12px 14px; }
#view-dash .dash-search input { border-radius: 14px; padding: 13px 18px 13px 46px; }

/* ---- logo ---- */
.brand::before { display: none; }
.brand-logo { height: 34px; width: auto; display: block; }
.side-logo { height: 36px; width: auto; display: block; }
.login-logo { width: min(260px, 70%); height: auto; display: block; margin: 0 auto 10px; }
/* (dark-theme logo tile: see the override further down) */
@media (max-width: 600px) { .brand-logo { height: 28px; } }

/* plain-words share line instead of bars */
.kpi-share { height: auto !important; background: none !important; border-radius: 0; overflow: visible; margin-top: 10px; font-style: normal; font-size: 13px; font-weight: 600; color: var(--muted); }
.stat-bar { display: none !important; }

.kpi-share { display: none !important; }

/* ---- auto fit: scales with the screen, compacts on small ones ---- */
html { -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; }
.table-scroll, .card { overflow-x: auto; }
table { max-width: 100%; }
td, th { overflow-wrap: anywhere; }
.page-head { flex-wrap: wrap; gap: 10px 14px; }
.toolbar, .upload-bar, .detail-actions { flex-wrap: wrap; }
@media (min-width: 1700px) { html { zoom: 1.1; } }
@media (min-width: 2200px) { html { zoom: 1.25; } }
@media (min-width: 3000px) { html { zoom: 1.6; } }
@media (max-width: 1366px), (max-height: 760px) and (min-width: 700px) {
  html { zoom: .93; }
  main { padding-top: 16px; padding-bottom: 32px; }
  #view-dash .kpi strong { font-size: 34px; }
}
@media (max-width: 900px) {
  .kpis { grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); gap: 10px; }
  #view-dash .kpi { padding: 14px; }
  #view-dash .kpi .icon-tile { display: none; }
  .modal-grid { padding: 16px 18px; }
  .modal h2, .modal > .muted, .modal-actions { padding-left: 18px; padding-right: 18px; }
  .detail-box { padding: 14px 16px; }
}
@media (max-width: 600px) {
  .modal-back { padding: 8px; align-items: flex-end; }
  .modal, .detail-box { max-height: 94dvh; border-radius: 18px 18px 12px 12px; }
  .detail-list { grid-template-columns: 38% 1fr; }
  .detail-actions { grid-template-columns: 1fr; }
  .modal-actions { flex-wrap: wrap; }
  .modal-actions .btn { flex: 1; }
  .dropzone { padding: 22px 14px; }
  th, td { padding-left: 8px; padding-right: 8px; }
}

td.due-soon, td.due-past { display: table-cell; background: none; padding: 8px 12px; }
td .due-soon, td .due-past { white-space: nowrap; line-height: 1.5; }

.appr-reason { margin: 8px 0 0; padding: 8px 12px; border-left: 3px solid var(--warn2); background: var(--warn2-soft); border-radius: 8px; font-size: 14px; }
.appr-details { margin: 10px 0; border: 1px solid var(--line); border-radius: 12px; padding: 4px 12px; }
.appr-details summary { cursor: pointer; font-weight: 600; padding: 6px 0; }
.appr-details .detail-list { margin: 6px 0 8px; max-height: 40vh; overflow: auto; }

/* ---- Applied licences (renewal applied for) ---- */
:root { --applied: #7c3aed; --applied-soft: #ede9fe; }
:root[data-theme="dark"] { --applied: #a78bfa; --applied-soft: #2a2145; }
.badge.applied { color: var(--applied); background: var(--applied-soft); }
.badge.applied::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }
.kpi.applied { border-top-color: var(--applied); }
.kpi.applied .icon-tile { color: var(--applied); background: var(--applied-soft); }
#view-dash .kpi.applied { background: linear-gradient(160deg, var(--card) 55%, var(--applied-soft)); }
.btn.applied-on { color: var(--applied); border-color: var(--applied); }
.icon-btn.applied-btn { color: var(--applied); }
.icon-btn.applied-btn.on { background: var(--applied-soft); }

/* step tracker of an applied licence */
.stepper-wrap { margin: 12px 0; }
.stepper { list-style: none; margin: 0; padding: 6px 0 10px; display: flex; overflow-x: auto; }
.step { position: relative; flex: 0 0 96px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 8px; }
.step:not(:first-child)::before { content: ""; position: absolute; top: 11px; right: 50%; width: 100%; height: 6px; margin-top: -1px; border-radius: 3px; background: var(--line); }
.step.done::before, .step.current::before { background: var(--ok); }
.step-dot { position: relative; z-index: 1; flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700;
  border: 3px solid var(--card); color: var(--muted); background: var(--line); box-shadow: 0 0 0 1px var(--line); }
.step.done .step-dot { background: var(--ok); color: #fff; box-shadow: 0 0 0 1px var(--ok); }
.step.current .step-dot { background: var(--ok); color: #fff; box-shadow: 0 0 0 1px var(--ok), 0 0 0 5px var(--ok-soft); }
.step-text { display: flex; flex-direction: column; padding: 0 4px; font-size: 12px; line-height: 1.25; color: var(--muted); }
.step.done .step-text, .step.current .step-text { color: var(--text); }
.step-text b { font-weight: 600; }
.step-text small { font-size: 11px; line-height: 1.2; color: var(--muted); }
.step.clickable { cursor: pointer; }
.step.clickable:hover .step-text b { text-decoration: underline; }
.step.clickable:hover .step-dot { transform: scale(1.12); }
.stepper-note { font-size: 13px; color: var(--ok); margin: 10px 0 8px; }
.stepper-wrap > .btn { width: 100%; }

/* text-free progress bar in the Applied list: blank until a step is done, then filled green */
.mini-steps { display: inline-flex; align-items: center; vertical-align: middle; }
.mini-steps i { position: relative; flex: none; width: 12px; height: 12px; margin-right: var(--gap, 8px); border-radius: 50%; background: var(--line); }
.mini-steps i:last-child { margin-right: 0; }
.mini-steps i:not(:first-child)::before { content: ""; position: absolute; right: 100%; top: 50%; width: var(--gap, 8px); height: 3px; margin-top: -1.5px; background: var(--line); }
.mini-steps i.done, .mini-steps i.current { background: var(--c, var(--ok)); }
.mini-steps i.done::before, .mini-steps i.current::before { background: var(--c, var(--ok)); }
.mini-steps i.current { box-shadow: 0 0 8px 1px var(--c, var(--ok)); animation: stepglow 1.6s ease-in-out infinite; }
@keyframes stepglow { 50% { box-shadow: 0 0 12px 3px var(--c, var(--ok)); } }
/* small instant label above a dot */
.mini-steps i::after { content: attr(data-label); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translateX(-50%); padding: 2px 6px; border-radius: 4px; background: #111827; color: #fff; border: 1px solid rgba(255,255,255,.25); font-style: normal; font-weight: 600; font-size: 11px; line-height: 1.3; white-space: nowrap; pointer-events: none; opacity: 0; z-index: 20; }
.mini-steps i:hover::after { opacity: 1; }
.kpi-body th, .kpi-body td { padding-left: 10px; padding-right: 10px; }

/* Compact dashboard */
#view-dash .page-head { margin-bottom: 10px; }
#view-dash .page-head h1 { font-size: 24px; margin: 0; }
#view-dash .page-head p { font-size: 13px; }
#view-dash .kpis { gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr)); }
#view-dash .kpi { padding: 10px 14px 12px; border-radius: 12px; gap: 8px; }
#view-dash .kpi strong { font-size: 26px; }
#view-dash .kpi small { font-size: 12px; line-height: 1.3; }
#view-dash .kpi span { font-size: 10.5px; }
#view-dash .kpi .icon-tile { width: 30px; height: 30px; }
#view-dash .kpi .icon-tile svg { width: 15px; height: 15px; }
#view-dash .kpi-text { gap: 2px; }
#view-dash .dash-sub { margin: 16px 0 8px; font-size: 12px; }
#view-dash .dash-search { margin-bottom: 10px; }
#view-dash .dash-search input { padding: 9px 14px 9px 42px; font-size: 14px; border-radius: 10px; }
#view-dash .cat-stats { gap: 10px; grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr)); }
#view-dash .stat { padding: 10px 12px; gap: 4px; border-radius: 12px; }
#view-dash .stat strong { font-size: 14px; }
#view-dash .stat .icon-tile { width: 30px; height: 30px; border-radius: 9px; }
#view-dash td, #view-dash th { padding: 8px 12px; }

/* Add category + delete categories side by side */
.cat-split { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.page-head.cat-split { align-items: end; margin-bottom: 20px; }
.cat-split > .card { margin: 0; max-width: none; }
#del-title { text-align: right; }
#add-form { display: flex; flex-direction: column; }
.cat-end { margin-top: auto; }
.cat-btns { display: flex; align-items: center; gap: 14px; }
.cat-btns .btn { flex: 1; }
#del-card { display: flex; flex-direction: column; }
#del-card[hidden] { display: none; }
#del-card .del-list { flex: 1 1 0; max-height: none; min-height: 240px; }
@media (max-width: 900px) { .cat-split { grid-template-columns: 1fr; } }
.del-list { display: flex; flex-direction: column; gap: 4px; max-height: 60vh; overflow: auto; margin: 10px 0; }
.del-item { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line, #e5e7eb); border-radius: 8px; cursor: pointer; }
.del-item input { width: auto; margin: 0; }
.btn.danger { background: #b91c1c; color: #fff; border-color: #b91c1c; }
.btn.danger:disabled { opacity: .45; cursor: not-allowed; }
.del-item[hidden] { display: none; }

/* Category page: fit the screen top to bottom; only the lists inside the cards scroll */
#view-newcat:not([hidden]) { display: flex; flex-direction: column; height: calc(100dvh - 96px); min-height: 360px; }
#view-newcat .page-head.cat-split { margin-bottom: clamp(8px, 1.6vh, 20px); }
#view-newcat .page-head h1 { font-size: clamp(20px, 3.4vh, 28px); }
#view-newcat .page-head p { font-size: clamp(12px, 1.8vh, 15px); }
#view-newcat > .cat-split:not(.page-head) { flex: 1; min-height: 0; }
#view-newcat .cat-split > .card { padding: clamp(12px, 2.2vh, 28px); min-height: 0; overflow: hidden; font-size: clamp(12px, 1.9vh, 15px); gap: clamp(6px, 1.2vh, 12px); }
#view-newcat .card input[type="text"], #view-newcat .card input[type="search"] { padding: clamp(6px, 1.2vh, 12px) 12px; }
#add-form .heads { flex: 1; min-height: 0; display: flex; flex-direction: column; margin: 0; }
#add-form .heads p { margin: 2px 0; }
#add-form .heads-list { flex: 1; min-height: 0; overflow: auto; align-content: start; gap: clamp(4px, 1vh, 8px); }
#view-newcat .del-item { padding: clamp(4px, 1vh, 8px) 10px; }
#view-newcat #del-card .del-list { min-height: 0; margin: 0; }
#view-newcat .btn { padding-top: clamp(7px, 1.4vh, 12px); padding-bottom: clamp(7px, 1.4vh, 12px); }
@media (max-width: 900px) { #view-newcat:not([hidden]) { height: auto; } #view-newcat .cat-split > .card { overflow: visible; } }
.modal-source { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); display: flex; flex-direction: column; gap: 8px; }
.modal-source .dropzone { padding: 14px; flex-direction: row; justify-content: center; gap: 10px; flex-wrap: wrap; } .modal-source .dz-icon { width: 28px; height: 28px; }
/* Category chips: more compact */
.cat-grid { margin: 8px 0 10px; padding: 2px 2px 6px; gap: 8px; }
.cat-card { padding: 5px 14px; font-size: 14px; border-radius: 10px; }

.modal-grid .mismatch { border-color: #b42318; background: #fef3f2; }

.alert-box { background: var(--card, #fff); border-radius: 18px; padding: 26px 28px 22px; width: min(360px, 100%); text-align: center; box-shadow: 0 24px 60px rgba(15,23,42,.35); animation: fadein .15s ease; }
.alert-box h2 { margin: 12px 0 6px; font-size: 18px; }
.alert-box p { margin: 0 0 6px; color: var(--muted, #667085); font-size: 14px; line-height: 1.45; }
.alert-box .btn { margin-top: 16px; width: 100%; border-radius: 10px; }
.alert-icon { width: 46px; height: 46px; margin: 0 auto; border-radius: 50%; background: #fef3f2; color: #b42318; font-size: 26px; font-weight: 700; line-height: 46px; }

.modal-source .skip-check { display: flex; width: fit-content; max-width: 100%; align-items: center; gap: 7px; margin: 8px 0 0; padding: 0; border: 0; background: none; color: #475467; font-size: 12.5px; font-weight: 500; cursor: pointer; user-select: none; }
.skip-check:hover { color: #0f766e; }
.skip-check input { appearance: none; -webkit-appearance: none; flex: none; width: 14px; height: 14px; margin: 0; padding: 0; border: 1.4px solid #98a2b3; border-radius: 3px; background: #fff; display: grid; place-content: center; }
.skip-check input::after { content: ""; width: 7px; height: 4px; border: solid #fff; border-width: 0 0 1.6px 1.6px; transform: rotate(-45deg) scale(0); margin-top: -1px; }
.skip-check input:checked { border-color: #0f766e; background: #0f766e; }
.skip-check input:checked::after { transform: rotate(-45deg) scale(1); }

/* Add license sits in the table header, level with the category name */
#cat-panel .page-head #btn-add { align-self: center; margin-left: auto; }

/* roles table: rows open the role window */
#roles-table tr.clickable { cursor: pointer; }
#roles-table tbody tr.clickable:hover { background: var(--bg); }
#roles-table td, #roles-table th { white-space: nowrap; }
#roles-table td:last-child { white-space: normal; color: var(--muted); }
/* role window: grouped permission switches */
.modal-grid { min-height: 0; }
.modal-grid .perm-list { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr; gap: 18px 28px; margin-top: 4px; }
.perm-list section { display: flex; flex-direction: column; }
.perm-list h3 { margin: 0 0 6px; font-size: 11px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.modal-grid .perm-list label { position: relative; flex-direction: row; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); cursor: pointer; text-transform: none; letter-spacing: 0; font-weight: 400; color: var(--text); }
.perm-list label:last-child { border-bottom: 0; }
.perm-list label span { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.perm-list label b { font-size: 14px; font-weight: 600; }
.perm-list label small { font-size: 12px; color: var(--muted); line-height: 1.3; }
.modal-grid .perm-list input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; padding: 0; }
.perm-list i { flex: none; width: 34px; height: 20px; border-radius: 20px; background: #cbd5e1; position: relative; transition: background .15s; }
.perm-list i::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0,0,0,.25); transition: transform .15s; }
.perm-list input:checked + i { background: var(--accent); }
.perm-list input:checked + i::after { transform: translateX(14px); }
.perm-list input:focus-visible + i { box-shadow: 0 0 0 3px rgba(15, 118, 110, .3); }
.perm-list input:disabled + i { opacity: .5; }
.perm-list label:has(input:disabled) { cursor: default; }
@media (max-width: 640px) { .modal-grid .perm-list { grid-template-columns: 1fr; } }
.modal > .muted.small { padding: 0 28px 14px; margin: 0; }

/* Users page: compact header button, slimmer stat cards and rows */
#view-users .page-head { align-items: center; margin-bottom: 12px; }
#view-users .page-head > .btn { width: auto; flex: none; margin-left: auto; padding: 9px 20px; }
#view-users .ustats { gap: 10px; margin-bottom: 12px; grid-template-columns: repeat(auto-fit, minmax(min(170px, 100%), 1fr)); }
#view-users .ustat { padding: 10px 14px; align-items: center; }
#view-users .ustat strong { font-size: 22px; }
#view-users .ustat .icon-tile { width: 32px; height: 32px; }
#view-users td, #view-users th { padding-top: 8px; padding-bottom: 8px; }

/* Category access dialog: one column, scrolls when the list is long */
.modal .perm-list.one { display: block; padding: 0 28px; max-height: 50vh; overflow-y: auto; }
.perm-list.one label { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 9px 2px; border-bottom: 1px solid var(--line); cursor: pointer; }
.perm-list.one input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.perm-list.one section { margin-top: 6px; }

/* Land module */
.land-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.land-actions .btn.primary { width: auto; }
.land-tools { display: flex; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.land-search { max-width: 320px; margin: 0; }
.land-select { padding: 10px 12px; font: inherit; color: var(--text); background: var(--card); border: 1px solid var(--line); border-radius: 10px; margin-top: 0; }
.land-select.wide { width: 100%; margin-top: 6px; }
.land-table tr.clickable { cursor: pointer; }
.land-table tr.clickable:hover { background: var(--accent-soft); }
.land-empty { padding: 24px; text-align: center; }
.land-card { max-width: none; margin: 0 0 14px; }
.land-card h2 { font-size: 15px; margin: 0 0 12px; }
.land-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0 16px; }
.land-grid label input { margin-top: 6px; }
.land-inline { display: flex; gap: 8px; align-items: center; }
.land-row { display: grid; gap: 8px; align-items: start; margin-bottom: 8px; }
.land-row.sellers { grid-template-columns: 2fr 1fr 1fr auto; }
.land-row.daags { grid-template-columns: repeat(5, 1fr) auto; }
.land-row.daags.head { margin-bottom: 4px; }
.land-row input { margin: 0; }
.land-row .error { grid-column: 1 / -1; margin: 0; }
.land-file { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.land-file span { flex: 1; }
.land-save { margin: 8px 0 24px; }
.land-save .btn.primary { width: auto; }
@media (max-width: 700px) { .land-row.sellers, .land-row.daags { grid-template-columns: 1fr 1fr; } .land-row.daags.head { display: none; } }
.land-row.items { grid-template-columns: 2fr 1fr 1fr 1fr 1fr auto; align-items: center; }
@media (max-width: 700px) { .land-row.items { grid-template-columns: 1fr 1fr; } .land-row.items.head { display: none; } }

.land-row.survey { grid-template-columns: repeat(7, 1fr) auto; align-items: center; }
@media (max-width: 800px) { .land-row.survey { grid-template-columns: 1fr 1fr; } }

/* Module chooser and per-module sidebar */
.nav-item.mod-off { display: none !important; }
.module-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; margin-top: 8px; }
.module-card { text-align: left; background: var(--card, #fff); border: 1px solid var(--line, #dfe3ea); border-radius: 12px; padding: 22px; cursor: pointer; color: inherit; font: inherit; transition: box-shadow .15s, transform .15s, border-color .15s; }
.module-card:hover, .module-card:focus-visible { box-shadow: 0 6px 20px rgba(0,0,0,.08); transform: translateY(-2px); border-color: var(--accent, #1f4e8c); outline: none; }
.module-card h2 { margin: 0 0 6px; font-size: 1.15rem; }
.module-card p { margin: 0 0 14px; }
.module-go { color: var(--accent, #1f4e8c); font-weight: 600; font-size: .9rem; }

/* Land dashboard tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tile { display: flex; flex-direction: column; gap: 4px; text-align: left; padding: 14px 16px; border: 1px solid var(--line, #e3e7ee); border-radius: 10px; background: var(--card, #fff); cursor: pointer; font: inherit; color: inherit; }
.tile:hover { border-color: var(--accent); box-shadow: var(--shadow); }
.tile-n { font-size: 1.6rem; font-weight: 700; }
.land-save { position: sticky; bottom: 0; padding: 10px 0; background: var(--bg, #fff); display: flex; gap: 8px; }

/* Land polish: toolbar, two-column detail cards, framed tables, sticky save bar */
.land-tools { padding: 10px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); align-items: center; }
.land-tools .land-search { flex: 1 1 240px; }
#view-land .table-scroll { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
#view-land .land-table th { position: sticky; top: 0; background: var(--card); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
#view-land .card.land-card .table-scroll { border: 0; box-shadow: none; }
.land-save { border-top: 1px solid var(--line); margin: 8px 0 0; z-index: 2; }

/* Land forms and detail pages */
#view-land .land-card { padding: 20px 22px; border-radius: var(--radius); box-shadow: var(--shadow); }
#view-land .land-card h2 { display: flex; align-items: center; gap: 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
#view-land .land-card h2::before { content: ""; width: 4px; height: 14px; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent-2)); }
#view-land .land-card .detail-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px 24px; margin: 0; }
#view-land .land-card .detail-list dt { font-size: 12px; color: var(--muted); margin: 0 0 2px; }
#view-land .land-card .detail-list dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.land-grid { gap: 2px 18px; }
.land-grid label { margin-bottom: 12px; }
#view-land .land-row { padding: 10px; margin-bottom: 8px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
#view-land .land-row.head { background: none; border: 0; padding: 0 10px; }
#view-land input[type=file] { margin-top: 6px; padding: 9px; background: var(--bg); border: 1px dashed var(--line); border-radius: 10px; width: 100%; }
#view-land .land-file { padding: 10px 12px; background: var(--bg); border: 1px solid var(--line); border-radius: 10px; }
.land-save { padding: 12px 0; background: var(--bg); justify-content: flex-end; }
.land-save .btn.primary { min-width: 200px; }
#view-land .page-head .btn.back { white-space: nowrap; }
@media (max-width: 700px) { #view-land .land-card { padding: 16px; } .land-save .btn.primary { width: 100%; } }

/* Land dashboard */
.ico { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.land-hero { padding: 22px; margin-bottom: 16px; border-radius: 16px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); box-shadow: 0 8px 24px rgba(15, 118, 110, .25); }
.hero-search { position: relative; display: block; margin: 0; }
.hero-search .ico { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.hero-search input.land-search { max-width: none; width: 100%; margin: 0; padding: 15px 18px 15px 46px; font-size: 16px; border: 0; border-radius: 12px; background: var(--card); box-shadow: 0 2px 10px rgba(0,0,0,.12); }
#view-land .tiles { gap: 16px; margin-bottom: 16px; }
#view-land .tile { position: relative; padding: 18px 20px; gap: 2px; border-radius: 14px; box-shadow: var(--shadow); transition: transform .15s, box-shadow .15s, border-color .15s; }
#view-land .tile:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(0,0,0,.09); }
.tile-ico { width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center; margin-bottom: 10px; color: var(--accent); background: var(--accent-soft); }
.tile.area .tile-ico { color: #2563eb; background: #e8f0fe; }
.tile.owners .tile-ico { color: #7c3aed; background: #f0e9fd; }
.tile.wait .tile-ico { color: #d97706; background: #fdf2dc; }
.tile-n { font-size: 1.9rem; line-height: 1.1; letter-spacing: -.02em; }
.tile-l { color: var(--muted); font-size: 13px; }
.dash-cols { display: grid; grid-template-columns: 3fr 2fr; gap: 16px; align-items: start; }
.dash-cols .land-card { margin: 0; }
.owner-list { display: grid; gap: 16px; }
.owner-top { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; flex-wrap: wrap; }
.bar { height: 8px; border-radius: 99px; background: var(--accent-soft); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.map-list { list-style: none; margin: 0; padding: 0; }
.map-list li { display: flex; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.map-list li:last-child { border: 0; }
@media (max-width: 800px) { .dash-cols { grid-template-columns: 1fr; } .land-hero { padding: 14px; } }
:root[data-theme="dark"] .tile.area .tile-ico { background: #1b2740; } :root[data-theme="dark"] .tile.owners .tile-ico { background: #271d3f; } :root[data-theme="dark"] .tile.wait .tile-ico { background: #3a2c14; }
#view-land .table-scroll:empty { display: none; }

/* Land list pages */
#view-land .land-tools { padding: 12px; gap: 12px; border-radius: 14px; }
#view-land .land-search { padding-left: 38px; border-radius: 10px; background: var(--bg) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") no-repeat 12px 50% / 18px; }
#view-land .land-select { background: var(--bg); min-width: 170px; }
#view-land .land-search:focus, #view-land .land-select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
#view-land .table-scroll { border-radius: 14px; max-height: 70vh; }
#view-land .land-table th { background: var(--band); padding: 13px 16px; font-size: 11px; letter-spacing: .08em; border-bottom: 1px solid var(--line); }
#view-land .land-table td { padding: 14px 16px; }
#view-land .land-table tbody tr:last-child td { border-bottom: 0; }
#view-land .land-table td:first-child { box-shadow: inset 3px 0 0 transparent; }
#view-land .land-table tr.clickable:hover td:first-child, #view-land .land-table tr.clickable:focus-visible td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
#view-land .land-table tr.clickable { transition: background .12s; }
#view-land .land-table tr.clickable:focus-visible { outline: none; background: var(--accent-soft); }
#view-land .land-table td:first-child strong { color: var(--accent); }
#view-land .land-empty { padding: 48px 24px; font-size: 15px; }
#view-land .land-empty::before { content: ""; display: block; width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px; background: var(--accent-soft) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230f766e' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 5h16v14H4zM4 10h16M9 5v14'/%3E%3C/svg%3E") no-repeat center / 22px; }
#view-land .seg { border-radius: 10px; }
@media (max-width: 700px) { #view-land .land-tools { padding: 10px; } #view-land .land-select { flex: 1 1 100%; } }

/* Home: module chooser */
.home-hero { margin: 0 0 18px; padding: 18px 24px; border-radius: 14px; color: #fff; background: linear-gradient(120deg, #0b3d3a, var(--accent) 60%, var(--accent-2)); box-shadow: var(--shadow); position: relative; overflow: hidden; }
.home-hero::after { content: ""; position: absolute; right: -60px; top: -80px; width: 280px; height: 280px; border-radius: 50%; background: rgba(255,255,255,.08); }
.home-hero small { text-transform: uppercase; letter-spacing: .12em; font-size: 11px; font-weight: 600; opacity: .8; }
.home-hero h1 { margin: 2px 0 2px; font-size: 1.5rem; color: #fff; }
.home-hero p { margin: 0; opacity: .88; }
.module-grid { gap: 20px; margin-top: 0; }
.module-card { position: relative; display: flex; flex-direction: column; padding: 20px; border-radius: 16px; box-shadow: var(--shadow); overflow: hidden; }
.module-card::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 4px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.module-card.land::before { background: linear-gradient(90deg, #2563eb, #7c3aed); }
.module-ico { display: grid; place-items: center; width: 48px; height: 48px; margin-bottom: 16px; border-radius: 12px; color: var(--accent); background: var(--accent-soft); }
.module-card.land .module-ico { color: #2563eb; background: #e8f0fe; }
:root[data-theme="dark"] .module-card.land .module-ico { background: #1b2540; color: #7aa2ff; }
.module-ico svg { width: 24px; height: 24px; }
.module-card h2 { font-size: 1.25rem; }
.module-card p { flex: 1; line-height: 1.5; }
.module-go { display: inline-flex; align-items: center; gap: 8px; margin-top: 6px; font-weight: 600; }
.module-go b { display: inline-block; transition: transform .15s; }
.module-card:hover .module-go b { transform: translateX(4px); }
@media (max-width: 700px) { .home-hero { padding: 16px; } .home-hero h1 { font-size: 1.3rem; } }

/* Role editor: pages down the side, View / Write / Delete / Approve across */
.modal.wide { width: min(860px, 100%); }
.modal-grid .perm-matrix { grid-column: 1 / -1; display: block; max-height: 52vh; overflow: auto; border: 1px solid var(--line); border-radius: 12px; }
.perm-matrix table { width: 100%; border-collapse: collapse; font-size: 13px; text-transform: none; letter-spacing: 0; }
.perm-matrix th, .perm-matrix td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: center; }
.perm-matrix th:first-child, .perm-matrix td:first-child { text-align: left; }
.perm-matrix thead th { position: sticky; top: 0; background: var(--bg); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); z-index: 1; }
.perm-matrix tr.grp th { text-align: left; background: var(--accent-soft); color: var(--accent); font-size: 11px; text-transform: uppercase; letter-spacing: .08em; }
.perm-matrix td b { display: block; font-weight: 600; color: var(--text); }
.perm-matrix td small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.perm-matrix td { color: var(--muted); }
.perm-matrix input[type=checkbox] { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.perm-matrix input:disabled { cursor: default; }

/* Land search banner: narrow frame, single icon vertically centred */
.land-hero { padding: 6px; border-radius: 14px; }
#view-land .hero-search input.land-search { background: var(--card); padding: 13px 16px 13px 44px; border-radius: 10px; }
.hero-search .ico { left: 15px; width: 18px; height: 18px; }
.back-btn { display: inline-flex; align-items: center; justify-content: center; margin-left: 8px; padding: 0; }
.back-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.back-btn:disabled { opacity: .35; cursor: default; border-color: var(--line); color: var(--text); }
.land-hero { padding: 2px; border-radius: 12px; box-shadow: none; }
#view-land .hero-search input.land-search { border-radius: 10px; box-shadow: none; }

/* Welcome animation */
.home-hero { position: relative; overflow: hidden; }
.home-hero small, .home-hero h1, .home-hero p { animation: hero-in .7s cubic-bezier(.2,.8,.2,1) both; }
.home-hero h1 { animation-delay: .12s; } .home-hero p { animation-delay: .24s; }
.hero-art { position: absolute; right: 6%; top: 50%; width: 220px; height: 120px; transform: translateY(-50%); fill: none; stroke: rgba(255,255,255,.85); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; }
.hero-art .doc { fill: rgba(255,255,255,.12); animation: doc-in .8s cubic-bezier(.2,.8,.2,1) both, float 4s ease-in-out 1s infinite; }
.hero-art .d2 { animation-delay: .25s, 1.3s; }
.hero-art .pin { fill: #fff; stroke: none; transform-origin: 150px 88px; animation: pin-drop 1s cubic-bezier(.3,1.5,.5,1) .5s both; }
.hero-art .pin circle { fill: #0f766e; }
.hero-art .ring { stroke: rgba(255,255,255,.7); transform-origin: 150px 96px; animation: ring 2.4s ease-out 1.3s infinite; opacity: 0; }
.hero-art .r2 { animation-delay: 2.1s; }
@keyframes hero-in { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }
@keyframes doc-in { from { opacity: 0; transform: translateX(-30px) rotate(-8deg); } to { opacity: 1; transform: none; } }
@keyframes float { 50% { transform: translateY(-5px); } }
@keyframes pin-drop { 0% { opacity: 0; transform: translateY(-50px) scale(.6); } 100% { opacity: 1; transform: none; } }
@keyframes ring { 0% { opacity: .8; transform: scale(.5); } 100% { opacity: 0; transform: scale(3.2); } }
@media (max-width: 700px) { .hero-art { display: none; } }
@media (prefers-reduced-motion: reduce) { .home-hero *, .hero-art * { animation: none !important; } }

/* Trademark and Industrial Design: few columns, so give each room instead of leaving the slack in the name column */
#licenses.spaced th, #licenses.spaced td { padding-left: 18px; padding-right: 18px; }
#licenses.spaced th:first-child, #licenses.spaced td:first-child { width: 64px; padding-left: 12px; padding-right: 6px; }
#licenses.spaced th:nth-child(2), #licenses.spaced td:nth-child(2) { width: 30%; }
#licenses.spaced td:nth-last-child(-n+3), #licenses.spaced th:nth-last-child(-n+3) { padding-left: 12px; padding-right: 12px; }

#licenses td.date-cell { white-space: nowrap; overflow-wrap: normal; word-break: normal; }

/* few-column tables: fixed layout, name column gets the most room and the rest share what is left evenly */
#licenses.spaced { table-layout: fixed; width: 100%; }
#licenses.spaced th, #licenses.spaced td { padding-left: 14px; padding-right: 14px; overflow-wrap: anywhere; }
#licenses.spaced th:first-child, #licenses.spaced td:first-child { width: 64px; padding-left: 16px; padding-right: 4px; }
#licenses.spaced th:nth-child(2), #licenses.spaced td:nth-child(2) { width: 22%; }
#licenses.spaced th:nth-last-child(2), #licenses.spaced td:nth-last-child(2) { width: 150px; }
#licenses.spaced th:last-child, #licenses.spaced td:last-child { width: 96px; padding-left: 4px; padding-right: 12px; }
#licenses.spaced td.date-cell, #licenses.spaced th { overflow-wrap: normal; }
#licenses.spaced tbody tr:hover td { background: var(--hover, rgba(15, 118, 110, .05)); }

.side-switch { padding: 0 10px 10px; }
.side-switch .nav-item { width: 100%; }

/* Dashboard category cards: one line, drag to scroll */
#view-dash #dash-cats { display: flex; flex-wrap: nowrap; overflow-x: auto; gap: 14px; cursor: grab; scrollbar-width: thin; padding-bottom: 8px; }
#view-dash #dash-cats .stat { flex: 0 0 240px; }
#view-dash #dash-cats.dragging { cursor: grabbing; user-select: none; }
#view-dash #dash-cats.dragging .stat { pointer-events: none; }

/* Land forms: full-width cards, even control heights, aligned item rows */
#view-land .card.inline.land-card { max-width: none; width: 100%; margin: 0 0 16px; }
#view-land .land-grid { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 4px 20px; }
#view-land .land-grid label { margin-bottom: 14px; }
#view-land .land-grid input, #view-land .land-grid .land-select.wide { height: 44px; margin-top: 6px; box-sizing: border-box; }
#view-land .land-grid .land-select.wide { padding: 0 12px; }
#view-land .land-row.items { grid-template-columns: minmax(140px, 2fr) repeat(2, minmax(90px, 1fr)) minmax(90px, 1fr) minmax(90px, 1fr) 44px; gap: 10px; align-items: center; }
#view-land .land-row.items.head { padding: 0 10px 4px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; font-size: 11px; }
#view-land .land-row.items input { height: 40px; box-sizing: border-box; }
#view-land .land-row.items .btn.small { width: 40px; height: 40px; padding: 0; }
#view-land .land-row.items > span.muted:not(.small) { font-weight: 600; color: var(--text); }
#view-land .land-card .land-inline { justify-content: space-between; margin-top: 4px; }
#view-land .land-save { margin: 0; padding: 14px 0; justify-content: flex-end; }
@media (max-width: 700px) { #view-land .land-row.items { grid-template-columns: 1fr 1fr; } #view-land .land-row.items.head { display: none; } }

/* Logo on dark theme: compact white tile that sits inside the bar, not against its edge */
:root[data-theme="dark"] .login-logo {
  background: none; padding: 0; box-shadow: none; }
:root[data-theme="dark"] .brand-logo, :root[data-theme="dark"] .side-logo { background: none; padding: 0; box-shadow: none; }
:root[data-theme="dark"] .topbar .brand-logo { height: 30px; margin: 4px 0; }
:root[data-theme="dark"] .topbar .brand { align-items: center; }

/* Approval card: key facts, then tables for rows of data */
.appr-details h4 { margin: 14px 0 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.appr-details .detail-list { grid-template-columns: 30% 1fr; }
.appr-details .detail-list dt, .appr-details .detail-list dd { padding: 8px 14px; }
.appr-table { overflow-x: auto; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 10px; }
.appr-table table { width: 100%; border-collapse: collapse; font-size: 14px; }
.appr-table th { text-align: left; font-size: 12px; font-weight: 700; color: var(--muted); background: var(--bg); padding: 8px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.appr-table td { padding: 9px 12px; border-bottom: 1px solid var(--line); }
.appr-table tr:last-child td { border-bottom: 0; }
.appr-table .num { text-align: right; font-variant-numeric: tabular-nums; }

/* Expiry reminders: recipient picker */
.rem-cat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 20px; margin-bottom: 16px; }
.rem-cat h3 { margin: 0 0 12px; }
.rem-users { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.rem-user { display: flex; align-items: center; gap: 12px; margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--bg); cursor: pointer; position: relative; transition: border-color .15s, background .15s; }
.rem-user:hover { border-color: var(--accent); }
.rem-user.on { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 1px var(--accent) inset; }
.rem-user input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.rem-user input:focus-visible + .avatar { outline: 2px solid var(--accent); outline-offset: 2px; }
.rem-user.on::after { content: "\2713"; position: absolute; top: 8px; right: 10px; width: 20px; height: 20px; border-radius: 50%; background: var(--accent);
  color: var(--accent-text); font-size: 12px; line-height: 20px; text-align: center; }
.rem-user .avatar { flex: none; background: linear-gradient(135deg, var(--accent), var(--accent-2)); }
.rem-info { display: flex; flex-direction: column; min-width: 0; line-height: 1.35; }
.rem-info strong { color: var(--text); font-size: 14px; }
.rem-info small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rem-info .rem-nophone { color: #b45309; }
.rem-foot { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
/* Reminders: test-message row */
#view-reminders .dash-sub { margin: 22px 0 10px; }
#view-reminders .row-actions:has(#rem-test-to) { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
#rem-test-to { margin: 0; flex: 1 1 220px; max-width: 320px; width: auto; }
#rem-test { flex: none; }

/* Country-code picker */
.phone-row { display: flex; gap: 8px; align-items: center; margin-top: 6px; }
.phone-row input, .phone-row select, #rem-test-cc { margin: 0; }
.cc-pick { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 8px; flex: none; width: 200px; max-width: 100%; }
.cc-pick:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.ok-text { color: var(--accent); }

/* custom message composer */
.modal-grid .wide { grid-column: 1 / -1; }
.modal-grid textarea { resize: vertical; }
.modal-grid .check { flex-direction: row; align-items: center; gap: 6px; display: inline-flex; text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 400; color: var(--text); margin-right: 14px; }
.modal-grid .check input { width: auto; }
.cm-sum { cursor: pointer; padding: 9px 12px; border: 1px solid var(--line); border-radius: 10px; text-transform: none; letter-spacing: 0; font-size: 14px; font-weight: 500; color: var(--text); }
.cm-users { max-height: 180px; overflow: auto; padding: 8px 4px; display: flex; flex-direction: column; gap: 4px; }
.cm-pick .modal { width: min(380px, 100%); }
.cm-pick .modal > p, .cm-pick .modal > input { margin: 8px 28px; width: auto; }
.modal > .error { margin: 0 28px; }
.modal-back[hidden] { display: none; }
.cm-facts { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; margin: 12px 0 16px; font-size: 14px; }
.cm-facts dt { color: var(--muted); } .cm-facts dd { margin: 0; font-weight: 600; text-align: right; }
.cm-list { padding: 8px 28px 16px; overflow: auto; }
.cm-list { padding: 8px 28px 16px; overflow: auto; }
.cm-card { padding: 0; overflow: hidden; border-radius: 18px; }
.cm-head { display: flex; gap: 16px; align-items: flex-start; justify-content: space-between; padding: 26px 32px 22px;
  background: linear-gradient(135deg, var(--accent-soft), transparent 70%); border-bottom: 1px solid var(--line); }
.cm-head h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.cm-head p { margin: 0; max-width: 560px; }
.cm-btns { display: flex; gap: 10px; flex-wrap: wrap; }
.cm-btns .btn { border-radius: 999px; padding: 9px 18px; font-weight: 600; font-size: 14px; }
.cm-btns .btn:hover { border-color: var(--accent); color: var(--accent); }
.cm-form { display: grid; gap: 14px; padding: 24px 32px 28px; }
.cm-sec { padding: 20px 22px; border: 1px solid var(--line); border-radius: 16px; background: var(--card); }
.cm-sec h3 { margin: 0 0 14px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); font-weight: 700; }
.cm-cols { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.cm-cols label { display: grid; gap: 6px; margin: 0; font-weight: 600; font-size: 13px; color: var(--muted); }
.cm-form select, .cm-cols .cm-sum { width: 100%; min-height: 44px; padding: 10px 14px; font: inherit; font-size: 14px; font-weight: 500; color: var(--text);
  background-color: var(--bg); border: 1px solid var(--line); border-radius: 12px; transition: border-color .15s, box-shadow .15s; }
.cm-form select { appearance: none; padding-right: 38px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' fill='none' stroke='%23667085' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 1.5l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; }
.cm-form select:disabled { opacity: .55; cursor: not-allowed; }
.cm-form select:hover:not(:disabled), .cm-cols .cm-sum:hover { border-color: var(--accent); }
.cm-form select:focus, .cm-to[open] .cm-sum { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cm-to { position: relative; }
.cm-cols .cm-sum { display: flex; align-items: center; cursor: pointer; list-style: none; }
.cm-cols .cm-sum::-webkit-details-marker { display: none; }
.cm-cols .cm-sum::after { content: ""; margin-left: auto; width: 8px; height: 8px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted); transform: rotate(45deg) translateY(-2px); }
.cm-users { max-height: 220px; overflow: auto; margin-top: 8px; padding: 6px; display: flex; flex-direction: column; gap: 2px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.cm-users .check { display: flex; align-items: center; gap: 10px; margin: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 500; color: var(--text); text-transform: none; letter-spacing: 0; }
.cm-users .check:hover { background: var(--accent-soft); }
.cm-users .check input { width: 18px; height: 18px; margin: 0; flex: none; accent-color: var(--accent); }
.cm-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.cm-chip { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 10px 18px; border: 1px solid var(--line); border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text); background: var(--bg); transition: all .15s; }
.cm-chip:hover { border-color: var(--accent); }
.cm-chip.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); cursor: default; }
.cm-chip:has(input:checked) { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.cm-chip input { width: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.cm-opts { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 12px; }
.cm-opt { display: flex; gap: 12px; align-items: flex-start; margin: 0; padding: 16px; border: 1px solid var(--line); border-radius: 14px; cursor: pointer; background: var(--bg); transition: all .15s; color: var(--text); }
.cm-opt:hover { border-color: var(--accent); }
.cm-opt:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); box-shadow: 0 0 0 3px var(--accent-soft); }
.cm-opt:has(input:disabled) { opacity: .5; cursor: not-allowed; }
.cm-opt > input { width: 18px; height: 18px; margin: 2px 0 0; flex: none; accent-color: var(--accent); }
.cm-opt span { display: grid; gap: 6px; } .cm-opt b { font-size: 15px; } .cm-opt small { color: var(--muted); font-size: 13px; }
.cm-opt input[type="number"] { display: inline-block; width: 72px; margin: 0 4px; padding: 6px 8px; border-radius: 8px; }
.cm-msg { display: flex; gap: 12px; align-items: center; justify-content: space-between; padding: 14px 16px; border: 1px dashed var(--accent); border-radius: 12px; background: var(--bg); }
.cm-foot { display: flex; gap: 16px; align-items: center; justify-content: flex-end; padding-top: 6px; }
.cm-foot .btn.primary { min-width: 180px; min-height: 46px; font-size: 16px; border-radius: 999px; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: 0; box-shadow: 0 6px 16px rgba(15, 118, 110, .28); }
.cm-foot .btn.primary:hover { filter: brightness(1.06); }
.cm-wa-modal { width: min(520px, 94vw); }
@media (max-width: 700px) { .cm-head { flex-direction: column; padding: 20px; } .cm-form { padding: 16px; } .cm-sec { padding: 16px; } }
/* compact pass */
.cm-head { padding: 14px 20px; }
.cm-head h2 { font-size: 18px; margin: 0 0 2px; }
.cm-head p { font-size: 13px; }
.cm-btns .btn { padding: 6px 14px; font-size: 13px; }
.cm-form { gap: 8px; padding: 12px 20px 16px; }
.cm-sec { padding: 10px 14px; border-radius: 12px; }
.cm-sec h3 { margin: 0 0 8px; font-size: 11px; }
.cm-sec .small { margin: 6px 0 0; font-size: 12px; }
.cm-cols { gap: 10px; }
.cm-cols label { gap: 4px; font-size: 12px; }
.cm-form select, .cm-cols .cm-sum { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 10px; }
.cm-users { max-height: 160px; margin-top: 6px; }
.cm-users .check { padding: 5px 8px; font-size: 13px; }
.cm-chips { gap: 8px; }
.cm-chip { padding: 6px 14px; font-size: 13px; }
.cm-opts { gap: 8px; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.cm-opt { padding: 10px 12px; gap: 8px; border-radius: 10px; }
.cm-opt span { gap: 3px; } .cm-opt b { font-size: 14px; } .cm-opt small { font-size: 12px; }
.cm-opt small .btn { padding: 4px 10px; font-size: 12px; }
.cm-msg { padding: 8px 12px; }
.cm-foot { padding-top: 0; }
.cm-foot .btn.primary { min-width: 140px; min-height: 38px; font-size: 14px; }
.settings-grid > .card:first-child:not(:only-child), .settings-grid > .card:last-child:not(:only-child) { align-self: stretch; }
/* one-window layout */
.cm-head p { max-width: none; }
.cm-form { grid-template-columns: 1fr 1fr; align-items: stretch; }
.cm-form > .cm-sec:nth-of-type(1), .cm-form > .cm-sec:nth-of-type(3), .cm-form > .error, .cm-form > .cm-foot { grid-column: 1 / -1; }
.cm-form > .error { margin: 0; min-height: 0; }
.cm-form > .error:empty { display: none; }
.cm-form > .cm-sec:nth-of-type(4) { display: flex; flex-direction: column; }
.cm-form > .cm-sec:nth-of-type(4) .cm-msg { flex: 1; }
@media (max-width: 900px) { .cm-form { grid-template-columns: 1fr; } .cm-form > .cm-sec:nth-of-type(n) { grid-column: 1; } }
/* reminders page: tighter top */
#view-reminders .page-head { margin-bottom: 8px; }
#view-reminders .page-head h1 { font-size: 22px; margin: 0; }
#view-reminders .page-head p { font-size: 13px; }
#view-reminders > .error { margin: 0; min-height: 0; }
#view-reminders > .error:empty { display: none; }
#view-reminders .settings-grid { gap: 12px; }

/* Reminders page: two buttons that open Custom Message / Who gets the reminders */
.rem-tabs { margin: 0 0 12px; }
.rem-tabs button { padding: 8px 18px; font-size: 14px; }
.rem-tabs button[hidden] { display: none; }

/* edit popup for the automatic reminders: always in front of the Messages popup */
.modal-back:has(#rem-edit-pop), #rem-edit-pop { z-index: 60; }
#rem-edit-pop { z-index: 80; }
#rem-edit-pop .modal { width: min(620px, 100%); }
.re-form { padding: 18px 28px 6px; display: flex; flex-direction: column; gap: 14px; }
.re-field { margin: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 600; color: var(--muted); }
.re-field input, .re-field textarea { width: 100%; margin: 0; padding: 11px 13px; font: inherit; font-size: 14px; font-weight: 400; line-height: 1.5; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 12px; }
.re-field textarea { resize: vertical; min-height: 150px; }
.re-field input:focus, .re-field textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--card); }
.re-tags { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13px; color: var(--muted); }
.re-tag { border: 1px solid var(--line); background: var(--accent-soft); color: var(--accent); font: inherit; font-size: 12.5px; font-weight: 600; padding: 5px 12px; border-radius: 999px; cursor: pointer; }
.re-tag:hover { border-color: var(--accent); }
#rem-edit-pop .error { padding: 0 28px; min-height: 0; }
#rem-edit-pop .error:empty { display: none; }
#rem-edit-pop .modal-actions { flex-direction: row; }
.re-reset { margin-left: auto; }

/* Reminders page: tidy one-window layout (Who / Medium + Message / When / Send) */
.cm-form > .cm-sec:nth-of-type(3) { order: 3; }
.cm-form > .error { order: 4; }
.cm-form > .cm-foot { order: 5; justify-content: flex-end; }
.cm-foot .btn.primary { width: auto; min-width: 160px; padding: 0 28px; }
.cm-form > .cm-sec:nth-of-type(2), .cm-form > .cm-sec:nth-of-type(4) { order: 2; display: flex; flex-direction: column; justify-content: center; }
.cm-form > .cm-sec:nth-of-type(2) h3, .cm-form > .cm-sec:nth-of-type(4) h3 { margin-bottom: 10px; }
.cm-form > .cm-sec:nth-of-type(1) { order: 1; }
#view-reminders .card > .dash-sub:first-child { margin-top: 0; }
#view-reminders #rem-log th, #view-reminders #rem-log td { padding: 8px 12px; font-size: 13px; }
#view-reminders .table-scroll { max-height: 280px; }
@media (max-width: 900px) { .cm-form > .cm-sec:nth-of-type(n) { order: 0; } }

/* Custom Message: fit the window at any scale (no sideways overflow), cleaner modern look */
#view-reminders .cm-card { max-width: 100%; min-width: 0; }
.cm-form { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; padding: 16px 22px 20px; }
.cm-form > * { min-width: 0; }
.cm-sec { padding: 14px 16px; border-radius: 14px; background: var(--card); box-shadow: 0 1px 2px rgba(15, 23, 42, .04); }
.cm-sec h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; }
.cm-cols { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cm-cols .cm-sum, .cm-form select { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cm-opts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.cm-opt { min-width: 0; flex-wrap: wrap; }
.cm-opt input[type="number"] { width: 64px; }
.cm-msg { min-width: 0; flex-wrap: wrap; }
.cm-chip { white-space: nowrap; }
.cm-foot { padding-top: 2px; }
@media (max-width: 1100px) { .cm-cols, .cm-opts { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); } }
@media (max-width: 900px) { .cm-form { grid-template-columns: minmax(0, 1fr); } }

/* When options: radio, title and detail on one line */
.cm-opt { align-items: center; }
.cm-opt > input { margin: 0; }
.cm-opt > span { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; min-width: 0; }
.cm-opt > span > small { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
