/* iahodesk administration. Colours follow crates/app/src/ui/theme.rs. */

@font-face {
  font-family: "DM Sans";
  src: url("fonts/DMSans.ttf") format("truetype");
  font-weight: 100 1000;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("fonts/Manrope.ttf") format("truetype");
  font-weight: 200 800;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #f8f9fc;
  --border: #e3e7ee;
  --border-strong: #d5dae4;
  --text: #172033;
  --muted: #5f6b7e;
  --faint: #8a94a6;
  --accent: #5b57d6;
  --accent-hover: #4b47c4;
  --accent-text: #4743b8;
  --accent-tint: #eeeefc;
  --on-accent: #ffffff;
  --control: #eceff5;
  --control-hover: #e2e6ef;
  --input: #ffffff;
  --green: #2fa676;
  --green-text: #1a7f56;
  --green-tint: #e6f5ee;
  --amber: #e2a83b;
  --amber-text: #8a5a00;
  --amber-tint: #fdf3df;
  --red: #c8372d;
  --red-text: #b02a21;
  --red-tint: #fbeae8;
  --row-hover: #f6f7fb;
  --row-selected: #f1f0fd;
  --shadow: 0 1px 2px rgba(23, 32, 51, .06), 0 4px 16px rgba(23, 32, 51, .06);
  --shadow-pop: 0 8px 32px rgba(23, 32, 51, .18);
  --side-bg: #101827;
  --side-text: #a9b4c6;
  --side-text-strong: #e6ebf3;
  --side-active: #262c52;
  --side-hover: #1f2a3f;
  --radius: 8px;
  --radius-lg: 12px;
  --font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Manrope", "DM Sans", system-ui, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, "SFMono-Regular", monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #0d1420;
    --panel: #141c2b;
    --panel-2: #172031;
    --border: #253147;
    --border-strong: #2e3a50;
    --text: #e6ebf3;
    --muted: #a9b4c6;
    --faint: #7d889b;
    --accent: #6d69e6;
    --accent-hover: #7d79f0;
    --accent-text: #aaa7ff;
    --accent-tint: #262c52;
    --control: #1f2a3f;
    --control-hover: #28354d;
    --input: #101827;
    --green: #3dba8a;
    --green-text: #5fd3a5;
    --green-tint: #12302a;
    --amber: #e2a83b;
    --amber-text: #f0c470;
    --amber-tint: #33290f;
    --red: #e0574c;
    --red-text: #ff8a80;
    --red-tint: #3a1a1a;
    --row-hover: #18223a;
    --row-selected: #1e2446;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 4px 16px rgba(0, 0, 0, .25);
    --shadow-pop: 0 8px 32px rgba(0, 0, 0, .5);
    --side-bg: #0a0f19;
    --side-active: #262c52;
    --side-hover: #172031;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 var(--font);
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); font-weight: 700; margin: 0; letter-spacing: -.01em; }
h1 { font-size: 22px; }
h2 { font-size: 16px; }
h3 { font-size: 14px; }
p { margin: 0 0 8px; }
a { color: var(--accent-text); }
code, .mono { font-family: var(--mono); font-size: 12.5px; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* The content area takes focus after navigation (for keyboard and screen-reader users); it is not a control. */
.content:focus, .content:focus-visible { outline: none; }

.icon { width: 16px; height: 16px; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -3px; }
.icon.lg { width: 20px; height: 20px; }

/* ---------- boot ---------- */
.boot { min-height: 100vh; display: grid; place-items: center; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: spin .8s linear infinite; }
.spinner.sm { width: 16px; height: 16px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 2.4s; } }

/* ---------- buttons and inputs ---------- */
button, input, select, textarea { font: inherit; color: inherit; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--control); color: var(--text);
  font-weight: 500; cursor: pointer; white-space: nowrap; text-decoration: none;
}
.btn:hover { background: var(--control-hover); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.danger:hover:not(:disabled) { filter: brightness(1.08); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.ghost:hover:not(:disabled) { background: var(--control); }
.btn.sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn.icon-only { width: 32px; padding: 0; }
.btn.sm.icon-only { width: 28px; }
.btn.block { width: 100%; }
.btn .spinner { width: 14px; height: 14px; border-width: 2px; border-color: rgba(255,255,255,.4); border-top-color: currentColor; }

.input, select.input, textarea.input {
  width: 100%; height: 34px; padding: 0 10px; border-radius: var(--radius);
  border: 1px solid var(--border-strong); background: var(--input);
}
textarea.input { height: auto; min-height: 88px; padding: 8px 10px; resize: vertical; line-height: 1.4; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.input[aria-invalid="true"] { border-color: var(--red); }
.input:disabled { opacity: .6; }
.input.mono { font-family: var(--mono); }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; flex: none; }
input[type="file"].input { padding: 5px 8px; height: auto; }

.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.field > label, .field-label { font-weight: 600; font-size: 13px; }
.field .help { color: var(--muted); font-size: 12.5px; }
.field .error { color: var(--red-text); font-size: 12.5px; }
.field.inline { flex-direction: row; align-items: center; gap: 8px; }
.check { display: flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.check input { margin-top: 2px; }
.check .help { display: block; }
.input-row { display: flex; gap: 6px; align-items: center; }
.input-row .input { flex: 1; min-width: 0; }
.input-row .chips { flex: 1; min-width: 0; }
.checklist { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow: auto; padding: 8px 10px; border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--input); }
.checklist .empty-inline { color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); column-gap: 18px; }

/* ---------- layout ---------- */
.shell { display: grid; grid-template-columns: 228px 1fr; min-height: 100vh; }
.side { background: var(--side-bg); color: var(--side-text); display: flex; flex-direction: column; padding: 16px 12px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 18px; color: var(--side-text-strong); }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: var(--accent); color: #fff; display: grid; place-items: center; flex: none; }
.brand-mark .icon { width: 18px; height: 18px; vertical-align: 0; }
.brand-name { font-family: var(--font-head); font-weight: 700; font-size: 16px; line-height: 1.1; }
.brand-sub { font-size: 12px; color: var(--side-text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 150px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius); color: var(--side-text); text-decoration: none; font-weight: 500; }
.nav a:hover { background: var(--side-hover); color: var(--side-text-strong); }
.nav a[aria-current="page"] { background: var(--side-active); color: #fff; }
.nav a[aria-current="page"] .icon { color: #a9a6ff; }
.nav .sep { height: 1px; background: rgba(255,255,255,.08); margin: 8px 4px; }
.side-foot { margin-top: auto; padding: 8px; font-size: 12px; color: var(--faint); }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar { display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 24px; border-bottom: 1px solid var(--border); background: var(--panel); position: sticky; top: 0; z-index: 20; }
.topbar .title { font-family: var(--font-head); font-weight: 700; font-size: 17px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.topbar .menu-toggle { display: none; }
.license-bar { display: flex; align-items: center; gap: 10px; padding: 8px 24px; background: var(--amber-tint); color: var(--text); border-bottom: 1px solid var(--border); font-size: 13.5px; }
.license-bar span { flex: 1; min-width: 0; }
.license-bar.expired { background: var(--red-tint); }
.license-bar.soft { background: var(--accent-tint); }
.license-bar.soft .icon { color: var(--accent-text); }
.license-bar .icon { color: var(--amber-text); }
.license-bar.expired .icon { color: var(--red-text); }
.license-bar[hidden] { display: none; }
@media (max-width: 760px) { .license-bar { padding: 8px 12px; } }
.content { padding: 22px 24px 40px; width: 100%; }

.company-switch { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.company-switch select { width: auto; max-width: 16rem; }
.lang { display: inline-flex; border: 1px solid var(--border-strong); border-radius: var(--radius); overflow: hidden; }
.lang button { border: 0; background: transparent; padding: 0 10px; height: 30px; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--muted); }
.lang button[aria-pressed="true"] { background: var(--accent-tint); color: var(--accent-text); }

.user-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 8px 0 4px; border-radius: var(--radius); border: 1px solid transparent; background: transparent; cursor: pointer; }
.user-btn:hover { background: var(--control); }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent-tint); color: var(--accent-text); display: grid; place-items: center; font-weight: 700; font-size: 12px; text-transform: uppercase; }

/* ---------- popover menus ---------- */
.menu-wrap { position: relative; display: inline-block; }
.menu { position: fixed; z-index: 50; min-width: 200px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-pop); padding: 4px; }
.menu .menu-head { padding: 8px 10px; color: var(--muted); font-size: 12.5px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; padding: 7px 10px; border: 0; border-radius: 6px; background: transparent; cursor: pointer; }
.menu button:hover:not(:disabled), .menu button:focus-visible { background: var(--control); outline: none; }
.menu button:disabled { opacity: .45; cursor: not-allowed; }
.menu button.danger { color: var(--red-text); }
.menu hr { border: 0; border-top: 1px solid var(--border); margin: 4px 0; }

/* ---------- panels ---------- */
.page-head { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.page-head .grow { flex: 1; min-width: 200px; }
.page-head p { color: var(--muted); margin: 4px 0 0; }
.panel { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.panel + .panel, .section + .section { margin-top: 18px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.panel-head h2 { flex: 1; }
.panel-head .sub { color: var(--muted); font-size: 13px; font-weight: 400; }
.panel-body { padding: 16px; }
.panel-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--border); background: var(--panel-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.toolbar .search { position: relative; flex: 1 1 220px; max-width: 340px; }
.toolbar .search .icon { position: absolute; left: 10px; top: 9px; color: var(--faint); }
.toolbar .search .input { padding-left: 32px; }
.toolbar select.input { width: auto; max-width: 220px; }
.toolbar .spacer { flex: 1; }
.toolbar .count { color: var(--muted); font-size: 13px; }

.bulkbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 16px; background: var(--accent-tint); border-bottom: 1px solid var(--border); }
.bulkbar .sel { font-weight: 600; color: var(--accent-text); margin-right: 6px; }

/* ---------- tables ---------- */
.table-wrap { overflow: auto; max-height: calc(100vh - 230px); }
.table-wrap.flat { max-height: none; }
table.data { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13.5px; }
table.data th, table.data td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data th { position: sticky; top: 0; z-index: 2; background: var(--panel-2); color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; }
table.data th button.sort { all: unset; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; }
table.data th button.sort:focus-visible { outline: 2px solid var(--accent); }
table.data th .arrow { font-size: 10px; }
table.data tbody tr:hover td { background: var(--row-hover); }
table.data tbody tr.selected td { background: var(--row-selected); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.nowrap, table.data th.nowrap { white-space: nowrap; }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data td.actions { text-align: right; white-space: nowrap; width: 1%; }
table.data td.check, table.data th.check { width: 36px; padding-right: 0; }
/* The cells share their class with the `.check` label (a flex box): they must stay table cells, or the box leaves the row. */
table.data td.check, table.data th.check { display: table-cell; }
table.data .check input { margin-top: 0; vertical-align: middle; }
table.data td.truncate { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
table.data tr.sub td { background: var(--panel-2); }
table.data tr.masked td { color: var(--muted); }
.cell-main { font-weight: 600; }
.cell-sub { color: var(--muted); font-size: 12.5px; }
.dim { color: var(--muted); }
.faint { color: var(--faint); }

/* ---------- badges, pills, dots ---------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--control); color: var(--muted); white-space: nowrap; line-height: 20px; }
.badge.accent { background: var(--accent-tint); color: var(--accent-text); }
.badge.green { background: var(--green-tint); color: var(--green-text); }
.badge.amber { background: var(--amber-tint); color: var(--amber-text); }
.badge.red { background: var(--red-tint); color: var(--red-text); }
.badge .icon { width: 12px; height: 12px; vertical-align: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.status { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.dot.green { background: var(--green); box-shadow: 0 0 0 3px color-mix(in srgb, var(--green) 20%, transparent); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.lock { color: var(--muted); }

/* ---------- overview ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { padding: 16px; }
.stat .label { color: var(--muted); font-size: 12.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; display: flex; align-items: center; gap: 6px; }
.stat .value { font-family: var(--font-head); font-size: 28px; font-weight: 700; margin-top: 6px; font-variant-numeric: tabular-nums; }
.stat .value small { font-size: 14px; color: var(--muted); font-weight: 600; }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 18px; }
.svc { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.svc:last-child { border-bottom: 0; }
.svc .name { font-weight: 600; flex: 1; }
.svc .detail { color: var(--muted); font-size: 13px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 10px 18px; align-items: center; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; }
.bar { height: 8px; border-radius: 999px; background: var(--control); overflow: hidden; min-width: 120px; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 999px; transition: width .3s; }
.bar.warn > span { background: var(--amber); }
.bar.crit > span { background: var(--red); }
.meter { display: flex; align-items: center; gap: 10px; }
.meter .bar { flex: 1; }
.meter .val { font-variant-numeric: tabular-nums; min-width: 110px; text-align: right; color: var(--muted); font-size: 13px; }
.refresh-note { color: var(--faint); font-size: 12.5px; display: inline-flex; align-items: center; gap: 6px; }

/* ---------- directory ---------- */
.dir-bar { border-bottom: 0; padding: 0 0 14px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 12px; border: 1px solid var(--border-strong); border-radius: 999px; background: var(--panel); cursor: pointer; font-weight: 500; }
.chip:hover { background: var(--control); }
.chip[aria-pressed="true"] { background: var(--accent-tint); border-color: var(--accent); color: var(--accent-text); }
.dtoggle-all { width: 118px; }
.dir-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
.dir-detail { position: sticky; top: 72px; }
.dpanel.drop-ok { outline: 2px dashed var(--accent); outline-offset: -2px; }
.dhead, .drow { display: grid; grid-template-columns: minmax(0, 1fr) 92px 104px; align-items: center; column-gap: 8px; }
.dhead { padding: 8px 15px; background: var(--panel-2); color: var(--muted); font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .03em; border-bottom: 1px solid var(--border); border-radius: var(--radius-lg) var(--radius-lg) 0 0; }
.dtree { padding: 4px 0; }
.dempty { padding: 6px 15px; margin: 0; }
.drow { min-height: 38px; padding: 3px 12px 3px 9px; cursor: pointer; border-left: 3px solid transparent; }
.drow:hover { background: var(--row-hover); }
.drow.active { background: var(--row-selected); border-left-color: var(--accent); }
.drow.dragging { opacity: .45; }
.drow.drop-ok { background: var(--accent-tint); outline: 2px solid var(--accent); outline-offset: -2px; }
.dmain { display: flex; align-items: center; gap: 6px; min-width: 0; padding-left: calc(var(--depth, 0) * 18px); }
.chev { flex: none; width: 22px; height: 22px; display: grid; place-items: center; border: 0; background: transparent; border-radius: 6px; color: var(--muted); cursor: pointer; padding: 0; }
.chev:hover { background: var(--control); }
.chev-spacer { flex: none; width: 22px; }
.dname { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dgroup .dname { font-weight: 600; }
.dcompany { min-height: 30px; background: var(--row-hover); }
.dcompany .dname { font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.dcount { color: var(--muted); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.dpeople { padding: 0 6px; font-size: 11.5px; }
.dtext { min-width: 0; }
.dtext > div { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dos { color: var(--muted); }
.dcol { font-size: 13px; color: var(--muted); white-space: nowrap; }
.group-info { display: flex; gap: 8px; padding: 10px 12px; margin: 6px 8px 8px; border-radius: var(--radius); background: var(--panel-2); color: var(--muted); font-size: 12.5px; }
.group-info .icon { margin-top: 2px; }
.dnamefield { margin-bottom: 4px; }
.input.dtitle { font-family: var(--font-head); font-weight: 700; font-size: 18px; height: 40px; }
.dpath { margin-bottom: 14px; }
.dstats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 14px; }
.dstat { background: var(--panel-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 12px; }
.dstat-v { font-family: var(--font-head); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.dstat-l { color: var(--muted); font-size: 12.5px; }
.dactions { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.dsection { border-top: 1px solid var(--border); padding-top: 14px; }
.dsection p { margin: 2px 0 10px; }
.dmembers { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.dmember { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.dmember .dtext { flex: 1; }
.dgrant { display: flex; align-items: center; gap: 6px; }
.dphead { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.dphead h2 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.dkey { display: inline-flex; align-items: center; gap: 6px; }
.dir-float { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: 900; max-width: calc(100vw - 32px); display: flex; align-items: center; gap: 12px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--border); border-left: 4px solid var(--accent); border-radius: var(--radius); box-shadow: var(--shadow-pop); }
.dir-float.hint { pointer-events: none; }
@media (max-width: 560px) {
  .dhead, .drow { grid-template-columns: minmax(0, 1fr) 84px; }
  .dlast { display: none; }
}

/* ---------- deployment ---------- */
.pkg-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 14px; }
.pkg { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; display: flex; flex-direction: column; gap: 8px; background: var(--panel-2); }
.pkg .pkg-title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.pkg .kv { font-size: 13px; gap: 4px 12px; }
.pkg .actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: auto; padding-top: 6px; }
.hash { font-family: var(--mono); font-size: 12px; word-break: break-all; }
.secret-box { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-radius: var(--radius); background: var(--panel-2); border: 1px solid var(--border-strong); }
.secret-box code { flex: 1; min-width: 0; word-break: break-all; font-size: 13.5px; }
.cmd { margin: 0 0 12px; }
.cmd .field-label { display: block; margin-bottom: 5px; }

/* ---------- notices ---------- */
.notice { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: var(--accent-tint); color: var(--text); margin-bottom: 14px; font-size: 13.5px; }
.notice .icon { margin-top: 2px; color: var(--accent-text); }
.notice.warn { background: var(--amber-tint); }
.notice.warn .icon { color: var(--amber-text); }
.notice.error { background: var(--red-tint); }
.notice.error .icon { color: var(--red-text); }
.notice.ok { background: var(--green-tint); }
.notice.ok .icon { color: var(--green-text); }
.notice p:last-child { margin: 0; }

.state { padding: 40px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.state .icon { width: 28px; height: 28px; color: var(--faint); }
.state.error .icon { color: var(--red); }

/* ---------- dialogs ---------- */
dialog.dlg { border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0; width: min(520px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: var(--panel); color: var(--text); box-shadow: var(--shadow-pop); }
dialog.dlg.wide { width: min(820px, calc(100vw - 24px)); }
dialog.dlg::backdrop { background: rgba(10, 15, 25, .45); }
dialog.dlg form { display: flex; flex-direction: column; max-height: calc(100vh - 34px); margin: 0; }
.dlg-head { display: flex; align-items: center; gap: 10px; padding: 16px 18px 12px; }
.dlg-head h2 { flex: 1; font-size: 17px; }
.dlg-body { padding: 4px 18px 16px; overflow: auto; }
.dlg-body > p { color: var(--text); }
.dlg-foot { display: flex; gap: 8px; justify-content: flex-end; padding: 12px 18px; border-top: 1px solid var(--border); background: var(--panel-2); border-radius: 0 0 var(--radius-lg) var(--radius-lg); flex-wrap: wrap; }
.dlg-foot .left { margin-right: auto; }
.confirm-list { margin: 6px 0 12px; padding-left: 20px; color: var(--muted); }
.confirm-list li { margin: 3px 0; }

/* ---------- login and setup ---------- */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; gap: 16px; }
.auth-card { width: 100%; max-width: 400px; padding: 28px; }
.auth-card.wide { max-width: 560px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand .brand-mark { width: 38px; height: 38px; border-radius: 10px; }
.auth-brand .brand-mark .icon { width: 22px; height: 22px; }
.auth-brand h1 { font-size: 20px; }
.auth-brand .brand-sub { color: var(--muted); max-width: none; font-size: 13px; }
.auth-card h2 { font-size: 17px; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin-bottom: 18px; }
.auth-or { display: flex; align-items: center; gap: 10px; margin: 16px 0; color: var(--muted); font-size: 12.5px; }
.auth-or::before, .auth-or::after { content: ''; flex: 1; border-top: 1px solid var(--border); }
.auth-or-link { margin-top: 16px; text-align: center; font-size: 13.5px; }
.auth-foot { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12.5px; }
.linkish { border: 0; background: none; color: var(--accent-text); cursor: pointer; padding: 0; font: inherit; text-decoration: underline; text-underline-offset: 2px; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps span { flex: 1; height: 4px; border-radius: 4px; background: var(--control); }
.steps span.done { background: var(--accent); }
.qr-row { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 14px; }
.qr { background: #fff; padding: 10px; border-radius: var(--radius); border: 1px solid var(--border); line-height: 0; flex: none; }
.qr svg { width: 180px; height: 180px; display: block; }
.qr-side { flex: 1; min-width: 200px; }
.codes { display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px 18px; padding: 14px 16px; background: var(--panel-2); border: 1px solid var(--border-strong); border-radius: var(--radius); margin: 10px 0 12px; font-family: var(--mono); font-size: 14px; }
.codes span { white-space: nowrap; }
.code-input { font-family: var(--mono); font-size: 18px; letter-spacing: .12em; height: 42px; text-align: center; }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px)); }
.toast { display: flex; gap: 10px; align-items: flex-start; padding: 10px 12px; border-radius: var(--radius); background: var(--panel); border: 1px solid var(--border); box-shadow: var(--shadow-pop); border-left: 4px solid var(--accent); }
.toast.ok { border-left-color: var(--green); }
.toast.ok .icon { color: var(--green-text); }
.toast.error { border-left-color: var(--red); }
.toast.error .icon { color: var(--red-text); }
.toast .msg { flex: 1; }
.toast button { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 0; }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .dir-grid { grid-template-columns: 1fr; }
  .dir-detail { position: static; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 60; transform: translateX(-100%); transition: transform .2s; box-shadow: var(--shadow-pop); }
  .shell.nav-open .side { transform: none; }
  .shell.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(10,15,25,.45); z-index: 55; }
  .topbar { padding: 0 12px; gap: 8px; }
  .topbar .menu-toggle { display: inline-flex; }
  .content { padding: 16px 12px 32px; }
  .user-btn .uname { display: none; }
  .table-wrap { max-height: none; }
  .codes { grid-template-columns: 1fr; }
  .toolbar .search { max-width: none; }
}

/* ---------- additions ---------- */
.input.narrow, .toolbar .input.narrow { width: 90px; }
.grid-2 + .panel, .grid-2 + .grid-2, form > .panel + .panel, form > .notice + .panel, .panel + form, form + .panel { margin-top: 18px; }
.stats + .grid-2 { margin-top: 0; }
.sticky-foot { position: sticky; bottom: 0; margin-top: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow); z-index: 5; }
.toolbar .check { align-items: center; white-space: nowrap; font-size: 13px; }
.toolbar .check input { margin-top: 0; }
.input-row .spacer { flex: 1; }
.panel-body .input-row { flex-wrap: wrap; }
.kv dd .lang { vertical-align: middle; }
.cell-sub .icon, .dim .icon { width: 13px; height: 13px; }

/* Statistics: one bar per day. */
.stats-bars { display: flex; align-items: flex-end; gap: 2px; height: 120px; }
.stats-bar { flex: 1 1 0; min-width: 1px; height: 100%; display: flex; align-items: flex-end; }
.stats-bar span { display: block; width: 100%; min-height: 1px; background: var(--accent, currentColor); border-radius: 2px 2px 0 0; }
