:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef2f0;
  --text: #1b2421;
  --muted: #5d6b66;
  --border: #d9e0dd;
  --primary: #0f5c4d;
  --primary-text: #ffffff;
  --primary-soft: #dcefe9;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --focus: #2f8f7a;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.05), 0 4px 16px rgb(0 0 0 / 0.06);
  --radius: 12px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1413;
    --surface: #171e1c;
    --surface-2: #1f2826;
    --text: #e6ece9;
    --muted: #93a39d;
    --border: #2b3633;
    --primary: #3fb39a;
    --primary-text: #06231d;
    --primary-soft: #183a33;
    --danger: #f07167;
    --danger-soft: #3a1d1b;
    --focus: #5fd0b6;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 "Segoe UI", Tahoma, "Noto Sans Arabic", "Geeza Pro", system-ui, sans-serif;
  min-height: 100dvh;
}

h1, h2, h3 { margin: 0; line-height: 1.3; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; margin-top: 1.25rem; }
.muted { color: var(--muted); font-weight: normal; font-size: 0.85rem; }
.spacer { flex: 1; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

input, select, textarea, button { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  width: 100%;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
label { display: grid; gap: 0.3rem; font-size: 0.9rem; color: var(--muted); }
label > input, label > textarea { color: var(--text); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  border: 1px solid var(--border); background: var(--surface); border-radius: 8px;
  padding: 0.5rem 1rem; cursor: pointer; text-decoration: none; white-space: nowrap; font-size: 0.95rem;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--danger); border-color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.small { padding: 0.25rem 0.6rem; font-size: 0.85rem; }
.btn:disabled { opacity: 0.6; cursor: wait; }
.icon-btn { border: 0; background: transparent; cursor: pointer; padding: 0.35rem; border-radius: 8px; display: inline-flex; color: var(--muted); }
.icon-btn:hover { background: var(--surface-2); color: var(--text); }
.close { font-size: 1.6rem; line-height: 1; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1.25rem; box-shadow: var(--shadow); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1rem; }

.banner { background: #8a5a00; color: #fff; text-align: center; padding: 0.4rem; font-size: 0.9rem; }

/* تسجيل الدخول */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(380px, 100%); display: grid; gap: 1rem; text-align: center; }
.login-card img { margin: 0 auto; }
.login-card label { text-align: start; }
.error { color: var(--danger); min-height: 1.2em; margin: 0; font-size: 0.9rem; }

/* الشريط العلوي */
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem;
  padding: 0.6rem 16px; padding-top: max(0.6rem, env(safe-area-inset-top));
  background: var(--surface); border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 0.5rem; font-weight: 700; }
.tabs { display: flex; gap: 0.25rem; }
.tabs button { border: 0; background: none; padding: 0.4rem 0.8rem; border-radius: 8px; cursor: pointer; color: var(--muted); }
.tabs button.active { background: var(--primary-soft); color: var(--primary); font-weight: 600; }
.user-menu { margin-inline-start: auto; position: relative; }
.menu {
  position: absolute; inset-inline-end: 0; top: calc(100% + 4px); min-width: 180px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow);
  display: grid; padding: 0.3rem; z-index: 20;
}
.menu button { text-align: start; border: 0; background: none; padding: 0.5rem 0.75rem; border-radius: 6px; cursor: pointer; }
.menu button:hover { background: var(--surface-2); }

.view { max-width: 1100px; margin: 0 auto; padding: 1.25rem 16px 4rem; }

/* البحث */
.search-row { display: flex; gap: 0.6rem; align-items: center; flex-wrap: wrap; }
.search {
  flex: 1 1 320px; display: flex; align-items: center; gap: 0.5rem;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0.2rem 0.4rem 0.2rem 0.9rem;
  padding-inline-start: 0.9rem; box-shadow: var(--shadow);
}
.search > svg { color: var(--muted); }
.search input { border: 0; background: transparent; padding: 0.55rem 0; }
.search input:focus-visible { outline: none; }
.search:focus-within { outline: 2px solid var(--focus); outline-offset: 1px; }
.mic {
  border: 0; border-radius: 999px; width: 42px; height: 42px; display: grid; place-items: center; cursor: pointer;
  background: var(--primary-soft); color: var(--primary);
}
.mic.listening { background: var(--danger); color: #fff; animation: pulse 1.2s infinite; }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgb(180 35 24 / 0.5); } 50% { box-shadow: 0 0 0 8px rgb(180 35 24 / 0); } }
#sort { width: auto; }
.add-buttons { display: flex; gap: 0.5rem; }
.chips.types { margin-top: -0.4rem; }
.chips.types .chip { font-size: 0.8rem; padding: 0.15rem 0.7rem; }
.chips.types .chip.active { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }
.file-link { color: var(--primary); overflow-wrap: anywhere; direction: ltr; text-align: right; font-size: 0.85rem; }
.voice-status { margin: 0.5rem 0 0; color: var(--primary); font-size: 0.9rem; }

.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin: 1rem 0; }
.chip {
  border: 1px solid var(--border); background: var(--surface); border-radius: 999px; padding: 0.25rem 0.8rem;
  cursor: pointer; font-size: 0.85rem; color: var(--muted);
}
.chip.active { background: var(--primary); border-color: var(--primary); color: var(--primary-text); }

/* قائمة الملفات */
.file-list { display: grid; gap: 0.6rem; }
.file {
  --type-color: #6b7a75;
  display: grid; grid-template-columns: auto auto 1fr auto; gap: 0.9rem; align-items: center; position: relative;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 0.8rem 1rem;
  border-inline-start: 4px solid var(--type-color);
}
.file.selected { background: var(--primary-soft); border-color: var(--primary); border-inline-start-color: var(--type-color); }
.file-icon {
  width: 52px; height: 52px; border-radius: 10px; display: grid; place-items: center; overflow: hidden; flex-shrink: 0;
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.02em; color: #fff; background: var(--type-color);
}
.file-main { min-width: 0; }
.file-name { font-weight: 600; overflow-wrap: anywhere; cursor: pointer; }
.file-name:hover { color: var(--primary); text-decoration: underline; }
.file-meta { color: var(--muted); font-size: 0.82rem; display: flex; gap: 0.35rem 0.9rem; flex-wrap: wrap; }
.tag { background: var(--surface-2); border-radius: 6px; padding: 0 0.45rem; }
.badge { background: var(--primary-soft); color: var(--primary); border-radius: 6px; padding: 0 0.45rem; font-weight: 600; }
.file-actions { display: flex; gap: 0.2rem; }
.empty { text-align: center; color: var(--muted); padding: 3rem 1rem; border: 2px dashed var(--border); border-radius: var(--radius); }

.drop-hint {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; font-size: 1.5rem; font-weight: 700;
  background: rgb(15 92 77 / 0.85); color: #fff; pointer-events: none;
}

/* النوافذ */
dialog {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 0; background: var(--surface); color: var(--text);
  width: min(520px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); box-shadow: 0 20px 60px rgb(0 0 0 / 0.3);
}
dialog.wide { width: min(760px, calc(100vw - 32px)); }
dialog.full { width: calc(100vw - 32px); height: calc(100dvh - 32px); max-width: 1400px; }
dialog::backdrop { background: rgb(0 0 0 / 0.45); }
.dialog-body { padding: 1.25rem; display: grid; gap: 0.9rem; }
.actions { display: flex; gap: 0.5rem; justify-content: flex-end; align-items: center; flex-wrap: wrap; }
.file-pick { border: 2px dashed var(--border); border-radius: 10px; padding: 1.25rem; text-align: center; cursor: pointer; }
.file-pick input { border: 0; padding: 0; background: none; }
.upload-names { margin: 0; padding-inline-start: 1.2rem; font-size: 0.88rem; max-height: 120px; overflow: auto; }
progress { width: 100%; accent-color: var(--primary); }

.meta-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.meta-form .full { grid-column: 1 / -1; }
.versions { list-style: none; margin: 0; padding: 0; display: grid; gap: 0.4rem; }
.versions li { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; padding: 0.55rem 0.75rem; border: 1px solid var(--border); border-radius: 8px; }
.versions li.current { border-color: var(--primary); background: var(--primary-soft); }
.versions .v-info { flex: 1; min-width: 180px; font-size: 0.88rem; }
.share-body { display: grid; gap: 1rem; }
.share-section { border: 1px solid var(--border); border-radius: 10px; padding: 1rem; display: grid; gap: 0.6rem; }
.share-section h3 { margin: 0; font-size: 0.95rem; }
.share-section p { margin: 0; font-size: 0.85rem; color: var(--muted); }
.share-row { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.share-row select { width: auto; }
.btn.whatsapp { background: #1fa855; border-color: #1fa855; color: #fff; }
.btn.whatsapp:hover { filter: brightness(1.08); background: #1fa855; }
.share-url { direction: ltr; text-align: left; font-size: 0.85rem; }
.share-list { display: grid; gap: 0.4rem; font-size: 0.85rem; }
.share-list div { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 0.4rem; }
.share-list span { flex: 1; color: var(--muted); }
.activity { display: grid; gap: 0.2rem; font-size: 0.87rem; max-height: 340px; overflow: auto; }
.activity div { display: flex; gap: 0.6rem; padding: 0.3rem 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.activity time { color: var(--muted); min-width: 9.5rem; }

/* المحرر */
.editor { display: flex; flex-direction: column; height: 100%; }
.editor-head { display: flex; align-items: center; gap: 0.6rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.editor-head h2 { overflow-wrap: anywhere; }
#editor-note { width: 240px; }
.toolbar { display: flex; gap: 0.25rem; padding: 0.4rem 1rem; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: var(--surface-2); }
.toolbar button, .toolbar select { border: 1px solid var(--border); background: var(--surface); border-radius: 6px; padding: 0.2rem 0.6rem; cursor: pointer; width: auto; }
.editor-area { flex: 1; overflow: auto; background: var(--bg); }
.editor-area textarea { width: 100%; height: 100%; border: 0; border-radius: 0; resize: none; padding: 1.25rem; font-family: ui-monospace, Consolas, monospace; font-size: 0.95rem; }
.doc-page {
  max-width: 820px; min-height: 100%; margin: 1.25rem auto; padding: 2.5rem 3rem; background: #fff; color: #111;
  box-shadow: var(--shadow); border-radius: 4px; outline: none;
}
.doc-page table { border-collapse: collapse; }
.doc-page td, .doc-page th { border: 1px solid #999; padding: 0.3rem 0.5rem; }
.sheet-tabs { display: flex; gap: 0.25rem; padding: 0.4rem 1rem; border-bottom: 1px solid var(--border); overflow-x: auto; }
.sheet-tabs button { border: 1px solid var(--border); background: var(--surface); border-radius: 6px 6px 0 0; padding: 0.2rem 0.9rem; cursor: pointer; white-space: nowrap; }
.sheet-tabs button.active { background: var(--primary); color: var(--primary-text); border-color: var(--primary); }
.grid { border-collapse: collapse; font-size: 0.88rem; background: var(--surface); }
.grid th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 600; min-width: 2.5rem; z-index: 1; }
.grid th, .grid td { border: 1px solid var(--border); padding: 0; }
.grid th.row-h { position: sticky; inset-inline-start: 0; z-index: 2; }
.grid input { border: 0; border-radius: 0; min-width: 110px; padding: 0.3rem 0.45rem; background: transparent; }
.grid input.changed { background: #fff3c4; color: #111; }
.grid input.formula { color: #1d4ed8; }
.preview-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.preview-img { max-width: 100%; display: block; margin: 1rem auto; }
.preview-text { white-space: pre-wrap; padding: 1.25rem; margin: 0; }
.preview-media { display: block; max-width: 100%; max-height: 100%; margin: 0 auto; background: #000; }
.preview-audio { display: block; width: min(600px, calc(100% - 32px)); margin: 3rem auto; }

/* الإدارة */
.admin-grid { display: grid; grid-template-columns: 3fr 2fr; gap: 1rem; }
.admin-grid .wide { grid-column: 1 / -1; }
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th, .table td { text-align: start; padding: 0.5rem 0.4rem; border-bottom: 1px solid var(--border); }
.table th { color: var(--muted); font-weight: 600; }
.status-off { color: var(--danger); }
.trash-item { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border); font-size: 0.9rem; }
.trash-item span { flex: 1; overflow-wrap: anywhere; }

.toast {
  position: fixed; bottom: max(1.25rem, env(safe-area-inset-bottom)); inset-inline: 16px; margin: 0 auto; width: fit-content; max-width: calc(100vw - 32px);
  background: var(--text); color: var(--bg); padding: 0.65rem 1.1rem; border-radius: 10px; z-index: 100; box-shadow: var(--shadow);
}
.toast.error { background: var(--danger); color: #fff; }

@media (max-width: 720px) {
  .topbar { gap: 0.5rem; }
  .brand span { display: none; }
  .search-row #sort { flex: 1; }
  .add-buttons { flex: 1 1 100%; }
  .add-buttons .btn { flex: 1; padding-inline: 0.5rem; }
  .file { grid-template-columns: auto auto 1fr; }
  .filters select { flex: 1 1 45%; }
  .add-buttons .btn { font-size: 0.85rem; }
  .stat-tiles { grid-template-columns: repeat(2, 1fr); }
  .file-actions { grid-column: 1 / -1; justify-content: flex-end; border-top: 1px solid var(--border); padding-top: 0.4rem; }
  .meta-form { grid-template-columns: 1fr; }
  .admin-grid { grid-template-columns: 1fr; }
  dialog.full { width: 100vw; height: 100dvh; max-height: 100dvh; border-radius: 0; }
  #editor-hint { display: none; }
  #editor-note { width: 100%; order: 5; }
  .doc-page { padding: 1.25rem; margin: 0; border-radius: 0; }
  .activity time { min-width: auto; }
}

/* ---------- هوية الملفات بالألوان، المجلدات، الشبكة ---------- */
.file-icon img { width: 100%; height: 100%; object-fit: cover; display: block; }
.file-check { width: 20px; height: 20px; accent-color: var(--primary); cursor: pointer; margin: 0; }
.mono { font-family: ui-monospace, Consolas, monospace; direction: ltr; unicode-bidi: isolate; }
.archive-no { font-family: ui-monospace, Consolas, monospace; direction: ltr; unicode-bidi: isolate; font-size: 0.78rem; }
.type-tag { color: var(--type-color); font-weight: 700; }
.badge.expired { background: var(--danger-soft); color: var(--danger); }
.badge.soon { background: #fff1d6; color: #8a5a00; }
.badge.lock { background: var(--surface-2); color: var(--muted); }
.path { color: var(--muted); font-size: 0.8rem; }
.hits { display: grid; gap: 0.2rem; margin-top: 0.35rem; }
.hit { border: 0; background: var(--surface-2); border-radius: 6px; padding: 0.2rem 0.5rem; text-align: start; cursor: pointer; font-size: 0.82rem; }
.hit:hover { background: var(--primary-soft); }
.hit time { color: var(--primary); font-weight: 700; margin-inline-end: 0.4rem; direction: ltr; display: inline-block; }

.filters { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; margin-top: 0.9rem; }
.filters select, #sort { width: auto; padding: 0.4rem 0.6rem; font-size: 0.9rem; }
.filters select.active { border-color: var(--primary); background: var(--primary-soft); color: var(--primary); }
.view-toggle { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.view-toggle button { border: 0; background: var(--surface); padding: 0.4rem 0.6rem; cursor: pointer; color: var(--muted); display: grid; }
.view-toggle button.active { background: var(--primary-soft); color: var(--primary); }
.chips.types { margin: 0.6rem 0 0.4rem; }
.chips.types .chip { display: inline-flex; align-items: center; gap: 0.35rem; }
.chips.types .chip .dot { width: 10px; height: 10px; border-radius: 3px; background: var(--type-color); }
.chips.types .chip.active { background: var(--type-color, var(--primary)); border-color: var(--type-color, var(--primary)); color: #fff; }
.chips.types .chip.active .dot { background: #fff; }

.expiry-banner { display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin: 0.6rem 0; padding: 0.6rem 0.9rem;
  border-radius: 10px; background: #fff1d6; color: #6b4500; border: 1px solid #f1d08a; font-size: 0.9rem; }
.expiry-banner button:first-of-type { margin-inline-start: auto; }
.alerts-btn { position: relative; }
.alerts-btn .count { position: absolute; top: -2px; inset-inline-end: -2px; background: var(--danger); color: #fff; border-radius: 999px; font-size: 0.7rem; min-width: 18px; height: 18px; display: grid; place-items: center; padding: 0 4px; }

.breadcrumb { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; margin: 0.8rem 0 0.6rem; font-size: 0.95rem; }
.breadcrumb button { border: 0; background: none; padding: 0.2rem 0.4rem; border-radius: 6px; cursor: pointer; color: var(--muted); }
.breadcrumb button:hover { background: var(--surface-2); color: var(--text); }
.breadcrumb button[aria-current] { color: var(--text); font-weight: 700; }
.breadcrumb .sep { color: var(--muted); }
.breadcrumb .folder-tools { margin-inline-start: auto; display: flex; gap: 0.3rem; }

.folder-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0.6rem; margin-bottom: 0.8rem; }
.folder-card { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.9rem; border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); cursor: pointer; text-align: start; font: inherit; color: inherit; }
.folder-card:hover { border-color: var(--primary); }
.folder-card svg { width: 28px; height: 28px; color: #e0a526; flex-shrink: 0; }
.folder-card .fname { font-weight: 600; overflow-wrap: anywhere; }
.folder-card .fmeta { font-size: 0.78rem; color: var(--muted); }

.selection-bar { position: sticky; top: 58px; z-index: 5; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap;
  padding: 0.5rem 0.75rem; margin-bottom: 0.6rem; border-radius: 10px; background: var(--primary-soft); border: 1px solid var(--primary); }

.file-list.layout-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
.file-list.layout-grid .file { grid-template-columns: 1fr; padding: 0; overflow: hidden; gap: 0; border-inline-start-width: 1px; border-top: 4px solid var(--type-color); align-items: stretch; }
.file-list.layout-grid .file-check { position: absolute; top: 10px; inset-inline-start: 10px; z-index: 1; background: var(--surface); }
.file-list.layout-grid .file-icon { width: 100%; height: auto; aspect-ratio: 16 / 10; border-radius: 0; font-size: 1.1rem; cursor: pointer; }
.file-list.layout-grid .file-main { padding: 0.6rem 0.75rem 0; }
.file-list.layout-grid .file-actions { padding: 0.2rem 0.4rem 0.4rem; justify-content: flex-end; border-top: 0; }
.file-list.layout-grid .file-meta .optional { display: none; }

.two-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.job-note { margin: 0; padding: 0.5rem 0.75rem; border-radius: 8px; background: var(--surface-2); color: var(--muted); font-size: 0.85rem; }
.transcript { display: grid; gap: 0.15rem; max-height: 260px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 0.4rem; }
.transcript button { border: 0; background: none; text-align: start; padding: 0.25rem 0.4rem; border-radius: 6px; cursor: pointer; font: inherit; font-size: 0.9rem; }
.transcript button:hover { background: var(--surface-2); }
.transcript time { color: var(--primary); font-weight: 700; margin-inline-end: 0.5rem; direction: ltr; display: inline-block; min-width: 3.2rem; }
.checklist { display: grid; gap: 0.3rem; max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; }
.checklist label { display: flex; gap: 0.5rem; align-items: center; color: var(--text); }
.checklist input { width: auto; }

/* الإحصائيات */
.stat-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 1.25rem; }
.stat { border: 1px solid var(--border); border-radius: 10px; padding: 0.8rem 1rem; }
.stat .label { color: var(--muted); font-size: 0.85rem; }
.stat .value { font-size: 1.6rem; font-weight: 700; line-height: 1.2; }
.stat .sub { color: var(--muted); font-size: 0.8rem; }
.stat.warn .value { color: #b26b00; }
.charts { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1.25rem; }
.chart h3 { margin: 0 0 0.6rem; font-size: 0.95rem; }
.bars { display: grid; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 7rem 1fr 4.5rem; gap: 0.5rem; align-items: center; font-size: 0.85rem; }
.bar-row .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-row .track { height: 12px; }
.bar-row .fill { height: 100%; min-width: 3px; border-radius: 0 4px 4px 0; background: var(--bar, var(--primary)); }
[dir="rtl"] .bar-row .fill { border-radius: 4px 0 0 4px; }
.bar-row .val { color: var(--muted); font-variant-numeric: tabular-nums; text-align: end; }
.columns { display: flex; align-items: flex-end; gap: 2px; height: 120px; border-bottom: 1px solid var(--border); direction: ltr; }
.columns .col { flex: 1; display: flex; align-items: flex-end; height: 100%; cursor: default; }
.columns .col span { width: 100%; min-height: 2px; background: var(--primary); border-radius: 4px 4px 0 0; }
.columns .col:hover span { filter: brightness(1.2); }
.axis { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.75rem; margin-top: 0.3rem; direction: ltr; }
.tooltip { position: fixed; z-index: 200; pointer-events: none; background: var(--text); color: var(--bg); font-size: 0.8rem; padding: 0.3rem 0.55rem; border-radius: 6px; white-space: nowrap; }
.dup-group { border: 1px solid var(--border); border-radius: 8px; padding: 0.5rem; margin-bottom: 0.5rem; display: grid; gap: 0.3rem; font-size: 0.85rem; }
.dup-group div { display: flex; gap: 0.5rem; align-items: center; }
.dup-group span { flex: 1; overflow-wrap: anywhere; }
@media (prefers-color-scheme: dark) {
  .expiry-banner { background: #3a2c0f; color: #f3d38b; border-color: #5c4415; }
  .badge.soon { background: #3a2c0f; color: #f3d38b; }
  .stat.warn .value { color: #f3b54a; }
}
