/* ---------------------------------------------------------------- tokens */
:root {
  color-scheme: light;
  --bg: #f3f4f8;
  --surface: #ffffff;
  --surface-2: #f7f8fb;
  --surface-3: #eef0f5;
  --border: rgba(15, 23, 42, 0.08);
  --border-strong: rgba(15, 23, 42, 0.16);
  --text: #0d1321;
  --text-2: #475067;
  --muted: #7a8398;
  --grid: #e7e9ef;
  --axis: #c8ccd6;

  --nacre-1: #0ea5e9;
  --nacre-2: #8b5cf6;
  --nacre-3: #ec4899;
  --accent: #6d4ae0;
  --accent-ink: #ffffff;
  --accent-soft: rgba(109, 74, 224, 0.09);
  --accent-line: rgba(109, 74, 224, 0.28);

  --rig-1: #2a78d6;
  --rig-2: #1baf7a;
  --rig-1-soft: rgba(42, 120, 214, 0.10);
  --rig-2-soft: rgba(27, 175, 122, 0.10);

  --good: #0ca30c;
  --good-text: #006300;
  --good-soft: rgba(12, 163, 12, 0.10);
  --warn: #fab219;
  --warn-text: #8a5a00;
  --warn-soft: rgba(250, 178, 25, 0.14);
  --crit: #d03b3b;
  --crit-soft: rgba(208, 59, 59, 0.10);

  --seq-hi: #5b3fd0;
  --seq-lo: #f3f0fe;

  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 10px 30px -18px rgba(15, 23, 42, 0.22);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #070b14;
    --surface: #0e1421;
    --surface-2: #121a2a;
    --surface-3: #182236;
    --border: rgba(255, 255, 255, 0.07);
    --border-strong: rgba(255, 255, 255, 0.14);
    --text: #eef2f9;
    --text-2: #aab4c8;
    --muted: #707b92;
    --grid: #1a2334;
    --axis: #2a3549;
    --nacre-1: #7dd3fc;
    --nacre-2: #c4b5fd;
    --nacre-3: #f9a8d4;
    --accent: #a78bfa;
    --accent-ink: #120a2e;
    --accent-soft: rgba(167, 139, 250, 0.12);
    --accent-line: rgba(167, 139, 250, 0.35);
    --rig-1: #3987e5;
    --rig-2: #199e70;
    --rig-1-soft: rgba(57, 135, 229, 0.14);
    --rig-2-soft: rgba(25, 158, 112, 0.14);
    --good-text: #3ecf3e;
    --good-soft: rgba(12, 163, 12, 0.16);
    --warn-text: #fbc14a;
    --warn-soft: rgba(250, 178, 25, 0.14);
    --crit-soft: rgba(208, 59, 59, 0.16);
    --seq-hi: #6a4fd6;
    --seq-lo: #131a2c;
    --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 16px 40px -24px rgba(0, 0, 0, 0.8);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #070b14;
  --surface: #0e1421;
  --surface-2: #121a2a;
  --surface-3: #182236;
  --border: rgba(255, 255, 255, 0.07);
  --border-strong: rgba(255, 255, 255, 0.14);
  --text: #eef2f9;
  --text-2: #aab4c8;
  --muted: #707b92;
  --grid: #1a2334;
  --axis: #2a3549;
  --nacre-1: #7dd3fc;
  --nacre-2: #c4b5fd;
  --nacre-3: #f9a8d4;
  --accent: #a78bfa;
  --accent-ink: #120a2e;
  --accent-soft: rgba(167, 139, 250, 0.12);
  --accent-line: rgba(167, 139, 250, 0.35);
  --rig-1: #3987e5;
  --rig-2: #199e70;
  --rig-1-soft: rgba(57, 135, 229, 0.14);
  --rig-2-soft: rgba(25, 158, 112, 0.14);
  --good-text: #3ecf3e;
  --good-soft: rgba(12, 163, 12, 0.16);
  --warn-text: #fbc14a;
  --warn-soft: rgba(250, 178, 25, 0.14);
  --crit-soft: rgba(208, 59, 59, 0.16);
  --seq-hi: #6a4fd6;
  --seq-lo: #131a2c;
  --shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset, 0 16px 40px -24px rgba(0, 0, 0, 0.8);
}

/* ---------------------------------------------------------------- base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  min-height: 100vh;
  overflow-x: hidden;
}
.glow {
  position: fixed; inset: 0 0 auto 0; height: 520px; pointer-events: none; z-index: 0;
  background:
    radial-gradient(600px 260px at 12% -40px, color-mix(in oklab, var(--nacre-1) 18%, transparent), transparent 70%),
    radial-gradient(520px 240px at 55% -80px, color-mix(in oklab, var(--nacre-2) 16%, transparent), transparent 70%),
    radial-gradient(520px 240px at 92% -60px, color-mix(in oklab, var(--nacre-3) 12%, transparent), transparent 70%);
  opacity: .9;
}
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
a { color: inherit; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
h2 { font-size: 15px; font-weight: 650; margin: 0; letter-spacing: -.005em; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* ---------------------------------------------------------------- topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px max(16px, calc((100vw - 1280px) / 2 + 16px));
  background: color-mix(in oklab, var(--bg) 78%, transparent);
  backdrop-filter: saturate(1.4) blur(14px);
  -webkit-backdrop-filter: saturate(1.4) blur(14px);
  border-bottom: 1px solid var(--border);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.pearl { width: 34px; height: 34px; flex: none; filter: drop-shadow(0 4px 10px color-mix(in oklab, var(--nacre-2) 40%, transparent)); }
.brand-name { font-weight: 700; font-size: 16px; letter-spacing: -.01em; }
.brand-sub { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 11px;
  border-radius: 999px; background: var(--surface); border: 1px solid var(--border);
  font-size: 12.5px; color: var(--text-2); white-space: nowrap; font-variant-numeric: tabular-nums;
}
.chip b { color: var(--text); font-weight: 650; }
.chip.live .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.chip.live.ok .dot { background: var(--good); box-shadow: 0 0 0 0 color-mix(in oklab, var(--good) 60%, transparent); animation: pulse 2s infinite; }
.chip.live.stale .dot { background: var(--warn); }
.chip.live.err .dot { background: var(--crit); }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }
.icon-btn {
  width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border); cursor: pointer; color: var(--text-2);
}
.icon-btn:hover { color: var(--text); border-color: var(--border-strong); }
.icon-btn.sm { width: 30px; height: 30px; font-size: 18px; line-height: 1; }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }
.i-moon { display: none; }
:root[data-theme="dark"] .i-sun { display: none; }
:root[data-theme="dark"] .i-moon { display: block; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .i-sun { display: none; }
  :root:not([data-theme="light"]) .i-moon { display: block; }
}

/* ---------------------------------------------------------------- layout */
.wrap { position: relative; z-index: 1; max-width: 1280px; margin: 0 auto; padding: 20px 16px 48px; }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 18px 20px; min-width: 0;
}
.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 0 2px 12px; flex-wrap: wrap; }
.section-note { color: var(--muted); font-size: 12.5px; }
.two-col { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; }
.two-col > div { min-width: 0; }

.banner {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 16px;
  border-radius: var(--radius-sm); border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--text);
}
.banner .b-icon { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); flex: none; }
.banner.warn { border-color: color-mix(in oklab, var(--warn) 45%, transparent); background: var(--warn-soft); }

/* ---------------------------------------------------------------- contador de la granja */
.farm-clock {
  position: relative; overflow: hidden; margin-bottom: 16px;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(240px, auto); gap: 18px 32px; align-items: center;
  background:
    radial-gradient(420px 160px at 0% 0%, color-mix(in oklab, var(--nacre-1) 12%, transparent), transparent 70%),
    radial-gradient(420px 180px at 100% 100%, color-mix(in oklab, var(--nacre-3) 10%, transparent), transparent 70%),
    var(--surface);
}
.farm-clock::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--nacre-1), var(--nacre-2), var(--nacre-3));
}
.fc-digits { display: flex; align-items: stretch; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.fc-seg {
  display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 78px;
  padding: 8px 12px 6px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border);
}
.fc-seg b { font-size: 40px; font-weight: 700; letter-spacing: -.02em; line-height: 1.05; font-variant-numeric: tabular-nums; }
.fc-seg span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; font-weight: 600; }
.fc-seg.days b {
  background: linear-gradient(120deg, var(--nacre-1), var(--nacre-2) 55%, var(--nacre-3));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.fc-sub { margin-top: 10px; font-size: 13px; color: var(--text-2); }
.fc-rigs { display: grid; gap: 8px; }
.fc-rig {
  display: grid; grid-template-columns: 12px minmax(0, 1fr) auto; gap: 10px; align-items: center;
  padding: 9px 12px; border-radius: 10px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px;
}
.fc-rig .sw { width: 10px; height: 10px; border-radius: 3px; }
.fc-rig .nm { color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fc-rig b { font-variant-numeric: tabular-nums; font-weight: 650; white-space: nowrap; }
.fc-rig .st { font-size: 11px; color: var(--muted); margin-left: 6px; font-weight: 500; }

/* ---------------------------------------------------------------- hero row */
.hero-grid { display: grid; grid-template-columns: 1.25fr 1fr .9fr; gap: 16px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--text-2); display: flex; align-items: center; gap: 8px; }
.eyebrow .pill { font-weight: 600; }
.hero-value { font-size: 52px; font-weight: 650; letter-spacing: -.03em; line-height: 1.05; margin: 10px 0 4px; }
.hero-value .unit { font-size: 20px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin-left: 6px; }
.hero-sub { color: var(--text-2); font-size: 13px; }
.hero { position: relative; overflow: hidden; }
.hero::after {
  content: ""; position: absolute; left: 0; right: 0; top: 0; height: 3px;
  background: linear-gradient(90deg, var(--nacre-1), var(--nacre-2), var(--nacre-3));
}
.progress { height: 6px; border-radius: 999px; background: var(--surface-3); overflow: hidden; margin-top: 14px; }
.progress > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--nacre-1), var(--nacre-2), var(--nacre-3)); }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 6px; gap: 8px; }
.mini-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.mini-stats .k { font-size: 11.5px; color: var(--muted); }
.mini-stats .v { font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; }

.rent { background:
  linear-gradient(160deg, color-mix(in oklab, var(--accent) 10%, var(--surface)), var(--surface) 60%); border-color: var(--accent-line); }
.rent-value { font-size: 40px; font-weight: 650; letter-spacing: -.025em; line-height: 1.1; margin: 10px 0 2px; }
.rent-value .unit { font-size: 17px; color: var(--muted); font-weight: 600; margin-left: 4px; }
.rent-note { font-size: 13px; color: var(--text-2); }
.rent-list { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.rent-list li { display: flex; justify-content: space-between; gap: 8px; align-items: center; font-size: 13px; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-2); border: 1px solid var(--border); }
.countdown { display: inline-flex; gap: 6px; align-items: center; margin-top: 12px; font-size: 12.5px; color: var(--text-2); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 9px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600; background: var(--surface-3); color: var(--text-2); white-space: nowrap;
}
.pill .d { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.good { background: var(--good-soft); color: var(--good-text); }
.pill.good .d { background: var(--good); }
.pill.warn { background: var(--warn-soft); color: var(--warn-text); }
.pill.warn .d { background: var(--warn); }
.pill.crit { background: var(--crit-soft); color: var(--crit); }
.pill.accent { background: var(--accent-soft); color: var(--accent); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; padding: 0 14px;
  border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13px;
}
.btn:hover { border-color: var(--text-2); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { background: transparent; }
.btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--muted); cursor: pointer; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
.link-btn:hover { color: var(--text); }

.split-bar { display: flex; gap: 2px; height: 10px; margin: 16px 0 14px; }
.split-bar i { display: block; height: 100%; }
.split-bar i:first-child { border-radius: 4px 0 0 4px; }
.split-bar i:last-child { border-radius: 0 4px 4px 0; }
.split-rows { display: grid; gap: 10px; }
.split-row { display: grid; grid-template-columns: 12px 1fr auto; align-items: center; gap: 10px; }
.split-row .sw { width: 10px; height: 10px; border-radius: 3px; }
.split-row .who { font-size: 13px; color: var(--text-2); }
.split-row .who b { color: var(--text); font-weight: 600; }
.split-row .amt { font-weight: 650; font-variant-numeric: tabular-nums; font-size: 15px; }
.split-row .amt small { color: var(--muted); font-weight: 500; font-size: 11.5px; margin-left: 4px; }

/* ---------------------------------------------------------------- KPI tiles */
.kpis { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-top: 16px; }
.kpi { padding: 14px 16px; }
.kpi .label { font-size: 12px; color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi .value { font-size: 22px; font-weight: 650; letter-spacing: -.015em; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi .value .unit { font-size: 13px; color: var(--muted); font-weight: 600; margin-left: 3px; }
.kpi .sub { font-size: 12px; color: var(--muted); margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meter { height: 6px; border-radius: 999px; background: color-mix(in oklab, var(--accent) 14%, var(--surface-3)); margin-top: 8px; overflow: hidden; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 999px; }

/* ---------------------------------------------------------------- rigs */
.rigs { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.rig { position: relative; overflow: hidden; }
.rig-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rig-name { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 16px; letter-spacing: -.01em; min-width: 0; }
.rig-name .sw { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.rig-meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.rig-body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: 16px; margin-top: 14px; align-items: end; }
.rig-hr { font-size: 34px; font-weight: 650; letter-spacing: -.02em; line-height: 1.1; white-space: nowrap; }
.rig-hr .unit { font-size: 15px; color: var(--muted); margin-left: 4px; font-weight: 600; }
.rig-hr-sub { font-size: 12px; color: var(--muted); }
.spark { width: 100%; height: 64px; display: block; }
.rig-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); }
.rig-stats .k { font-size: 11.5px; color: var(--muted); }
.rig-stats .v { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rig.waiting .rig-body { opacity: .55; }
.uptime-bar { margin-top: 14px; }
.uptime-bar .track { display: flex; gap: 2px; height: 18px; }
.uptime-bar .track i { flex: 1; border-radius: 3px; background: var(--surface-3); }
.uptime-bar .track i.on { background: var(--rig-c); }
.uptime-bar .track i.part { background: color-mix(in oklab, var(--rig-c) 45%, var(--surface-3)); }
.uptime-bar .cap { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); margin-top: 4px; }

/* ---------------------------------------------------------------- charts */
.charts { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; }
.chart-card { padding-bottom: 12px; }
.chart-title { font-size: 13px; font-weight: 600; }
.chart-box { position: relative; height: 260px; margin-top: 8px; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 8px; font-size: 12px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.seg { display: inline-flex; padding: 3px; border-radius: 10px; background: var(--surface); border: 1px solid var(--border); }
.seg-btn { border: 0; background: transparent; padding: 4px 12px; border-radius: 7px; cursor: pointer; font-size: 12.5px; color: var(--text-2); font-weight: 600; }
.seg-btn.active { background: var(--surface-3); color: var(--text); }

/* ---------------------------------------------------------------- calendar */
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-title { font-weight: 650; min-width: 132px; text-align: center; }
.cal-card { padding: 16px; }
.cal-month { display: flex; flex-wrap: wrap; gap: 10px 26px; padding: 2px 4px 14px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.cal-month .k { font-size: 11.5px; color: var(--muted); }
.cal-month .v { font-size: 17px; font-weight: 650; font-variant-numeric: tabular-nums; }
.cal-month .v .unit { font-size: 12px; color: var(--muted); margin-left: 3px; font-weight: 600; }
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)) minmax(150px, 1.35fr); gap: 6px; }
.cal-h { font-size: 11.5px; color: var(--muted); font-weight: 600; text-align: center; padding: 2px 0 4px; text-transform: capitalize; }
.cal-h.wkh { text-align: left; padding-left: 10px; }
.day {
  position: relative; min-height: 84px; border-radius: 10px; padding: 7px 8px 8px; border: 1px solid var(--border);
  background: color-mix(in oklab, var(--seq-hi) calc(var(--heat, 0) * 1%), var(--seq-lo));
  display: flex; flex-direction: column; gap: 2px; cursor: default; min-width: 0;
}
.day.out { background: transparent; border-style: dashed; opacity: .45; }
.day.pre { background: repeating-linear-gradient(135deg, transparent 0 6px, var(--surface-3) 6px 7px); }
.day.future { background: var(--surface-2); }
.day.today { outline: 2px solid var(--accent); outline-offset: -1px; }
.day .dn { font-size: 12px; font-weight: 650; color: var(--text-2); display: flex; justify-content: space-between; align-items: center; }
.day .dp { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; margin-top: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.day .dp small { font-size: 10.5px; color: var(--muted); font-weight: 600; margin-left: 2px; }
.day.hot .dn, .day.hot .dp, .day.hot .dp small { color: #fff; }
.day .ups { display: grid; gap: 2px; margin-top: 4px; }
.day .ups { gap: 3px; }
.day .ups i { display: block; height: 7px; padding: 1.5px; border-radius: 4px; background: color-mix(in oklab, var(--surface) 88%, transparent); overflow: hidden; }
.day .ups i b { display: block; height: 100%; border-radius: 2px; background: var(--c); }
.day .gem { width: 12px; height: 12px; color: var(--accent); }
.day.hot .gem { color: #fff; }
.wk {
  border-radius: 10px; padding: 8px 10px; background: var(--surface-2); border: 1px solid var(--border);
  display: flex; flex-direction: column; justify-content: center; gap: 2px; min-width: 0;
}
.wk .wl { font-size: 11px; color: var(--muted); }
.wk .wv { font-size: 14px; font-weight: 650; font-variant-numeric: tabular-nums; }
.wk .wr { font-size: 12px; color: var(--text-2); font-variant-numeric: tabular-nums; }
.wk.close { border-color: var(--accent-line); background: var(--accent-soft); }
.wk.cont { opacity: .8; }
.wk.empty { visibility: hidden; }
.cal-legend { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-top: 12px; font-size: 12px; color: var(--muted); }
.cal-legend .ramp { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .ramp i { width: 64px; height: 8px; border-radius: 4px; background: linear-gradient(90deg, var(--seq-lo), var(--seq-hi)); border: 1px solid var(--border); }
.cal-legend .k { display: inline-flex; align-items: center; gap: 6px; }
.cal-legend .k i { width: 14px; height: 3px; border-radius: 2px; }

/* ---------------------------------------------------------------- tables */
.table-card { padding: 4px 0; }
.table-scroll { overflow-x: auto; }
.table-scroll.tall { max-height: 460px; overflow-y: auto; }
.table-scroll.tall thead th { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-weight: 600; font-size: 11.5px; color: var(--muted); padding: 10px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.tbl td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; white-space: nowrap; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl .r { text-align: right; font-variant-numeric: tabular-nums; }
.tbl tr.current td { background: color-mix(in oklab, var(--accent) 5%, transparent); }
.tbl tfoot td { font-weight: 650; border-top: 1px solid var(--border-strong); }
.tbl .strong { font-weight: 650; }
.tbl .empty { text-align: center; color: var(--muted); padding: 22px; white-space: normal; }
.txid { font-family: var(--mono); font-size: 12px; color: var(--text-2); }
.copy { border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px 4px; border-radius: 6px; }
.copy:hover { color: var(--text); background: var(--surface-3); }

/* ---------------------------------------------------------------- footer */
.foot { margin-top: 36px; padding-top: 16px; border-top: 1px solid var(--border); color: var(--muted); font-size: 12px; display: flex; flex-wrap: wrap; gap: 8px 18px; justify-content: space-between; }
.foot .errs { color: var(--crit); }

/* ---------------------------------------------------------------- dialog + tooltip */
.dialog { border: 1px solid var(--border-strong); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 22px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 30px 80px -20px rgba(0,0,0,.45); }
.dialog::backdrop { background: rgba(3, 6, 14, .55); backdrop-filter: blur(3px); }
.dialog h3 { margin: 0 0 4px; font-size: 17px; }
.dialog p { margin: 0 0 14px; font-size: 13px; }
.dialog label { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 12px; }
.dialog input { height: 38px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--surface-2); color: var(--text); padding: 0 12px; font: inherit; font-size: 14px; }
.dialog input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.form-error { color: var(--crit); min-height: 1em; font-size: 12.5px; margin: 0 0 6px !important; }
.tooltip {
  position: fixed; z-index: 50; pointer-events: none; opacity: 0; transition: opacity .12s;
  background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); border-radius: 10px;
  padding: 8px 10px; font-size: 12px; box-shadow: 0 12px 30px -12px rgba(0,0,0,.35); max-width: 260px;
}
.tooltip.show { opacity: 1; }
.tooltip .tt-h { font-weight: 650; margin-bottom: 4px; }
.tooltip .tt-r { display: flex; align-items: center; gap: 6px; justify-content: space-between; font-variant-numeric: tabular-nums; }
.tooltip .tt-r i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; }

.skeleton { color: transparent !important; background: var(--surface-3); border-radius: 6px; }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) {
  .hero-grid { grid-template-columns: 1fr 1fr; }
  .hero { grid-column: 1 / -1; }
  .kpis { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .charts { grid-template-columns: 1fr; }
  .two-col { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .rigs { grid-template-columns: 1fr; }
  .farm-clock { grid-template-columns: 1fr; }
  .cal { grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px; }
  .cal-h.wkh { display: none; }
  .wk.empty { display: none; }
  .wk { grid-column: 1 / -1; flex-direction: row; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 6px 10px; }
  .day { min-height: 58px; padding: 5px; border-radius: 8px; }
  .day .dp { font-size: 11.5px; }
  .day .dp small { display: none; }
  .day .ups { display: none; }
}
@media (max-width: 640px) {
  .hero-grid { grid-template-columns: 1fr; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hero-value { font-size: 44px; }
  .rent-value { font-size: 34px; }
  .rig-body { grid-template-columns: 1fr; }
  .rig-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chip#priceChip { display: none; }
  .brand-sub { display: none; }
  .card { padding: 16px; }
  .day .dp { font-size: 10.5px; }
  .fc-digits { gap: 6px; flex-wrap: nowrap; }
  .fc-seg { min-width: 0; flex: 1; padding: 6px 4px 4px; }
  .fc-seg b { font-size: 28px; }
  .fc-seg span { font-size: 10px; letter-spacing: .03em; }
}
@media (prefers-reduced-motion: reduce) { .chip.live.ok .dot { animation: none; } }
