/* Additions on top of the mockup stylesheet for the real UI (phase E1). */
.dir.none { color: var(--md-sys-color-on-surface-variant); font-weight: 400; }
.dir.none .icon { color: var(--md-sys-color-outline); }
.dist .n { background: var(--md-sys-color-surface-container-highest); }
.dest.disabled { opacity: .38; cursor: default; }

/* theme tabs as links (server-rendered, no JS needed) */
.theme-tabs { display: flex; gap: 8px; border-bottom: 1px solid var(--md-sys-color-outline-variant); margin: 8px 0 24px; overflow-x: auto; }
.theme-tab { display: inline-flex; align-items: center; gap: 8px; min-height: 48px; padding: 0 16px; color: var(--md-sys-color-on-surface-variant);
  text-decoration: none; border-bottom: 3px solid transparent; white-space: nowrap; }
.theme-tab:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 8%, transparent); }
.theme-tab:focus-visible { outline: 3px solid var(--md-sys-color-secondary); outline-offset: -3px; }
.theme-tab[aria-current="page"] { color: var(--md-sys-color-primary); border-bottom-color: var(--md-sys-color-primary); }

/* login */
/* login: white card (surface-container-lowest = white in light, darkest in dark theme) */
.login-card { background: var(--md-sys-color-surface-container-lowest);
  box-shadow: 0 1px 2px rgb(0 0 0 / .12), 0 2px 8px rgb(0 0 0 / .06); }
.login-card md-outlined-text-field { background: var(--md-sys-color-surface-container-lowest); border-radius: 4px; }
.login-card h1 { margin: 0; }
.login-card .step { margin: 0 0 4px; }
.login-card p.variant { margin-top: 8px; }
.form-error { display: flex; gap: 8px; align-items: flex-start; margin: 16px 0 0; padding: 12px 16px; border-radius: var(--shape-sm);
  background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.alt-link { text-align: center; margin: 16px 0 0; }
.alt-link a, .login-card a { color: var(--md-sys-color-primary); }
.enrol-steps { padding-left: 20px; margin: 16px 0 0; display: grid; gap: 12px; }
.qr { margin: 12px 0 4px; width: max-content; padding: 8px; border-radius: var(--shape-md); background: #fff; }
.qr img { display: block; width: 200px; height: 200px; image-rendering: pixelated; }
.secret { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 4px; }
.secret code, .recovery code { font: 500 16px/24px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .5px; }
details summary { cursor: pointer; color: var(--md-sys-color-primary); min-height: 32px; display: flex; align-items: center; }
.recovery { list-style: none; padding: 16px; margin: 16px 0; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px 24px;
  border-radius: var(--shape-md); background: var(--md-sys-color-surface-container-high); }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.banner { display: flex; gap: 8px; align-items: center; padding: 12px 16px; border-radius: var(--shape-md);
  background: var(--app-color-warn-container); color: var(--app-color-on-warn-container); }
.summary { display: grid; gap: 16px; margin: 0; padding: 8px 16px 20px; }
.card > p.variant { margin: 0; padding: 0 16px 20px; }
.summary dt { margin-bottom: 4px; }
.summary dd { margin: 0; color: var(--md-sys-color-on-surface-variant); }
.summary ul { margin: 0; padding-left: 20px; }

@media print {
  .rail, .topbar, .row-actions, form, .brand { display: none !important; }
  .login-page, .login-card { background: #fff; color: #000; }
}

/* Light theme: neutral surfaces instead of the seed-tinted (slightly pinkish) M3 greys.
   Content area and cards pure white, frame/lanes neutral cool grey. Dark theme unchanged. */
@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --md-sys-color-background: #ffffff; --md-sys-color-surface: #ffffff; --md-sys-color-surface-bright: #ffffff;
    --md-sys-color-surface-container-lowest: #ffffff; --md-sys-color-surface-container-low: #ffffff;
    --md-sys-color-surface-container: #f2f4f7; --md-sys-color-surface-container-high: #eaedf1;
    --md-sys-color-surface-container-highest: #e3e7ec; --md-sys-color-surface-dim: #dde1e6;
    --md-sys-color-outline-variant: #dde2e8;
    --app-lane: #f5f7f9;
  }
}
:root[data-theme="light"] {
  --md-sys-color-background: #ffffff; --md-sys-color-surface: #ffffff; --md-sys-color-surface-bright: #ffffff;
  --md-sys-color-surface-container-lowest: #ffffff; --md-sys-color-surface-container-low: #ffffff;
  --md-sys-color-surface-container: #f2f4f7; --md-sys-color-surface-container-high: #eaedf1;
  --md-sys-color-surface-container-highest: #e3e7ec; --md-sys-color-surface-dim: #dde1e6;
  --md-sys-color-outline-variant: #dde2e8;
  --app-lane: #f5f7f9;
}
/* white cards on a white content area need an edge; lanes get a soft grey so white company cards stand out */
.card { border: 1px solid var(--md-sys-color-outline-variant); }
.lane { background: var(--app-lane, var(--md-sys-color-surface-container-low)); }
.co { border: 1px solid var(--md-sys-color-outline-variant); }
.login-card { border: 1px solid var(--md-sys-color-outline-variant); }

/* market card */
.rec-dist { padding: 4px 16px 16px; display: grid; gap: 8px; }
.dist.tall { height: 8px; }
.dist .u2, .swatch.u2 { background: color-mix(in srgb, var(--app-color-up) 70%, black); }
.dist .u, .swatch.u { background: var(--app-color-up); }
.dist .f, .swatch.f { background: var(--md-sys-color-outline); }
.dist .d, .swatch.d { background: var(--app-color-down); }
.dist .d2, .swatch.d2 { background: color-mix(in srgb, var(--app-color-down) 70%, black); }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 4px; vertical-align: -1px; }
.rat-head { margin: 0; padding: 8px 16px 0; color: var(--md-sys-color-on-surface-variant); }
.icon.xs { font-size: 16px; vertical-align: -3px; }
.facts > div:nth-child(4n+1) { border-left: 0; }
.facts > div:nth-child(n+5) { border-top: 1px solid var(--md-sys-color-outline-variant); }
@media (max-width: 760px) { .facts > div:nth-child(odd) { border-left: 0; } .facts > div:nth-child(even) { border-left: 1px solid var(--md-sys-color-outline-variant); } }

/* E2 */
.flash { display: flex; gap: 8px; align-items: center; margin: 0 16px 12px; padding: 10px 14px; border-radius: var(--shape-sm); }
.flash.ok { background: color-mix(in srgb, var(--app-color-up) 12%, var(--md-sys-color-surface)); color: var(--md-sys-color-on-surface); }
.flash.err { background: var(--md-sys-color-error-container); color: var(--md-sys-color-on-error-container); }
.stack > .flash { margin: 0; }
.notes-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.notes-3 > section + section { border-left: 1px solid var(--md-sys-color-outline-variant); }
@media (max-width: 960px) { .notes-3 { grid-template-columns: minmax(0, 1fr); } .notes-3 > section + section { border-left: 0; border-top: 1px solid var(--md-sys-color-outline-variant); } }
.avatar.hermes { background: var(--app-color-warn-container); color: var(--app-color-on-warn-container); }
.note-body p { margin: 4px 0; } .note-body ul, .note-body ol { margin: 4px 0; padding-left: 20px; }
.note-del { margin: 4px 0 -8px -12px; }
.composer { padding: 16px; border-top: 1px solid var(--md-sys-color-outline-variant); display: grid; gap: 12px; }
.composer h3 { margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.toolbar .grow, .src-form .grow { flex: 1 1 240px; }
.filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 0 0 16px; }
.src-form { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; padding: 8px 16px 16px; }
.src-form .wide { flex: 1 1 100%; }
.src-list { list-style: none; margin: 0; padding: 0 0 8px; }
.src-list li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid var(--md-sys-color-outline-variant); }
.src-list p { margin: 2px 0; } .src-list .url { word-break: break-all; }
.sub-row td { padding-top: 0; border-top: 0; }
.plain { list-style: none; margin: 0; padding: 0 16px 16px; display: grid; gap: 6px; }
.doc-text-wrap { max-height: 70vh; overflow: auto; margin: 0 16px 16px; border: 1px solid var(--md-sys-color-outline-variant); border-radius: var(--shape-sm); }
.doc-text { margin: 0; padding: 12px 16px; font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; white-space: pre; tab-size: 2; }
.report-list { list-style: none; margin: 0; padding: 0; }
.report-list li + li { border-top: 1px solid var(--md-sys-color-outline-variant); }
.report-list a { display: grid; grid-template-columns: auto auto minmax(0, 1fr); gap: 12px; align-items: center; padding: 14px 16px; color: inherit; text-decoration: none; }
.report-list a:hover { background: color-mix(in srgb, var(--md-sys-color-on-surface) 6%, transparent); }
.report-list a:focus-visible { outline: 3px solid var(--md-sys-color-secondary); outline-offset: -3px; }
.report-list .preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 760px) { .report-list a { grid-template-columns: auto minmax(0, 1fr); } .report-list .preview { grid-column: 1 / -1; } }
.prose { padding: 24px 32px; max-width: 860px; }
.prose h2 { font: 400 28px/36px var(--md-ref-typeface-brand); margin: 0 0 12px; }
.prose h3 { font: 500 20px/28px var(--md-ref-typeface-brand); margin: 24px 0 8px; }
.prose h4 { font: 500 16px/24px var(--md-ref-typeface-plain); margin: 16px 0 4px; }
.prose p, .prose li { margin: 6px 0; } .prose ul, .prose ol { padding-left: 24px; }
.prose hr { border: 0; border-top: 1px solid var(--md-sys-color-outline-variant); margin: 20px 0; }
@media (max-width: 760px) { .prose { padding: 16px; } }
