:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --bg: #0b1220;
  --surface: #111b2c;
  --surface-raised: #162236;
  --surface-inset: #0d1727;
  --line: #25344b;
  --line-strong: #34465f;
  --text: #e8eef7;
  --muted: #96a6bb;
  --subtle: #6f8199;
  --accent: #67d5c0;
  --accent-strong: #39b9a5;
  --blue: #77a9ff;
  --green: #55d6a4;
  --amber: #f2bd68;
  --red: #fa7887;
  --radius: 12px;
  --shadow: 0 8px 28px rgba(0, 0, 0, .16);
}

* { box-sizing: border-box; }
html { min-width: 320px; min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(70rem 36rem at 50% -28rem, rgba(54, 123, 153, .17), transparent 72%),
    var(--bg);
  font-size: 15px;
  line-height: 1.55;
}
a { color: #9bc3ff; text-underline-offset: 3px; }
a:hover { color: #c1d8ff; }
button, input, select, textarea { font: inherit; }
button, input, select, textarea {
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--text);
  background: var(--surface-inset);
}
input, select, textarea { padding: .58rem .75rem; }
input:not([type=checkbox]), select { width: 100%; max-width: 30rem; }
input::placeholder { color: var(--subtle); }
input[type=checkbox] { width: 17px; min-height: 17px; margin: 0 .5rem 0 0; accent-color: var(--accent-strong); vertical-align: middle; }
textarea { width: 100%; }
input:focus-visible, select:focus-visible, textarea:focus-visible {
  border-color: var(--accent-strong);
  outline: 3px solid rgba(103, 213, 192, .2);
  outline-offset: 1px;
}
button {
  padding: .55rem .95rem;
  border-color: var(--accent-strong);
  color: #071b1a;
  background: var(--accent);
  font-weight: 700;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .12s ease;
}
button:hover:not(:disabled) { border-color: #88e8d6; background: #88e8d6; }
button:active:not(:disabled) { transform: translateY(1px); }
button.secondary {
  border-color: var(--line-strong);
  color: var(--text);
  background: var(--surface-raised);
}
button.secondary:hover:not(:disabled) { border-color: #536780; background: #1c2b41; }
button.danger {
  border-color: #9d4454;
  color: #fff;
  background: #9c3f50;
}
button.danger:hover:not(:disabled) { border-color: #c15b6b; background: #b34a5b; }
button:disabled { opacity: .55; cursor: not-allowed; }
:focus-visible { outline: 3px solid rgba(103, 213, 192, .72); outline-offset: 2px; }

.bar {
  position: sticky;
  z-index: 5;
  top: 0;
  min-height: 68px;
  border-bottom: 1px solid rgba(113, 137, 166, .19);
  background: rgba(11, 18, 32, .94);
  backdrop-filter: blur(16px);
}
.bar-inner {
  display: flex;
  width: min(100% - 48px, 1440px);
  min-height: 68px;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: auto;
}
.brand { display: inline-flex; align-items: center; gap: .7rem; color: var(--text); text-decoration: none; }
.brand:hover { color: #fff; }
.brand-mark {
  display: grid;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(103, 213, 192, .42);
  border-radius: 10px;
  color: var(--accent);
  background: rgba(103, 213, 192, .1);
  font-size: 1.2rem;
  font-weight: 800;
}
.brand-copy { display: grid; line-height: 1.1; }
.brand-copy strong { font-size: 1rem; letter-spacing: .13em; }
.brand-copy small { margin-top: .25rem; color: var(--subtle); font-size: .57rem; font-weight: 700; letter-spacing: .16em; }
.bar-actions { display: flex; align-items: center; gap: .8rem; }
#who {
  padding: .36rem .65rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  max-width: 34vw;
  overflow: hidden;
  color: #c0cddd;
  background: rgba(22, 34, 54, .72);
  font-size: .88rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
#signout { min-height: 36px; padding: .35rem .75rem; font-size: .84rem; }
main { width: min(100% - 48px, 1440px); min-height: calc(100vh - 68px); margin: auto; padding: 34px 0 64px; }
.page-content { display: grid; gap: 22px; }
.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.5rem;
  padding: 5px 0 2px;
}
.page-heading h1 { margin: 0; color: #f4f7fb; font-size: clamp(1.7rem, 3vw, 2.15rem); font-weight: 700; letter-spacing: -.035em; }
.page-description { max-width: 680px; margin: .55rem 0 0; color: var(--muted); }
.eyebrow { margin: 0 0 .45rem; color: var(--accent); font-size: .7rem; font-weight: 800; letter-spacing: .15em; }
.context-pill, .section-count {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: .25rem .7rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #b6c4d6;
  background: rgba(22, 34, 54, .7);
  font-size: .78rem;
  font-weight: 650;
  white-space: nowrap;
}
.tabs {
  display: flex;
  width: 100%;
  gap: .3rem;
  overflow-x: auto;
  padding: .35rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(17, 27, 44, .72);
}
.tabs a {
  flex: 0 0 auto;
  padding: .5rem .9rem;
  border-radius: 7px;
  color: var(--muted);
  font-size: .88rem;
  font-weight: 650;
  text-decoration: none;
}
.tabs a:hover { color: var(--text); background: rgba(255, 255, 255, .045); }
.tabs a[aria-current=page] { color: #eafffb; background: rgba(57, 185, 165, .17); box-shadow: inset 0 0 0 1px rgba(103, 213, 192, .19); }

.metric-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.metric-card {
  position: relative;
  min-height: 132px;
  overflow: hidden;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(145deg, rgba(22, 34, 54, .96), rgba(17, 27, 44, .96));
  box-shadow: var(--shadow);
}
.metric-card::after { position: absolute; top: -34px; right: -30px; width: 100px; height: 100px; border: 1px solid currentColor; border-radius: 50%; content: ""; opacity: .1; }
.metric-label { margin: 0; color: var(--muted); font-size: .84rem; font-weight: 600; }
.metric-value { margin: .3rem 0 0; color: var(--text); font-size: 2rem; font-weight: 730; letter-spacing: -.04em; line-height: 1.15; }
.metric-detail { margin: .35rem 0 0; color: var(--subtle); font-size: .78rem; }
.metric-blue { color: var(--blue); }
.metric-green { color: var(--green); }
.metric-amber { color: var(--amber); }
.metric-neutral { color: #9eacc0; }

.card {
  min-width: 0;
  padding: 22px 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(155deg, rgba(19, 30, 48, .98), rgba(16, 26, 42, .98));
  box-shadow: var(--shadow);
}
.card > :first-child { margin-top: 0; }
.card > :last-child { margin-bottom: 0; }
.card p { max-width: 74rem; }
h1, h2, h3 { line-height: 1.25; }
h1 { margin: 0; color: #f4f7fb; font-size: 1.7rem; font-weight: 720; letter-spacing: -.03em; }
.auth h1 { margin-bottom: 1.3rem; }
h2 { margin: 0 0 .8rem; color: #eaf0f8; font-size: 1.08rem; font-weight: 690; letter-spacing: -.01em; }
h3 { margin: .35rem 0; font-size: 1rem; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 15px; }
.section-heading h2 { margin: 0; }
.section-heading p { margin: .25rem 0 0; font-size: .86rem; }
.table-card { padding-bottom: 0; }
.table-wrap { overflow: auto; margin: 0 -24px; }
.table-wrap table { min-width: 700px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th, td { padding: .85rem .9rem; border-bottom: 1px solid rgba(92, 115, 145, .19); text-align: left; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 24px; }
th:last-child, td:last-child { padding-right: 24px; }
th { position: sticky; top: 0; color: var(--subtle); background: #131e30; font-size: .69rem; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: rgba(133, 164, 202, .055); }
tbody tr:last-child td { border-bottom: 0; }
.server-link { display: grid; gap: .1rem; color: #dce8f7; text-decoration: none; }
.server-link:hover { color: #b2e8df; }
.server-link .muted { font-size: .74rem; opacity: 0; transition: opacity .12s ease; }
tbody tr:hover .server-link .muted, .server-link:focus-visible .muted { opacity: 1; }
.empty-state { display: grid; justify-items: center; padding: 46px 16px 50px; text-align: center; }
.empty-state p { max-width: 430px; margin: .35rem 0 0; color: var(--muted); }
.empty-icon { display: grid; width: 44px; height: 44px; place-items: center; margin-bottom: .7rem; border: 1px solid rgba(103, 213, 192, .25); border-radius: 12px; color: var(--accent); background: rgba(103, 213, 192, .08); font-size: 1.5rem; }

label { display: block; margin: .8rem 0 .3rem; color: #d3deeb; font-size: .87rem; font-weight: 620; }
form .row { margin-top: 1rem; }
.row { display: flex; align-items: center; flex-wrap: wrap; gap: .6rem; }
td button { min-height: 34px; padding: .35rem .65rem; font-size: .8rem; }
td:last-child { white-space: nowrap; }
.auth { width: min(100%, 440px); margin: 9vh auto 0; padding: 30px; }
.auth input:not([type=checkbox]) { max-width: none; }
.auth form .row button { width: 100%; }
.auth .eyebrow { margin: 0 0 .4rem; }
.auth h1 { margin: 0 0 1.3rem; }
.auth > p:last-child { margin: 1.25rem 0 0; color: var(--muted); font-size: .88rem; }
.msg { padding: .65rem .8rem; border: 1px solid var(--line-strong); border-radius: 8px; color: #c7d4e4; background: rgba(119, 169, 255, .07); }
.msg.err { border-color: rgba(250, 120, 135, .4); color: #ffabb4; background: rgba(250, 120, 135, .08); }
.msg.warn { border-color: rgba(242, 189, 104, .38); color: #f3cd91; background: rgba(242, 189, 104, .07); }
.muted { color: var(--muted); font-size: .88rem; }
.badge { display: inline-flex; align-items: center; gap: .48rem; padding: .3rem .62rem; border: 1px solid var(--line-strong); border-radius: 999px; color: #c3cedc; background: rgba(148, 163, 184, .07); font-size: .78rem; font-weight: 650; white-space: nowrap; }
.badge::before { width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #7e8da2; content: ""; }
.badge[data-state=running] { border-color: rgba(85, 214, 164, .3); color: #a4e9cc; background: rgba(85, 214, 164, .08); }
.badge[data-state=running]::before { background: var(--green); }
.badge[data-state=starting], .badge[data-state=stopping], .badge[data-state=installing], .badge[data-state=restoring] { border-color: rgba(242, 189, 104, .3); color: #efd09b; background: rgba(242, 189, 104, .07); }
.badge[data-state=starting]::before, .badge[data-state=stopping]::before, .badge[data-state=installing]::before, .badge[data-state=restoring]::before { background: var(--amber); }
.badge[data-state=deleting], .badge[data-state=crashed], .badge[data-state=install-failed], .badge[data-state=unknown] { border-color: rgba(250, 120, 135, .35); color: #ffadb5; background: rgba(250, 120, 135, .07); }
.badge[data-state=deleting]::before, .badge[data-state=crashed]::before, .badge[data-state=install-failed]::before, .badge[data-state=unknown]::before { background: var(--red); }
.console { height: min(26rem, 55vh); overflow: auto; padding: 14px; border: 1px solid var(--line); border-radius: 9px; color: #d2deea; background: #091321; font: 13px/1.55 ui-monospace, "Cascadia Code", Consolas, monospace; white-space: pre-wrap; overflow-wrap: anywhere; }
.console .sys { color: var(--amber); font-style: italic; }
.editor { width: 100%; padding: .75rem; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--text); background: #0b1524; font: 13px/1.55 ui-monospace, "Cascadia Code", Consolas, monospace; }
.editor[readonly] { color: var(--muted); background: #111b2b; }
.back-link { margin: 0; }
.back-link a { color: var(--muted); font-size: .88rem; text-decoration: none; }
.back-link a:hover { color: var(--text); }
code { padding: .16rem .4rem; border: 1px solid var(--line); border-radius: 5px; color: #b8e5dc; background: var(--surface-inset); overflow-wrap: anywhere; }
.skip:not(:focus), .sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
.skip:focus { position: fixed; z-index: 10; top: 8px; left: 8px; padding: .65rem; border-radius: 6px; color: var(--text); background: var(--surface-raised); }
::selection { color: #061412; background: rgba(103, 213, 192, .72); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { border: 2px solid transparent; border-radius: 8px; background: #34465f; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background-color: #50647d; }

@media (max-width: 760px) {
  .bar-inner, main { width: min(100% - 32px, 1440px); }
  main { padding-top: 24px; }
  .metric-grid { gap: 10px; }
  .metric-card { min-height: 116px; padding: 15px; }
  .metric-value { font-size: 1.7rem; }
  .card { padding: 18px; }
  .table-wrap { margin: 0 -18px; }
  th:first-child, td:first-child { padding-left: 18px; }
  th:last-child, td:last-child { padding-right: 18px; }
}
@media (max-width: 520px) {
  .bar-inner, main { width: calc(100% - 24px); }
  .bar-inner { min-height: 62px; }
  .bar { min-height: 62px; }
  #who { max-width: 34vw; font-size: .76rem; }
  #signout { padding: .3rem .55rem; font-size: .76rem; }
  main { min-height: calc(100vh - 62px); padding: 18px 0 36px; }
  .page-content { gap: 15px; }
  .page-heading { align-items: flex-start; flex-direction: column; gap: .7rem; }
  .page-heading h1 { font-size: 1.65rem; }
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 94px; padding: 13px 16px; }
  .metric-value { font-size: 1.55rem; }
  .metric-detail { position: absolute; right: 16px; bottom: 15px; max-width: 48%; margin: 0; text-align: right; }
  .card { padding: 16px; }
  .section-heading { align-items: flex-start; }
  .table-wrap { margin: 0 -16px; }
  th:first-child, td:first-child { padding-left: 16px; }
  th:last-child, td:last-child { padding-right: 16px; }
  .auth { margin-top: 5vh; padding: 23px; }
  .tabs { gap: .15rem; }
  .tabs a { padding: .45rem .65rem; font-size: .81rem; }
  .context-pill { align-self: flex-start; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}
