/* oura-sync web UI — dark, app-adjacent, zero dependencies.
   Palette: bg #19191C, card #222428, text #F2F3F5, muted #9FA7B8,
   accent #6FCBFF, grid #32353B. Stage colors live in lib/model.js. */

:root {
  --bg: #19191c;
  --card: #222428;
  --raise: #2a2d33;
  --raise-2: #30333a;
  --text: #f2f3f5;
  --muted: #9fa7b8;
  --accent: #6fcbff;
  --accent-ink: #0c161b;
  --grid: #32353b;
  --line: #2e3138;
  --danger: #ffb4b4;
  --danger-bg: #3a2426;
  --danger-line: #5c3236;
  --warn: #ffd08a;
  --ok: #8be0b0;
  --deep: #24477b;
  --light: #448dc2;
  --rem: #6fcbff;
  --awake: #f2f3f5;
  --radius: 18px;
  --radius-sm: 12px;
  --tap: 44px;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scrollbar-color: #3d4148 transparent;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 520px at 12% -12%, #232833 0%, rgba(35, 40, 51, 0) 62%),
    var(--bg);
  color: var(--text);
  font-family: "Inter", "SF Pro Text", system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, p, dl, dd, figure {
  margin: 0;
}

button,
input {
  font: inherit;
  color: inherit;
}

[hidden] {
  display: none !important;
}

a {
  color: var(--accent);
}

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 8px;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 100;
  padding: 10px 14px;
  border-radius: 10px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 650;
  text-decoration: none;
  transition: top 0.15s ease;
}

.skip-link:focus {
  top: 12px;
}

/* ------------------------------------------------------------------ chrome */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(25, 25, 28, 0.84);
  border-bottom: 1px solid rgba(50, 53, 59, 0.7);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 13px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  letter-spacing: -0.01em;
  font-size: 16px;
}

.brand-mark {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  background: linear-gradient(145deg, var(--accent), #2f6c8f);
  box-shadow: 0 0 18px rgba(111, 203, 255, 0.25);
  position: relative;
  flex: 0 0 auto;
}

.brand-mark::after {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: #10222b;
}

.brand-name {
  font-variant: small-caps;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.label-short {
  display: none;
}

.topbar-meta {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  border: 1px solid rgba(111, 203, 255, 0.35);
  background: rgba(111, 203, 255, 0.08);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

/* ------------------------------------------------------------------ layout */

.view {
  max-width: 1180px;
  margin: 0 auto;
  padding: 26px 24px 10px;
}

.view.auth {
  max-width: 620px;
  padding: 24px 24px 10px;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card {
  padding: 26px;
}

.eyebrow {
  color: var(--accent);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1 {
  margin-top: 6px;
  font-size: clamp(26px, 3vw, 32px);
  line-height: 1.15;
  letter-spacing: -0.02em;
}

h2 {
  font-size: 19px;
  letter-spacing: -0.01em;
}

h3 {
  font-size: 16px;
  letter-spacing: -0.01em;
}

.lede {
  margin-top: 10px;
  color: var(--muted);
  font-size: 15px;
  max-width: 62ch;
}

.hint {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.55;
}

/* ------------------------------------------------------------------ forms */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 12px;
}

.field > .label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
}

.field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  border: 1px solid #3a3e46;
  background: #1b1d21;
  color: var(--text);
  font-size: 15px;
}

.field input::placeholder {
  color: #6c7484;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(111, 203, 255, 0.18);
}

.field input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.field small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.field-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 12px;
}

.form-error {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.notice {
  margin-top: 12px;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.55;
  border: 1px solid var(--grid);
  background: #1e2024;
  color: var(--muted);
}

.notice strong {
  color: var(--text);
}

.notice.warn {
  border-color: #55452c;
  background: rgba(255, 208, 138, 0.06);
}

.notice.warn strong {
  color: var(--warn);
}

.notice.ok {
  border-color: rgba(139, 224, 176, 0.35);
  background: rgba(139, 224, 176, 0.07);
  color: var(--ok);
}

.vault-meta {
  margin-top: 20px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
  display: grid;
  gap: 8px;
}

.vault-meta > div {
  display: flex;
  gap: 12px;
  justify-content: space-between;
  font-size: 13px;
}

.vault-meta dt {
  color: var(--muted);
}

.vault-meta dd {
  margin: 0;
  text-align: right;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.link-danger {
  margin-top: 22px;
  padding: 8px 0;
  min-height: var(--tap);
  background: none;
  border: 0;
  color: #d99a9a;
  font-size: 13px;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}

.link-danger:hover {
  color: var(--danger);
}

/* ----------------------------------------------------------------- buttons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 0 18px;
  border-radius: var(--radius-sm);
  border: 1px solid #3a3e46;
  background: var(--raise);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.06s ease;
  -webkit-tap-highlight-color: transparent;
}

.btn:hover {
  background: #31353c;
}

.btn:active {
  transform: translateY(1px);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.btn.primary:hover {
  background: #8ad7ff;
}

.btn.ghost {
  background: transparent;
  color: var(--muted);
}

.btn.ghost:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
}

.btn.danger {
  background: var(--danger-bg);
  border-color: var(--danger-line);
  color: var(--danger);
}

.btn.block {
  width: 100%;
  margin-top: 14px;
}

#form-unlock .btn.block {
  margin-top: 16px;
}

/* --------------------------------------------------------------- sync bar */

.syncbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 14px 12px 18px;
  margin-bottom: 18px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 13px;
  color: var(--muted);
  min-height: 24px;
}

.sync-status strong {
  color: var(--text);
  font-weight: 600;
}

.sync-status .live-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 10px rgba(139, 224, 176, 0.5);
  flex: 0 0 auto;
}

.sync-status .live-dot.off {
  background: #6c7484;
  box-shadow: none;
}

.sync-status .warn {
  color: var(--warn);
}

.sync-status .sync-error {
  color: var(--danger);
  overflow-wrap: anywhere;
}

.sync-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.sync-log {
  flex-basis: 100%;
  border-top: 1px solid var(--line);
  padding-top: 10px;
  margin-top: 2px;
}

.log {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 220px;
  overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
}

.log-note {
  margin-top: 6px;
}

.log li {
  padding: 4px 2px;
  border-bottom: 1px dashed rgba(50, 53, 59, 0.7);
  overflow-wrap: anywhere;
}

.log li:last-child {
  border-bottom: 0;
}

/* --------------------------------------------------------------- workspace */

.workspace {
  display: grid;
  grid-template-columns: minmax(290px, 380px) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.panel {
  padding: 18px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.count {
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.nights-panel {
  position: sticky;
  top: 78px;
  max-height: calc(100vh - 96px);
  overflow: auto;
}

.nights {
  display: flex;
  flex-direction: column;
  gap: 7px;
  margin-top: 12px;
}

.night {
  display: grid;
  grid-template-areas:
    "day score"
    "time score"
    "metrics metrics";
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1px 12px;
  width: 100%;
  min-height: 82px;
  padding: 11px 12px;
  border: 1px solid transparent;
  border-radius: 14px;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, border-color 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.night:hover {
  background: #272a30;
}

.night[aria-current="true"] {
  background: rgba(111, 203, 255, 0.08);
  border-color: rgba(111, 203, 255, 0.5);
}

.night .day {
  grid-area: day;
  font-weight: 650;
  font-size: 15px;
  letter-spacing: -0.01em;
}

.night .time {
  grid-area: time;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.night .score {
  grid-area: score;
  align-self: center;
  min-width: 44px;
  height: 44px;
  padding: 0 6px;
  display: grid;
  place-items: center;
  border: 1px solid #3a3e46;
  border-radius: 12px;
  background: #1d1f23;
  color: var(--accent);
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.night[aria-current="true"] .score {
  background: rgba(111, 203, 255, 0.1);
  border-color: rgba(111, 203, 255, 0.5);
}

.night .metrics {
  grid-area: metrics;
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  gap: 2px 12px;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.night .metrics span {
  white-space: nowrap;
}

.empty {
  margin-top: 14px;
  padding: 14px;
  border: 1px dashed var(--grid);
  border-radius: 14px;
  color: var(--muted);
  font-size: 13px;
}

.empty p + p {
  margin-top: 8px;
}

.empty strong {
  color: var(--text);
}

.detail-column {
  min-width: 0;
  display: grid;
  gap: 18px;
}

.detail-placeholder {
  padding: 26px 22px;
  color: var(--muted);
  font-size: 14px;
}

.detail-placeholder p + p {
  margin-top: 8px;
}

/* ----------------------------------------------------------------- detail */

.detail-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.detail-heading {
  min-width: 0;
}

.detail-sub {
  margin-top: 5px;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 2px 12px;
  color: var(--muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.detail-sub span {
  white-space: nowrap;
}

.score-ring {
  position: relative;
  width: 72px;
  height: 72px;
  flex: 0 0 auto;
}

.score-ring svg {
  position: absolute;
  inset: 0;
  display: block;
}

.score-ring .score-num {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.banner {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--grid);
  background: #1e2024;
  font-size: 13px;
  color: var(--muted);
}

.banner strong {
  color: var(--text);
}

.banner.info {
  border-color: rgba(111, 203, 255, 0.3);
  background: rgba(111, 203, 255, 0.06);
}

.banner.error {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
}

/* ----------------------------------------------------------------- charts */

.hypnogram {
  margin-top: 14px;
}

.chart-frame {
  background: #1b1d21;
  border: 1px solid #30333a;
  border-radius: 14px;
  padding: 7px 7px 3px;
  overflow: hidden;
}

.chart-host {
  width: 100%;
  min-height: 120px;
}

.chart-host svg {
  display: block;
  width: 100%;
  height: auto;
  overflow: visible;
}

.chart-host text {
  font-family: inherit;
  fill: var(--muted);
  user-select: none;
}

.chart-svg .lane-label {
  font-size: 10.5px;
  letter-spacing: 0.02em;
}

.chart-svg .axis-label {
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
}

.chart-svg .bar-cap {
  pointer-events: none;
}

.chart-svg .no-data {
  font-size: 12px;
}

.chart-svg .handle {
  cursor: ew-resize;
  touch-action: none;
}

.chart-svg .handle .hit {
  fill: transparent;
}

.chart-svg .handle .guide {
  stroke: var(--accent);
  stroke-width: 2;
  pointer-events: none;
}

.chart-svg .handle .grip {
  fill: var(--accent);
  pointer-events: none;
}

.chart-svg .handle .grip-line {
  stroke: #0c161b;
  stroke-width: 1.4;
  opacity: 0.55;
  pointer-events: none;
}

.chart-svg .handle:focus {
  outline: none;
}

.chart-svg .handle:focus-visible .grip {
  fill: #ffffff;
  stroke: var(--accent);
  stroke-width: 2;
}

.chart-svg .handle:focus-visible .guide {
  stroke: #ffffff;
  stroke-width: 3;
}

.chart-svg .handle:focus-visible .grip-line {
  opacity: 0.9;
}

.trim-frame .chart-svg {
  touch-action: none;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin: 10px 2px 0;
  color: var(--muted);
  font-size: 12px;
}

.legend .item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}

.legend .dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
  background: var(--muted);
}

.legend .dot.stage-deep {
  background: var(--deep);
}

.legend .dot.stage-light {
  background: var(--light);
}

.legend .dot.stage-rem {
  background: var(--rem);
}

.legend .dot.stage-awake {
  background: var(--awake);
}

/* ---------------------------------------------------------------- metrics */

.metrics {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 9px;
}

.metric {
  grid-column: span 3;
  background: #1d1f23;
  border: 1px solid #2e3138;
  border-radius: 12px;
  padding: 10px 12px;
}

.metric:nth-child(n + 5) {
  grid-column: span 4;
}

.metric .label {
  display: block;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric .value {
  display: block;
  margin-top: 3px;
  font-size: 17px;
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.metric .sub {
  display: block;
  color: var(--muted);
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
}

.detail-extra {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  color: var(--muted);
  font-size: 12.5px;
  font-variant-numeric: tabular-nums;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--grid);
  background: #1e2024;
  color: var(--muted);
  font-size: 11.5px;
}

.note {
  margin: 0;
  padding: 10px 12px;
  border-left: 2px solid var(--accent);
  background: rgba(111, 203, 255, 0.04);
  border-radius: 0 10px 10px 0;
  color: #d6dae2;
  font-size: 13px;
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------- trim */

.trim {
  margin-top: 22px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.trim .hint {
  margin-top: 6px;
  max-width: 78ch;
}

.trim .chart-frame {
  margin-top: 10px;
}

.trim-readout {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.trim-range {
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

.trim-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 6px;
}

.trim-stat {
  padding: 7px 10px;
  border-radius: 10px;
  border: 1px solid #2e3138;
  background: #1d1f23;
  font-size: 12px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

.trim-stat b {
  display: block;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 650;
}

.trim-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.trim-actions .btn {
  min-width: 150px;
}

/* ---------------------------------------------------------------- devices */

.devices-panel {
  margin-top: 18px;
}

.devices-panel .hint {
  margin-top: 4px;
  max-width: 82ch;
}

.devices {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.device {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 11px 12px;
  border: 1px solid #2e3138;
  border-radius: 12px;
  background: #1d1f23;
}

.device .info {
  min-width: 0;
  flex: 1 1 220px;
}

.device .name {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  font-weight: 600;
  font-size: 14px;
}

.device .meta {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.device .meta span + span::before {
  content: "·";
  margin: 0 6px;
  color: #5c6474;
}

.device .actions {
  margin-left: auto;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  border: 1px solid var(--grid);
  color: var(--muted);
  background: #26282d;
}

.badge.current {
  border-color: rgba(111, 203, 255, 0.35);
  background: rgba(111, 203, 255, 0.08);
  color: var(--accent);
}

.badge.revoked {
  border-color: var(--danger-line);
  background: var(--danger-bg);
  color: var(--danger);
}

.device.revoked .name {
  color: var(--muted);
}

/* ----------------------------------------------------------------- footer */

.security {
  margin-top: 34px;
  border-top: 1px solid var(--line);
  background: #151619;
}

.security-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 20px 24px 30px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 4px 14px;
  align-items: start;
}

.security-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  border: 1px solid rgba(111, 203, 255, 0.35);
  background: rgba(111, 203, 255, 0.08);
  color: var(--accent);
  position: relative;
  margin-top: 2px;
}

.security-icon::before {
  content: "";
  position: absolute;
  left: 10px;
  top: 14px;
  width: 12px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 3px;
}

.security-icon::after {
  content: "";
  position: absolute;
  left: 13px;
  top: 8px;
  width: 6px;
  height: 8px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 5px 5px 0 0;
}

.security p {
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.6;
  max-width: 96ch;
}

.security p:last-child {
  margin-bottom: 0;
}

.security strong {
  color: var(--text);
}

/* ----------------------------------------------------------------- dialog */

.confirm {
  width: min(460px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid #3a3e46;
  border-radius: var(--radius);
  background: var(--card);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
}

.confirm::backdrop {
  background: rgba(10, 11, 13, 0.72);
  backdrop-filter: blur(2px);
}

.confirm h2 {
  font-size: 19px;
}

.confirm p {
  margin-top: 8px;
  color: var(--muted);
  font-size: 14px;
}

.dialog-actions {
  margin-top: 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 60;
  max-width: calc(100vw - 32px);
  padding: 11px 16px;
  border-radius: 12px;
  border: 1px solid rgba(111, 203, 255, 0.35);
  background: #2a2f36;
  color: var(--text);
  font-size: 13.5px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
}

.toast.error {
  border-color: var(--danger-line);
  background: #352226;
  color: #ffd7d7;
}

.toast.show {
  animation: toast-in 0.18s ease-out;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 6px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.noscript {
  margin: 20px auto;
  max-width: 620px;
  padding: 12px 16px;
  border: 1px solid var(--danger-line);
  border-radius: 12px;
  background: var(--danger-bg);
  color: var(--danger);
}

/* -------------------------------------------------------------- responsive */

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr);
  }

  .nights-panel {
    position: static;
    max-height: none;
    overflow: visible;
  }
}

@media (max-width: 520px) {
  .label-full {
    display: none;
  }

  .label-short {
    display: inline;
  }
}

@media (max-width: 640px) {
  .topbar-inner,
  .view,
  .security-inner {
    padding-left: 16px;
    padding-right: 16px;
  }

  .view.auth {
    padding-top: 24px;
  }

  .auth-card {
    padding: 22px;
  }

  .field-pair {
    grid-template-columns: 1fr;
  }

  .syncbar {
    align-items: stretch;
  }

  .sync-status {
    flex-basis: 100%;
  }

  .sync-actions {
    margin-left: 0;
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr 1fr;
  }

  .sync-actions .btn {
    padding: 0 8px;
  }

  .panel {
    padding: 15px;
  }

  .detail-head {
    gap: 10px;
  }

  .score-ring {
    width: 62px;
    height: 62px;
  }

  .score-ring .score-num {
    font-size: 18px;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .metric,
  .metric:nth-child(n + 5) {
    grid-column: auto;
  }

  .metric:last-child {
    grid-column: 1 / -1;
  }

  .trim-actions .btn {
    flex: 1 1 100%;
  }

  .trim-stat:last-child {
    grid-column: 1 / -1;
  }

  .security-inner {
    grid-template-columns: minmax(0, 1fr);
    padding-bottom: 26px;
  }

  .security-icon {
    display: none;
  }

  .night {
    min-height: 84px;
  }
}

@media (max-width: 380px) {
  .brand-name {
    font-size: 15px;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }

  .metric {
    padding: 9px 10px;
  }

  .metric .value {
    font-size: 16px;
  }

  .trim-stats {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}