/* ==========================================================
   Weißer Fleck – Atlas-/Feldbuch-Look
   Papier, Tinte, Zinnoberrot für die „weißen Flecken“
   ========================================================== */

:root {
  --paper: #f2eee3;
  --paper-2: #e9e3d3;
  --card: #fbf9f3;
  --line: #d8cfba;
  --line-2: #c3b89d;
  --ink: #16272c;
  --ink-2: #3f5156;
  --ink-3: #586669;
  --accent: #c93a1d;
  --accent-2: #d9482b;
  --accent-soft: #f6dcd3;
  --ok: #276a4c;
  --warn: #8a5a00;
  --bad: #b3261e;
  --info: #2f6f8f;
  --grid: rgba(22, 39, 44, 0.05);
  --radius: 8px;
  --shadow: 0 1px 0 rgba(22, 39, 44, 0.04), 0 8px 20px -10px rgba(22, 39, 44, 0.28);
  --head-h: 58px;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Consolas, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body { height: 100%; }
body {
  margin: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font: 400 1rem/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; min-height: 0; position: relative; }
.view { height: 100%; }

h1, h2, h3, p, ul, ol, dl, dd { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; }
em { font-style: italic; }
code { font: 0.86em var(--mono); background: var(--paper-2); padding: 0.1em 0.35em; border-radius: 4px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }

.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 0.5rem; top: -4rem; z-index: 3000;
  background: var(--card); color: var(--ink); padding: 0.5rem 0.8rem; border-radius: 6px;
}
.skip:focus { top: 0.5rem; }

:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 2px; }

.ic {
  width: 1.1em; height: 1.1em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round;
}
.ic-fill { fill: currentColor; stroke: none; }
.mono { font-family: var(--mono); font-size: 0.78rem; color: var(--ink-3); font-variant-numeric: tabular-nums; }

.eyebrow {
  font: 600 0.75rem/1.2 var(--sans);
  letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3);
}

/* ---------- Kopfzeile ---------- */
.top {
  flex: none; height: var(--head-h);
  display: flex; align-items: center; gap: 1.2rem;
  padding: 0 clamp(0.8rem, 2vw, 1.5rem);
  background: var(--ink); color: #f1ece0;
  position: relative; z-index: 1500;
}
.brand { display: flex; align-items: center; gap: 0.65rem; text-decoration: none; color: inherit; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.brand-name { font: 600 1.3rem/1 var(--serif); letter-spacing: 0.01em; white-space: nowrap; }
.brand-name em { color: #ff9c82; font-weight: 500; }

.tabs { display: flex; gap: 0.2rem; height: 100%; margin-left: 0.5rem; }
.tabs a {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0 0.9rem; text-decoration: none; font-weight: 600; font-size: 0.95rem;
  color: #c9c3b3; border-bottom: 3px solid transparent; margin-bottom: -1px;
}
.tabs a:hover { color: #fff; }
.tabs a[aria-current="page"] { color: #fff; border-bottom-color: #ff7f5e; }
.badge {
  min-width: 1.4rem; padding: 0.05rem 0.4rem; border-radius: 99px; text-align: center;
  background: #ff7f5e; color: #2a0f08; font: 700 0.75rem/1.3 var(--mono);
}

.gh-btn {
  margin-left: auto; display: inline-flex; align-items: center; gap: 0.55rem;
  padding: 0.45rem 0.85rem; border-radius: 99px;
  border: 1px solid rgba(241, 236, 224, 0.28); background: rgba(255, 255, 255, 0.05);
  font-weight: 600; font-size: 0.88rem; color: #f1ece0;
}
.gh-btn:hover { background: rgba(255, 255, 255, 0.12); }
.gh-btn .ic { width: 1.15rem; height: 1.15rem; }
.gh-dot { width: 0.55rem; height: 0.55rem; border-radius: 50%; background: #7e8a8d; }
.gh-btn[data-state="ok"] .gh-dot { background: #4cc38a; box-shadow: 0 0 0 3px rgba(76, 195, 138, 0.25); }
.gh-btn[data-state="dirty"] .gh-dot { background: #f0b429; box-shadow: 0 0 0 3px rgba(240, 180, 41, 0.25); }

/* ---------- Buttons & Formularelemente ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  min-height: 40px; padding: 0.5rem 0.95rem; border-radius: 7px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  font-weight: 600; font-size: 0.9rem; text-decoration: none; line-height: 1.2;
  transition: background 0.15s, border-color 0.15s, transform 0.1s;
}
.btn:hover { background: #fff; border-color: var(--ink-3); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--ink); border-color: var(--ink); color: #f5f0e4; }
.btn.primary:hover { background: #24404a; }
.btn.accent { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.accent:hover { background: #ac2f15; border-color: #ac2f15; }
.btn.danger { color: var(--bad); border-color: #e0b2ad; }
.btn.danger:hover { background: #fdf0ee; border-color: var(--bad); }
.btn.danger-fill, .btn.primary.danger-fill { background: var(--bad); border-color: var(--bad); color: #fff; }
.btn.block { width: 100%; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn.busy::before {
  content: ""; width: 1em; height: 1em; border: 2px solid currentColor; border-right-color: transparent;
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn {
  display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 7px;
  border: 0; background: transparent; color: var(--ink-2);
}
.icon-btn:hover { background: var(--paper-2); color: var(--ink); }

.link { border: 0; background: none; padding: 0; color: var(--accent); text-decoration: underline; font-weight: 600; }

.mini {
  display: inline-flex; align-items: center; gap: 0.3rem;
  padding: 0.32rem 0.6rem; min-height: 30px; border-radius: 6px;
  border: 1px solid var(--line-2); background: var(--card); color: var(--ink);
  font: 600 0.78rem/1.2 var(--sans); text-decoration: none; white-space: nowrap;
}
.mini .ic { width: 0.95em; height: 0.95em; }
.mini:hover { background: #fff; border-color: var(--ink-3); }
.mini.on { background: var(--ink); border-color: var(--ink); color: #f5f0e4; }
.mini.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.mini.primary:hover { background: #ac2f15; }
.mini.ghost-ok { border-color: transparent; background: #dcefe5; color: var(--ok); }

input:not([type]), input[type="text"], input[type="search"], input[type="tel"], input[type="email"],
input[type="number"], input[type="date"], input[type="password"], select, textarea {
  width: 100%; min-height: 40px; padding: 0.5rem 0.7rem;
  border: 1px solid var(--line-2); border-radius: 7px; background: #fffdf8;
}
input::placeholder, textarea::placeholder { color: #7c8789; }
textarea { resize: vertical; min-height: 5rem; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 1px; border-color: var(--accent); }
input[aria-invalid="true"] { border-color: var(--bad); }
input[type="checkbox"] { width: 1.05rem; height: 1.05rem; accent-color: var(--accent); flex: none; }

.check { display: flex; align-items: center; gap: 0.55rem; font-size: 0.9rem; cursor: pointer; }
.check.small { font-size: 0.8rem; }

.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.45rem; }
.chip {
  padding: 0.3rem 0.75rem; border-radius: 99px; font-size: 0.84rem; font-weight: 600;
  border: 1px solid var(--line-2); background: transparent; color: var(--ink-2);
}
.chip:hover { background: var(--card); }
.chip[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: #f5f0e4; }

.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; background: var(--card); max-width: 100%; }
.seg button {
  display: inline-flex; align-items: center; gap: 0.35rem;
  border: 0; border-right: 1px solid var(--line); background: transparent;
  padding: 0.38rem 0.7rem; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); min-height: 34px;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: #fff; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #f5f0e4; }
.seg .n { font: 600 0.72rem var(--mono); opacity: 0.8; }

.tag {
  display: inline-block; padding: 0.08rem 0.5rem; border-radius: 4px;
  background: var(--paper-2); color: var(--ink-2); font: 600 0.74rem/1.5 var(--sans);
}
.tag-hot { background: var(--accent-soft); color: #8f2610; }
.tag-ok { background: #dcefe5; color: var(--ok); }

.dot { display: inline-block; width: 0.62rem; height: 0.62rem; border-radius: 50%; margin-right: 0.45rem; flex: none; background: var(--accent-2); }
.dot-neu { background: var(--accent-2); }
.dot-vorgemerkt { background: #e3a31b; box-shadow: 0 0 0 2px var(--ink) inset; }
.dot-kontaktiert { background: var(--info); }
.dot-verworfen { background: #a3a39b; }
.dot-auftrag { background: #2f7d5b; }
.dot-website { background: #d9d4c4; box-shadow: 0 0 0 1.5px #7b8588 inset; }

/* ==========================================================
   KARTE
   ========================================================== */
.view-map { display: grid; grid-template-columns: clamp(350px, 32vw, 440px) 1fr; }

.panel {
  display: flex; flex-direction: column; min-height: 0; min-width: 0;
  background: var(--paper); border-right: 1px solid var(--line-2);
}
.panel-top {
  flex: none; padding: 1.1rem 1.2rem 1rem;
  border-bottom: 1px solid var(--line-2);
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 28px 28px;
  display: flex; flex-direction: column; gap: 0.8rem;
}
.panel-title { font: 600 1.7rem/1.1 var(--serif); margin-top: -0.35rem; }
.panel-title em { color: var(--accent); font-weight: 500; }
.geo { display: flex; gap: 0.5rem; }
.geo input { flex: 1; min-width: 0; }
.status-row { display: flex; align-items: flex-start; gap: 0.6rem; margin-top: -0.2rem; }
.status-row .mini { flex: none; margin-top: -0.2rem; }
.status { flex: 1; min-height: 1.3em; font-size: 0.84rem; color: var(--ink-2); }
.status-ok { color: var(--ok); font-weight: 600; }
.status-warn { color: var(--warn); }
.status-bad { color: var(--bad); font-weight: 600; }
.hint { font-size: 0.78rem; line-height: 1.4; color: var(--ink-3); }
.hint summary { cursor: pointer; font-weight: 600; width: fit-content; }
.hint p { margin-top: 0.4rem; }
.gbox { border-top: 1px dashed var(--line-2); padding-top: 0.6rem; }
.gbox summary .tag { margin-left: 0.3rem; }
.gbox .f { margin-top: 0.6rem; }
.gbox .check { margin: 0.5rem 0; }
.gbox a { color: var(--accent); }

.panel-list { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.list-head {
  flex: none; display: flex; flex-direction: column; align-items: stretch; gap: 0.4rem;
  padding: 0.7rem 1.2rem 0.6rem; border-bottom: 1px solid var(--line);
}
.list-head .seg { display: flex; width: 100%; }
.list-head .seg button { flex: 1; justify-content: center; padding: 0.38rem 0.2rem; }
.leads { flex: 1; min-height: 0; overflow-y: auto; padding: 0.8rem 1.2rem 1.5rem; }

.lead {
  background: var(--card); border: 1px solid var(--line); border-left: 4px solid var(--accent-2);
  border-radius: var(--radius); padding: 0.7rem 0.8rem; margin-bottom: 0.6rem;
}
.lead[data-state="vorgemerkt"] { border-left-color: #e3a31b; }
.lead[data-state="kontaktiert"] { border-left-color: var(--info); }
.lead[data-state="verworfen"] { border-left-color: #a3a39b; opacity: 0.8; }
.lead.sel { background: #fff; border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink) inset, var(--shadow); }
.lead-main { cursor: pointer; border-radius: 4px; }
.lead-title { display: flex; align-items: center; gap: 0; }
.lead-title strong { font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.lead-sub { font-size: 0.82rem; color: var(--ink-2); margin-top: 0.15rem; }
.lead-addr { font-size: 0.82rem; color: var(--ink-3); margin-top: 0.1rem; }
.lead-contact { display: flex; flex-wrap: wrap; gap: 0.2rem 0.8rem; margin-top: 0.4rem; font-size: 0.82rem; }
.lead-contact:empty { display: none; }
.lead-contact a { display: inline-flex; align-items: center; gap: 0.3rem; color: var(--ink-2); text-decoration: none; overflow-wrap: anywhere; }
.lead-contact a:hover { color: var(--accent); text-decoration: underline; }
.lead-site { display: flex; align-items: center; flex-wrap: wrap; gap: 0.25rem; margin-top: 0.4rem; padding: 0.3rem 0.5rem; border-radius: 6px; background: var(--paper-2); font-size: 0.8rem; color: var(--ink-2); }
.lead-site a { color: var(--accent); font-weight: 600; overflow-wrap: anywhere; }
.lead-site .how { color: var(--ink-3); }
.lead-site.ok { background: #e3f0e9; color: var(--ok); }
.lead-site.gold { background: #fdf0c9; color: #6b4a00; }
.lead[data-state="website"] { border-left-color: #c9c3ae; background: #f6f3ea; }
.lead[data-state="website"] .lead-title strong { color: var(--ink-2); }
.lead-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.6rem; }
.list-empty { color: var(--ink-3); font-size: 0.9rem; padding: 1rem 0.2rem; }
.list-more { text-align: center; padding: 0.4rem 0 1rem; }

.map-wrap { position: relative; min-width: 0; min-height: 0; background: #dfe6e0; }
#map { position: absolute; inset: 0; z-index: 0; isolation: isolate; font: inherit; background: #e4e9e2; }
.leaflet-tile-pane { filter: saturate(0.7) sepia(0.2) contrast(0.97) brightness(1.02); }
.leaflet-container.adding { cursor: crosshair; }
.leaflet-container a { color: var(--accent); }
.leaflet-control-attribution { font-size: 0.7rem; }
.leaflet-bar a { color: var(--ink); }

.map-empty {
  position: absolute; z-index: 500; left: 50%; top: 1rem; transform: translateX(-50%);
  width: min(420px, calc(100% - 2rem)); padding: 0.9rem 1.1rem;
  background: var(--card); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow);
  font-size: 0.9rem; color: var(--ink-2); pointer-events: none;
}
.map-empty .eyebrow { color: var(--accent); margin-bottom: 0.35rem; }

.legend {
  position: absolute; z-index: 600; left: 0.8rem; bottom: 1.8rem;
  background: rgba(251, 249, 243, 0.95); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 0.55rem 0.8rem 0.6rem; font-size: 0.8rem; box-shadow: var(--shadow);
}
.legend-title { font: 600 0.72rem/1 var(--sans); letter-spacing: 0.14em; text-transform: uppercase; color: var(--ink-3); margin-bottom: 0.4rem; }
.legend li { display: flex; align-items: center; gap: 0.5rem; line-height: 1.6; }
.legend small { color: var(--ink-3); font-size: 0.72rem; }
.sw { width: 0.8rem; height: 0.8rem; border-radius: 50%; border: 1.5px solid #fff; box-shadow: 0 0 0 1px rgba(22, 39, 44, 0.3); }
.sw-neu { background: #d9482b; }
.sw-vorgemerkt { background: #e3a31b; box-shadow: 0 0 0 1.5px var(--ink); }
.sw-kontaktiert { background: #2f6f8f; }
.sw-verified { background: #d9482b; border-color: #2f7d5b; border-width: 2.5px; }
.sw-order { background: #2f7d5b; border-radius: 3px; transform: rotate(45deg) scale(0.85); }
.legend .check { margin-top: 0.35rem; padding-top: 0.4rem; border-top: 1px solid var(--line); }

.map-btn { position: absolute; z-index: 600; top: 0.8rem; right: 0.8rem; box-shadow: var(--shadow); }
.map-btn.active { background: var(--accent); border-color: var(--accent); color: #fff; }

.omark-wrap { background: none; border: 0; }
.omark {
  display: block; width: 17px; height: 17px; margin: 3.5px; background: var(--c);
  border: 2px solid #fff; border-radius: 4px; transform: rotate(45deg);
  box-shadow: 0 0 0 1px rgba(22, 39, 44, 0.4), 0 2px 5px rgba(0, 0, 0, 0.35);
}

.wf-popup .leaflet-popup-content-wrapper { background: var(--card); color: var(--ink); border-radius: 11px; box-shadow: 0 14px 34px -10px rgba(22, 39, 44, 0.55); }
.wf-popup .leaflet-popup-tip { background: var(--card); }
.wf-popup .leaflet-popup-content { margin: 0.85rem 1rem 0.8rem; font: 400 0.9rem/1.4 var(--sans); }
.wf-popup a.leaflet-popup-close-button { color: var(--ink-3); top: 4px; right: 4px; }
.pop-kicker { display: flex; align-items: center; font-size: 0.75rem; color: var(--ink-3); font-weight: 600; letter-spacing: 0.02em; }
.pop-title { font: 600 1.1rem/1.2 var(--serif); margin: 0.25rem 0 0.2rem; overflow-wrap: anywhere; }
.pop-line { color: var(--ink-2); font-size: 0.85rem; }
.pop .lead-contact { margin-top: 0.3rem; }
.pop-actions { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.65rem; }
.pop-foot { margin-top: 0.6rem; font-size: 0.75rem; color: var(--ink-3); }
.pop-foot a { color: var(--ink-3); }

/* ==========================================================
   AUFTRÄGE
   ========================================================== */
.view-orders {
  overflow: auto;
  padding: 1.5rem clamp(1rem, 3vw, 2.4rem) 2.5rem;
  background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 36px 36px;
}
.orders-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.page-title { font: 600 clamp(1.9rem, 4vw, 2.6rem)/1.05 var(--serif); margin-top: 0.4rem; }
.page-title em { color: var(--accent); font-weight: 500; }
.orders-actions { display: flex; gap: 0.6rem; flex-wrap: wrap; }
#publishQuick[data-state="dirty"] { border-color: #d8a21f; background: #fdf3d6; }
#publishQuick[data-state="ok"] { border-color: #8cc9a8; background: #e7f5ed; }

.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 0.8rem; margin-bottom: 1.3rem; }
.kpi {
  position: relative; background: var(--card); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.8rem 1rem 0.85rem 1.2rem; overflow: hidden;
}
.kpi::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 5px; background: var(--k, var(--line-2)); }
.kpi-stone { --k: #8c8470; } .kpi-blue { --k: #2f6f8f; } .kpi-ochre { --k: #c58b1b; } .kpi-green { --k: #2f7d5b; }
.kpi dt { font: 600 0.75rem/1.2 var(--sans); letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-3); }
.kpi dd { font: 600 1.7rem/1.2 var(--serif); font-variant-numeric: tabular-nums; margin-top: 0.3rem; }
.kpi small { color: var(--ink-3); font-size: 0.8rem; }

.orders-tools { display: flex; align-items: center; flex-wrap: wrap; gap: 0.8rem 1.2rem; margin-bottom: 1rem; }
.search { position: relative; flex: 1 1 260px; max-width: 420px; display: block; }
.search .ic { position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search input { padding-left: 2.3rem; }
.orders-tools .seg { margin-left: auto; }

.board { display: flex; gap: 0.9rem; align-items: flex-start; overflow-x: auto; padding: 0.2rem 0.1rem 1rem; scroll-snap-type: x proximity; }
.col {
  flex: 0 0 276px; scroll-snap-align: start;
  background: rgba(233, 227, 211, 0.6); border: 1px solid var(--line); border-radius: 11px; padding: 0.55rem 0.55rem 0.6rem;
  transition: background 0.15s, outline-color 0.15s; outline: 2px dashed transparent; outline-offset: -2px;
}
.col.over { outline-color: var(--accent); background: #f4ddd4; }
.col-head { display: flex; align-items: center; gap: 0.5rem; padding: 0.25rem 0.3rem 0.55rem; border-bottom: 2px solid var(--c); }
.col-head h2 { font: 650 0.92rem/1.2 var(--sans); display: flex; align-items: center; flex: 1; }
.col-count { font: 700 0.75rem var(--mono); background: var(--ink); color: #f5f0e4; border-radius: 99px; padding: 0.05rem 0.5rem; }
.col-sum { font: 600 0.8rem var(--sans); font-variant-numeric: tabular-nums; color: var(--ink-3); }
.col-body { min-height: 3.2rem; padding-top: 0.15rem; }
.col-empty { text-align: center; color: var(--ink-3); font-size: 0.82rem; padding: 1rem 0 0.6rem; border: 1px dashed var(--line-2); border-radius: 8px; margin-top: 0.55rem; }
.col-add {
  display: flex; align-items: center; justify-content: center; gap: 0.35rem; width: 100%; margin-top: 0.55rem;
  min-height: 36px; border: 1px dashed var(--line-2); border-radius: 8px; background: transparent;
  color: var(--ink-2); font-size: 0.84rem; font-weight: 600;
}
.col-add:hover { background: var(--card); border-style: solid; }

.card {
  background: var(--card); border: 1px solid var(--line); border-radius: 9px;
  padding: 0.65rem 0.75rem 0.7rem; margin-top: 0.55rem; cursor: grab;
  box-shadow: 0 1px 0 rgba(22, 39, 44, 0.05);
  transition: box-shadow 0.15s, transform 0.15s, border-color 0.15s;
}
.card:hover { border-color: var(--ink-3); box-shadow: var(--shadow); transform: translateY(-1px); }
.card.dragging { opacity: 0.35; }
.card.cancelled { opacity: 0.7; }
.card-top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.6rem; }
.card h3 { font: 650 0.98rem/1.25 var(--sans); overflow-wrap: anywhere; }
.price { font: 600 0.92rem var(--serif); font-variant-numeric: tabular-nums; white-space: nowrap; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.5rem; margin-top: 0.4rem; }
.due { font-size: 0.78rem; color: var(--ink-3); font-weight: 600; }
.due.soon { color: var(--warn); }
.due.overdue { color: var(--bad); }
.card-loc { display: flex; align-items: center; gap: 0.3rem; margin-top: 0.4rem; font-size: 0.8rem; color: var(--ink-3); }
.card-actions { margin-top: 0.6rem; }

.table-wrap { position: relative; overflow-x: auto; background: var(--card); border: 1px solid var(--line); border-radius: 10px; }
.otable { width: 100%; border-collapse: collapse; min-width: 720px; font-size: 0.9rem; }
.otable th, .otable td { padding: 0.65rem 0.9rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.otable thead th { font: 600 0.74rem var(--sans); letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); background: var(--paper-2); }
.otable tbody tr { cursor: pointer; }
.otable tbody tr:hover { background: #fff; }
.otable tbody tr:last-child th, .otable tbody tr:last-child td { border-bottom: 0; }
.otable tbody th { font-weight: 400; }
.otable small { display: block; color: var(--ink-3); font-size: 0.78rem; }
.otable .r { text-align: right; font-variant-numeric: tabular-nums; }
.o-status { width: auto; min-height: 34px; padding: 0.2rem 0.5rem; border-left: 5px solid var(--c); font-weight: 600; font-size: 0.85rem; }

.empty {
  max-width: 560px; margin: 2rem auto; padding: 2rem; text-align: center;
  background: var(--card); border: 1.5px dashed var(--line-2); border-radius: 14px;
}
.empty .eyebrow { color: var(--accent); }
.empty h2 { font: 600 1.7rem/1.15 var(--serif); margin: 0.5rem 0 0.7rem; }
.empty p { color: var(--ink-2); }
.empty-actions { display: flex; justify-content: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 1.3rem; }

/* ==========================================================
   DIALOGE
   ========================================================== */
dialog {
  width: min(660px, calc(100vw - 1.5rem)); max-height: calc(100dvh - 1.5rem);
  padding: 0; border: 1px solid var(--line-2); border-radius: 14px;
  background: var(--card); color: var(--ink); box-shadow: 0 34px 90px -24px rgba(22, 39, 44, 0.6);
}
dialog.small { width: min(440px, calc(100vw - 1.5rem)); }
dialog::backdrop { background: rgba(22, 39, 44, 0.55); backdrop-filter: blur(2px); }
dialog form { display: flex; flex-direction: column; max-height: calc(100dvh - 1.5rem); }
.dlg-head { flex: none; display: flex; align-items: center; justify-content: space-between; padding: 0.9rem 0.9rem 0.8rem 1.4rem; border-bottom: 1px solid var(--line); }
.dlg-head h2 { font: 600 1.4rem/1.2 var(--serif); }
.dlg-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1.1rem 1.4rem 1.2rem; }
.dlg-body h2 { font: 600 1.35rem/1.2 var(--serif); margin-bottom: 0.5rem; }
.dlg-foot { flex: none; display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; padding: 0.8rem 1.4rem; border-top: 1px solid var(--line); background: var(--paper); border-radius: 0 0 14px 14px; }
.grow { flex: 1; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0.9rem; }
.span2 { grid-column: 1 / -1; }
.f { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.82rem; font-weight: 600; color: var(--ink-2); min-width: 0; }
.f input:not([type="checkbox"]), .f select, .f textarea { font-weight: 400; font-size: 0.95rem; color: var(--ink); }
.f small { font-weight: 400; color: var(--ink-3); font-size: 0.78rem; line-height: 1.4; }
.f small a { color: var(--accent); }
.f.check { flex-direction: row; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.55rem; font-weight: 500; font-size: 0.9rem; color: var(--ink); }
.req { color: var(--accent); }
.err { color: var(--bad); font-weight: 600; }
.loc-note { display: flex; align-items: center; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.9rem; font-size: 0.85rem; color: var(--ink-2); }
.history { margin-top: 0.5rem; display: grid; gap: 0.25rem; font-size: 0.85rem; color: var(--ink-2); }
.history li { display: flex; align-items: center; }
.history time { margin-left: auto; font: 0.78rem var(--mono); color: var(--ink-3); padding-left: 1rem; }
#orderHistoryWrap { margin-top: 1.1rem; }

.lead-text { color: var(--ink-2); font-size: 0.92rem; margin-bottom: 0.9rem; }
.notice { display: flex; gap: 0.7rem; align-items: flex-start; background: #fbefd5; border: 1px solid #ecd49b; color: #5b4308; border-radius: 9px; padding: 0.7rem 0.85rem; font-size: 0.86rem; margin-bottom: 1rem; }
.notice .ic { margin-top: 0.15rem; }
.gh-log { margin-top: 1rem; display: grid; gap: 0.25rem; font-size: 0.88rem; }
.gh-log:empty { display: none; }
.gh-log a { color: var(--accent); font-weight: 600; }
.log-ok { color: var(--ok); }
.log-warn { color: var(--warn); }
.log-bad { color: var(--bad); font-weight: 600; }
.backup { margin-top: 1.1rem; font-size: 0.88rem; }
.backup summary { cursor: pointer; font-weight: 600; color: var(--ink-2); }
.backup-row { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.7rem; }

/* ---------- Toasts ---------- */
.toasts { position: fixed; z-index: 4000; left: 50%; bottom: 1.2rem; transform: translateX(-50%); display: grid; gap: 0.5rem; width: min(440px, calc(100vw - 1.5rem)); pointer-events: none; }
.toast {
  background: var(--ink); color: #f5f0e4; padding: 0.65rem 1rem; border-radius: 9px; font-size: 0.9rem;
  border-left: 4px solid #8a9a9d; box-shadow: 0 12px 30px -10px rgba(0, 0, 0, 0.5);
  animation: toast-in 0.22s ease-out both;
}
.toast-ok { border-left-color: #4cc38a; }
.toast-bad { border-left-color: #ff7f5e; }
.toast.out { opacity: 0; transform: translateY(6px); transition: opacity 0.25s, transform 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ==========================================================
   RESPONSIVE
   ========================================================== */
@media (max-height: 720px) and (min-width: 861px) {
  .panel { overflow-y: auto; }
  .panel-list { display: block; flex: none; }
  .leads { overflow: visible; }
  .list-head { position: sticky; top: 0; background: var(--paper); z-index: 2; }
}

@media (max-width: 860px) {
  .view-map { display: flex; flex-direction: column; overflow-y: auto; }
  .map-wrap { order: -1; flex: none; height: 50dvh; position: sticky; top: 0; z-index: 20; border-bottom: 1px solid var(--line-2); }
  .panel { overflow: visible; border-right: 0; flex: none; }
  .panel-list { display: block; }
  .leads { overflow: visible; }
  .legend { bottom: 1.6rem; }
}

@media (max-width: 620px) {
  .kpis { grid-template-columns: repeat(2, 1fr); gap: 0.6rem; }
  .kpi { padding: 0.65rem 0.7rem 0.7rem 1rem; }
  .kpi dt { font-size: 0.68rem; letter-spacing: 0.08em; }
  .kpi dd { font-size: 1.3rem; }
  .orders-actions .btn { flex: 1 1 auto; }
  .top { gap: 0.6rem; }
  .brand-name { display: none; }
  .tabs { margin-left: 0; }
  .tabs a { padding: 0 0.65rem; }
  .gh-label { display: none; }
  .gh-btn { padding: 0.5rem 0.65rem; }
  .grid { grid-template-columns: 1fr; }
  .orders-tools .seg { margin-left: 0; }
  .col { flex-basis: 84vw; }
  .legend { display: none; }
  .dlg-foot .btn { flex: 1 1 auto; }
  .dlg-foot .grow { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
  .btn.busy::before { animation-duration: 1.2s !important; animation-iteration-count: infinite !important; }
}
