:root {
  --bg: #f7f5f0;
  --bg-soft: #fcfbf8;
  --card: #ffffff;
  --text: #1f1f1f;
  --muted: #6f6a62;
  --border: #e5e0d7;
  --accent: #d86f2d;
  --accent-dark: #b85a21;
  --accent-soft: rgba(216, 111, 45, 0.12);
  --success: #237a3b;
  --success-soft: rgba(35, 122, 59, 0.12);
  --danger-bg: #fff1f1;
  --danger-text: #9f2f2f;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
  --radius: 20px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(180deg, #f7f5f0 0%, #f4f1ea 100%);
  color: var(--text);
}

body {
  line-height: 1.45;
}

a {
  color: inherit;
}

.page-shell {
  max-width: 1180px;
  margin: 0 auto;
  padding: 30px 18px 56px;
}

.narrow-shell {
  max-width: 760px;
}

.admin-shell {
  max-width: 1280px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.auth-card,
.search-card,
.tracker-card,
.form-card,
.table-card,
.hero-card {
  padding: 28px;
}

.hero-card {
  overflow: hidden;
  position: relative;
}

.hero-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 24px;
  align-items: center;
}

.hero-graphic {
  min-height: 240px;
  border-radius: 24px;
  background:
    radial-gradient(circle at top left, rgba(216, 111, 45, 0.20), transparent 35%),
    radial-gradient(circle at bottom right, rgba(216, 111, 45, 0.14), transparent 28%),
    linear-gradient(135deg, #fff9f3 0%, #f6efe5 100%);
  border: 1px solid var(--border);
  padding: 22px;
  display: flex;
  align-items: stretch;
}

.mini-tracker {
  width: 100%;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.mini-card-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.mini-card {
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(229,224,215,0.9);
  border-radius: 14px;
  padding: 12px;
}

.mini-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 4px;
  font-weight: 700;
}

.mini-value {
  font-size: 15px;
  font-weight: 700;
}

.mini-progress {
  margin-top: auto;
}

.eyebrow {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

h1, h2, h3 {
  margin-top: 0;
}

h1 {
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.02;
  margin-bottom: 10px;
}

h2 {
  font-size: 22px;
  margin-bottom: 14px;
}

.hero-copy p,
.muted {
  color: var(--muted);
}

.hero-copy p {
  font-size: 16px;
  max-width: 580px;
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 7px;
}

.field input,
.field textarea,
.field select,
.form-inline-search input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 13px 14px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  outline: none;
}

.field textarea {
  min-height: 110px;
  resize: vertical;
}

.form-stack {
  display: grid;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field-full {
  grid-column: 1 / -1;
}

.form-inline-search {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 14px;
  padding: 13px 18px;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease;
}

.btn:hover {
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-secondary {
  background: #f1eee7;
  color: var(--text);
  border: 1px solid var(--border);
}

.full-width {
  width: 100%;
}

.alert {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 14px;
}

.alert-error {
  background: var(--danger-bg);
  color: var(--danger-text);
}

.top-actions {
  margin-bottom: 16px;
}

.text-link {
  color: var(--accent-dark);
  text-decoration: none;
  font-weight: 700;
}

.tracker-header,
.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 22px;
}

.admin-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.status-pill {
  background: var(--success-soft);
  color: var(--success);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.order-meta-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.six-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.meta-box {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 14px;
  background: var(--bg-soft);
}

.meta-label {
  display: block;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 700;
}

.meta-value {
  font-size: 16px;
  font-weight: 700;
  word-break: break-word;
}

.progress-shell {
  margin: 8px 0 30px;
}

.progress-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: #ece7de;
  overflow: hidden;
  margin: 0 18px 18px;
}

.no-side-margin {
  margin-left: 0;
  margin-right: 0;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #ef9a63);
  border-radius: inherit;
}

.steps-grid {
  display: grid;
  gap: 10px;
}

.six-steps {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.step {
  text-align: center;
  padding: 0 4px;
}

.step-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  margin: 0 auto 10px;
  border: 3px solid #d8d2c8;
  background: #fff;
  transition: all 0.2s ease;
}

.step.active .step-dot {
  border-color: var(--accent);
  background: var(--accent);
}

.step-label {
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 4px;
}

.step-note {
  font-size: 12px;
  color: var(--muted);
}

.details-grid,
.split-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.inner-card {
  padding: 20px;
}

.notes-block {
  margin: 0;
  white-space: pre-wrap;
}

.delivery-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.delivery-note {
  margin-top: 0;
  color: var(--muted);
}

.address-block {
  line-height: 1.6;
}

.top-gap-small {
  margin-top: 12px;
}

.invoice-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.updates-card {
  margin-top: 0;
}

.timeline-chart {
  position: relative;
  margin-top: 8px;
  padding-left: 24px;
}

.timeline-chart:before {
  content: '';
  position: absolute;
  left: 8px;
  top: 4px;
  bottom: 4px;
  width: 2px;
  background: #e7dfd3;
}

.timeline {
  display: grid;
  gap: 14px;
}

.timeline-item {
  position: relative;
  display: grid;
  gap: 6px;
  padding: 14px 14px 14px 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: var(--bg-soft);
}

.timeline-item:before {
  content: '';
  position: absolute;
  left: -22px;
  top: 18px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent);
  border: 3px solid #fff;
  box-shadow: 0 0 0 1px var(--border);
}

.timeline-date {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 700;
}

.timeline-status {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.timeline-note {
  color: #3a352f;
  white-space: pre-wrap;
}

.table-wrap {
    max-height: 500px;
    overflow-y: auto;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

.admin-table th,
.admin-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #eee8de;
  text-align: left;
  vertical-align: top;
}

.admin-table th {
  background: var(--bg-soft);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.actions-cell {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.actions-cell a {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.info-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-top: 18px;
}

.info-pill {
  border: 1px solid var(--border);
  background: #fff;
  border-radius: 16px;
  padding: 14px;
}

.info-pill strong {
  display: block;
  margin-bottom: 6px;
  font-size: 14px;
}

.invoice-modal {
  display: none;
  position: fixed;
  z-index: 9999;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.7);
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.invoice-modal-content {
  width: 95%;
  max-width: 1100px;
  height: 90%;
  background: #fff;
  border-radius: 16px;
  overflow: hidden;
  position: relative;
  box-shadow: 0 30px 60px rgba(0,0,0,0.25);
}

.invoice-close {
  position: absolute;
  top: 8px;
  right: 14px;
  font-size: 32px;
  font-weight: bold;
  cursor: pointer;
  z-index: 2;
  border: 0;
  background: transparent;
  line-height: 1;
}

.invoice-modal iframe {
  border: none;
  width: 100%;
  height: 100%;
}

@media (max-width: 1100px) {
  .six-steps {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    row-gap: 18px;
  }
}

@media (max-width: 960px) {
  .hero-grid,
  .form-grid,
  .details-grid,
  .split-layout,
  .order-meta-grid,
  .info-strip,
  .six-grid {
    grid-template-columns: 1fr;
  }

  .tracker-header,
  .admin-header,
  .form-inline-search {
    grid-template-columns: 1fr;
    display: grid;
  }

  .progress-bar {
    margin-left: 0;
    margin-right: 0;
  }

  .six-steps {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .page-shell {
    padding: 20px 14px 36px;
  }

  .auth-card,
  .search-card,
  .tracker-card,
  .form-card,
  .table-card,
  .inner-card,
  .hero-card {
    padding: 18px;
  }

  .mini-card-row,
  .six-steps {
    grid-template-columns: 1fr;
  }

  .invoice-actions {
    flex-direction: column;
  }
}

.dashboard-search-card {
  margin-bottom: 18px;
}

.lookup-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr auto;
  gap: 14px;
  align-items: end;
}

.lookup-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.dashboard-tabs {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}

.dashboard-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  text-decoration: none;
  font-weight: 700;
}

.dashboard-tab.active {
  color: #1f1f1f;
}

.status-open {
  background: #fff4bf;
  border-color: #e5d26a;
}

.status-completed {
  background: #daf3df;
  border-color: #96d3a4;
}

.status-cancelled {
  background: #ffdede;
  border-color: #ea9a9a;
}

.status-inline-form {
  margin: 0;
}

.status-select {
  width: 100%;
  min-width: 140px;
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  font-weight: 700;
}

.status-select.status-open {
  background: #fff4bf;
  border-color: #e5d26a;
}

.status-select.status-completed {
  background: #daf3df;
  border-color: #96d3a4;
}

.status-select.status-cancelled {
  background: #ffdede;
  border-color: #ea9a9a;
}

.edit-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.admin-order-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  border: 1px solid transparent;
}

.admin-order-badge.status-open {
  background: #fff4bf;
  border-color: #e5d26a;
  color: #6c5600;
}

.admin-order-badge.status-completed {
  background: #daf3df;
  border-color: #96d3a4;
  color: #1f6b34;
}

.admin-order-badge.status-cancelled {
  background: #ffdede;
  border-color: #ea9a9a;
  color: #992626;
}

.opened-card {
  margin-bottom: 18px;
}

.opened-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

@media (max-width: 960px) {
  .lookup-grid,
  .opened-grid {
    grid-template-columns: 1fr;
  }
}

.proof-field {
  align-self: start;
}

.proof-admin-card {
  margin-top: 8px;
  padding: 14px;
  border: 1px solid #eee8de;
  border-radius: 14px;
  background: #faf8f6;
}

.proof-admin-meta {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.proof-admin-file {
  font-size: 13px;
  font-weight: 700;
  color: #2f2a26;
  word-break: break-word;
}

.proof-admin-link {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.proof-admin-link:hover {
  text-decoration: underline;
}

.proof-remove-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  font-size: 13px;
  color: #6c6257;
  cursor: pointer;
}

.proof-remove-toggle input {
  margin: 0;
}

.proof-admin-empty {
  margin: 10px 0 0;
}

.proof-field {
  align-self: start;
}

.proof-admin-card {
  margin-top: 8px;
  padding: 14px;
  border: 1px solid #eee8de;
  border-radius: 14px;
  background: #faf8f6;
}

.proof-admin-meta {
  margin-top: 10px;
  display: grid;
  gap: 6px;
}

.proof-admin-file {
  font-size: 13px;
  font-weight: 700;
  color: #2f2a26;
  word-break: break-word;
  line-height: 1.35;
}

.proof-admin-link {
  color: var(--accent-dark);
  font-weight: 700;
  text-decoration: none;
}

.proof-admin-link:hover {
  text-decoration: underline;
}

.proof-remove-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  font-size: 13px;
  color: #6c6257;
  cursor: pointer;
  width: auto;
}

.proof-remove-toggle input {
  margin: 0;
  position: relative;
  top: 0;
  flex: 0 0 auto;
}

.proof-remove-toggle span {
  line-height: 1.2;
}

.proof-admin-empty {
  margin: 8px 0 0;
}

.admin-modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(25, 20, 16, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.admin-modal-card {
  width: 100%;
  max-width: 760px;
  max-height: 90vh;
  overflow: auto;
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.22);
  padding: 24px;
}

.admin-modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.admin-modal-header h2 {
  margin: 4px 0 0;
}

.admin-modal-close {
  border: 0;
  background: #f3eee8;
  color: #2f2a26;
  font-weight: 700;
  border-radius: 999px;
  padding: 10px 14px;
  cursor: pointer;
}

.admin-modal-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}

.admin-modal-body {
  border-top: 1px solid #eee8de;
  padding-top: 18px;
}

.save-summary-list {
  margin: 0;
  padding-left: 20px;
  display: grid;
  gap: 10px;
}

.save-summary-list li {
  color: #2f2a26;
  line-height: 1.45;
}