:root {
  --bg: #f4f7f8;
  --paper: #ffffff;
  --ink: #172026;
  --muted: #64717d;
  --line: #d9e0e6;
  --green: #1f8a70;
  --blue: #2f6fa7;
  --red: #b42318;
  --amber: #b7791f;
  --dark: #111827;
  --shadow: 0 18px 45px rgba(24, 33, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: wait;
  opacity: 0.65;
}

a {
  color: inherit;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 70px;
  padding: 12px clamp(16px, 4vw, 38px);
  color: #f8fafc;
  background: var(--dark);
  box-shadow: 0 10px 30px rgba(17, 24, 39, 0.16);
}

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

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: linear-gradient(140deg, var(--green), var(--blue));
}

.role {
  padding: 9px 12px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: clamp(16px, 4vw, 36px);
}

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

h1 {
  font-size: clamp(30px, 4vw, 42px);
  line-height: 1.05;
}

h2 {
  font-size: 20px;
  line-height: 1.2;
}

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

.panel,
.tile,
.login {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  box-shadow: var(--shadow);
}

.panel,
.login {
  padding: clamp(18px, 4vw, 30px);
}

.login {
  display: grid;
  gap: 18px;
  max-width: 560px;
  margin: 42px auto;
}

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

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

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

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

label {
  display: grid;
  gap: 7px;
  color: #36424d;
  font-size: 13px;
  font-weight: 800;
}

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

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 138, 112, 0.16);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 48px;
  padding: 0 18px;
  border-radius: 7px;
  font-weight: 900;
}

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

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

.btn.danger {
  color: var(--red);
  background: #fff5f4;
  border: 1px solid #f2c5c0;
}

.btn.big {
  width: 100%;
  min-height: 72px;
  font-size: 20px;
}

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

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.tile {
  padding: 16px;
}

.tile span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.tile strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin: 16px 0;
}

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

.summary-panel {
  padding: 16px;
}

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

.table-wrap.compact table {
  min-width: 520px;
}

.table-wrap.compact th,
.table-wrap.compact td {
  padding: 9px 8px;
  font-size: 13px;
}

.mini-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 8px;
  margin-top: 12px;
}

.mini-form.two {
  grid-template-columns: minmax(0, 1fr) auto;
}

.list {
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
  margin-top: 12px;
}

.list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 42px;
  padding: 7px 8px 7px 12px;
  border: 1px solid #edf1f4;
  border-radius: 7px;
  background: #fbfcfd;
  font-weight: 800;
}

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

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

th,
td {
  padding: 12px;
  border-bottom: 1px solid #edf1f4;
  text-align: left;
  vertical-align: middle;
}

th {
  color: #47535e;
  background: #f8fafc;
  font-size: 13px;
  font-weight: 900;
}

.cell {
  min-width: 112px;
  min-height: 38px;
  padding: 7px 9px;
  font-size: 14px;
}

.photos {
  display: flex;
  gap: 8px;
}

.photos img {
  width: 52px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  object-fit: cover;
}

.notice {
  margin-bottom: 16px;
  padding: 13px 14px;
  border-radius: 8px;
  font-weight: 900;
}

.notice.ok {
  border: 1px solid #9ccfbd;
  color: #16664f;
  background: #ecf8f3;
}

.notice.error {
  border: 1px solid #f2c5c0;
  color: var(--red);
  background: #fff5f4;
}

.driver-card {
  display: grid;
  gap: 18px;
  max-width: 780px;
  margin: 0 auto;
}

.step-line {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
}

.step {
  display: grid;
  gap: 5px;
  min-height: 68px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  font-size: 12px;
  font-weight: 900;
}

.step.is-current {
  border-color: var(--green);
  background: #ecf8f3;
}

.photo-preview img {
  width: 100%;
  max-height: 300px;
  border-radius: 8px;
  object-fit: cover;
}

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

.photo-task {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid #d9e0e6;
  border-radius: 8px;
  background: #fbfcfd;
}

.photo-task.is-complete {
  border-color: #9ccfbd;
  background: #f4fbf8;
}

.photo-task-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 10px;
}

.photo-task-head span {
  flex: 0 0 auto;
  padding: 5px 8px;
  border-radius: 7px;
  color: #16664f;
  background: #ecf8f3;
  font-size: 12px;
  font-weight: 900;
}

.photo-placeholder {
  display: grid;
  min-height: 190px;
  place-items: center;
  padding: 16px;
  border: 1px dashed #aab6c1;
  border-radius: 8px;
  color: var(--muted);
  background: #fff;
  text-align: center;
  font-weight: 900;
}

.required-note {
  color: var(--amber);
  text-align: center;
  font-weight: 900;
}

.gps {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid #9ccfbd;
  border-radius: 8px;
  background: #ecf8f3;
  font-weight: 800;
}

.camera {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px;
  color: #fff;
  background: #020617;
}

.camera video {
  width: 100%;
  height: 100%;
  border-radius: 8px;
  object-fit: cover;
  background: #111827;
}

.camera-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.error {
  padding: 12px;
  border: 1px solid #f2c5c0;
  border-radius: 8px;
  color: var(--red);
  background: #fff5f4;
  font-weight: 800;
}

.success {
  padding: 14px;
  border: 1px solid #9ccfbd;
  border-radius: 8px;
  color: #16664f;
  background: #ecf8f3;
  font-weight: 900;
}

@media (max-width: 860px) {
  .topbar,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .grid.two,
  .grid.three,
  .grid.four,
  .stats,
  .summary-grid,
  .admin-grid,
  .finish-photo-grid,
  .mini-form,
  .mini-form.two {
    grid-template-columns: 1fr;
  }

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

.office-app {
  min-height: 100vh;
  background: #eef3f5;
}

.office-login-wrap {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: clamp(16px, 4vw, 36px);
}

.pro-login {
  width: min(620px, 100%);
  margin: 0;
}

.pro-login-brand {
  color: var(--ink);
}

.eyebrow {
  color: #2f6fa7;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.office-notice {
  position: fixed;
  top: 86px;
  right: 22px;
  z-index: 60;
  width: min(440px, calc(100vw - 32px));
  box-shadow: var(--shadow);
}

.office-topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 72px;
  padding: 12px 24px;
  color: #f8fafc;
  background: #111827;
  box-shadow: 0 12px 28px rgba(17, 24, 39, 0.16);
}

.office-topbar-actions {
  display: flex;
  align-items: end;
  gap: 10px;
}

.date-control {
  color: #d8e1e8;
}

.date-control input {
  min-width: 160px;
}

.btn.ghost {
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
}

.btn.compact {
  min-height: 36px;
  padding: 0 12px;
  font-size: 13px;
}

.office-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 72px);
}

.office-sidebar {
  position: sticky;
  top: 72px;
  align-self: start;
  display: grid;
  gap: 18px;
  min-height: calc(100vh - 72px);
  padding: 20px 14px;
  border-right: 1px solid #d7e0e6;
  background: #f8fafc;
}

.sidebar-section {
  display: grid;
  gap: 10px;
}

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

.nav-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 7px;
  color: #33414c;
  background: transparent;
  font-weight: 900;
  text-align: left;
}

.nav-btn:hover,
.nav-btn.is-active {
  color: #0f4f73;
  background: #e8f2f6;
}

.nav-btn strong {
  min-width: 28px;
  padding: 3px 7px;
  border-radius: 999px;
  color: #0f4f73;
  background: #fff;
  font-size: 12px;
  text-align: center;
}

.side-health {
  padding-top: 12px;
  border-top: 1px solid #dde5ea;
}

.health-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: #52616d;
  font-size: 13px;
}

.health-row strong {
  color: var(--ink);
}

.office-main {
  display: grid;
  align-content: start;
  gap: 18px;
  min-width: 0;
  padding: 22px;
}

.office-main > *,
.ops-layout > *,
.report-layout > *,
.registry-grid > *,
.document-grid > *,
.pro-panel {
  min-width: 0;
}

.command-bar {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(380px, 1.25fr) 210px;
  gap: 16px;
  align-items: end;
  padding: 18px;
  border: 1px solid #d7e0e6;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.command-bar h1 {
  font-size: clamp(24px, 3vw, 34px);
}

.command-filters {
  display: grid;
  grid-template-columns: 150px 180px minmax(170px, 1fr);
  gap: 10px;
}

.workload {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.workload strong {
  color: var(--ink);
  font-size: 30px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #dfe7ec;
}

.progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--green), var(--blue));
}

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

.kpi {
  display: grid;
  gap: 7px;
  min-height: 116px;
  padding: 16px;
  border: 1px solid #d7e0e6;
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.kpi span,
.kpi small {
  color: var(--muted);
  font-weight: 800;
}

.kpi strong {
  font-size: clamp(24px, 3vw, 34px);
}

.kpi.warn {
  border-color: #f0c36b;
  background: #fff9ea;
}

.kpi.ok {
  border-color: #9ccfbd;
  background: #f3fbf8;
}

.ops-layout,
.report-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 14px;
}

.pro-panel {
  padding: 16px;
}

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

.record-count {
  padding: 6px 10px;
  border-radius: 999px;
  color: #33414c;
  background: #eef3f5;
  font-size: 13px;
  font-weight: 900;
}

.action-list {
  display: grid;
  gap: 9px;
}

.action-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  min-height: 62px;
  padding: 10px 12px;
  border: 1px solid #e4ebf0;
  border-radius: 8px;
  background: #fbfcfd;
}

.action-item div:first-child {
  display: grid;
  gap: 3px;
}

.action-item span,
.subline {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.missing-tags,
.doc-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.missing-tags span,
.doc-chip,
.status-pill {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.missing-tags span,
.doc-chip.missing {
  color: #8a5a12;
  background: #fff3d3;
}

.doc-chip.ok,
.status-pill.ok {
  color: #16664f;
  background: #e5f6ef;
}

.status-pill.warn,
.status-select.warn {
  color: #7a4b00;
  background: #fff3d3;
}

.status-pill.bad,
.status-select.bad {
  color: var(--red);
  background: #fff0ee;
}

.zpm-grid {
  display: grid;
  gap: 9px;
}

.zpm-card {
  display: grid;
  gap: 5px;
  padding: 12px;
  border: 1px solid #e4ebf0;
  border-radius: 8px;
  background: #fbfcfd;
}

.zpm-card strong {
  font-size: 24px;
}

.zpm-card small {
  color: var(--muted);
  font-weight: 800;
}

.pro-table-wrap {
  max-width: 100%;
  min-width: 0;
  border: 1px solid #e4ebf0;
  border-radius: 8px;
}

.pro-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f4f7f8;
}

.pro-table td {
  background: #fff;
}

.stack-cell {
  display: block;
  margin-bottom: 7px;
}

.numeric {
  max-width: 120px;
}

.note-cell {
  min-width: 160px;
}

.compact-table {
  min-width: 520px;
}

.registry-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.9fr 0.9fr;
  gap: 14px;
}

.registry-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr)) auto;
  gap: 8px;
  margin-bottom: 12px;
}

.registry-form.asset-form {
  grid-template-columns: minmax(0, 1fr) auto;
}

.registry-list {
  display: grid;
  gap: 8px;
  max-height: 520px;
  overflow: auto;
}

.registry-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 46px;
  padding: 8px 9px 8px 12px;
  border: 1px solid #e4ebf0;
  border-radius: 8px;
  background: #fbfcfd;
}

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

.document-photos {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.photo-box {
  display: grid;
  gap: 8px;
}

.photo-box span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.photo-box img {
  width: 100%;
  aspect-ratio: 4 / 3;
  border: 1px solid #d7e0e6;
  border-radius: 8px;
  object-fit: cover;
}

.photo-placeholder.small {
  min-height: 120px;
}

.report-grid,
.module-list {
  display: grid;
  gap: 9px;
}

.report-line,
.module-row {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #e4ebf0;
  border-radius: 8px;
  background: #fbfcfd;
}

.report-line {
  grid-template-columns: minmax(0, 1fr) auto;
}

.report-line span,
.module-row span {
  color: var(--muted);
  font-weight: 800;
}

.module-row.ready {
  border-color: #9ccfbd;
  background: #f3fbf8;
}

.module-row.todo {
  border-color: #f0c36b;
  background: #fff9ea;
}

.empty-state {
  padding: 18px;
  border: 1px dashed #b9c5ce;
  border-radius: 8px;
  color: var(--muted);
  background: #fbfcfd;
  text-align: center;
  font-weight: 900;
}

.transport-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.6fr);
  gap: 14px;
}

.transport-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.transport-form .btn {
  grid-column: span 2;
}

.transport-client-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px auto;
  gap: 8px;
  margin-bottom: 12px;
}

.transport-table {
  min-width: 1180px;
}

.control-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
  gap: 14px;
}

.control-document-form,
.route-template-form {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.control-document-form .btn,
.route-template-form .btn {
  grid-column: span 2;
}

.control-table {
  min-width: 1120px;
}

.relation-cell {
  min-width: 220px;
}

.money-ok {
  color: #16664f;
}

.money-bad {
  color: var(--red);
}

@media (max-width: 1180px) {
  .office-shell,
  .command-bar,
  .ops-layout,
  .report-layout,
  .registry-grid,
  .document-grid,
  .transport-layout,
  .control-layout {
    grid-template-columns: 1fr;
  }

  .office-sidebar {
    position: static;
    min-height: auto;
    border-right: 0;
    border-bottom: 1px solid #d7e0e6;
  }

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

  .side-health {
    display: none;
  }

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

@media (max-width: 760px) {
  .office-topbar,
  .office-topbar-actions,
  .command-filters,
  .registry-form,
  .registry-form.asset-form,
  .transport-form,
  .transport-client-form,
  .control-document-form,
  .route-template-form,
  .document-photos,
  .office-nav {
    grid-template-columns: 1fr;
  }

  .transport-form .btn,
  .control-document-form .btn,
  .route-template-form .btn {
    grid-column: auto;
  }

  .office-topbar,
  .office-topbar-actions {
    display: grid;
    align-items: stretch;
  }

  .office-main {
    padding: 14px;
  }

  .office-nav {
    display: grid;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
  }

  .action-item,
  .report-line {
    grid-template-columns: 1fr;
  }
}
