@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700&family=Tajawal:wght@400;500;600;700;800&display=swap");

:root {
  --bg: #f7f9fc;
  --panel: #ffffff;
  --panel-warm: #f1f5fb;
  --text: #0b1220;
  --muted: #5f6b7a;
  --primary: #0b1f3a;
  --primary-2: #132a4a;
  --accent: #1f3b63;
  --accent-soft: rgba(31, 59, 99, 0.15);
  --border: #e2e8f0;
  --danger: #c0352b;
  --success: #138a6a;
  --shadow: 0 24px 60px rgba(11, 31, 58, 0.12);
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: 'Tajawal', 'Manrope', sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top right, #ffffff 0%, var(--bg) 65%);
  min-height: 100vh;
}

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

.sidebar {
  background: linear-gradient(160deg, #0b1f3a, #132a4a 70%);
  color: #fff;
  padding: 32px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: sticky;
  top: 0;
  height: 100vh;
}

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

.brand-sub {
  color: rgba(255, 255, 255, 0.7);
  font-size: 14px;
  margin-top: 6px;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.nav-item {
  background: transparent;
  color: #fff;
  border: 1px solid transparent;
  padding: 12px 16px;
  border-radius: 14px;
  text-align: right;
  font-size: 14px;
  cursor: pointer;
  transition: 0.2s ease;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.12);
}

.nav-item.is-active {
  background: rgba(255, 255, 255, 0.16);
  border-color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

.sidebar-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.status-card {
  background: rgba(255, 255, 255, 0.12);
  padding: 16px;
  border-radius: 16px;
}

.status-label {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.status-value {
  font-size: 24px;
  font-weight: 700;
  margin-top: 6px;
}

.status-meta {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.65);
  margin-top: 6px;
}

.primary {
  background: var(--panel);
  color: var(--primary);
  border: none;
  padding: 12px 16px;
  border-radius: 14px;
  font-weight: 700;
  cursor: pointer;
}

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

.content {
  padding: 32px 36px 40px;
}

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

.title {
  font-size: 26px;
  font-weight: 700;
}

.subtitle {
  color: var(--muted);
  margin-top: 4px;
}

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

.pill {
  background: var(--accent-soft);
  color: var(--primary);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 600;
}

.user-chip {
  background: var(--panel);
  border-radius: 999px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow);
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--success);
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

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

.kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}

.kpi-card.accent {
  background: linear-gradient(140deg, rgba(31, 59, 99, 0.18), #fff);
  border: 1px solid rgba(31, 59, 99, 0.25);
}

.kpi-label {
  color: var(--muted);
  font-size: 13px;
}

.kpi-value {
  font-size: 28px;
  font-weight: 700;
  margin-top: 8px;
}

.kpi-meta {
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

.two-col {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.panel {
  background: var(--panel);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.panel-header h3 {
  margin: 0;
  font-size: 18px;
}

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

.link {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

.route-chart {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.route-bar span {
  font-size: 13px;
  color: var(--muted);
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: #e5ecf6;
  overflow: hidden;
  margin-top: 6px;
}

.bar div {
  height: 100%;
  background: linear-gradient(90deg, #0b1f3a, #1f3b63);
}

.filters {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}

.filters select,
.filters input,
.field input,
.settings-grid input {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-family: 'Tajawal', sans-serif;
}

.panel-body {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

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

.badge {
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  display: inline-flex;
}

.badge.pending {
  background: rgba(195, 86, 58, 0.15);
  color: var(--danger);
}

.badge.active {
  background: rgba(11, 31, 58, 0.12);
  color: var(--primary);
}

.badge.done {
  background: rgba(31, 122, 90, 0.12);
  color: var(--success);
}
.badge.cancelled {
  background: rgba(123, 116, 107, 0.2);
  color: var(--muted);
}

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

.secondary {
  border: 1px solid var(--primary);
  background: transparent;
  padding: 6px 12px;
  border-radius: 12px;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
}

.notice {
  background: var(--panel-warm);
  border-radius: var(--radius-md);
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  margin-top: 16px;
}

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  margin-bottom: 6px;
  color: var(--muted);
}

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

.toggle-card {
  border: 1px solid var(--border);
  padding: 14px;
  border-radius: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.switch {
  width: 44px;
  height: 24px;
  border-radius: 999px;
  background: #ded6c8;
  position: relative;
}

.switch::after {
  content: '';
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: white;
  top: 3px;
  right: 3px;
  transition: 0.2s ease;
}

.switch.is-on {
  background: var(--primary);
}

.switch.is-on::after {
  right: 23px;
}

.drawer {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  display: none;
  align-items: flex-end;
  justify-content: center;
  padding: 20px;
}

.drawer.is-open {
  display: flex;
}

.drawer-content {
  background: var(--panel);
  border-radius: 24px;
  padding: 24px;
  width: min(720px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow);
}

.drawer-close {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 5;
}

.modal.is-open {
  display: flex;
}

.modal-content {
  background: var(--panel);
  border-radius: 24px;
  padding: 24px;
  width: min(520px, 100%);
  box-shadow: var(--shadow);
}

.modal-close {
  background: none;
  border: none;
  color: var(--primary);
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 12px;
}

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

.modal form label {
  font-size: 12px;
  color: var(--muted);
}

.modal form input,
.modal form select,
.modal form textarea {
  border-radius: 12px;
  border: 1px solid var(--border);
  padding: 10px 12px;
  font-family: 'Tajawal', sans-serif;
  width: 100%;
}

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

.toast-stack {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: grid;
  gap: 10px;
  z-index: 6;
}

.toast {
  background: var(--primary);
  color: #fff;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  box-shadow: var(--shadow);
}

.is-hidden {
  display: none !important;
}

.card-list {
  display: grid;
  gap: 12px;
}

.card-row {
  padding: 12px;
  border-radius: 14px;
  background: var(--panel-warm);
  border: 1px solid var(--border);
}

.card-row strong {
  display: block;
  margin-bottom: 6px;
}

.log-item {
  border-bottom: 1px solid var(--border);
  padding: 12px 0;
  font-size: 13px;
  color: var(--muted);
}

.empty-state {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 16px;
}

.settings-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

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

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

  .content {
    padding: 24px;
  }
}
