/* Magic Extension board. Two inks only carry data: blue is the browser, amber is the editor. */
:root {
    color-scheme: dark;
    --tt-topnav-h: 64px;
    --ground: #131722;
    --rail: #0f131c;
    --panel: #1a1f2c;
    --raised: #252b3a;
    --line: #2b3243;
    --line-2: #434d65;
    --ink: #eef1f7;
    --ink-2: #b6bdcc;
    --ink-3: #98a1b4;
    --browse: #3c8ae2;
    --browse-ink: #8cc2ff;
    --code: #c98012;
    --code-ink: #f0b65c;
    --fill: #2f6fe0;
    --pos: #6fd3a0;
    --neg: #ff9f97;
    --danger: #ff8a80;
    --danger-fill: #b83a34;
    --warn: #f0b65c;
    --gap: clamp(12px, 1.3vw, 20px);
    --pad: clamp(16px, 2.2vw, 40px);
    --side-w: 224px;
    --display: 'Bricolage Grotesque', 'Inter', system-ui, sans-serif;
    --mono: ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { overflow-x: clip; scroll-padding-top: calc(var(--tt-topnav-h) + 96px); -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--ground); color: var(--ink); font: 400 15px/1.5 'Inter', system-ui, sans-serif; overflow-x: clip; }
a { color: var(--browse-ink); }
h1, h2, h3, h4, p, ul, ol, dl, dd { margin: 0; }
:focus-visible { outline: 2px solid var(--browse-ink); outline-offset: 2px; }
.me-main:focus, #me-title:focus, .gate-title:focus, .page-head h1:focus { outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.offscreen { position: fixed; left: -12000px; top: 0; width: 1px; height: 1px; overflow: hidden; }
.me-skip { position: absolute; left: 12px; top: -60px; z-index: 950; padding: 10px 14px; border-radius: 8px; background: var(--raised); color: var(--ink); }
.me-skip:focus { top: calc(var(--tt-topnav-h) + 8px); }

/* Shell */
.me-shell { display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; min-height: calc(100dvh - var(--tt-topnav-h)); }
.me-side { position: sticky; top: var(--tt-topnav-h); z-index: 30; background: var(--rail); border-bottom: 1px solid var(--line); }
.me-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); }
.me-nav a {
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 54px; padding: 6px 2px;
    color: var(--ink-2); text-decoration: none; font-weight: 600; font-size: 0.72rem; line-height: 1.1; text-align: center;
}
.me-nav a i { font-size: 0.95rem; color: var(--ink-3); }
.me-nav a.active { color: var(--ink); box-shadow: inset 0 -3px 0 var(--ink); }
.me-nav a.active i { color: var(--ink); }
.nav-long { display: none; }
.me-side-link { display: none; }
.me-main { min-width: 0; }
body[data-shell="off"] .me-side { display: none; }
body[data-shell="off"] .me-shell { grid-template-rows: 1fr; }

@media (min-width: 900px) {
    .me-shell { grid-template-columns: var(--side-w) minmax(0, 1fr); grid-template-rows: 1fr; }
    body[data-shell="off"] .me-shell { grid-template-columns: minmax(0, 1fr); }
    .me-side { height: calc(100dvh - var(--tt-topnav-h)); border-bottom: 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px; }
    .me-nav { display: flex; flex-direction: column; gap: 2px; }
    .me-nav a { flex-direction: row; justify-content: flex-start; gap: 12px; min-height: 44px; padding: 0 12px; border-radius: 8px; font-size: 0.95rem; text-align: left; }
    .me-nav a i { width: 18px; text-align: center; font-size: 1rem; }
    .me-nav a:hover { background: var(--panel); color: var(--ink); }
    .me-nav a.active { background: var(--raised); box-shadow: none; }
    .nav-long { display: inline; }
    .nav-short { display: none; }
    .me-side-link { display: flex; align-items: center; min-height: 44px; margin-top: auto; padding: 0 12px; color: var(--ink-3); font-size: 0.85rem; text-decoration: none; }
    .me-side-link:hover { color: var(--ink); }
}

/* Toolbar: title, period, controls */
.toolbar { display: grid; gap: 10px 20px; padding: 14px var(--pad); background: var(--ground); border-bottom: 1px solid var(--line); }
.toolbar-head { min-width: 0; }
.toolbar h1, .page-head h1, .gate-title { font-family: var(--display); font-weight: 650; letter-spacing: -0.01em; }
.toolbar h1 { font-size: 1.5rem; line-height: 1.15; }
.range-text { color: var(--ink-2); font-size: 0.9rem; }
.toolbar-controls { display: grid; gap: 10px; min-width: 0; }
.toolbar-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.updated { color: var(--ink-3); font-size: 0.85rem; margin-right: auto; }
.custom-range { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 14px; grid-column: 1 / -1; }
.custom-range label { display: grid; gap: 3px; font-size: 0.82rem; color: var(--ink-2); flex: 1 1 140px; }
.custom-range .form-error { flex-basis: 100%; }
.custom-range .btn { flex: 0 0 auto; }

@media (min-width: 900px) {
    .toolbar { position: sticky; top: var(--tt-topnav-h); z-index: 20; grid-template-columns: minmax(0, 1fr) auto; align-items: center; padding-block: 10px; }
    .toolbar-controls { grid-auto-flow: column; align-items: center; gap: 14px; }
    .updated { margin-right: 0; }
    .custom-range label { flex: 0 0 160px; }
}

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px;
    border: 1px solid var(--line-2); border-radius: 8px; background: var(--raised); color: var(--ink);
    font: 600 0.9rem 'Inter', system-ui, sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--fill); border-color: var(--fill); color: #fff; }
.btn-primary:hover { background: #3a7bea; border-color: #3a7bea; }
.btn-danger { background: var(--danger-fill); border-color: var(--danger-fill); color: #fff; }
.btn-danger:hover { background: #c9443e; border-color: #c9443e; }
.btn-quiet { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn-quiet:hover { color: var(--ink); border-color: var(--line-2); }
.btn-icon { width: 38px; padding: 0; }
.btn-more { margin-top: 6px; color: var(--browse-ink); }
.btn-copy { min-height: 32px; padding: 0 8px; font-size: 0.8rem; font-weight: 500; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.input {
    width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: 8px;
    background: var(--ground); color: var(--ink); font: 400 0.95rem 'Inter', system-ui, sans-serif;
}
.segmented { display: inline-grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; min-width: 0; }
.segment { min-height: 36px; padding: 0 12px; border: 0; border-left: 1px solid var(--line-2); background: transparent; color: var(--ink-2); font: 600 0.85rem 'Inter', system-ui, sans-serif; cursor: pointer; white-space: nowrap; }
.segment:first-child { border-left: 0; }
.segment:hover { color: var(--ink); }
.segment[aria-pressed="true"] { background: var(--ink); color: #12161f; }
.segment:focus-visible { outline-offset: -3px; outline-color: var(--fill); }

/* Body */
.me-notes { display: grid; gap: var(--gap); padding: 0 var(--pad); }
.me-notes:not(:empty) { padding-top: var(--gap); }
.me-body { display: grid; gap: var(--gap); padding: var(--gap) var(--pad) 72px; transition: opacity 0.15s; min-width: 0; align-content: start; }
.me-body.is-refreshing { opacity: 0.5; }
body[data-shell="off"] .me-body { padding-top: clamp(20px, 3vw, 40px); }
.section-title { font-family: var(--display); font-weight: 600; font-size: 1.15rem; margin-top: 10px; }
.view-lead { color: var(--ink-2); max-width: 80ch; }
.hint { color: var(--ink-3); font-size: 0.85rem; max-width: 80ch; }
.note { color: var(--ink-2); font-size: 0.9rem; max-width: 80ch; }
.empty { color: var(--ink-3); padding: 8px 0; }
.form-error { color: var(--danger); font-size: 0.9rem; }
.form-msg { display: grid; gap: 8px; justify-items: start; margin-top: 8px; }
.form-msg:empty { display: none; }

.grid { display: grid; gap: var(--gap); grid-template-columns: minmax(0, 1fr); align-items: start; min-width: 0; }
.grid > * { min-width: 0; }
.grid-lead, .grid-coding { align-items: stretch; }
@media (min-width: 1000px) {
    .grid-lead { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
    .grid-pair { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-three { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .grid-coding { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
    .grid-coding > :first-child { grid-column: 1 / -1; }
    .grid-sub { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1400px) {
    .grid-week { grid-template-columns: minmax(0, 2.6fr) minmax(0, 1fr); }
    .grid-cols { grid-template-columns: repeat(auto-fit, minmax(0, 1fr)); grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
    .grid-three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .grid-coding { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr) minmax(0, 1fr); }
    .grid-coding > :first-child { grid-column: auto; }
    .grid-sub { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* One card level. Lists sit open on the ground, charts sit on the panel. */
.card { min-width: 0; padding: 14px 18px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.card-open { padding: 12px 0 0; background: none; border: 0; border-top: 2px solid var(--line-2); border-radius: 0; }
.card-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 10px; min-height: 28px; }
.card-head > :last-child:not(:first-child):not(.card-count) { margin-left: auto; }
.card-title { font-size: 0.98rem; font-weight: 600; line-height: 1.3; }
.card-count { color: var(--ink-3); font-size: 0.85rem; }
.link-more { color: var(--browse-ink); font-size: 0.85rem; text-decoration: none; }
.link-more:hover { text-decoration: underline; }
.subsection { margin-top: 16px; min-width: 0; }
.sub-title { font-size: 0.86rem; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; }
.lead-stat { font-family: var(--display); font-weight: 650; font-size: 1.6rem; line-height: 1.2; }
.kv { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; margin-top: 10px; padding-top: 8px; border-top: 1px solid var(--line); font-size: 0.9rem; color: var(--ink-2); }

/* The totals band */
.band { display: grid; grid-template-columns: minmax(0, 1fr); background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.band-group { padding: 12px 18px 16px; border-top: 3px solid var(--line-2); min-width: 0; }
.band-browse { border-top-color: var(--browse); }
.band-code { border-top-color: var(--code); }
.band-title { font-size: 0.85rem; font-weight: 600; color: var(--ink-2); margin-bottom: 8px; }
.band-note { color: var(--ink-2); padding: 6px 0; }
.band-items { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.stat { min-width: 0; }
.stat-label { color: var(--ink-3); font-size: 0.82rem; line-height: 1.3; }
.stat-value { font-family: var(--display); font-weight: 650; font-size: 1.55rem; line-height: 1.2; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.stat-na { color: var(--ink-3); font-weight: 500; }
.stat-sub { color: var(--ink-3); font-size: 0.8rem; line-height: 1.3; }
.stats { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 18px; }
.stats .stat-value { font-size: 1.2rem; }
.stats + .hint { margin-top: 8px; }
@media (min-width: 600px) {
    .band-items { grid-template-columns: repeat(auto-fit, minmax(min(100%, 136px), 1fr)); }
    .stats { grid-template-columns: repeat(auto-fit, minmax(min(100%, 130px), 1fr)); }
}
@media (min-width: 1000px) {
    .band { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); }
    .band-group + .band-group { border-left: 1px solid var(--line); }
    .band-items { grid-template-columns: repeat(auto-fit, minmax(min(100%, 118px), 1fr)); }
    .stat-value { font-size: 1.8rem; }
    .stats .stat-value { font-size: 1.25rem; }
}

/* Charts */
.chart-block { min-width: 0; }
.chart { position: relative; height: 240px; }
.chart-tall { height: 300px; }
.legend { display: flex; flex-wrap: wrap; gap: 4px 14px; list-style: none; padding: 0; margin-bottom: 8px; font-size: 0.85rem; color: var(--ink-2); }
.swatch { display: inline-block; width: 10px; height: 10px; margin-right: 6px; border-radius: 2px; flex: none; }
.chart-data { margin-top: 4px; font-size: 0.85rem; }
.chart-data summary, .guide summary { cursor: pointer; color: var(--ink-3); min-height: 28px; display: flex; align-items: center; gap: 6px; }
.chart-data summary:hover, .guide summary:hover { color: var(--ink); }
.chart-data summary::before, .guide summary::before { content: '\f105'; font: 900 0.8rem 'Font Awesome 6 Free'; transition: transform 0.12s; }
.chart-data[open] summary::before, .guide[open] summary::before { transform: rotate(90deg); }
.chart-data summary::-webkit-details-marker, .guide summary::-webkit-details-marker { display: none; }
.table-wrap { overflow-x: auto; min-width: 0; }
.data { width: 100%; border-collapse: collapse; font-size: 0.88rem; font-variant-numeric: tabular-nums; }
.data th, .data td { padding: 6px 12px 6px 0; border-top: 1px solid var(--line); text-align: left; white-space: nowrap; font-weight: 400; }
.data thead th { border-top: 0; color: var(--ink-3); font-weight: 500; }
.data tbody th { color: var(--ink-2); }
.data .num { text-align: right; }
.data tr > :last-child { padding-right: 0; }

/* The week grid */
.card-week { min-width: 0; }
.heat-top { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 16px; margin-bottom: 8px; }
.heat-read { color: var(--ink); font-size: 0.9rem; min-height: 1.5em; font-variant-numeric: tabular-nums; }
.heat-scale { display: inline-flex; align-items: center; gap: 3px; color: var(--ink-3); font-size: 0.78rem; }
.heat-scale > span:first-child { margin-right: 4px; }
.heat-scale > span:last-child { margin-left: 4px; }
.heat-chip { width: 14px; height: 10px; border-radius: 2px; }
.heat { width: 100%; table-layout: fixed; border-collapse: separate; border-spacing: 1px; }
.heat-corner { width: 34px; }
.heat-day { width: 34px; padding-right: 6px; text-align: left; font-weight: 500; font-size: 0.74rem; color: var(--ink-2); white-space: nowrap; overflow: hidden; }
.heat-hour { padding: 0 0 3px; font-weight: 400; font-size: 0.62rem; color: transparent; text-align: left; overflow: visible; }
.heat-hour-on { color: var(--ink-3); }
.heat-cell { height: 20px; border-radius: 2px; padding: 0; }
.heat-zero { background: rgba(160, 175, 205, 0.055); }
.heat-cell:hover { outline: 1px solid var(--ink); outline-offset: -1px; }
@media (min-width: 900px) {
    .heat { border-spacing: 2px; }
    .heat-corner, .heat-day { width: 46px; }
    .heat-day { font-size: 0.82rem; }
    .heat-hour { font-size: 0.72rem; }
    .heat-cell { height: 26px; border-radius: 3px; }
}
@media (min-width: 1400px) {
    .heat-hour { color: var(--ink-3); }
    .heat-cell { height: 30px; }
}

/* Ranked bars and rows */
.ranks { list-style: none; padding: 0; }
.rank { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 3px 12px; padding: 6px 0; }
.rank-label { display: flex; align-items: center; min-width: 0; font-size: 0.9rem; }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-value { color: var(--ink-2); font-size: 0.84rem; font-variant-numeric: tabular-nums; text-align: right; }
.rank-track { grid-column: 1 / -1; display: block; height: 4px; border-radius: 2px; background: rgba(160, 175, 205, 0.1); overflow: hidden; }
.rank-bar { display: block; height: 100%; border-radius: 2px; }
.rows { list-style: none; padding: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 44px; padding: 3px 0; border-top: 1px solid var(--line); }
.rows > .row:first-child { border-top: 0; }
.row-main { flex: 1; min-width: 0; display: grid; color: inherit; text-decoration: none; }
a.row-main { min-height: 44px; align-content: center; }
a.row-main:hover .row-title { color: var(--browse-ink); }
.row-title { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; overflow-wrap: anywhere; font-size: 0.92rem; line-height: 1.3; }
.row-sub { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-3); font-size: 0.8rem; }
.row-meta { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 1px; max-width: 45%; color: var(--ink-2); font-size: 0.82rem; font-variant-numeric: tabular-nums; text-align: right; }
.row-meta-sub { color: var(--ink-3); font-size: 0.78rem; }
.row-actions { flex-direction: row; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; max-width: none; }
.rows-cols { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 420px), 1fr)); column-gap: 28px; }
.rows-cols > .row:first-child { border-top: 1px solid var(--line); }
.deltas { display: inline-flex; gap: 8px; font-size: 0.82rem; font-variant-numeric: tabular-nums; }
.delta-pos { color: var(--pos); }
.delta-neg { color: var(--neg); }
@media (min-width: 900px) {
    .row-title { display: block; white-space: nowrap; text-overflow: ellipsis; }
}

/* Install, claim, banners */
.install { display: flex; gap: 14px; min-width: 0; padding: 16px 18px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; }
.install-icon { flex: none; display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: var(--raised); font-size: 1.2rem; }
.install-chrome { color: var(--browse-ink); }
.install-vscode { color: var(--code-ink); }
.install-body { display: grid; gap: 8px; min-width: 0; justify-items: start; }
.install-body > p { color: var(--ink-2); font-size: 0.92rem; max-width: 70ch; }
.guide { font-size: 0.9rem; width: 100%; }
.guide-steps { padding-left: 20px; display: grid; gap: 4px; color: var(--ink-2); margin: 4px 0 8px; max-width: 80ch; }
.guide-paste { padding: 4px 0; }
.paste { margin-top: 8px; }
.paste-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; max-width: 640px; }
.callout { display: grid; gap: 10px 20px; padding: 14px 18px; background: rgba(60, 138, 226, 0.09); border: 1px solid rgba(60, 138, 226, 0.55); border-radius: 12px; }
.callout p { max-width: 80ch; color: var(--ink-2); font-size: 0.92rem; }
.callout-warn { background: rgba(201, 128, 18, 0.1); border-color: rgba(201, 128, 18, 0.6); }
.callout .hint { margin-top: 4px; }
@media (min-width: 900px) {
    .callout { grid-template-columns: minmax(0, 1fr) auto; align-items: center; }
}
.banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 10px 14px; border-radius: 10px; border: 1px solid; }
.banner p { flex: 1 1 240px; }
.banner-error { background: rgba(184, 58, 52, 0.16); border-color: rgba(255, 138, 128, 0.55); }
.banner-warn { background: rgba(201, 128, 18, 0.12); border-color: rgba(201, 128, 18, 0.6); }
.banner > i { color: var(--warn); }
.banner-error > i { color: var(--danger); }

.gate { display: grid; gap: 12px; justify-items: start; }
.gate-title { font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.1; }
.gate p { max-width: 62ch; color: var(--ink-2); }
.page-head { display: grid; gap: 4px; }
.page-head h1 { font-size: clamp(1.6rem, 3vw, 2.2rem); line-height: 1.1; }
.page-head p { color: var(--ink-2); max-width: 80ch; }
.checklist { list-style: none; padding: 0; display: grid; gap: 18px; counter-reset: step; margin-top: 8px; }
.check { display: grid; grid-template-columns: 32px minmax(0, 1fr); gap: 14px; counter-increment: step; }
.check-mark { display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line-2); font-weight: 700; font-size: 0.9rem; color: var(--ink-2); }
.check-todo .check-mark::before { content: counter(step); }
.check-done .check-mark { background: #1f6b4a; border-color: #1f6b4a; color: #fff; }
.check-body { display: grid; gap: 8px; min-width: 0; }
.check-title { font-size: 1rem; font-weight: 600; line-height: 2; }
.check-body p { color: var(--ink-2); max-width: 80ch; }
.check-body .actions { margin-top: 8px; }

/* Sources */
.sources { list-style: none; padding: 0; display: grid; gap: var(--gap); grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); }
.source { display: grid; gap: 10px; align-content: start; padding: 14px 16px; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.source-head { display: flex; align-items: center; gap: 12px; min-width: 0; }
.source-icon { flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; background: var(--raised); font-size: 1.1rem; color: var(--ink-2); }
.source-chrome { color: var(--browse-ink); }
.source-vscode { color: var(--code-ink); }
.source-name { min-width: 0; }
.source-title { font-size: 1rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-status { display: flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 0.84rem; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); flex: none; }
.dot-on { background: var(--pos); }
.dot-mid { background: var(--warn); }
.dot-none { background: transparent; border: 1px solid var(--ink-3); }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags:empty { display: none; }
.tag { padding: 1px 8px; border: 1px solid var(--line-2); border-radius: 999px; font-size: 0.76rem; color: var(--ink-2); }
.facts { display: grid; }
.fact { display: flex; justify-content: space-between; gap: 14px; padding: 5px 0; border-top: 1px solid var(--line); font-size: 0.86rem; }
.fact dt { color: var(--ink-3); flex: none; }
.fact dd { color: var(--ink); text-align: right; overflow-wrap: anywhere; min-width: 0; }
.update { display: grid; gap: 6px; justify-items: start; padding: 10px 12px; background: rgba(201, 128, 18, 0.1); border-left: 3px solid var(--code); border-radius: 0 8px 8px 0; }
.update-title { display: flex; gap: 8px; align-items: center; font-weight: 600; font-size: 0.9rem; }
.update-title i { color: var(--code-ink); }
.source-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px; margin-top: auto; }
.masked-id { display: inline-flex; align-items: center; gap: 2px; min-width: 0; }
.masked-id code { font-family: var(--mono); font-size: 0.82rem; color: var(--ink-2); white-space: nowrap; }

/* Privacy and data */
.yesno { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr)); margin-top: 10px; }
.plain-list { padding-left: 18px; display: grid; gap: 4px; color: var(--ink-2); font-size: 0.9rem; }
.danger-zone { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; margin-top: 12px; padding: 14px 18px; border: 1px solid rgba(255, 138, 128, 0.45); border-radius: 12px; }
.danger-zone > div { flex: 1 1 280px; }

/* Dialogs: the top layer handles stacking, so no z-index here. Display stays with the browser while closed. */
.dlg { padding: 0; width: min(580px, calc(100vw - 24px)); max-height: calc(100dvh - 24px); background: var(--panel); color: var(--ink); border: 1px solid var(--line-2); border-radius: 14px; }
.dlg::backdrop { background: rgba(5, 8, 14, 0.72); }
.dlg-inner { display: grid; gap: 12px; padding: 14px 18px 16px; }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.dlg-head h2 { font-family: var(--display); font-weight: 650; font-size: 1.2rem; line-height: 1.2; }
.dlg-body { display: grid; gap: 8px; }
.dlg-body p { color: var(--ink-2); font-size: 0.92rem; }
.dlg-strong { color: var(--ink) !important; font-weight: 600; }
.dlg-message { color: var(--danger); font-size: 0.92rem; }
.dlg-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }

.status { position: fixed; left: 50%; bottom: 16px; transform: translateX(-50%); z-index: calc(var(--tt-z-modal, 1000) + 20); display: flex; align-items: center; gap: 10px; width: max-content; max-width: calc(100vw - 24px); padding: 8px 8px 8px 14px; background: var(--raised); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45); }
.status > i { color: var(--pos); }
.status-text { font-size: 0.92rem; min-width: 0; }
.status-action { color: var(--browse-ink); }

/* First load */
.skel { background: rgba(160, 175, 205, 0.08); border-radius: 12px; animation: me-pulse 1.4s ease-in-out infinite; }
.skel-band { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 150px), 1fr)); }
.skel-tile { height: 86px; }
.skel-chart { height: 340px; }
.skel-wide { height: 260px; }
@keyframes me-pulse { 50% { opacity: 0.45; } }
@media (prefers-reduced-motion: reduce) {
    .skel { animation: none; }
    .me-body, .chart-data summary::before, .guide summary::before { transition: none; }
}

/* Phones: 44px targets, day rows become cards */
@media (max-width: 899px) {
    .btn { min-height: 44px; }
    .btn-icon { width: 44px; }
    .btn-copy { min-height: 44px; min-width: 44px; }
    .input { min-height: 44px; }
    .toolbar-controls .segmented { display: grid; }
    .segment { min-height: 44px; padding: 0 4px; }
    .chart-data summary, .guide summary { min-height: 44px; }
    .link-more { display: inline-flex; align-items: center; min-height: 44px; }
    .chart, .chart-tall { height: 220px; }
    .toolbar-actions .btn span { display: inline; }
    .rank-value { font-size: 0.8rem; }
}
@media (max-width: 699px) {
    .daytable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    .daytable tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 18px; padding: 8px 0; border-top: 1px solid var(--line); }
    .daytable th, .daytable td { border: 0; padding: 2px 0; white-space: normal; }
    .daytable tbody th { grid-column: 1 / -1; font-weight: 600; color: var(--ink); }
    .daytable td { display: flex; justify-content: space-between; gap: 8px; }
    .daytable td::before { content: attr(data-label); color: var(--ink-3); text-align: left; }
    .paste-row { grid-template-columns: minmax(0, 1fr); }
    .rank-name { white-space: normal; overflow-wrap: anywhere; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
    .install { flex-direction: column; }
    .row-meta { max-width: 40%; }
    .row:has(.row-actions) { flex-wrap: wrap; }
    .row-actions { max-width: none; justify-content: flex-start; }
}
