:root {
  --ink: #182127;
  --muted: #65717a;
  --line: #d8e0e3;
  --soft: #f4f7f5;
  --panel: #ffffff;
  --brand: #0b6f57;
  --brand-strong: #064d3e;
  --amber: #b46a18;
  --red: #a8332c;
  --blue: #245d86;
  --shadow: 0 16px 40px rgba(18, 31, 37, 0.11);
}

* {
  box-sizing: border-box;
}

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

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px;
  color: #eef8f4;
  background: #102a2f;
}

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

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 8px;
  color: #0d282d;
  background: #93e2c5;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand span,
.sidebar-metrics span,
.sidebar-metrics small {
  color: #a9c8c2;
  font-size: 0.84rem;
}

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

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 44px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 12px;
  color: #dcebe7;
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  border-color: rgba(147, 226, 197, 0.34);
  background: rgba(255, 255, 255, 0.08);
}

.icon {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: #93e2c5;
}

.sidebar-metrics {
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar-metrics strong {
  display: block;
  margin: 6px 0;
  font-size: 1.8rem;
}

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

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

.topbar h1 {
  max-width: 920px;
  margin: 4px 0 0;
  font-size: clamp(2rem, 4vw, 4.6rem);
  line-height: 0.98;
  letter-spacing: 0;
}

.logged-out-only,
.landing-page {
  display: none;
}

.landing-copy {
  max-width: 760px;
}

.landing-subheadline {
  max-width: 690px;
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 1.08rem;
  font-weight: 650;
  line-height: 1.45;
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.trust-text {
  margin: 14px 0 0;
  color: var(--brand-strong);
  font-size: 0.92rem;
  font-weight: 800;
}

.eyebrow {
  margin: 0;
  color: var(--brand);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.auth-panel {
  display: grid;
  gap: 8px;
  min-width: min(460px, 48vw);
  border-radius: 8px;
}

.auth-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.auth-fields {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) minmax(120px, 1fr) auto auto;
  gap: 8px;
}

.auth-fields[hidden],
#logoutButton[hidden] {
  display: none;
}

.auth-fields input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 700;
}

body.signed-out .hero-visual,
body.signed-out .view,
body.signed-out [data-view-link="document"],
body.signed-out #quickAddLoadButton {
  display: none;
}

body.signed-out .logged-in-only {
  display: none;
}

body.signed-out .logged-out-only {
  display: block;
}

body.signed-out .landing-page {
  display: grid;
  gap: 18px;
}

body.signed-out .topbar {
  align-items: stretch;
}

body.signed-out .topbar h1 {
  max-width: 760px;
  font-size: 4rem;
}

body.signed-out .auth-panel {
  min-width: 360px;
  max-width: 420px;
  padding: 18px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: var(--shadow);
}

body.signed-out .auth-panel p {
  color: var(--ink);
  font-size: 0.95rem;
}

body.signed-out .auth-fields {
  grid-template-columns: 1fr;
}

body.signed-in .logged-in-only,
body.signed-in .hero-visual,
body.demo-preview .logged-in-only,
body.demo-preview .hero-visual {
  display: none;
}

body.signed-in .topbar,
body.demo-preview .topbar {
  justify-content: flex-end;
  margin-bottom: 16px;
}

body.signed-in .topbar-actions,
body.demo-preview .topbar-actions {
  width: min(760px, 100%);
}

body.signed-in .auth-panel,
body.demo-preview .auth-panel {
  flex: 1;
  min-width: 0;
}

body.driver-mode {
  background: #eef5f1;
}

body.driver-mode .app-shell {
  display: none;
}

body.driver-mode .driver-submission {
  display: block;
}

.driver-submission[hidden] {
  display: none;
}

.driver-submission {
  min-height: 100vh;
  padding: 16px;
}

.driver-submit-card {
  display: grid;
  gap: 16px;
  max-width: 760px;
  margin: 0 auto;
}

.driver-mode-banner {
  display: inline-flex;
  width: max-content;
  border-radius: 999px;
  padding: 8px 12px;
  color: #fff;
  background: var(--brand);
  font-size: 0.8rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.driver-submit-header,
.driver-load-summary,
.driver-submit-form {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.compact-brand {
  margin-bottom: 12px;
}

.driver-submit-header p,
.driver-submit-note {
  margin: 0;
  color: var(--muted);
  font-weight: 700;
}

.driver-load-summary h1 {
  margin: 4px 0 14px;
  font-size: clamp(2rem, 9vw, 4rem);
  line-height: 0.95;
}

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

.driver-summary-grid p {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.driver-summary-grid span,
.driver-summary-grid strong {
  display: block;
}

.driver-summary-grid span {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  text-transform: uppercase;
}

.driver-summary-grid strong {
  margin-top: 4px;
  font-size: 1rem;
}

.driver-submit-form {
  display: grid;
  gap: 14px;
}

.driver-upload-zone {
  min-height: 170px;
}

.driver-gps-box,
.driver-signature-section {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfb;
}

.driver-submit-button {
  min-height: 56px;
  font-size: 1.05rem;
}

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

.landing-card,
.preview-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(27, 43, 48, 0.06);
}

.landing-card {
  padding: 20px;
}

.landing-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1.05rem;
}

.landing-card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.4;
}

.landing-preview {
  display: grid;
  grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.05fr);
  gap: 18px;
}

.preview-card {
  padding: 20px;
}

.preview-card h2 {
  margin: 4px 0 16px;
  font-size: 1.35rem;
}

.preview-check,
.preview-load-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font-weight: 800;
  background: #f8fbf9;
}

.preview-check.ok {
  color: var(--brand-strong);
  border-color: #b6dfce;
  background: #f0faf4;
}

.preview-check.warning {
  color: var(--amber);
  border-color: #ecd29f;
  background: #fff8e8;
}

.preview-check.missing {
  color: var(--red);
  border-color: #efc2bc;
  background: #fff4f2;
}

.preview-risk-message {
  display: block;
  margin-top: 12px;
  color: var(--amber);
}

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

.preview-load-row strong {
  margin-left: auto;
}

.preview-load-row .status {
  font-style: normal;
}

.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 16px;
  font-weight: 800;
}

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

.primary-button:hover {
  background: var(--brand-strong);
}

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

.icon-button {
  width: 42px;
  padding: 0;
  font-size: 1.2rem;
}

.wide {
  width: 100%;
}

.hero-visual {
  position: relative;
  min-height: 230px;
  margin-bottom: 22px;
  overflow: hidden;
  border-radius: 8px;
  background: #1c3439;
  box-shadow: var(--shadow);
}

.hero-visual img {
  display: block;
  width: 100%;
  height: 270px;
  object-fit: cover;
}

.hero-overlay {
  position: absolute;
  left: 22px;
  bottom: 22px;
  max-width: 340px;
  color: #fff;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.38);
}

.hero-overlay span,
.hero-overlay strong {
  display: block;
}

.hero-overlay span {
  margin-bottom: 6px;
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.hero-overlay strong {
  font-size: 1.7rem;
  line-height: 1.05;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

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

.metric-card,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 24px rgba(27, 43, 48, 0.06);
}

.metric-card {
  padding: 18px;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 2rem;
}

.metric-card.warning strong {
  color: var(--amber);
}

.two-column,
.automation-grid,
.pod-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  gap: 18px;
}

.toolbar-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) repeat(3, minmax(150px, 0.35fr));
  gap: 10px;
  padding: 18px;
  border-top: 1px solid var(--line);
}

.toolbar-grid input,
.toolbar-grid select,
.load-form input,
.load-form select {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
  font: inherit;
  font-weight: 700;
}

.load-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 0 18px 18px;
  padding: 16px;
  border: 1px solid #b7d9cb;
  border-radius: 8px;
  background: #f5fbf8;
}

.load-form[hidden] {
  display: none;
}

.load-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.form-wide {
  grid-column: 1 / -1;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 240px;
}

.table-actions .secondary-button,
.table-actions .danger-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 0.82rem;
}

.attention-list,
.compact-load-list,
.document-grid,
.load-detail-grid {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.attention-item,
.compact-load-card,
.document-card,
.detail-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fff;
}

.attention-item,
.compact-load-card,
.document-card {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
}

.attention-item p,
.compact-load-card p,
.document-card p,
.detail-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.helper-text {
  max-width: 620px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.driver-link-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.compact-load-card small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-weight: 700;
}

.attention-main {
  display: grid;
  gap: 7px;
  min-width: 118px;
}

.urgency-badge {
  width: fit-content;
  border-radius: 999px;
  padding: 4px 8px;
  color: var(--muted);
  background: #eef3ef;
  font-size: 0.72rem;
  font-weight: 900;
}

.urgency-badge.review {
  color: var(--amber);
  background: #fff3d7;
}

.urgency-badge.late {
  color: var(--red);
  background: #fff1ed;
}

.attention-item small,
.attention-item em {
  display: block;
  margin-top: 7px;
}

.attention-item small {
  color: var(--muted);
  font-weight: 800;
}

.attention-item em {
  color: var(--brand-strong);
  font-style: normal;
  font-weight: 900;
}

.load-detail-panel {
  margin-top: 18px;
}

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

.detail-card .timeline {
  margin-top: 10px;
}

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

.automation-grid {
  grid-template-columns: minmax(340px, 0.8fr) minmax(0, 1.2fr);
}

.panel {
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  margin: 4px 0 0;
  font-size: 1.15rem;
}

select,
input {
  min-height: 42px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: #fff;
}

input.needs-review,
select.needs-review {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(180, 106, 24, 0.16);
}

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

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

th,
td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
}

.status,
.risk-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status.review {
  color: #74470e;
  background: #fff1d3;
}

.status.paid {
  color: #1e5176;
  background: #ddeefa;
}

.status.collected {
  color: #32423d;
  background: #e8eee9;
}

.status.late {
  color: #8b211d;
  background: #ffe1de;
}

.status.empty {
  color: #4f5b57;
  background: #e9eeee;
}

.risk-pill.low {
  color: #0e5d45;
  background: #dff6e9;
}

.risk-pill.medium {
  color: #74470e;
  background: #fff1d3;
}

.risk-pill.high {
  color: #8b211d;
  background: #ffe1de;
}

.folder-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 0 10px;
  color: #405059;
  background: #edf2f3;
  font-size: 0.78rem;
  font-weight: 800;
}

.timeline,
.email-list,
.watchlist,
.review-list,
.insight-stack {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.timeline-item,
.email-card,
.watch-card,
.review-card,
.insight,
.empty-state {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfb;
}

.empty-state {
  border-style: dashed;
  background: #f8fbf9;
}

.timeline-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 12px;
}

.dot {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.dot.medium {
  background: var(--amber);
}

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

.timeline-item p,
.email-card p,
.watch-card p,
.review-card p,
.insight p,
.automation-steps p,
.risk-box p {
  margin: 5px 0 0;
  color: var(--muted);
}

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

.pod-form {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.pod-section {
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfdfb;
}

.ai-reader {
  border-color: #a9d8c1;
  background: #f0fbf5;
}

.payment-risk-card {
  border-color: #e6c58a;
  background: #fffaf0;
}

.dispatcher-review-tools {
  border-color: #a9d8c1;
  background: #f2fbf6;
}

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

.mode-note,
.gps-dispatcher-note {
  margin: 0;
  border-radius: 8px;
  padding: 10px 12px;
  color: #74470e;
  background: #fff1d3;
  font-weight: 800;
}

.section-title {
  display: flex;
  gap: 10px;
  align-items: center;
}

.section-title > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

.section-title strong,
.section-title small {
  display: block;
}

.section-title small {
  color: var(--muted);
}

.upload-zone {
  display: grid;
  place-items: center;
  gap: 7px;
  min-height: 178px;
  border: 2px dashed #b7c9c3;
  border-radius: 8px;
  color: var(--muted);
  background: var(--soft);
  text-align: center;
}

.upload-zone.compact {
  min-height: 132px;
}

.ai-readout {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.ai-readout span,
.ai-readout strong {
  display: block;
}

.ai-readout span,
.ai-results p {
  color: var(--muted);
}

.ai-results {
  display: grid;
  gap: 8px;
}

.ai-results p {
  margin: 0;
}

.ai-score {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid #b9dacb;
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.ai-score > span {
  display: grid;
  place-items: center;
  width: 50px;
  height: 50px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand);
  font-weight: 900;
}

.ai-score strong,
.ai-score p {
  display: block;
  margin: 0;
}

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

.risk-check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

.risk-check-row span {
  font-size: 1.1rem;
}

.risk-check-row p {
  margin: 0;
  color: var(--ink);
  font-weight: 800;
}

.risk-check-row.ok {
  border-color: #a9d8c1;
  background: #f0fbf5;
}

.risk-check-row.unclear {
  border-color: #ead19d;
  background: #fff8e8;
}

.risk-check-row.missing {
  border-color: #efb5af;
  background: #fff4f2;
}

.risk-final-message {
  display: block;
  border-radius: 8px;
  padding: 12px;
  font-size: 1rem;
}

.risk-final-message.low {
  color: #0e5d45;
  background: #dff6e9;
}

.risk-final-message.medium {
  color: #74470e;
  background: #fff1d3;
}

.risk-final-message.high {
  color: #8b211d;
  background: #ffe1de;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.upload-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 999px;
  color: #fff;
  background: var(--brand);
  font-size: 1.8rem;
  font-weight: 700;
}

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

label {
  display: grid;
  gap: 7px;
  color: #405059;
  font-size: 0.86rem;
  font-weight: 800;
}

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

.pod-items-table input,
.pod-items-table select {
  min-width: 110px;
}

.pod-items-table td:first-child input {
  min-width: 72px;
}

.gps-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

body:not(.driver-mode) #gpsButton {
  display: none;
}

.photo-preview {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.photo-preview div {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.photo-preview img {
  display: block;
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
}

.photo-preview span {
  display: block;
  overflow: hidden;
  padding: 6px;
  color: var(--muted);
  font-size: 0.7rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.signature-pad {
  width: 100%;
  height: 180px;
  border: 1px solid #bac8cc;
  border-radius: 8px;
  background:
    linear-gradient(#fff 0 0) padding-box,
    repeating-linear-gradient(0deg, transparent, transparent 30px, rgba(11, 111, 87, 0.08) 31px);
  touch-action: none;
}

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

.send-link,
.pod-actions .secondary-button,
.pod-actions .primary-button {
  display: inline-grid;
  place-items: center;
  text-align: center;
  text-decoration: none;
}

.pod-receipt-panel {
  align-self: start;
  position: sticky;
  top: 18px;
}

.pod-receipt {
  margin: 18px;
  border: 1px solid #b7c8ce;
  border-radius: 8px;
  background: #fff;
}

.receipt-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  color: #fff;
  background: #102a2f;
}

.receipt-head strong,
.receipt-head span {
  display: block;
}

.receipt-head span {
  color: #c7ddd8;
}

.receipt-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
}

.receipt-grid p,
.receipt-note,
.receipt-signature {
  margin: 0;
  padding: 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}

.receipt-grid p:nth-child(2n) {
  border-right: 0;
}

.receipt-grid span,
.receipt-note span,
.receipt-signature span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.receipt-items {
  display: grid;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.receipt-items p {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  gap: 8px;
  margin: 0;
}

.receipt-items span {
  color: var(--muted);
}

.receipt-signature img {
  display: block;
  width: 100%;
  min-height: 82px;
  object-fit: contain;
  border-bottom: 2px solid var(--ink);
}

.pod-print {
  display: none;
}

.document-preview {
  padding: 18px;
  background:
    linear-gradient(90deg, rgba(11, 111, 87, 0.09) 1px, transparent 1px),
    linear-gradient(rgba(11, 111, 87, 0.09) 1px, transparent 1px),
    #edf5f1;
  background-size: 24px 24px;
}

.doc-paper {
  max-width: 380px;
  margin: 0 auto;
  min-height: 300px;
  padding: 28px;
  border: 1px solid #d1dbdf;
  border-radius: 6px;
  background: #fff;
  box-shadow: 0 16px 24px rgba(25, 38, 44, 0.12);
}

.doc-paper span,
.doc-paper strong {
  display: block;
}

.doc-paper span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.doc-paper strong {
  margin: 18px 0;
  font-size: 1.5rem;
}

.signature-line {
  height: 42px;
  margin-top: 34px;
  border-bottom: 2px solid #2f3a40;
  transform: rotate(-1deg);
}

.risk-box {
  margin: 0 18px 18px;
  padding: 14px;
  border-radius: 8px;
  background: #f7f2e9;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f6f8f6;
}

.segment {
  border: 0;
  border-radius: 6px;
  min-height: 34px;
  padding: 0 12px;
  color: var(--muted);
  background: transparent;
  font-weight: 800;
}

.segment.active {
  color: var(--ink);
  background: #fff;
  box-shadow: 0 2px 10px rgba(20, 34, 39, 0.1);
}

.review-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

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

.danger-button {
  min-height: 38px;
  border: 1px solid #efb5af;
  border-radius: 8px;
  padding: 0 12px;
  color: var(--red);
  background: #fff4f2;
  font-weight: 800;
}

.automation-steps {
  display: grid;
  gap: 12px;
  padding: 18px;
}

.forwarding-card {
  display: grid;
  gap: 10px;
  margin: 0 18px 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #f6fbf8;
}

.forwarding-card span,
.panel-subtitle {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.forwarding-card strong {
  overflow-wrap: anywhere;
  font-size: 1.05rem;
}

.forwarding-card p {
  margin: 0;
  color: var(--muted);
}

.panel-subtitle {
  margin: 18px 0 10px;
}

.automation-steps div {
  display: grid;
  grid-template-columns: 34px 1fr;
  column-gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfb;
}

.automation-steps span {
  grid-row: span 2;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  color: #fff;
  background: var(--blue);
  font-weight: 900;
}

.email-card {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.imported-email-card {
  width: 100%;
  border-color: var(--line);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
  align-items: flex-start;
}

.imported-email-card p b {
  color: var(--ink);
}

.imported-email-card.selected {
  border-color: var(--brand);
  background: #eef8f2;
  box-shadow: 0 0 0 2px rgba(47, 122, 95, 0.12);
}

.email-card.matched {
  border-color: #a9d8c1;
  background: #f0fbf5;
}

.import-review-card {
  display: grid;
  gap: 14px;
  margin: 0 18px 18px;
  padding: 16px;
  border: 1px solid #a9d8c1;
  border-radius: 8px;
  background: #f7fcf9;
}

.import-review-card h3 {
  margin: 2px 0 8px;
}

.import-review-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.import-review-card p strong {
  color: var(--ink);
}

.import-review-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, max-content));
  gap: 8px;
}

.import-review-actions .primary-button {
  grid-column: 1 / -1;
  width: fit-content;
}

.insight strong {
  display: block;
  font-size: 1.6rem;
}

.watch-card {
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  transform: translateY(130%);
  transition: transform 180ms ease;
  max-width: min(360px, calc(100vw - 48px));
  border-radius: 8px;
  padding: 14px 16px;
  color: #fff;
  background: #102a2f;
  box-shadow: var(--shadow);
}

.toast.show {
  transform: translateY(0);
}

.preview-open {
  overflow: hidden;
}

.file-preview-modal[hidden] {
  display: none;
}

.file-preview-modal {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: grid;
  place-items: center;
  padding: 18px;
}

.file-preview-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(7, 27, 31, 0.62);
}

.file-preview-panel {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-rows: auto 1fr;
  width: min(980px, 100%);
  height: min(760px, 92vh);
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fff;
  box-shadow: 0 24px 80px rgba(14, 39, 44, 0.28);
}

.file-preview-header {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

.file-preview-header h2 {
  margin: 2px 0 0;
  font-size: 1.2rem;
}

.file-preview-body {
  overflow: auto;
  padding: 16px;
  background: #f6f9f7;
}

.file-preview-frame {
  width: 100%;
  height: 100%;
  min-height: 620px;
  border: 0;
  background: #fff;
}

.file-preview-image {
  display: block;
  max-width: 100%;
  height: auto;
  margin: 0 auto;
  border-radius: 6px;
  background: #fff;
}

.file-preview-text {
  margin: 0;
  white-space: pre-wrap;
  font: 0.9rem/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.spreadsheet-preview {
  overflow: auto;
}

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

.spreadsheet-preview table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  background: #fff;
}

.spreadsheet-preview td {
  min-width: 92px;
  max-width: 320px;
  border: 1px solid var(--line);
  padding: 10px 12px;
  white-space: nowrap;
  vertical-align: top;
}

.spreadsheet-preview th {
  position: sticky;
  top: 0;
  z-index: 1;
  min-width: 92px;
  border: 1px solid var(--line);
  padding: 8px 12px;
  color: var(--muted);
  background: #eef3ef;
  font-size: 0.78rem;
}

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

  .sidebar {
    position: static;
    height: auto;
  }

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

  .nav-item {
    justify-content: center;
    padding: 0 8px;
  }

  .nav-item .icon {
    display: none;
  }

  .import-review-actions {
    grid-template-columns: 1fr;
  }

  .import-review-actions .primary-button,
  .import-review-actions .secondary-button {
    width: 100%;
  }

  .sidebar-metrics {
    display: none;
  }

  .topbar,
  .two-column,
  .automation-grid,
  .pod-layout,
  .toolbar-grid,
  .load-form,
  .load-detail-grid,
  .document-grid,
  .review-action-grid {
    grid-template-columns: 1fr;
  }

  .pod-receipt-panel {
    position: static;
  }

  .topbar {
    display: grid;
  }

  body.signed-out .topbar {
    gap: 18px;
  }

  body.signed-out .auth-panel {
    min-width: 0;
    max-width: none;
  }

  .landing-feature-grid,
  .landing-preview {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 640px) {
  .workspace,
  .sidebar {
    padding: 16px;
  }

  .nav-list,
  .metric-grid,
  .dispatcher-metrics,
  .form-grid,
  .pod-actions,
  .gps-row,
  .driver-summary-grid {
    grid-template-columns: 1fr;
  }

  .attention-item,
  .compact-load-card,
  .document-card,
  .driver-link-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .driver-link-actions .primary-button,
  .driver-link-actions .secondary-button {
    width: 100%;
  }

  .topbar-actions {
    display: grid;
    width: 100%;
  }

  .auth-panel {
    min-width: 0;
    width: 100%;
  }

  body.signed-out .topbar h1 {
    font-size: 2.65rem;
    line-height: 1;
  }

  .landing-subheadline {
    font-size: 1rem;
  }

  .landing-actions {
    display: grid;
  }

  .auth-fields {
    grid-template-columns: 1fr;
  }

  .preview-load-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .preview-load-row strong {
    margin-left: 0;
  }

  .topbar-actions .primary-button {
    flex: 1;
  }

  .hero-visual img {
    height: 210px;
  }

  .hero-overlay strong {
    font-size: 1.25rem;
  }

  .review-card,
  .email-card,
  .watch-card {
    grid-template-columns: 1fr;
    display: grid;
  }

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

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

  .receipt-grid p {
    border-right: 0;
  }
}

@media print {
  body {
    background: #fff;
  }

  .app-shell,
  .toast {
    display: none !important;
  }

  .pod-print {
    display: block;
  }

  .print-sheet {
    width: 100%;
    min-height: 100vh;
    padding: 24px;
    color: #111;
    background: #fff;
    font-family: Arial, sans-serif;
  }

  .print-sheet header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    border-bottom: 3px solid #111;
    padding-bottom: 14px;
  }

  .print-sheet h2,
  .print-sheet p {
    margin: 0;
  }

  .print-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    border: 1px solid #111;
    border-bottom: 0;
    margin-top: 18px;
  }

  .print-grid p,
  .print-note,
  .print-signature {
    padding: 10px;
    border-right: 1px solid #111;
    border-bottom: 1px solid #111;
  }

  .print-grid p:nth-child(2n) {
    border-right: 0;
  }

  .print-grid span,
  .print-note span,
  .print-signature span {
    display: block;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
  }

  .print-sheet table {
    margin-top: 18px;
    border: 1px solid #111;
  }

  .print-sheet th,
  .print-sheet td {
    border: 1px solid #111;
    color: #111;
  }

  .print-signature img {
    display: block;
    width: 360px;
    min-height: 100px;
    object-fit: contain;
    border-bottom: 2px solid #111;
  }
}
