:root {
  color-scheme: light;
  --bg: #071f43;
  --panel: #ffffff;
  --line: #dbe2ec;
  --text: #1f2933;
  --muted: #65758b;
  --primary: #1e58bd;
  --primary-dark: #0b3e94;
  --accent: #28b46b;
  --danger: #c2413b;
  --shadow: 0 16px 42px rgba(31, 41, 51, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--bg);
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

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

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background:
    linear-gradient(135deg, rgba(30, 88, 189, 0.36), transparent 42%),
    linear-gradient(315deg, rgba(6, 31, 67, 0.9), transparent 44%),
    #071f43;
}

.login-panel {
  width: min(420px, calc(100vw - 32px));
  padding: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.brand-mark {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}

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

.login-panel h1 {
  margin: 18px 0 24px;
  font-size: 28px;
}

.login-info {
  display: grid;
  gap: 5px;
  margin: -10px 0 22px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  background: #f8fafc;
  font-size: 13px;
}

.login-info strong {
  color: var(--text);
  font-size: 15px;
}

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

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

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

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--text);
  background: #fff;
  outline: none;
}

input,
select {
  height: 40px;
  padding: 0 11px;
}

textarea {
  padding: 10px 11px;
  resize: vertical;
}

.date-range-inputs {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: center;
}

.date-range-inputs.is-range {
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
}

.date-range-separator {
  color: var(--muted);
  font-size: 12px;
  white-space: nowrap;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(22, 119, 199, 0.12);
}

.primary-btn,
.ghost-btn,
.icon-btn {
  border-radius: 6px;
  border: 1px solid transparent;
  min-height: 40px;
  padding: 0 16px;
}

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

.primary-btn:hover {
  background: var(--primary-dark);
}

.ghost-btn,
.icon-btn {
  color: var(--text);
  border-color: var(--line);
  background: #fff;
}

.danger-action {
  color: var(--danger);
}

.small {
  min-height: 36px;
}

.error-text {
  min-height: 22px;
  margin-top: 14px;
  color: var(--danger);
}

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

.sidebar {
  padding: 14px 10px;
  color: #d8e7f4;
  background: #27384f;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  margin-bottom: 18px;
}

.sidebar-brand strong {
  width: 44px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 4px;
  color: #fff;
  background: var(--primary);
}

.nav-item {
  width: 100%;
  min-height: 48px;
  margin: 3px 0;
  padding: 0 14px;
  text-align: left;
  color: #c7d6e3;
  border: 0;
  border-radius: 6px;
  background: transparent;
}

.nav-group {
  margin: 14px 10px 6px;
  color: #94a9c0;
  font-size: 12px;
}

.nav-section {
  margin: 8px 0;
}

.nav-section summary {
  min-height: 38px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: #d8e7f4;
  border-radius: 6px;
  cursor: pointer;
  user-select: none;
}

.nav-section summary:hover {
  background: rgba(255, 255, 255, 0.08);
}

.nav-section .nav-item {
  min-height: 38px;
  padding-left: 28px;
  font-size: 13px;
}

.nav-section:not([open]) .nav-item {
  display: none;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  background: #1e58bd;
}

.workspace {
  min-width: 0;
  padding: 16px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 54px;
  margin: -16px -16px 14px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.topbar h2 {
  font-size: 24px;
}

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

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

.page {
  display: none;
}

.active-page {
  display: block;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 14px;
}

.report-stats {
  margin-bottom: 12px;
}

.summary-card,
.table-panel,
.toolbar,
.modal-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.summary-card {
  padding: 18px;
  color: #fff;
  border-color: #1a4fae;
  background: linear-gradient(135deg, #1e58bd, #0b3e94);
}

.summary-card span {
  color: rgba(255, 255, 255, 0.9);
  font-size: 13px;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  font-size: 32px;
}

.toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  margin-bottom: 12px;
  padding: 14px;
}

.search-toolbar {
  flex-wrap: wrap;
}

.search-toolbar label {
  min-width: 160px;
}

.table-panel {
  overflow: auto;
}

.calendar-panel {
  display: grid;
  gap: 1px;
  margin-bottom: 14px;
  max-height: calc(100vh - 270px);
  min-height: 420px;
  overflow: auto;
  border: 1px solid #1e58bd;
  border-radius: 0;
  background: var(--line);
}

.calendar-head,
.vehicle-head,
.vehicle-cell,
.schedule-cell {
  min-height: 46px;
  padding: 10px;
  background: #fff;
}

.calendar-head,
.vehicle-head {
  position: sticky;
  top: 0;
  z-index: 4;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
  background: #eef4ff;
}

.calendar-head.today {
  color: #fff;
  background: var(--primary);
}

.calendar-head.holiday {
  color: #c2413b;
}

.calendar-head.today.holiday {
  color: #fff;
}

.vehicle-head,
.vehicle-cell {
  position: sticky;
  left: 0;
  z-index: 5;
  min-width: 170px;
}

.vehicle-head {
  z-index: 6;
}

.vehicle-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 58px;
  background: #eef4ff;
}

.vehicle-cell strong,
.vehicle-cell span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.vehicle-cell span {
  color: var(--muted);
  font-size: 12px;
}

.schedule-cell {
  position: relative;
  min-width: 132px;
  min-height: 58px;
  padding: 8px;
  overflow: hidden;
}

.compact-schedule-cell {
  display: flex;
  align-items: center;
  min-height: 58px;
  padding: 0;
}

.compact-schedule-cell.has-orders {
  cursor: pointer;
}

.compact-schedule-cell.has-orders:hover,
.compact-schedule-cell.selected-cell {
  background: #e6f1ff;
  box-shadow: inset 0 0 0 2px rgba(30, 88, 189, 0.22);
}

.schedule-cell.today {
  background: #f3f9ff;
}

.schedule-cell.today.has-orders:hover,
.schedule-cell.today.selected-cell {
  background: #dff0ff;
}

.time-guide {
  position: absolute;
  left: 8px;
  right: 8px;
  z-index: 0;
  height: 1px;
  border-top: 1px dashed #d2deeb;
  color: #8a98aa;
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}

.time-guide span {
  position: absolute;
  top: -6px;
  right: 0;
  padding-left: 4px;
  background: inherit;
}

.vehicle-order-controls {
  display: grid;
  grid-template-columns: repeat(2, 24px);
  gap: 3px;
}

.icon-btn.tiny {
  width: 24px;
  min-height: 24px;
  padding: 0;
  font-size: 13px;
}

.icon-btn.tiny:disabled {
  cursor: default;
  opacity: 0.38;
}

.calendar-order {
  position: absolute;
  left: 8px;
  right: 8px;
  z-index: 1;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  grid-template-rows: 16px 14px;
  column-gap: 5px;
  align-items: center;
  min-height: 32px;
  margin: 0;
  padding: 4px 5px;
  border: 1px solid #bfd4ea;
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  color: var(--text);
  background: #f6fbff;
  text-align: left;
  box-shadow: 0 1px 2px rgba(31, 41, 51, 0.08);
  transition: background 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease, transform 0.12s ease;
}

.calendar-order:hover {
  z-index: 4;
  border-color: #1e58bd;
  background: #e6f1ff;
  box-shadow: 0 6px 14px rgba(30, 88, 189, 0.2);
  transform: translateY(-1px);
}

.calendar-order.selected {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(22, 119, 199, 0.2);
}

.calendar-icon-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  width: 100%;
  max-height: 48px;
  overflow: hidden;
}

.calendar-driver-block {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  min-height: 58px;
  overflow: hidden;
}

.calendar-driver-segment {
  position: relative;
  display: grid;
  align-items: end;
  min-width: 0;
  padding: 4px 5px;
}

.calendar-driver-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 800;
  text-shadow: 0 1px 1px rgba(0, 0, 0, 0.14);
}

.calendar-driver-overlay {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: start;
  gap: 4px;
  padding: 5px;
  pointer-events: none;
}

.calendar-driver-time {
  padding: 1px 4px;
  border-radius: 3px;
  color: #fff;
  background: rgba(15, 23, 42, 0.62);
  font-size: 11px;
  font-weight: 800;
}

.calendar-driver-icons {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
}

.calendar-driver-icons b,
.calendar-driver-icons em {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  border-radius: 3px;
  color: #1f2933;
  background: rgba(255, 255, 255, 0.9);
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.calendar-driver-icons b.service-pickup {
  transform: rotate(55deg);
}

.calendar-driver-icons b.service-dropoff {
  color: #d48219;
  transform: rotate(-35deg);
}

.calendar-order-icon,
.calendar-order-more {
  display: grid;
  flex: 0 0 20px;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid #bfd4ea;
  border-left: 3px solid var(--primary);
  border-radius: 4px;
  color: var(--text);
  background: #f6fbff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
}

.calendar-order-more {
  border-left-color: #65758b;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
}

.calendar-order-icon.service-pickup,
.calendar-order-icon.service-dropoff {
  color: var(--primary);
  background: #fff;
  font-size: 14px;
}

.calendar-order-icon.service-pickup {
  transform: rotate(55deg);
}

.calendar-order-icon.service-dropoff {
  color: #d48219;
  transform: rotate(-35deg);
}

.calendar-order-icon.service-dropoff {
  border-left-color: #d48219;
}

.calendar-order-icon.service-tour {
  border-left-color: var(--accent);
  background: #f0fbf4;
}

.calendar-order-icon.service-multiday {
  border-left-color: #0f9aa8;
  background: #eefcfd;
}

.calendar-order-icon.service-deadhead {
  border-left-color: #8f5cc2;
  background: #f7f1fb;
}

.calendar-order-icon.service-station {
  border-left-color: #cc7a1d;
  background: #fff7eb;
}

.calendar-order-icon.service-point {
  border-left-color: #5b78d6;
  background: #f1f4ff;
}

.calendar-order span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
}

.event-icon {
  grid-row: 1 / span 2;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  color: #fff;
  background: var(--primary);
  font-size: 13px;
  font-weight: 800;
}

.calendar-order.service-pickup .event-icon,
.calendar-order.service-dropoff .event-icon {
  color: var(--primary);
  background: transparent;
  font-size: 18px;
}

.calendar-order.service-pickup .event-icon {
  transform: rotate(55deg);
}

.calendar-order.service-dropoff .event-icon {
  color: #d48219;
  transform: rotate(-35deg);
}

.event-main {
  color: var(--text);
  font-weight: 700;
}

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

.calendar-order.service-dropoff {
  border-left-color: #d48219;
  background: #fff8ed;
}

.calendar-order.service-dropoff .event-icon {
  background: transparent;
}

.calendar-order.service-tour {
  border-left-color: var(--accent);
  background: #f0fbf4;
}

.calendar-order.service-tour .event-icon {
  background: var(--accent);
}

.calendar-order.service-multiday {
  border-left-color: #0f9aa8;
  background: #eefcfd;
}

.calendar-order.service-multiday .event-icon {
  background: #0f9aa8;
}

.calendar-order.service-deadhead {
  border-left-color: #8f5cc2;
  background: #f7f1fb;
}

.calendar-order.service-deadhead .event-icon {
  background: #8f5cc2;
}

.calendar-order.service-station {
  border-left-color: #cc7a1d;
  background: #fff7eb;
}

.calendar-order.service-station .event-icon {
  background: #cc7a1d;
}

.calendar-order.service-point {
  border-left-color: #5b78d6;
  background: #f1f4ff;
}

.calendar-order.service-point .event-icon {
  background: #5b78d6;
}

.calendar-order.trip-linked-order {
  border-top-style: dashed;
  border-bottom-style: dashed;
}

.calendar-order.trip-linked-order::after {
  content: "";
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: -6px;
  width: 2px;
  background: #0f9aa8;
}

.calendar-order.trip-linked-order.trip-start::after {
  top: 4px;
}

.calendar-order.trip-linked-order.trip-end::after {
  bottom: 4px;
}

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

#driversPage table,
#vehiclesPage table,
#goodsPage table,
#genericTable {
  min-width: 1680px;
}

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

th {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  background: #f8fafc;
}

td {
  font-size: 14px;
}

.empty-cell {
  height: 96px;
  text-align: center;
  color: var(--muted);
  background: #fafcff;
}

.status {
  display: inline-grid;
  place-items: center;
  min-width: 64px;
  height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  color: #0f5f9d;
  background: #e5f2fc;
  font-size: 12px;
}

.color-swatch {
  display: inline-block;
  width: 28px;
  height: 18px;
  border: 1px solid rgba(0, 0, 0, 0.08);
}

.modal {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, 0.42);
  z-index: 1000;
  overflow: auto;
}

.modal-card {
  width: min(860px, 100%);
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding: 18px;
  box-shadow: var(--shadow);
  margin: auto;
}

.draggable-modal-card {
  position: fixed;
  margin: 0;
  min-width: min(520px, calc(100vw - 24px));
  min-height: 240px;
  resize: both;
}

.draggable-modal-card header {
  cursor: move;
  user-select: none;
}

.compact-modal {
  width: min(560px, 100%);
}

.modal-open {
  overflow: hidden;
}

.permission-panel {
  margin-top: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

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

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

.permission-group {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.inline-check {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text);
  font-size: 13px;
}

.inline-check input {
  width: auto;
  height: auto;
}

.select-action-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.model-editor-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
  margin-bottom: 14px;
}

.model-editor-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 24px 24px auto;
  gap: 6px;
  align-items: center;
}

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

.modal-card header {
  margin-bottom: 16px;
}

.modal-card footer {
  justify-content: flex-end;
  margin-top: 16px;
}

.icon-btn {
  width: 36px;
  min-height: 36px;
  padding: 0;
  font-size: 24px;
  line-height: 1;
}

.icon-btn.small {
  width: 28px;
  min-height: 28px;
  font-size: 18px;
}

.order-popover {
  position: fixed;
  width: min(360px, calc(100vw - 24px));
  max-height: min(520px, calc(100vh - 24px));
  overflow: hidden;
  min-width: min(300px, calc(100vw - 24px));
  min-height: 160px;
  resize: both;
  border: 1px solid #b9cbe0;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 18px 48px rgba(15, 23, 42, 0.24);
}

.calendar-cell-popover {
  width: min(720px, calc(100vw - 24px));
  min-width: min(560px, calc(100vw - 24px));
}

.order-edit-popover {
  width: min(920px, calc(100vw - 24px));
  max-height: min(760px, calc(100vh - 24px));
  min-width: min(640px, calc(100vw - 24px));
  min-height: 360px;
  overflow: auto;
}

.order-edit-popover .modal-card {
  width: 100%;
  max-height: none;
  margin: 0;
  box-shadow: none;
}

.order-edit-popover header {
  cursor: move;
  user-select: none;
}

.order-popover-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  color: #fff;
  background: var(--primary);
  cursor: move;
  user-select: none;
}

.order-popover-head div {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 8px;
}

.order-popover-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
}

.order-popover-type {
  display: grid;
  flex: 0 0 24px;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.18);
  font-weight: 800;
}

.order-popover-type.service-pickup,
.order-popover-type.service-dropoff {
  background: rgba(255, 255, 255, 0.92);
  color: var(--primary);
  font-size: 18px;
}

.order-popover-type.service-pickup {
  transform: rotate(55deg);
}

.order-popover-type.service-dropoff {
  color: #d48219;
  transform: rotate(-35deg);
}

.order-popover-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1px;
  max-height: 360px;
  overflow: auto;
  background: var(--line);
}

.order-popover-body div {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 10px;
  padding: 9px 12px;
  background: #fff;
}

.order-popover-body span {
  color: var(--muted);
  font-size: 12px;
}

.order-popover-body strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.calendar-cell-popover-body {
  max-height: min(520px, calc(100vh - 120px));
  background: #fff;
}

.calendar-cell-popover-body .cell-order-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  padding: 10px;
  background: #fff;
}

.calendar-cell-popover-body .cell-order-row {
  display: grid;
  grid-template-columns: 24px 92px minmax(120px, 1.2fr) minmax(120px, 1fr) minmax(100px, 0.8fr) auto;
  gap: 8px;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  color: var(--text);
  background: #f8fafc;
  text-align: left;
}

.calendar-cell-popover-body .cell-order-row:hover {
  border-color: #1e58bd;
  background: #eaf3ff;
}

.cell-order-row.service-dropoff {
  border-left-color: #d48219;
}

.cell-order-row.service-tour {
  border-left-color: var(--accent);
}

.cell-order-row.service-multiday {
  border-left-color: #0f9aa8;
}

.cell-order-row.service-deadhead {
  border-left-color: #8f5cc2;
}

.cell-order-row.service-station {
  border-left-color: #cc7a1d;
}

.cell-order-row.service-point {
  border-left-color: #5b78d6;
}

.cell-order-type {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  color: #fff;
  background: var(--primary);
  font-weight: 800;
}

.cell-order-row.service-pickup .cell-order-type,
.cell-order-row.service-dropoff .cell-order-type {
  color: var(--primary);
  background: #fff;
  font-size: 16px;
}

.cell-order-row.service-pickup .cell-order-type {
  transform: rotate(55deg);
}

.cell-order-row.service-dropoff .cell-order-type {
  color: #d48219;
  transform: rotate(-35deg);
}

.cell-order-row strong,
.cell-order-row span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
}

.cell-order-row strong {
  font-size: 13px;
}

.cell-order-empty {
  padding: 18px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
}

.order-popover footer {
  display: flex;
  justify-content: flex-end;
  padding: 10px 12px;
  background: #f8fafc;
}

.trip-days-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #cfe0f2;
  border-radius: 6px;
  background: #f6fbff;
}

.trip-days-head,
.trip-day-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.trip-days-head strong,
.trip-day-title strong {
  color: var(--text);
  font-size: 14px;
}

.trip-days-list {
  display: grid;
  gap: 10px;
}

.trip-day-card {
  display: grid;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.compact-form-grid {
  gap: 10px;
}

.trip-day-card textarea {
  min-height: 48px;
}

.transfer-panel {
  display: grid;
  gap: 12px;
  padding: 12px;
  border: 1px solid #d6e3ef;
  border-radius: 6px;
  background: #fbfdff;
}

.transfer-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.transfer-head strong {
  color: var(--text);
  font-size: 14px;
}

.transfer-head span {
  max-width: 520px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: right;
}

.attachment-panel {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
}

.attachment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.attachment-head strong {
  color: var(--text);
  font-size: 14px;
}

.hint-text,
.attachment-empty {
  color: var(--muted);
  font-size: 12px;
}

.attachment-list {
  display: grid;
  gap: 8px;
}

.attachment-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
}

.attachment-item strong,
.attachment-item span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-item strong {
  margin-bottom: 4px;
  font-size: 13px;
}

.attachment-item span {
  color: var(--muted);
  font-size: 12px;
}

.attachment-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

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

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

  .sidebar {
    display: flex;
    overflow-x: auto;
    gap: 6px;
  }

  .sidebar-brand {
    min-width: 130px;
    margin: 0;
  }

  .nav-item {
    min-width: 96px;
    text-align: center;
  }

  .summary-grid,
  .two-cols {
    grid-template-columns: 1fr;
  }

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

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

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

/* RBC premium operations theme */
:root {
  --bg: #0b1420;
  --panel: #ffffff;
  --panel-soft: #f7f4ef;
  --surface: #fbfaf7;
  --surface-strong: #f1eee8;
  --line: #dfd9ce;
  --line-strong: #cfc5b8;
  --text: #202833;
  --muted: #6d7784;
  --muted-strong: #4d5968;
  --primary: #123a5d;
  --primary-dark: #08263f;
  --primary-soft: #e9f0f5;
  --accent: #7d6542;
  --accent-soft: #f1eadf;
  --danger: #a9433f;
  --success: #2d6b57;
  --shadow: 0 22px 60px rgba(21, 29, 38, 0.14);
  --shadow-soft: 0 10px 28px rgba(21, 29, 38, 0.08);
  --radius: 8px;
}

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

body {
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), transparent 240px),
    var(--bg);
  font-family: "Yu Gothic UI", "Yu Gothic", "Hiragino Sans", "Meiryo", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select,
textarea {
  letter-spacing: 0;
}

button {
  transition: background-color 0.16s ease, border-color 0.16s ease, color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

input,
select,
textarea {
  border-color: var(--line);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.92);
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background-color 0.16s ease;
}

input,
select {
  height: 42px;
}

textarea {
  line-height: 1.55;
}

label {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 700;
}

label span {
  letter-spacing: 0.02em;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(18, 58, 93, 0.11), inset 0 1px 0 rgba(255, 255, 255, 0.94);
}

.primary-btn,
.ghost-btn,
.icon-btn {
  border-radius: var(--radius);
  min-height: 42px;
  font-weight: 800;
}

.primary-btn {
  color: #fff;
  border-color: #0f344f;
  background: linear-gradient(180deg, #1b4b72, var(--primary));
  box-shadow: 0 10px 18px rgba(18, 58, 93, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.14);
}

.primary-btn:hover {
  background: linear-gradient(180deg, #123f64, var(--primary-dark));
  box-shadow: 0 12px 22px rgba(18, 58, 93, 0.22), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transform: translateY(-1px);
}

.ghost-btn,
.icon-btn {
  color: var(--primary);
  border-color: var(--line-strong);
  background: linear-gradient(180deg, #fff, #f8f6f1);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9);
}

.ghost-btn:hover,
.icon-btn:hover {
  color: var(--primary-dark);
  border-color: #b8ab9c;
  background: #fff;
  box-shadow: 0 8px 18px rgba(28, 37, 46, 0.09);
}

.small {
  min-height: 36px;
  padding-inline: 14px;
  font-size: 13px;
}

.danger-action {
  color: var(--danger);
  border-color: rgba(169, 67, 63, 0.28);
}

.login-shell {
  background:
    radial-gradient(circle at 18% 18%, rgba(189, 170, 132, 0.18), transparent 30%),
    linear-gradient(135deg, #081521 0%, #10263a 48%, #0a1320 100%);
}

.login-panel {
  padding: 38px;
  border-color: rgba(223, 217, 206, 0.72);
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(251, 250, 247, 0.98)),
    var(--panel);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.brand-mark,
.sidebar-brand strong {
  color: #fff;
  background: linear-gradient(135deg, #163d5e, #0b2238);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.16), 0 12px 24px rgba(8, 38, 63, 0.2);
}

.login-panel h1 {
  color: var(--primary-dark);
  font-size: 27px;
  letter-spacing: 0;
}

.login-info {
  border-color: var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #fff, var(--surface));
}

.app-shell {
  grid-template-columns: 236px minmax(0, 1fr);
  background:
    linear-gradient(180deg, #f8f6f1 0, #f3f0e9 360px, #efebe3 100%);
}

.sidebar {
  padding: 18px 13px;
  color: #d7dee5;
  background:
    linear-gradient(180deg, #101d2a 0%, #15283a 58%, #111a26 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.18);
}

.sidebar-brand {
  height: 58px;
  margin: 0 4px 18px;
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.11);
}

.sidebar-brand strong {
  width: 48px;
  height: 36px;
  border-radius: 6px;
  font-size: 13px;
}

.sidebar-brand span {
  color: #edf2f5;
  font-weight: 800;
}

.nav-section {
  margin: 10px 0;
}

.nav-section summary {
  min-height: 34px;
  padding: 0 12px;
  color: #aebbc7;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.nav-section summary:hover {
  background: rgba(255, 255, 255, 0.06);
}

.nav-item {
  position: relative;
  min-height: 42px;
  margin: 4px 0;
  padding: 0 14px 0 18px;
  color: #d4dde5;
  border: 1px solid transparent;
  border-radius: var(--radius);
  font-size: 14px;
  font-weight: 700;
}

.nav-section .nav-item {
  min-height: 38px;
  padding-left: 30px;
  font-size: 13px;
}

.nav-item::before {
  content: "";
  position: absolute;
  left: 9px;
  top: 50%;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: rgba(196, 180, 145, 0.72);
  transform: translateY(-50%);
}

.nav-section .nav-item::before {
  left: 18px;
}

.nav-item.active,
.nav-item:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.13);
  background: linear-gradient(90deg, rgba(190, 170, 128, 0.26), rgba(255, 255, 255, 0.08));
  box-shadow: inset 3px 0 0 #bda16c;
}

.workspace {
  padding: 22px;
}

.topbar {
  min-height: 72px;
  margin: -22px -22px 18px;
  padding: 0 24px;
  border-bottom-color: rgba(207, 197, 184, 0.88);
  background: rgba(251, 250, 247, 0.88);
  backdrop-filter: blur(14px);
  box-shadow: 0 8px 24px rgba(28, 37, 46, 0.05);
}

.topbar h2 {
  color: #172435;
  font-size: 25px;
  font-weight: 900;
}

.topbar p {
  color: var(--muted);
  font-size: 13px;
}

.user-box {
  padding: 7px;
  border: 1px solid rgba(207, 197, 184, 0.8);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
}

#adminName {
  padding-left: 10px;
  color: var(--primary-dark);
  font-weight: 800;
}

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

.summary-card,
.table-panel,
.toolbar,
.modal-card,
.permission-panel,
.permission-group,
.trip-days-panel,
.trip-day-card,
.attachment-panel,
.attachment-item {
  border-color: var(--line);
  border-radius: var(--radius);
}

.summary-card {
  position: relative;
  min-height: 118px;
  padding: 20px;
  color: var(--text);
  overflow: hidden;
  background:
    linear-gradient(135deg, rgba(18, 58, 93, 0.08), transparent 45%),
    linear-gradient(180deg, #fff, var(--surface));
  box-shadow: var(--shadow-soft);
}

.summary-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--primary), #bda16c);
}

.summary-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.summary-card strong {
  margin-top: 12px;
  color: var(--primary-dark);
  font-size: 34px;
  line-height: 1;
}

.toolbar {
  align-items: end;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.74);
  box-shadow: var(--shadow-soft);
}

.toolbar strong,
#calendarTitle {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  padding: 0 12px;
  color: var(--primary-dark);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 13px;
}

.search-toolbar {
  row-gap: 12px;
}

.search-toolbar label {
  min-width: 168px;
}

.table-panel {
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow-soft);
}

table {
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  padding: 13px 14px;
  border-bottom-color: rgba(223, 217, 206, 0.82);
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  color: #536171;
  background: linear-gradient(180deg, #f8f6f1, #efeae2);
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

td {
  background: #fff;
  font-size: 13px;
  line-height: 1.45;
}

tbody tr:nth-child(even) td {
  background: #fcfbf8;
}

tbody tr:hover td {
  background: #f3f7f8;
}

.status {
  min-width: 68px;
  height: 26px;
  color: #17486d;
  border: 1px solid rgba(23, 72, 109, 0.16);
  background: #eaf2f7;
  font-weight: 800;
}

.color-swatch {
  width: 36px;
  height: 20px;
  border: 2px solid #fff;
  border-radius: 999px;
  box-shadow: 0 0 0 1px rgba(32, 40, 51, 0.15), 0 4px 10px rgba(32, 40, 51, 0.12);
}

.calendar-panel {
  gap: 0;
  margin-bottom: 16px;
  height: calc(100vh - 230px);
  max-height: none;
  min-height: 560px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: var(--line);
  box-shadow: var(--shadow);
  scrollbar-color: #b6ab9d #f1eee8;
}

#ordersPage.active-page .calendar-panel {
  display: grid !important;
  visibility: visible;
}

.calendar-head,
.vehicle-head,
.vehicle-cell,
.schedule-cell {
  border-right: 1px solid rgba(223, 217, 206, 0.92);
  border-bottom: 1px solid rgba(223, 217, 206, 0.92);
  background: #fff;
}

.calendar-head,
.vehicle-head {
  color: #526071;
  background: linear-gradient(180deg, #f8f6f1, #e9e3d9);
  font-size: 12px;
  font-weight: 900;
  line-height: 1.35;
}

.calendar-head.today {
  color: #fff;
  background: linear-gradient(180deg, #1c4a70, #0d304e);
  box-shadow: inset 0 -3px 0 #bda16c;
}

.calendar-head.holiday:not(.today) {
  color: #9d3f3b;
  background: linear-gradient(180deg, #fff7f4, #f3e7df);
}

.vehicle-head,
.vehicle-cell {
  min-width: 190px;
}

.vehicle-cell {
  padding: 9px 12px;
  color: var(--primary-dark);
  background: linear-gradient(90deg, #f8f6f1, #fff);
  box-shadow: 8px 0 18px rgba(28, 37, 46, 0.04);
}

.vehicle-cell strong {
  font-size: 13px;
  font-weight: 900;
}

.vehicle-cell span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 11px;
}

.vehicle-order-controls {
  grid-template-columns: repeat(2, 25px);
}

.icon-btn.tiny {
  width: 25px;
  min-height: 25px;
  border-radius: 6px;
  color: #526071;
  background: #fff;
  font-size: 12px;
}

.schedule-cell {
  min-width: 132px;
  background:
    linear-gradient(90deg, rgba(18, 58, 93, 0.025) 1px, transparent 1px),
    #fff;
}

.compact-schedule-cell {
  min-height: 62px;
}

.compact-schedule-cell.has-orders:hover,
.compact-schedule-cell.selected-cell {
  background: #eff6f8;
  box-shadow: inset 0 0 0 2px rgba(18, 58, 93, 0.2);
}

.schedule-cell.today {
  background:
    linear-gradient(180deg, rgba(189, 161, 108, 0.16), transparent 58%),
    #fffdf7;
}

.calendar-driver-block {
  min-height: 62px;
  border-radius: 0;
  background: #f9faf8;
}

.calendar-driver-segment {
  isolation: isolate;
  padding: 5px 6px;
}

.calendar-driver-segment::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0.03)),
    linear-gradient(90deg, rgba(0, 0, 0, 0.08), transparent 16%, transparent 84%, rgba(0, 0, 0, 0.08));
  pointer-events: none;
  mix-blend-mode: soft-light;
}

.calendar-driver-name {
  position: relative;
  z-index: 1;
  max-width: 100%;
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.14);
  font-size: 11px;
  font-weight: 900;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.22);
}

.calendar-driver-overlay {
  padding: 6px;
}

.calendar-driver-time {
  border: 1px solid rgba(255, 255, 255, 0.34);
  border-radius: 999px;
  background: rgba(9, 20, 32, 0.7);
  box-shadow: 0 4px 10px rgba(9, 20, 32, 0.16);
  font-size: 10px;
}

.calendar-driver-icons {
  gap: 4px;
}

.calendar-driver-icons b,
.calendar-driver-icons em,
.calendar-order-icon,
.calendar-order-more,
.event-icon,
.cell-order-type,
.order-popover-type {
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(9, 20, 32, 0.1);
}

.calendar-driver-icons b,
.calendar-driver-icons em {
  width: 19px;
  height: 19px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.94);
  font-size: 10px;
}

.calendar-order,
.calendar-order-icon {
  border-color: rgba(18, 58, 93, 0.2);
  border-left-color: var(--primary);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 6px 14px rgba(32, 40, 51, 0.1);
}

.calendar-order:hover {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 12px 24px rgba(18, 58, 93, 0.18);
}

.calendar-order.service-dropoff,
.calendar-order-icon.service-dropoff,
.cell-order-row.service-dropoff {
  border-left-color: #b9732d;
}

.calendar-order.service-tour,
.calendar-order-icon.service-tour,
.cell-order-row.service-tour {
  border-left-color: #2d6b57;
}

.calendar-order.service-multiday,
.calendar-order-icon.service-multiday,
.cell-order-row.service-multiday {
  border-left-color: #247481;
}

.calendar-order.service-deadhead,
.calendar-order-icon.service-deadhead,
.cell-order-row.service-deadhead {
  border-left-color: #7f6690;
}

.calendar-order.service-station,
.calendar-order-icon.service-station,
.cell-order-row.service-station {
  border-left-color: #9b6a35;
}

.calendar-order.service-point,
.calendar-order-icon.service-point,
.cell-order-row.service-point {
  border-left-color: #566f9f;
}

.event-main {
  color: var(--primary-dark);
}

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

.modal {
  padding: 22px;
  background: rgba(8, 18, 29, 0.56);
  backdrop-filter: blur(8px);
}

.modal-card {
  padding: 22px;
  border-color: rgba(223, 217, 206, 0.9);
  border-radius: 10px;
  background:
    linear-gradient(180deg, #fff, var(--surface)),
    var(--panel);
  box-shadow: 0 28px 86px rgba(5, 15, 26, 0.32);
}

.modal-card header {
  position: sticky;
  top: -22px;
  z-index: 3;
  margin: -22px -22px 18px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.96);
  backdrop-filter: blur(12px);
}

.modal-card header h3 {
  color: var(--primary-dark);
  font-size: 18px;
  font-weight: 900;
}

.modal-card footer {
  position: sticky;
  bottom: -22px;
  margin: 18px -22px -22px;
  padding: 16px 22px;
  border-top: 1px solid var(--line);
  background: rgba(251, 250, 247, 0.96);
  backdrop-filter: blur(12px);
}

.permission-panel,
.trip-days-panel,
.attachment-panel {
  background: linear-gradient(180deg, #fff, var(--surface));
}

.permission-group,
.trip-day-card,
.attachment-item {
  background: #fff;
  box-shadow: 0 4px 12px rgba(32, 40, 51, 0.04);
}

.order-popover {
  border-color: rgba(207, 197, 184, 0.95);
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 24px 70px rgba(8, 18, 29, 0.24);
}

.order-popover-head {
  padding: 11px 13px;
  color: #fff;
  background: linear-gradient(135deg, #153b5d, #0a2238);
}

.order-popover-head .icon-btn {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
}

.order-popover-type {
  background: rgba(255, 255, 255, 0.16);
}

.order-popover-body {
  background: var(--line);
}

.order-popover-body div {
  background: #fff;
}

.order-popover footer {
  border-top: 1px solid var(--line);
  background: var(--surface);
}

.calendar-cell-popover-body .cell-order-list {
  gap: 9px;
  padding: 12px;
  background: var(--surface);
}

.calendar-cell-popover-body .cell-order-row {
  min-height: 46px;
  border-color: var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 5px 14px rgba(32, 40, 51, 0.06);
}

.calendar-cell-popover-body .cell-order-row:hover {
  border-color: var(--primary);
  background: #fbfdff;
}

.attachment-head strong,
.permission-head strong,
.trip-days-head strong,
.trip-day-title strong {
  color: var(--primary-dark);
  font-weight: 900;
}

.hint-text,
.attachment-empty {
  color: var(--muted);
}

button:disabled {
  box-shadow: none;
  transform: none;
}

@media (max-width: 860px) {
  .app-shell {
    background: #f3f0e9;
  }

  .sidebar {
    padding: 10px;
  }

  .sidebar-brand {
    min-width: 146px;
    height: 46px;
    padding-bottom: 0;
    border-bottom: 0;
  }

  .nav-section {
    display: contents;
  }

  .nav-section summary {
    min-width: 96px;
  }

  .nav-item {
    min-width: 112px;
  }

  .workspace {
    padding: 14px;
  }

  .topbar {
    margin: -14px -14px 14px;
    padding: 14px;
  }

  .user-box {
    border-radius: var(--radius);
  }

  .modal-card header {
    top: -18px;
  }

  .modal-card footer {
    bottom: -18px;
  }
}
