:root {
  color-scheme: light;
  --navy: #0b1220;
  --deep: #0f2747;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --sky: #4ea3ff;
  --bg: #f5f7fa;
  --surface: #ffffff;
  --text: #111827;
  --muted: #6b7280;
  --border: #e5e7eb;
  --placeholder: #9ca3af;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --shadow-lg: 0 6px 24px rgba(15, 39, 71, 0.08);
  --shadow-sm: 0 2px 10px rgba(17, 24, 39, 0.06);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  font-size: 16px;
  line-height: 24px;
}

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

button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  padding: 10px 16px;
  background: var(--primary);
  color: #fff;
  font-weight: 700;
  cursor: pointer;
  transition: 0.16s ease;
}

button:hover {
  background: var(--primary-hover);
}

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

.btn-secondary {
  background: #fff;
  border: 1px solid var(--primary);
  color: var(--primary);
}

.btn-secondary:hover {
  background: #eff6ff;
}

.btn-success {
  background: var(--success);
}

.btn-danger {
  background: var(--danger);
}

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

.hidden {
  display: none !important;
}

.login-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
  gap: 32px;
  padding: 28px;
}

.login-hero {
  min-height: calc(100vh - 56px);
  border-radius: 24px;
  padding: 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(11, 18, 32, 0.98), rgba(15, 39, 71, 0.88)),
    radial-gradient(circle at 72% 26%, rgba(78, 163, 255, 0.28), transparent 28rem);
  box-shadow: var(--shadow-lg);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(78, 163, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #7ec3ff;
  font-weight: 900;
}

.login-hero h1 {
  max-width: 620px;
  margin: 0 0 16px;
  font-size: 56px;
  line-height: 1.03;
  font-weight: 800;
  letter-spacing: 0;
}

.login-hero h1 span {
  color: var(--sky);
}

.login-hero p {
  max-width: 560px;
  margin: 0;
  color: rgba(255, 255, 255, 0.74);
}

.login-card-wrap {
  display: grid;
  align-content: center;
  gap: 16px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: var(--shadow-lg);
  padding: 28px;
}

.login-card h2,
.mode-page h1,
.page-title h1 {
  margin: 0;
  font-size: 32px;
  line-height: 40px;
  font-weight: 800;
}

.muted {
  color: var(--muted);
}

.tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 4px;
  margin: 22px 0;
  border-radius: 14px;
  background: #eef2f7;
}

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

.tabs button.active {
  background: #fff;
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  font-size: 14px;
  line-height: 20px;
  font-weight: 700;
  color: var(--text);
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: 0;
}

textarea {
  resize: vertical;
}

input::placeholder,
textarea::placeholder {
  color: var(--placeholder);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.12);
}

.mode-page {
  min-height: 100vh;
  padding: 34px;
  display: grid;
  align-content: center;
  gap: 24px;
}

.mode-header {
  max-width: 760px;
  margin: 0 auto;
  text-align: center;
}

.mode-grid {
  width: min(1080px, 100%);
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}

.mode-card {
  min-height: 178px;
  text-align: left;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: var(--shadow-sm);
}

.mode-card:hover {
  background: #fff;
  border-color: rgba(37, 99, 235, 0.35);
  box-shadow: var(--shadow-lg);
}

.mode-card .nav-icon {
  margin-bottom: 14px;
}

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

.sidebar {
  min-height: 100vh;
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  background: linear-gradient(180deg, var(--navy), #07101d);
  color: #fff;
}

.sidebar .brand-lockup {
  padding: 0 8px 14px;
}

.side-nav {
  display: grid;
  gap: 6px;
}

.nav-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-radius: 12px;
  padding: 10px 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.78);
  text-align: left;
  font-size: 14px;
  font-weight: 700;
}

.nav-item:hover,
.nav-item.active {
  background: var(--primary);
  color: #fff;
}

.nav-icon {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
  font-size: 12px;
  font-weight: 900;
}

.sidebar .nav-icon {
  background: rgba(255, 255, 255, 0.1);
  color: rgba(255, 255, 255, 0.86);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 8px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.role-switch {
  width: 100%;
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

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

.topline,
.page-title,
.section-head,
.item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topline {
  margin-bottom: 22px;
}

.page-title {
  margin-bottom: 20px;
}

.page-title p,
.section-head p {
  margin: 4px 0 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: #fff;
  box-shadow: var(--shadow-sm);
  color: var(--muted);
  font-size: 14px;
}

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

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

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

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

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

.card-lg {
  box-shadow: var(--shadow-lg);
}

.card h2,
.card h3 {
  margin: 0 0 12px;
  font-size: 20px;
  line-height: 28px;
}

.card h3 {
  font-size: 18px;
  line-height: 24px;
}

.metric {
  min-height: 126px;
}

.metric-value {
  display: block;
  margin-top: 10px;
  font-size: 32px;
  line-height: 40px;
  font-weight: 800;
}

.metric-delta {
  color: var(--success);
  font-size: 12px;
}

.list {
  display: grid;
  gap: 10px;
}

.item {
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  background: #fff;
}

.item strong {
  font-weight: 800;
}

.item p {
  margin: 4px 0 0;
}

.badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  background: #eef2f7;
  color: var(--muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.success {
  background: rgba(34, 197, 94, 0.12);
  color: #15803d;
}

.badge.warning {
  background: rgba(245, 158, 11, 0.12);
  color: #b45309;
}

.badge.info {
  background: rgba(37, 99, 235, 0.1);
  color: var(--primary);
}

.badge.danger {
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

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

.actions button {
  min-height: 38px;
  padding: 8px 12px;
  font-size: 14px;
}

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

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

.table th {
  color: var(--muted);
  font-weight: 700;
}

.slot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(82px, 1fr));
  gap: 8px;
}

.slot-btn {
  min-height: 40px;
  background: #eff6ff;
  color: var(--primary);
  border: 1px solid rgba(37, 99, 235, 0.18);
  padding: 8px 10px;
}

.slot-btn.active {
  background: var(--primary);
  color: #fff;
}

.slot-btn.busy {
  background: #f3f4f6;
  color: var(--placeholder);
  border-color: var(--border);
}

.stepper {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.step {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.step::before {
  content: attr(data-step);
  width: 28px;
  height: 28px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: #eef2f7;
  color: var(--muted);
  font-weight: 900;
}

.step.active::before {
  background: var(--primary);
  color: #fff;
}

.mobile-frame {
  max-width: 420px;
  margin: 0 auto;
}

.bottom-nav {
  display: none;
}

.demo-page {
  padding: 28px;
}

.demo-section {
  margin-bottom: 28px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 18px;
  z-index: 50;
  width: min(520px, calc(100% - 24px));
  transform: translateX(-50%);
  padding: 12px 14px;
  border: 1px solid rgba(37, 99, 235, 0.28);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: var(--shadow-lg);
}

@media (max-width: 980px) {
  .login-page,
  .app-shell,
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }

  .login-page {
    padding: 0;
    gap: 0;
  }

  .login-hero {
    min-height: 280px;
    border-radius: 0 0 24px 24px;
  }

  .login-hero h1 {
    font-size: 34px;
    line-height: 40px;
  }

  .login-card-wrap {
    padding: 16px;
  }

  .sidebar {
    display: none;
  }

  .main {
    padding: 18px 14px 88px;
  }

  .topline {
    align-items: flex-start;
  }

  .page-title,
  .section-head,
  .item-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 4px;
    padding: 8px 8px max(8px, env(safe-area-inset-bottom));
    background: #fff;
    border-top: 1px solid var(--border);
  }

  .bottom-nav button {
    min-height: 54px;
    padding: 6px 4px;
    border-radius: 12px;
    background: transparent;
    color: var(--muted);
    font-size: 11px;
    line-height: 14px;
  }

  .bottom-nav button.active {
    background: #eff6ff;
    color: var(--primary);
  }

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