:root {
  color-scheme: dark;
  --bg: #09100f;
  --surface: rgba(20, 31, 29, 0.84);
  --surface-strong: #172522;
  --line: rgba(208, 230, 224, 0.12);
  --text: #edf5f1;
  --muted: #93a8a2;
  --accent: #79e7ae;
  --accent-strong: #2acb79;
  --blue: #7fc9ff;
  --amber: #f3c86b;
  --danger: #ff8f86;
  --radius: 22px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-synthesis: none;
}

html[data-theme="light"] {
  color-scheme: light;
  --bg: #edf4f1;
  --surface: rgba(255, 255, 255, 0.88);
  --surface-strong: #ffffff;
  --line: rgba(20, 55, 44, 0.14);
  --text: #14211d;
  --muted: #667b74;
  --accent: #168a55;
  --accent-strong: #087343;
  --blue: #2676a8;
  --amber: #9b6812;
  --danger: #b7443b;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background: linear-gradient(135deg, #0c2b20 0%, #061912 34%, #030b08 66%, #000101 100%);
  letter-spacing: -0.012em;
}

html[data-theme="light"] body {
  background:
    radial-gradient(circle at 10% -10%, rgba(39, 175, 111, 0.11), transparent 34rem),
    linear-gradient(145deg, #f6faf8 0%, #eaf1ee 72%);
}

button, a { -webkit-tap-highlight-color: transparent; }

a { color: inherit; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: -5rem;
  z-index: 20;
  padding: .75rem 1rem;
  border-radius: 10px;
  background: var(--accent);
  color: #07100d;
  font-weight: 750;
}

.skip-link:focus { top: 1rem; }

.ambient {
  position: fixed;
  z-index: -1;
  width: 20rem;
  aspect-ratio: 1;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .08;
  pointer-events: none;
}

.ambient-one { top: 25%; right: -8rem; background: var(--accent); }
.ambient-two { bottom: -8rem; left: -5rem; background: var(--blue); }

.site-header, main, footer { width: min(1180px, calc(100% - 2rem)); margin-inline: auto; }

.site-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px auto;
  grid-template-rows: 64px;
  align-items: center;
  column-gap: 1.25rem;
  min-height: 96px;
  padding: 1rem 0;
  border-bottom: 1px solid var(--line);
}

.header-brand { grid-column: 1; grid-row: 1; display: flex; min-width: 0; align-items: center; text-decoration: none; }
.header-brand img { display: block; width: 100%; max-width: 100%; height: 64px; object-fit: contain; object-position: left center; }

.header-power { grid-column: 2; grid-row: 1; align-self: end; }
.header-actions { display: flex; grid-column: 3; grid-row: 1; flex-direction: column; align-items: flex-end; align-self: end; min-width: 0; max-width: 48vw; overflow-x: auto; scrollbar-width: none; }
.header-actions::-webkit-scrollbar { display: none; }
.header-actions-inner { display: flex; justify-content: flex-end; gap: .42rem; min-width: max-content; }
.header-user-welcome { margin: 0 0 .32rem; color: var(--muted); font: 650 .7rem/1 ui-monospace, monospace; white-space: nowrap; }
.header-user-welcome strong { color: var(--text); font-weight: 750; }

@media (min-width: 681px) {
  .site-header { grid-template-columns: 505px 48px minmax(0, 1fr); }
  .header-actions { max-width: none; }
}

.header-button {
  display: grid;
  width: 48px;
  height: 48px;
  flex: 0 0 48px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 14px;
  color: var(--text);
  background: transparent;
  cursor: pointer;
  text-decoration: none;
  transition: border-color .18s ease, background-color .18s ease, transform .18s ease;
}

.header-button:hover { border-color: var(--line); background: rgba(255, 255, 255, .09); }
.header-button:active { transform: scale(.94); }
.header-button:disabled { cursor: not-allowed; opacity: .45; }
.header-button:disabled:hover { border-color: transparent; background: transparent; }
.header-button.is-unavailable { opacity: .36; }
.header-button.is-unavailable img { filter: brightness(0) invert(1); opacity: .65; }
.header-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.header-button.is-active { border-color: rgba(255, 255, 255, .38); background: rgba(255, 255, 255, .12); }
.header-button img { width: 24px; height: 24px; object-fit: contain; filter: brightness(0) invert(1); opacity: 1; }
.header-button.is-active img { filter: brightness(0) invert(1); opacity: 1; }
html[data-theme="light"] .header-button img,
html[data-theme="light"] .header-button.is-active img { filter: brightness(0); opacity: 1; }
html[data-theme="light"] .header-button:hover { background: rgba(0, 0, 0, .05); }
html[data-theme="light"] .header-button.is-unavailable img { filter: brightness(0); }
html[data-theme="light"] .header-button.is-active { border-color: rgba(0, 0, 0, .25); background: rgba(0, 0, 0, .06); }

.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

.status-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }
.status-heading h1 { margin: 0; font-size: 32px; line-height: 1; letter-spacing: -.035em; }
.status-heading p { margin: 0; color: var(--muted); font: 650 .74rem/1 ui-monospace, monospace; }
.status-grid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; }
.status-card { --state: #ef7a7a; position: relative; min-height: 182px; padding: 1.35rem; overflow: hidden; border: 1px solid color-mix(in srgb, var(--state) 26%, var(--line)); border-radius: var(--radius); background: radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--state) 12%, transparent), transparent 42%), radial-gradient(circle at 4% 100%, rgba(78, 187, 143, .08), transparent 46%), linear-gradient(135deg, rgba(31, 49, 44, .88), rgba(10, 17, 16, .84)); box-shadow: 0 20px 48px rgba(0, 0, 0, .20), inset 0 1px 0 rgba(255,255,255,.055); backdrop-filter: blur(10px); }
.status-card::before { position: absolute; inset: 0 auto 0 0; width: 4px; border-radius: inherit 0 0 inherit; background: var(--state); content: ""; }
.state-good { --state: #62d394; }
.state-warn { --state: #e4ba5d; }
.state-bad { --state: #ef7a7a; }
.status-card-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.status-card h2 { margin: 0; font-size: .94rem; letter-spacing: -.015em; }
.state-badge, .chart-range { padding: .3rem .5rem; border-radius: 999px; color: var(--state); background: color-mix(in srgb, var(--state) 12%, transparent); font: 750 .66rem/1 ui-monospace, monospace; letter-spacing: .08em; }
.chart-range { --state: var(--muted); letter-spacing: 0; }
.status-value { display: inline-block; margin: 1.65rem 0 .8rem; font-size: clamp(2.3rem, 5vw, 3.65rem); line-height: .8; letter-spacing: -.07em; }
.status-unit { margin-left: .3rem; color: var(--muted); font: 700 1rem/1 ui-monospace, monospace; }
.status-detail { margin: 0; color: var(--muted); font-size: .74rem; line-height: 1.5; }
.metrics-overview-card { --state: var(--accent); grid-column: span 12; min-height: 320px; padding: 1rem 1.35rem; border-color: rgba(121, 231, 174, .23); background: radial-gradient(circle at 0% 100%, rgba(121, 231, 174, .11), transparent 52%), linear-gradient(135deg, rgba(26, 44, 39, .98), rgba(10, 18, 17, .97)); }
.metrics-overview-card::before { display: none; }
.metrics-list { display: grid; margin: 0; }
.metric-row { --state: var(--accent); position: relative; display: grid; grid-template-columns: minmax(120px, .8fr) minmax(0, 1.6fr); column-gap: 1rem; align-items: baseline; min-width: 0; padding: .78rem 0 .78rem 1.2rem; border-bottom: 1px solid var(--line); }
.metric-row::before { position: absolute; top: 50%; left: .12rem; width: .42rem; height: .42rem; border-radius: 50%; background: var(--state); box-shadow: 0 0 0 .2rem color-mix(in srgb, var(--state) 13%, transparent), 0 0 .72rem color-mix(in srgb, var(--state) 72%, transparent); content: ""; transform: translateY(-50%); }
.metric-row:last-child { border-bottom: 0; }
.metric-row dt { color: var(--muted); font-size: .9rem; font-weight: 720; }
.metric-row dd { min-width: 0; margin: 0; color: var(--state); font: 720 .9rem/1.35 ui-monospace, SFMono-Regular, Consolas, monospace; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.metric-row.event-row dd { color: var(--text); }
.chart-card { --state: var(--accent); grid-column: span 12; min-height: 320px; border-color: rgba(127, 201, 255, .22); background: radial-gradient(circle at 100% 100%, rgba(127, 201, 255, .13), transparent 52%), radial-gradient(circle at 0% 0%, rgba(121, 231, 174, .08), transparent 40%), linear-gradient(135deg, rgba(24, 38, 40, .98), rgba(9, 16, 17, .97)); }
.chart-card::before { display: none; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1rem 0 .6rem; color: var(--muted); font-size: .72rem; }
.chart-legend span { display: inline-flex; align-items: center; gap: .4rem; }
.chart-legend i { width: 18px; height: 3px; border-radius: 99px; }
.temperature-line { background: #ef7a7a; }
.cpu-line { background: #62d394; }
#metrics-chart { display: block; width: 100%; height: 220px; }
html[data-theme="light"] .status-card { background: linear-gradient(145deg, rgba(255,255,255,.96), rgba(238,246,242,.94)); box-shadow: 0 18px 50px rgba(31,70,57,.08); }

.auth-main { display: grid; min-height: calc(100vh - 196px); place-items: start center; }
.auth-card { width: min(100%, 580px); padding: clamp(1.5rem, 5vw, 2.5rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 18px 50px rgba(0,0,0,.12); }
.auth-card h1 { margin: 0; font-size: clamp(2rem, 6vw, 3rem); }
.auth-card label { display: block; margin: .85rem 0 .5rem; color: var(--text); font-size: 1.05rem; font-weight: 750; }
.auth-card input { width: 100%; min-height: 48px; padding: .75rem .9rem; border: 1px solid var(--line); border-radius: 12px; color: var(--text); background: rgba(255,255,255,.05); font: inherit; }
.nickname-row { display: flex; gap: .7rem; }
.nickname-row input { min-width: 0; }
.nickname-row .auth-button { flex: 0 0 auto; }
.auth-actions { display: flex; flex-wrap: wrap; gap: .7rem; margin-top: 1rem; }
.auth-button { min-height: 44px; padding: .7rem 1rem; border: 0; border-radius: 12px; color: #07100d; background: var(--accent); cursor: pointer; font: 750 .85rem/1 inherit; }
.auth-button.secondary { color: var(--text); background: rgba(255,255,255,.1); }
.login-button { width: 100%; min-height: 54px; font-size: 1.05rem; }
.auth-button:disabled { cursor: wait; opacity: .6; }
.auth-message { min-height: 0; margin: .65rem 0 0; color: var(--accent); font-size: .85rem; }
.auth-message:empty { display: none; }
.auth-message.is-error { color: var(--danger); }
.auth-user { margin: 1.5rem 0 1rem; color: var(--text); font-weight: 700; }
html[data-theme="light"] .auth-card { background: rgba(255,255,255,.88); box-shadow: 0 18px 50px rgba(31,70,57,.08); }
html[data-theme="light"] .auth-card input { background: rgba(20,55,44,.04); }
html[data-theme="light"] .auth-button.secondary { background: rgba(20,55,44,.1); }

main { padding: clamp(2.5rem, 7vw, 5.5rem) 0 2rem; }

.hero { display: flex; align-items: flex-end; justify-content: space-between; gap: 2rem; margin-bottom: 2.25rem; }
.eyebrow, .card-label { margin: 0 0 .62rem; color: var(--accent); font: 720 .67rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .16em; }
h1 { max-width: 740px; margin: 0; font-size: clamp(2.25rem, 7vw, 4.55rem); line-height: .98; letter-spacing: -.055em; }
.hero-copy { max-width: 650px; margin: 1.2rem 0 0; color: var(--muted); font-size: clamp(.95rem, 2vw, 1.05rem); line-height: 1.7; }
.updated { flex: 0 0 auto; padding-bottom: .35rem; text-align: right; }
.updated span, .updated strong { display: block; }
.updated span { margin-bottom: .35rem; color: var(--muted); font-size: .72rem; }
.updated strong { font: 650 .86rem/1.2 ui-monospace, SFMono-Regular, Consolas, monospace; }

.error-banner { margin-bottom: 1rem; padding: .85rem 1rem; border: 1px solid rgba(255, 143, 134, .25); border-radius: 14px; color: #ffd2ce; background: rgba(108, 36, 32, .28); font-size: .88rem; }

.dashboard { display: grid; grid-template-columns: repeat(12, 1fr); gap: 1rem; }
.card {
  position: relative;
  overflow: hidden;
  min-height: 230px;
  padding: clamp(1.25rem, 3vw, 1.65rem);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(24, 39, 36, .94), rgba(15, 24, 23, .9));
  box-shadow: 0 18px 50px rgba(0, 0, 0, .12);
}

.card::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(120deg, rgba(255,255,255,.025), transparent 35%); }
.card h2 { margin: 0; font-size: 1rem; letter-spacing: -.015em; }
.card-heading, .metric-title { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; }
.card-note { margin: auto 0 0; color: var(--muted); font-size: .74rem; line-height: 1.45; }
.pill { padding: .35rem .6rem; border-radius: 99px; color: var(--accent); background: rgba(121, 231, 174, .09); font-size: .68rem; font-weight: 720; }

html[data-theme="light"] .card { background: linear-gradient(145deg, rgba(255, 255, 255, .96), rgba(238, 246, 242, .94)); box-shadow: 0 18px 50px rgba(31, 70, 57, .08); }
html[data-theme="light"] .temperature-card { background: radial-gradient(circle at 85% 115%, rgba(44, 209, 126, .14), transparent 50%), linear-gradient(145deg, #ffffff, #edf7f2); }
html[data-theme="light"] .uptime-card { background: linear-gradient(145deg, #ffffff, #edf3f5); }
html[data-theme="light"] .temperature-track,
html[data-theme="light"] .progress { background: rgba(20, 55, 44, .1); }
html[data-theme="light"] .error-banner { color: #8a2922; background: rgba(207, 79, 69, .1); }

.temperature-card { grid-column: span 6; display: flex; flex-direction: column; min-height: 300px; background: radial-gradient(circle at 85% 115%, rgba(44, 209, 126, .2), transparent 50%), linear-gradient(145deg, rgba(25, 43, 38, .97), rgba(14, 24, 21, .92)); }
.temperature-value { display: flex; align-items: flex-start; margin: 2rem 0 1.5rem; }
.temperature-value strong { font-size: clamp(4.6rem, 10vw, 7rem); line-height: .75; letter-spacing: -.075em; }
.temperature-value span { margin: -.18rem 0 0 .45rem; color: var(--muted); font: 650 1.2rem/1 ui-monospace, monospace; }
.temperature-track, .progress { overflow: hidden; height: 5px; border-radius: 99px; background: rgba(255,255,255,.075); }
.temperature-track span, .progress span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent-strong), var(--accent)); transition: width .55s ease; }

.metric-card { grid-column: span 3; display: flex; flex-direction: column; }
.metric-icon { display: grid; width: 38px; height: 38px; margin-bottom: 1.2rem; place-items: center; border-radius: 11px; font: 760 .6rem/1 ui-monospace, monospace; letter-spacing: .04em; }
.cpu-icon { color: var(--accent); background: rgba(121,231,174,.1); }
.memory-icon { color: var(--blue); background: rgba(127,201,255,.1); }
.storage-icon { color: var(--amber); background: rgba(243,200,107,.1); }
.metric-title span { color: var(--muted); font: 600 .7rem/1.2 ui-monospace, monospace; }
.metric-value { margin: 1.45rem 0 .8rem; font-size: 2.35rem; letter-spacing: -.06em; }
.metric-card .card-note { margin-top: .8rem; }

.load-card { grid-column: span 6; display: flex; flex-direction: column; }
.load-values { display: grid; grid-template-columns: repeat(3, 1fr); margin: 2.2rem 0 1.5rem; }
.load-values div { padding-right: 1rem; }
.load-values div + div { padding-left: 1.25rem; border-left: 1px solid var(--line); }
.load-values strong, .load-values span { display: block; }
.load-values strong { font-size: 1.9rem; letter-spacing: -.05em; }
.load-values span { margin-top: .35rem; color: var(--muted); font-size: .68rem; }

.network-card { grid-column: span 3; display: flex; flex-direction: column; }
.network-values { display: grid; gap: 1.15rem; margin: 1.65rem 0; }
.network-values > div { display: flex; align-items: center; gap: .8rem; }
.network-values small, .network-values strong { display: block; }
.network-values small { margin-bottom: .25rem; color: var(--muted); font-size: .68rem; }
.network-values strong { font: 680 .95rem/1.1 ui-monospace, monospace; }
.direction { display: grid; width: 32px; height: 32px; place-items: center; border-radius: 10px; }
.direction.down { color: var(--accent); background: rgba(121,231,174,.09); }
.direction.up { color: var(--blue); background: rgba(127,201,255,.09); }

.uptime-card { grid-column: span 3; display: flex; flex-direction: column; background: linear-gradient(145deg, rgba(28, 41, 47, .95), rgba(15, 24, 26, .9)); }
.uptime-card > strong { margin: 2.5rem 0 1rem; font-size: clamp(2rem, 4vw, 3rem); letter-spacing: -.06em; }

.site-footer { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .75rem; width: min(1180px, calc(100% - 2rem)); min-height: 100px; margin-inline: auto; color: #9fb7b0; font: 650 .72rem/1.4 ui-monospace, SFMono-Regular, Consolas, monospace; }
.site-footer a { color: inherit; text-decoration: none; }
.site-footer a:hover, .site-footer a:focus-visible { color: var(--accent); }
.footer-separator { width: 3px; height: 3px; border-radius: 50%; background: #42534f; }

@media (min-width: 901px) {
  .metrics-overview-card { grid-column: span 7; min-height: 320px; }
  .chart-card { grid-column: span 5; }
  .chart-card h2 { font-size: .86rem; }
  .chart-legend { gap: .55rem; margin: .8rem 0 .45rem; font-size: .66rem; }
  #metrics-chart { height: 205px; }
}

@media (max-width: 900px) {
  .temperature-card { grid-column: span 8; }
  .metric-card { grid-column: span 4; }
  .load-card { grid-column: span 8; }
  .network-card, .uptime-card { grid-column: span 4; }
  .metrics-overview-card, .chart-card { grid-column: span 12; }
}

@media (max-width: 680px) {
  .site-header, main, footer { width: min(100% - 1.2rem, 1180px); }
  .site-header { grid-template-columns: minmax(0, 1fr) 48px minmax(96px, 48vw); column-gap: .65rem; min-height: 96px; }
  .header-brand img { height: 64px; }
  .header-actions-inner { gap: .25rem; }
  .header-user-welcome { margin-bottom: .28rem; font-size: .64rem; }
  .status-heading { display: block; }
  .status-heading p { margin-top: .75rem; }
  .status-grid { grid-template-columns: 1fr; }
  .metrics-overview-card, .chart-card { grid-column: 1; }
  .metrics-overview-card { padding: .8rem 1rem; }
  .metric-row { grid-template-columns: minmax(104px, .8fr) minmax(0, 1.4fr); column-gap: .7rem; }
  .metric-row dt, .metric-row dd { font-size: .8rem; }
  .nickname-row { align-items: stretch; }
  .chart-card { min-height: 290px; }
  #metrics-chart { height: 190px; }
  main { padding-top: 2.5rem; }
  .hero { display: block; }
  .updated { display: flex; align-items: center; gap: .5rem; margin-top: 1.25rem; text-align: left; }
  .updated span { margin: 0; }
  .dashboard { grid-template-columns: 1fr; }
  .temperature-card, .metric-card, .load-card, .network-card, .uptime-card { grid-column: 1; min-height: 220px; }
  .temperature-card { min-height: 275px; }
  .metric-card { min-height: 225px; }
  .uptime-card { min-height: 200px; }
}

.management-toolbar { align-items: center; }
.management-toolbar > div { display: flex; align-items: baseline; gap: 1rem; }
.management-tabs { display: flex; align-items: center; gap: .5rem; }
.management-tabs button { min-height: 34px; padding: .55rem .8rem; border: 1px solid rgba(98, 211, 148, .5); border-radius: 999px; color: var(--text); background: rgba(98, 211, 148, .12); font: 720 .72rem/1 ui-monospace, monospace; }
.admin-account-card { --state: var(--accent); grid-column: span 12; min-height: 0; }
.admin-card-note { margin: 1rem 0; color: var(--muted); font-size: .8rem; line-height: 1.55; }
.admin-message { min-height: 1.25rem; margin: 0 0 .75rem; color: var(--accent); font-size: .8rem; }
.admin-message:empty { display: none; }
.admin-message.is-error { color: var(--danger); }
.account-list { display: grid; gap: .8rem; }
.account-entry { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1rem; padding: 1rem; border: 1px solid var(--line); border-radius: 16px; background: rgba(255,255,255,.035); }
.account-entry-heading { display: flex; align-items: end; justify-content: space-between; gap: 1rem; }
.account-name-field { display: grid; gap: .42rem; color: var(--muted); font-size: .72rem; font-weight: 700; }
.account-name-field input { width: min(100%, 260px); min-height: 38px; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 10px; color: var(--text); background: rgba(255,255,255,.05); font: inherit; }
.account-role { padding: .34rem .52rem; border-radius: 999px; color: var(--accent); background: rgba(98,211,148,.11); font: 720 .66rem/1 ui-monospace, monospace; white-space: nowrap; }
.account-permissions { display: flex; flex-wrap: wrap; grid-column: 1 / -1; gap: .5rem .9rem; margin: 0; padding: .75rem 0 0; border: 0; border-top: 1px solid var(--line); }
.account-permissions legend { width: 100%; margin-bottom: .15rem; color: var(--muted); font-size: .72rem; font-weight: 700; }
.permission-control { display: inline-flex; align-items: center; gap: .42rem; color: var(--text); font-size: .78rem; cursor: pointer; }
.permission-control input { width: 1rem; height: 1rem; accent-color: var(--accent-strong); }
.account-save { align-self: end; min-height: 38px; padding: .55rem .8rem; border: 0; border-radius: 10px; color: #07100d; background: var(--accent); font: 750 .76rem/1 inherit; cursor: pointer; }
.account-save:disabled { cursor: wait; opacity: .6; }
html[data-theme="light"] .account-entry { background: rgba(20,55,44,.035); }
html[data-theme="light"] .account-name-field input { background: rgba(20,55,44,.04); }

@media (max-width: 680px) {
  .management-toolbar > div { display: block; }
  .management-tabs { margin-top: 1rem; }
  .account-entry { grid-template-columns: 1fr; }
  .account-entry-heading { align-items: start; }
  .account-save { justify-self: start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}

.dashboard-page { padding-top: clamp(1.15rem, 2.7vw, 2rem); }

/* Funding Dashboard — same status-heading and status-card system as the Pi portal. */
.funding-page { padding-top: clamp(1.15rem, 2.7vw, 2rem); }
.funding-toolbar {
  margin-bottom: 1.5rem;
}
.funding-title-group { display: flex; align-items: center; gap: 1rem; min-width: 0; }
.funding-toolbar h1 { flex: 0 0 auto; font-size: 32px; line-height: 1; letter-spacing: -.035em; }
.funding-settlement-clock { display: flex; align-items: center; flex-wrap: wrap; gap: .4rem .6rem; min-width: 0; color: var(--muted); font: 700 .7rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .035em; }
.funding-settlement-label { color: var(--text); font-size: .74rem; }
.funding-settlement-time { padding: .4rem .55rem; border: 1px solid var(--line); border-radius: 0; background: rgba(255,255,255,.035); font-size: .78rem; }
.funding-settlement-time.is-warning { color: var(--amber); }
.funding-settlement-time.is-critical { color: #ef7a7a; }
.view-switcher, .exchange-list, .card-actions { display: flex; align-items: center; gap: .5rem; }
.view-switcher { gap: .15rem; padding: .2rem; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.04); }
.view-switcher button, .card-actions button, .exchange-toggle {
  border: 1px solid transparent;
  color: var(--muted);
  font: 700 .68rem/1 ui-monospace, SFMono-Regular, Consolas, monospace;
  letter-spacing: .05em;
  cursor: pointer;
  transition: border-color .18s ease, background-color .18s ease, color .18s ease, transform .18s ease;
}
.view-switcher button, .card-actions button { min-height: 30px; padding: .5rem .65rem; border-radius: 999px; background: transparent; }
.view-switcher button[aria-pressed="true"] { color: #07100d; background: var(--accent); }
.view-switcher button:hover, .card-actions button:hover { border-color: var(--line); color: var(--text); background: rgba(255,255,255,.07); }
.view-switcher button:active, .card-actions button:active, .exchange-toggle:active { transform: scale(.97); }
.view-switcher button:focus-visible, .card-actions button:focus-visible, .exchange-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.funding-grid { grid-template-columns: repeat(12, 1fr); }
.funding-filter-card, .funding-table-card { grid-column: span 12; border-radius: 8px; }
.funding-filter-card::before, .funding-table-card::before { display: none; }
.funding-filter-card { min-height: 0; padding: 1.1rem 1.35rem; }
.funding-filter-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.card-actions { gap: .15rem; }
.card-actions button { padding-inline: .55rem; }
.exchange-list { flex-wrap: wrap; gap: .5rem; }
.exchange-toggle { display: inline-flex; align-items: center; gap: .5rem; min-height: 34px; padding: .55rem .7rem; border-color: rgba(98,211,148,.25); border-radius: 999px; background: rgba(98,211,148,.07); }
.exchange-toggle::before { width: 7px; height: 7px; border-radius: 50%; background: #52645f; content: ""; box-shadow: 0 0 0 3px rgba(82,100,95,.14); }
.exchange-toggle[aria-pressed="true"] { border-color: rgba(98,211,148,.45); color: var(--text); background: rgba(98,211,148,.12); }
.exchange-toggle[aria-pressed="true"]::before { background: var(--accent); box-shadow: 0 0 0 3px rgba(121,231,174,.14); }
.exchange-toggle:hover { border-color: rgba(121,231,174,.38); color: var(--text); }
.funding-table-card { min-height: 144px; padding: 0; overflow: hidden; }
.funding-table-wrap { overflow-x: auto; overscroll-behavior-x: contain; }
.funding-table { width: 100%; min-width: 1px; border-collapse: collapse; text-align: left; }
.funding-table th, .funding-table td { height: 56px; padding: 0 .6rem; border-bottom: 1px solid var(--line); white-space: nowrap; }
.funding-table th { color: var(--muted); font: 720 1.36rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .1em; text-align: center; text-transform: uppercase; }
.funding-table th:first-child, .funding-table td:first-child { width: 128px; color: var(--text); }
.funding-table tbody tr:last-child td { border-bottom: 0; }
.funding-table .is-hidden { display: none; }
.exchange-lock { display: inline-flex; align-items: center; gap: .35rem; margin: 0; padding: .55rem 0; border: 0; color: inherit; background: transparent; font: inherit; letter-spacing: inherit; text-transform: inherit; cursor: pointer; }
.exchange-lock:hover { color: var(--text); }
.exchange-lock[aria-pressed="true"] { color: var(--accent); text-shadow: 0 0 14px rgba(98,211,148,.28); }
.exchange-lock:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.lock-icon { display: none; width: 1em; height: 1em; flex: 0 0 1em; background: currentColor; -webkit-mask: url("/assets/icons/lock.svg") center / contain no-repeat; mask: url("/assets/icons/lock.svg") center / contain no-repeat; }
.exchange-lock[aria-pressed="true"] .lock-icon { display: inline-block; }
.funding-spread-sort { display: inline-flex; flex-direction: column; align-items: center; gap: .08rem; margin: 0; padding: .35rem 0; border: 0; color: inherit; background: transparent; font: 720 .78rem/1.05 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .08em; text-transform: inherit; cursor: pointer; }
.funding-spread-sort:hover { color: var(--text); }
.funding-spread-sort:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }
.funding-spread-column, .funding-spread-cell { box-sizing: border-box; width: 154px; min-width: 154px; max-width: 154px; text-align: center; }
.funding-table tbody th { color: var(--text); font: 700 .78rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .04em; text-align: left; }
.funding-cell { min-width: 154px; text-align: center; }
.funding-quote { position: relative; display: grid; grid-template-columns: minmax(0, 1fr); gap: .24rem; box-sizing: border-box; width: 134px; margin: 0 auto; padding: .43rem .5rem; border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.05); }
.market-status-light { position: absolute; top: .34rem; right: .38rem; width: 6px; height: 6px; border: 1px solid rgba(255,255,255,.9); border-radius: 50%; box-shadow: 0 0 4px currentColor, 0 0 9px currentColor; }
.market-status-light.state-good { color: #00ff00; background: #00ff00; }
.market-status-light.state-warn { color: #ffff00; background: #ffff00; }
.market-status-light.state-bad { color: #ff0000; background: #ff0000; }
.funding-price, .funding-rate { display: flex; align-items: center; justify-content: center; min-height: 16px; font-variant-numeric: tabular-nums; text-align: center; white-space: nowrap; }
.funding-price { color: #d6dcdf; font: 700 .78rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.funding-rate { font: 800 1.04rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .01em; text-shadow: 0 1px 3px rgba(0,0,0,.95), 0 0 5px rgba(0,0,0,.78); }
.funding-quote.is-positive { border-color: rgba(58, 178, 108, .72); background: rgba(46, 151, 92, .72); }
.funding-quote.is-positive .funding-rate { color: #a7ffbe; -webkit-text-stroke: .25px rgba(255,255,255,.72); }
.funding-quote.is-negative { border-color: rgba(214, 79, 73, .72); background: rgba(184, 61, 57, .74); }
.funding-quote.is-negative .funding-rate { color: #ffaba6; -webkit-text-stroke: .25px rgba(255,255,255,.72); }
.funding-quote.is-unavailable { color: var(--muted); border-color: var(--line); background: rgba(255,255,255,.035); }
.funding-quote.is-unavailable .funding-rate { color: var(--muted); -webkit-text-stroke: 0; text-shadow: none; }
.funding-spread-column,
.funding-spread-cell { position: sticky; right: 0; z-index: 1; background: var(--surface-strong); box-shadow: -10px 0 16px rgba(0,0,0,.18); }
.funding-spread-column { z-index: 2; }
.funding-cell.is-empty { color: var(--muted); font: 650 .8rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; }
.funding-table-message { height: 84px !important; color: var(--muted); font-size: .78rem; text-align: center; }
.funding-filter-summary { min-height: 18px; margin: 0; padding: .72rem 1.35rem .52rem; color: var(--muted); font: 650 .7rem/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; letter-spacing: .015em; text-align: center; }
.funding-pagination { display: flex; align-items: center; justify-content: center; gap: .42rem; min-height: 54px; padding: 0 1.35rem; border-top: 1px solid var(--line); }
.funding-page-numbers { display: flex; align-items: center; gap: .42rem; }
.funding-pagination button { min-height: 30px; padding: .5rem .7rem; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.04); font: 700 .68rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; cursor: pointer; }
.funding-pagination button:hover:not(:disabled) { color: var(--text); border-color: rgba(98,211,148,.45); }
.funding-pagination button[aria-current="page"] { color: var(--text); border-color: rgba(98,211,148,.55); background: rgba(98,211,148,.15); }
.funding-pagination button:disabled { cursor: not-allowed; opacity: .4; }
.funding-pagination button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.funding-page-jump { width: 46px; min-height: 30px; padding: .4rem; border: 1px solid rgba(98,211,148,.55); border-radius: 999px; color: var(--text); background: rgba(255,255,255,.04); font: 700 .68rem/1 ui-monospace, SFMono-Regular, Consolas, monospace; text-align: center; outline: none; }
.funding-page-jump:focus { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(98,211,148,.15); }
html[data-theme="light"] .view-switcher { background: rgba(0,0,0,.025); }
html[data-theme="light"] .view-switcher button:hover, html[data-theme="light"] .card-actions button:hover { background: rgba(0,0,0,.05); }
html[data-theme="light"] .exchange-toggle { background: rgba(0,0,0,.02); }
html[data-theme="light"] .funding-quote.is-positive { background: #258050; }
html[data-theme="light"] .funding-quote.is-negative { background: #b4433d; }

@media (max-width: 680px) {
  .funding-page { padding-top: 1.15rem; }
  .funding-toolbar { align-items: flex-start; flex-direction: column; }
  .funding-title-group { align-items: flex-start; flex-direction: column; gap: .65rem; }
  .view-switcher { width: 100%; }
  .view-switcher button { flex: 1; }
  .funding-filter-row { align-items: flex-start; flex-direction: column; }
  .card-actions { align-self: flex-end; justify-content: flex-end; margin-top: -.15rem; }
  .funding-filter-card { padding: 1.1rem; }
  .funding-pagination { justify-content: center; padding-inline: 1rem; }
}
