:root {
  color-scheme: light;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-soft: #f1f5f9;
  --text: #1e293b;
  --muted: #475569;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-soft: #dbeafe;
  --accent: #f97316;
  --success: #15803d;
  --success-soft: #dcfce7;
  --warning: #b45309;
  --warning-soft: #fef3c7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(219, 234, 254, 0.75), rgba(248, 250, 252, 0) 360px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1280px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 44px;
}

.login-view {
  min-height: calc(100vh - 72px);
  display: grid;
  place-items: center;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 18px;
}

.brand-mark svg,
button svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

h1,
h2,
p {
  margin: 0;
}

.login-panel h1 {
  font-size: 28px;
  line-height: 1.2;
  margin-bottom: 8px;
}

.login-panel p,
.subtitle,
.section-heading p {
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.login-form label,
.account-form label {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 650;
}

.login-form input,
.account-form input {
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  padding: 0 12px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.login-form input:focus,
.account-form input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 16px;
  font-weight: 700;
  transition: border-color 160ms ease, background-color 160ms ease, color 160ms ease, box-shadow 160ms ease;
}

.primary-button {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 10px 22px rgba(37, 99, 235, 0.22);
}

.primary-button:hover {
  background: #1d4ed8;
}

.secondary-button {
  background: var(--surface);
  color: var(--primary);
  border-color: #bfdbfe;
}

.secondary-button:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.12);
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.ghost-button:hover {
  color: var(--text);
  background: var(--surface-soft);
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--primary);
  font-weight: 800;
  margin-bottom: 8px;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 42px);
  line-height: 1.1;
  margin-bottom: 8px;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.alert {
  margin-top: 16px;
  border-radius: 8px;
  border: 1px solid #fecaca;
  background: var(--danger-soft);
  color: #991b1b;
  padding: 12px 14px;
  font-weight: 650;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-card,
.section-block {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(15, 23, 42, 0.06);
}

.metric-card {
  padding: 16px;
  min-height: 138px;
  display: grid;
  align-content: space-between;
  gap: 14px;
}

.metric-card .label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
}

.metric-card .value {
  font-size: 28px;
  font-weight: 850;
  line-height: 1;
  overflow-wrap: anywhere;
}

.metric-card .hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--surface-soft);
}

.progress span {
  display: block;
  height: 100%;
  width: var(--value, 0%);
  background: var(--primary);
}

.progress.warn span {
  background: var(--warning);
}

.progress.danger span {
  background: var(--danger);
}

.section-block {
  margin-top: 16px;
  overflow: hidden;
}

.account-panel {
  margin-bottom: 16px;
}

.account-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  padding: 0 18px 18px;
}

.password-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
}

.mini-button {
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--surface-soft);
  color: var(--text);
  font-weight: 750;
}

.mini-button:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.form-actions {
  display: flex;
  gap: 10px;
  align-items: end;
}

.inline-message {
  margin: 0 18px 18px;
  border-radius: 8px;
  padding: 11px 13px;
  font-weight: 700;
}

.inline-success {
  color: var(--success);
  background: var(--success-soft);
  border: 1px solid #bbf7d0;
}

.inline-error {
  color: var(--danger);
  background: var(--danger-soft);
  border: 1px solid #fecaca;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 18px 12px;
}

.section-heading h2 {
  font-size: 18px;
  line-height: 1.25;
  margin-bottom: 4px;
}

.section-grid {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr);
  gap: 16px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

.compact table {
  min-width: 560px;
}

th,
td {
  padding: 12px 18px;
  text-align: left;
  border-top: 1px solid var(--border);
  vertical-align: middle;
  white-space: nowrap;
}

th {
  color: var(--muted);
  background: #f8fafc;
  font-size: 13px;
  font-weight: 800;
}

td {
  color: var(--text);
  font-size: 14px;
}

.muted-cell {
  color: var(--muted);
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 26px;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 13px;
  font-weight: 800;
}

.status-pill::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.status-ok {
  color: var(--success);
  background: var(--success-soft);
}

.status-warn {
  color: var(--warning);
  background: var(--warning-soft);
}

.status-bad {
  color: var(--danger);
  background: var(--danger-soft);
}

.skeleton {
  position: relative;
  overflow: hidden;
  min-height: 138px;
}

.skeleton::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.78), transparent);
  animation: shimmer 1.35s infinite;
}

@keyframes shimmer {
  from {
    transform: translateX(-100%);
  }
  to {
    transform: translateX(100%);
  }
}

@media (max-width: 1080px) {
  .summary-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

@media (max-width: 720px) {
  .app-shell {
    width: min(100% - 20px, 1280px);
    padding-top: 16px;
  }

  .topbar {
    display: grid;
  }

  .topbar-actions {
    justify-content: stretch;
  }

  .topbar-actions button {
    flex: 1 1 140px;
  }

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

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

  .login-panel {
    padding: 22px;
  }

  th,
  td {
    padding: 11px 12px;
  }
}
