/* ── Vazirmatn (self-hosted) ─────────────────────────────────────────────── */
@font-face {
  font-family: 'Vazirmatn';
  src: url('/public/fonts/Vazirmatn-RD[wght].woff2') format('woff2-variations');
  font-weight: 100 900;
  font-display: swap;
}

/* ── Reset ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Design tokens ───────────────────────────────────────────────────────── */
:root {
  --green:         #2d6a4f;
  --green-hover:   #245a41;
  --green-dot:     #40b07a;
  --red:           #c1121f;
  --red-hover:     #a50f1a;
  --red-dot:       #e63946;
  --bg:            #f4f2ed;
  --surface:       #ffffff;
  --border:        #ddd9d2;
  --text:          #1a1a1a;
  --text-muted:    #6b6b6b;
  --radius:        10px;
  --shadow:        0 1px 4px rgba(0,0,0,.08);
  --font:          'Vazirmatn', Tahoma, Arial, sans-serif;
}

/* ── Base ────────────────────────────────────────────────────────────────── */
html { font-size: 16px; }

body {
  font-family: var(--font);
  direction: rtl;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

/* ── App shell ───────────────────────────────────────────────────────────── */
.app {
  max-width: 720px;
  margin: 0 auto;
  padding: 1rem 1rem 3rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .25rem 0 .25rem;
  border-bottom: 2px solid var(--green);
}
.app-title {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--green);
  letter-spacing: .02em;
}
.logout-link {
  font-size: .85rem;
  color: var(--text-muted);
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: .25rem .6rem;
  transition: background .12s;
}
.logout-link:hover { background: var(--bg); }

/* ── Zones ───────────────────────────────────────────────────────────────── */
.zone {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .9rem;
}

/* ── Search zone ─────────────────────────────────────────────────────────── */
.search-input {
  width: 100%;
  padding: .65rem .85rem;
  font-family: var(--font);
  font-size: 1rem;
  direction: rtl;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.search-input:focus { border-color: var(--green); background: #fff; }
.search-input::placeholder { color: var(--text-muted); }

#search-results { margin-top: .5rem; }

.search-result {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .55rem .75rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s;
}
.search-result:hover { background: var(--bg); }

.dot {
  flex-shrink: 0;
  width: 10px;
  height: 10px;
  border-radius: 50%;
}
.dot-green { background: var(--green-dot); }
.dot-red   { background: var(--red-dot); }

.result-title { flex: 1; font-size: .95rem; }
.result-price { font-size: .85rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

/* ── Action zone (boxed panel, like the search box) ──────────────────────── */
.zone-actions { padding: .9rem; }
.action-buttons { display: flex; gap: .75rem; }

.btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .8rem 1rem;
  font-family: var(--font);
  font-size: 1rem;
  font-weight: 700;
  border: none;
  border-radius: var(--radius);
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: background .15s, transform .1s;
  user-select: none;
}
.btn:active { transform: scale(.97); }

.btn-icon { font-size: 1.4rem; line-height: 1; }

.btn-add  { background: var(--green); color: #fff; }
.btn-add:hover  { background: var(--green-hover); }

.btn-sell { background: var(--red); color: #fff; }
.btn-sell:hover { background: var(--red-hover); }

/* ── Inline panel (forms) ────────────────────────────────────────────────── */
#panel:not(:empty) {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1.5px solid var(--border);
  padding: 1rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .85rem;
}
.panel-title { font-size: 1.05rem; font-weight: 700; }
.panel-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  cursor: pointer;
  color: var(--text-muted);
  line-height: 1;
  padding: .1rem .3rem;
  border-radius: 4px;
}
.panel-close:hover { background: var(--bg); }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem;
}
.form-grid .full { grid-column: 1 / -1; }

.field { display: flex; flex-direction: column; gap: .25rem; }
.field label { font-size: .85rem; font-weight: 500; color: var(--text-muted); }

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: .55rem .7rem;
  font-family: var(--font);
  font-size: .95rem;
  direction: rtl;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color .15s;
}
.field input:focus,
.field select:focus,
.field textarea:focus { border-color: var(--green); background: #fff; }
.field textarea { resize: vertical; min-height: 72px; }

.form-actions { display: flex; gap: .5rem; margin-top: .75rem; }

.btn-submit {
  padding: .6rem 1.2rem;
  font-family: var(--font);
  font-size: .95rem;
  font-weight: 700;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: background .15s;
}
.btn-submit-green { background: var(--green); color: #fff; }
.btn-submit-green:hover { background: var(--green-hover); }
.btn-submit-red   { background: var(--red); color: #fff; }
.btn-submit-red:hover   { background: var(--red-hover); }

.btn-cancel {
  padding: .6rem 1rem;
  font-family: var(--font);
  font-size: .95rem;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: background .15s;
}
.btn-cancel:hover { background: var(--bg); }

/* ── Reports zone ────────────────────────────────────────────────────────── */
.zone-reports { padding: 1rem; }

.reports-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  border-bottom: 2px solid var(--green);
  padding-bottom: .3rem;
  margin-bottom: .85rem;
}

.report-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .65rem;
}

.report-card {
  background: var(--bg);
  border-radius: 8px;
  padding: .75rem .9rem;
  border: 1px solid var(--border);
}
.report-card-label { font-size: .8rem; color: var(--text-muted); margin-bottom: .2rem; }
.report-card-value { font-size: 1.1rem; font-weight: 700; }
.report-card-sub   { font-size: .8rem; color: var(--text-muted); margin-top: .1rem; }

/* ── Auth page ───────────────────────────────────────────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.auth-box {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 4px 16px rgba(0,0,0,.1);
  padding: 2rem;
  width: 100%;
  max-width: 360px;
}
.auth-title {
  text-align: center;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--green);
  margin-bottom: .4rem;
}
.auth-tagline {
  text-align: center;
  font-size: .95rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: .3rem;
}
.auth-subtitle {
  text-align: center;
  font-size: .82rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1.4rem;
}
.auth-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--red);
  border-radius: 6px;
  padding: .5rem .75rem;
  font-size: .9rem;
  margin-bottom: .75rem;
}

/* ── Utilities ───────────────────────────────────────────────────────────── */
.loading { text-align: center; color: var(--text-muted); padding: 1.5rem; }
.text-muted { color: var(--text-muted); font-size: .9rem; }
.empty-state { text-align: center; color: var(--text-muted); padding: 2rem 1rem; }

/* HTMX loading indicator */
.htmx-indicator { opacity: 0; transition: opacity .2s; }
.htmx-request .htmx-indicator,
.htmx-request.htmx-indicator { opacity: 1; }

/* ── Search results ──────────────────────────────────────────────────────── */
.search-result-list { display: flex; flex-direction: column; gap: 2px; }

.search-result {
  display: grid;
  grid-template-columns: 14px 1fr auto auto;
  align-items: center;
  gap: .5rem;
  padding: .5rem .6rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background .1s;
  user-select: none;
}
.search-result:hover { background: var(--bg); }

.result-title  { font-size: .95rem; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.result-price  { font-size: .82rem; color: var(--text-muted); white-space: nowrap; }
.result-status { font-size: .78rem; color: var(--text-muted); white-space: nowrap; }

/* ── Item detail ─────────────────────────────────────────────────────────── */
.detail-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: .45rem .9rem;
  font-size: .93rem;
}
.detail-grid dt {
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
  padding-top: .05rem;
}
.detail-grid dd { font-weight: 500; }

.sold-badge {
  display: inline-block;
  background: #fee2e2;
  color: var(--red);
  border-radius: 6px;
  padding: .35rem .75rem;
  font-size: .88rem;
  font-weight: 700;
}

/* ── Form helpers ────────────────────────────────────────────────────────── */
.req { color: var(--red); font-size: .8rem; }

.field-error {
  display: block;
  font-size: .82rem;
  color: var(--red);
  margin-top: .2rem;
}

.item-form { margin-top: .25rem; }

/* ── Rate banner ─────────────────────────────────────────────────────────── */
.rate-banner {
  padding: .4rem .65rem;
  background: var(--bg);
  border-radius: 6px;
  font-size: .88rem;
  border-right: 3px solid var(--green);
}
.rate-banner.rate-stale { border-right-color: #d97706; }

.rate-banner-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.rate-meta { display: flex; align-items: center; gap: .45rem; }
.rate-freshness { font-size: .78rem; color: var(--text-muted); }
.rate-stale .rate-freshness { color: #d97706; }

.rate-refresh-btn {
  padding: .15rem .5rem;
  font-family: var(--font);
  font-size: .75rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  transition: background .12s, color .12s;
  white-space: nowrap;
  line-height: 1.6;
}
.rate-refresh-btn:hover:not([disabled]) { background: #e8e5de; color: var(--text); }
.rate-refresh-btn[disabled] { opacity: .55; cursor: not-allowed; }

.rate-msg {
  font-size: .78rem;
  color: var(--text-muted);
  margin-top: .2rem;
}
.rate-msg-error { color: var(--red); }

/* ── Reports ─────────────────────────────────────────────────────────────── */
.report-period { margin-top: .9rem; }
.report-period + .report-period { margin-top: 1.1rem; }

.report-period-label {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-muted);
  border-right: 3px solid var(--green);
  padding-right: .5rem;
  margin-bottom: .5rem;
}

.report-note {
  font-size: .72rem;
  color: var(--text-muted);
  margin-top: .25rem;
  line-height: 1.4;
}

/* ── Report tabs / drill-down / chart ────────────────────────────────────── */
.report-tabs {
  display: flex;
  gap: .4rem;
  margin: .3rem 0 .2rem;
}
.report-tab {
  flex: 1;
  padding: .4rem .5rem;
  font-family: var(--font);
  font-size: .82rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all .12s;
}
.report-tab.active { background: var(--green); color: #fff; border-color: var(--green); font-weight: 700; }

.report-card-link { cursor: pointer; transition: border-color .12s, background .12s; position: relative; }
.report-card-link:hover { border-color: var(--green); background: #fff; }
.report-card-more { font-size: .72rem; color: var(--green); margin-top: .3rem; font-weight: 600; }

.chart-bars {
  display: flex;
  align-items: flex-end;
  gap: .4rem;
  height: 110px;
  padding-top: .4rem;
}
.chart-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: .25rem; height: 100%; }
.chart-bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; }
.chart-bar {
  width: 100%;
  background: linear-gradient(to top, var(--green), var(--green-dot));
  border-radius: 4px 4px 0 0;
  min-height: 2px;
  transition: height .3s;
}
.chart-label { font-size: .68rem; color: var(--text-muted); white-space: nowrap; }

.cat-breakdown {
  margin-top: .6rem;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.cat-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: .5rem;
  padding: .35rem .55rem;
  background: var(--bg);
  border-radius: 5px;
  font-size: .88rem;
}
.cat-name  { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-count { color: var(--text-muted); font-size: .82rem; white-space: nowrap; }
.cat-value { font-size: .82rem; white-space: nowrap; }

/* ── Sale form ───────────────────────────────────────────────────────────── */
.sale-item-info {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .5rem .6rem;
  background: var(--bg);
  border-radius: 6px;
  margin-bottom: .75rem;
  font-size: .9rem;
}
.sale-item-title { flex: 1; font-weight: 600; }
.sale-item-price { color: var(--text-muted); font-size: .85rem; white-space: nowrap; }

/* ── Profit display ──────────────────────────────────────────────────────── */
.profit-pos   { color: var(--green); font-weight: 700; }
.profit-neg   { color: var(--red);   font-weight: 700; }
.profit-label { font-weight: 600; }

/* ── Toast notification ──────────────────────────────────────────────────── */
#toast { position: fixed; bottom: 1.25rem; left: 50%; transform: translateX(-50%); z-index: 100; pointer-events: none; }

.toast {
  background: var(--green);
  color: #fff;
  font-size: .95rem;
  font-weight: 500;
  padding: .6rem 1.25rem;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  white-space: nowrap;
  animation: toastFade 2.5s ease forwards;
}

@keyframes toastFade {
  0%   { opacity: 0; transform: translateY(6px); }
  15%  { opacity: 1; transform: translateY(0); }
  75%  { opacity: 1; }
  100% { opacity: 0; }
}

/* ── Logout button + tagline ─────────────────────────────────────────────── */
.logout-btn {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  font-size: .82rem;
  font-weight: 600;
  color: var(--green);
  text-decoration: none;
  border: 1.5px solid var(--green);
  border-radius: 8px;
  padding: .32rem .7rem;
  background: #fff;
  transition: background .12s, color .12s;
  white-space: nowrap;
}
.logout-btn:hover { background: var(--green); color: #fff; }
.logout-icon { font-size: .95rem; line-height: 1; }

.tagline {
  text-align: center;
  color: var(--text-muted);
  font-size: .92rem;
  margin: -.25rem 0 .25rem;
}

.back-link {
  font-size: .85rem;
  color: var(--green);
  text-decoration: none;
  font-weight: 600;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  padding: .3rem .7rem;
  transition: background .12s;
}
.back-link:hover { background: var(--bg); }
.header-spacer { width: 4.5rem; }

/* ── Computed helper lines (buy total, USD-of-price, worth) ───────────────── */
.computed-total {
  font-size: .9rem;
  color: var(--text);
  min-height: 1.2em;
  margin-top: .1rem;
}
.hint { color: var(--text-muted); font-size: .82rem; font-weight: 400; }
.usd-inline, .usd-suffix { color: var(--green); font-weight: 600; }
.usd-suffix { font-size: .82rem; }
.worth-line {
  font-size: .85rem;
  color: var(--text);
  background: var(--bg);
  border-radius: 6px;
  padding: .45rem .6rem;
  margin-bottom: .7rem;
  border-right: 3px solid var(--green);
}

/* ── Summary card (main screen) ──────────────────────────────────────────── */
.summary-card {
  display: block;
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .9rem;
  text-decoration: none;
  color: var(--text);
  border: 1.5px solid var(--border);
  transition: border-color .12s, transform .08s;
}
.summary-card:hover { border-color: var(--green); }
.summary-card:active { transform: scale(.995); }

.summary-head {
  font-size: .82rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: .6rem;
}
.summary-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .5rem;
}
.summary-metric { display: flex; flex-direction: column; gap: .15rem; }
.summary-label { font-size: .74rem; color: var(--text-muted); }
.summary-value { font-size: 1rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.summary-more {
  display: block;
  text-align: left;
  margin-top: .6rem;
  font-size: .78rem;
  color: var(--green);
  font-weight: 600;
}
@media (max-width: 460px) {
  .summary-value { font-size: .88rem; }
  .summary-metrics { gap: .35rem; }
}

/* ── Title autocomplete ──────────────────────────────────────────────────── */
.suggest-box:not(:empty) { margin-top: 2px; }
.suggest-list {
  border: 1.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: var(--shadow);
}
.suggest-item {
  padding: .5rem .7rem;
  cursor: pointer;
  font-size: .9rem;
  border-bottom: 1px solid var(--border);
}
.suggest-item:last-child { border-bottom: none; }
.suggest-item:hover { background: var(--bg); }

/* ── Varied per-unit prices + mode pills ─────────────────────────────────── */
/* Stack the two options vertically — full-width, tappable rows, never clipped. */
.radio-row { display: flex; flex-direction: column; gap: .5rem; }
.radio-pill {
  display: flex;
  align-items: center;
  gap: .55rem;
  width: 100%;
  min-height: 44px;
  padding: .5rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: .9rem;
  line-height: 1.4;
  cursor: pointer;
  background: var(--bg);
}
.radio-pill input { flex-shrink: 0; width: 1.05rem; height: 1.05rem; }
.radio-pill:has(input:checked) { border-color: var(--green); background: #fff; font-weight: 600; }

.unit-prices { display: flex; flex-direction: column; gap: .4rem; }
.unit-price-field {
  display: grid;
  grid-template-columns: 5.5rem minmax(0, 1fr);
  align-items: center;
  gap: .5rem;
}
.unit-price-label { font-size: .82rem; color: var(--text-muted); white-space: nowrap; }
.unit-price-field input[type=text] {
  width: 100%;
  min-width: 0;
  padding: .5rem .7rem;
  font-family: var(--font);
  font-size: .95rem;
  direction: rtl;
  border: 1.5px solid var(--border);
  border-radius: 6px;
  background: var(--bg);
  outline: none;
}
.unit-price-field input:focus { border-color: var(--green); background: #fff; }

.group-badge {
  display: inline-block;
  background: var(--green);
  color: #fff;
  font-size: .7rem;
  font-weight: 700;
  border-radius: 10px;
  padding: .05rem .45rem;
  margin-right: .3rem;
}

/* ── Date field + Jalali calendar ────────────────────────────────────────── */
.date-field { position: relative; }
.date-input { cursor: pointer; background: var(--bg); }
.date-cal {
  position: absolute;
  left: .6rem;
  top: 50%;
  transform: translateY(-50%);
  font-size: .95rem;
  pointer-events: none;
  opacity: .7;
}
.datepicker-pop:not(:empty) { margin-top: .4rem; }

.dp {
  border: 1.5px solid var(--border);
  border-radius: 10px;
  background: #fff;
  padding: .5rem;
  box-shadow: var(--shadow);
}
.dp-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: .4rem;
}
.dp-title { font-weight: 700; font-size: .92rem; }
.dp-nav {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 1.9rem;
  height: 1.9rem;
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  color: var(--green);
}
.dp-nav:hover { background: #e8e5de; }
.dp-week, .dp-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.dp-week span {
  text-align: center;
  font-size: .72rem;
  color: var(--text-muted);
  padding: .2rem 0;
}
.dp-day {
  aspect-ratio: 1 / 1;
  border: none;
  background: var(--bg);
  border-radius: 6px;
  font-family: var(--font);
  font-size: .85rem;
  cursor: pointer;
  color: var(--text);
  transition: background .1s;
}
.dp-day:hover { background: var(--green); color: #fff; }
.dp-sel { background: var(--green); color: #fff; font-weight: 700; }
.dp-empty { aspect-ratio: 1 / 1; }
.dp-foot { text-align: left; margin-top: .35rem; }
.dp-close {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: .8rem; font-family: var(--font);
}

/* ── Nav card (warehouse link) ───────────────────────────────────────────── */
.nav-card {
  display: flex;
  align-items: center;
  gap: .7rem;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .8rem .9rem;
  text-decoration: none;
  color: var(--text);
  transition: border-color .12s;
}
.nav-card:hover { border-color: var(--green); }
.nav-card-icon { font-size: 1.4rem; }
.nav-card-text { display: flex; flex-direction: column; flex: 1; }
.nav-card-title { font-weight: 700; font-size: .95rem; }
.nav-card-sub { font-size: .78rem; color: var(--text-muted); }
.nav-card-arrow { color: var(--green); font-size: 1.1rem; }

/* ── Warehouse table ─────────────────────────────────────────────────────── */
.wh-filters {
  display: flex;
  gap: .5rem;
  margin-bottom: .8rem;
  flex-wrap: wrap;
}
.wh-filters select, .wh-filters input {
  flex: 1;
  min-width: 6rem;
  padding: .5rem .6rem;
  font-family: var(--font);
  font-size: .88rem;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  outline: none;
}
.wh-filters select:focus, .wh-filters input:focus { border-color: var(--green); background: #fff; }

.wh-table-wrap { overflow-x: auto; }
.wh-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.wh-table th {
  text-align: right;
  font-weight: 600;
  color: var(--text-muted);
  font-size: .78rem;
  padding: .45rem .5rem;
  border-bottom: 1.5px solid var(--border);
  white-space: nowrap;
}
.wh-table td {
  padding: .5rem .5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.wh-table tbody tr { cursor: pointer; transition: background .1s; }
.wh-table tbody tr:hover { background: var(--bg); }
.wh-title { font-weight: 600; }

/* ── Modal / pop-up dialog ───────────────────────────────────────────────── */
body.modal-open { overflow: hidden; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(20, 18, 14, .5);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 200;
  animation: backdropIn .15s ease;
}
@keyframes backdropIn { from { opacity: 0; } to { opacity: 1; } }

.modal {
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.28);
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 2rem);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalIn .16s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .8rem 1rem;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.modal-green .modal-header { border-top: 3px solid var(--green); }
.modal-red   .modal-header { border-top: 3px solid var(--red); }
.modal-title { font-size: 1.05rem; font-weight: 700; }
.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  color: var(--text-muted);
  padding: .15rem .4rem;
  border-radius: 6px;
}
.modal-close:hover { background: var(--bg); color: var(--text); }

.modal-body {
  padding: 1rem;
  overflow-y: auto;
}

@media (max-width: 480px) {
  .modal-backdrop { padding: 0; align-items: flex-end; }
  .modal {
    max-width: 100%;
    border-radius: 16px 16px 0 0;
    max-height: 92vh;
  }
  @keyframes modalIn {
    from { opacity: 0; transform: translateY(24px); }
    to   { opacity: 1; transform: translateY(0); }
  }
}
