:root {
  --bg: #0b1326;
  --bg-deep: #020617;
  --surface-lowest: #060e20;
  --surface-low: #131b2e;
  --surface: #171f33;
  --surface-high: #222a3d;
  --surface-highest: #2d3449;
  --text: #dae2fd;
  --muted: #c7c4d7;
  --muted-2: #908fa0;
  --outline: rgba(255,255,255,.055);
  --outline-strong: rgba(192,193,255,.18);
  --primary: #c0c1ff;
  --primary-container: #8083ff;
  --on-primary: #1000a9;
  --secondary: #4edea3;
  --tertiary: #ffb783;
  --error: #ffb4ab;
  --danger: #ffb4ab;
  --warning: #ffb783;
  --success: #4edea3;
  --sidebar-w: 240px;
  --radius: 8px;
  --font-ui: "Geist", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Consolas, monospace;
}

.light {
  --bg: #f8fafc;
  --bg-deep: #eef2f7;
  --surface-lowest: #ffffff;
  --surface-low: #f1f5f9;
  --surface: #ffffff;
  --surface-high: #f8fafc;
  --surface-highest: #e2e8f0;
  --text: #0f172a;
  --muted: #475569;
  --muted-2: #94a3b8;
  --outline: rgba(15,23,42,.08);
  --outline-strong: rgba(73,75,214,.22);
  --primary: #494bd6;
  --primary-container: #6366f1;
  --on-primary: #ffffff;
  --secondary: #059669;
  --tertiary: #d97706;
  --error: #dc2626;
  --danger: #dc2626;
  --warning: #d97706;
  --success: #059669;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  min-height: 100vh;
  background: var(--bg-deep);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(73,75,214,.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(73,75,214,.035) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 18%, black, transparent 76%);
}
body::after {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(ellipse at 10% 0%, rgba(128,131,255,.12), transparent 34%),
    radial-gradient(ellipse at 90% 92%, rgba(78,222,163,.07), transparent 32%);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
.fa-solid,
.fa-regular,
.fa-brands {
  font-size: 16px;
  line-height: 1;
  vertical-align: middle;
}
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--surface-highest); border-radius: 999px; }

.mono, th, .badge, .nav-label, .eyebrow, .topbar-title span, small { font-family: var(--font-mono); }
.gradient-text { color: var(--primary); }

.app-shell { position: relative; z-index: 1; min-height: 100vh; }
.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 60;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  background: var(--surface-low);
  border-right: 1px solid var(--outline);
}
.light .app-sidebar {
  background: #f8fafc;
  border-right-color: #e5e7eb;
}
.sidebar-brand { padding: 0 16px 28px; }
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: var(--surface-high);
  border: 1px solid var(--outline-strong);
  color: var(--primary);
  filter: drop-shadow(0 0 8px rgba(192,193,255,.22));
}
.light .brand-mark {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4f46e5;
  filter: none;
}
.brand-name {
  color: var(--primary);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -.02em;
}
.light .brand-name { color: #4f46e5; }
.sidebar-nav {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 0 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.nav-label {
  margin: 4px 12px 8px;
  color: color-mix(in srgb, var(--muted) 68%, transparent);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: 40px;
  padding: 8px 16px;
  border-radius: 8px;
  color: var(--muted);
  transition: background .18s ease, color .18s ease, border-color .18s ease;
}
.sidebar-nav a:hover { background: var(--surface-highest); color: var(--text); }
.sidebar-nav a.active {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary-container) 12%, transparent);
  font-weight: 700;
}
.light .sidebar-nav a {
  color: #475569;
}
.light .sidebar-nav a:hover {
  background: #eef2ff;
  color: #111827;
}
.light .sidebar-nav a.active {
  background: #e0e7ff;
  color: #4f46e5;
}
.sidebar-nav a.active i { color: var(--primary); }
.sidebar-cta { padding: 16px; border-top: 1px solid var(--outline); }
.sidebar-cta .btn { width: 100%; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-top: 1px solid var(--outline);
}
.user-avatar {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-highest);
  color: var(--primary);
  border: 1px solid var(--outline-strong);
  font: 700 12px var(--font-mono);
}
.user-meta { min-width: 0; }
.user-meta strong, .user-meta span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-meta strong { font-size: 12px; color: var(--text); }
.user-meta span { font: 600 10px var(--font-mono); color: var(--secondary); text-transform: uppercase; letter-spacing: .08em; }

.main {
  position: relative;
  z-index: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
}
.site-header {
  position: sticky;
  top: 0;
  z-index: 45;
  height: 64px;
  display: flex;
  align-items: center;
  background: color-mix(in srgb, var(--surface-lowest) 92%, transparent);
  border-bottom: 1px solid var(--outline);
  backdrop-filter: blur(14px);
}
.light .site-header {
  background: rgba(255, 255, 255, .94);
  border-bottom-color: #e5e7eb;
}
.header-inner {
  width: 100%;
  height: 64px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
}
.mobile-brand { display: none; }
.topbar-title { min-width: 220px; display: none; }
.topbar-title span {
  display: block;
  color: var(--muted-2);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.topbar-title strong { display: block; color: var(--primary); font-size: 16px; line-height: 1.2; }
.header-actions { display: flex; align-items: center; gap: 12px; }
.icon-btn {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
.icon-btn:hover { color: var(--primary); }
.user-pill {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-size: 12px;
}
.content {
  width: min(100% - 48px, 1400px);
  margin: 0 auto;
  padding: 22px 0 56px;
}

.btn, button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 36px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid var(--outline-strong);
  background: var(--surface-high);
  color: var(--text);
  font-weight: 700;
  cursor: pointer;
  transition: opacity .18s ease, background .18s ease, border-color .18s ease;
}
.btn:hover, button:hover { background: var(--surface-highest); }
.btn.primary, button.primary {
  border-color: transparent;
  background: var(--primary);
  color: var(--on-primary);
}
.btn.ghost { background: transparent; color: var(--muted); }

input, select, textarea {
  width: 100%;
  border: 1px solid var(--outline-strong);
  border-radius: 8px;
  background: var(--surface-lowest);
  color: var(--text);
  outline: none;
  padding: 10px 12px;
}
input:focus, select:focus, textarea:focus {
  border-color: color-mix(in srgb, var(--primary) 62%, transparent);
  box-shadow: 0 0 0 3px rgba(128,131,255,.16);
}
textarea { min-height: 110px; resize: vertical; }
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--outline); text-align: left; vertical-align: middle; }
th {
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .1em;
  text-transform: uppercase;
}
td { color: var(--text); }
tr:hover td { background: color-mix(in srgb, var(--surface-highest) 34%, transparent); }
small { color: var(--muted-2); font-size: 11px; }

.panel, .stat, .login-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--outline);
  border-radius: 12px;
  background: var(--surface);
}
.panel { padding: 16px; }
.panel h2 { margin: 0 0 4px; font-size: 18px; font-weight: 700; }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat {
  min-height: 130px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.stat span {
  color: var(--muted);
  font: 700 10px var(--font-mono);
  letter-spacing: .14em;
  text-transform: uppercase;
}
.stat strong { color: var(--text); font-size: 32px; line-height: 1; }
.stat i { color: var(--primary); }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  width: fit-content;
  border-radius: 6px;
  padding: 4px 8px;
  border: 1px solid var(--outline);
  background: var(--surface-high);
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
}
.badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: currentColor;
}
.badge.online, .badge.done { background: rgba(78,222,163,.10); border-color: rgba(78,222,163,.22); color: var(--secondary); }
.badge.offline, .badge.urgent { background: rgba(255,180,171,.10); border-color: rgba(255,180,171,.22); color: var(--error); }
.badge.warning, .badge.doing { background: rgba(255,183,131,.12); border-color: rgba(255,183,131,.24); color: var(--tertiary); }
.badge.disabled, .badge.paused, .badge.cancelled { color: var(--muted); }

.progress {
  height: 20px;
  min-width: 120px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-highest);
}
.progress div {
  height: 100%;
  min-width: 28px;
  background: var(--primary);
  color: var(--on-primary);
  font: 700 11px/20px var(--font-mono);
  text-align: center;
}
.progress.clean { height: 6px; min-width: 0; }
.progress.clean div { min-width: 0; font-size: 0; }

.page-head, .dashboard-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.page-head h1, .dashboard-hero h1 {
  color: var(--text);
  font-size: 32px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: -.01em;
}
.dashboard-hero { padding: 0; }
.dashboard-hero h1 { font-size: 30px; }
.dashboard-hero p { max-width: 620px; }
.dashboard-hero p, .panel-head p { color: var(--muted); }
.eyebrow {
  display: block;
  margin-bottom: 4px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.hero-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(320px, 1fr); gap: 24px; margin-bottom: 24px; }
.dashboard-grid.lower { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.panel-head a { color: var(--primary); font: 700 12px var(--font-mono); }
.summary-panel { display: flex; flex-direction: column; gap: 16px; }
.summary-metric {
  padding: 12px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-low);
}
.summary-metric > div:first-child { display: flex; justify-content: space-between; margin-bottom: 10px; }
.summary-metric strong { font-size: 24px; }
.summary-metric span { color: var(--muted); }
.compact-list { display: flex; flex-direction: column; gap: 8px; }
.compact-row {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-low);
}
.compact-row.no-icon {
  grid-template-columns: minmax(0, 1fr) auto;
}
.compact-row:hover { background: var(--surface-high); }
.row-icon {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(192,193,255,.10);
  color: var(--primary);
}
.row-icon.danger { background: rgba(255,180,171,.10); color: var(--error); }
.row-main { min-width: 0; }
.row-main strong, .row-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-main strong { font-weight: 700; }
.empty-state {
  padding: 22px;
  border: 1px dashed var(--outline-strong);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.filters { display: grid; grid-template-columns: 1fr 220px auto; gap: 10px; margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid label {
  color: var(--muted);
  font: 700 11px var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.form-grid label input, .form-grid label select, .form-grid label textarea { margin-top: 7px; font-family: var(--font-ui); letter-spacing: 0; text-transform: none; }
.wide { grid-column: 1 / -1; }
.actions, .actions-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.actions form { display: inline; }
.actions a, .actions button { border: 0; background: transparent; color: var(--primary); padding: 0; min-height: auto; }
.actions button { color: var(--error); }
.check-row { display: grid; grid-template-columns: auto 1fr; gap: 8px; margin-bottom: 8px; }
.check-row input[type=checkbox], .check-inline input { width: auto; }
.mt { margin-top: 14px; }
.secret { max-width: 170px; }
.copyable { color: var(--primary); cursor: pointer; }

.guest {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background: var(--surface-lowest);
}
.light .guest {
  background: #f8fafc;
}
.guest::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image:
    linear-gradient(to right, rgba(73,75,214,.06) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(73,75,214,.06) 1px, transparent 1px);
  background-size: 40px 40px;
  mask-image: radial-gradient(circle at 50% 50%, black, transparent 80%);
}
.light .guest::before {
  background-image:
    linear-gradient(to right, rgba(15,23,42,.035) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(15,23,42,.035) 1px, transparent 1px);
}
.login-card {
  width: min(440px, 100%);
  padding: 24px;
  background: rgba(19, 27, 46, .72);
  border-color: rgba(192,193,255,.12);
  backdrop-filter: blur(12px);
}
.light .login-card {
  background: #ffffff;
  border-color: rgba(15, 23, 42, .08);
  box-shadow: 0 18px 50px rgba(15, 23, 42, .10);
  backdrop-filter: none;
}
.login-logo {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin: 0 auto 16px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid rgba(192,193,255,.18);
  color: var(--primary);
  filter: drop-shadow(0 0 10px rgba(192,193,255,.26));
}
.light .login-logo {
  background: #eef2ff;
  border-color: #c7d2fe;
  color: #4f46e5;
  filter: none;
}
.login-logo i { font-size: 32px; }
.login-title { text-align: center; margin-bottom: 22px; }
.login-title h1 { font-size: 30px; color: var(--text); line-height: 1.1; font-weight: 800; letter-spacing: -.03em; }
.login-title h1 span { color: var(--primary); }
.login-title p {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 6px;
  color: color-mix(in srgb, var(--primary) 62%, transparent);
  font: 600 10px var(--font-mono);
  letter-spacing: .24em;
  text-transform: uppercase;
}
.login-title p::before,
.login-title p::after { content: ""; width: 32px; height: 1px; background: color-mix(in srgb, var(--primary) 34%, transparent); }
.light .login-title p {
  color: #64748b;
}
.light .login-title p::before,
.light .login-title p::after {
  background: #cbd5e1;
}
.login-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.login-card-head h2 { font-size: 20px; }
.login-card-head span {
  padding: 4px 8px;
  border: 1px solid var(--outline);
  border-radius: 6px;
  background: color-mix(in srgb, var(--surface-high) 50%, transparent);
  color: var(--muted-2);
  font: 700 10px var(--font-mono);
}
.light .login-card-head span {
  background: #f8fafc;
  border-color: #e2e8f0;
  color: #64748b;
}
.login-card label {
  display: block;
  margin-top: 14px;
  margin-bottom: 7px;
  color: var(--primary);
  font: 700 11px var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.light .login-card label {
  color: #334155;
}
.input-with-icon {
  position: relative;
}
.input-with-icon i {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
}
.input-with-icon input {
  padding-left: 46px;
}
.light .input-with-icon i {
  color: #94a3b8;
}
.light .login-card input {
  background: #ffffff;
  border-color: #cbd5e1;
  color: #0f172a;
}
.light .login-card input:focus {
  border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99, 102, 241, .14);
}
.light .login-card input::placeholder {
  color: #94a3b8;
}
.login-options {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--muted);
}
.login-options .remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--muted);
  font: 500 13px var(--font-ui);
  letter-spacing: 0;
  text-transform: none;
}
.login-options input { width: 16px; height: 16px; accent-color: var(--primary); }
.login-options a { color: var(--primary); }
.light .login-options,
.light .login-options .remember {
  color: #64748b;
}
.login-card .btn { width: 100%; margin-top: 18px; min-height: 46px; }
.alert.danger {
  border: 1px solid rgba(255,180,171,.28);
  background: rgba(255,180,171,.10);
  color: var(--error);
  border-radius: 8px;
  padding: 10px 12px;
}

.mobile-nav { display: none; }

@media (max-width: 1024px) {
  .app-sidebar { display: none; }
  .main { margin-left: 0; }
  .mobile-brand { display: block; }
  .topbar-title, .user-pill, .header-actions .btn.ghost { display: none; }
  .site-header { position: fixed; left: 0; right: 0; }
  .content { width: min(100% - 24px, 1400px); padding-top: 88px; }
  .mobile-nav {
    display: block;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 70;
    padding-bottom: env(safe-area-inset-bottom);
  }
  .mobile-nav-inner {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    max-width: 430px;
    height: 64px;
    margin: 0 auto;
    padding: 6px 8px;
    border: 1px solid var(--outline);
    border-bottom: 0;
    border-radius: 12px 12px 0 0;
    background: color-mix(in srgb, var(--surface-low) 92%, transparent);
    backdrop-filter: blur(14px);
  }
  .mobile-nav a {
    display: flex;
    min-width: 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: 8px;
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
  }
  .mobile-nav a.active { color: var(--primary); background: rgba(128,131,255,.10); }
  .dashboard-grid, .dashboard-grid.lower { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 640px) {
  .stats-grid, .filters, .form-grid { grid-template-columns: 1fr; }
  .page-head, .dashboard-hero { display: block; }
  .page-head .btn, .hero-actions { margin-top: 14px; }
  .compact-row { grid-template-columns: 36px minmax(0, 1fr); }
  .compact-row .badge { grid-column: 2; width: fit-content; }
  table { min-width: 680px; }
}

.task-hero {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}
.task-hero.compact {
  align-items: center;
}
.task-hero h1 {
  color: var(--text);
  font-size: 32px;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.01em;
}
.task-hero p {
  color: var(--muted);
  max-width: 720px;
}
.task-stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.task-stat {
  padding: 14px;
  border: 1px solid var(--outline);
  border-radius: 10px;
  background: var(--surface);
}
.task-stat span {
  display: block;
  color: var(--muted);
  font: 700 10px var(--font-mono);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.task-stat strong {
  display: block;
  margin-top: 8px;
  color: var(--text);
  font-size: 28px;
  line-height: 1;
}
.task-stat.danger strong { color: var(--error); }
.task-filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(4, minmax(130px, .7fr)) auto;
  gap: 10px;
  align-items: end;
  padding: 12px;
  margin-bottom: 16px;
  border: 1px solid var(--outline);
  border-radius: 12px;
  background: var(--surface);
}
.task-filter-panel label {
  color: var(--muted);
  font: 700 10px var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.task-filter-panel input,
.task-filter-panel select {
  margin-top: 6px;
  font-family: var(--font-ui);
  letter-spacing: 0;
  text-transform: none;
}
.task-filter-actions {
  display: flex;
  gap: 8px;
}
.task-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.task-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--outline);
  border-radius: 12px;
  background: var(--surface);
}
.task-card.is-overdue {
  border-color: rgba(255, 180, 171, .26);
}
.task-title-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}
.task-title-row h2 {
  margin-bottom: 4px;
  color: var(--text);
  font-size: 18px;
  font-weight: 700;
}
.task-title-row p {
  color: var(--muted);
  max-width: 760px;
}
.task-badges {
  display: flex;
  gap: 6px;
  align-items: flex-start;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.task-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.task-meta-grid div {
  padding: 10px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-low);
}
.task-meta-grid span,
.task-progress-row span {
  display: block;
  color: var(--muted-2);
  font: 700 10px var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.task-meta-grid strong {
  display: block;
  margin-top: 4px;
  color: var(--text);
  font-size: 12px;
}
.danger-text { color: var(--error) !important; }
.task-progress-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  margin-top: 8px;
}
.task-progress-row strong {
  color: var(--text);
  font: 700 13px var(--font-mono);
}
.checklist-progress .progress div {
  background: var(--secondary);
}
.task-checklist-summary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 10px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-low);
  color: var(--muted);
  font-size: 12px;
}
.task-checklist-summary i {
  color: var(--secondary);
  font-size: 18px;
}
.task-checklist-summary strong {
  color: var(--text);
  font-family: var(--font-mono);
}
.task-checklist-summary a {
  color: var(--primary);
  font-weight: 700;
}
.task-inline-checklist {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.task-inline-checklist label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-low);
  color: var(--text);
  cursor: pointer;
}
.task-inline-checklist input {
  width: 16px;
  height: 16px;
  padding: 0;
  accent-color: var(--secondary);
}
.task-inline-checklist span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}
.task-inline-checklist label.is-done {
  color: var(--muted-2);
}
.task-inline-checklist label.is-done span {
  text-decoration: line-through;
}
.task-inline-checklist.compact {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.checklist-more {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px dashed var(--outline-strong);
  border-radius: 8px;
  color: var(--primary);
  font: 700 12px var(--font-mono);
}
.task-actions {
  display: flex;
  width: 138px;
  flex-direction: column;
  gap: 8px;
}
.task-actions .btn,
.task-actions form,
.task-actions button {
  width: 100%;
}
.btn.danger {
  background: rgba(255, 180, 171, .10);
  border-color: rgba(255, 180, 171, .26);
  color: var(--error);
}
.task-form-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}
.task-form-main,
.task-checklist-panel {
  min-width: 0;
}
.task-form-side {
  align-self: start;
  position: sticky;
  top: 88px;
}
input[type="range"] {
  padding: 0;
  accent-color: var(--primary);
}
.task-progress-preview {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-low);
}
.task-progress-preview strong {
  display: block;
  color: var(--primary);
  font-size: 28px;
  line-height: 1;
}
.task-progress-preview span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
}
.form-actions-sticky {
  display: flex;
  gap: 8px;
  margin-top: 16px;
}
.task-checklist-panel {
  grid-column: 1 / -1;
}
.checklist-builder {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.checklist-builder-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}
.checklist-builder-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--secondary);
}
.checklist-builder-row .remove-checklist {
  width: 38px;
  padding: 0;
}
.task-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
}
.task-detail-main,
.task-detail-side {
  min-width: 0;
}
.task-detail-side {
  align-self: start;
  position: sticky;
  top: 88px;
}
.task-progress-row.detail {
  margin-bottom: 16px;
}
.detail-checklist {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.detail-checklist label {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-low);
  cursor: pointer;
}
.detail-checklist input {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  accent-color: var(--secondary);
}
.detail-checklist span {
  color: var(--text);
}
.detail-checklist label.is-done span {
  color: var(--muted-2);
  text-decoration: line-through;
}
.detail-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.detail-meta > div {
  padding: 10px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-low);
}
.detail-meta span:first-child {
  display: block;
  margin-bottom: 5px;
  color: var(--muted-2);
  font: 700 10px var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.detail-meta strong {
  color: var(--text);
  font-size: 13px;
  word-break: break-word;
}

.tool-page-head p {
  margin-top: 4px;
  color: var(--muted);
  max-width: 680px;
}
.tool-stat-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.stat-card {
  min-height: 104px;
  padding: 16px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface);
}
.stat-card span {
  display: block;
  color: var(--muted-2);
  font: 700 10px var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.stat-card strong {
  display: block;
  margin-top: 12px;
  color: var(--text);
  font-size: 30px;
  line-height: 1;
}
.stat-card.online strong { color: var(--success); }
.stat-card.warning strong { color: var(--warning); }
.stat-card.offline strong { color: var(--error); }
.stat-card.muted strong { color: var(--primary); }
.tool-filter-panel {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 180px 160px 190px auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.tool-filter-panel label,
.form-stack label,
.copy-field {
  color: var(--muted);
  font: 700 11px var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.tool-filter-panel input,
.tool-filter-panel select,
.form-stack input,
.form-stack select,
.copy-field input {
  margin-top: 7px;
  font-family: var(--font-ui);
  letter-spacing: 0;
  text-transform: none;
}
.tool-filter-actions {
  display: flex;
  gap: 8px;
}
.tool-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tool-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px;
  gap: 18px;
  align-items: start;
}
.tool-card.is-stale,
.tool-status-panel.is-stale {
  border-color: rgba(255, 183, 131, .36);
}
.tool-card-main {
  min-width: 0;
}
.tool-title-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: flex-start;
  margin-bottom: 14px;
}
.tool-name-line {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.tool-name-line h2 {
  margin: 0;
  color: var(--text);
  font-size: 20px;
  letter-spacing: 0;
}
.tool-code {
  margin-top: 4px;
  color: var(--muted-2);
  font: 700 11px var(--font-mono);
  word-break: break-word;
}
.tool-alert-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  color: var(--muted);
  white-space: nowrap;
}
.tool-alert-pill.on {
  border-color: rgba(78, 222, 163, .28);
  color: var(--success);
  background: rgba(78, 222, 163, .08);
}
.tool-alert-pill.off {
  color: var(--muted-2);
}
.tool-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}
.tool-meta-grid.detail {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.tool-meta-grid > div {
  padding: 11px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-low);
  min-width: 0;
}
.tool-meta-grid span,
.tool-key-row > span,
.tool-last-message > span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted-2);
  font: 700 10px var(--font-mono);
  letter-spacing: .08em;
  text-transform: uppercase;
}
.tool-meta-grid strong {
  display: block;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tool-key-row {
  display: grid;
  grid-template-columns: auto minmax(0, max-content) 38px;
  align-items: center;
  gap: 9px;
  margin-top: 12px;
}
.tool-key-row > span {
  margin-bottom: 0;
}
code,
.code-block {
  font-family: var(--font-mono);
}
.tool-key-row code,
td code {
  color: var(--primary);
  word-break: break-all;
}
.icon-btn.copied {
  color: var(--success);
}
.tool-message,
.tool-last-message {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-low);
  color: var(--muted);
}
.tool-last-message p {
  color: var(--text);
}
.tool-actions,
.tool-side-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tool-actions .btn,
.tool-actions form,
.tool-actions button,
.tool-side-actions .btn,
.tool-side-actions form,
.tool-side-actions button {
  width: 100%;
}
.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.section-head h2 {
  margin: 0;
  font-size: 18px;
  letter-spacing: 0;
}
.copy-field {
  display: block;
  margin-bottom: 12px;
}
.copy-field > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
}
.code-block {
  margin-top: 14px;
  padding: 14px;
  overflow: auto;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-lowest);
  color: var(--text);
  font-size: 12px;
  line-height: 1.65;
}
.table-wrap {
  overflow-x: auto;
}
.tool-detail-grid,
.tool-form-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 16px;
}
.tool-detail-main,
.tool-form-main,
.tool-detail-side,
.tool-form-side {
  min-width: 0;
}
.tool-detail-side,
.tool-form-side {
  align-self: start;
  position: sticky;
  top: 88px;
}
.form-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.form-hint {
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
}
.tool-regenerate-form {
  max-width: 340px;
  margin-top: 14px;
  margin-left: auto;
}
.empty-state i {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  margin-bottom: 10px;
  border-radius: 8px;
  background: rgba(192,193,255,.10);
  color: var(--primary);
}
.empty-state h2 {
  color: var(--text);
  margin-bottom: 4px;
}
.empty-state .btn {
  margin-top: 14px;
}

.api-docs-head p {
  max-width: 760px;
  margin-top: 4px;
  color: var(--muted);
}
.api-docs-grid {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
}
.api-docs-side {
  align-self: start;
  position: sticky;
  top: 88px;
}
.api-docs-side > code {
  display: block;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-lowest);
  color: var(--primary);
  word-break: break-all;
}
.api-docs-note {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-low);
}
.api-docs-note strong {
  display: block;
  margin-bottom: 6px;
  color: var(--text);
}
.api-docs-note p {
  color: var(--muted);
  font-size: 13px;
}
.api-docs-note a {
  color: var(--primary);
  font-weight: 700;
}
.api-docs-main {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}
.api-endpoint p {
  color: var(--muted);
}
.api-endpoint h2 {
  margin: 18px 0 8px;
  color: var(--text);
  font-size: 15px;
}
.endpoint-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) 38px;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}
.endpoint-title code {
  padding: 9px 10px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-lowest);
  color: var(--primary);
  overflow: hidden;
  text-overflow: ellipsis;
}
.method {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 32px;
  padding: 6px 9px;
  border-radius: 8px;
  font: 800 11px var(--font-mono);
}
.method.post {
  background: rgba(78, 222, 163, .10);
  color: var(--success);
  border: 1px solid rgba(78, 222, 163, .26);
}
.method.get {
  background: rgba(192, 193, 255, .10);
  color: var(--primary);
  border: 1px solid rgba(192, 193, 255, .26);
}
.api-error-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.api-error-list > div {
  padding: 12px;
  border: 1px solid var(--outline);
  border-radius: 8px;
  background: var(--surface-low);
}
.api-error-list span {
  color: var(--error);
  font: 800 12px var(--font-mono);
}
.api-error-list strong {
  display: block;
  margin-top: 5px;
  color: var(--text);
}
.api-error-list p {
  margin-top: 4px;
  font-size: 13px;
}

@media (max-width: 1180px) {
  .task-filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .task-filter-actions {
    grid-column: 1 / -1;
  }
  .task-form-shell {
    grid-template-columns: 1fr;
  }
  .task-detail-grid {
    grid-template-columns: 1fr;
  }
  .tool-stat-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .tool-filter-panel {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .tool-filter-actions {
    grid-column: 1 / -1;
  }
  .tool-detail-grid,
  .tool-form-shell,
  .api-docs-grid {
    grid-template-columns: 1fr;
  }
  .task-form-side {
    position: static;
  }
  .task-detail-side {
    position: static;
  }
  .tool-detail-side,
  .tool-form-side,
  .api-docs-side {
    position: static;
  }
}

@media (max-width: 780px) {
  .task-hero,
  .task-card,
  .task-title-row {
    display: block;
  }
  .task-stat-grid,
  .task-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .task-badges,
  .task-actions {
    width: 100%;
    margin-top: 12px;
  }
  .task-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .task-inline-checklist {
    grid-template-columns: 1fr;
  }
  .task-progress-row {
    grid-template-columns: 1fr;
  }
  .tool-stat-grid,
  .tool-filter-panel,
  .tool-meta-grid,
  .tool-meta-grid.detail,
  .tool-card {
    grid-template-columns: 1fr;
  }
  .tool-title-row,
  .section-head {
    display: block;
  }
  .tool-alert-pill,
  .section-head .btn {
    margin-top: 10px;
  }
  .tool-key-row {
    grid-template-columns: 1fr 38px;
  }
  .tool-key-row > span {
    grid-column: 1 / -1;
  }
  .endpoint-title,
  .api-error-list {
    grid-template-columns: 1fr;
  }
}
