:root {
  --ink: #18211f;
  --muted: #60706c;
  --line: #d8e0dd;
  --panel: #ffffff;
  --field: #f5f7f6;
  --mist: #eef3f1;
  --pine: #285849;
  --pine-dark: #173d34;
  --snow: #e7f3fa;
  --gold: #c89b3c;
  --danger: #a84838;
  --shadow: 0 18px 50px rgba(24, 33, 31, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: linear-gradient(135deg, #edf4f2 0%, #f7f8f4 52%, #e6f1f7 100%);
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(90deg, rgba(18, 32, 29, 0.88), rgba(18, 32, 29, 0.36)),
    url("https://images.unsplash.com/photo-1600585154340-be6161a56a0c?auto=format&fit=crop&w=1600&q=80");
  background-size: cover;
  background-position: center;
}

.login-screen.hidden,
.app-shell.hidden,
.conditional-field.hidden {
  display: none;
}

.login-panel {
  width: min(100%, 460px);
  display: grid;
  gap: 22px;
  padding: 26px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255, 255, 255, 0.5);
  box-shadow: var(--shadow);
}

.login-brand span {
  color: var(--muted);
}

.login-copy,
.session-line {
  color: var(--muted);
  line-height: 1.5;
}

.form-error {
  min-height: 20px;
  color: var(--danger);
  font-weight: 800;
}

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

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

button {
  cursor: pointer;
}

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

.sidebar {
  background: #172520;
  color: white;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand-mark {
  width: 48px;
  height: 48px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: var(--gold);
  color: #172520;
  font-weight: 900;
}

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

.brand span,
.sidebar-card p {
  color: rgba(255, 255, 255, 0.7);
}

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

.nav-tab {
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: white;
  background: rgba(255, 255, 255, 0.06);
  text-align: left;
  padding: 0 14px;
}

.nav-tab.active,
.nav-tab:hover {
  background: white;
  color: var(--pine-dark);
}

.nav-tab.locked {
  display: none;
}

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

.logout-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: white;
  background: rgba(255, 255, 255, 0.08);
  font-weight: 800;
}

.sidebar-card strong {
  display: block;
  font-size: 1.5rem;
  margin-top: 6px;
}

.main {
  padding: 28px;
  overflow: auto;
}

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

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 3.25rem);
  line-height: 1;
}

h2 {
  font-size: 1.25rem;
}

.eyebrow {
  display: block;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.72rem;
  font-weight: 800;
}

.company-editor {
  display: grid;
  gap: 6px;
  min-width: 240px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--field);
  color: var(--ink);
  padding: 11px 12px;
}

textarea {
  resize: vertical;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.work-grid,
.split-layout {
  display: grid;
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.5fr);
  gap: 18px;
}

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

.panel {
  padding: 18px;
}

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

.job-list,
.lead-list,
.request-list,
.invoice-list,
.schedule-board {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.job-card {
  width: 100%;
  display: grid;
  gap: 4px;
  text-align: left;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f9fbfa;
}

.job-card.active {
  border-color: var(--pine);
  box-shadow: inset 4px 0 0 var(--pine);
}

.job-card-time,
.job-card-service,
.job-card-address {
  color: var(--muted);
  font-size: 0.86rem;
}

.job-form,
.stacked-form {
  display: grid;
  gap: 16px;
  margin-top: 16px;
}

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

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

.metric-card {
  padding: 18px;
}

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

.primary-button,
.secondary-button,
.text-button,
.upload-button {
  min-height: 42px;
  border-radius: 8px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  font-weight: 800;
}

.primary-button {
  color: white;
  background: var(--pine);
}

.secondary-button {
  color: var(--pine-dark);
  background: var(--snow);
  border: 1px solid #bfd7e4;
}

.text-button {
  background: transparent;
  color: var(--pine);
  min-height: auto;
  padding: 0;
}

.upload-button {
  color: var(--pine-dark);
  background: var(--mist);
  border: 1px dashed var(--pine);
}

.upload-button input {
  display: none;
}

.status-pill {
  padding: 8px 10px;
  border-radius: 999px;
  background: var(--mist);
  color: var(--pine-dark);
  font-weight: 800;
  font-size: 0.82rem;
}

.status-pill.active {
  background: #fff0c8;
  color: #76530e;
}

.status-pill.done {
  background: #dff2e7;
  color: #1d6840;
}

.checklist {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #fbfcfb;
}

.checklist label {
  grid-template-columns: auto 1fr;
  display: grid;
  align-items: center;
  justify-content: start;
  color: var(--ink);
  font-weight: 650;
}

.task-option.hidden {
  display: none;
}

.checklist input {
  width: 18px;
  height: 18px;
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.photo-tile {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--mist);
}

.photo-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-tile button {
  position: absolute;
  right: 6px;
  top: 6px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  border: 0;
  background: rgba(24, 33, 31, 0.75);
  color: white;
}

.lead-item,
.request-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
  display: grid;
  gap: 6px;
}

.lead-item select,
.request-item select {
  margin-top: 8px;
}

.request-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
}

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

.invoice-item {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(220px, 0.8fr);
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.invoice-summary {
  display: grid;
  gap: 6px;
}

.invoice-summary span,
.invoice-summary p {
  color: var(--muted);
}

.invoice-controls {
  display: grid;
  gap: 10px;
}

.schedule-day {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.schedule-day-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.route-item {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
}

.route-number {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--pine);
  color: white;
  font-weight: 900;
}

.route-item span,
.repeat-tag {
  color: var(--muted);
  font-size: 0.86rem;
}

.repeat-tag {
  padding: 6px 8px;
  border-radius: 999px;
  background: var(--mist);
  font-weight: 800;
}

.accounting-table {
  display: grid;
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.table-row {
  display: grid;
  grid-template-columns: 1fr 0.7fr 1.4fr;
  gap: 12px;
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
}

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

.table-head {
  background: var(--mist);
  font-weight: 900;
}

.public-hero {
  min-height: 52vh;
  border-radius: 8px;
  display: flex;
  align-items: end;
  padding: 36px;
  overflow: hidden;
  color: white;
  background:
    linear-gradient(90deg, rgba(18, 32, 29, 0.9), rgba(18, 32, 29, 0.38)),
    url("https://images.unsplash.com/photo-1600585154340-be6161a56a0c?auto=format&fit=crop&w=1600&q=80");
  background-size: cover;
  background-position: center;
}

.hero-copy {
  max-width: 620px;
}

.hero-copy .eyebrow {
  color: rgba(255, 255, 255, 0.75);
}

.hero-copy h2 {
  font-size: clamp(3rem, 8vw, 6rem);
  line-height: 0.95;
  margin: 8px 0 16px;
}

.hero-copy p {
  font-size: 1.15rem;
  line-height: 1.55;
  margin-bottom: 22px;
}

.service-band {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.service-band article {
  padding: 18px;
  border-radius: 8px;
  background: white;
  border: 1px solid var(--line);
}

.service-band strong,
.service-band span {
  display: block;
}

.service-band span {
  color: var(--muted);
  margin-top: 5px;
}

@media (max-width: 980px) {
  .app-shell,
  .work-grid,
  .split-layout,
  .metric-grid,
  .service-band {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
  }

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

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

  .field-row,
  .actions,
  .panel-header,
  .section-heading {
    grid-template-columns: 1fr;
    display: grid;
    align-items: stretch;
  }

  .table-row,
  .invoice-item,
  .route-item {
    grid-template-columns: 1fr;
  }
}
