:root {
  color-scheme: light;
  --bg: #f7f8fb;
  --panel: #ffffff;
  --ink: #172033;
  --muted: #667085;
  --line: #d8dee8;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --gaia: #1788a5;
  --gaia-dark: #0f6f89;
  --green: #047857;
  --red: #b42318;
  --amber: #b45309;
  --shadow: 0 14px 35px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

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

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

button {
  border: 0;
  cursor: pointer;
}

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

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

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

.login-logo-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 18px;
}

.ford-like-badge {
  display: inline-grid;
  place-items: center;
  min-width: 58px;
  height: 32px;
  border-radius: 999px;
  background: var(--red);
  color: #fff;
  font-weight: 850;
  letter-spacing: 0;
}

.ford-like-badge.small {
  min-width: 42px;
  height: 22px;
  margin-right: 8px;
  font-size: 12px;
  vertical-align: middle;
}

.login-submit {
  background: var(--gaia-dark);
}

.login-links {
  display: grid;
  gap: 8px;
  padding-top: 4px;
}

.login-links button {
  color: var(--gaia-dark);
  background: transparent;
  text-align: left;
  font-weight: 700;
}

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

.app-shell {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px;
  padding: 12px 22px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand strong {
  font-size: 18px;
}

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

.module-strip {
  position: sticky;
  top: 61px;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0;
  min-height: 44px;
  padding-left: 14px;
  overflow-x: auto;
  background: linear-gradient(90deg, var(--gaia-dark), var(--gaia));
  border-bottom: 1px solid #0b596c;
}

.module-button {
  align-self: stretch;
  padding: 0 18px;
  color: #eaf8fb;
  background: transparent;
  border-left: 1px solid rgba(255, 255, 255, 0.18);
  font-weight: 750;
  white-space: nowrap;
}

.module-button.active,
.module-button:hover {
  color: #fff;
  background: rgba(15, 23, 42, 0.22);
}

.layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  min-height: calc(100vh - 65px);
  min-width: 0;
}

.sidebar {
  position: sticky;
  top: 106px;
  min-width: 0;
  max-width: 100%;
  max-height: calc(100vh - 106px);
  overflow-y: auto;
  border-right: 1px solid var(--line);
  background: #fff;
  padding: 18px;
}

.nav-button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
  padding: 10px 12px;
  color: var(--ink);
  background: transparent;
  border-radius: 6px;
  text-align: left;
}

.nav-button.active,
.nav-button:hover {
  background: #eaf1ff;
  color: var(--blue-dark);
}

.content {
  padding: 24px;
  min-width: 0;
  max-width: 100%;
}

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

.section-header h2 {
  margin: 0;
  font-size: 24px;
}

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

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

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

.stat,
.panel,
.table-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.03);
}

.stat {
  padding: 18px;
}

.stat span {
  color: var(--muted);
  font-size: 14px;
}

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

.panel {
  padding: 18px;
}

.load-errors {
  margin-bottom: 14px;
  border-color: #f4c7c2;
  background: #fff5f4;
}

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

.load-errors span {
  margin-top: 4px;
  color: var(--red);
  font-size: 13px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: start center;
  padding: 72px 24px 24px;
  background: rgba(15, 23, 42, 0.38);
}

.modal-card {
  width: min(760px, 100%);
  max-height: calc(100vh - 96px);
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.22);
  padding: 18px;
}

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

.modal-header {
  margin-bottom: 14px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.modal-header h3 {
  margin: 0;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 6px;
}

.icon-close {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  color: var(--ink);
  background: #eef2f7;
  font-size: 22px;
  line-height: 1;
}

.quick-customer-block {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid #dce3ed;
  border-radius: 6px;
  background: #f8fafc;
}

.customer-picker {
  position: relative;
}

.customer-match-list {
  display: grid;
  gap: 4px;
  margin-top: 6px;
}

.customer-match-list button {
  display: grid;
  gap: 2px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #dce3ed;
  border-radius: 6px;
  color: var(--ink);
  background: #fff;
  text-align: left;
}

.customer-match-list button:hover {
  border-color: var(--gaia);
  background: #eef8fb;
}

.customer-match-list span {
  color: var(--muted);
  font-size: 12px;
}

.schedule-preview {
  display: grid;
  grid-template-columns: minmax(120px, 0.5fr) minmax(120px, 0.5fr) minmax(220px, 1fr);
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid #bfd6df;
  border-radius: 6px;
  background: #eef8fb;
}

.schedule-preview span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.schedule-preview strong {
  color: var(--gaia-dark);
  font-size: 18px;
}

.schedule-preview em {
  color: var(--ink);
  font-style: normal;
  font-size: 13px;
}

.two-col {
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  align-items: start;
}

.workbench {
  grid-template-columns: minmax(320px, 420px) minmax(0, 1fr);
  align-items: start;
}

.dashboard-panels {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-top: 16px;
}

.global-search {
  flex: 1;
  min-width: 220px;
  max-width: 420px;
  position: relative;
  z-index: 1000;
}

.global-search input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
}

.top-search-results {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 3000;
  max-height: 320px;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(16, 24, 40, 0.16);
}

.top-search-results.open {
  display: grid;
}

.top-search-results button {
  display: grid;
  gap: 2px;
  padding: 9px 12px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.top-search-results button:hover {
  background: #eef8fb;
}

.top-search-results span {
  color: var(--muted);
  font-size: 12px;
}

.split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.field {
  display: grid;
  gap: 6px;
  min-width: 0;
}

input,
select,
textarea,
button {
  box-sizing: border-box;
  max-width: 100%;
}

.field label {
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.field input,
.field select,
.field textarea,
.search {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 10px 11px;
}

.modal-card .split,
.panel .split {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.modal-card .field,
.panel .field {
  min-width: 0;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #344054;
  font-size: 14px;
  font-weight: 650;
}

.check-row input {
  width: 18px;
  height: 18px;
}

.field textarea {
  min-height: 92px;
  resize: vertical;
}

.form-subhead {
  margin: 6px 0 0;
  border-top: 1px solid #edf1f6;
  padding-top: 12px;
  font-size: 15px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr 150px 130px auto;
  gap: 8px;
  margin: 8px 0 12px;
}

.inline-form input,
.inline-form select {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.stage-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  margin: 8px 0 14px;
  padding-bottom: 4px;
}

.stage-strip span {
  flex: 0 0 auto;
  border: 1px solid #d8dee8;
  border-radius: 999px;
  background: #f8fafc;
  color: #475467;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 700;
}

.stage-strip span.active {
  border-color: #b42318;
  background: #fff1f0;
  color: #b42318;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 6px;
  padding: 9px 13px;
  color: #fff;
  background: var(--blue);
  font-weight: 650;
}

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

.btn.secondary {
  background: #eef2f7;
  color: #1f2937;
}

.btn.secondary:hover {
  background: #e2e8f0;
}

.btn.danger {
  background: #fee4e2;
  color: var(--red);
}

.btn.danger:hover {
  background: #ffd5d1;
}

.table-shell {
  overflow: auto;
}

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

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

th {
  color: #344054;
  background: #f2f5f9;
  font-size: 13px;
}

tr:last-child td {
  border-bottom: 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  background: #ecfdf3;
  color: var(--green);
  font-size: 12px;
  font-weight: 700;
}

.pill.warn {
  background: #fff7ed;
  color: var(--amber);
}

.pill.danger {
  background: #fee4e2;
  color: var(--red);
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
}

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

a.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.document-actions {
  flex-wrap: wrap;
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  align-items: end;
}

.dense-filters {
  margin-bottom: 14px;
  padding: 10px 12px;
}

.filter-bar.compact {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.vehicle-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

.vehicle-photo {
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  width: 74px;
  height: 48px;
  overflow: hidden;
  border: 1px solid #d9e1ea;
  border-radius: 6px;
  background: #eef2f7;
  color: #111827;
  object-fit: cover;
}

.vehicle-photo.large {
  width: 100%;
  height: 170px;
  margin-bottom: 14px;
}

.vehicle-photo.fallback {
  background:
    linear-gradient(145deg, rgba(180, 35, 24, 0.16), transparent 42%),
    linear-gradient(160deg, #f8fafc 0%, #d9e4ef 55%, #aebdcc 100%);
  text-align: center;
}

.vehicle-photo.fallback strong {
  font-size: 13px;
}

.vehicle-photo.fallback span {
  color: #475467;
  font-size: 11px;
}

.vehicle-photo.fallback.large strong {
  font-size: 26px;
}

.vehicle-photo.fallback.large span {
  font-size: 14px;
}

.vehicle-hero {
  margin-bottom: 6px;
}

.listing-preview {
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
}

.listing-preview p {
  margin: 6px 0 0;
  color: var(--muted);
}

.merch-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(360px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.merch-card {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.merch-media {
  position: relative;
  min-height: 100%;
  background: #eef2f7;
}

.merch-media .vehicle-photo.large {
  height: 100%;
  min-height: 260px;
  margin: 0;
  border: 0;
  border-radius: 0;
}

.merch-badge {
  position: absolute;
  left: 10px;
  bottom: 10px;
  border-radius: 6px;
  background: rgba(17, 24, 39, 0.86);
  color: #fff;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 750;
}

.merch-body {
  padding: 14px;
}

.merch-body h3 {
  margin: 0;
  font-size: 18px;
}

.readiness {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5e7eb;
  margin: 12px 0;
}

.readiness span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #b42318, #0ea5b7, #15803d);
}

.merch-facts {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.merch-facts > div {
  border: 1px solid #edf1f6;
  border-radius: 6px;
  padding: 8px;
}

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

.checklist span {
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 700;
}

.checklist .ok {
  background: #ecfdf3;
  color: var(--green);
}

.checklist .missing {
  background: #fff7ed;
  color: var(--amber);
}

.td-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0 12px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f8fafc;
  padding: 5px 8px;
  color: #344054;
  font-size: 13px;
  font-weight: 650;
}

.legend-item i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.planned,
.legend-item i.planned {
  background: #0ea5b7;
}

.done,
.legend-item i.done {
  background: #15803d;
}

.reserved,
.legend-item i.reserved {
  background: #b45309;
}

.blocked,
.legend-item i.blocked {
  background: #b42318;
}

.calendar-grid {
  display: grid;
  grid-template-columns: minmax(170px, 210px) repeat(var(--days), 32px);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: auto;
  background: #fff;
  max-width: 100%;
}

.calendar-title {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 10px;
  color: var(--ink);
}

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

.calendar-corner,
.calendar-hour,
.calendar-day,
.calendar-vehicle,
.calendar-cell {
  min-height: 24px;
  border-right: 1px solid #dce3ed;
  border-bottom: 1px solid #dce3ed;
}

.calendar-corner,
.calendar-hour,
.calendar-day {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #e8f3f6;
  color: #243746;
  font-weight: 750;
}

.calendar-corner.sub {
  top: 25px;
  z-index: 2;
  font-size: 11px;
}

.calendar-hour {
  display: grid;
  align-content: center;
  justify-items: start;
  padding-left: 4px;
  min-width: 32px;
  border-right: 1px solid #b9ccd7;
  font-size: 11px;
}

.calendar-corner {
  left: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 8px 10px;
}

.calendar-day {
  display: grid;
  align-content: center;
  justify-items: center;
  padding: 4px 2px;
  min-width: 32px;
  top: 25px;
}

.calendar-day strong {
  font-size: 10px;
}

.calendar-day span {
  color: var(--muted);
  font-size: 10px;
  text-transform: uppercase;
}

.calendar-vehicle {
  position: sticky;
  left: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 8px;
  background: #f8fafc;
  padding: 4px 6px;
}

.calendar-vehicle strong,
.calendar-vehicle span {
  display: block;
}

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

.calendar-cell {
  position: relative;
  min-width: 32px;
  padding: 0;
  background: #fbfdff;
  overflow: visible;
}

.booking {
  display: grid;
  width: auto;
  min-width: 0;
  max-width: none;
  height: 23px;
  min-height: 23px;
  margin-bottom: 0;
  border-radius: 2px;
  padding: 3px 5px;
  color: #fff;
  text-align: left;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.18);
  position: absolute;
  left: 0;
  top: 0;
  z-index: 2;
  border: 0;
  cursor: pointer;
}

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

.booking strong {
  font-size: 11px;
  line-height: 11px;
}

.booking span {
  display: none;
  opacity: 0.88;
  font-size: 10px;
}

.empty-slot {
  display: block;
  width: 100%;
  height: 100%;
  min-height: 23px;
  border: 0;
  border-radius: 0;
  color: transparent;
  background: transparent;
  font-size: 0;
  cursor: pointer;
}

.empty-slot:hover {
  border-color: var(--blue);
  background: #eef8fb;
}

.link-button {
  color: var(--blue-dark);
  background: transparent;
  padding: 0;
  font-weight: 650;
}

.danger-link {
  color: #b42318;
}

.message {
  margin-top: 12px;
  color: var(--red);
  min-height: 20px;
}

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

.audit-item {
  border-left: 3px solid var(--blue);
  padding-left: 10px;
}

.compact-list,
.mini-rows {
  display: grid;
  gap: 8px;
}

.timeline {
  display: grid;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  overflow: hidden;
  background: #fff;
}

.timeline-row {
  display: grid;
  grid-template-columns: 150px minmax(180px, 0.8fr) minmax(220px, 1fr);
  gap: 12px;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

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

.timeline-row span,
.timeline-row em {
  color: var(--muted);
  font-style: normal;
}

.compact-list > div,
.mini-rows > div {
  display: grid;
  gap: 2px;
  border-bottom: 1px solid #edf1f6;
  padding-bottom: 8px;
}

.compact-list strong,
.compact-list span {
  display: block;
}

.small {
  font-size: 13px;
}

.big {
  display: block;
  font-size: 34px;
  line-height: 1.1;
}

.detail-panel h4 {
  margin: 18px 0 8px;
}

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

.detail-grid strong {
  display: block;
  margin-top: 3px;
}

.section-header.compact {
  align-items: start;
  margin-bottom: 12px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
}

.kanban-col {
  min-height: 320px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.kanban-col h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.kanban-card {
  display: grid;
  width: 100%;
  gap: 4px;
  margin-bottom: 8px;
  border: 1px solid #e1e7f0;
  border-radius: 6px;
  background: #fafcff;
  color: var(--ink);
  padding: 10px;
  text-align: left;
}

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

.contract-page {
  width: min(210mm, 100%);
  min-height: 297mm;
  margin: 0 auto;
  padding: 14mm;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  font-size: 12px;
}

.contract-header,
.contract-grid,
.signature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}

.contract-header {
  align-items: start;
  border-bottom: 2px solid #111827;
  padding-bottom: 20px;
  margin-bottom: 22px;
}

.contract-header h1 {
  margin: 0 0 6px;
  font-size: 24px;
}

.contract-meta {
  text-align: right;
}

.contract-page section {
  margin-top: 14px;
}

.terms-block p {
  margin: 0 0 6px;
  font-size: 9.5px;
  line-height: 1.35;
}

.contract-line {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 10px;
  margin: 5px 0;
  border-bottom: 1px solid #e5e7eb;
  padding-bottom: 4px;
}

.signature-grid {
  margin-top: 72px;
}

.signature-grid span {
  display: block;
  height: 56px;
  border-bottom: 1px solid #111827;
}

.handover-checklist {
  display: grid;
  gap: 5px;
}

.checkbox-line {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
}

.checkbox-line span,
.checkbox-line i {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 1px solid #111827;
}

.signature-box {
  min-height: 72px;
  border: 1px solid #111827;
}

.document-footnote {
  text-align: center;
  font-weight: 700;
}

@media (max-width: 1200px) {
  .layout {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .workbench,
  .dashboard-panels {
    grid-template-columns: 1fr;
  }

  .content {
    padding: 18px;
  }
}

@media (max-width: 900px) {
  .layout,
  .two-col,
  .workbench,
  .dashboard-panels,
  .merch-grid,
  .merch-card,
  .inline-form,
  .stats,
  .filter-bar {
    grid-template-columns: 1fr;
  }

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

  .detail-grid,
  .split {
    grid-template-columns: 1fr;
  }

  .sidebar {
    display: flex;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    gap: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .nav-button {
    width: auto;
    white-space: nowrap;
  }
}

.lookup-results {
  display: grid;
  gap: 6px;
}

.lookup-result {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  padding: 8px 10px;
  text-align: left;
}

.lookup-result:hover {
  border-color: var(--accent);
}

.lookup-result span {
  color: var(--muted);
  display: block;
  font-size: 12px;
  margin-top: 2px;
}

.mini-kpis {
  display: grid;
  gap: 6px;
}

.daily-report-panel {
  grid-column: span 2;
}

.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 16px;
}

.price-picker {
  border: 1px solid var(--line);
  border-radius: 6px;
  display: grid;
  gap: 10px;
  padding: 12px;
}

.document-window {
  background: #eef1f4;
  padding: 18px;
}

.document-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin-bottom: 12px;
}

.document-actions button {
  background: var(--accent);
  border: 0;
  border-radius: 6px;
  color: #fff;
  cursor: pointer;
  padding: 9px 14px;
}

.template-designer {
  display: grid;
  gap: 10px;
}

.legacy-template-fields {
  display: none;
}

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

.template-preview-page {
  background: #fff;
  border: 1px solid var(--line);
  border-top: 4px solid var(--accent);
  border-radius: 6px;
  min-height: 360px;
  overflow: hidden;
  padding: 18px;
}

.template-preview-header {
  align-items: center;
  display: flex;
  gap: 12px;
  margin-bottom: 18px;
}

.template-preview-header h2 {
  margin: 0;
}

.template-logo-placeholder {
  align-items: center;
  background: #f2f4f7;
  border: 1px dashed #98a2b3;
  color: var(--muted);
  display: flex;
  font-weight: 750;
  height: 42px;
  justify-content: center;
}

.template-preview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.template-preview-grid div,
.template-preview-lines span,
.template-preview-lines strong {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 4px;
  min-height: 28px;
  padding: 7px;
}

.template-preview-lines {
  display: grid;
  gap: 6px;
}

.doc-logo {
  max-height: 42px;
  max-width: 160px;
  object-fit: contain;
}

.page-break {
  break-before: page;
  page-break-before: always;
  margin-top: 18px;
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }

  body {
    background: #fff;
  }

  body * {
    visibility: hidden;
  }

  .topbar,
  .sidebar,
  .module-strip,
  .no-print {
    display: none !important;
  }

  .layout {
    display: block;
  }

  .content {
    padding: 0;
  }

  .contract-page,
  .contract-page * {
    visibility: visible;
  }

  .contract-page {
    position: absolute;
    inset: 0 auto auto 0;
    width: 210mm;
    min-height: 297mm;
    margin: 0;
    padding: 12mm;
    border: 0;
    box-shadow: none;
    border-radius: 0;
    font-size: 10.5px;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .global-search {
    max-width: none;
    width: 100%;
  }

  .content {
    padding: 16px;
  }

  .section-header {
    align-items: stretch;
    flex-direction: column;
  }

  table {
    min-width: 720px;
  }

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