:root {
  color: #101828;
  background: #f4f6fb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --navy: #081b43;
  --navy-soft: #112c5d;
  --blue: #2563eb;
  --blue-soft: #eef4ff;
  --ink: #101828;
  --muted: #667085;
  --line: #dce3ee;
  --danger: #b42318;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.admin-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  min-height: 100vh;
}
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 236px;
  flex-direction: column;
  padding: 22px 16px 16px;
  color: #fff;
  background: var(--navy);
}
.brand {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 0 8px 20px;
}
.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  font-size: 30px;
  transform: rotate(-20deg);
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 18px; }
.brand small {
  margin-top: 2px;
  color: #fff;
  font-size: 8px;
  letter-spacing: 0.16em;
  opacity: 0.7;
}
.admin-label {
  margin: 0 10px 10px;
  color: #8fa5cb;
  font-size: 10px;
  font-weight: 800;
}
.main-nav {
  display: grid;
  gap: 4px;
  margin-top: 18px;
}
.nav-item {
  position: relative;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr) auto;
  align-items: center;
  width: 100%;
  min-height: 39px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  color: rgba(255, 255, 255, 0.78);
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 700;
}
.nav-item > span {
  font-size: 17px;
  text-align: center;
}
.nav-item > small {
  color: rgba(255, 255, 255, 0.62);
  font-size: 10px;
}
.nav-item:hover,
.nav-item.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.12);
}
.nav-item.active::before {
  position: absolute;
  inset: 8px auto 8px 0;
  width: 3px;
  border-radius: 0 4px 4px 0;
  background: #6f9dff;
  content: "";
}
.main {
  grid-column: 2;
  min-width: 0;
}
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 58px;
  align-items: center;
  gap: 10px;
  padding: 0 24px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(14px);
}
.topbar-spacer { flex: 1; }
.menu-button { display: none; }
.icon-button,
.menu-button {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 6px;
  color: var(--ink);
  background: transparent;
  font-size: 19px;
}
.page-container { max-width: 1500px; margin: 0 auto; padding: 28px 28px 48px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; margin-bottom: 25px; }
.page-heading h1 { margin: 0 0 7px; font-size: 28px; letter-spacing: 0; }
.page-heading p, .panel-header p { margin: 0; color: var(--muted); font-size: 11px; }
.date-display {
  min-width: 132px;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: #344054;
  background: #fff;
  text-align: center;
  font-size: 10px;
  font-weight: 700;
}
.button {
  display: inline-flex;
  gap: 7px;
  min-height: 38px;
  align-items: center;
  justify-content: center;
  padding: 0 15px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 800;
}
.button-secondary { border: 1px solid var(--line); color: #344054; background: #fff; }
.kpi-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.orders-kpis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.kpi-card { padding: 20px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.kpi-card span, .kpi-card strong, .kpi-card small { display: block; }
.kpi-card span { color: var(--muted); font-size: 10px; font-weight: 700; }
.kpi-card strong { margin: 8px 0 5px; color: var(--navy); font-size: 25px; }
.kpi-card small { color: #98a2b3; font-size: 9px; }
.panel { overflow: hidden; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.panel-header { padding: 19px 22px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0 0 5px; font-size: 15px; }
.admin-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 210px) minmax(150px, 210px);
  gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}
.admin-filters input,
.admin-filters select {
  margin-top: 0;
}
.admin-message { margin: 0; padding: 14px 22px; color: var(--muted); font-size: 11px; }
.admin-message:empty { display: none; }
#utilityContent .admin-message { padding: 22px; }
.table-wrap { overflow: auto; }
table { width: 100%; min-width: 1000px; border-collapse: collapse; }
th, td { padding: 15px 18px; border-top: 1px solid #e8edf4; text-align: left; font-size: 11px; }
th { color: #667085; background: #f8fafc; font-size: 9px; text-transform: uppercase; }
td strong, td small { display: block; }
td small { margin-top: 4px; color: #7b8495; font-size: 9px; }
.status { display: inline-block; padding: 5px 9px; border-radius: 999px; color: #067647; background: #ecfdf3; font-size: 9px; font-weight: 800; }
.status.disabled { color: var(--danger); background: #fef3f2; }
.status.unregistered { color: #b54708; background: #fffaeb; }
.edit, .delete { min-height: 32px; padding: 0 10px; border-radius: 5px; font-size: 10px; font-weight: 700; }
.edit { border: 1px solid #cbd5e1; color: #344054; background: #fff; }
.delete { margin-left: 5px; border: 1px solid #fecdca; color: var(--danger); background: #fff; }

dialog { width: min(600px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 24px 70px #0f172a40; }
dialog::backdrop { background: #0f172a8c; }
#editForm { padding: 0; }
.dialog-header { display: flex; justify-content: space-between; padding: 22px 24px; border-bottom: 1px solid var(--line); }
.dialog-header h2 { margin: 0 0 5px; font-size: 17px; }
.dialog-header p { margin: 0; color: var(--muted); font-size: 10px; }
.dialog-header button { border: 0; color: #667085; background: transparent; font-size: 24px; }
.dialog-body { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; padding: 22px 24px; }
.dialog-body label { color: #344054; font-size: 10px; font-weight: 700; }
.dialog-body label:nth-of-type(3), .dialog-body label:nth-of-type(5), .check { grid-column: 1 / -1; }
input:not([type=checkbox]), textarea, select { width: 100%; margin-top: 7px; padding: 10px 11px; border: 1px solid #cbd5e1; border-radius: 6px; color: var(--ink); background: #fff; font-size: 11px; }
textarea { resize: vertical; }
.check { display: flex; gap: 10px; align-items: start; padding: 13px; border: 1px solid #fecdca; border-radius: 6px; background: #fff8f7; }
.check input { width: 17px; height: 17px; accent-color: var(--danger); }
.check span strong, .check span small { display: block; }
.check span small { margin-top: 4px; color: var(--muted); font-weight: 400; }
#editForm footer, #assignForm footer { display: flex; justify-content: flex-end; gap: 9px; padding: 17px 24px; border-top: 1px solid var(--line); background: #f8fafc; }
#editForm footer button, #assignForm footer button { min-height: 38px; padding: 0 17px; border: 1px solid #cbd5e1; border-radius: 6px; color: #344054; background: #fff; font-size: 11px; font-weight: 800; }
#editForm footer .primary, #assignForm footer .primary { border-color: var(--blue); color: #fff; background: var(--blue); }
.sidebar-backdrop { display: none; }

.dashboard-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.dashboard-kpi {
  position: relative;
  min-height: 108px;
  padding: 17px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.dashboard-kpi > span { color: #344054; font-size: 9px; font-weight: 800; }
.dashboard-kpi > strong { display: block; margin-top: 9px; color: var(--navy); font-size: 24px; }
.dashboard-kpi-wide > strong { font-size: 22px; }
.dashboard-kpi > strong small { margin-left: 4px; font-size: 9px; }
.dashboard-kpi > p { margin: 7px 0 0; color: var(--muted); font-size: 8px; }
.kpi-icon {
  position: absolute;
  top: 16px;
  right: 14px;
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 50%;
  font-size: 13px;
}
.kpi-icon.blue { color: #2563eb; background: #eef4ff; }
.kpi-icon.green { color: #039855; background: #ecfdf3; }
.kpi-icon.purple { color: #7f56d9; background: #f4f0ff; }
.kpi-icon.amber { color: #dc6803; background: #fffaeb; }
.kpi-icon.red { color: #e31b54; background: #fff1f3; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin-bottom: 14px; }
.dashboard-panel { min-height: 300px; }
.chart-panel-header { display: flex; justify-content: space-between; align-items: center; }
.period-tabs {
  display: inline-grid;
  grid-template-columns: repeat(3, auto);
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f3f6fb;
}
.period-tabs button {
  min-height: 28px;
  padding: 0 12px;
  border: 0;
  border-radius: 999px;
  color: #667085;
  background: transparent;
  font-size: 9px;
  font-weight: 900;
}
.period-tabs button.active {
  color: #fff;
  background: var(--blue);
  box-shadow: 0 6px 14px rgba(37, 99, 235, 0.18);
}
.sales-chart-wrap { position: relative; min-height: 228px; padding: 48px 18px 10px; }
.sales-total { position: absolute; top: 13px; left: 22px; display: flex; gap: 10px; align-items: baseline; }
.sales-total span { color: var(--muted); font-size: 8px; }
.sales-total strong { color: var(--navy); font-size: 19px; }
.sales-chart svg { display: block; width: 100%; height: 174px; overflow: visible; }
.chart-grid line { stroke: #e8edf5; stroke-width: 1; }
.chart-grid text, .chart-labels text { fill: #7b8495; font-size: 9px; }
.chart-area { fill: #2563eb12; }
.chart-line { fill: none; stroke: #2563eb; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.chart-dots circle { fill: #fff; stroke: #2563eb; stroke-width: 2.5; }
.status-overview { display: grid; grid-template-columns: minmax(150px, .8fr) 1.2fr; align-items: center; gap: 26px; min-height: 228px; padding: 22px 30px; }
.status-donut {
  position: relative;
  width: 154px;
  height: 154px;
  margin: auto;
  border-radius: 50%;
}
.status-donut::after {
  position: absolute;
  inset: 34px;
  border-radius: 50%;
  background: #fff;
  content: "";
}
.status-donut > div {
  position: absolute;
  z-index: 1;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.status-donut span, .status-donut small { color: var(--muted); font-size: 8px; }
.status-donut strong { margin: 2px 0; color: var(--navy); font-size: 23px; }
.status-legend { display: grid; gap: 13px; }
.status-legend p {
  display: grid;
  grid-template-columns: 9px 1fr auto;
  gap: 8px;
  align-items: center;
  margin: 0;
  color: #344054;
  font-size: 9px;
}
.status-legend i { width: 7px; height: 7px; border-radius: 50%; }
.status-legend strong { color: var(--navy); font-size: 9px; }
.status-legend strong small { color: var(--muted); font-size: 7px; font-weight: 500; }
.recent-panel .panel-header { display: flex; justify-content: space-between; }
.recent-table { min-width: 760px; }
.panel-link { border: 0; color: var(--blue); background: transparent; font-size: 9px; font-weight: 800; }
.empty-row { height: 88px; color: var(--muted); text-align: center; }
.account-type { display: inline-block; min-width: 42px; padding: 4px 6px; border-radius: 3px; text-align: center; font-size: 8px; font-weight: 800; }
.account-type.company { color: #175cd3; background: #eff8ff; }
.account-type.courier { color: #027a48; background: #ecfdf3; }
.orders-table { min-width: 1120px; }
.order-title { max-width: 240px; }
.order-title strong { color: var(--navy); }
.order-title small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.order-status { display: inline-block; padding: 5px 8px; border-radius: 4px; font-size: 8px; font-weight: 800; }
.order-status.pending { color: #b54708; background: #fffaeb; }
.order-status.assigned { color: #175cd3; background: #eff8ff; }
.assign-button { min-height: 32px; padding: 0 10px; border: 1px solid #b2ccff; border-radius: 5px; color: #175cd3; background: #fff; font-size: 9px; font-weight: 800; }
.order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}
.order-actions .delete {
  margin-left: 0;
}
.admin-action-form {
  display: grid;
  gap: 16px;
  padding: 22px;
  border-bottom: 1px solid var(--line);
}
.admin-action-form h3,
.maintenance-panel h3 {
  margin: 0;
  color: var(--navy);
  font-size: 16px;
}
.admin-action-form p {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.7;
}
.admin-action-form label {
  display: grid;
  gap: 7px;
  color: var(--navy);
  font-size: 10px;
  font-weight: 800;
}
.admin-action-form input,
.admin-action-form select,
.admin-action-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--navy);
  background: #fff;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.admin-action-footer,
.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.admin-action-footer p {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
}
.danger-button {
  border-color: #fecdca;
  background: var(--danger);
}
.danger-button:disabled,
.button:disabled {
  opacity: .5;
  cursor: not-allowed;
}
.recipient-option {
  display: flex;
  gap: 10px;
  align-items: center;
}
.recipient-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}
.recipient-option span {
  display: grid;
  gap: 3px;
}
.recipient-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 220px;
  gap: 12px;
  margin-bottom: 12px;
}
.recipient-controls input,
.recipient-controls select {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--navy);
  background: #fff;
}
.system-warning,
.system-ok {
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 10px;
  font-weight: 800;
}
.system-warning {
  border: 1px solid #fedf89;
  color: #93370d;
  background: #fffaeb;
}
.system-ok {
  border: 1px solid #abefc6;
  color: #027a48;
  background: #ecfdf3;
}
.system-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}
.system-grid .admin-action-form {
  border-bottom: 0;
}
.system-grid .admin-action-form + .admin-action-form {
  border-left: 1px solid var(--line);
}
.maintenance-panel {
  display: grid;
  gap: 16px;
  padding: 22px;
}
.maintenance-calendar-heading {
  color: var(--navy);
  font-size: 14px;
  font-weight: 900;
}
.maintenance-weekdays {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 900;
  text-align: center;
}
.maintenance-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.maintenance-day {
  min-height: 86px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}
.maintenance-day.is-empty {
  border-color: transparent;
  background: transparent;
}
.maintenance-day.has-maintenance {
  border-color: #f79009;
  background: #fffaeb;
}
.maintenance-day strong {
  display: block;
  color: var(--navy);
  font-size: 12px;
}
.maintenance-day small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}
.maintenance-day span {
  display: block;
  margin-top: 7px;
  color: #b54708;
  font-size: 8px;
  font-weight: 800;
  line-height: 1.45;
}
.assignment-body { grid-template-columns: 1fr; }
.assignment-summary { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.assignment-summary div { padding: 11px; border: 1px solid var(--line); border-radius: 5px; background: #f8fafc; }
.assignment-summary span, .assignment-summary strong { display: block; }
.assignment-summary span { margin-bottom: 5px; color: var(--muted); font-size: 8px; }
.assignment-summary strong { font-size: 10px; }
.assignment-manager {
  display: grid;
  gap: 13px;
}
.assignment-section-heading {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}
.assignment-section-heading h3 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 13px;
}
.assignment-section-heading p,
.assignment-help {
  margin: 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}
.assignment-section-heading strong {
  min-width: 52px;
  padding: 7px 10px;
  border-radius: 999px;
  color: #175cd3;
  background: #eff8ff;
  text-align: center;
  font-size: 10px;
}
.assigned-courier-stack {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 44px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafc;
}
.assigned-courier-chip {
  display: inline-flex;
  gap: 7px;
  align-items: center;
  padding: 7px 10px 7px 7px;
  border: 1px solid #b2ccff;
  border-radius: 999px;
  color: #0b2f6f;
  background: #fff;
  font-size: 9px;
  font-weight: 800;
}
.assigned-courier-chip b {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  color: #fff;
  background: var(--blue);
  font-size: 8px;
}
.assignment-candidate-panel {
  display: grid;
  gap: 10px;
}
.assignment-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 220px 150px;
  gap: 8px;
}
.assignment-tools input,
.assignment-tools select,
.assignment-tools button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--navy);
  background: #fff;
  font-size: 10px;
  font-weight: 700;
}
.assignment-tools input {
  padding: 0 12px;
}
.assignment-tools button {
  margin: 0;
}
.assignment-check-list {
  display: grid;
  gap: 7px;
  max-height: 244px;
  overflow: auto;
  padding-right: 2px;
}
.assignment-check-item {
  display: flex;
  gap: 10px;
  align-items: center;
  min-height: 48px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}
.assignment-check-item:hover {
  border-color: #b2ccff;
  background: #f8fbff;
}
.assignment-check-item input {
  width: 16px;
  height: 16px;
  accent-color: var(--blue);
}
.assignment-check-item span {
  display: grid;
  gap: 3px;
}
.assignment-check-item strong {
  color: var(--navy);
  font-size: 10px;
}
.assignment-check-item small {
  color: var(--muted);
  font-size: 8px;
}
.assignment-empty {
  margin: 0;
  padding: 12px;
  border: 1px dashed #cbd5e1;
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

@media (max-width: 700px) {
  .assignment-tools { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .admin-shell { display: block; }
  .sidebar { transform: translateX(-105%); transition: transform 180ms ease; }
  .sidebar.open { transform: translateX(0); }
  .main { width: 100%; margin-left: 0; }
  .menu-button { display: block; }
  .topbar { padding: 0 18px; }
  .sidebar-backdrop { position: fixed; z-index: 20; inset: 0; background: #0f172a66; }
  .sidebar-backdrop.show { display: block; }
  .dashboard-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .admin-filters { grid-template-columns: 1fr; }
  .recipient-controls { grid-template-columns: 1fr; }
  .system-grid { grid-template-columns: 1fr; }
  .system-grid .admin-action-form + .admin-action-form { border-left: 0; border-top: 1px solid var(--line); }
}

@media (max-width: 640px) {
  .page-container { padding: 22px 14px 40px; }
  .page-heading { align-items: start; }
  .page-heading h1 { font-size: 23px; }
  .page-heading .button { min-width: 38px; padding: 0; }
  .page-heading .button span { margin: 0; }
  .page-heading .button { font-size: 0; }
  .page-heading .button span { font-size: 18px; }
  .kpi-grid { grid-template-columns: 1fr; }
  .orders-kpis { grid-template-columns: 1fr; }
  .dashboard-kpis { grid-template-columns: 1fr; }
  .dashboard-heading { gap: 14px; }
  .date-display { min-width: auto; }
  .status-overview { grid-template-columns: 1fr; gap: 18px; }
  .status-legend { width: 100%; }
  .dialog-body { grid-template-columns: 1fr; }
  .dialog-body label { grid-column: 1 / -1; }
  .assignment-summary { grid-template-columns: 1fr; }
}
