/* Velvet Noir Web: the Noir dock's smoked glass, colours and type, laid out for a browser. */
:root {
  color-scheme: dark;
  --bright: #f4f3f8; --soft: #c9c6d4; --muted: #8f8b9e; --faint: #625e71;
  --up: #5be0ae; --down: #ff7190; --amber: #f0c27a; --violet: #b4a2ff;
  --up-tint: rgba(91, 224, 174, .12); --down-tint: rgba(255, 113, 144, .12); --amber-tint: rgba(240, 194, 122, .12);
  --segment-on: rgba(164, 139, 255, .18); --hairline: rgba(255, 255, 255, .07); --whisper: rgba(255, 255, 255, .05);
  --glass: rgba(21, 19, 28, .9); --ink: #0b0a10; --sheet: #17151e;
  --signature: linear-gradient(45deg, #9c7cff, #47d5c6);
  --ui: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink); color: var(--bright); font: 13px/1.35 var(--ui);
  font-variant-numeric: tabular-nums; -webkit-font-smoothing: antialiased; overflow: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
:focus-visible { outline: 2px solid rgba(180, 162, 255, .65); outline-offset: 2px; }
[hidden] { display: none !important; }
svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.backdrop {
  position: fixed; inset: 0; z-index: -1;
  background:
    radial-gradient(900px 600px at 12% 8%, rgba(140, 108, 255, .16), transparent 60%),
    radial-gradient(800px 600px at 92% 96%, rgba(71, 213, 198, .1), transparent 60%),
    var(--ink);
}

/* Shell: the dock alone, or the dock beside the chart on wide screens. */
.shell { height: 100%; display: flex; gap: 20px; padding: 28px; justify-content: center; align-items: stretch; }
.dock, .chart {
  background: var(--glass); border: 1px solid var(--hairline); border-radius: 22px;
  box-shadow: 0 30px 80px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .05);
  backdrop-filter: blur(18px);
}
.dock { width: 560px; max-width: 100%; display: flex; flex-direction: column; min-height: 0; position: relative; overflow: hidden; }
.dock::before {
  content: ""; position: absolute; width: 420px; height: 260px; left: -120px; top: -150px; pointer-events: none;
  background: radial-gradient(closest-side, rgba(140, 108, 255, .22), transparent);
}

.bar { display: flex; align-items: center; justify-content: space-between; padding: 18px 16px 6px 22px; position: relative; }
.brand { display: flex; align-items: center; gap: 10px; }
.mark { width: 30px; height: 30px; border-radius: 8px; }
.wordmark { font: 600 19px var(--display); letter-spacing: .01em; }
.eyebrow { font-size: 8px; font-weight: 600; letter-spacing: .22em; color: var(--faint); }
.actions { display: flex; gap: 4px; }
.icon {
  width: 32px; height: 32px; border: 0; border-radius: 10px; background: transparent; color: var(--soft);
  display: inline-grid; place-items: center; transition: background .12s, color .12s;
}
.icon:hover { background: rgba(255, 255, 255, .07); color: var(--bright); }

.status { display: flex; align-items: center; gap: 10px; padding: 2px 22px 12px; font-size: 11px; color: var(--muted); position: relative; min-width: 0; }
.status span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.halo { width: 12px; height: 12px; border-radius: 50%; display: grid; place-items: center; background: rgba(240, 194, 122, .22); flex: none; }
.halo.live { background: rgba(91, 224, 174, .22); }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--amber); flex: none; }
.halo.live .dot { background: var(--up); }

.listhead { display: flex; justify-content: space-between; padding: 4px 22px 8px; }
.sorter {
  border: 0; background: none; padding: 2px 0; font-size: 8px; font-weight: 600; letter-spacing: .2em; color: var(--faint);
  display: inline-flex; align-items: center; gap: 5px;
}
.sorter:hover { color: var(--soft); }
.sorter.on { color: var(--violet); }
.arrow { font-size: 8px; letter-spacing: 0; }

.rows { flex: 1; min-height: 0; overflow-y: auto; padding: 0 10px 8px 10px; position: relative; scrollbar-width: thin; scrollbar-color: rgba(255, 255, 255, .14) transparent; }
.rows::-webkit-scrollbar { width: 6px; }
.rows::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .14); border-radius: 3px; }

.row {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto 26px; align-items: center;
  padding: 10px 0 10px 10px; margin-bottom: 2px; border-radius: 14px; cursor: pointer; user-select: none;
  transition: background .12s;
}
.row:hover { background: var(--whisper); }
.row.dragging { z-index: 5; background: rgba(38, 35, 48, .97); box-shadow: 0 14px 34px rgba(0, 0, 0, .5); cursor: grabbing; transition: none; }
.rows.reordering .row:not(.dragging) { transition: transform .18s ease; }
.glow {
  position: absolute; inset: 0; border-radius: 14px; pointer-events: none; opacity: 0; transition: opacity .9s;
  border: 1px solid transparent;
  background: linear-gradient(rgba(71, 213, 198, .06), rgba(71, 213, 198, .06)) padding-box, linear-gradient(#1b1a24, #1b1a24) padding-box, var(--signature) border-box;
}
.holders.measuring .count { flex-shrink: 0; }
.spark .line { fill: none; stroke-width: 1.5; }
.spark .area { stroke: none; }
.spark circle { stroke: none; }
.row > :not(.glow) { position: relative; }
.row.alerted .glow { opacity: 1; }
.row.pulse .glow { animation: pulse 2.1s ease-out 1; }
@keyframes pulse { 0% { opacity: 0; } 12% { opacity: 1; } 32% { opacity: .35; } 52% { opacity: 1; } 72% { opacity: .35; } 100% { opacity: 1; } }

.logo {
  width: 38px; height: 38px; border-radius: 50%; margin-right: 13px; overflow: hidden; flex: none;
  display: grid; place-items: center; font: 600 13px var(--display); color: var(--bright);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.logo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.logo.big { width: 52px; height: 52px; font-size: 18px; margin-right: 16px; }

.identity { min-width: 0; margin-right: 8px; }
.heading { display: flex; align-items: center; min-width: 0; }
.title { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sym { font-size: 15px; font-weight: 600; color: var(--bright); }
.name { font-size: 12px; color: var(--muted); margin-left: .55em; }
.tool {
  width: 22px; height: 22px; border: 0; border-radius: 6px; background: transparent; color: var(--muted); opacity: .55;
  display: inline-grid; place-items: center; flex: none; text-decoration: none; transition: opacity .2s, background .12s, color .12s;
}
.tool svg { width: 13px; height: 13px; }
.tool:hover { background: rgba(255, 255, 255, .08); color: var(--bright); opacity: 1; }
.row:hover .tool { opacity: 1; }
.heading .copy { margin-left: 5px; }
.heading .del { margin-left: 1px; opacity: 0; }
.row:hover .del, .del:focus-visible { opacity: 1; }
.del.armed { opacity: 1; color: var(--down); background: var(--down-tint); }
.tool.done { color: var(--up); opacity: 1; }
.tool.failed { color: var(--down); opacity: 1; }

.holders { display: flex; align-items: center; margin-top: 5px; font-size: 11px; white-space: nowrap; overflow: hidden; min-width: 0; }
.holders .glyph { width: 16px; color: var(--faint); flex: none; display: inline-flex; }
.holders .glyph svg { width: 12px; height: 12px; stroke-width: 1.6; }
.holders.live .glyph { color: var(--up); }
.holders .tag { font-size: 7.5px; font-weight: 700; letter-spacing: .18em; color: var(--amber); margin-right: 6px; flex: none; }
.holders .count { color: var(--muted); overflow: hidden; text-overflow: ellipsis; min-width: 0; flex: 0 1 auto; }
.holders.live .count { color: var(--soft); }
.holders .d5, .holders .d15 { flex: none; margin-left: 6px; color: var(--muted); }
.holders .d15 { margin-left: 9px; }
.holders b { font-weight: 600; }
.holders i { font-style: normal; color: var(--faint); }
.holders b.up { color: var(--up); }
.holders b.down { color: var(--down); }
.holders.no-unit .unit, .holders.no-d15 .d15, .holders.no-label .d5 i, .holders.no-delta .d5 { display: none; }
.holders.big { font-size: 12.5px; margin-top: 6px; }
.holders.big .glyph svg { width: 14px; height: 14px; }
.holders.big .glyph { width: 20px; }

.state { display: flex; align-items: center; margin-top: 5px; font-size: 10.5px; white-space: nowrap; overflow: hidden; }
.state .dot { margin: 0 10px 0 2px; }
.state .mode { font-weight: 600; letter-spacing: .04em; }
.state .age { color: var(--faint); white-space: pre; }

.spark { width: 112px; height: 34px; margin: 0 12px 0 10px; overflow: visible; }
.spark path { stroke-width: 1.5; }

.pricing { text-align: right; min-width: 82px; }
.cap { font: 600 16.5px var(--display); color: var(--bright); white-space: nowrap; }
.cap.up { color: var(--up); }
.cap.down { color: var(--down); }
.pill { display: inline-block; margin-top: 5px; padding: 1px 7px 2px; border-radius: 7px; font-size: 11.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.pill.up { color: var(--up); background: var(--up-tint); }
.pill.down { color: var(--down); background: var(--down-tint); }
.vol { margin-top: 4px; font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.vol i { font-style: normal; color: var(--faint); }

.edge { align-self: stretch; display: flex; flex-direction: column; align-items: center; padding-top: 1px; }
.edge .more { margin: auto 0; opacity: .4; }
.row:hover .edge .more { opacity: 1; }

.empty { padding: 36px 30px 40px; text-align: center; }
.empty-title { font: 600 17px var(--display); margin: 0 0 6px; }
.empty-text { color: var(--muted); margin: 0 auto 18px; max-width: 360px; line-height: 1.5; }
.empty-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }

.foot { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px 16px 22px; border-top: 1px solid var(--hairline); }
.tally { font-size: 8px; font-weight: 600; letter-spacing: .2em; color: var(--faint); }

.primary, .chip, .danger {
  border-radius: 12px; display: inline-flex; align-items: center; gap: 8px; font-weight: 600; white-space: nowrap;
  transition: background .12s, border-color .12s, filter .12s;
}
.primary { border: 0; padding: 9px 16px; color: #fff; background: linear-gradient(135deg, #8c6cff, #6b56e8); box-shadow: 0 6px 18px rgba(124, 92, 255, .28); }
.primary:hover:not(:disabled) { filter: brightness(1.08); }
.primary svg { width: 14px; height: 14px; stroke-width: 2; }
.chip { border: 1px solid rgba(255, 255, 255, .12); padding: 7px 12px; background: rgba(255, 255, 255, .04); color: var(--soft); font-weight: 500; }
.chip:hover:not(:disabled) { background: rgba(255, 255, 255, .08); color: var(--bright); }
.chip[aria-pressed="true"] { background: var(--segment-on); color: var(--bright); border-color: rgba(180, 162, 255, .3); }
.danger { border: 1px solid rgba(255, 113, 144, .3); padding: 9px 14px; background: var(--down-tint); color: var(--down); }

.segments { display: inline-flex; padding: 3px; border-radius: 11px; background: rgba(255, 255, 255, .04); border: 1px solid var(--hairline); }
.segments button { border: 0; background: transparent; color: var(--muted); padding: 6px 12px; border-radius: 8px; font-weight: 600; }
.segments button:hover { color: var(--bright); }
.segments button.on { background: var(--segment-on); color: var(--bright); }
.segments:has(button:disabled) { opacity: .5; }

/* Chart panel */
.chart { flex: 1; min-width: 0; max-width: 1180px; display: flex; flex-direction: column; padding: 22px 24px 18px; position: relative; }
.chart-head { display: grid; grid-template-columns: minmax(0, 1fr) auto 36px; gap: 18px; align-items: start; }
.who { display: flex; align-items: center; min-width: 0; }
.names { min-width: 0; }
.names h1 { margin: 0; font: 600 26px var(--display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.subtitle { display: flex; align-items: center; gap: 2px; margin-top: 2px; font-size: 13.5px; color: var(--muted); min-width: 0; }
.subtitle span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-right: 6px; }
.subtitle .tool { opacity: .75; }
.chart-state { display: flex; align-items: center; gap: 8px; margin-top: 8px; font-size: 12px; font-weight: 600; }
.value { text-align: right; display: flex; flex-direction: column; align-items: flex-end; }
.value .label { font-size: 7.5px; font-weight: 600; letter-spacing: .2em; color: var(--faint); }
.value .cap { font: 350 36px var(--display); margin-top: 2px; }
.value .pill { padding: 2px 8px 3px; border-radius: 8px; }
.value .vol { font-size: 12px; margin-top: 7px; }
.value .vol b { color: var(--soft); font-weight: 400; }
.close { margin-top: -4px; }
.tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin: 18px 0 14px; }
.spacer { flex: 1; }
.plot { position: relative; flex: 1; min-height: 260px; border-radius: 16px; background: rgba(255, 255, 255, .022); border: 1px solid var(--hairline); overflow: hidden; }
.plot canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.plot-status { position: absolute; left: 0; right: 0; bottom: 10px; margin: 0; text-align: center; font-size: 11px; color: var(--faint); pointer-events: none; }
.footnote { margin: 12px 2px 0; font-size: 11.5px; color: var(--faint); line-height: 1.5; }

/* Sheets */
.sheet {
  width: min(470px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 20px 26px 24px;
  background: var(--sheet); color: var(--bright); border: 1px solid var(--hairline); border-radius: 22px;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}
.sheet::backdrop { background: rgba(6, 5, 10, .62); backdrop-filter: blur(4px); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; margin: 0 -8px 8px 0; }
.sheet h2 { margin: 0; font: 600 21px var(--display); }
.help { color: var(--muted); font-size: 12px; line-height: 18px; margin: 8px 0 14px; }
.help.small { font-size: 11px; line-height: 16px; margin: 6px 0 0; }
.field { width: 100%; padding: 12px 14px; border-radius: 12px; background: rgba(0, 0, 0, .38); border: 1px solid rgba(255, 255, 255, .1); color: var(--bright); font-size: 13px; margin-top: 12px; }
.field:focus { outline: none; border-color: rgba(180, 162, 255, .55); }
.row-actions { display: flex; align-items: center; gap: 10px; margin-top: 12px; flex-wrap: wrap; }
.error { color: var(--down); font-size: 11.5px; margin: 8px 2px 0; min-height: 0; }
.error:empty { display: none; }
.error.quiet { color: var(--muted); }
.pill-status { display: inline-flex; align-items: center; gap: 8px; margin: 0; padding: 6px 12px 7px 10px; border-radius: 10px; background: rgba(255, 255, 255, .05); border: 1px solid rgba(255, 255, 255, .08); font-size: 11.5px; color: var(--soft); }
.pill-status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--amber); }
.pill-status.ok::before { background: var(--up); }
.card { margin-top: 12px; padding: 12px 14px 13px; border-radius: 12px; background: rgba(255, 255, 255, .03); border: 1px solid var(--hairline); }
.card .segments { margin-top: 12px; }
.card-title { margin: 0; font-size: 12.5px; font-weight: 600; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch i { width: 40px; height: 22px; border-radius: 11px; background: rgba(255, 255, 255, .12); position: relative; flex: none; transition: background .15s; }
.switch i::after { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; border-radius: 50%; background: #e9e6f2; transition: transform .15s; }
.switch input:checked + i { background: linear-gradient(135deg, #8c6cff, #6b56e8); }
.switch input:checked + i::after { transform: translateX(18px); }
.switch input:focus-visible + i { outline: 2px solid rgba(180, 162, 255, .65); outline-offset: 2px; }

/* Row menu, toast and offline banner */
.menu { position: fixed; z-index: 40; min-width: 210px; padding: 6px; border-radius: 12px; background: #1d1a25; border: 1px solid rgba(255, 255, 255, .09); box-shadow: 0 18px 44px rgba(0, 0, 0, .55); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 12px; border: 0; border-radius: 8px; background: transparent; color: var(--soft); text-align: left; }
.menu button:hover:not(:disabled) { background: var(--whisper); color: var(--bright); }
.menu button.danger-item { color: var(--down); }
.menu hr { border: 0; border-top: 1px solid var(--hairline); margin: 5px 4px; }
.menu svg { width: 14px; height: 14px; }
.toast { position: fixed; left: 50%; bottom: 26px; transform: translateX(-50%); z-index: 50; max-width: min(640px, calc(100vw - 32px)); padding: 10px 16px; border-radius: 12px; background: #201d29; border: 1px solid rgba(255, 255, 255, .1); box-shadow: 0 16px 40px rgba(0, 0, 0, .5); font-size: 12px; color: var(--soft); }
.offline { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 60; padding: 10px 16px; border-radius: 12px; background: #2a2216; border: 1px solid rgba(240, 194, 122, .3); color: var(--amber); font-size: 12px; max-width: calc(100vw - 32px); }

/* Narrower windows: the chart opens over the dock. */
@media (max-width: 1080px) {
  .chart { position: fixed; inset: 12px; z-index: 30; max-width: none; }
}
@media (max-width: 640px) {
  .shell { padding: 10px; }
  .dock { width: 100%; border-radius: 18px; }
  .chart { inset: 0; border-radius: 0; padding: 16px; }
  .chart-head { grid-template-columns: minmax(0, 1fr) 36px; }
  .chart-head .value { grid-column: 1 / -1; grid-row: 2; align-items: flex-start; text-align: left; }
  .value .cap { font-size: 30px; }
}
@media (max-width: 460px) {
  .spark { display: none; }
  .logo { width: 32px; height: 32px; margin-right: 11px; }
  .sym { font-size: 13.5px; }
}
@media (prefers-reduced-motion: reduce) {
  .row.pulse .glow { animation: none; }
  .rows.reordering .row:not(.dragging), .glow { transition: none; }
}
