/* Заряди станцію — one quiet system, one loud colour (volt) for the main action. */
:root {
  --ink: #1b2430;
  --ink-2: #4a5563;
  --paper: #f6f7f4;
  --surface: #ffffff;
  --line: #d5d9de;
  --line-strong: #aeb5bd;
  --volt: #f2c200;
  --volt-deep: #d9ad00;
  --on: #1f8a4c;
  --on-bg: #e3f3e9;
  --err: #b42318;
  --err-bg: #fdecea;
  --r-s: 6px;
  --r-m: 10px;
  --font-body: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-display: "Unbounded", "IBM Plex Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font: 16px/1.5 var(--font-body);
  color: var(--ink);
  background: var(--paper);
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
main { flex: 1; min-height: 0; }
a { color: var(--ink); text-underline-offset: 3px; }
h1, h2 { font-family: var(--font-display); letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 700; margin: 0 0 8px; }
h2 { font-size: 1.05rem; font-weight: 500; margin: 0 0 16px; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; box-shadow: 0 0 0 5px var(--volt); }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* Top bar */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 20px; background: var(--ink); color: #fff; }
.topbar a { color: #fff; text-decoration: none; }
.topbar nav { display: flex; gap: 20px; align-items: center; font-size: 0.95rem; }
.brand { font-family: var(--font-display); font-weight: 700; font-size: 1.05rem; letter-spacing: -0.01em; }
.brand-bolt { color: var(--volt); }
.inline { display: inline; margin: 0; }

/* Buttons */
button, .button, .btn {
  font: inherit; font-weight: 500;
  min-height: 44px; padding: 10px 16px;
  border-radius: var(--r-s); border: 1px solid var(--line-strong);
  background: var(--surface); color: var(--ink);
  cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
button:hover, .button:hover, .btn:hover { border-color: var(--ink); }
button.primary, .button.primary, .btn-primary {
  background: var(--volt); border-color: var(--volt-deep); color: var(--ink); font-weight: 600;
}
button.primary:hover, .button.primary:hover, .btn-primary:hover { background: var(--volt-deep); border-color: var(--volt-deep); }
.btn-ghost { background: transparent; border-style: dashed; }
button.link { background: none; border: none; padding: 0; min-height: 0; color: inherit; text-decoration: underline; }
.topbar button.link { color: #fff; }
.icon-btn {
  min-height: 44px; width: 44px; padding: 0;
  font-size: 1.4rem; line-height: 1; color: var(--ink-2);
  border-color: transparent; background: transparent;
}
.icon-btn:hover { color: var(--err); border-color: var(--line); }

/* Generic page blocks */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 24px; margin: 24px auto; max-width: 760px; }
.narrow { max-width: 480px; }
.muted, .hint { color: var(--ink-2); font-size: 0.9rem; }
.hint { margin: 8px 0; }
.hint:empty { display: none; }
.error { color: var(--err); font-size: 0.9rem; margin: 6px 0 0; }
.alert { background: var(--err-bg); color: var(--err); border-left: 3px solid var(--err); padding: 12px 16px; border-radius: var(--r-s); margin: 0 0 24px; }
.badge { display: inline-block; padding: 4px 12px; border-radius: 999px; font-weight: 600; font-size: 0.9rem; }
.badge.ok { background: var(--on-bg); color: var(--on); }
.badge.off { background: #eceef0; color: var(--ink-2); }

/* Form controls */
input:not([type=checkbox]):not([type=hidden]), select, textarea {
  font: inherit; font-size: 16px; color: var(--ink);
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-s);
}
input:not([type=checkbox]):hover, select:hover, textarea:hover { border-color: var(--ink-2); }
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
textarea { resize: vertical; min-height: 88px; }
input[type=checkbox] { width: 20px; height: 20px; margin: 0; accent-color: var(--ink); }

/* Owner form */
.spot-form { max-width: 720px; margin: 0 auto; padding: 32px 20px 64px; }
.form-head { margin-bottom: 24px; }
.lede { color: var(--ink-2); margin: 0; max-width: 60ch; }
.step { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); padding: 24px; margin-bottom: 16px; }
.step h2 { display: flex; align-items: center; gap: 12px; }
.step-num {
  flex: none; width: 28px; height: 28px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--ink); color: #fff; font-size: 0.85rem; font-weight: 700;
}
.field { margin-bottom: 18px; }
.field:last-child { margin-bottom: 0; }
.field > label { display: block; font-weight: 600; margin-bottom: 6px; }
.optional { font-weight: 400; color: var(--ink-2); font-size: 0.85rem; margin-left: 4px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.grid-2 .field { margin-bottom: 0; }
.locate-row { display: flex; flex-wrap: wrap; gap: 8px; }
.pick-map { height: 300px; margin: 12px 0 0; border-radius: var(--r-m); border: 1px solid var(--line); }
.price-row { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.with-suffix { position: relative; flex: 0 1 220px; }
.with-suffix input { padding-right: 64px; }
.with-suffix .suffix { position: absolute; right: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-2); pointer-events: none; }
.with-suffix input:disabled { background: #eceef0; color: var(--ink-2); }
.check { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; font-weight: 500; }

/* Schedule rows */
.slots { display: grid; gap: 8px; margin: 12px 0; }
.slots:empty { display: block; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: var(--r-s); color: var(--ink-2); }
.slots:empty::before { content: "Проміжків ще немає — додайте хоча б один або вмикайте точку вручну."; }
.slot-row { display: grid; grid-template-columns: minmax(130px, 1fr) minmax(0, 2fr) 44px; gap: 8px; align-items: center; }
.slot-times { display: grid; grid-template-columns: 1fr auto 1fr; gap: 8px; align-items: center; }
.slot-times span { color: var(--ink-2); }

.form-actions { display: flex; justify-content: flex-start; margin-top: 24px; }
.form-actions .btn-primary { min-width: 200px; font-size: 1.05rem; }

/* Map page */
.map-page { display: grid; grid-template-columns: 280px 1fr; height: 100%; position: relative; }
.filters { padding: 20px; display: flex; flex-direction: column; gap: 14px; background: var(--surface); border-right: 1px solid var(--line); }
.filters label { display: flex; align-items: center; gap: 10px; }
#map { height: 100%; min-height: 400px; }
.panel { position: absolute; top: 16px; right: 16px; width: 340px; max-height: calc(100% - 32px); overflow: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-m); box-shadow: 0 12px 32px rgba(27, 36, 48, 0.18); padding: 20px; z-index: 1000; }
.panel h2 { margin: 0 40px 10px 0; font-size: 1.05rem; }
.panel dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 16px 0; }
.panel dt { color: var(--ink-2); }
.panel dd { margin: 0; }
.panel .close { position: absolute; top: 8px; right: 8px; border: none; font-size: 1.5rem; background: none; width: 44px; padding: 0; }
.note { white-space: pre-wrap; background: var(--paper); padding: 10px 12px; border-radius: var(--r-s); }

/* "You are here" + nearest list */
.nearby h2 { font-size: 0.95rem; margin: 0 0 8px; }
.nearby ol { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.nearby-item { width: 100%; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; }
.nearby-item strong { font-weight: 600; }
.nearby-item .muted { font-size: 0.85rem; }

/* First-visit question */
.intent { position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center; padding: 16px; background: rgba(27, 36, 48, 0.55); }
.intent[hidden] { display: none; }
.intent-card { width: min(520px, 100%); background: var(--surface); border-radius: var(--r-m); padding: 28px 24px; display: grid; gap: 12px; box-shadow: 0 24px 60px rgba(27, 36, 48, 0.35); }
.intent-card h1 { font-size: 1.4rem; margin: 0 0 4px; }
.intent-btn { justify-content: flex-start; gap: 16px; padding: 16px; text-align: left; min-height: 76px; border-radius: var(--r-m); }
.intent-btn strong { display: block; font-size: 1.05rem; }
.intent-btn small { display: block; color: var(--ink-2); font-weight: 400; margin-top: 2px; }
.intent-icon { font-size: 1.6rem; flex: none; width: 40px; text-align: center; }
.intent-need { background: var(--volt); border-color: var(--volt-deep); }
.intent-need small { color: var(--ink); }
.intent-need:hover { background: var(--volt-deep); }

/* Dashboard & admin */
.status-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin: 16px 0; }
table { border-collapse: collapse; width: 100%; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); }
th { color: var(--ink-2); font-weight: 500; font-size: 0.9rem; }

/* Phones */
@media (max-width: 640px) {
  .topbar { padding: 10px 16px; }
  .brand { font-size: 0.95rem; }
  .brand, .topbar nav a, .topbar nav button { white-space: nowrap; }
  .topbar nav { gap: 14px; font-size: 0.85rem; }
  .spot-form { padding: 20px 16px 48px; }
  .step { padding: 18px 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .pick-map { height: 240px; }
  .slots { gap: 0; }
  .slot-row { grid-template-columns: 1fr 44px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .slot-row:first-child { padding-top: 0; }
  .slot-row .slot-times { grid-column: 1 / 2; }
  .slot-row .icon-btn { grid-row: 1 / 3; grid-column: 2; }
  .form-actions .btn-primary { width: 100%; }
  .map-page { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .filters { border-right: none; border-bottom: 1px solid var(--line); flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 12px; gap: 6px 14px; font-size: 0.9rem; }
  .filters .legend, .filters #updated { display: none; }
  .filters #locate { min-height: 36px; padding: 6px 12px; }
  .nearby { flex: 1 0 100%; }
  .nearby h2 { margin-bottom: 6px; }
  .nearby ol { grid-auto-flow: column; grid-auto-columns: 78%; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; }
  .nearby li { scroll-snap-align: start; }
  .nearby-item { height: 100%; padding: 8px 10px; }
  .panel { left: 12px; right: 12px; width: auto; top: auto; bottom: 12px; max-height: 60%; }
}
