:root {
  color-scheme: light;
  --ink: #182023;
  --muted: #617073;
  --line: #d8e0de;
  --soft: #eef4f2;
  --panel: #ffffff;
  --page: #f6f8f7;
  --accent: #116b59;
  --accent-strong: #0a4d40;
  --blue: #22577a;
  --gold: #8a6500;
  --danger: #a14016;
  --shadow: 0 18px 44px rgba(24, 32, 35, 0.1);
  --body-bg:
    linear-gradient(135deg, rgba(17, 107, 89, 0.08), transparent 34%),
    linear-gradient(315deg, rgba(34, 87, 122, 0.08), transparent 30%),
    var(--page);
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --ink: #edf4f8;
  --muted: #9cadbb;
  --line: #293948;
  --soft: #151f2a;
  --panel: #111821;
  --page: #0a0f14;
  --accent: #37ca8f;
  --accent-strong: #2dd4bf;
  --blue: #78a8ff;
  --gold: #f3c74f;
  --danger: #f36f5f;
  --shadow: 0 18px 44px rgba(0, 0, 0, 0.34);
  --body-bg:
    radial-gradient(circle at top left, rgba(45, 212, 191, 0.1), transparent 32rem),
    linear-gradient(135deg, #0a0f14 0%, #0d141b 54%, #10151d 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--body-bg);
}

.hidden {
  display: none !important;
}

button,
a {
  font: inherit;
}

.auth-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 18px;
}

.auth-panel {
  width: min(420px, 100%);
  padding: 24px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 3px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-tabs button {
  min-height: 38px;
  color: var(--ink);
  font-weight: 800;
  background: transparent;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
}

.auth-tabs button.active {
  color: #fff;
  background: var(--accent);
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.field input {
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.auth-message {
  min-height: 20px;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.app-shell {
  width: min(1480px, calc(100% - 28px));
  margin: 0 auto;
  padding: 22px 0 30px;
}

.topbar,
.service-panel,
.logs-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
}

.service-panel {
  margin-top: 14px;
  padding: 14px;
}

.batch-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr);
  align-items: end;
  gap: 12px;
}

.batch-field input {
  font-weight: 800;
  text-transform: uppercase;
}

.batch-message {
  min-height: 20px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.credit-line {
  margin-top: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

h1,
h2,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.05;
}

h2 {
  font-size: 15px;
}

.top-actions,
.section-head,
.card-actions,
.language-toggle,
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button,
.text-button,
.card-button,
.language-toggle button,
.theme-toggle button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
}

.icon-button {
  width: 42px;
  font-size: 20px;
  font-weight: 800;
}

.text-button,
.card-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 14px;
  font-weight: 800;
}

.text-button.danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--panel));
  border-color: #efc6b4;
}

.card-button.primary,
.tab.active,
.language-toggle button.active,
.theme-toggle button.active {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.language-toggle,
.theme-toggle {
  gap: 4px;
  padding: 3px;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.language-toggle button,
.theme-toggle button {
  min-height: 34px;
  padding: 0 11px;
  font-weight: 800;
}

.card-button.danger {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 10%, var(--panel));
  border-color: #efc6b4;
}

.app-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0;
}

.app-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 330px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.app-card .section-head {
  align-items: flex-start;
  min-height: 54px;
}

.app-card h2 {
  margin-bottom: 8px;
  font-size: 16px;
  line-height: 1.25;
}

.app-card p {
  min-height: 82px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-content: flex-start;
  min-height: 66px;
  margin: 12px 0 16px;
}

.card-actions {
  margin-top: auto;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 999px;
}

.status-ready {
  color: var(--accent-strong);
  background: color-mix(in srgb, var(--accent) 14%, var(--panel));
  border-color: #bfd6d1;
}

.status-starting {
  color: var(--gold);
  background: color-mix(in srgb, var(--gold) 18%, var(--panel));
  border-color: #e9d38b;
}

.status-offline,
.status-missing {
  color: var(--danger);
  background: color-mix(in srgb, var(--danger) 12%, var(--panel));
  border-color: #efc6b4;
}

.logs-panel {
  margin-top: 14px;
  overflow: hidden;
}

.section-head {
  justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.logs {
  max-height: 210px;
  overflow: auto;
  padding: 10px 14px 14px;
  color: var(--ink);
  font-family: Consolas, "SFMono-Regular", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.shutdown-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  color: var(--ink);
  background: var(--page);
}

@media (max-width: 1120px) {
  .app-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 18px, 1480px);
    padding-top: 10px;
  }

  .topbar,
  .top-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .app-grid {
    grid-template-columns: 1fr;
  }

  .batch-form {
    grid-template-columns: 1fr;
  }

  .app-card p {
    min-height: 0;
  }

  .app-card,
  .card-meta {
    min-height: 0;
  }
}
