:root {
  --ld-bg: #f4f9fd;
  --ld-bg2: #e6f0f9;
  --ld-surface: rgba(255, 255, 255, 0.9);
  --ld-surface-strong: #ffffff;
  --ld-surface-soft: #edf4fb;
  --ld-border: rgba(26, 95, 160, 0.14);
  --ld-border-strong: rgba(26, 95, 160, 0.24);
  --ld-primary: #1a5fa0;
  --ld-primary-hover: #0c1e30;
  --ld-accent: #2a78c8;
  --ld-text: #0c1e30;
  --ld-text-2: #2a3f54;
  --ld-muted: #6d8398;
  --ld-muted-2: #8aa5bd;
  --ld-success: #1f8f5f;
  --ld-shadow-sm: 0 8px 24px rgba(12, 30, 48, 0.06);
  --ld-shadow: 0 18px 55px rgba(12, 30, 48, 0.09);
  --ld-radius: 12px;
  --ld-radius-lg: 18px;
  --ld-radius-pill: 999px;
  --ld-max: 1180px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ld-text-2);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.55;
  background:
    linear-gradient(rgba(26, 95, 160, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(26, 95, 160, 0.035) 1px, transparent 1px),
    linear-gradient(135deg, #ffffff 0%, var(--ld-bg) 48%, var(--ld-bg2) 100%);
  background-size: 44px 44px, 44px 44px, auto;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.7), rgba(255, 255, 255, 0));
  mask-image: linear-gradient(to bottom, #000 0%, transparent 72%);
}

button,
input,
select,
textarea {
  font: inherit;
}

button,
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 18px;
  border: 1px solid var(--ld-primary);
  border-radius: var(--ld-radius-pill);
  color: #ffffff;
  background: var(--ld-primary);
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.16s ease, border-color 0.16s ease, color 0.16s ease, transform 0.16s ease;
}

button:hover,
.button-link:hover {
  background: var(--ld-primary-hover);
  border-color: var(--ld-primary-hover);
}

button.secondary,
.button-link.secondary {
  color: var(--ld-text-2);
  background: rgba(255, 255, 255, 0.76);
  border-color: var(--ld-border-strong);
}

button.secondary:hover,
.button-link.secondary:hover {
  color: var(--ld-text);
  background: #ffffff;
  border-color: var(--ld-primary);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

button.danger {
  min-height: 34px;
  color: #b02d2d;
  background: #ffffff;
  border-color: rgba(176, 45, 45, 0.24);
}

a {
  color: var(--ld-primary);
  text-decoration: none;
}

a:hover {
  color: var(--ld-primary-hover);
}

.page {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

.brand-logo {
  display: block;
  width: min(220px, 70vw);
  height: auto;
  margin: 0 auto 22px;
}

.brand-logo.small {
  width: 96px;
  margin: 0;
  flex: 0 0 auto;
}

.brand-mark {
  width: 68px;
  height: 68px;
  display: grid;
  place-items: center;
  margin: 0 auto 20px;
  border-radius: var(--ld-radius);
  color: #ffffff;
  background: var(--ld-primary);
  font-weight: 800;
  font-size: 22px;
}

.brand-mark.small {
  width: 44px;
  height: 44px;
  margin: 0;
  font-size: 14px;
}

.auth-shell {
  width: min(440px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 58px 0 32px;
  text-align: center;
}

.auth-shell h1,
.hero h1 {
  margin: 0;
  color: var(--ld-text);
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.08;
  font-weight: 650;
}

.auth-shell p,
.hero p,
.card p,
.settings-panel p {
  color: var(--ld-muted);
}

.panel,
.settings-panel {
  border: 1px solid var(--ld-border);
  border-radius: var(--ld-radius-lg);
  background: var(--ld-surface);
  box-shadow: var(--ld-shadow);
  backdrop-filter: blur(16px);
}

.panel {
  display: grid;
  gap: 16px;
  margin-top: 28px;
  padding: 24px;
  text-align: left;
}

label {
  display: grid;
  gap: 8px;
  color: var(--ld-text-2);
  font-size: 14px;
  font-weight: 700;
}

input,
select {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  border: 1px solid var(--ld-border-strong);
  border-radius: 10px;
  color: var(--ld-text);
  background: #ffffff;
}

input:focus,
select:focus {
  border-color: var(--ld-primary);
  outline: 4px solid rgba(26, 95, 160, 0.1);
}

.muted-link {
  color: var(--ld-muted);
  text-align: center;
}

.error {
  padding: 10px 12px;
  color: #b02d2d;
  background: #fff0f0;
  border: 1px solid rgba(176, 45, 45, 0.18);
  border-radius: 10px;
}

.home-shell {
  width: min(var(--ld-max), calc(100vw - 36px));
  margin: 0 auto;
  padding: 22px 0 46px;
}

.topbar {
  position: sticky;
  top: 14px;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  padding: 14px 18px;
  border: 1px solid var(--ld-border);
  border-radius: var(--ld-radius-lg);
  background: rgba(255, 255, 255, 0.86);
  box-shadow: var(--ld-shadow-sm);
  backdrop-filter: blur(16px);
}

.brand-inline {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 14px;
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong {
  display: block;
  color: var(--ld-text);
  font-size: 16px;
}

.brand-copy span {
  display: block;
  color: var(--ld-muted);
  font-size: 14px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.top-actions form {
  margin: 0;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 28px;
  margin: 56px 0 24px;
}

.eyebrow {
  display: block;
  margin-bottom: 10px;
  color: var(--ld-primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.hero p {
  max-width: 620px;
  margin: 14px 0 0;
  font-size: 16px;
}

.hero-status {
  display: grid;
  gap: 6px;
  min-width: 240px;
  padding: 16px 18px;
  border: 1px solid var(--ld-border);
  border-radius: var(--ld-radius);
  background: rgba(255, 255, 255, 0.74);
}

.hero-status span {
  color: var(--ld-muted);
  font-size: 13px;
}

.hero-status strong {
  color: var(--ld-text);
  font-size: 15px;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.status-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--ld-success);
  box-shadow: 0 0 0 4px rgba(31, 143, 95, 0.12);
}

.cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.card {
  min-height: 188px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  color: inherit;
  text-decoration: none;
  border: 1px solid var(--ld-border);
  border-radius: var(--ld-radius);
  background: var(--ld-surface);
  box-shadow: var(--ld-shadow-sm);
  transition: transform 0.16s ease, box-shadow 0.16s ease, border-color 0.16s ease;
}

.card:hover {
  color: inherit;
  transform: translateY(-2px);
  border-color: var(--ld-border-strong);
  box-shadow: var(--ld-shadow);
}

.card-kicker {
  color: var(--ld-primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.card h2 {
  margin: 2px 0 0;
  color: var(--ld-text);
  font-size: 20px;
  line-height: 1.2;
}

.card p {
  flex: 1;
  margin: 0;
  font-size: 15px;
}

.card-action {
  color: var(--ld-primary);
  font-size: 14px;
  font-weight: 800;
}

.settings-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 42px 0 16px;
}

.settings-panel {
  padding: 22px;
}

.settings-panel.wide {
  margin-top: 16px;
}

.settings-panel h1 {
  margin: 0;
  color: var(--ld-text);
  font-size: 22px;
}

.stack-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
}

.check-row input {
  width: 18px;
  min-height: 18px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--ld-border);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--ld-muted);
  font-weight: 800;
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 640px) {
  .home-shell {
    width: min(100% - 24px, var(--ld-max));
    padding-top: 12px;
  }

  .topbar {
    position: static;
    align-items: flex-start;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .button-link,
  .top-actions form,
  .top-actions button {
    width: 100%;
  }

  .hero {
    margin-top: 34px;
  }

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

  .brand-logo.small {
    width: 84px;
  }
}

.form-note {
  margin: -4px 0 0;
  color: #5f7691;
  font-size: 13px;
  line-height: 1.45;
}

.form-note.warning {
  color: #9b4a2f;
}

.service-status-card {
  max-width: 720px;
}

.service-status-card .eyebrow {
  margin: 0 0 10px;
  color: #1d69ac;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 24px;
}
