:root {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #f1f5f9;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --primary: #2563eb;
  --primary-2: #1d4ed8;
  --teal: #0f766e;
  --orange: #f97316;
  --green: #15803d;
  --red: #dc2626;
  --amber: #b45309;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(360px, 480px) minmax(0, 1fr);
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(37, 99, 235, 0.08), transparent 42%),
    var(--bg);
}

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 48px;
  background: var(--surface);
  border-right: 1px solid var(--border);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.login-brand h1 {
  font-size: 26px;
}

.login-copy {
  margin-bottom: 28px;
  color: var(--muted);
  line-height: 1.6;
}

.login-form {
  display: grid;
  gap: 14px;
}

.login-form label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-form input {
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0 12px;
  color: var(--text);
}

.form-error {
  min-height: 18px;
  margin-bottom: 0;
  color: var(--red);
  font-size: 13px;
  font-weight: 700;
}

.login-aside {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 54px;
  background: #0f172a;
  color: #f8fafc;
}

.login-aside h2 {
  max-width: 760px;
  font-size: 42px;
  line-height: 1.12;
}

.feature-list {
  display: grid;
  gap: 12px;
  max-width: 520px;
  padding: 0;
  margin: 0;
  list-style: none;
}

.feature-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid rgba(226, 232, 240, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.06);
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 20px;
  background: #0f172a;
  color: #f8fafc;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding-bottom: 22px;
  border-bottom: 1px solid rgba(226, 232, 240, 0.14);
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, #2563eb, #0f766e);
  font-weight: 800;
}

.brand strong,
.sidebar-footer strong {
  display: block;
  font-size: 14px;
}

.brand span,
.sidebar-footer span {
  display: block;
  margin-top: 2px;
  color: #94a3b8;
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 6px;
  margin-top: 22px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 10px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(147, 197, 253, 0.28);
  background: rgba(37, 99, 235, 0.16);
  color: #ffffff;
}

.nav-item svg,
.icon-button svg,
.search-box svg {
  width: 18px;
  height: 18px;
}

.sidebar-footer {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(226, 232, 240, 0.14);
  border-radius: 12px;
  background: rgba(15, 23, 42, 0.58);
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #22c55e;
}

.main-panel {
  min-width: 0;
  padding: 22px;
}

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

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

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 30px;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

h3 {
  margin-bottom: 4px;
  font-size: 15px;
}

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

.admin-chip {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 42px;
  padding: 5px 10px 5px 6px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.admin-chip span {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--primary-2);
  font-size: 12px;
  font-weight: 800;
}

.admin-chip strong,
.admin-chip small {
  display: block;
}

.admin-chip strong {
  font-size: 12px;
}

.admin-chip small {
  color: var(--muted);
  font-size: 11px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(420px, 42vw);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
}

.icon-button,
.primary-button,
.secondary-button,
.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 10px;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.icon-button {
  width: 42px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.primary-button,
.secondary-button,
.danger-button {
  padding: 0 14px;
  font-weight: 700;
}

.primary-button {
  border: 1px solid var(--primary);
  background: var(--primary);
  color: #ffffff;
}

.secondary-button {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}

.danger-button {
  border: 1px solid #fecaca;
  background: #fef2f2;
  color: var(--red);
}

.view {
  display: none;
}

.active-view {
  display: block;
}

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

.kpi-card,
.panel,
.metric-card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.kpi-card {
  padding: 16px;
}

.kpi-card span,
.muted {
  color: var(--muted);
}

.kpi-value {
  margin: 8px 0 0;
  font-size: 28px;
  font-weight: 800;
}

.panel {
  margin-bottom: 16px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.panel-header p {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

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

.toolbar select,
.toolbar input,
.form-grid input,
.form-grid select,
.settings-grid input,
.settings-grid select {
  min-height: 40px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  padding: 0 11px;
}

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

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

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

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

tbody tr:hover {
  background: #f8fafc;
}

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

.avatar {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  background: #dbeafe;
  color: var(--primary-2);
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 800;
}

.badge.blue {
  background: #dbeafe;
  color: #1d4ed8;
}

.badge.green {
  background: #dcfce7;
  color: #15803d;
}

.badge.orange {
  background: #ffedd5;
  color: #c2410c;
}

.badge.red {
  background: #fee2e2;
  color: #b91c1c;
}

.badge.gray {
  background: #f1f5f9;
  color: #475569;
}

.action-row {
  display: flex;
  gap: 8px;
}

.split-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 16px;
}

.timeline {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}

.timeline-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.settings-grid,
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.settings-grid {
  padding: 16px;
}

.form-grid label,
.settings-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.checkbox-line {
  display: flex !important;
  align-items: center;
  gap: 8px !important;
  padding-top: 23px;
  color: var(--text) !important;
}

.checkbox-line input {
  width: 18px;
  height: 18px;
}

.modal {
  width: min(680px, calc(100vw - 32px));
  border: 0;
  border-radius: 16px;
  box-shadow: 0 30px 80px rgba(15, 23, 42, 0.25);
}

.modal::backdrop {
  background: rgba(15, 23, 42, 0.5);
}

.modal form {
  display: grid;
  gap: 18px;
}

.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.modal-actions {
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  display: none;
  max-width: 360px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  background: #eff6ff;
  color: #1e40af;
  font-weight: 700;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 84px minmax(0, 1fr);
  }

  .sidebar {
    padding: 14px;
  }

  .brand div:not(.brand-mark),
  .nav-item {
    font-size: 0;
  }

  .nav-item {
    justify-content: center;
    padding: 10px;
  }

  .nav-item svg {
    width: 20px;
    height: 20px;
  }

  .sidebar-footer {
    display: none;
  }

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

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

@media (max-width: 720px) {
  .login-shell {
    grid-template-columns: 1fr;
  }

  .login-panel,
  .login-aside {
    padding: 28px;
  }

  .login-aside h2 {
    font-size: 30px;
  }

  .app-shell {
    display: block;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav-list {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .main-panel {
    padding: 16px;
  }

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

  .search-box {
    width: 100%;
  }

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

  .timeline-item {
    grid-template-columns: 1fr;
  }
}
