:root {
  --brand: #2f6bff;
  --brand-strong: #1f56e5;
  --success: #1f9e61;
  --danger: #e5484d;
  --bg: #080a10;
  --text: #f4f6fb;
  --muted: #9aa3b5;
  --stroke: rgb(255 255 255 / 10%);
  --glass: rgb(255 255 255 / 7%);
  --field: rgb(255 255 255 / 6%);
  --shadow: 0 18px 48px rgb(0 0 0 / 32%);
  --radius: 18px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  --sidebar: 268px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input { font-family: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }

.ambient {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 0;
}
.ambient span {
  position: absolute;
  border-radius: 50%;
  filter: blur(92px);
}
.ambient .a {
  width: 44vw;
  height: 44vw;
  min-width: 280px;
  min-height: 280px;
  left: -10%;
  top: -14%;
  background: color-mix(in srgb, var(--brand) 22%, transparent);
}
.ambient .b {
  width: 36vw;
  height: 36vw;
  min-width: 240px;
  min-height: 240px;
  right: -12%;
  bottom: -18%;
  background: color-mix(in srgb, #6b7cff 16%, transparent);
}

.glass {
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(28px) saturate(1.4);
  -webkit-backdrop-filter: blur(28px) saturate(1.4);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 10%), var(--shadow);
}

#login-screen {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(420px, 100%);
  border-radius: 28px;
  padding: 32px 28px 28px;
}
.mark {
  width: 48px;
  height: 48px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: color-mix(in srgb, var(--brand) 18%, transparent);
  border: 1px solid color-mix(in srgb, var(--brand) 32%, transparent);
  color: #9cbcff;
  margin-bottom: 20px;
}
.login-card h1, .page-head h1, .modal-card h2 {
  margin: 0 0 6px;
  font-weight: 650;
  letter-spacing: -0.04em;
  line-height: 1.15;
}
.login-card h1 { font-size: 28px; }
.lead, .page-head p {
  margin: 0 0 24px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.45;
}
.page-head p { margin-bottom: 0; max-width: 640px; }

.field { margin-bottom: 14px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 550;
  color: var(--muted);
  margin-bottom: 8px;
}
.control { position: relative; }
.control input {
  width: 100%;
  height: 48px;
  border: 1px solid var(--stroke);
  background: var(--field);
  color: var(--text);
  border-radius: 14px;
  padding: 0 14px;
  font-size: 15px;
  outline: none;
}
.control input:focus {
  border-color: color-mix(in srgb, var(--brand) 70%, white);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--brand) 24%, transparent);
}
.control .icon-btn {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 10px;
  display: grid;
  place-items: center;
}
#password { padding-right: 44px; }
#client-code {
  font-family: var(--mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.55; cursor: default; transform: none; }
.btn-primary {
  height: 48px;
  padding: 0 16px;
  background: var(--brand);
  color: #fff;
  box-shadow: 0 8px 20px color-mix(in srgb, var(--brand) 32%, transparent);
}
.btn-primary:hover { background: var(--brand-strong); }
.btn-ghost {
  height: 40px;
  padding: 0 12px;
  background: rgb(255 255 255 / 6%);
  color: var(--text);
  border: 1px solid var(--stroke);
}
.btn-danger {
  height: 40px;
  padding: 0 14px;
  background: color-mix(in srgb, var(--danger) 16%, transparent);
  color: #ffb4b6;
  border: 1px solid color-mix(in srgb, var(--danger) 32%, transparent);
}
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 12px; }
.login-card .btn-primary { width: 100%; margin-top: 10px; }

.alert {
  display: none;
  margin: 0 0 16px;
  padding: 10px 12px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--danger) 14%, transparent);
  color: #ffb4b6;
  font-size: 13px;
  font-weight: 500;
  border: 1px solid color-mix(in srgb, var(--danger) 28%, transparent);
}
.alert.show { display: block; }

.app-shell {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar) 1fr;
}
.sidebar {
  margin: 12px 0 12px 12px;
  border-radius: 22px;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 24px);
  position: sticky;
  top: 12px;
}
.sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 16px;
}
.sidebar .mark { width: 36px; height: 36px; border-radius: 12px; margin: 0; }
.sidebar .title { font-weight: 650; font-size: 15px; letter-spacing: -0.03em; }
.sidebar .hint { color: var(--muted); font-size: 12px; }
.nav { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  text-align: left;
}
.nav-item:hover, .nav-item.active {
  background: rgb(255 255 255 / 8%);
  color: var(--text);
}
.sidebar-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 8px;
}
.project-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  overflow: auto;
  flex: 1;
  min-height: 80px;
  margin-bottom: 10px;
}
.project-item {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  color: var(--text);
  border-radius: 12px;
  padding: 10px 12px;
}
.project-item .p-name { font-weight: 600; font-size: 13px; }
.project-item .p-hint { color: var(--muted); font-size: 11px; font-family: var(--mono); margin-top: 2px; }
.project-item.active, .project-item:hover {
  background: color-mix(in srgb, var(--brand) 16%, transparent);
}
.sidebar-empty { color: var(--muted); font-size: 13px; padding: 8px 12px; }
.sidebar-foot { margin-top: auto; padding-top: 12px; }
.scrim {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 7;
  background: rgb(0 0 0 / 45%);
}

.workspace { min-width: 0; padding: 12px 12px 12px 16px; }
.topbar {
  border-radius: 18px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 12px;
}
.crumb { font-weight: 650; letter-spacing: -0.03em; flex: 1; }
.menu-btn { display: none; }
.top-actions { display: flex; gap: 8px; }

.view { padding: 24px 8px 64px; }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-size: 32px; }

.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 420px));
  gap: 16px;
}
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.span-2 { grid-column: 1 / -1; }
.card {
  border-radius: var(--radius);
  padding: 18px;
  background: var(--glass);
  border: 1px solid var(--stroke);
  backdrop-filter: blur(20px) saturate(1.3);
  -webkit-backdrop-filter: blur(20px) saturate(1.3);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 10%);
}
.card.down {
  border-color: color-mix(in srgb, var(--danger) 40%, var(--stroke));
  background: color-mix(in srgb, var(--danger) 6%, var(--glass));
}
.card-click { cursor: pointer; text-align: left; width: 100%; color: inherit; }
.card-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}
.stat-row {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin: 0 0 16px;
}
.stat {
  border-radius: var(--radius);
  padding: 16px;
  background: var(--glass);
  border: 1px solid var(--stroke);
}
.stat .label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--muted);
}
.stat .value {
  font-size: 26px;
  font-weight: 650;
  letter-spacing: -0.045em;
  margin-top: 8px;
  font-variant-numeric: tabular-nums;
}
.stat .sub {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}
.metric [data-copy] {
  cursor: pointer;
}
.empty {
  padding: 36px 20px;
  text-align: center;
  color: var(--muted);
}
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 650;
  font-size: 17px;
  letter-spacing: -0.03em;
}
.pod-flag {
  font-size: 22px;
  line-height: 1;
}
.badge {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 5px 8px;
  border-radius: 999px;
}
.up { background: color-mix(in srgb, var(--success) 16%, transparent); color: #6ee7a8; }
.down-badge { background: color-mix(in srgb, var(--danger) 16%, transparent); color: #ff9ea1; }
.metrics {
  margin: 16px 0 0;
  border-radius: 14px;
  overflow: hidden;
  border: 1px solid var(--stroke);
  background: rgb(0 0 0 / 28%);
}
.metric {
  display: grid;
  grid-template-columns: 132px 1fr;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  border-top: 1px solid var(--stroke);
}
.metric:first-child { border-top: 0; }
.metric dt { color: var(--muted); font-weight: 500; }
.metric dd { margin: 0; overflow-wrap: break-word; word-break: normal; }
.metric dd.mono { white-space: nowrap; }
.mono { font-family: var(--mono); font-size: 12.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  font-size: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgb(255 255 255 / 8%);
  border: 1px solid var(--stroke);
  white-space: nowrap;
}

.invite-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  margin-top: 16px;
}
.invite-form .field { margin: 0; }
.invite-form .btn-primary { height: 48px; min-width: 148px; }
.passcode {
  margin-top: 12px;
  padding: 14px;
  border-radius: 14px;
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 28%, transparent);
  color: #b7f0cf;
}
.passcode .code {
  display: block;
  margin: 8px 0;
  font-family: var(--mono);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #fff;
}
.passcode p { margin: 0; font-size: 13px; line-height: 1.45; }
.client-list { display: grid; gap: 8px; margin-top: 14px; }
.client-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--stroke);
  background: rgb(255 255 255 / 4%);
}
.client-row .who { font-size: 13px; }
.client-row .who small {
  display: block;
  color: var(--muted);
  margin-top: 2px;
  font-family: var(--mono);
  font-size: 12px;
  letter-spacing: 0.08em;
}
.client-row .row-actions { display: flex; gap: 6px; }
.share-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.share-actions .btn-primary { width: auto; height: 40px; }
.danger-row { margin-top: 20px; }
.key-form { margin-top: 14px; display: grid; gap: 10px; }
.key-form .btn-primary { width: auto; height: 40px; justify-self: start; }

.client-shell {
  position: relative;
  z-index: 1;
  max-width: 960px;
  margin: 0 auto;
  padding: 24px 16px 64px;
}
.client-shell .topbar { margin-bottom: 22px; }

footer {
  margin-top: 22px;
  color: var(--muted);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgb(0 0 0 / 46%);
}
.modal-card {
  position: relative;
  width: min(440px, 100%);
  border-radius: 28px;
  padding: 28px 24px 22px;
}
.modal-card .lead { margin-bottom: 18px; }
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}
.modal-actions .btn-primary { width: auto; min-width: 132px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(12px);
  z-index: 40;
  padding: 10px 16px;
  border-radius: 999px;
  background: #141821;
  border: 1px solid var(--stroke);
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 1280px) {
  .stat-row { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 980px) {
  .detail-grid, .stat-row { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
  .invite-form { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    display: none;
    position: fixed;
    inset: 12px auto 12px 12px;
    width: min(var(--sidebar), calc(100% - 24px));
    z-index: 8;
    margin: 0;
  }
  .sidebar.open { display: flex; }
  .scrim.show { display: block; }
  .menu-btn { display: inline-flex; }
  .page-head h1 { font-size: 26px; }
  .metric { grid-template-columns: 1fr; gap: 2px; }
}
