:root {
  --ink: #17252b;
  --muted: #63747a;
  --line: #dce5e4;
  --paper: #f5f8f7;
  --card: #ffffff;
  --teal: #1d7bb2;
  --teal-dark: #21a5dc;
  --teal-soft: #c7e9f6;
  --orange: #c96d3d;
  --danger: #a9453f;
  --shadow: 0 14px 36px rgba(22, 54, 58, .08);
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--paper);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: linear-gradient(145deg, #f5f8f7 0%, #eef5f2 50%, #f8f7f2 100%); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .48; }

.app-shell { width: min(1120px, calc(100% - 32px)); margin: 0 auto; padding: 28px 0 56px; }
.topbar { position: relative; display: flex; align-items: center; justify-content: center; min-height: 48px; margin-bottom: 42px; }
.brand-logo { display: block; width: min(340px, 75vw); height: auto; }
.access-badge { position: absolute; right: 0; top: 50%; display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; transform: translateY(-50%); }
.access-badge::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: #4c9b72; box-shadow: 0 0 0 5px #dceee3; }
.company-name { position: absolute; left: 0; top: 50%; margin: 0; color: var(--teal-dark); font-size: .85rem; font-weight: 800; letter-spacing: .04em; transform: translateY(-50%); }

.hero { max-width: 720px; margin-bottom: 32px; }
.eyebrow { margin: 0 0 10px; color: var(--teal); font-size: .78rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
h1, h2, h3, p { margin-top: 0; }
h1 { max-width: 700px; margin-bottom: 12px; font-size: clamp(2.15rem, 6vw, 4.2rem); line-height: .99; letter-spacing: -.04em; }
.lead { max-width: 580px; margin-bottom: 0; color: var(--muted); font-size: clamp(1rem, 2vw, 1.2rem); line-height: 1.6; }

.dashboard { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(280px, .8fr); gap: 18px; align-items: start; }
.card { border: 1px solid rgba(220, 229, 228, .9); border-radius: 14px; background: rgba(255,255,255,.88); box-shadow: var(--shadow); }
.service-card { padding: clamp(22px, 4vw, 38px); }
.side-card { padding: 26px; }
.card-heading { display: flex; justify-content: space-between; gap: 18px; align-items: flex-start; margin-bottom: 26px; }
.card-heading h2 { margin-bottom: 7px; font-size: 1.35rem; }
.card-heading p { margin-bottom: 0; color: var(--muted); line-height: 1.5; }
.card-heading .service-company-name { margin: 0 0 16px; color: var(--teal-dark); font-size: clamp(1.35rem, 3vw, 1.8rem); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; }
.step-number { display: grid; flex: 0 0 42px; height: 42px; place-items: center; border-radius: 50%; color: white; background: var(--teal); font-weight: 800; }

.status-panel { display: flex; align-items: center; gap: 12px; min-height: 63px; padding: 16px; border-radius: 10px; background: var(--teal-soft); }
.status-dot { flex: 0 0 10px; width: 10px; height: 10px; border-radius: 50%; background: var(--teal); }
.status-panel p { margin: 0; color: var(--teal-dark); font-weight: 700; line-height: 1.45; }
.status-panel.error { background: #fbebea; }
.status-panel.error .status-dot { background: var(--danger); }
.status-panel.success { background: #e4f2e8; }

.worker-field { display: grid; gap: 8px; margin-bottom: 18px; color: var(--muted); font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.worker-field input { min-height: 48px; padding: 11px 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: white; font-size: 1rem; font-weight: 600; letter-spacing: normal; text-transform: none; }
.worker-field input:focus { outline: 3px solid rgba(23, 107, 104, .18); border-color: var(--teal); }

.button-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 22px; }
.button { min-height: 50px; padding: 12px 18px; border: 0; border-radius: 8px; font-size: .84rem; font-weight: 800; letter-spacing: .05em; transition: transform .18s ease, background .18s ease, box-shadow .18s ease; }
.button:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 9px 20px rgba(22, 54, 58, .14); }
.button-primary { color: white; background: var(--teal); }
.button-primary:hover:not(:disabled) { background: var(--teal-dark); }
.button-secondary { color: white; background: var(--orange); }
.button-ghost { color: var(--teal-dark); border: 1px solid var(--line); background: white; }
.history-link { display: inline-flex; align-items: center; justify-content: center; width: 100%; margin-top: 22px; text-decoration: none; }

.service-summary { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 26px; padding-top: 24px; border-top: 1px solid var(--line); }
.summary-item span, .metric span { display: block; margin-bottom: 6px; color: var(--muted); font-size: .74rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.summary-item strong { font-size: 1rem; }
.hidden { display: none !important; }

.side-card h2 { margin-bottom: 20px; font-size: 1.2rem; }
.check-list { display: grid; gap: 12px; margin-bottom: 24px; }
.check-row { display: flex; align-items: center; gap: 12px; color: var(--ink); font-size: .98rem; }
.check-row input { width: 19px; height: 19px; accent-color: var(--teal); }
.metrics { display: grid; gap: 10px; padding-top: 20px; border-top: 1px solid var(--line); }
.metric { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.metric span { margin: 0; }
.metric strong { font-size: 1.2rem; color: var(--teal-dark); }
.metric.missing strong { color: var(--orange); }

.history { margin-top: 18px; padding: 28px; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.section-title h2 { margin: 0; font-size: 1.35rem; }
.section-title p { margin: 0; color: var(--muted); font-size: .9rem; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; }
th { padding: 13px 12px; color: var(--muted); border-bottom: 1px solid var(--line); font-size: .72rem; letter-spacing: .08em; text-align: left; text-transform: uppercase; }
td { padding: 16px 12px; border-bottom: 1px solid #e9efee; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
.empty-history { margin: 0; padding: 20px 0 4px; color: var(--muted); text-align: center; }
.location-label { color: var(--teal-dark); font-weight: 700; }

.history-page-header { margin-bottom: 30px; text-align: center; }
.history-page-header .brand-logo { margin: 0 auto 22px; }
.history-page-header .company-name { position: static; margin: -10px 0 18px; color: var(--teal-dark); font-size: clamp(1.5rem, 4vw, 2.25rem); font-weight: 800; line-height: 1.1; letter-spacing: -.02em; transform: none; }
.history-page-header h1 { max-width: none; margin-bottom: 0; font-size: clamp(1.65rem, 4vw, 2.4rem); }
.history-toolbar { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; padding: 20px; }
.filter-field { display: grid; gap: 7px; color: var(--muted); font-size: .74rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.filter-field input, .filter-field select { width: 100%; min-height: 43px; padding: 9px 11px; color: var(--ink); border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.history-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 22px; }
.history-metrics .metric { display: grid; gap: 6px; padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255,255,255,.88); box-shadow: var(--shadow); }
.history-metrics .metric span { margin: 0; }
.back-link { display: inline-flex; align-items: center; justify-content: center; margin-top: 24px; text-decoration: none; }

@media (max-width: 760px) {
  .app-shell { width: min(100% - 24px, 620px); padding-top: 18px; }
  .topbar { margin-bottom: 30px; }
  .access-badge { font-size: .66rem; }
  .card-heading .service-company-name { font-size: 1.8rem; }
  .history-page-header .company-name { font-size: 2rem; }
  .dashboard { grid-template-columns: 1fr; }
  .service-card, .side-card, .history { padding: 22px 18px; }
  .service-summary { grid-template-columns: 1fr; gap: 16px; }
  .history-toolbar, .history-metrics { grid-template-columns: 1fr; }
  .section-title { align-items: flex-start; flex-direction: column; gap: 8px; }
  .table-wrap { overflow: visible; }
  table, thead, tbody, tr, th, td { display: block; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tbody { display: grid; gap: 12px; }
  tr { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
  td { display: grid; grid-template-columns: 92px 1fr; gap: 12px; padding: 7px 0; border: 0; }
  td::before { content: attr(data-label); color: var(--muted); font-size: .7rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
}

@media (max-width: 430px) {
  .topbar { flex-direction: column; gap: 14px; }
  .access-badge, .company-name { position: static; transform: none; }
  .button-row { display: grid; }
  .button { width: 100%; }
}
