/* ================= condition vocabulary ================= */
[data-cond="Good"]    { --c: var(--cond-good);    --c-ink: var(--cond-good-ink);    --c-soft: var(--cond-good-soft);    --c-text: var(--cond-good-text); }
[data-cond="Fair"]    { --c: var(--cond-fair);    --c-ink: var(--cond-fair-ink);    --c-soft: var(--cond-fair-soft);    --c-text: var(--cond-fair-text); }
[data-cond="Poor"]    { --c: var(--cond-poor);    --c-ink: var(--cond-poor-ink);    --c-soft: var(--cond-poor-soft);    --c-text: var(--cond-poor-text); }
[data-cond="Unknown"] { --c: var(--cond-unknown); --c-ink: var(--cond-unknown-ink); --c-soft: var(--cond-unknown-soft); --c-text: var(--cond-unknown-text); }

.pill {
  display: inline-flex; align-items: center; gap: 7px; height: 26px; padding-inline: 10px 12px;
  border-radius: 999px; background: var(--c-soft); color: var(--c-text);
  font-size: var(--fs-xs); font-weight: 600; white-space: nowrap;
}
.pill::before { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--c); flex: none; }
.pill[data-cond="Unknown"]::before { background: transparent; border: 2px dashed var(--c); }
/* a type scored 0..100: the element's --c is the score's colour (labels.scoreStyle); soft background and text from it */
[data-score] { --c-soft: color-mix(in srgb, var(--c) 16%, var(--surface)); --c-text: color-mix(in srgb, var(--c) 72%, var(--ink)); --c-ink: #fff; }
.pill[data-score]::before { background: var(--c); border: 0; }
.pill--lg { height: 32px; font-size: var(--fs-s); padding-inline: 12px 14px; }

.tag {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding-inline: 8px;
  border-radius: var(--r-s); font-size: var(--fs-2xs); font-weight: 600; white-space: nowrap;
  background: var(--surface-3); color: var(--ink-2);
}
.tag svg { width: 13px; height: 13px; }
.tag--repair { background: var(--cond-poor-soft); color: var(--cond-poor-text); }
.tag--inspect { background: var(--cond-fair-soft); color: var(--cond-fair-text); }

/* ================= summary ================= */
.summary {
  display: grid; gap: 14px 36px; align-items: center;
  grid-template-columns: minmax(0, 1fr);
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 12px 18px;
}
/* the condition bar was removed (2026-10-27): only the figures remain */

.cond-bar { display: flex; gap: 4px; min-width: 0; }
.cond-seg {
  flex: 1 1 0; min-width: 68px; border: 0; background: transparent; padding: 6px 6px 5px;
  border-radius: var(--r-m); text-align: start; display: grid; gap: 7px;
  transition: opacity .15s, background-color .15s;
}
.cond-seg:hover { background: var(--surface-2); }
.cond-seg__bar { height: 12px; border-radius: 3px; background: var(--c); display: block; }
.cond-seg[data-cond="Unknown"] .cond-seg__bar {
  background: repeating-linear-gradient(135deg, var(--c) 0 3px, transparent 3px 7px);
  box-shadow: inset 0 0 0 1.5px var(--c);
}
.cond-seg__meta { display: flex; align-items: baseline; gap: 7px; padding-inline: 1px; }
.cond-seg__count { font-size: var(--fs-l); font-weight: 650; font-variant-numeric: tabular-nums; }
.cond-seg__label { font-size: var(--fs-s); color: var(--ink-2); }
.cond-seg.is-active { background: var(--c-soft); box-shadow: inset 0 0 0 1.5px var(--c); }
.summary[data-filtered="true"] .cond-seg:not(.is-active) { opacity: .5; }

/* one line: the figures share the width (at least 12px apart); they wrap only on narrow screens */
.stats { display: flex; gap: 12px 12px; flex-wrap: nowrap; justify-content: space-between; align-items: flex-start; }
@media (max-width: 760px) { .stats { flex-wrap: wrap; justify-content: flex-start; gap: 12px 28px; } }

.stat { display: grid; gap: 0; white-space: nowrap; }
.stat dd { order: 1; font-size: var(--fs-l); font-weight: 650; line-height: 1.5; font-variant-numeric: tabular-nums; }
.stat dt { order: 2; font-size: var(--fs-xs); color: var(--ink-3); }
.stat__sub { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 400; margin-top: -2px; }

/* ================= toolbar ================= */
.toolbar { display: grid; gap: 10px; }
.toolbar__row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.dd-clear-all:disabled { opacity: .45; cursor: default; }
.search { position: relative; flex: 1 1 260px; min-width: 200px; }
.search svg { position: absolute; inset-inline-start: 12px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--ink-3); pointer-events: none; }
.search .input { padding-inline-start: 38px; }

.select { position: relative; }
.select svg { position: absolute; inset-inline-end: 11px; top: 50%; translate: 0 -50%; width: 16px; height: 16px; color: var(--ink-3); pointer-events: none; }
.select .input { min-width: 150px; }

.filter-group { display: inline-flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.filter-group__label { font-size: var(--fs-xs); color: var(--ink-3); margin-inline-end: 2px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; height: 34px; padding-inline: 11px;
  border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--surface); color: var(--ink);
  font-size: var(--fs-s); white-space: nowrap; transition: background-color .12s, border-color .12s;
}
.chip svg { width: 17px; height: 17px; color: var(--ink-2); flex: none; }
.chip:hover { background: var(--surface-2); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); color: var(--ink); font-weight: 600; }
.chip[aria-pressed="true"] svg { color: var(--accent); }
.chip__n { color: var(--ink-3); font-variant-numeric: tabular-nums; font-size: var(--fs-xs); }
.chip[aria-pressed="true"] .chip__n { color: var(--ink-2); }
.chip--repair[aria-pressed="true"] { background: var(--cond-poor-soft); border-color: var(--cond-poor); }
.chip--repair[aria-pressed="true"] svg { color: var(--cond-poor-text); }

.view-toggle { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-m); overflow: hidden; background: var(--surface); }
.view-toggle button { border: 0; background: transparent; width: 40px; height: 38px; display: grid; place-items: center; color: var(--ink-2); }
.view-toggle button svg { width: 19px; height: 19px; }
.view-toggle button + button { border-inline-start: 1px solid var(--line-strong); }
.view-toggle button[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); }

.results-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 30px; }
.results-count { font-size: var(--fs-s); color: var(--ink-2); }
.results-count b { color: var(--ink); font-weight: 650; }

/* ================= asset cards ================= */
.cards { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }
.asset-card {
  position: relative; display: grid; gap: 9px; text-align: start; width: 100%;
  padding: 13px 14px 13px; background: var(--surface); border: 1px solid var(--line);
  border-inline-start: 6px solid var(--c); border-radius: var(--r-m);
  transition: border-color .12s, background-color .12s, opacity .15s;
}
.asset-card[data-cond="Unknown"] { border-inline-start-style: dashed; }
.asset-card:hover, .asset-card.is-hover { border-color: var(--line-strong); border-inline-start-color: var(--c); background: var(--surface-2); }
.asset-card.is-selected { outline: 2px solid var(--accent); outline-offset: 1px; }
.asset-card__top { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: var(--ink-2); font-size: var(--fs-xs); }
.asset-card__type { display: inline-flex; align-items: center; gap: 6px; }
.asset-card__type svg { width: 17px; height: 17px; }
.asset-card__id { font-weight: 650; color: var(--ink); font-size: var(--fs-s); letter-spacing: .02em; }
.asset-card__name { font-size: var(--fs-l); font-weight: 650; line-height: 1.35; }
.asset-card__facts { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: var(--fs-xs); color: var(--ink-2); }
.asset-card__fact { display: inline-flex; align-items: center; gap: 5px; }
.asset-card__fact svg { width: 15px; height: 15px; color: var(--ink-3); }
.asset-card__obs { font-size: var(--fs-xs); color: var(--ink-3); }
.asset-card__note {
  font-size: var(--fs-s); color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.asset-card__tags { display: flex; flex-wrap: wrap; gap: 6px; }
.asset-card > * { min-width: 0; }
.asset-card.is-dim { opacity: .4; }

/* ================= table view ================= */
/* the list's column never grows past the page: a wide table scrolls sideways inside its frame */
.content > * { min-width: 0; }
.table-wrap { overflow-x: auto; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); }
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-s); min-width: 900px; }
.table td { white-space: nowrap; }
.table td:last-child { white-space: normal; min-width: 130px; }
.table th { text-align: start; font-weight: 600; font-size: var(--fs-xs); color: var(--ink-3); padding: 10px 12px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { cursor: pointer; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr.is-selected { background: var(--accent-soft); }
.table tbody tr:focus-visible { outline-offset: -2px; }
.table .num-cell { font-variant-numeric: tabular-nums; white-space: nowrap; }
.table .id-cell { font-weight: 650; letter-spacing: .02em; white-space: nowrap; }
.table .muted { color: var(--ink-3); }

/* ================= empty & skeleton ================= */
.empty {
  display: grid; justify-items: center; gap: 10px; text-align: center; padding: 44px 20px;
  border: 1.5px dashed var(--line-strong); border-radius: var(--r-l); color: var(--ink-2);
}
.empty svg { width: 32px; height: 32px; color: var(--ink-3); }
.empty strong { font-size: var(--fs-l); color: var(--ink); }
.empty p { max-width: 42ch; font-size: var(--fs-s); }
.skeleton { background: linear-gradient(90deg, var(--surface-3), var(--surface-2), var(--surface-3)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; border-radius: var(--r-m); }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ================= rail: priority queue & detail ================= */
.rail {
  min-width: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-l);
}
@media (min-width: 1120px) {
  .rail { position: sticky; top: calc(var(--header-h) + 16px); max-height: calc(100dvh - var(--header-h) - 32px); overflow: auto; overscroll-behavior: contain; }
}
@media (max-width: 1119px) {
  .rail:not(.is-detail) { display: none; }
  .rail.is-detail {
    position: fixed; z-index: 40; inset-block: 0; inset-inline-end: 0; width: min(500px, 100%);
    border-radius: 0; border-block: 0; border-inline-end: 0; overflow: auto; box-shadow: var(--shadow-pop);
    padding-bottom: env(safe-area-inset-bottom);
  }
  .rail-backdrop { position: fixed; inset: 0; z-index: 39; background: rgba(8, 14, 18, .5); }
}
@media (min-width: 1120px) { .rail-backdrop { display: none; } }

.rail__head { padding: 18px 20px 12px; }
.rail__head h2 { font-size: var(--fs-l); font-weight: 650; }
.rail__head p { font-size: var(--fs-s); color: var(--ink-3); margin-top: 3px; }

.queue-group + .queue-group { border-top: 1px solid var(--line); }
.queue-group__title { display: flex; align-items: center; justify-content: space-between; padding: 12px 20px 6px; font-size: var(--fs-xs); font-weight: 650; color: var(--ink-2); }
.queue-group__count { font-variant-numeric: tabular-nums; color: var(--ink-3); font-weight: 500; }
.queue-item {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 2px 10px; align-items: center; width: 100%;
  text-align: start; padding: 9px 20px; border: 0; background: transparent; border-inline-start: 4px solid var(--c);
}
.queue-item:hover, .queue-item.is-hover { background: var(--surface-2); }
.queue-item__icon { grid-row: span 2; color: var(--ink-3); }
.queue-item__icon svg { width: 20px; height: 20px; }
.queue-item__name { font-size: var(--fs-s); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.queue-item__id { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 600; }
.queue-item__why { grid-column: 2 / 4; font-size: var(--fs-xs); color: var(--ink-2); }
.queue-empty { padding: 4px 20px 16px; font-size: var(--fs-s); color: var(--ink-3); }
.rail__foot { padding: 12px 20px 16px; border-top: 1px solid var(--line); font-size: var(--fs-xs); color: var(--ink-3); }

/* ---- detail ---- */
.detail__top { padding: 14px 20px 16px; border-top: 5px solid var(--c); border-radius: var(--r-l) var(--r-l) 0 0; display: grid; gap: 10px; }
.detail__top[data-cond="Unknown"] { border-top-style: dashed; }
.detail__nav { display: flex; align-items: center; justify-content: space-between; margin-inline: -8px; }
.detail__nav .btn { height: 34px; padding-inline: 8px 12px; }
.detail__nav .btn svg { transform: none; }
html[dir="rtl"] .icon-flip { transform: scaleX(-1); }
.detail__kicker { display: flex; align-items: center; gap: 8px; color: var(--ink-2); font-size: var(--fs-s); }
.detail__kicker svg { width: 19px; height: 19px; }
.detail__kicker b { color: var(--ink); letter-spacing: .02em; }
.detail__title { font-size: var(--fs-xl); font-weight: 650; line-height: 1.3; }
.detail__badges { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.section { padding: 16px 20px; border-top: 1px solid var(--line); display: grid; gap: 12px; }
.section__title { font-size: var(--fs-s); font-weight: 650; color: var(--ink); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.section__title small { font-weight: 500; color: var(--ink-3); font-size: var(--fs-xs); }

.facts { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.fact dt { font-size: var(--fs-xs); color: var(--ink-3); }
.fact dd { font-size: var(--fs-s); font-weight: 550; }
.fact--wide { grid-column: 1 / -1; }

.callout { padding: 10px 12px; border-radius: var(--r-m); font-size: var(--fs-s); display: flex; gap: 9px; align-items: flex-start; }
.callout svg { width: 18px; height: 18px; flex: none; margin-top: 3px; }
.callout--repair { background: var(--cond-poor-soft); color: var(--cond-poor-text); }
.callout--inspect { background: var(--cond-fair-soft); color: var(--cond-fair-text); }

.status-line { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.status-line strong { font-size: var(--fs-m); font-weight: 650; }
.status-line span { font-size: var(--fs-xs); color: var(--ink-3); }
.quote { font-size: var(--fs-s); color: var(--ink-2); padding-inline-start: 12px; border-inline-start: 3px solid var(--line-strong); }

.actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.actions .btn--wide { grid-column: 1 / -1; }

/* timeline */
.timeline { display: grid; gap: 0; position: relative; }
.tl-item { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; gap: 0 12px; padding-bottom: 16px; position: relative; }
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before { content: ""; position: absolute; inset-inline-start: 14px; top: 30px; bottom: 0; width: 2px; background: var(--line); }
.tl-item:last-child::before { display: none; }
.tl-node { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--c-soft, var(--surface-3)); color: var(--c-text, var(--ink-2)); box-shadow: inset 0 0 0 2px var(--c, var(--line-strong)); }
.tl-node svg { width: 16px; height: 16px; }
.tl-item--work .tl-node { --c: var(--line-strong); background: var(--surface-3); color: var(--ink-2); }
.tl-body { display: grid; gap: 3px; min-width: 0; padding-top: 3px; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: var(--fs-s); font-weight: 650; }
.tl-date { font-size: var(--fs-xs); color: var(--ink-3); font-weight: 400; }
.tl-note { font-size: var(--fs-s); color: var(--ink-2); overflow-wrap: anywhere; }
.tl-meta { font-size: var(--fs-xs); color: var(--ink-3); }
.tl-cost { font-weight: 650; color: var(--ink); font-variant-numeric: tabular-nums; }
.tl-del { opacity: 0; align-self: start; width: 30px; height: 30px; }
.tl-item:hover .tl-del, .tl-del:focus-visible { opacity: 1; }
@media (hover: none) { .tl-del { opacity: .7; } }
.tl-empty { border: 1.5px dashed var(--line-strong); border-radius: var(--r-m); padding: 14px; font-size: var(--fs-s); color: var(--ink-2); }

/* ================= dialog & forms ================= */
.dlg {
  width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); padding: 0;
  border: 1px solid var(--line); border-radius: var(--r-l); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-pop); overflow: hidden;
}
.dlg[open] { display: flex; flex-direction: column; animation: dlg-in .18s var(--ease); }
.dlg::backdrop { background: rgba(8, 14, 18, .55); backdrop-filter: blur(2px); }
@keyframes dlg-in { from { opacity: 0; transform: translateY(8px) scale(.985); } }
.dlg__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 18px 20px 12px; }
.dlg__head h2 { font-size: var(--fs-l); font-weight: 650; }
.dlg__head p { font-size: var(--fs-s); color: var(--ink-3); margin-top: 2px; }
.dlg__body { padding: 4px 20px 8px; overflow: auto; display: grid; gap: 14px; }
.dlg__foot { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px 18px; border-top: 1px solid var(--line); margin-top: 8px; }
.dlg__danger { margin-inline-end: auto; }   /* the destructive action keeps away from save */
.dlg--confirm { width: min(430px, calc(100vw - 24px)); }
.dlg--confirm .dlg__body { padding-bottom: 4px; font-size: var(--fs-s); color: var(--ink-2); }

.form-row { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.field { display: grid; gap: 6px; min-width: 0; align-content: start; }
.field__label { font-size: var(--fs-s); font-weight: 600; }
.field__label i { font-style: normal; font-weight: 400; color: var(--ink-3); font-size: var(--fs-xs); margin-inline-start: 6px; }
.field__hint { font-size: var(--fs-xs); color: var(--ink-3); }
.field__error { font-size: var(--fs-xs); color: var(--danger); font-weight: 550; display: none; }
.field.has-error .field__error { display: block; }
.field.has-error .input, .field.has-error .seg-group { border-color: var(--danger); }
.field.has-error .input:focus-visible { outline-color: var(--danger); }
.input-affix { position: relative; direction: ltr; }
.input-affix .input { padding-inline-end: 52px; }
.input-affix span { position: absolute; inset-inline-end: 12px; top: 50%; translate: 0 -50%; font-size: var(--fs-xs); color: var(--ink-3); pointer-events: none; }

.seg-group { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--surface-2); }
.seg-opt { position: relative; }
.check-group { display: flex; flex-wrap: wrap; gap: 8px; }
.check-opt { display: inline-flex; align-items: center; gap: 7px; height: 36px; padding-inline: 12px; border: 1px solid var(--line-strong);
  border-radius: var(--r-m); background: var(--surface-2); font-size: var(--fs-s); cursor: pointer; }
.check-opt svg { width: 16px; height: 16px; color: var(--ink-3); }
.check-opt input { margin: 0; accent-color: var(--cond-poor); }
.check-opt:has(input:checked) { background: var(--cond-poor-soft); border-color: var(--cond-poor); }
.check-opt:has(input:checked) svg { color: var(--cond-poor-text); }
.seg-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg-opt span {
  display: flex; align-items: center; justify-content: center; gap: 7px; min-height: 36px; padding: 4px 8px; text-align: center;
  border-radius: 6px; font-size: var(--fs-s); color: var(--ink-2); line-height: 1.3;
}
.seg-opt span svg { width: 17px; height: 17px; flex: none; }
.seg-opt input:checked + span { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: 0 0 0 1.5px var(--accent); }
.seg-opt[data-cond] input:checked + span { background: var(--c-soft); color: var(--c-text); box-shadow: 0 0 0 2px var(--c); }
.seg-opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.seg-opt input:disabled + span { opacity: .55; }
.seg-opt span .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c); }

/* ================= toast ================= */
.toasts { position: fixed; z-index: 60; inset-inline: 0; bottom: max(20px, env(safe-area-inset-bottom)); display: grid; justify-items: center; gap: 8px; pointer-events: none; padding-inline: 12px; }
.toast {
  pointer-events: auto; display: inline-flex; align-items: center; gap: 10px; max-width: min(520px, 100%);
  padding: 11px 16px; border-radius: var(--r-m); background: #1c2429; color: #f1f4f5; font-size: var(--fs-s);
  box-shadow: var(--shadow-pop); animation: toast-in .22s var(--ease);
}
:root[data-theme="dark"] .toast { background: #eef2f4; color: #12181c; }
.toast svg { width: 18px; height: 18px; flex: none; color: #5ad19a; }
:root[data-theme="dark"] .toast svg { color: #16815a; }
.toast--error svg { color: #ff8b83; }
:root[data-theme="dark"] .toast--error svg { color: #c93a31; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ================= progress card (long uploads) ================= */
.progress-host { position: fixed; z-index: 61; inset-inline-end: 16px; bottom: max(16px, env(safe-area-inset-bottom)); display: grid; gap: 8px; }
.progress {
  width: min(340px, calc(100vw - 32px)); display: grid; gap: 8px; padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-l); box-shadow: var(--shadow-pop);
}
.progress__head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.progress__title { font-size: var(--fs-s); font-weight: 650; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.progress__pct { font-size: var(--fs-s); font-variant-numeric: tabular-nums; color: var(--accent); flex: none; }
.progress__detail { font-size: var(--fs-xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.progress__detail:empty { display: none; }
.progress__bar { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 99px; background: var(--surface-2); overflow: hidden; }
.progress__bar::-webkit-progress-bar { background: var(--surface-2); border-radius: 99px; }
.progress__bar::-webkit-progress-value { background: var(--accent); border-radius: 99px; transition: width .2s; }
.progress__bar::-moz-progress-bar { background: var(--accent); border-radius: 99px; }
/* amount unknown (the server is working): a band sweeping across */
.progress__bar:indeterminate { background: linear-gradient(90deg, var(--surface-2) 0 30%, var(--accent) 45% 55%, var(--surface-2) 70%) 0 0 / 300% 100%; animation: progress-sweep 1.3s linear infinite; }
.progress__bar:indeterminate::-webkit-progress-bar { background: transparent; }
.progress__bar:indeterminate::-moz-progress-bar { background: transparent; }
@keyframes progress-sweep { from { background-position: 100% 0; } to { background-position: 0 0; } }

/* ================= date picker ================= */
.date-field { position: relative; }
.date-input { padding-inline-end: 44px; text-align: start; font-variant-numeric: tabular-nums; }
html[dir="rtl"] .date-input { text-align: right; }
.date-btn { position: absolute; inset-inline-end: 4px; top: 50%; translate: 0 -50%; width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: transparent; color: var(--ink-2); border-radius: 6px; }
.date-btn:hover { background: var(--surface-3); color: var(--ink); }
.date-btn svg { width: 19px; height: 19px; }

.cal {
  position: fixed; z-index: 80; width: 292px; padding: 10px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--r-l); box-shadow: var(--shadow-pop);
}
.cal__head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 6px; }
.cal__title { font-weight: 650; font-size: var(--fs-m); }
html[dir="rtl"] .icon-prev { transform: scaleX(-1); }
html[dir="ltr"] .icon-next { transform: scaleX(-1); }
.cal__week, .cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.cal__week span { font-size: var(--fs-xs); color: var(--ink-3); padding: 4px 0; font-weight: 600; }
.cal__blank { height: 36px; }
.cal__day { height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--ink); font-variant-numeric: tabular-nums; font-size: var(--fs-s); }
.cal__day:hover:not(:disabled) { background: var(--surface-3); }
.cal__day:disabled { color: var(--ink-3); opacity: .38; cursor: not-allowed; }
.cal__day.is-today { box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.cal__day.is-selected { background: var(--accent); color: var(--accent-ink); font-weight: 650; box-shadow: none; }
.cal__foot { display: flex; justify-content: center; margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--line); }

/* ================= CSV import ================= */
.dlg--wide { width: min(720px, calc(100vw - 24px)); }
.import__format { display: grid; gap: 8px; padding: 12px 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-m); font-size: var(--fs-s); }
.import__format .btn { justify-self: start; margin-top: 4px; }
.import__cols { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; direction: ltr; }
.import__cols code, .import__issues code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 11.5px; padding: 1px 6px; border-radius: 4px; background: var(--surface-3); color: var(--ink-2); direction: ltr; display: inline-block; }
.import__cols code.req { background: var(--accent-soft); color: var(--ink); }
.import__note { font-size: var(--fs-xs); color: var(--ink-3); }
.import__note--warn { color: var(--cond-fair-text); font-weight: 600; }
.dropzone {
  display: grid; justify-items: center; gap: 4px; text-align: center; padding: 26px 16px; cursor: pointer;
  border: 2px dashed var(--line-strong); border-radius: var(--r-l); color: var(--ink-2); transition: background-color .15s, border-color .15s;
}
.dropzone svg { width: 28px; height: 28px; color: var(--accent); }
.dropzone strong { color: var(--ink); }
.dropzone span { font-size: var(--fs-xs); color: var(--ink-3); }
.dropzone:hover, .dropzone.is-over { background: var(--accent-soft); border-color: var(--accent); }
.import__format + input + .dropzone { margin-top: 2px; }
#import-file:focus-visible + .dropzone { outline: 2px solid var(--focus); outline-offset: 2px; }
.import__status { display: grid; gap: 10px; }
.import__busy { font-size: var(--fs-s); color: var(--ink-2); }
.import__file { display: flex; align-items: center; gap: 8px; font-size: var(--fs-s); font-weight: 600; direction: ltr; justify-content: flex-start; }
.import__file svg { width: 18px; height: 18px; color: var(--ink-3); }
.import__stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.import__stat { display: grid; padding: 8px 12px; border-radius: var(--r-m); background: var(--surface-2); border-inline-start: 4px solid var(--line-strong); }
.import__stat b { font-size: var(--fs-l); font-variant-numeric: tabular-nums; }
.import__stat span { font-size: var(--fs-xs); color: var(--ink-3); }
.import__stat--ok { border-inline-start-color: var(--cond-good); background: var(--cond-good-soft); }
.import__stat--bad { border-inline-start-color: var(--cond-poor); background: var(--cond-poor-soft); }
.import__stat--dup { border-inline-start-color: var(--cond-unknown); }
.import__issues { max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: var(--r-m); }
.import__issues table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.import__issues th { position: sticky; top: 0; background: var(--surface-2); text-align: start; padding: 7px 10px; color: var(--ink-3); font-weight: 600; }
.import__issues td { padding: 7px 10px; border-top: 1px solid var(--line); vertical-align: top; }
.import__issues td.num { font-variant-numeric: tabular-nums; color: var(--ink-3); }
.import__issues tr.is-duplicate td { color: var(--ink-3); }
@media (max-width: 560px) { .import__stats { grid-template-columns: repeat(2, 1fr); } }

/* secondary header buttons on the dark bar */
.header .btn:not(.btn--primary) { background: rgba(255, 255, 255, .1); border-color: rgba(255, 255, 255, .22); color: var(--header-ink); }
.header .btn:not(.btn--primary):hover { background: rgba(255, 255, 255, .18); }
.header .btn:focus-visible { outline-color: #fff; }
/* «دارایی جدید»: its menu drops down under it (single asset / CSV-Excel / shapefile) */
.hdr-menu { position: relative; }
.hdr-menu__caret { display: inline-flex; margin-inline-start: -2px; }
.hdr-menu__caret svg { width: 14px; height: 14px; transition: rotate .15s; }
.hdr-menu .btn[aria-expanded="true"] .hdr-menu__caret svg { rotate: 180deg; }
@media (max-width: 960px) { .hdr-menu__caret { display: none; } }
.hdr-menu__list { position: absolute; top: calc(100% + 6px); inset-inline-end: 0; z-index: 60; min-width: 230px; padding: 6px; display: grid; gap: 2px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: 0 12px 30px rgba(0, 0, 0, .22); }
.hdr-menu__list[hidden] { display: none; }
.hdr-menu__item { all: unset; display: flex; align-items: center; gap: 10px; padding: 9px 12px; border-radius: 6px; cursor: pointer; font-size: var(--fs-s); white-space: nowrap; }
.hdr-menu__item:hover, .hdr-menu__item:focus-visible { background: var(--surface-2); }
.hdr-menu__item:focus-visible { outline: 2px solid var(--focus); outline-offset: -2px; }
.hdr-menu__item svg { width: 18px; height: 18px; color: var(--accent); }

/* ================= asset types and models ================= */
.type-cell { display: inline-flex; align-items: center; gap: 8px; }
.type-cell svg { width: 17px; height: 17px; color: var(--ink-2); flex: none; }
.btn--small { height: 30px; padding-inline: 10px; font-size: var(--fs-xs); gap: 6px; }
.btn--small svg { width: 15px; height: 15px; }
.badge { display: inline-flex; align-items: center; height: 22px; padding-inline: 8px; border-radius: var(--r-s); background: var(--surface-3); color: var(--ink-2); font-size: var(--fs-2xs); font-weight: 600; white-space: nowrap; }
.badge--off { background: var(--cond-poor-soft); color: var(--cond-poor-text); }
.badge--accent { background: var(--accent-soft); color: var(--accent); }
.types-list { display: grid; gap: 12px; }
.type-row { display: grid; gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); }
.type-row.is-inactive { opacity: .62; }
.type-row__main { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.type-row__icon { width: 36px; height: 36px; display: grid; place-items: center; border-radius: var(--r-m); background: var(--surface-3); color: var(--ink); flex: none; }
.type-row__icon svg { width: 22px; height: 22px; }
.type-row__names { display: grid; margin-inline-end: auto; min-width: 0; }
.type-row__names span { font-size: var(--fs-xs); color: var(--ink-3); }
.type-row__models { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: var(--fs-s); }
.type-row__label { font-size: var(--fs-xs); color: var(--ink-3); margin-inline-end: 4px; }
.type-row__models .muted { color: var(--ink-3); font-size: var(--fs-xs); }
.model-chip { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding-inline: 9px; border: 1px solid var(--line-strong); border-radius: 999px; background: var(--surface-2); font-size: var(--fs-xs); }
.model-chip:hover { background: var(--surface-3); }
.model-chip svg { width: 15px; height: 15px; color: var(--ink-2); }
.model-chip.is-inactive { opacity: .55; text-decoration: line-through; }
.type-row__actions { display: flex; gap: 8px; flex-wrap: wrap; }

.icon-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); gap: 6px; padding: 8px; border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--surface-2); }
.icon-opt { position: relative; }
.icon-opt input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.icon-opt span { display: grid; place-items: center; height: 40px; border-radius: 8px; color: var(--ink-2); border: 1px solid transparent; }
.icon-opt span svg { width: 22px; height: 22px; }
.icon-opt input:checked + span { background: var(--surface); color: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.icon-opt input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: 1px; }
.icon-opt__none { font-style: normal; font-size: 18px; }
.field .select .input { width: 100%; }

/* ================= long lists, source attributes, shapefile import ================= */
.results-more { display: flex; justify-content: center; padding: 14px 0 4px; }
.attrs summary { cursor: pointer; font-size: var(--fs-s); font-weight: 650; color: var(--ink); }
.attrs__list { display: grid; gap: 0; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r-m); max-height: 340px; overflow: auto; }
.attrs__row { display: grid; grid-template-columns: minmax(90px, 38%) minmax(0, 1fr); gap: 8px; padding: 6px 10px; border-top: 1px solid var(--line); font-size: var(--fs-xs); }
.attrs__row:first-child { border-top: 0; }
.attrs__row dt { color: var(--ink-3); font-family: ui-monospace, Menlo, Consolas, monospace; overflow-wrap: anywhere; text-align: start; }
.attrs__row dd { color: var(--ink); overflow-wrap: anywhere; }
.shp-mapping { display: grid; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-2); }
.shp-dirs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.shp-fields summary { cursor: pointer; font-size: var(--fs-s); color: var(--ink-2); }
.shp-fields .import__issues { margin-top: 8px; max-height: 260px; }
.shp-fields td .badge { margin-inline-start: 6px; height: 18px; }
.shp-history .types-list { gap: 8px; }
.import__file svg + span { overflow-wrap: anywhere; }

/* ================= photos ================= */
.btn--danger-quiet { border-color: transparent; background: transparent; color: var(--danger); }
.btn--danger-quiet:hover { background: var(--cond-poor-soft); }
.photo-section.is-drop { outline: 2px dashed var(--accent); outline-offset: -6px; background: var(--accent-soft); }
.photo-status:empty { display: none; }
.photo-status { font-size: var(--fs-xs); color: var(--ink-2); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; }
.photo-strip { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.photo-strip .photo-thumb { width: 64px; }
.photo-strip .photo-thumb__tag { display: none; }   /* the entry it sits under already says which record it documents */
.photo-thumb {
  position: relative; aspect-ratio: 1; padding: 0; overflow: hidden; cursor: zoom-in;
  border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface-3); color: var(--ink-3);
}
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s var(--ease); }
.photo-thumb:hover img { transform: scale(1.04); }
.photo-thumb:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.photo-thumb__none { display: grid; place-items: center; width: 100%; height: 100%; }
.photo-thumb__none svg { width: 26px; height: 26px; }
.photo-thumb__tag {
  position: absolute; inset-inline-start: 4px; bottom: 4px; width: 20px; height: 20px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(12, 18, 22, .68); color: #fff;
}
.photo-thumb__tag svg { width: 12px; height: 12px; }
.photo-empty { display: flex; align-items: center; gap: 10px; width: 100%; text-align: start; cursor: pointer; background: transparent; font: inherit; }
.photo-empty svg { width: 22px; height: 22px; flex: none; color: var(--accent); }
.photo-empty:hover { background: var(--surface-2); border-color: var(--accent); }

.photo-picker { display: grid; gap: 6px; }
.photo-picker .field__hint:empty { display: none; }
.photo-picker__row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.photo-picks { display: contents; list-style: none; }
.photo-pick { position: relative; width: 52px; height: 52px; border-radius: var(--r-s); overflow: hidden; background: var(--surface-3); color: var(--ink-3); display: grid; place-items: center; border: 1px solid var(--line); }
.photo-pick img { width: 100%; height: 100%; object-fit: cover; }
.photo-pick > svg { width: 22px; height: 22px; }
.photo-pick__del {
  position: absolute; top: 2px; inset-inline-end: 2px; width: 20px; height: 20px; padding: 0; border: 0; border-radius: 50%;
  display: grid; place-items: center; background: rgba(12, 18, 22, .72); color: #fff; cursor: pointer;
}
.photo-pick__del svg { width: 12px; height: 12px; }

.viewer { width: min(1040px, calc(100vw - 24px)); }
.viewer .dlg__head { padding-bottom: 8px; }
.viewer__stage {
  position: relative; display: flex; align-items: center; justify-content: center; overflow: hidden;
  flex: 1 1 auto; height: min(64dvh, 680px); min-height: 160px; background: #0d1215;
}
.viewer__img { max-width: 100%; max-height: 100%; object-fit: contain; display: block; }
.viewer__img[hidden] { display: none; }
.viewer .dlg__head, .viewer__foot { flex: none; }
.viewer__none { display: grid; justify-items: center; gap: 8px; color: #b9c3ca; font-size: var(--fs-s); padding: 20px; text-align: center; }
.viewer__none[hidden] { display: none; }
.viewer__none svg { width: 40px; height: 40px; }
.viewer__nav {
  position: absolute; top: 50%; translate: 0 -50%; width: 44px; height: 44px; border-radius: 50%; border: 0; cursor: pointer;
  display: grid; place-items: center; background: rgba(255, 255, 255, .14); color: #fff;
}
.viewer__nav:hover { background: rgba(255, 255, 255, .26); }
.viewer__nav:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.viewer__nav svg { width: 24px; height: 24px; }
.viewer__nav--prev { inset-inline-start: 10px; }
.viewer__nav--next { inset-inline-end: 10px; }
.viewer__foot { display: grid; gap: 10px; padding: 12px 20px 16px; }
.viewer__meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: var(--fs-xs); color: var(--ink-2); }
.viewer__meta > span { display: inline-flex; align-items: center; gap: 5px; min-width: 0; }
.viewer__meta svg { width: 14px; height: 14px; flex: none; color: var(--ink-3); }
.viewer__file bdi { overflow-wrap: anywhere; }
.viewer__caption { display: flex; gap: 8px; }
.viewer__caption .input { flex: 1; min-width: 0; }
.viewer__actions { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; }
@media (max-width: 560px) {
  .viewer__stage { height: 46dvh; }
  .viewer__caption { flex-direction: column; }
  .viewer__nav { width: 38px; height: 38px; }
}

/* ================= filter fields, bulk photo attach ================= */
.toolbar__row[hidden] { display: none; }
.shp-facets { display: flex; flex-wrap: wrap; gap: 6px; }
.shp-facets .chip { cursor: pointer; }
.shp-facets .chip input { margin: 0; accent-color: var(--accent); }

/* photo viewer zoom */
.viewer__stage { touch-action: none; }
.viewer__img { transform-origin: center; user-select: none; -webkit-user-drag: none; }
.viewer__stage.is-zoomed { cursor: grab; }
.viewer__stage.is-panning { cursor: grabbing; }
.viewer__stage .viewer__img { cursor: zoom-in; }
.viewer__stage.is-max .viewer__img { cursor: zoom-out; }
.viewer__stage.is-panning .viewer__img { cursor: grabbing; }
.viewer__zoom { position: absolute; inset-inline-end: 10px; bottom: 10px; display: flex; gap: 6px; }
.viewer__zbtn {
  width: 36px; height: 36px; border-radius: 50%; border: 0; cursor: pointer; display: grid; place-items: center;
  background: rgba(255, 255, 255, .14); color: #fff;
}
.viewer__zbtn:hover:not(:disabled) { background: rgba(255, 255, 255, .26); }
.viewer__zbtn:disabled { opacity: .4; cursor: default; }
.viewer__zbtn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.viewer__zbtn svg { width: 20px; height: 20px; }

/* ================= filter drop-downs ================= */
.toolbar__dds { gap: 8px; }
.dd { position: relative; }
.dd[hidden] { display: none; }
.dd__btn {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding-inline: 12px 10px; cursor: pointer;
  border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-s);
}
.dd__btn:hover { background: var(--surface-2); }
.dd__btn svg { width: 17px; height: 17px; color: var(--ink-2); }
.dd__btn.is-active { border-color: var(--accent); background: var(--accent-soft); }
.dd__btn.is-active svg:first-child { color: var(--accent); }
.dd__count:not(:empty) { min-width: 20px; height: 20px; padding-inline: 6px; border-radius: 10px; background: var(--accent); color: var(--accent-ink); font-size: var(--fs-2xs); font-weight: 650; display: inline-grid; place-items: center; }
.dd__btn[aria-expanded="true"] .dd__chev { transform: rotate(180deg); }
.dd__panel {
  position: absolute; top: calc(100% + 6px); inset-inline-start: 0; z-index: 40; width: min(340px, calc(100vw - 32px));
  max-height: min(70vh, 520px); display: flex; flex-direction: column;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-l); box-shadow: var(--shadow-pop);
}
.dd__panel[hidden] { display: none; }
.dd__body { overflow: auto; padding: 6px; display: grid; gap: 1px; }
.dd__head { padding: 8px 8px 2px; }
.dd__search { width: 100%; height: 34px; }
.dd__opt[hidden] { display: none; }
.dd__foot { border-top: 1px solid var(--line); padding: 6px; display: flex; justify-content: flex-end; }
.dd__row { display: flex; align-items: center; gap: 2px; }
.dd__row .dd__opt { flex: 1; min-width: 0; }
.dd__opt { display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: var(--r-s); cursor: pointer; font-size: var(--fs-s); }
.dd__opt:hover { background: var(--surface-2); }
.dd__opt input { margin: 0; width: 16px; height: 16px; accent-color: var(--accent); flex: none; }
.dd__opt svg { width: 17px; height: 17px; color: var(--ink-2); flex: none; }
.dd__opt-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dd__opt-label--one { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.dd__n { color: var(--ink-3); font-size: var(--fs-xs); font-variant-numeric: tabular-nums; white-space: nowrap; }
.dd__expand { width: 32px; height: 32px; border: 0; border-radius: var(--r-s); background: transparent; color: var(--ink-2); cursor: pointer; display: grid; place-items: center; flex: none; }
.dd__expand:hover { background: var(--surface-3); }
.dd__expand svg { width: 16px; height: 16px; transition: transform .15s var(--ease); }
.dd__expand.is-open svg { transform: rotate(180deg); }
.dd__sub { margin-inline-start: 22px; padding-inline-start: 8px; border-inline-start: 2px solid var(--line); display: grid; gap: 4px; margin-block: 2px 6px; }
.dd__group { display: grid; gap: 1px; }
.dd__group-title { font-size: var(--fs-2xs); font-weight: 650; color: var(--ink-3); padding: 6px 8px 2px; }
.dd__empty { font-size: var(--fs-s); color: var(--ink-3); padding: 8px; }

/* ================= added files ================= */
.imports-row { display: grid; gap: 8px; }
.imports-group + .imports-group { margin-top: 18px; }
/* «گزارشات ادمین» (components/admin-reports.js) */
.alert-dot { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: #d92d20; color: #fff; font-size: 11px; font-weight: 800; line-height: 1; }
.alert-dot[hidden] { display: none; }
.hdr-settings { position: relative; }
.hdr-settings .alert-dot { position: absolute; top: -6px; inset-inline-end: -6px; box-shadow: 0 0 0 2px var(--header-bg, #12324f); }
.drawer__action .alert-dot { margin-inline-start: auto; }
.ar-dlg .dlg__body { overflow: auto; }
.ar-banner { display: grid; gap: 6px; margin: 10px 20px 0; }
.ar-banner[hidden] { display: none; }
.ar-banner__item { display: flex; align-items: flex-start; gap: 8px; padding: 10px 12px; border-radius: var(--r-m); font-size: var(--fs-s); font-weight: 600; }
.ar-banner__item svg { flex: none; width: 18px; height: 18px; margin-top: 1px; }
.ar-banner__item.is-error { background: var(--cond-poor-soft); color: var(--cond-poor-text); border: 1px solid var(--cond-poor); }
.ar-banner__item.is-warn { background: var(--cond-fair-soft); color: var(--cond-fair-text); border: 1px solid var(--cond-fair); }
.ar-tabs { display: flex; gap: 4px; padding: 10px 20px 0; border-bottom: 1px solid var(--line); }
.ar-tab { all: unset; display: inline-flex; align-items: center; gap: 6px; padding: 8px 14px; border-radius: 8px 8px 0 0; cursor: pointer; font-weight: 700; color: var(--ink-3); border-bottom: 3px solid transparent; }
.ar-tab svg { width: 16px; height: 16px; }
.ar-tab[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.ar-filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.ar-filters .input { height: 34px; flex: 0 1 190px; }
.ar-filters input[type="search"] { flex: 1 1 220px; }
.ar-list { display: grid; border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.ar-entry + .ar-entry { border-top: 1px solid var(--line); }
.ar-row { all: unset; box-sizing: border-box; width: 100%; display: grid; grid-template-columns: 150px 110px 170px 140px minmax(0, 1fr) 20px; gap: 10px; align-items: center; padding: 8px 12px; font-size: var(--fs-xs); cursor: pointer; }
.ar-row.is-plain { cursor: default; }
.ar-row:hover { background: var(--surface-2); }
.ar-row__when { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.ar-row__user { font-weight: 700; }
.ar-row__action { justify-self: start; padding: 2px 8px; border-radius: 999px; background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); font-weight: 700; }
.ar-row__action.is-danger { background: var(--cond-poor-soft); color: var(--cond-poor-text); }
.ar-row__action.is-auth { background: var(--surface-3); color: var(--ink-2); }
.ar-row__id { font-family: ui-monospace, Menlo, Consolas, monospace; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ar-row__summary { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.ar-row__caret svg { width: 14px; height: 14px; color: var(--ink-3); transition: rotate .15s; }
.ar-row[aria-expanded="true"] .ar-row__caret svg { rotate: 180deg; }
.ar-detail { padding: 4px 12px 12px; background: var(--surface-2); }
.ar-detail[hidden] { display: none; }
.ar-diff { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); background: var(--surface); }
.ar-diff th, .ar-diff td { padding: 5px 8px; border: 1px solid var(--line); text-align: start; vertical-align: top; overflow-wrap: anywhere; }
.ar-diff thead th { background: var(--surface-3); }
.ar-diff tbody th { width: 26%; font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 600; color: var(--ink-2); }
.ar-diff tr.is-changed td { background: color-mix(in srgb, #f2c037 22%, var(--surface)); font-weight: 700; }
.ar-diff tr[hidden] { display: none; }
.ar-link { all: unset; margin-top: 6px; display: inline-block; color: var(--accent); cursor: pointer; font-size: var(--fs-xs); text-decoration: underline; }
.ar-more { display: flex; justify-content: center; margin-top: 10px; }
.ar-more .btn[hidden] { display: none; }
.ar-health-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; color: var(--ink-3); font-size: var(--fs-xs); }
.ar-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; }
.ar-card { border: 1px solid var(--line); border-radius: var(--r-m); padding: 12px 14px; display: grid; gap: 10px; align-content: start; border-top: 4px solid var(--cond-good); }
.ar-card.is-warn { border-top-color: var(--cond-fair); }
.ar-card.is-error { border-top-color: var(--cond-poor); }
.ar-card h3 { display: flex; align-items: center; gap: 8px; margin: 0; font-size: var(--fs-m); }
.ar-card h3 > svg { width: 18px; height: 18px; color: var(--accent); }
.ar-card h3 span { flex: 1; }
.ar-pill { padding: 2px 10px; border-radius: 999px; font-size: var(--fs-xs); background: var(--cond-good-soft); color: var(--cond-good-text); }
.ar-pill.is-warn { background: var(--cond-fair-soft); color: var(--cond-fair-text); }
.ar-pill.is-error { background: var(--cond-poor-soft); color: var(--cond-poor-text); }
.ar-kv { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 14px; margin: 0; font-size: var(--fs-xs); }
.ar-kv div { display: grid; gap: 1px; }
.ar-kv dt { color: var(--ink-3); }
.ar-kv dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.ar-warn { margin: 0; padding: 8px 10px; border-radius: 6px; background: var(--cond-poor-soft); color: var(--cond-poor-text); font-size: var(--fs-xs); font-weight: 600; }
.ar-disk { display: grid; gap: 4px; font-size: var(--fs-xs); }
.ar-disk__head { display: flex; flex-wrap: wrap; gap: 4px 10px; }
.ar-disk__head span:last-child { margin-inline-start: auto; color: var(--ink-3); }
.ar-bar { height: 10px; border-radius: 5px; background: var(--surface-3); overflow: hidden; }
.ar-bar__fill { display: block; height: 100%; background: var(--cond-good); }
.ar-bar__fill.is-warn { background: var(--cond-fair); }
.ar-bar__fill.is-error { background: var(--cond-poor); }
.ar-table { width: 100%; border-collapse: collapse; font-size: var(--fs-xs); }
.ar-table th, .ar-table td { padding: 5px 6px; border-bottom: 1px solid var(--line); text-align: start; }
.ar-table th { color: var(--ink-3); font-weight: 600; }
@media (max-width: 760px) {
  .ar-row { grid-template-columns: 1fr auto; }
  .ar-row__id, .ar-row__summary, .ar-row__user { grid-column: 1 / -1; }
}
/* «تنظیمات فیلترها» (components/filters-dialog.js) */
.fs-dlg { width: min(860px, calc(100vw - 24px)); }
.fs-types { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.fs-type { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); color: var(--ink-2); font: inherit; font-size: var(--fs-s); cursor: pointer; }
.fs-type svg { width: 16px; height: 16px; }
.fs-type[aria-selected="true"] { background: var(--accent); border-color: var(--accent); color: #fff; }
.fs-toggles { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 12px; }
.fs-check { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-s); cursor: pointer; }
.fs-groups { display: grid; gap: 12px; }
.fs-group { border: 1px solid var(--line); border-radius: var(--r-m); overflow: hidden; }
.fs-group__head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 8px 10px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.fs-group__order { display: flex; }
.fs-group__order .icon-btn { width: 26px; height: 26px; }
.fs-group__order .is-up svg { rotate: 180deg; }
.fs-label { flex: 1 1 180px; height: 32px; font-weight: 700; }
.fs-group__n { font-size: var(--fs-xs); color: var(--ink-3); }
.fs-del { color: var(--danger); }
.fs-values { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); max-height: 260px; overflow: auto; }
.fs-value { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto minmax(110px, 40%); align-items: center; gap: 8px; padding: 4px 10px; border-bottom: 1px solid var(--line); font-size: var(--fs-xs); }
.fs-value__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fs-value__n { color: var(--ink-3); font-variant-numeric: tabular-nums; }
.fs-value.is-hidden .fs-value__name { color: var(--ink-3); text-decoration: line-through; }
.fs-rename { height: 28px; font-size: var(--fs-xs); }
.fs-add { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; padding: 12px; border: 1px dashed var(--line-strong); border-radius: var(--r-m); }
.fs-add__select { flex: 1 1 260px; height: 34px; }
.fs-add .import__note { flex-basis: 100%; margin: 0; }
.fs-mode { margin-inline-end: auto; font-size: var(--fs-xs); color: var(--ink-3); }
.fs-mode.is-dirty { color: var(--ink); font-weight: 700; }

/* «جدول توصیفی»: a file's attribute table edited like a spreadsheet (components/attr-table.js) */
.dlg--sheet { width: min(1500px, calc(100vw - 24px)); height: calc(100vh - 32px); max-height: none; }
.dlg--sheet .dlg__head p { max-width: 980px; }
.at-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.at-search { flex: 1 1 220px; max-width: 320px; height: 32px; }
.at-sep { width: 1px; height: 22px; background: var(--line); margin-inline: 2px; }
.at-count { margin-inline-start: auto; font-size: var(--fs-xs); color: var(--ink-3); }
.at-problems { margin: 10px 20px 0; max-height: 140px; overflow: auto; font-size: var(--fs-xs); }
.at-problems ul { margin: 6px 0 0; padding-inline-start: 18px; }
.at-link { background: none; border: 0; padding: 0; color: inherit; font: inherit; font-weight: 700; text-decoration: underline; cursor: pointer; }
.at-wrap { flex: 1 1 auto; min-height: 0; padding: 0 !important; overflow: hidden; display: flex; }
.at-scroll { position: relative; flex: 1; overflow: auto; outline: none; font-size: var(--fs-xs); background: var(--surface); }
.at-scroll:focus-visible { box-shadow: inset 0 0 0 2px var(--focus); }
.at-head { position: sticky; top: 0; z-index: 3; display: grid; grid-template-columns: var(--at-cols); width: var(--at-width); height: 46px; background: var(--at-head-bg); border-bottom: 1px solid var(--line-strong); }
.at-spacer { width: var(--at-width); }
.at-body { position: absolute; top: 46px; inset-inline-start: 0; width: var(--at-width); }
.at-row { position: absolute; inset-inline-start: 0; display: grid; grid-template-columns: var(--at-cols); width: var(--at-width); height: 32px; }
.at-th, .at-td { min-width: 0; border-inline-end: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 0 8px; }
.at-th { display: flex; flex-direction: column; justify-content: center; gap: 3px; height: 46px; box-sizing: border-box; overflow: hidden; font-size: var(--fs-xs); font-weight: 700; line-height: 18px; color: var(--ink); position: relative; padding-inline-end: 24px; }
.at-th__top { display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; }
.at-th__label { overflow: hidden; text-overflow: ellipsis; }
.at-th__tags { display: flex; gap: 4px; min-width: 0; min-height: 15px; overflow: hidden; white-space: nowrap; }   /* kept when empty: every name on one line */
.at-th--num .at-th__top { justify-content: center; }
.at-th.is-dirty { background: color-mix(in srgb, var(--accent) 14%, var(--at-head-bg)); }
.at-th__name { all: unset; flex: 1 1 auto; min-width: 0; cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-th__sort { font-size: 9px; margin-inline-start: 4px; color: var(--accent); }
.at-th__menu { all: unset; position: absolute; inset-inline-end: 3px; top: 50%; translate: 0 -50%; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 4px; cursor: pointer; color: var(--ink-3); }
.at-th__menu:hover { background: var(--line); color: var(--ink); }
.at-th__menu svg { width: 14px; height: 14px; }
.at-tag { flex: none; font-size: 10px; font-weight: 600; line-height: 1.3; padding: 0 5px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 16%, transparent); color: var(--accent); }
.at-tag--pos { background: color-mix(in srgb, var(--cond-good) 18%, transparent); color: var(--cond-good-text); }
.at-td { display: flex; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; background: var(--surface); cursor: cell; user-select: none; }
.at-td.is-computed, .at-th.is-computed { background: color-mix(in srgb, var(--accent) 6%, var(--surface)) !important; color: var(--ink-2, var(--ink)); }
.at-td.is-num { justify-content: flex-end; font-variant-numeric: tabular-nums; }
.at-th--num, .at-td--num { position: sticky; inset-inline-start: 0; z-index: 2; justify-content: center; color: var(--ink-3); background: var(--at-head-bg); cursor: pointer; }
.at-th--id, .at-td--id { position: sticky; inset-inline-start: 56px; z-index: 2; color: var(--ink-2); background: var(--at-head-bg); cursor: default; }
.at-td--id { font-family: ui-monospace, Menlo, Consolas, monospace; }
.at-th--num, .at-th--id { z-index: 4; padding-inline-end: 8px; }
.at-row:nth-child(even) .at-td:not(.at-td--num):not(.at-td--id) { background: color-mix(in srgb, var(--line) 22%, var(--surface)); }
.at-td.is-dirty { background: color-mix(in srgb, #f2c037 26%, var(--surface)) !important; }
.at-td.is-in-range { background: color-mix(in srgb, var(--accent) 14%, var(--surface)) !important; }
.at-td.is-active { box-shadow: inset 0 0 0 2px var(--accent); }
.at-td.has-fill { position: relative; }
.at-fxbar { flex: none; display: flex; align-items: stretch; gap: 0; margin: 0 20px 8px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); }
.at-namebox { min-width: 92px; padding: 0 10px; display: flex; align-items: center; justify-content: center; font: 600 var(--fs-xs) ui-monospace, Menlo, Consolas, monospace; color: var(--ink-2); background: var(--surface-2); border-inline-end: 1px solid var(--line); }
.at-fxbar__fx { padding: 0 10px; display: flex; align-items: center; font-style: italic; font-weight: 700; color: var(--ink-3); border-inline-end: 1px solid var(--line); }
.at-fxbar__input { flex: 1; min-width: 0; border: 0; outline: none; padding: 7px 10px; font: inherit; font-size: var(--fs-sm); background: transparent; color: var(--ink); }
.at-fxbar__input:focus { box-shadow: inset 0 0 0 2px var(--accent); }
.at-fxbar__input.has-formula { font-family: ui-monospace, Menlo, Consolas, monospace; }
.at-fxbar__input[readonly] { color: var(--ink-3); }
.at-menu__keys { margin-inline-start: auto; font: 500 11px ui-monospace, Menlo, Consolas, monospace; color: var(--ink-3); }
.at-menu__sep { height: 1px; background: var(--line); margin: 4px 0; }
.at-menu__item[disabled] { opacity: .45; cursor: default; }
.at-menu.at-menu--cells { width: 230px; }
.at-clip { position: fixed; top: 0; inset-inline-start: -9999px; opacity: 0; }
.at-fill { position: absolute; bottom: 0; right: 0; width: 8px; height: 8px; background: var(--accent); border: 1px solid var(--surface); cursor: crosshair; z-index: 1; }
[dir="rtl"] .at-fill { right: auto; left: 0; }
.at-td.is-fill-target { outline: 1px dashed var(--accent); outline-offset: -2px; }
.at-th.is-in-range .at-th__letter { background: var(--accent); color: #fff; }
.at-th.is-whole { background: color-mix(in srgb, var(--accent) 12%, var(--at-head-bg, var(--surface))); }
.at-th__letter { cursor: pointer; }
.at-th--all { cursor: pointer; }
.at-td--num { cursor: pointer; }
.at-td--num.is-in-range { color: var(--accent); font-weight: 700; }
.at-row.is-new .at-td--id { color: var(--accent); font-family: inherit; font-weight: 700; }
.at-row.is-deleted .at-td { text-decoration: line-through; color: var(--ink-3); background: color-mix(in srgb, var(--cond-poor) 10%, var(--surface)) !important; }
.at-row.has-problem .at-td--num { background: var(--cond-poor-soft); color: var(--danger); font-weight: 700; }
.at-editor { position: absolute; z-index: 5; box-sizing: border-box; margin: 0; padding: 0 7px; border: 2px solid var(--accent); border-radius: 0; font: inherit; font-size: var(--fs-xs); background: var(--surface); color: var(--ink); outline: none; box-shadow: 0 4px 14px rgba(0, 0, 0, .18); }
.at-menu { position: absolute; z-index: 10; min-width: 190px; padding: 4px; border: 1px solid var(--line); border-radius: var(--r-m); background: var(--surface); box-shadow: 0 10px 28px rgba(0, 0, 0, .18); display: grid; }
.at-menu__item { all: unset; display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 6px; cursor: pointer; font-size: var(--fs-s); }
.at-menu__item:hover { background: var(--line); }
.at-menu__item svg { width: 15px; height: 15px; }
.at-menu__item.is-flip svg { rotate: 180deg; }
.at-menu__item.is-danger { color: var(--danger); }
.at-status { margin-inline-end: auto; font-size: var(--fs-xs); color: var(--ink-3); }
.at-status.is-dirty { color: var(--ink); font-weight: 700; }
.at-fx { font-size: var(--fs-xs); font-weight: 700; color: var(--accent); padding: 4px 10px; border-radius: 6px; background: color-mix(in srgb, var(--accent) 10%, transparent); max-width: 50%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.at-fx.is-error { color: var(--danger, #c0392b); background: color-mix(in srgb, var(--danger, #c0392b) 10%, transparent); }
.at-th__letter { flex: none; font-size: 10px; font-weight: 700; color: var(--ink-3); background: var(--surface-2, rgba(127,127,127,.12)); border-radius: 4px; padding: 0 5px; line-height: 16px; }
.dlg--sheet { --at-head-bg: color-mix(in srgb, var(--line) 45%, var(--surface)); }
/* the asset page's source record, edited */
.attrs__bar { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.attrs__row--edit { grid-template-columns: minmax(90px, 34%) minmax(0, 1fr) 30px; align-items: center; }
.attrs__row--edit .input { height: 30px; font-size: var(--fs-xs); }
.imports-group__head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-size: var(--fs-m); font-weight: 700; }
.imports-group__head svg { width: 18px; height: 18px; color: var(--accent); }
.imports-row .type-row__actions { padding-inline-start: 40px; }
.imports-row .badge svg { width: 12px; height: 12px; vertical-align: -1px; }

/* figures under the map: the total, then one per asset type */
.stat--total { padding-inline-end: 20px; border-inline-end: 1px solid var(--line); }
.stat--total dd { font-size: var(--fs-xl); }
.stat--type dt { display: inline-flex; align-items: center; gap: 5px; }
.stat--type dt svg { width: 15px; height: 15px; color: var(--ink-3); flex: none; }


/* a heading between groups of fields in a form */
.form-heading { padding-top: 12px; border-top: 1px solid var(--line); }
.form-heading h3 { font-size: var(--fs-s); font-weight: 650; color: var(--ink); }
.form-heading p { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 2px; }

/* ---- admin settings: a panel sliding in from the side its button is on (the left in Persian, the right in English) ---- */
.drawer {
  position: fixed; inset-block: 0; inset-inline: auto 0; margin: 0; width: min(340px, calc(100vw - 48px)); height: 100dvh; max-height: none;
  padding: 0; border: 0; border-inline: 1px solid var(--line); background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-pop); overflow: auto;
}
.drawer[open] { display: flex; flex-direction: column; animation: drawer-in .2s var(--ease); }
.drawer::backdrop { background: rgba(8, 14, 18, .45); }
@keyframes drawer-in { from { transform: translateX(-100%); } }
@keyframes drawer-in-ltr { from { transform: translateX(100%); } }
[dir="ltr"] .drawer[open] { animation-name: drawer-in-ltr; }
.drawer__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.drawer__head h2 { display: inline-flex; align-items: center; gap: 9px; font-size: var(--fs-l); font-weight: 650; }
.drawer__head h2 svg { width: 20px; height: 20px; color: var(--ink-2); }
.drawer__body { display: grid; gap: 4px; padding: 8px 0 18px; }
.drawer__section { display: grid; gap: 10px; padding: 14px 18px; }
.drawer__section + .drawer__section { border-top: 1px solid var(--line); }
.drawer__section h3 { font-size: var(--fs-xs); font-weight: 600; color: var(--ink-3); }
.drawer__seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border: 1px solid var(--line-strong);
  border-radius: var(--r-m); background: var(--surface-2); }
.drawer__opt { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 36px; border: 0; border-radius: calc(var(--r-m) - 2px);
  background: transparent; color: var(--ink-2); font: inherit; font-size: var(--fs-s); font-weight: 550; cursor: pointer; }
.drawer__opt svg { width: 16px; height: 16px; }
.drawer__opt:hover { color: var(--ink); }
.drawer__opt[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(10, 20, 28, .18); }
.drawer__action { display: flex; align-items: center; gap: 10px; width: 100%; height: 44px; padding-inline: 12px; border: 1px solid var(--line);
  border-radius: var(--r-m); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fs-s); font-weight: 550;
  cursor: pointer; text-align: start; }
.drawer__action svg { width: 18px; height: 18px; color: var(--ink-2); }
.drawer__action:hover { background: var(--surface-2); }
@media (prefers-reduced-motion: reduce) { .drawer[open] { animation: none; } }

/* ---- road-marking codes: settings rows (code | name | colour | delete, always one line), colour swatches ---- */
.mk-rows { display: grid; gap: 8px; }
.mk-row { display: grid; grid-template-columns: 56px 70px minmax(0, 1fr) 46px 36px; gap: 8px; align-items: center; }
.mk-order { display: flex; gap: 2px; }
.mk-move { width: 27px; height: 30px; }
.mk-rows > .mk-row:first-child .mk-move:first-child, .mk-rows > .mk-row:last-child .mk-move:last-child { visibility: hidden; }
.icon-up { transform: rotate(180deg); }
.mk-row--head { font-size: var(--fs-xs); color: var(--ink-3); }
.mk-row .input { height: 38px; min-width: 0; }
.mk-code { text-align: center; }
.mk-code.is-bad { border-color: var(--danger); }
.mk-color { width: 46px; height: 38px; padding: 3px; border: 1px solid var(--line-strong); border-radius: var(--r-m); background: var(--surface-2); cursor: pointer; }
.mk-swatch { display: inline-block; width: 14px; height: 8px; border-radius: 2px; flex: none; }
@media (max-width: 640px) { .mk-row { grid-template-columns: 50px 52px minmax(0, 1fr) 42px 34px; gap: 6px; } .mk-move { width: 24px; } }

/* ---- login page (the owner's design): photo on one side, logo + form on the other ---- */
.login {
  --login-brand: #173f35; --login-brand-2: #00845d; --login-text: #123b43; --login-muted: #738195;
  --login-border: #d6dee6; --login-field: #fafbfc; --login-side: #ffffff;
  display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(380px, .9fr); height: 100dvh; overflow: hidden;
  color: var(--login-text); background: var(--login-side);
}
:root[data-theme="dark"] .login {
  --login-brand: #7fd3b0; --login-text: #e6eef0; --login-muted: #93a3b5; --login-border: #34414b; --login-field: #1b2329; --login-side: #12181c;
}
.login__hero { background: #173f35 url("../assets/login/tehran-highway.jpg") top center / cover no-repeat; }
.login__side { display: flex; align-items: center; justify-content: center; padding: 20px 40px; overflow-y: auto; background: var(--login-side); }
.login__card { width: 100%; max-width: 400px; }
.login__logo { display: block; width: 90px; height: 90px; margin: 0 auto 20px; object-fit: contain; border-radius: 8px; }
.login__card h2 { margin: 0 0 5px; text-align: center; font-size: 24px; font-weight: 800; color: var(--login-brand); }
.login__subtitle { margin: 0 0 20px; text-align: center; font-size: 14px; color: var(--login-muted); }
.login__form { display: grid; gap: 14px; }
.login__field label { display: block; margin-bottom: 6px; font-size: 13px; font-weight: 500; color: var(--login-muted); }
.login__wrap { position: relative; }
.login__icon { position: absolute; top: 50%; inset-inline-start: 16px; width: 18px; height: 18px; translate: 0 -50%; color: #5a7184; pointer-events: none; }
.login__input {
  width: 100%; min-height: 52px; padding-inline: 45px 15px; border: 1px solid var(--login-border); border-radius: 8px;
  font: inherit; font-size: 14px; color: var(--login-text); background: var(--login-field); transition: border-color .2s, box-shadow .2s, background-color .2s;
}
.login__input::placeholder { color: #9aa8b6; }
.login__input:focus { border-color: #315d3e; background: var(--login-side); outline: none; box-shadow: 0 0 0 3px rgba(49, 93, 62, .15); }
.login__submit {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; min-height: 52px; margin-top: 6px;
  border: 0; border-radius: 8px; color: #fff; background: linear-gradient(110deg, #173f35, var(--login-brand-2));
  font: inherit; font-size: 16px; font-weight: 700; cursor: pointer; transition: transform .1s ease, filter .2s ease;
}
.login__submit:hover { filter: brightness(1.08); }
.login__submit:active { transform: translateY(2px); }
.login__submit:disabled { opacity: .7; cursor: progress; }
@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; height: auto; min-height: 100dvh; overflow: visible; }
  .login__hero { min-height: 35vh; }
  .login__side { min-height: 65vh; padding: 30px 20px; }
}

/* ---- report printed to PDF: only the report is printed, the site is hidden meanwhile ---- */
#print-root { display: none; }
@media print {
  /* The margins are part of the page itself, so whatever the print dialog's «Margins» says (Default, None ...) the
     PDF keeps them: 15 mm at the sides, and a 16 mm band at the top and bottom of every page (print.js wraps the page
     in a table whose header and footer rows repeat on each page). */
  @page { size: A4 landscape; margin: 0; }
  html.is-printing #print-root { padding: 0 15mm; }
  .print-page { width: 100%; border-collapse: collapse; }
  .print-page > thead { display: table-header-group; }
  .print-page > tfoot { display: table-footer-group; }
  .print-page > * > tr > td { padding: 0; border: 0; }
  .print-gap { height: 16mm; }
  html.is-printing body > *:not(#print-root) { display: none !important; }
  html.is-printing #print-root { display: block; color: #000; background: #fff; font-family: var(--font); }
  /* never wider than the paper, whatever its size or orientation: a page too narrow for a table or a long line would
     otherwise push it out on the left of a right-to-left page */
  html.is-printing, html.is-printing body { background: #fff !important; width: auto !important; min-width: 0 !important; overflow: visible !important; }
  html.is-printing #print-root { width: 100%; max-width: 100%; box-sizing: border-box; overflow-wrap: break-word; }
  .print-about dd, .print-head__org, .print-head__system { min-width: 0; }
  html.is-printing #print-root[lang="fa"] { font-family: "B Nazanin", var(--font); font-size: 11pt; }
  /* the letterhead: logo, organisation, system, a navy rule */
  .print-head { display: flex; align-items: center; gap: 5mm; padding-bottom: 3mm; margin-bottom: 4mm; border-bottom: 0.8mm solid #1f4e79; }
  .print-head__logo { width: 17mm; height: 17mm; object-fit: contain; flex: none; }
  .print-head__names { flex: 1; text-align: center; }
  .print-head__org { font-size: 16pt; font-weight: 800; color: #1f4e79; }
  .print-head__system { font-size: 10pt; color: #4a5868; margin-top: 1mm; }
  .print-head__logo + .print-head__names { margin-inline-end: 22mm; }   /* keep the names centred on the page */
  #print-root .print-title { font-size: 14pt; font-weight: 800; margin: 0 0 2mm; color: #1f4e79; text-align: center; }
  .print-about { display: flex; flex-wrap: wrap; justify-content: center; gap: 1mm 8mm; margin: 0 0 4mm; font-size: 8.5pt; }
  .print-about div { display: flex; gap: 1.5mm; }
  .print-about dt { color: #555; }
  .print-table { width: 100%; max-width: 100%; border-collapse: collapse; font-size: 8pt; }
  .print-table th, .print-table td { overflow-wrap: break-word; }   /* whole words; a token longer than its column breaks */
  #print-root .print-table--wide { font-size: 8pt; }
  #print-root[lang="fa"] .print-table { font-size: 10pt; }
  .print-table th { background: #1f4e79; color: #fff; font-weight: 700; text-align: center; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-table tbody tr:nth-child(even) td { background: #f2f6fb; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .print-table tr.is-total td { background: #dce6f1; font-weight: 800; border-top: 0.6mm solid #1f4e79; }
  /* the printed map (map/print-map.js): the map's copied layers in a frame, a legend beside it, then the asset list */
  #print-root, #print-root * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .pm-body { display: flex; flex-wrap: wrap; gap: 5mm; align-items: flex-start; }
  .pm-frame { position: relative; flex: none; max-width: 100%; overflow: hidden; direction: ltr; border: 0.4mm solid #1f4e79; background: #fff; }
  #print-root .pm-geo { position: absolute; top: 0; left: 0; background: #fff; }
  .pm-frame { contain: paint; }        /* nothing inside the frame reaches the page's width */
  .pm-north { position: absolute; top: 10px; right: 12px; z-index: 3; color: #1b2a36; }
  .pm-north .geo-north { display: grid; }
  #print-root .pm-scale { position: absolute; bottom: 8px; left: 10px; z-index: 3; }
  /* a report's map keeps the scale bar on its frame (beside the map's layers, not in them): a light box, bottom left */
  #print-root .pm-frame > .pm-scale { inset: auto auto 8px 10px; background: rgba(255, 255, 255, .85); color: #1b2a36; padding: 2px 6px; border-radius: 4px; }
  #print-root .pm-frame > .pm-scale .geo-scale__bar { border-color: #1b2a36; }
  .pm-legend { flex: 1 1 62mm; min-width: 0; font-size: 8.5pt; }   /* beside the map, or under it on a narrow page */
  .pm-legend__table { table-layout: fixed; }
  .pm-legend__table td, .pm-legend__table th { overflow-wrap: break-word; }
  .pm-legend h3, .pm-list h3 { font-size: 11pt; font-weight: 800; color: #1f4e79; margin: 0 0 2mm; }
  .pm-legend__table { width: 100%; border-collapse: collapse; margin-bottom: 3mm; }
  .pm-legend__table th { background: #1f4e79; color: #fff; font-weight: 700; padding: 0.8mm 1.5mm; text-align: start; }
  .pm-legend__table td { border-bottom: 0.3pt solid #c9d3e0; padding: 0.6mm 1.5mm; vertical-align: middle; line-height: 1.35; }
  .pm-legend__table .pm-ic { width: 7mm; }
  .pm-legend__table .pm-n { width: 22mm; }
  .pm-legend__table .pm-ic svg { width: 5mm; height: 5mm; }
  .pm-legend__table .pm-n { white-space: nowrap; text-align: end; font-variant-numeric: tabular-nums; }
  .pm-line { display: inline-block; width: 6mm; height: 1.4mm; border-radius: 1mm; vertical-align: middle; }
  .pm-conds { display: flex; flex-wrap: wrap; gap: 1.5mm 4mm; align-items: center; margin-bottom: 2mm; }
  .pm-conds span { display: inline-flex; align-items: center; gap: 1.5mm; }
  .pm-note { color: #4a5868; font-size: 9pt; margin: 1mm 0; }
  /* the 0..100 scale and the heat map in the map PDF's legend; the heat layer over the tiles */
  .pm-grad { display: inline-block; width: 26mm; height: 2.2mm; border-radius: 1mm; }
  .pm-grad--score { background: linear-gradient(to left, hsl(0 72% 42%), hsl(60 72% 42%), hsl(120 72% 42%)); }
  .pm-grad--heat { background: linear-gradient(to left, #2b6cff, #00d0ff, #3ddc4a, #ffe23a, #ff8a1e, #e8141c); }
  [dir="ltr"] .pm-grad--score { background: linear-gradient(to right, hsl(0 72% 42%), hsl(60 72% 42%), hsl(120 72% 42%)); }
  [dir="ltr"] .pm-grad--heat { background: linear-gradient(to right, #2b6cff, #00d0ff, #3ddc4a, #ffe23a, #ff8a1e, #e8141c); }
  .pm-heat { margin-top: 2mm; padding-top: 2mm; border-top: 0.3pt solid #c9d3e0; }
  .pm-heat strong { color: #c2410c; }
  #print-root .pm-heat-layer { position: absolute; top: 0; left: 0; z-index: 1; pointer-events: none; }
  .pm-list { break-before: page; }
  .print-table--next { break-before: page; }       /* a report's table, after the map on page 1 */
  .print-sign { display: flex; justify-content: space-between; gap: 10mm; margin-top: 10mm; font-size: 11pt; break-inside: avoid; }
  .print-sign div { display: flex; gap: 2mm; align-items: baseline; }
  .print-sign b { min-width: 35mm; border-bottom: 0.3pt dotted #555; padding: 0 1mm; }
  .print-table th, .print-table td { border: 0.3pt solid #9aa5ad; padding: 1.2mm 1.6mm; vertical-align: top; }
  .print-table thead { display: table-header-group; }
  .print-table tr { break-inside: avoid; }
  .print-table td.k-num, .print-table td.k-money { white-space: nowrap; font-variant-numeric: tabular-nums; }
}
