:root {
    --bg: #1c212b;
    --surface: #252b37;
    --surface-2: #2e3542;
    --border: #3a4253;
    --text: #e7eaf0;
    --muted: #9ba5b7;
    --ok: #6ad49b;
    --error: #ff8080;
    --warn: #f2c66d;
    --accent: #7dd3c0;
    --c-overview: #7dd3c0;
    --c-fartdump: #62a845;
    --c-wisedocks: #3f8de6;
    --c-stellarhistory: #d6782f;
    --radius: 12px;
    --sidebar-w: 264px;
    --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

[data-site="overview"] { --accent: var(--c-overview); }
[data-site="fartdump"] { --accent: var(--c-fartdump); }
[data-site="wisedocks"] { --accent: var(--c-wisedocks); }
[data-site="stellarhistory"] { --accent: var(--c-stellarhistory); }

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

[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font: 16px/1.55 var(--font);
    -webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { line-height: 1.25; margin: 0; }

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

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

.icon { width: 20px; height: 20px; flex: none; }

.app { min-height: 100vh; }

.sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: var(--sidebar-w);
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: calc(16px + env(safe-area-inset-top)) 14px calc(16px + env(safe-area-inset-bottom));
    overflow-y: auto;
    z-index: 30;
    transform: translateX(-100%);
    transition: transform .22s ease;
}

.menu-open .sidebar { transform: none; }

.backdrop {
    position: fixed;
    inset: 0;
    background: rgba(10, 12, 17, .55);
    opacity: 0;
    pointer-events: none;
    transition: opacity .22s ease;
    z-index: 20;
}

.menu-open .backdrop { opacity: 1; pointer-events: auto; }

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 8px 16px;
    color: var(--text);
    font-weight: 700;
    font-size: 1.15rem;
    letter-spacing: .02em;
}

.brand:hover { text-decoration: none; }
.brand img { border-radius: 7px; }

.switcher {
    display: grid;
    gap: 2px;
    padding: 6px;
    background: var(--bg);
    border-radius: var(--radius);
}

.switch {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 8px;
    color: var(--muted);
    font-size: .93rem;
}

.switch:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.switch.is-active { background: var(--surface-2); color: var(--text); font-weight: 600; }

.dot {
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: var(--accent);
    flex: none;
    display: inline-block;
}

.site-title {
    display: flex;
    flex-direction: column;
    padding: 22px 10px 10px;
}

.site-label {
    font-size: .74rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--muted);
}

.site-name {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--accent);
}

.menu { display: grid; gap: 2px; }

.menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 10px 12px;
    border: 0;
    border-radius: 9px;
    background: none;
    color: var(--text);
    text-align: left;
    cursor: pointer;
}

.menu-item .icon { color: var(--muted); }
.menu-item:hover { background: var(--surface-2); text-decoration: none; }

.menu-item.is-active {
    background: color-mix(in srgb, var(--accent) 16%, transparent);
    color: var(--accent);
    font-weight: 600;
}

.menu-item.is-active .icon { color: var(--accent); }

.sidebar-foot {
    margin-top: auto;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    display: grid;
    gap: 2px;
}

.sidebar-foot form { margin: 0; }

.who {
    margin: 8px 12px 0;
    font-size: .85rem;
    color: var(--muted);
}

.main { min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 10;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: calc(10px + env(safe-area-inset-top)) 16px 10px;
    background: color-mix(in srgb, var(--bg) 88%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border);
}

.topbar-title { display: flex; flex-direction: column; min-width: 0; }

.topbar-site {
    font-size: .76rem;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--accent);
    font-weight: 600;
}

.topbar h1 {
    font-size: 1.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
}

.content {
    width: 100%;
    max-width: 1200px;
    padding: 20px 16px calc(32px + env(safe-area-inset-bottom));
}

.intro { margin-bottom: 18px; color: var(--muted); }
.intro p { margin: 0; }

.grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr));
    gap: 16px;
}

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

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

.card-head h2 {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 1.08rem;
}

.card-foot {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
}

.facts { margin: 0; display: grid; gap: 8px; }

.facts div {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}

.facts div:last-child { border-bottom: 0; padding-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-variant-numeric: tabular-nums; text-align: right; }

.muted { color: var(--muted); margin: 0; }
.error-text { color: var(--error); margin: 0; word-break: break-word; }

.pill {
    font-size: .78rem;
    font-weight: 600;
    padding: 3px 10px;
    border-radius: 999px;
    white-space: nowrap;
}

.pill-ok { background: color-mix(in srgb, var(--ok) 18%, transparent); color: var(--ok); }
.pill-error { background: color-mix(in srgb, var(--error) 18%, transparent); color: var(--error); }
.pill-warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 8px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: var(--surface-2);
    color: var(--text);
    font-weight: 600;
    cursor: pointer;
}

.btn:hover { text-decoration: none; border-color: var(--accent); }

.btn-primary {
    background: var(--accent);
    border-color: var(--accent);
    color: #13171e;
}

.btn-primary:hover { filter: brightness(1.08); }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }

.flash {
    padding: 12px 14px;
    border-radius: 10px;
    margin-bottom: 16px;
    border: 1px solid;
}

.flash-ok { color: var(--ok); border-color: color-mix(in srgb, var(--ok) 40%, transparent); background: color-mix(in srgb, var(--ok) 10%, transparent); }
.flash-error { color: var(--error); border-color: color-mix(in srgb, var(--error) 40%, transparent); background: color-mix(in srgb, var(--error) 10%, transparent); }

.form { display: grid; gap: 16px; }

.field { display: grid; gap: 6px; }
.field span { font-size: .9rem; color: var(--muted); }

.field input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }

.check { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: .93rem; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }

.login {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px 16px;
}

.login-card {
    width: 100%;
    max-width: 380px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 28px 22px;
}

.login-brand { text-align: center; margin-bottom: 22px; }
.login-brand img { border-radius: 14px; }
.login-brand h1 { font-size: 1.5rem; margin-top: 10px; }
.login-brand p { margin: 4px 0 0; color: var(--muted); font-size: .9rem; }

.content > * + * { margin-top: 16px; }

.attention .attn-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

.attn-item {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--bg);
    border: 1px solid transparent;
    color: var(--text);
}

.attn-item:hover { text-decoration: none; border-color: var(--border); }

.attn-site {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: .82rem;
    color: var(--muted);
    min-width: 118px;
}

.attn-count {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    padding: 2px 10px;
    border-radius: 999px;
    background: var(--surface-2);
}

.attn-high .attn-count { background: color-mix(in srgb, var(--warn) 22%, transparent); color: var(--warn); }
.attn-warn .attn-count { background: color-mix(in srgb, var(--warn) 14%, transparent); color: var(--warn); }
.attn-error .attn-count { background: color-mix(in srgb, var(--error) 20%, transparent); color: var(--error); }

.all-clear { display: flex; align-items: center; gap: 10px; margin: 0; color: var(--muted); }
.all-clear .icon { color: var(--ok); }

.tile-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tile-head h2 { display: flex; align-items: center; gap: 10px; font-size: 1.02rem; }
.tile-link { font-size: .9rem; font-weight: 600; }

.hero { display: flex; align-items: baseline; gap: 10px; }
.hero-num { font-size: 2.4rem; font-weight: 700; line-height: 1; font-variant-numeric: tabular-nums; }
.hero-label { color: var(--muted); }

.chart-head { flex-wrap: wrap; }

.seg {
    display: inline-flex;
    padding: 3px;
    gap: 2px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.seg button {
    border: 0;
    background: none;
    color: var(--muted);
    padding: 6px 12px;
    border-radius: 7px;
    font-size: .88rem;
    font-weight: 600;
    cursor: pointer;
}

.seg button[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }

.legend { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.legend li { display: inline-flex; align-items: center; gap: 8px; font-size: .9rem; color: var(--muted); }
.swatch { width: 14px; height: 3px; border-radius: 2px; background: var(--accent); }

.chart { position: relative; height: 280px; touch-action: pan-y; }
.chart svg { display: block; overflow: visible; }

.c-grid line { stroke: var(--border); stroke-width: 1; opacity: .55; }
.c-grid line.base { opacity: 1; stroke: #4a5366; }
.c-axis { fill: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.c-line { fill: none; stroke: var(--accent); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.c-dot { fill: var(--accent); stroke: var(--surface); stroke-width: 2; }
.c-hover { opacity: 0; }
.c-hover.on { opacity: 1; }
.c-cross { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; opacity: 0; }
.c-cross.on { opacity: .8; }
.c-hit { fill: transparent; cursor: crosshair; }
.c-end { font-size: 12.5px; }
.c-end-name { fill: var(--muted); }
.c-end-val { fill: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }

.chart-tip {
    position: absolute;
    min-width: 170px;
    padding: 10px 12px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 10px;
    box-shadow: 0 8px 24px rgba(0, 0, 0, .35);
    pointer-events: none;
    font-size: .88rem;
    z-index: 2;
}

.tip-date { font-weight: 700; margin-bottom: 6px; }
.tip-row { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; }
.tip-name { color: var(--muted); }
.tip-val { font-weight: 700; font-variant-numeric: tabular-nums; }

.chart-table summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.table-wrap { max-height: 320px; overflow: auto; margin-top: 10px; border: 1px solid var(--border); border-radius: 10px; }

.data-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.data-table th, .data-table td { padding: 8px 12px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
.data-table thead th { position: sticky; top: 0; background: var(--surface-2); color: var(--muted); font-weight: 600; }
.data-table tbody th { font-weight: 500; }
.data-table .num { text-align: right; font-variant-numeric: tabular-nums; }

.chart-foot {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 6px 16px;
    font-size: .82rem;
    color: var(--muted);
}

.nav-badge {
    margin-left: auto;
    min-width: 24px;
    padding: 1px 8px;
    border-radius: 999px;
    background: color-mix(in srgb, var(--warn) 22%, transparent);
    color: var(--warn);
    font-size: .78rem;
    font-weight: 700;
    text-align: center;
    font-variant-numeric: tabular-nums;
}

.btn .icon, .icon-btn .icon { width: 18px; height: 18px; }
.btn-sm { min-height: 38px; padding: 6px 12px; font-size: .9rem; border-radius: 9px; }

.btn-danger {
    background: color-mix(in srgb, var(--error) 16%, var(--surface-2));
    border-color: color-mix(in srgb, var(--error) 45%, transparent);
    color: #ffb3b3;
}

.btn-danger:hover { border-color: var(--error); }
.btn.is-disabled { opacity: .45; pointer-events: none; }

.icon-btn-sm { width: 38px; height: 38px; border-radius: 9px; }
.icon-btn-danger { color: #ffb3b3; border-color: color-mix(in srgb, var(--error) 45%, transparent); background: color-mix(in srgb, var(--error) 12%, var(--surface)); }
.icon-btn-danger:hover { border-color: var(--error); }

.spacer { flex: 1; }

.linkish {
    border: 0;
    background: none;
    padding: 0;
    color: var(--accent);
    font-weight: 600;
    cursor: pointer;
    justify-self: start;
}

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.toolbar-note { flex-basis: 100%; margin: 0; color: var(--muted); font-size: .88rem; }
.toolbar-note strong { color: var(--text); }

.search {
    position: relative;
    flex: 1 1 320px;
    max-width: 560px;
    display: flex;
    align-items: center;
}

.search > .icon { position: absolute; left: 12px; color: var(--muted); pointer-events: none; }

.search input {
    width: 100%;
    min-height: 44px;
    padding: 10px 40px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 10px;
}

.search input:focus { outline: none; border-color: var(--accent); }
.search input::-webkit-search-cancel-button { display: none; }
.search-clear { position: absolute; right: 10px; display: grid; color: var(--muted); }

.seg-tabs a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 7px 14px;
    border-radius: 7px;
    color: var(--muted);
    font-weight: 600;
    font-size: .92rem;
}

.seg-tabs a:hover { text-decoration: none; color: var(--text); }
.seg-tabs a[aria-current="page"] { background: var(--surface-2); color: var(--text); }
.tab-count { font-size: .8rem; color: var(--muted); font-variant-numeric: tabular-nums; }

.select-all { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); font-size: .9rem; padding: 0 4px; }

.pick { display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; cursor: pointer; }

.pick input, .select-all input { width: 18px; height: 18px; accent-color: var(--accent); margin: 0; }

.mod-list { display: grid; gap: 12px; }

.mcard {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px 16px;
    display: grid;
    gap: 12px;
    transition: opacity .2s ease, transform .2s ease, border-color .15s ease;
}

.mcard.is-selected, .dcard.is-selected { border-color: var(--accent); }
.is-busy { opacity: .55; pointer-events: none; }
.is-leaving { opacity: 0; transform: scale(.97); }

.mcard-head { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.mcard-time { margin-left: auto; color: var(--muted); font-size: .85rem; white-space: nowrap; }

.chip {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--surface-2);
    font-size: .8rem;
    font-weight: 600;
    white-space: nowrap;
}

.chip .icon { width: 14px; height: 14px; }
.chip-warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }
.chip-error { background: color-mix(in srgb, var(--error) 18%, transparent); color: var(--error); }
.chip-muted { color: var(--muted); }

.mcard-body {
    margin: 0;
    white-space: normal;
    overflow-wrap: anywhere;
    display: -webkit-box;
    -webkit-line-clamp: 6;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.mcard-body.is-open { display: block; -webkit-line-clamp: unset; }

.mcard-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }

.empty {
    display: grid;
    justify-items: center;
    gap: 8px;
    padding: 40px 16px;
    color: var(--muted);
    text-align: center;
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

.empty .icon { width: 32px; height: 32px; color: var(--ok); }
.empty p { margin: 0; }
.draw-grid .empty { grid-column: 1 / -1; }

.pager { display: flex; align-items: center; justify-content: center; gap: 14px; }
.pager-info { color: var(--muted); font-size: .9rem; }

.bulkbar {
    position: fixed;
    left: 50%;
    bottom: calc(16px + env(safe-area-inset-bottom));
    transform: translateX(-50%);
    z-index: 40;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 8px 8px 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    max-width: calc(100vw - 24px);
}

.bulkbar > span { margin-right: 6px; white-space: nowrap; }
.has-bulkbar .content { padding-bottom: 110px; }

.draw-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(100%, 230px), 1fr));
    gap: 14px;
}

.dcard {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    transition: opacity .2s ease, transform .2s ease, border-color .15s ease;
}

.dthumb {
    display: block;
    width: 100%;
    aspect-ratio: 4 / 3;
    padding: 0;
    border: 0;
    background: #fff;
    cursor: zoom-in;
}

.dthumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
[data-visible="0"] .dthumb img { opacity: .55; }

.dthumb-missing {
    display: grid;
    place-content: center;
    justify-items: center;
    gap: 6px;
    background: var(--bg);
    color: var(--muted);
    cursor: default;
    font-size: .85rem;
}

.dchips { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; }
.dchips .chip { box-shadow: 0 2px 8px rgba(0, 0, 0, .35); }
.dchips .chip-error { background: #4a2a2e; }
.dchips .chip-muted { background: #2e3542; }

[data-flags="0"] .chip-flags { display: none; }
[data-visible="1"] .chip-hidden { display: none; }
[data-visible="1"][data-flags="0"] .act-keep { display: none; }
[data-visible="0"][data-flags="0"] .act-hide { display: none; }
.lbl-b { display: none; }
[data-visible="0"] .lbl-a { display: none; }
[data-visible="0"] .lbl-b { display: inline; }

.dmeta { display: flex; align-items: flex-start; gap: 8px; padding: 12px 12px 0; }
.dmeta-text { display: grid; min-width: 0; }
.dmeta-text strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dmeta-text span { color: var(--muted); font-size: .84rem; }
.dcard .mcard-actions { padding: 12px; margin-top: auto; }

.lightbox {
    width: min(96vw, 1000px);
    max-height: 94vh;
    padding: 0;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
}

.lightbox::backdrop, .dialog::backdrop { background: rgba(8, 10, 14, .75); }
.lightbox-inner { position: relative; display: grid; }
.lightbox img { width: 100%; max-height: 76vh; object-fit: contain; background: #fff; display: block; }
.lightbox-close { position: absolute; top: 10px; right: 10px; }
.lightbox-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; padding: 14px; }

.dialog {
    width: min(92vw, 420px);
    padding: 22px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    color: var(--text);
}

.dialog h2 { font-size: 1.15rem; }
.dialog p { color: var(--muted); margin: 10px 0 20px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; }

.toast {
    position: fixed;
    left: 50%;
    top: calc(14px + env(safe-area-inset-top));
    transform: translateX(-50%);
    z-index: 60;
    max-width: calc(100vw - 24px);
    padding: 12px 16px;
    border-radius: 12px;
    background: var(--surface-2);
    border: 1px solid color-mix(in srgb, var(--ok) 45%, transparent);
    color: var(--text);
    box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
    font-weight: 500;
}

.toast[data-type="error"] { border-color: color-mix(in srgb, var(--error) 60%, transparent); color: #ffd0d0; }

.btn.is-on { border-color: var(--accent); color: var(--accent); }
.seg-tabs a .dot { width: 8px; height: 8px; }
.toolbar-note code { font-size: .85em; background: var(--surface-2); padding: 1px 6px; border-radius: 6px; color: var(--text); }

.msg { gap: 0; padding: 0; }

.msg-head {
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: start;
    gap: 10px;
    padding: 12px 14px;
}

.msg-head .pick { margin-top: 2px; }

.msg-open {
    display: grid;
    gap: 2px;
    min-width: 0;
    padding: 0;
    border: 0;
    background: none;
    text-align: left;
    cursor: pointer;
}

.msg-line { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.msg-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.msg-email { color: var(--muted); font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.msg-preview {
    color: var(--muted);
    font-size: .93rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.unread-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; align-self: center; display: none; }
.msg[data-unread="1"] .unread-dot { display: inline-block; }
.msg[data-unread="1"] .msg-name { font-weight: 800; }
.msg[data-unread="1"] .msg-preview { color: var(--text); }
.msg.is-open .msg-preview { display: none; }

.msg-side { display: grid; justify-items: end; gap: 4px; }
.msg-side .attn-site { min-width: 0; }

.msg-detail {
    display: grid;
    gap: 14px;
    padding: 0 14px 14px 52px;
}

.msg-body {
    padding: 14px 16px;
    background: var(--bg);
    border-radius: 10px;
    overflow-wrap: anywhere;
    line-height: 1.6;
}

.msg-facts { margin: 0; display: flex; flex-wrap: wrap; gap: 6px 24px; font-size: .88rem; }
.msg-facts div { display: flex; gap: 8px; }
.msg-facts dt { color: var(--muted); }
.msg-facts dd { margin: 0; overflow-wrap: anywhere; }

@media (max-width: 520px) {
    .msg-head { grid-template-columns: auto 1fr; }
    .msg-side { grid-column: 2; grid-row: 2; display: flex; justify-content: flex-start; gap: 12px; }
    .msg-side .mcard-time { margin-left: 0; }
    .msg-detail { padding-left: 14px; }
    .msg-email { display: none; }
}

@media (max-width: 520px) {
    .bulkbar { left: 12px; right: 12px; transform: none; max-width: none; flex-wrap: wrap; }
    .bulkbar .btn span, .mcard-actions .btn-ghost span {
        position: absolute;
        width: 1px;
        height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

@media (max-width: 520px) {
    .attn-item { grid-template-columns: 1fr auto; }
    .attn-site { grid-column: 1 / -1; min-width: 0; }
    .attn-label { grid-row: 2; }
}

@media (min-width: 960px) {
    .sidebar { transform: none; }
    .backdrop { display: none; }
    .main { margin-left: var(--sidebar-w); }
    #menu-btn { display: none; }
    .topbar { padding: 14px 28px; }
    .content { padding: 28px; }
}

@media (prefers-reduced-motion: reduce) {
    .sidebar, .backdrop { transition: none; }
}
