/* Private dashboard. One hue for magnitude (bars, heat map), text in text
   tokens, light and dark themes each with their own steps. */
@font-face { font-family: "Inter"; src: url("../fonts/inter.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

.dash {
  color-scheme: light;
  --bg: #f6f6f4; --surface-1: #fcfcfb; --line: #e2e1dc; --text-primary: #0b0b0b; --text-secondary: #52514e;
  --series-1: #2a78d6; --track: #ecebe7; --danger: #b3261e; --ok-bg: #e5f2e8; --ok-ink: #1d5a38;
}
@media (prefers-color-scheme: dark) {
  .dash {
    color-scheme: dark;
    --bg: #121211; --surface-1: #1a1a19; --line: #2c2c2a; --text-primary: #f0efec; --text-secondary: #c3c2b7;
    --series-1: #3987e5; --track: #262624; --danger: #ff8a80; --ok-bg: #1d2e22; --ok-ink: #9fd3b6;
  }
}
*, *::before, *::after { box-sizing: border-box; }
body.dash { margin: 0; background: var(--bg); color: var(--text-primary); font: 400 15px/1.5 "Inter", system-ui, sans-serif; overflow-x: hidden; }
a { color: inherit; }
code { font-size: .9em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.dwrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }
.dmuted { color: var(--text-secondary); }
.small { font-size: .86rem; }
.dtop { background: var(--surface-1); border-bottom: 1px solid var(--line); }
.dtop-inner { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 18px; min-height: 56px; padding-top: 8px; padding-bottom: 8px; }
.dbrand { font-weight: 800; text-decoration: none; letter-spacing: -.01em; }
.dnav { display: flex; gap: 4px; flex-wrap: wrap; order: 3; width: 100%; }
.dnav a { text-decoration: none; padding: 6px 10px; border-radius: 8px; color: var(--text-secondary); font-weight: 600; }
.dnav a[aria-current="page"] { background: var(--track); color: var(--text-primary); }
.dlogout { margin-left: auto; }
.dlink { background: none; border: 0; padding: 0; font: inherit; color: var(--series-1); font-weight: 600; cursor: pointer; text-decoration: none; }
.dmain { padding-top: 20px; padding-bottom: 60px; }
.dh1 { font-size: 1.6rem; margin: 0 0 .3rem; letter-spacing: -.02em; }
.dh2 { font-size: 1.12rem; margin: 0 0 .4rem; }
.dh3 { font-size: .95rem; margin: 1.2rem 0 .6rem; }
.dpage-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; }
.dpage-head p { margin: 0; }
.dactions { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.dcard { background: var(--surface-1); border: 1px solid var(--line); border-radius: 14px; padding: 18px; margin-bottom: 16px; min-width: 0; }
.dcard-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.site-grid { display: grid; gap: 16px; margin-top: 16px; }
.two { display: grid; gap: 4px 28px; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 18px; }
.tiles-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.tile { background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.tile p { margin: 0; }
.tile-label { font-size: .8rem; color: var(--text-secondary); font-weight: 600; }
.tile-value { font-size: 1.55rem; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile-sub { font-size: .76rem; color: var(--text-secondary); }

.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "label value" "track track"; align-items: center; gap: 4px 10px; padding: 2px 0; border-radius: 6px; }
.bar-label { grid-area: label; }
.bar-track { grid-area: track; }
.bar-value { grid-area: value; }
.bar-row:hover { background: var(--track); }
.bar-label { font-size: .88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 12px; background: var(--track); border-radius: 0 4px 4px 0; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--series-1); border-radius: 0 4px 4px 0; min-width: 0; }
.bar-value { font-size: .86rem; font-variant-numeric: tabular-nums; text-align: right; white-space: nowrap; }
.funnel .bar-label { font-weight: 600; }
.empty { color: var(--text-secondary); font-size: .9rem; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; margin: 8px 0; }
.dtable { width: 100%; border-collapse: collapse; font-size: .88rem; }
.dtable td.num, .bar-value, .heat td { font-variant-numeric: tabular-nums; }
.dtable th, .dtable td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; white-space: nowrap; }
.dtable th { font-size: .78rem; color: var(--text-secondary); font-weight: 600; white-space: normal; min-width: 5.5rem; }
.dtable .num { text-align: right; }
.dtable-compact { max-width: 640px; }
.heat { border-collapse: separate; border-spacing: 2px; font-size: .82rem; width: 100%; table-layout: fixed; }
.heat th:first-child { width: 3.2rem; }
.heat th:last-child { width: 2.6rem; }
.heat th { font-weight: 600; color: var(--text-secondary); padding: 2px 6px; text-align: right; }
.heat thead th { text-align: center; }
.heat td { height: 26px; text-align: center; border-radius: 4px; background: color-mix(in srgb, var(--series-1) calc(var(--k) * 100%), var(--track)); color: var(--text-primary); }
.heat td.zero { background: var(--track); }
.heat td.num { background: none; text-align: right; color: var(--text-secondary); }

.dbtn { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--series-1); background: var(--series-1); color: #fff; font: inherit; font-weight: 600; text-decoration: none; cursor: pointer; }
.dbtn-ghost { background: transparent; color: var(--text-primary); border-color: var(--line); }
.dbtn-danger { background: transparent; color: var(--danger); border-color: var(--line); }
.dbtn-sm { min-height: 32px; padding: 0 10px; font-size: .85rem; }
.dspin { display: none; width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: dspin .8s linear infinite; }
.is-loading .dspin, .dsearch.is-loading .dspin-input { display: inline-block; }
.is-loading { opacity: .75; cursor: progress; }
@keyframes dspin { to { transform: rotate(360deg); } }

.dsearch { position: relative; max-width: 560px; margin-bottom: 12px; }
.dsearch input { width: 100%; min-height: 44px; padding: 0 40px 0 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-1); color: var(--text-primary); font: inherit; font-size: 16px; }
.dspin-input { position: absolute; right: 42px; top: 15px; color: var(--text-secondary); }
.dflash { background: var(--ok-bg); color: var(--ok-ink); padding: 10px 14px; border-radius: 10px; font-weight: 600; }
.rlist { display: grid; gap: 8px; }
.ritem { display: grid; gap: 8px; background: var(--surface-1); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.ritem p { margin: 0 0 2px; overflow-wrap: anywhere; }
.ritem-side { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.ritem-side form { margin: 0; }
.ritem-more summary { cursor: pointer; color: var(--series-1); font-weight: 600; font-size: .86rem; margin-top: 4px; }
.ritem-more dl { margin: 6px 0 0; display: grid; gap: 4px; font-size: .86rem; }
.ritem-more dl div { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; border-bottom: 1px dashed var(--line); padding-bottom: 3px; }
.ritem-more dt { color: var(--text-secondary); }
.ritem-more dd { margin: 0; font-weight: 600; text-align: right; }
.tag { display: inline-block; font-size: .72rem; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--track); color: var(--text-secondary); text-transform: uppercase; letter-spacing: .05em; }
.dpager { display: flex; align-items: center; gap: 12px; margin-top: 14px; }

.dlogin { display: grid; place-items: center; min-height: 100svh; padding: 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface-1); border: 1px solid var(--line); border-radius: 16px; padding: 26px; }
.login-card h1 { margin: 0 0 .3rem; font-size: 1.4rem; }
.login-card label { display: block; font-weight: 600; margin: 18px 0 6px; }
.login-card input { width: 100%; min-height: 46px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg); color: var(--text-primary); padding: 0 12px; font: inherit; font-size: 16px; }
.login-card .dbtn { margin-top: 14px; width: 100%; justify-content: center; min-height: 46px; }
.derror { color: var(--danger); font-weight: 600; margin: 8px 0 0; }

/* Wide tables become one card per row on a phone. */
@media (max-width: 719px) {
  .dtable-cards thead { display: none; }
  .dtable-cards, .dtable-cards tbody, .dtable-cards tr, .dtable-cards td { display: block; width: 100%; }
  .dtable-cards tr { border: 1px solid var(--line); border-radius: 10px; padding: 6px 12px; margin-bottom: 8px; }
  .dtable-cards td { display: flex; justify-content: space-between; gap: 12px; border: 0; padding: 4px 0; white-space: normal; text-align: right; }
  .dtable-cards td::before { content: attr(data-label); color: var(--text-secondary); font-size: .8rem; text-align: left; }
  .dtable-cards td:first-child { display: block; text-align: left; font-size: 1rem; padding-bottom: 6px; }
  .dtable-cards td:first-child::before { content: none; }
  .dtable-cards td.num { text-align: right; }
  .table-scroll:has(.dtable-cards) { overflow: visible; }
}
@media (min-width: 720px) {
  .dwrap { padding: 0 24px; }
  .dnav { order: 0; width: auto; }
  .tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .two { grid-template-columns: 1fr 1fr; }
  .ritem { grid-template-columns: minmax(0, 1fr) auto; align-items: start; }
  .ritem-side { flex-direction: column; align-items: flex-end; }
  .bar-row { grid-template-columns: minmax(0, 13rem) minmax(0, 1fr) auto; grid-template-areas: "label track value"; gap: 10px; }
}
@media (min-width: 1000px) {
  .site-grid { grid-template-columns: 1fr 1fr; }
}
.cards-only { display: none; }
@media (max-width: 719px) {
  .cards-only { display: inline; }
}
