:root {
  color-scheme: light;
  --green-950: #102f24;
  --green-900: #123d2c;
  --green-800: #1d503a;
  --green-700: #2a684b;
  --green-100: #e4eee7;
  --green-50: #f1f6f2;
  --cream: #f7f3e8;
  --paper: #fffefa;
  --ink: #17231d;
  --muted: #647069;
  --line: #dbe2dc;
  --orange: #df832d;
  --orange-soft: #fff0dc;
  --red: #a33d31;
  --shadow: 0 12px 36px rgba(18, 61, 44, 0.1);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--cream); }
body { margin: 0; color: var(--ink); background: var(--cream); font-size: 16px; line-height: 1.5; }
button, input, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; }

.boot-screen, .auth-screen { min-height: 100vh; display: grid; place-content: center; text-align: center; padding: 32px; }
.spinner { width: 34px; height: 34px; margin: 0 auto 14px; border: 3px solid #cad8cf; border-top-color: var(--green-700); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.auth-card { max-width: 460px; padding: 42px; border-radius: 24px; background: var(--paper); box-shadow: var(--shadow); border: 1px solid rgba(18,61,44,.08); }
.auth-mark { width: 58px; height: 58px; display: grid; place-items: center; margin: 0 auto 22px; color: white; background: var(--green-900); border-radius: 17px; }
.auth-card h1 { margin: 0 0 10px; font-family: Georgia, serif; font-size: clamp(2rem, 6vw, 2.75rem); line-height: 1; color: var(--green-950); }
.auth-card p { margin: 0 0 26px; color: var(--muted); }

.shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 18px; min-height: 76px; padding: 12px 28px; color: white; background: var(--green-950); box-shadow: 0 4px 22px rgba(6,26,18,.22); }
.brand { display: flex; align-items: center; gap: 12px; min-width: 230px; }
.brand-mark { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 11px; color: var(--green-950); background: var(--cream); }
.brand-copy { display: grid; line-height: 1.05; }
.brand-copy strong { font-family: Georgia, serif; font-size: 1.25rem; letter-spacing: .01em; }
.brand-copy span { margin-top: 4px; font-size: .76rem; color: #bdd0c4; letter-spacing: .08em; text-transform: uppercase; }
.tabs { display: flex; align-self: stretch; align-items: stretch; gap: 4px; margin: 0 auto; }
.tab-button { position: relative; border: 0; padding: 0 17px; color: #c8d8ce; background: transparent; cursor: pointer; font-weight: 700; }
.tab-button:hover, .tab-button:focus-visible { color: white; }
.tab-button.active { color: white; }
.tab-button.active::after { content: ""; position: absolute; left: 14px; right: 14px; bottom: 0; height: 3px; border-radius: 3px 3px 0 0; background: var(--orange); }
.user-menu { display: flex; align-items: center; gap: 10px; min-width: 230px; justify-content: flex-end; }
.user-meta { text-align: right; line-height: 1.2; }
.user-meta strong { display: block; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .9rem; }
.user-meta span { color: #bcd0c3; font-size: .75rem; }

.page { width: min(1260px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 64px; }
.page-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 24px; }
.eyebrow { margin: 0 0 6px; color: var(--green-700); text-transform: uppercase; letter-spacing: .12em; font-size: .75rem; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
.page-heading h1 { margin-bottom: 6px; font-family: Georgia, serif; font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 700; line-height: 1; color: var(--green-950); }
.page-heading p { margin-bottom: 0; color: var(--muted); }
.toolbar { display: grid; grid-template-columns: minmax(240px, 1fr) repeat(4, auto); gap: 12px; margin-bottom: 18px; }
.control { height: 48px; padding: 0 14px; color: var(--ink); background: var(--paper); border: 1px solid var(--line); border-radius: 12px; outline: none; }
.control:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(42,104,75,.12); }
.search-wrap { position: relative; }
.search-wrap svg { position: absolute; left: 15px; top: 14px; color: var(--muted); pointer-events: none; }
.search-wrap input { width: 100%; padding-left: 44px; }

.button { min-height: 46px; display: inline-flex; align-items: center; justify-content: center; gap: 9px; padding: 0 17px; border: 1px solid transparent; border-radius: 12px; font-weight: 800; cursor: pointer; text-decoration: none; transition: transform .12s ease, background .12s ease, border-color .12s ease; }
.button:hover { transform: translateY(-1px); }
.button:active { transform: translateY(0); }
.button:focus-visible { outline: 3px solid rgba(223,131,45,.34); outline-offset: 2px; }
.button.primary { color: white; background: var(--green-800); }
.button.primary:hover { background: var(--green-700); }
.button.secondary { color: var(--green-900); background: var(--paper); border-color: var(--line); }
.button.notification { color: #73420f; background: var(--orange-soft); border-color: #e7bf8c; }
.button.notification span { min-width: 24px; padding: 2px 7px; border-radius: 999px; color: white; background: var(--orange); font-size: .76rem; }
.button.notification.active { color: white; background: var(--orange); border-color: var(--orange); }
.button.notification.active span { color: #73420f; background: white; }
.button.danger { color: white; background: var(--red); }
.button.orange { color: #35200d; background: var(--orange); }
.button.ghost { min-height: 38px; color: inherit; background: transparent; border-color: rgba(255,255,255,.18); }
.button.small { min-height: 36px; padding: 0 12px; font-size: .86rem; }
.button:disabled { cursor: not-allowed; opacity: .48; transform: none; }
.icon-button { width: 42px; height: 42px; display: grid; place-items: center; padding: 0; border: 1px solid var(--line); border-radius: 11px; color: var(--green-900); background: var(--paper); cursor: pointer; }

.stop-list { display: grid; gap: 10px; }
.new-profile-group { margin-bottom: 28px; padding: 20px; border: 1px solid #e8c99c; border-radius: 20px; background: var(--orange-soft); }
.profile-group-heading { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 16px; }
.profile-group-heading h2, .profile-group-title { margin-bottom: 5px; font-family: Georgia, serif; color: var(--green-950); }
.profile-group-heading p { margin-bottom: 0; color: #765332; }
.new-profile-count { flex: 0 0 auto; padding: 7px 11px; border-radius: 999px; color: #6f3d0c; background: white; font-size: .8rem; font-weight: 900; }
.profile-group-title:empty { display: none; }
.profile-group-title { margin: 0 0 12px 2px; }
.stop-card { overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--paper); box-shadow: 0 5px 20px rgba(18,61,44,.045); }
.stop-card.new-profile { border-color: #deb982; }
.stop-card[open] { border-color: #b8cabe; box-shadow: var(--shadow); }
.stop-summary { list-style: none; display: grid; grid-template-columns: 70px minmax(220px, 1.35fr) minmax(220px, 1fr) auto 36px; gap: 16px; align-items: center; min-height: 82px; padding: 14px 18px; cursor: pointer; }
.stop-summary::-webkit-details-marker { display: none; }
.stop-index { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 13px; color: var(--green-900); background: var(--green-100); font-family: Georgia, serif; font-size: 1.25rem; font-weight: 700; }
.stop-title { min-width: 0; }
.stop-title strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--green-950); font-size: 1.05rem; }
.stop-title span, .stop-address { display: block; margin-top: 3px; color: var(--muted); font-size: .86rem; }
.stop-address { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stop-tags { display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.tag { padding: 5px 9px; border-radius: 999px; background: var(--green-50); color: var(--green-800); font-size: .76rem; font-weight: 800; white-space: nowrap; }
.tag.window { color: #7b4817; background: var(--orange-soft); }
.tag.new { color: white; background: var(--orange); }
.chevron { transition: transform .15s ease; }
.stop-card[open] .chevron { transform: rotate(180deg); }
.stop-detail { display: grid; grid-template-columns: 1.1fr .9fr; gap: 28px; padding: 22px 24px 26px; border-top: 1px solid var(--line); background: #fcfdf9; }
.detail-section h3 { margin-bottom: 9px; color: var(--green-900); font-size: .86rem; text-transform: uppercase; letter-spacing: .08em; }
.detail-section p { white-space: pre-wrap; }
.entry-code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-weight: 750; letter-spacing: .035em; }
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 18px; }
.address-link { color: var(--green-700); font-weight: 800; text-decoration-thickness: 1px; text-underline-offset: 3px; }
.photos { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; margin-bottom: 12px; }
.photo { overflow: hidden; aspect-ratio: 4/3; padding: 0; border: 0; border-radius: 11px; background: var(--green-100); cursor: zoom-in; }
.photo img { width: 100%; height: 100%; object-fit: cover; }
.photo:hover img { transform: scale(1.025); }
.photo:focus-visible { outline: 3px solid rgba(223,131,45,.5); outline-offset: 2px; }
.photo img { transition: transform .16s ease; }
.empty-photo { padding: 18px; border: 1px dashed #b8c9bd; border-radius: 12px; color: var(--muted); text-align: center; font-size: .88rem; }
.detail-actions { display: flex; gap: 9px; flex-wrap: wrap; margin-top: 18px; }
.file-input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; pointer-events: none; }

.empty-state { padding: 70px 24px; text-align: center; border: 1px dashed #b9cabe; border-radius: 20px; background: rgba(255,255,255,.48); }
.empty-state svg { color: var(--green-700); }
.empty-state h2 { margin: 14px 0 6px; font-family: Georgia, serif; color: var(--green-950); }
.empty-state p { color: var(--muted); }

.workflow-layout { display: grid; grid-template-columns: minmax(0,1.4fr) minmax(320px,.8fr); gap: 22px; align-items: start; }
.panel { padding: 25px; border: 1px solid var(--line); border-radius: 20px; background: var(--paper); box-shadow: 0 7px 24px rgba(18,61,44,.06); }
.panel h2 { margin-bottom: 6px; color: var(--green-950); font-family: Georgia, serif; font-size: 1.55rem; }
.panel-subtitle { margin-bottom: 22px; color: var(--muted); }
.steps { display: grid; grid-template-columns: 1fr 56px 1fr; align-items: stretch; }
.step { display: flex; flex-direction: column; min-height: 250px; padding: 22px; border: 1px solid var(--line); border-radius: 17px; background: #fbfcf8; }
.step-number { width: 31px; height: 31px; display: grid; place-items: center; margin-bottom: 18px; border-radius: 50%; color: white; background: var(--green-800); font-weight: 900; }
.step h3 { margin-bottom: 8px; color: var(--green-950); }
.step p { color: var(--muted); font-size: .9rem; }
.step .step-safeguard { margin: 12px 0 18px; padding: 10px 12px; border-left: 3px solid var(--orange); border-radius: 0 8px 8px 0; background: var(--orange-soft); color: #6d451d; font-size: .82rem; font-weight: 700; }
.step .button { margin-top: auto; }
.step-connector { align-self: center; height: 2px; background: var(--line); }
.status-banner { display: flex; align-items: flex-start; gap: 13px; margin-bottom: 18px; padding: 15px 17px; border-radius: 13px; background: var(--green-50); border: 1px solid #d0dfd4; }
.status-banner strong { display: block; margin-bottom: 2px; color: var(--green-900); }
.status-banner p { margin: 0; color: var(--muted); font-size: .88rem; }
.status-banner.warning { background: var(--orange-soft); border-color: #f1d0a9; }
.status-banner.warning strong { color: #784514; }
.status-banner.loading .status-icon { animation: spin .8s linear infinite; }
.controller-meta { display: inline-block; margin-top: 7px; color: var(--green-700); font-size: .76rem; font-weight: 800; text-transform: capitalize; }
.job-steps { display: grid; gap: 8px; margin: 0 0 18px; padding: 0; list-style: none; }
.job-step { display: grid; grid-template-columns: 15px 1fr; gap: 10px; align-items: start; padding: 10px 12px; border-radius: 10px; background: #f8faf6; }
.job-step-dot { width: 10px; height: 10px; margin-top: 6px; border: 2px solid #9bb2a3; border-radius: 50%; background: white; }
.job-step.running .job-step-dot { border-color: var(--orange); background: var(--orange-soft); }
.job-step.complete .job-step-dot { border-color: var(--green-700); background: var(--green-700); }
.job-step.failed .job-step-dot { border-color: var(--red); background: var(--red); }
.job-step.skipped .job-step-dot { border-color: var(--muted); background: #d7ddd9; }
.job-step strong { display: block; color: var(--green-950); font-size: .8rem; text-transform: capitalize; }
.job-step p { margin: 2px 0 0; color: var(--muted); font-size: .8rem; }
.error-code { display: inline-block; margin-top: 7px; padding: 3px 7px; border-radius: 6px; color: #7d2e27; background: #f8e3df; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; }
.history { display: grid; gap: 11px; }
.history-item { padding: 13px 0; border-top: 1px solid var(--line); }
.history-item:first-child { border-top: 0; }
.history-item-top { display: flex; justify-content: space-between; gap: 12px; }
.history-item strong { color: var(--green-950); }
.history-item time { color: var(--muted); font-size: .78rem; white-space: nowrap; }
.history-item p { margin: 4px 0 0; color: var(--muted); font-size: .85rem; }
.note-box textarea { width: 100%; min-height: 138px; resize: vertical; padding: 13px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fbfcf8; outline: none; }
.note-box textarea:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(42,104,75,.12); }
.note-box .button { width: 100%; margin-top: 10px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; background: rgba(10,31,23,.62); }
.modal { width: min(680px, 100%); max-height: min(90vh, 780px); overflow: auto; padding: 26px; border-radius: 20px; background: var(--paper); box-shadow: 0 30px 80px rgba(6,25,17,.28); }
.modal-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 20px; }
.modal-head h2 { margin-bottom: 4px; font-family: Georgia, serif; color: var(--green-950); }
.modal-head p { margin: 0; color: var(--muted); font-size: .9rem; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 15px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: .84rem; font-weight: 800; color: var(--green-900); }
.field input, .field textarea, .field select { width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: white; outline: none; }
.field textarea { min-height: 110px; resize: vertical; }
.field input:focus, .field textarea:focus, .field select:focus { border-color: var(--green-700); box-shadow: 0 0 0 3px rgba(42,104,75,.12); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.modal-actions .delete-profile { margin-right: auto; }
.photo-modal-backdrop { z-index: 70; }
.photo-viewer { width: min(1040px, 100%); max-height: calc(100vh - 40px); display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; padding: 12px; border-radius: 20px; background: var(--paper); box-shadow: 0 30px 80px rgba(6,25,17,.35); }
.photo-viewer-head { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 2px 2px 10px 10px; color: var(--green-950); font-weight: 800; }
.photo-viewer-head span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-viewer img { display: block; width: 100%; height: 100%; max-height: calc(100vh - 112px); object-fit: contain; border-radius: 13px; background: var(--green-950); }
.toast-stack { position: fixed; z-index: 80; right: 20px; bottom: 20px; display: grid; gap: 10px; }
.toast { max-width: 420px; padding: 13px 16px; color: white; background: var(--green-950); border-radius: 11px; box-shadow: var(--shadow); animation: toast-in .2s ease-out; }
.toast.error { background: #7d2e27; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

@media (max-width: 940px) {
  .topbar { flex-wrap: wrap; padding: 12px 18px 0; }
  .brand { min-width: 0; flex: 1; }
  .user-menu { min-width: 0; }
  .tabs { order: 3; width: 100%; overflow-x: auto; justify-content: flex-start; }
  .tab-button { min-height: 48px; white-space: nowrap; }
  .user-meta { display: none; }
  .toolbar { grid-template-columns: 1fr 1fr; }
  .search-wrap { grid-column: 1 / -1; }
  .stop-summary { grid-template-columns: 58px minmax(0,1fr) auto 28px; }
  .stop-address { display: none; }
  .stop-detail { grid-template-columns: 1fr; }
  .workflow-layout { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .page { width: min(100% - 24px, 1260px); padding-top: 24px; }
  .brand-copy span { display: none; }
  .page-heading { align-items: start; flex-direction: column; }
  .profile-group-heading { flex-direction: column; }
  .toolbar { grid-template-columns: 1fr; }
  .search-wrap { grid-column: auto; }
  .toolbar .button { width: 100%; }
  .stop-summary { grid-template-columns: 50px minmax(0,1fr) 28px; gap: 10px; padding: 12px; }
  .stop-index { width: 42px; height: 42px; }
  .stop-tags { grid-column: 2 / 4; justify-content: flex-start; }
  .stop-detail { padding: 18px; }
  .detail-grid, .form-grid { grid-template-columns: 1fr; }
  .field.full { grid-column: auto; }
  .steps { grid-template-columns: 1fr; gap: 12px; }
  .step-connector { width: 2px; height: 22px; }
  .panel { padding: 18px; }
  .auth-card { padding: 30px 24px; }
  .modal { padding: 20px; }
}
.closed-attempts { color: var(--muted); font-size: 13px; margin: 0 0 20px; }
.closed-attempts summary { cursor: pointer; padding: 8px 0; }
