:root {
  --bg: #090a0d;
  --surface: #15171b;
  --surface-2: #1c1f24;
  --surface-3: #242830;
  --gold: #d2b46a;
  --gold-soft: #f0d18a;
  --text: #f4f5f7;
  --dim: #b1b5c0;
  --faint: #858b98;
  --green: #42d66b;
  --yellow: #ffd166;
  --red: #ff6b63;
  --blue: #72b7ff;
  --border: rgba(255, 255, 255, .11);
  --gold-border: rgba(210, 180, 106, .42);
  --radius: 16px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .22);
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(700px 360px at 12% -8%, rgba(210, 180, 106, .12), transparent 65%), radial-gradient(800px 420px at 92% 0%, rgba(75, 125, 220, .09), transparent 65%);
}
[hidden] { display: none !important; }
.wrap { width: min(1240px, calc(100% - 40px)); margin: 0 auto; padding: 0 0; position: relative; z-index: 1; }
a { color: var(--gold-soft); text-underline-offset: 3px; }
button, input, textarea, select { font: inherit; }
button, select { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, textarea:focus-visible, select:focus-visible { outline: 3px solid rgba(114, 183, 255, .65); outline-offset: 2px; }

/* Header: two flex rows — brand/account on top, nav/project below. Rows wrap
   instead of overlapping, so nothing can collide at any viewport width. */
header { position: sticky; top: 0; z-index: 50; border-bottom: 1px solid var(--gold-border); background: rgba(12, 13, 16, .94); backdrop-filter: blur(18px); }
.topbar { display: flex; flex-direction: column; gap: 8px; padding-top: 12px; padding-bottom: 10px; }
.topbar-row { display: flex; align-items: center; gap: 14px; min-width: 0; }
.topbar-main { justify-content: space-between; }
.topbar-nav { justify-content: space-between; flex-wrap: wrap; row-gap: 8px; }
.brand { display: inline-flex; align-items: center; gap: 12px; flex: 0 0 auto; color: var(--text); font-weight: 750; letter-spacing: .01em; text-decoration: none; }
.brand-logo { width: 116px; height: 40px; object-fit: contain; }
.brand > span { color: var(--gold-soft); font-size: 1.05rem; }
.mainnav { display: flex; align-items: center; gap: 4px; min-width: 0; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.mainnav::-webkit-scrollbar { display: none; }
.mainnav a { flex: 0 0 auto; padding: 9px 12px; border-radius: 9px; color: var(--dim); font-size: .92rem; font-weight: 600; text-decoration: none; }
.mainnav a:hover, .mainnav a.active { color: var(--gold-soft); background: rgba(210, 180, 106, .12); }
.project-context { display: flex; align-items: center; flex: 0 0 auto; gap: 9px; min-width: 0; margin-left: auto; }
.project-context[hidden] { display: none; }
.project-context label, .range-label { color: var(--faint); font-size: .78rem; font-weight: 700; letter-spacing: .04em; white-space: nowrap; }
.project-context select { width: auto; min-width: 150px; max-width: 220px; margin: 0; padding: 9px 34px 9px 12px; color: var(--text); background-color: var(--surface-2); border-color: var(--border); font-size: .9rem; }
.account { display: flex; align-items: center; flex: 0 1 auto; justify-content: flex-end; gap: 10px; min-width: 0; color: var(--dim); font-size: .86rem; }
.account a { max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 0 1 auto; }
.account .small { white-space: nowrap; flex: 0 0 auto; }
#clock { color: var(--gold-soft); font-variant-numeric: tabular-nums; white-space: nowrap; }
.live-dot { display: inline-block; flex: 0 0 auto; width: 9px; height: 9px; border-radius: 50%; background: var(--green); animation: pulse 2s infinite; }

/* Auth pages: restrained branding, clear hierarchy, generous spacing. */
.auth-wrap { max-width: 440px; padding-top: 10vh; padding-bottom: 8vh; }
.auth-card { text-align: center; padding: 2rem 1.8rem 1.7rem; }
.auth-card .lv-logo { display: block; width: 104px; height: auto; max-height: 38px; object-fit: contain; margin: 0 auto .9rem; filter: drop-shadow(0 4px 12px rgba(197, 168, 92, .18)); }
.auth-brand { justify-content: center; font-size: 1.15rem; margin-bottom: .35rem; }
.auth-brand img { display: block; }
.auth-card > p.dim { margin: .1rem 0 0; font-size: .9rem; }
.auth-form { text-align: left; margin-top: 1.3rem; }
.field-label { display: block; margin: 0 0 2px; color: var(--dim); font-size: .82rem; font-weight: 650; }
.field-label .dim { font-weight: 400; }
.auth-submit { width: 100%; margin-top: .8rem; }

/* Layout and typography */
.page { padding-top: 34px; padding-bottom: 70px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; margin-bottom: 22px; }
.page h1 { margin: 0 0 6px; font-size: clamp(1.9rem, 3vw, 2.55rem); line-height: 1.1; letter-spacing: -.035em; }
.page-head p { margin: 0; color: var(--dim); font-size: 1rem; }
.page > section > h2:first-of-type { margin-top: 0; }
h2 { margin: 30px 0 12px; color: var(--text); font-size: 1.05rem; font-weight: 750; letter-spacing: .01em; }
h3 { margin: 0 0 12px; color: var(--gold-soft); font-size: 1rem; }
.dim { color: var(--dim); }
.section-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.section-toolbar h2 { margin-bottom: 10px; }
.toolbar-actions { display: flex; align-items: center; gap: 9px; padding-bottom: 10px; }
.compact-select { width: auto; min-width: 142px; margin: 0; padding: 9px 32px 9px 11px; font-size: .9rem; }
.button-link { display: inline-flex; align-items: center; min-height: 42px; padding: 9px 14px; border: 1px solid var(--gold-border); border-radius: 10px; color: var(--gold-soft); font-size: .9rem; font-weight: 700; text-decoration: none; }
.button-link:hover { background: rgba(210, 180, 106, .1); }
.card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: var(--radius); padding: 20px; box-shadow: 0 8px 30px rgba(0, 0, 0, .1); animation: rise .45s cubic-bezier(.22, 1, .36, 1) both; }
.card:hover { border-color: rgba(210, 180, 106, .35); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: 16px; }
.card.slim { max-width: 820px; }
.empty-state { padding: 26px 4px; color: var(--dim); font-size: .95rem; }
.section-label { margin: 26px 0 10px; color: var(--text); font-size: .98rem; font-weight: 750; }
.section-sub { margin: -6px 0 12px; font-size: .86rem; }
.source-banner { display: flex; flex-direction: column; gap: 4px; margin: 0 0 14px; padding: 14px 16px; border: 1px solid rgba(114, 183, 255, .3); border-radius: 12px; background: rgba(114, 183, 255, .08); color: var(--dim); font-size: .9rem; }
.source-banner strong { color: var(--text); }
.source-note { margin: 12px 0 0; color: var(--faint); font-size: .86rem; }
.form-note { margin: 0 0 12px; color: var(--dim); font-size: .9rem; }
.form-note code { color: var(--gold-soft); }

/* Controls */
button { min-height: 44px; padding: 10px 16px; border: 0; border-radius: 10px; background: var(--gold); color: #17181a; font-weight: 750; transition: transform .14s, background .15s, border-color .15s; }
button:hover { background: var(--gold-soft); transform: translateY(-1px); }
button:active { transform: translateY(0) scale(.98); }
button.ghost { background: transparent; color: var(--gold-soft); border: 1px solid var(--gold-border); }
button.ghost:hover { background: rgba(210, 180, 106, .1); }
button.small { min-height: 38px; padding: 8px 12px; font-size: .86rem; }
input, textarea, select { width: 100%; min-height: 46px; margin: 6px 0; padding: 11px 13px; border: 1px solid #343943; border-radius: 10px; background: #101216; color: var(--text); }
input:focus, textarea:focus, select:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(210, 180, 106, .18); outline: none; }
textarea { min-height: 120px; resize: vertical; }
textarea.sql { min-height: 150px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92rem; line-height: 1.55; }

/* Project context and cards */
.project-card { display: block; color: inherit; text-decoration: none; }
.project-card:hover { transform: translateY(-2px); }
.project-card.selected { border-color: var(--gold); box-shadow: 0 0 0 1px rgba(210, 180, 106, .18), var(--shadow); }
.project-card-top, .host-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-card-top > span, .host-head > span { font-size: .78rem; font-weight: 750; }
.project-limits { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 16px; }
.project-limits span { padding: 5px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--dim); font-size: .78rem; }
.project-card-link { margin-top: 16px; color: var(--gold-soft); font-size: .9rem; font-weight: 700; }
.kind-badge { display: inline-block; padding: 2px 8px; border: 1px solid var(--gold-border); border-radius: 999px; color: var(--gold-soft); font-size: .72rem; font-weight: 700; white-space: nowrap; }
.service-meta { display: flex; align-items: center; gap: 7px; margin-top: 12px; color: var(--dim); font-size: .78rem; }
.service-meta-dot { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--faint); }
.service-meta.current .service-meta-dot { background: var(--green); }
.service-meta.update { color: var(--yellow); }
.service-meta.update .service-meta-dot { background: var(--yellow); }
.service-context { margin-top: 16px; border-color: rgba(210, 180, 106, .3); background: rgba(210, 180, 106, .07); }
.service-context a { margin-left: 4px; white-space: nowrap; }
.service-ops { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.service-ops > div { min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.service-ops span, .service-ops b, .service-ops small { display: block; }
.service-ops span { color: var(--faint); font-size: .75rem; }
.service-ops b { margin-top: 4px; color: var(--text); font-size: .88rem; }
.service-ops small { margin-top: 5px; color: var(--dim); font-size: .75rem; line-height: 1.35; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.secondary-link { color: var(--dim); border-color: var(--border); background: transparent; }
.secondary-link:hover { color: var(--gold-soft); border-color: var(--gold-border); background: rgba(210, 180, 106, .08); }

/* Update Center */
.update-policy { margin-bottom: 16px; }
.update-policy-note { margin-top: 16px; }
.update-targets { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.update-target { min-width: 0; }
.update-target-head, .update-job-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.update-target-state { color: var(--yellow); font-size: .78rem; font-weight: 700; text-align: right; }
.update-target p { margin: 12px 0; }
.update-target-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 9px; }
.update-target-actions button { min-height: 38px; font-size: .82rem; }
.update-target-actions button:disabled { cursor: not-allowed; opacity: .55; }
.update-ready { color: var(--green); font-size: .8rem; font-weight: 700; }
.update-preview-age { color: var(--dim); font-size: .75rem; }
.update-warning { color: var(--yellow); font-size: .75rem; }
.update-plan { margin-top: 14px; color: var(--dim); font-size: .8rem; }
.update-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: .45rem .7rem; margin: .7rem 0; }
.update-facts span { display: block; color: var(--dim); font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; }
.update-facts b { display: block; margin-top: .12rem; overflow-wrap: anywhere; color: var(--text); font-size: .75rem; }
.update-plan summary { cursor: pointer; color: var(--gold-soft); }
.update-plan ul { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 5px 12px; margin: 10px 0 0; padding-left: 18px; }
.update-plan li { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.update-plan pre { max-height: 220px; margin-top: 10px; overflow: auto; padding: 10px; border-radius: 8px; background: var(--surface); color: var(--dim); font-size: .72rem; white-space: pre-wrap; word-break: break-word; }
.update-error { margin-top: 8px; color: var(--red); }
.update-job { margin-top: 12px; }
.update-job:first-child { margin-top: 0; }
.update-job > .dim { margin-top: 7px; }
.update-job-head span { color: var(--dim); font-size: .8rem; text-align: right; }
.update-job-success { border-left: 3px solid var(--green); }
.update-job-failed { border-left: 3px solid var(--red); }
.update-job-active { border-left: 3px solid var(--yellow); }
.update-latest-execution { margin-top: 10px; color: var(--yellow); font-size: .78rem; }
.observed-card { margin-top: 16px; }
.observed-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.observed-head h2 { margin: 0; }
.observed-head p { margin: 5px 0 0; }
.observed-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.observed-row { min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2); }
.observed-row > div { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; }
.observed-row small { display: block; margin-top: 5px; }
.observed-row code { overflow-wrap: anywhere; color: var(--gold-soft); font-size: .76rem; }
@media (max-width: 760px) {
  .observed-grid { grid-template-columns: 1fr; }
  .observed-head { flex-direction: column; }
  .update-targets { grid-template-columns: 1fr; }
  .update-plan ul { grid-template-columns: 1fr; }
  .update-facts { grid-template-columns: 1fr; }
  .update-target-head, .update-job-head { flex-direction: column; gap: 4px; }
  .update-target-state, .update-job-head span { text-align: left; }
}

/* Compute cards and charts */
.range-note { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 28px; margin: -2px 0 12px; color: var(--dim); font-size: .86rem; }
.range-note b { color: var(--gold-soft); }
.range-warning { color: var(--yellow); }
.compute-cards { margin-bottom: 18px; }
.host-card { border-left-color: var(--green); }
.host-card:has(.status-fail) { border-left-color: var(--red); }
.host-card:has(.status-warn) { border-left-color: var(--yellow); }
.host-foot { margin-top: 14px; color: var(--faint); font-size: .8rem; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px 12px; margin-top: 18px; }
.metric-grid span { display: block; color: var(--dim); font-size: .78rem; font-weight: 650; }
.metric-grid b { display: block; margin-top: 3px; font-size: 1.22rem; font-variant-numeric: tabular-nums; }
.bar { height: 9px; margin-top: 8px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .1); }
.bar > i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--gold-soft)); transition: width .7s cubic-bezier(.22, 1, .36, 1); }
.bar.idle > i { background: linear-gradient(90deg, #3b82d0, var(--blue)); }
.bar.warm > i { background: linear-gradient(90deg, #b98522, var(--yellow)); }
.bar.hot > i { background: linear-gradient(90deg, #bd3e38, var(--red)); }
.compute-charts { display: grid; gap: 18px; }
.chart-host { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.chart-host-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; color: var(--gold-soft); font-size: 1rem; font-weight: 750; }
.chart-host-title span:last-child { color: var(--faint); font-size: .8rem; font-weight: 500; }
.chart-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.chart-card { position: relative; min-width: 0; min-height: 100%; padding: 16px; border: 1px solid rgba(255, 255, 255, .08); border-radius: 13px; background: var(--surface-2); color: var(--text); text-align: left; box-shadow: none; }
.chart-card:hover { background: var(--surface-3); border-color: var(--gold-border); }
.chart-plot { position: relative; cursor: crosshair; border-radius: 8px; }
.chart-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: .92rem; }
.chart-head span { color: var(--gold-soft); font-size: 1.05rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.time-chart { display: block; width: 100%; height: 175px; margin: 10px 0 4px; overflow: visible; touch-action: pan-y; cursor: crosshair; }
.time-chart:focus-visible { outline: 2px solid rgba(114, 183, 255, .8); outline-offset: 3px; border-radius: 6px; }
.chart-grid line { stroke: rgba(255, 255, 255, .13); stroke-width: 1; }
.chart-axis { fill: #c3c9d4; font-size: 13px; font-weight: 600; }
.chart-tlabel { fill: #8b93a1; font-size: 12px; font-weight: 500; }
.chart-area { opacity: .09; }
.chart-event-note { display: flex; align-items: center; gap: 7px; margin: -3px 0 12px; color: var(--yellow); font-size: .74rem; }
.event-marker { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: var(--yellow); box-shadow: 0 0 8px rgba(255, 209, 102, .45); }
.chart-line { stroke-width: 2.5; stroke-linecap: round; stroke-linejoin: round; }
.chart-hover-line { stroke: rgba(255, 255, 255, .48); stroke-width: 1; stroke-dasharray: 3 3; }
.chart-hover-dot { stroke: #101216; stroke-width: 2; }
.chart-tip { position: fixed; z-index: 200; display: grid; gap: 2px; min-width: 170px; max-width: 260px; padding: 9px 12px; border: 1px solid var(--gold-border); border-radius: 10px; background: rgba(16, 18, 22, .97); box-shadow: var(--shadow); color: var(--text); font-size: .78rem; line-height: 1.35; pointer-events: none; }
.chart-tip strong { color: var(--dim); font-size: .74rem; font-weight: 600; }
.chart-tip b { color: var(--gold-soft); font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.chart-tip .dim { display: block; color: var(--faint); font-size: .72rem; }
.chart-meta { display: flex; justify-content: space-between; gap: 8px; color: var(--dim); font-size: .8rem; }
.chart-hint { margin-top: 9px; color: var(--faint); font-size: .73rem; }
.chart-hint kbd { padding: 1px 4px; border: 1px solid var(--border); border-radius: 4px; background: var(--surface-3); color: var(--dim); font-size: .68rem; }
.chart-empty { display: grid; min-height: 165px; place-items: center; color: var(--faint); font-size: .85rem; }
.countdowns { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.countdown { padding: 8px 11px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); color: var(--dim); font-size: .84rem; }
.countdown b { color: var(--gold-soft); font-variant-numeric: tabular-nums; }

/* Infrastructure summary */
.infra-card { padding: 18px 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.infra-card + .infra-card { margin-top: 14px; }
.infra-card-head { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.infra-card-head span, .infra-row span, .version-summary span { font-size: .82rem; }
.infra-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(150px, 1fr) 48px; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid rgba(255, 255, 255, .07); }
.infra-row > div:first-child { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.infra-row > div:first-child strong { font-size: .9rem; }
.infra-bar { height: 10px; overflow: hidden; border-radius: 999px; background: rgba(255, 255, 255, .1); }
.infra-bar i { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.infra-bar i.warn { background: var(--yellow); }
.infra-bar i.hot { background: var(--red); }
.infra-row > b { text-align: right; font-size: .9rem; font-variant-numeric: tabular-nums; }
.version-summary { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.infra-manage-link { margin-left: auto; white-space: nowrap; font-size: .78rem; font-weight: 700; }
.version-pills { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.version-pill { padding: 5px 9px; border: 1px solid var(--border); border-radius: 999px; color: var(--dim); font-size: .78rem; }
.version-pill.current { color: var(--green); border-color: rgba(66, 214, 107, .35); }
.version-pill.outdated { color: var(--yellow); border-color: rgba(255, 209, 102, .4); }

/* Tables and deployment actions */
table { width: 100%; overflow: hidden; border-collapse: separate; border-spacing: 0; border: 1px solid var(--border); border-radius: 13px; background: var(--surface); font-size: .92rem; }
td, th { padding: 14px 15px; border-bottom: 1px solid rgba(255, 255, 255, .07); text-align: left; vertical-align: middle; }
th { color: var(--dim); font-size: .78rem; font-weight: 750; letter-spacing: .03em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: rgba(255, 255, 255, .025); }
code { color: var(--gold-soft); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .9em; }
.commit-cell { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.copy-button { min-height: 32px; padding: 5px 8px; border: 1px solid var(--border); background: transparent; color: var(--dim); font-size: .75rem; font-weight: 700; }
.copy-button:hover, .copy-button.copied { border-color: var(--gold-border); background: rgba(210, 180, 106, .1); color: var(--gold-soft); }
.withdraw-button { min-height: 34px; padding: 6px 10px; border: 1px solid rgba(255, 209, 102, .4); background: transparent; color: var(--yellow); font-size: .78rem; }
.withdraw-button:hover { background: rgba(255, 209, 102, .1); }
.table-action, .run-link { font-weight: 750; text-decoration: none; }
.table-action { white-space: nowrap; }
.run-link:hover, .table-action:hover { text-decoration: underline; }
.request-row td { background: rgba(255, 209, 102, .035); }
.request-detail, .row-detail { display: block; margin-top: 3px; color: var(--faint); font-size: .76rem; }
.timer-live { color: var(--yellow); font-variant-numeric: tabular-nums; }
.status-live { color: var(--green); font-weight: 750; }
.status-warn, .status-requested { color: var(--yellow); font-weight: 750; }
.status-fail { color: var(--red); font-weight: 750; }
.status-idle { color: var(--dim); font-weight: 650; }

/* SQL and detail views */
.results-wrap { max-height: 480px; overflow: auto; border: 1px solid var(--border); border-radius: 13px; }
.results-wrap thead th { position: sticky; top: 0; background: var(--surface-2); }
td.null { color: var(--faint); font-style: italic; }
.sql-err { margin-top: 8px; padding: 12px 14px; border: 1px solid rgba(255, 107, 99, .35); border-radius: 10px; background: rgba(255, 107, 99, .08); color: #ffaaa5; font-size: .9rem; }
.sql-meta { margin-top: 7px; color: var(--dim); font-size: .88rem; }
.sql-meta b { color: var(--gold-soft); }
.tables-list { display: flex; flex-wrap: wrap; gap: 7px; margin: 12px 0; }
.tables-list button { min-height: 36px; padding: 7px 10px; font-size: .82rem; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.detail-grid .card { min-width: 0; }
.detail-summary, .full-card { grid-column: 1 / -1; }
.detail-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 22px; }
.detail-facts span, .detail-facts b { display: block; }
.detail-facts span { color: var(--faint); font-size: .8rem; }
.detail-facts b { margin-top: 4px; font-size: .92rem; }
.detail-line { display: flex; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid rgba(255, 255, 255, .07); font-size: .9rem; }
.detail-line span:last-child { color: var(--dim); text-align: right; }

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(66, 214, 107, .45); } 50% { box-shadow: 0 0 0 7px rgba(66, 214, 107, 0); } }
@keyframes shimmer { to { background-position: -200% 0; } }
.skeleton { min-height: 100px; border-radius: var(--radius); background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%); background-size: 200% 100%; animation: shimmer 1.4s infinite; }

@media (max-width: 900px) {
  .wrap { width: min(100% - 28px, 680px); }
  .topbar-nav { flex-direction: column; align-items: stretch; }
  .mainnav { width: 100%; }
  .project-context { width: 100%; margin-left: 0; }
  .project-context select { flex: 1; max-width: none; }
  #clock { display: none; }
  .account a { max-width: 130px; }
  .page { padding-top: 26px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .chart-grid, .detail-grid { grid-template-columns: 1fr; }
  .detail-summary, .full-card { grid-column: auto; }
  .detail-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-ops { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 20px; background: rgba(0, 0, 0, .72); backdrop-filter: blur(8px); }
.modal-card { width: min(520px, 100%); max-height: min(720px, calc(100vh - 40px)); overflow: auto; padding: 24px; border: 1px solid var(--gold-border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.modal-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 8px; }
.modal-head h2 { margin: 0; font-size: 1.25rem; }
.modal-card .field-label { margin-top: 16px; }
.modal-card input { width: 100%; }
.modal-plan { margin: 16px 0; padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); color: var(--dim); font-size: .9rem; white-space: pre-line; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
@media (max-width: 560px) {
  body { font-size: 15px; }
  .wrap { width: calc(100% - 22px); }
  .mainnav { justify-content: flex-start; }
  .mainnav a { padding: 8px 9px; font-size: .86rem; }
  .account { gap: 6px; font-size: .78rem; }
  .account a { max-width: 100px; }
  #clock { display: none; }
  .page-head { flex-direction: column; }
  .button-link { width: 100%; justify-content: center; }
  .section-toolbar { align-items: flex-start; flex-direction: column; }
  .toolbar-actions { width: 100%; justify-content: space-between; padding-bottom: 0; }
  .range-note { align-items: flex-start; flex-direction: column; gap: 4px; }
  .version-summary { flex-wrap: wrap; }
  .infra-manage-link { margin-left: 0; }
  .card { padding: 16px; }
  .service-ops { grid-template-columns: 1fr; }
  table { display: block; overflow-x: auto; white-space: nowrap; }
  td, th { padding: 12px; }
  .infra-row { grid-template-columns: minmax(0, 1fr) 90px 42px; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .card { opacity: 1; transform: none; }
}
