﻿:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #101928;
  --muted: #667085;
  --line: #d9e3ef;
  --nav: #08264b;
  --nav-deep: #031b36;
  --blue: #216fed;
  --green: #2faf66;
  --orange: #f28b18;
  --purple: #8b5cf6;
  --slate: #64748b;
  --teal: #0f766e;
  --teal-dark: #0b3f46;
  --aqua: #d9f3f0;
  --yellow: #f3c84b;
  --red: #d92d20;
  --shadow: 0 14px 34px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Segoe UI", "Inter", Arial, sans-serif;
  font-size: 14px;
  font-weight: 400;
}

.login-page {
  min-height: 100vh;
  background: #ffffff;
}

.login-only {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.login-brand p {
  color: var(--muted);
  margin-top: 4px;
}

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  background: linear-gradient(180deg, var(--nav) 0%, var(--nav-deep) 100%);
  color: #fff;
  padding: 24px 16px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  color: #4da3ff;
  font-size: 34px;
  font-weight: 500;
  line-height: 1;
}

.brand-title {
  font-size: 24px;
  font-weight: 500;
  line-height: 1;
}

.brand-subtitle {
  color: #91add0;
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.nav {
  display: grid;
  gap: 8px;
}

.navigation-tree,
.department {
  display: grid;
  gap: 10px;
}

.department-toggle {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  min-height: 42px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-weight: 600;
  border-radius: 8px;
}

.department-body {
  display: grid;
  gap: 8px;
}

.department-body.collapsed {
  display: none;
}

.unit {
  display: grid;
  gap: 8px;
}

.unit-toggle {
  width: 100%;
  border: 0;
  background: transparent;
  color: #93b9bd;
  min-height: 32px;
  padding: 7px 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  border-radius: 8px;
}

.unit-toggle:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #d9e7fb;
}

.nav.collapsed {
  display: none;
}

.nav-label {
  color: #93b9bd;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.nav-item,
.link-button {
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.nav-item {
  padding: 12px 14px;
  border-left: 0;
  color: #d9e7fb;
  border-radius: 8px;
}

.nav-empty {
  padding: 10px 12px;
  color: #93b9bd;
  font-size: 13px;
}

.nav-item.active {
  background: rgba(37, 99, 235, 0.38);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.user-card {
  margin-top: auto;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #d9e7fb;
  border-radius: 8px;
}

.link-button {
  margin-top: 8px;
  color: var(--yellow);
}

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

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

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

.global-search {
  width: min(420px, 32vw);
  min-height: 40px;
  border-radius: 8px;
  background: #fff;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  letter-spacing: 0;
  font-weight: 650;
}

.topbar p {
  margin-top: 5px;
  color: var(--muted);
}

.status-pill {
  padding: 8px 12px;
  background: #e3ecee;
  color: var(--teal-dark);
  font-weight: 500;
  border-radius: 999px;
}

.status-pill.ok {
  background: #dff4e9;
  color: #17633d;
}

.status-pill.error {
  background: #fae1df;
  color: var(--red);
}

.login-panel {
  display: grid;
  place-items: center;
  min-height: 62vh;
}

.login-card {
  width: min(420px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 26px;
  display: grid;
  gap: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 500;
}

input {
  width: 100%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
}

select {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  min-height: 40px;
  padding: 9px 11px;
  border-radius: 8px;
}

.primary-button,
.secondary-button {
  border: 1px solid transparent;
  min-height: 40px;
  padding: 9px 14px;
  cursor: pointer;
  font-weight: 600;
  border-radius: 8px;
}

.primary-button {
  background: var(--blue);
  color: #fff;
}

.secondary-button {
  background: #fff;
  color: #1d4ed8;
  border-color: var(--line);
}

.form-error {
  min-height: 20px;
  color: var(--red);
}

.hidden {
  display: none;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}

.metric-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 18px;
  border-radius: 12px;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.04);
}

.metric-card span {
  display: block;
  color: var(--muted);
  margin-bottom: 12px;
}

.metric-card strong {
  font-size: 32px;
  font-weight: 650;
}

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

.dashboard-header h2 {
  font-size: 26px;
  margin-bottom: 6px;
  font-weight: 650;
}

.dashboard-header p,
.panel-title p,
.queue-item p,
.bottom-card p,
.route-card p {
  color: var(--muted);
}

.date-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.icon-button,
.date-button {
  border: 1px solid var(--line);
  background: #fff;
  color: #344054;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
  border-radius: 8px;
  font-weight: 600;
}

.icon-button {
  width: 40px;
  padding: 0;
}

.icon-button.small {
  width: 34px;
  min-height: 34px;
}

.plan-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 16px;
}

.plan-tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 600;
  border-bottom: 3px solid transparent;
}

.plan-tab.active {
  color: var(--blue);
  border-bottom-color: var(--blue);
}

.logistics-metrics {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  margin-bottom: 16px;
}

.metric-card {
  position: relative;
  overflow: hidden;
}

.metric-card::before {
  content: "";
  position: absolute;
  left: 18px;
  top: 18px;
  width: 46px;
  height: 46px;
  border-radius: 10px;
  opacity: 0.14;
}

.metric-card span,
.metric-card strong,
.metric-card small {
  display: block;
  margin-left: 58px;
}

.metric-card small {
  color: var(--muted);
  margin-top: 4px;
}

.metric-blue::before {
  background: var(--blue);
}

.metric-green::before {
  background: var(--green);
}

.metric-orange::before {
  background: var(--orange);
}

.metric-purple::before {
  background: var(--purple);
}

.metric-slate::before {
  background: var(--slate);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 300px minmax(560px, 1.35fr) minmax(320px, 0.9fr);
  gap: 16px;
}

.queue-panel,
.drivers-panel,
.route-panel,
.bottom-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

.queue-panel,
.drivers-panel,
.route-panel {
  padding: 16px;
}

.drivers-panel {
  grid-column: span 1;
}

.panel-title {
  margin-bottom: 14px;
}

.panel-title h3,
.bottom-card h3 {
  font-size: 18px;
  font-weight: 650;
  margin: 0;
}

.panel-title.split,
.route-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

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

.compact {
  min-height: 34px;
  padding: 7px 10px;
  font-size: 12px;
}

.queue-group {
  border-top: 1px solid var(--line);
  padding: 14px 0;
}

.queue-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #1d4ed8;
  font-weight: 600;
  margin-bottom: 12px;
}

.queue-heading strong,
.danger-count {
  background: #eef4ff;
  color: var(--blue);
  border-radius: 999px;
  min-width: 28px;
  height: 24px;
  display: inline-grid;
  place-items: center;
  font-size: 12px;
}

.queue-heading.warning,
.danger-count {
  color: var(--red);
}

.queue-heading.warning strong {
  background: #fee4e2;
  color: var(--red);
}

.queue-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  align-items: start;
}

.queue-item strong {
  display: block;
  margin-bottom: 4px;
}

.mini-list,
.event-list,
.driver-load-list {
  display: grid;
  gap: 8px;
}

.mini-item {
  width: 100%;
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  align-items: start;
  border: 0;
  background: transparent;
  padding: 7px 0;
  color: var(--ink);
  text-align: left;
  cursor: pointer;
}

.mini-item strong,
.mini-item small {
  display: block;
}

.mini-item small {
  color: var(--muted);
  margin-top: 3px;
}

.empty-state,
.workbench-empty {
  color: var(--muted);
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 12px;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-top: 5px;
  background: var(--blue);
}

.dot-red {
  background: var(--red);
}

.dot-gray {
  background: #98a2b3;
}

.wide-button {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #f8fbff;
  color: var(--blue);
  cursor: pointer;
  border-radius: 8px;
  font-weight: 600;
}

.plan-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.plan-table-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.8fr) repeat(5, minmax(62px, 0.8fr));
  gap: 10px;
  align-items: center;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

.plan-table-row:last-child {
  border-bottom: 0;
}

.plan-table-row.head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.plan-table-row em {
  font-style: normal;
  color: #15803d;
  background: #dcfce7;
  border-radius: 999px;
  padding: 4px 8px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
}

.workbench-table {
  display: grid;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}

.workbench-row {
  display: grid;
  grid-template-columns: 84px minmax(170px, 1.8fr) minmax(110px, 1fr) 58px minmax(110px, 1fr) 118px;
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
}

.workbench-row:last-child {
  border-bottom: 0;
}

.workbench-row.head {
  background: #f8fafc;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.workbench-row strong {
  font-weight: 600;
}

.workbench-row strong small {
  display: block;
  color: var(--muted);
  font-weight: 400;
  margin-top: 3px;
}

.status-badge {
  justify-self: start;
  border-radius: 999px;
  padding: 4px 8px;
  font-style: normal;
  font-size: 12px;
  font-weight: 600;
}

.status-badge.ok {
  background: #dcfce7;
  color: #15803d;
}

.status-badge.bad {
  background: #fee4e2;
  color: var(--red);
}

.status-badge.plan {
  background: #eff6ff;
  color: #1d4ed8;
}

.status-badge.work {
  background: #fff7ed;
  color: #c2410c;
}

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

.map-mock {
  position: relative;
  height: 250px;
  overflow: hidden;
  border-radius: 10px;
  border: 1px solid var(--line);
  background:
    linear-gradient(120deg, rgba(33, 111, 237, 0.08), rgba(47, 175, 102, 0.1)),
    repeating-linear-gradient(0deg, transparent, transparent 28px, rgba(15, 23, 42, 0.06) 29px),
    repeating-linear-gradient(90deg, transparent, transparent 34px, rgba(15, 23, 42, 0.05) 35px);
}

.route-line {
  position: absolute;
  left: 62px;
  top: 52px;
  width: 205px;
  height: 122px;
  border: 4px solid rgba(47, 175, 102, 0.72);
  border-left-color: transparent;
  border-radius: 50%;
  transform: rotate(-14deg);
}

.pin {
  position: absolute;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  font-weight: 650;
  border: 3px solid #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.18);
}

.pin-1 {
  left: 66px;
  top: 74px;
}

.pin-2 {
  right: 76px;
  top: 58px;
}

.pin-3 {
  right: 106px;
  bottom: 68px;
}

.pin-4 {
  left: 122px;
  bottom: 56px;
}

.route-card {
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px;
}

.route-card-head strong {
  color: #15803d;
  background: #dcfce7;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

.route-card h4 {
  margin: 10px 0 6px;
  font-size: 18px;
  font-weight: 650;
}

.route-card .primary-button {
  width: 100%;
  margin-top: 12px;
}

.driver-load-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.driver-load-card strong,
.driver-load-card span {
  display: block;
}

.driver-load-card span {
  color: var(--muted);
  margin-top: 4px;
}

.driver-load-card em {
  font-style: normal;
  font-weight: 650;
}

.load-bar {
  grid-column: 1 / -1;
  height: 6px;
  border-radius: 999px;
  background: #e5e7eb;
  overflow: hidden;
}

.load-bar i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--green);
}

.driver-load-card.warn .load-bar i {
  background: var(--orange);
}

.driver-load-card.bad .load-bar i {
  background: var(--red);
}

.bottom-card {
  padding: 16px;
  min-height: 150px;
}

.bottom-card p {
  min-height: 44px;
  margin: 12px 0;
}

.money-count {
  color: var(--red);
  font-weight: 650;
}

.quick-actions {
  display: grid;
  gap: 10px;
}

.quick-actions button {
  min-height: 38px;
  border: 1px solid #bfdbfe;
  background: #eff6ff;
  color: #1d4ed8;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.event-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  align-items: start;
  padding: 6px 0;
}

.event-item strong,
.event-item small {
  display: block;
}

.event-item small {
  color: var(--muted);
  margin-top: 3px;
}

.table-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.table-toolbar input {
  max-width: 360px;
}

.toolbar-summary {
  margin-left: auto;
  color: var(--muted);
  white-space: nowrap;
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.section-head h2 {
  font-size: 24px;
  font-weight: 650;
  margin: 0 0 5px;
}

.section-head p {
  color: var(--muted);
}

.inline-form {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.8fr 1fr auto;
  gap: 10px;
  align-items: end;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
  padding: 14px;
}

.inline-form.hidden {
  display: none;
}

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

.object-form {
  grid-template-columns: 1.1fr 1.5fr 0.8fr 0.9fr 0.55fr 0.55fr 0.55fr 0.85fr auto;
}

.request-form {
  grid-template-columns: 0.8fr 1.2fr 1fr 0.55fr 0.55fr 0.55fr 0.55fr 0.75fr 0.85fr 1.3fr 0.8fr 1.3fr auto;
}

.wide-field {
  min-width: 220px;
}

.schedule-form {
  grid-template-columns: 1.4fr 1fr 0.8fr 0.8fr 0.55fr 0.55fr 0.55fr 0.55fr 0.75fr auto;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
}

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

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  overflow-wrap: anywhere;
}

th {
  background: #0b3f46;
  color: #fff;
  position: sticky;
  top: 0;
}

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

.service-card,
.admin-panel,
.role-card {
  background: var(--panel);
  border: 1px solid var(--line);
  padding: 14px;
}

.admin-panel {
  display: grid;
  gap: 16px;
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.admin-panel h2 {
  font-size: 22px;
  font-weight: 650;
  margin: 0 0 6px;
}

.admin-panel p {
  color: var(--muted);
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 10px;
}

.role-card {
  border-radius: 10px;
  background: #f8fbff;
}

.role-card strong,
.role-card span,
.role-card p {
  display: block;
}

.role-card strong {
  margin-bottom: 5px;
}

.role-card span {
  color: var(--blue);
  font-size: 12px;
}

.role-card p {
  margin-top: 8px;
  font-size: 12px;
}

.service-card strong {
  display: block;
  margin-bottom: 8px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  background: #edf5f6;
  color: var(--teal-dark);
  padding: 5px 8px;
  font-size: 12px;
}

.role-tag {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
}

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

  .sidebar {
    min-height: auto;
  }

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

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

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

  .global-search {
    width: 100%;
  }

  .logistics-metrics,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .plan-table-row {
    grid-template-columns: 1fr 1fr;
  }

  .workbench-row {
    grid-template-columns: 1fr 1fr;
  }

  .section-head,
  .table-toolbar,
  .inline-form {
    align-items: stretch;
    grid-template-columns: 1fr;
    flex-direction: column;
  }

  .table-toolbar input {
    max-width: none;
  }

  .toolbar-summary {
    margin-left: 0;
  }
}

