:root {
  --line: #d7e9f7;
  --text: #1f3550;
  --muted: #63809b;
  --primary: #62b6ff;
  --primary2: #89ccff;
  --shadow: 0 16px 40px rgba(72, 123, 168, 0.12);
  font-family: Inter, system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #edf7ff 0%, #e7f3ff 100%);
  color: var(--text);
}

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

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 26px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.88);
}

.brand {
  font-weight: 700;
  font-size: 20px;
}

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

.container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 24px;
}

.layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: calc(100vh - 70px);
}

.sidebar {
  border-right: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.68);
  padding: 18px;
}

.main {
  padding: 20px;
}

.grid {
  display: grid;
  gap: 16px;
}

.cards {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.dashboard-split {
  grid-template-columns: 1.3fr 1fr;
}

.two-col {
  grid-template-columns: 1fr 1fr;
}

.status-grid {
  margin-top: 8px;
  gap: 8px;
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 18px;
}

.compact-card {
  padding: 10px 14px;
}

.card-title,
.compact-card-label {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
  text-transform: uppercase;
}

.compact-card-label {
  font-size: 11px;
}

.big {
  font-size: 30px;
  font-weight: 700;
}

.compact-card-value {
  font-size: 18px;
  font-weight: 700;
}

.section-title {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 14px;
}

.subtext {
  font-size: 14px;
  color: var(--muted);
}

.section-gap {
  margin-top: 16px;
}

.section-gap-sm {
  margin-bottom: 12px;
}

.form-gap {
  margin-bottom: 16px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.action-row {
  gap: 4px;
  flex-wrap: wrap;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.form-submit-row {
  align-self: end;
}

label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

input,
select,
textarea {
  padding: 11px 12px;
  border: 1px solid #cfe4f7;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
}

textarea {
  min-height: 90px;
  resize: vertical;
}

.btn {
  border: none;
  background: linear-gradient(135deg, var(--primary), var(--primary2));
  color: #08314e;
  padding: 11px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 700;
}

.btn.secondary {
  background: #dff0ff;
}

.nav-btn {
  width: 100%;
  text-align: left;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text);
  padding: 12px 14px;
  border-radius: 12px;
  cursor: pointer;
  margin-bottom: 8px;
}

.nav-btn.active,
.nav-btn:hover {
  background: #dff0ff;
  border-color: #c6e6ff;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-size: 14px;
  vertical-align: middle;
}

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

.empty-cell {
  text-align: center;
  color: #6b7a90;
  padding: 24px 12px;
}

.badge {
  display: inline-flex;
  padding: 5px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.ok {
  background: #dcfff4;
  color: #0d6a52;
}

.badge.warn {
  background: #fff1dd;
  color: #8f5d12;
}

.badge.danger {
  background: #ffe4e9;
  color: #9d2948;
}

.badge.info {
  background: #e4f3ff;
  color: #1d5b85;
}

.pre {
  white-space: pre-wrap;
  font-family: ui-monospace, monospace;
  background: #f7fbff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
}

/* =========================
   Dashboard components
   ========================= */

.stat-card__title {
  margin-bottom: 8px;
}

.stat-card__value {
  line-height: 1;
}

.stat-card__subtitle {
  margin-top: 8px;
}

.stat-card--ok {
  border-color: #cfe9dc;
}

.stat-card--warn {
  border-color: #f4dfb3;
}

.stat-card--danger {
  border-color: #efc7cf;
}

/* unified progress */
.progress {
  display: grid;
  gap: 8px;
  width: 100%;
}

.progress__meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 13px;
  font-weight: 600;
}

.progress__numbers,
.progress__percent {
  color: var(--text);
}

.progress__label {
  font-size: 12px;
  color: var(--muted);
}

.progress__track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: #e8eef5;
  overflow: hidden;
}

.progress__fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.25s ease;
  background: #7aa7d9;
}

.progress[data-tone="ok"] .progress__fill {
  background: #77c29a;
}

.progress[data-tone="info"] .progress__fill {
  background: #7aa7d9;
}

.progress[data-tone="warn"] .progress__fill {
  background: #e2b85d;
}

.progress[data-tone="danger"] .progress__fill {
  background: #de8d9d;
}

.progress--compact {
  min-width: 180px;
}

.progress--compact .progress__track {
  height: 8px;
}

.progress--compact .progress__meta {
  font-size: 12px;
}

.progress-cell {
  min-width: 180px;
}

.progress-text {
  margin-bottom: 6px;
  font-weight: 600;
}

.alert-banner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 14px 16px;
  border-radius: 16px;
  border: 1px solid #d7e4f2;
  background: #f7fbff;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}

.alert-banner--info {
  background: #f3f8ff;
}

.alert-banner--warn {
  background: #fff8e8;
  border-color: #f1dfae;
}

.alert-banner--danger {
  background: #fff1f4;
  border-color: #f0c8d0;
}

.alert-banner--ok {
  background: #f1fbf5;
  border-color: #cfe9dc;
}

.alert-banner__body {
  min-width: 0;
  flex: 1;
}

.alert-banner__title {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
  color: var(--text);
}

.alert-banner__message {
  color: var(--muted);
  line-height: 1.5;
}

.alert-banner__actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.alert-banner__action {
  white-space: nowrap;
}

.alert-strip {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.alert-item {
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff4e5;
  border: 1px solid #ffd7a8;
  color: #9a5b00;
  font-weight: 600;
}

.quick-actions__grid {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.quick-actions__btn {
  white-space: nowrap;
}

.risk-good {
  color: #15803d;
}

.risk-warn {
  color: #b45309;
}

.risk-bad {
  color: #b91c1c;
}

.risk-muted {
  color: #64748b;
}

.risk-hint {
  margin-top: 2px;
  font-size: 11px;
}

.line-contact-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.line-contact-link img {
  display: block;
  height: 36px;
  max-width: 100%;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }

  .dashboard-split,
  .two-col {
    grid-template-columns: 1fr;
  }

  .alert-banner {
    flex-direction: column;
  }

  .alert-banner__actions {
    width: 100%;
  }

  .quick-actions__grid {
    flex-direction: column;
  }

  .quick-actions__btn,
  .alert-banner__action {
    width: 100%;
  }
}

@media (max-width: 768px) {
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }

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

  .line-contact-link {
    justify-content: flex-start;
  }
}