/* Midnightly adviser dashboard (pilot). Loaded after site.css and tools.css; uses their tokens. */
:root { --ok-ink: #1F6B49; --ok-bg: rgba(62, 154, 110, .13); --watch-ink: #7A5205; --watch-bg: rgba(212, 154, 42, .18); --over-ink: #9E3523; --over-bg: rgba(201, 96, 77, .14); }
@media (prefers-color-scheme: dark) {
  :root { --ok-ink: #8FD6B2; --ok-bg: rgba(62, 154, 110, .2); --watch-ink: #F2C97A; --watch-bg: rgba(212, 154, 42, .2); --over-ink: #F2A08F; --over-bg: rgba(201, 96, 77, .22); }
}

.dash-wrap { display: grid; gap: clamp(1.4rem, 3vw, 2rem); padding: clamp(32px, 5vw, 56px) 0 clamp(64px, 9vw, 120px); }
.dash-wrap h2 { font-size: clamp(1.3rem, 2.4vw, 1.6rem); letter-spacing: -.025em; }
.dash-wrap h3 { font-size: 1.05rem; margin: .4rem 0 0; }
.dash-wrap h4 { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .4rem .8rem; margin: 0; font-size: 1rem; line-height: 1.3; }
.dash-wrap code { font-size: .82em; }

/* Loader */
.dash-drop {
  position: relative; display: grid; gap: .35rem; justify-items: center; text-align: center; cursor: pointer;
  padding: clamp(1.4rem, 4vw, 2.2rem) 1rem; border-radius: 16px; background: var(--bg); border: 1.5px dashed var(--line);
  transition: border-color .15s, background .15s;
}
.dash-drop:hover, .dash-drop.is-over { border-color: var(--accent); background: var(--chip); }
.dash-drop:focus-within { outline: 3px solid #E2B861; outline-offset: 2px; }
.dash-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dash-drop-title { font-weight: 650; color: var(--ink); }
.dash-drop-title u { color: var(--accent); text-underline-offset: .2em; }
.dash-drop .hint { max-width: 46em; }
.dash-actions { display: flex; flex-wrap: wrap; gap: .6rem; }
.dash-actions .button[disabled] { opacity: .45; cursor: not-allowed; transform: none; box-shadow: inset 0 0 0 1.5px currentColor; }
#dash-sample { background: var(--accent-bg); color: var(--accent-ink); box-shadow: none; }
.dash-status { margin: 0; padding: 0; list-style: none; font-size: .9rem; color: var(--muted); display: grid; gap: .2rem; }
.dash-status:empty { display: none; }
.dash-status li:first-child { color: var(--ink); font-weight: 600; }

/* Summary */
#dash-results { display: grid; gap: clamp(1.4rem, 3vw, 2rem); }
.dash-summary { display: grid; gap: .9rem; }
.dash-bar { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 1rem 1.5rem; }
.dash-bar .small { margin-top: .2rem; }
.dash-period { display: flex; flex-wrap: wrap; gap: .8rem; flex: 0 1 auto; }
.dash-period .field:first-child { width: 300px; max-width: 100%; }
.dash-period .field:last-child { width: 130px; }
.dash-period select[disabled] { opacity: .5; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.dash-table, .dash-countries { width: 100%; border-collapse: collapse; font-size: .93rem; font-variant-numeric: tabular-nums; }
.dash-table { min-width: 760px; }
.dash-table th, .dash-table td, .dash-countries th, .dash-countries td { text-align: left; vertical-align: top; padding: .75rem .9rem; border-bottom: 1px solid var(--line); color: var(--muted); }
.dash-table tbody tr:last-child > *, .dash-countries tbody tr:last-child > * { border-bottom: 0; }
.dash-table thead th, .dash-countries thead th { color: var(--ink); font-weight: 600; font-size: .85rem; white-space: nowrap; background: var(--bg-2); }
.dash-table thead th button {
  font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; display: inline-flex; align-items: center; gap: .3rem;
}
.dash-table thead th button::after { content: "\2195"; opacity: .35; font-size: .85em; }
.dash-table th[aria-sort="ascending"] button::after { content: "\2191"; opacity: 1; color: var(--accent); }
.dash-table th[aria-sort="descending"] button::after { content: "\2193"; opacity: 1; color: var(--accent); }
.dash-table tbody th { color: var(--ink); font-weight: 600; min-width: 180px; }
.dash-table tbody tr.is-selected > * { background: var(--chip); }
.dash-table tbody tr.is-selected > th { box-shadow: inset 3px 0 0 var(--accent); }
.dash-open { font: inherit; font-weight: 600; color: var(--accent); background: none; border: 0; padding: 0; text-align: left; cursor: pointer; text-decoration: underline; text-underline-offset: .2em; text-decoration-thickness: 1px; }
.dash-open:hover { text-decoration-thickness: 2px; }
.sub { display: block; font-size: .8rem; color: var(--muted); }
.sub-inline { font-size: .8em; color: var(--muted); font-weight: 500; }
.flag-list { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.flag-list li { margin: 0; line-height: 1.35; }

.pill {
  display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .74rem; font-weight: 700; letter-spacing: .03em;
  line-height: 1.5; white-space: nowrap; vertical-align: .05em;
}
.pill.ok { color: var(--ok-ink); background: var(--ok-bg); }
.pill.watch { color: var(--watch-ink); background: var(--watch-bg); }
.pill.over { color: var(--over-ink); background: var(--over-bg); }

/* Detail */
.dash-detail-wrap { scroll-margin-top: 84px; }
#dash-detail { display: grid; gap: 1rem; }
.detail-head { display: flex; flex-wrap: wrap; align-items: flex-end; gap: .6rem 1rem; }
.detail-head .field { flex: 1 1 260px; }
.detail-head .small { flex: 1 1 200px; margin-bottom: .7rem; }
.detail-head .stay-remove { min-height: 46px; }
.dash-countries tbody th { color: var(--ink); font-weight: 600; }
.dash-countries td:not(:last-child) { white-space: nowrap; }
.rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: .8rem; }
.rule { display: grid; gap: .55rem; align-content: start; padding: 1rem 1.1rem; border-radius: 16px; background: var(--bg); box-shadow: inset 0 0 0 1px var(--line); }
.rule.watch { box-shadow: inset 0 0 0 1px var(--line), inset 4px 0 0 #D49A2A; }
.rule.over { box-shadow: inset 0 0 0 1px var(--line), inset 4px 0 0 #C9604D; }
.rule.ok { box-shadow: inset 0 0 0 1px var(--line), inset 4px 0 0 #3E9A6E; }
.rule p { margin: 0; font-size: .92rem; color: var(--muted); }
.rule p strong { color: var(--ink); }
.rule .big { font-family: var(--font-display); font-size: 2rem; line-height: 1.1; letter-spacing: -.03em; color: var(--ink); font-variant-numeric: tabular-nums; }
.rule .big span { display: block; font-family: var(--font); font-size: .84rem; letter-spacing: 0; color: var(--muted); margin-top: .2rem; }
.rule .small { font-size: .82rem; }

/* Notes + CTA */
.dash-notes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dash-notes > section { padding: 1.4rem 1.5rem; border-radius: var(--radius); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.dash-notes h2 { font-size: 1.2rem; margin: 0 0 .7rem; }
.dash-notes p { color: var(--muted); font-size: .95rem; }
.dash-notes p:last-child { margin-bottom: 0; }
.disclaimer-note { padding: .8rem 1rem; border-radius: 12px; background: var(--chip); }
.dash-wrap .tool-cta { margin: 0; }
.dash-wrap .tool-cta p { margin: 0 0 .8rem; }
.dash-wrap .tool-cta .cta-note { margin: 0; }
.code-pill { font-family: var(--mono); font-size: .92em; letter-spacing: .04em; color: var(--gold); padding: .05em .45em; border-radius: 6px; background: rgba(240, 215, 161, .12); }

@media (max-width: 720px) {
  .dash-notes { grid-template-columns: 1fr; }
  .dash-period { width: 100%; flex-wrap: nowrap; }
  .dash-period .field:first-child { width: auto; flex: 1 1 auto; min-width: 0; }
  .dash-period .field:last-child { width: 110px; flex: none; }
}
/* Summary table becomes one card per client on narrow screens. */
@media (max-width: 720px) {
  .table-scroll:has(.dash-table) { overflow: visible; background: none; box-shadow: none; border-radius: 0; }
  .dash-table { min-width: 0; display: block; }
  .dash-table thead { display: block; }
  .dash-table thead tr { display: flex; flex-wrap: wrap; gap: .4rem; }
  .dash-table thead th { display: none; padding: 0; border: 0; background: none; }
  .dash-table thead th[data-sort] { display: block; }
  .dash-table thead th button { padding: .35rem .7rem; border-radius: 999px; box-shadow: inset 0 0 0 1px var(--line); background: var(--surface); font-size: .8rem; }
  .dash-table tbody { display: grid; gap: .7rem; margin-top: .8rem; }
  .dash-table tbody tr { display: grid; grid-template-columns: 1fr 1fr; border-radius: 16px; background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); overflow: hidden; }
  .dash-table tbody tr > * { border-bottom: 0; padding: .55rem 1rem; }
  .dash-table tbody th { grid-column: 1 / -1; min-width: 0; padding-top: .9rem; font-size: 1rem; }
  .dash-table tbody td[data-label="Top countries"], .dash-table tbody td[data-label="Flags"] { grid-column: 1 / -1; }
  .dash-table tbody td[data-label="Flags"] { padding-bottom: 1rem; }
  .dash-table tbody td::before { content: attr(data-label); display: block; font-size: .72rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); margin-bottom: .15rem; }
  .dash-table tbody tr.is-selected > th { box-shadow: none; }
  .dash-table tbody tr.is-selected { box-shadow: inset 0 0 0 1.5px var(--accent); }
}
@media (max-width: 560px) {
  .dash-actions .button { flex: 1 1 100%; }
  .rule .big { font-size: 1.7rem; }
  .dash-countries { font-size: .85rem; }
  .dash-countries th, .dash-countries td { padding: .6rem .5rem; }
  .dash-countries thead th { white-space: normal; }
  .dash-countries th:first-child, .dash-countries td:first-child { padding-left: .8rem; }
}
