:root {
  --c-primary: #123a6b;
  --c-primary-2: #1d5aa6;
  --c-accent: #f2a900;
  --c-origin: #1b8a4b;
  --c-dest: #c0392b;
  --c-bg: #f4f6f9;
  --c-surface: #ffffff;
  --c-text: #17202b;
  --c-muted: #5b6878;
  --c-border: #d6dde6;
  --c-ok: #1b8a4b;
  --c-warn: #9a6400;
  --c-err: #b42318;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 24, 40, .12), 0 1px 2px rgba(16, 24, 40, .06);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--c-text);
  background: var(--c-bg);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { min-height: 100vh; background: var(--c-bg); }
a { color: var(--c-primary-2); }
[hidden] { display: none !important; }

/* --- antet ------------------------------------------------------------ */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; background: var(--c-primary); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  flex: none; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 10px;
  background: var(--c-accent); color: var(--c-primary); font-weight: 800; font-size: 13px; letter-spacing: -.5px;
}
.brand h1 { margin: 0; font-size: 18px; line-height: 1.2; }
.brand p { margin: 2px 0 0; font-size: 12px; opacity: .85; }
.brand p.orgs { opacity: 1; font-size: 12.5px; }
.brand p.orgs strong { color: var(--c-accent); font-weight: 700; }
.link-btn {
  background: transparent; border: 1px solid rgba(255,255,255,.5); color: #fff; border-radius: 999px;
  padding: 6px 12px; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.badge { background: var(--c-accent); color: var(--c-primary); border-radius: 999px; padding: 0 6px; font-weight: 700; margin-left: 4px; }

.notice { background: #fff4d6; color: #5a4000; padding: 8px 16px; font-size: 14px; border-bottom: 1px solid #f0d78c; }
.notice.error { background: #fde8e7; color: #7a1a12; border-color: #f3b8b3; }

/* --- progres ----------------------------------------------------------- */
.progress { background: var(--c-surface); border-bottom: 1px solid var(--c-border); padding: 8px 16px 6px; }
.progress ol { display: flex; gap: 8px; list-style: none; margin: 0; padding: 0; font-size: 13px; color: var(--c-muted); }
.progress li { flex: 1; display: flex; align-items: center; gap: 6px; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.progress li span {
  flex: none; display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: var(--c-border); color: var(--c-text); font-weight: 700; font-size: 12px;
}
.progress li.active { color: var(--c-primary); font-weight: 600; }
.progress li.active span, .progress li.done span { background: var(--c-primary); color: #fff; }
.progress-bar { height: 4px; background: var(--c-border); border-radius: 4px; margin-top: 6px; overflow: hidden; }
.progress-bar div { height: 100%; width: 33.3%; background: var(--c-primary-2); transition: width .25s; }
.progress-label { margin: 4px 0 0; font-size: 12px; color: var(--c-muted); }
@media (max-width: 520px) { .progress li { font-size: 0; flex: none; } .progress li span { font-size: 12px; } .progress ol { justify-content: center; gap: 18px; } }

/* --- layout ---------------------------------------------------------------- */
.layout { display: flex; flex-direction: column; }
.map-wrap { position: relative; height: 42vh; min-height: 260px; }
#map { position: absolute; inset: 0; background: #dfe6ee; }
.panel { background: var(--c-surface); padding: 16px; }
@media (min-width: 900px) {
  body { display: flex; flex-direction: column; height: 100vh; }
  .layout { flex-direction: row; flex: 1; min-height: 0; }
  .map-wrap { flex: 1; height: auto; }
  .panel { width: 440px; flex: none; overflow-y: auto; border-left: 1px solid var(--c-border); }
}

.map-tools {
  position: absolute; z-index: 500; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px;
}
.map-tools button {
  background: #fff; border: 1px solid var(--c-border); border-radius: 8px; padding: 6px 10px; font-size: 13px;
  box-shadow: var(--shadow); cursor: pointer; text-align: left;
}
.map-tools button[aria-pressed="true"] { background: var(--c-primary); color: #fff; border-color: var(--c-primary); }
.map-hint {
  position: absolute; z-index: 500; left: 50%; transform: translateX(-50%); bottom: 14px; max-width: calc(100% - 24px);
  background: rgba(18, 58, 107, .92); color: #fff; padding: 6px 12px; border-radius: 999px; font-size: 13px; text-align: center;
  pointer-events: none;
}
.map-hint:empty { display: none; }
.map-hint.origin { background: rgba(27, 138, 75, .95); }
.map-hint.destination { background: rgba(192, 57, 43, .95); }

.od-marker {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg);
  color: #fff; font-weight: 800; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.4);
}
.od-marker span { transform: rotate(45deg); font-size: 13px; }
.od-marker.o { background: var(--c-origin); }
.od-marker.d { background: var(--c-dest); }
.zone-label { background: transparent; border: none; box-shadow: none; color: var(--c-primary); font-weight: 600; font-size: 11px; text-shadow: 0 0 3px #fff, 0 0 3px #fff; }

/* --- formulare ------------------------------------------------------------- */
h2 { font-size: 19px; margin: 0 0 6px; }
.help, .hint { color: var(--c-muted); font-size: 14px; margin: 0 0 12px; }
.hint:empty { display: none; }
.opt { color: var(--c-muted); font-weight: 400; }
.step { display: block; }
.field { margin: 0 0 14px; border: 0; padding: 0; min-width: 0; }
.field > label, .field > legend, .endpoint > label { display: block; font-weight: 600; margin-bottom: 6px; font-size: 15px; padding: 0; }
input[type="search"], input[type="text"], input[type="date"], input[type="time"], input[type="password"], select, textarea {
  width: 100%; font: inherit; font-size: 16px; padding: 10px 12px; border: 1px solid var(--c-border); border-radius: 8px;
  background: #fff; color: var(--c-text);
}
input:focus-visible, button:focus-visible, select:focus-visible { outline: 3px solid rgba(29, 90, 166, .35); outline-offset: 1px; }
.inline { display: flex; gap: 6px; align-items: center; }
.inline input { flex: 1; min-width: 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

button { font: inherit; cursor: pointer; border-radius: 8px; border: 1px solid var(--c-border); background: #fff; color: var(--c-text); padding: 10px 14px; }
button:disabled { cursor: not-allowed; opacity: .5; }
button.primary {
  width: 100%; background: var(--c-primary); border-color: var(--c-primary); color: #fff; font-weight: 700; letter-spacing: .3px; padding: 14px;
}
button.primary:not(:disabled):hover { background: var(--c-primary-2); }
button.ghost { background: transparent; }
button.small { padding: 6px 10px; font-size: 13px; }
button.danger { background: var(--c-err); color: #fff; border-color: var(--c-err); }

.endpoint { border: 1px solid var(--c-border); border-radius: var(--radius); padding: 12px; margin-bottom: 12px; transition: border-color .15s, box-shadow .15s; }
.endpoint.active { border-color: var(--c-primary-2); box-shadow: 0 0 0 3px rgba(29, 90, 166, .12); }
.endpoint.ok { border-color: var(--c-ok); }
.pin { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; color: #fff; font-size: 12px; font-weight: 800; margin-right: 4px; }
.pin-o { background: var(--c-origin); }
.pin-d { background: var(--c-dest); }
.search { position: relative; }
.results {
  position: absolute; z-index: 1000; left: 0; right: 0; top: calc(100% + 4px); margin: 0; padding: 4px 0; list-style: none;
  background: #fff; border: 1px solid var(--c-border); border-radius: 8px; box-shadow: 0 8px 24px rgba(16, 24, 40, .16);
  max-height: 320px; overflow-y: auto;
}
.results li { padding: 8px 12px; cursor: pointer; display: flex; gap: 10px; align-items: baseline; }
.results li[aria-selected="true"], .results li:hover { background: #eef3fa; }
.results li .k { flex: none; width: 20px; text-align: center; }
.results li .t { font-weight: 600; }
.results li .s { display: block; font-size: 12px; color: var(--c-muted); font-weight: 400; }
.results li.sep { font-size: 11px; text-transform: uppercase; letter-spacing: .5px; color: var(--c-muted); cursor: default; padding: 8px 12px 2px; }
.results li.sep:hover { background: transparent; }
.results li.empty { color: var(--c-muted); cursor: default; }
.ep-status { font-size: 14px; margin: 8px 0 0; min-height: 0; }
.ep-status .ok { color: var(--c-ok); font-weight: 700; }
.ep-status .unit { display: block; color: var(--c-muted); font-size: 13px; margin-top: 2px; }
.ep-status .warn { display: block; color: var(--c-warn); font-size: 13px; margin-top: 2px; }
.ep-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.row-actions { display: flex; gap: 8px; margin-bottom: 12px; }
.row-actions button { flex: 1; }
.nav-buttons { display: flex; gap: 10px; margin-top: 8px; }
.nav-buttons .ghost { flex: none; }
.nav-buttons .primary { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 8px; }

.saved { margin-bottom: 12px; }
.saved-title { font-size: 13px; color: var(--c-muted); margin: 0 0 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button, .chips label {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--c-border); border-radius: 999px;
  padding: 8px 12px; font-size: 14px; background: #fff; cursor: pointer; user-select: none;
}
.chips.wide label { flex: 1; justify-content: center; border-radius: 8px; padding: 12px; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label:has(input:checked) { background: var(--c-primary); border-color: var(--c-primary); color: #fff; }
.chips label:has(input:focus-visible) { outline: 3px solid rgba(29, 90, 166, .35); }
.chips label:has(input:disabled) { opacity: .4; cursor: not-allowed; }
.chips .del { border: none; background: none; padding: 0 0 0 4px; color: var(--c-muted); font-size: 16px; line-height: 1; }

.od-recap { background: var(--c-bg); border-radius: 8px; padding: 8px 10px; font-size: 14px; margin: 0 0 14px; }
.duration { background: #eef3fa; border-radius: 8px; padding: 12px; font-size: 16px; margin-bottom: 12px; }
.duration strong { font-size: 22px; color: var(--c-primary); }
.duration.warn { background: #fff4d6; }
.duration.err { background: #fde8e7; color: var(--c-err); }
.error { color: var(--c-err); background: #fde8e7; border-radius: 8px; padding: 8px 10px; font-size: 14px; }

.done { text-align: center; }
.done-icon { width: 64px; height: 64px; margin: 8px auto 12px; border-radius: 50%; display: grid; place-items: center; background: var(--c-ok); color: #fff; font-size: 34px; }
.done-icon.pending { background: var(--c-accent); }
.summary { text-align: left; display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; background: var(--c-bg); border-radius: 8px; padding: 12px; font-size: 14px; }
.summary dt { color: var(--c-muted); }
.summary dd { margin: 0; font-weight: 600; }

.foot { margin-top: 24px; padding-top: 12px; border-top: 1px solid var(--c-border); font-size: 13px; color: var(--c-muted); }
.foot .ver { font-size: 11px; }

dialog { border: none; border-radius: 12px; padding: 0; width: min(560px, calc(100% - 24px)); box-shadow: 0 20px 50px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(16, 24, 40, .45); }
.dialog-body { padding: 18px; }
.history { list-style: none; padding: 0; margin: 0 0 12px; max-height: 50vh; overflow-y: auto; }
.history li { border-bottom: 1px solid var(--c-border); padding: 8px 0; font-size: 14px; }
.history li small { color: var(--c-muted); display: block; }
.history .st { font-size: 12px; font-weight: 700; }
.history .st.sent { color: var(--c-ok); }
.history .st.pending { color: var(--c-warn); }
.danger-zone { margin: 8px 0 12px; font-size: 14px; }
.danger-zone summary { cursor: pointer; color: var(--c-err); }

/* paginile statice (confidențialitate, metodologie) */
.doc { max-width: 760px; margin: 0 auto; padding: 20px 16px 60px; background: var(--c-surface); line-height: 1.55; }
.doc h1 { font-size: 24px; }
.doc h2 { font-size: 19px; margin-top: 28px; }
.doc table { border-collapse: collapse; width: 100%; font-size: 14px; }
.doc td, .doc th { border: 1px solid var(--c-border); padding: 6px 8px; text-align: left; vertical-align: top; }
.draft { background: #fff4d6; border: 1px solid #f0d78c; border-radius: 8px; padding: 10px 12px; }

/* antet pe telefon: mai mult loc pentru numele organizațiilor */
@media (max-width: 560px) {
  .topbar { align-items: flex-start; padding: 10px 12px; }
  .brand-mark { display: none; }
  .brand h1 { font-size: 17px; }
  .link-btn { padding: 5px 10px; font-size: 12px; }
}
.muted { color: var(--c-muted); }
.consent { font-size: 13px; margin-top: 6px; }

/* contor public și distribuire */
.counter { background: #eef3fa; border-radius: 8px; padding: 8px 10px; font-size: 14px; margin: -4px 0 12px; }
.counter strong { color: var(--c-primary); font-size: 16px; }
.share { margin-top: 18px; padding: 14px; border: 1px dashed var(--c-border); border-radius: var(--radius); text-align: left; }
.share h3 { margin: 0 0 4px; font-size: 16px; }
.share-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.share-buttons a, .share-buttons button {
  flex: 1 1 130px; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 11px 12px; border-radius: 8px; font-weight: 700; font-size: 15px; text-decoration: none; border: 1px solid transparent; cursor: pointer;
}
.share-wa { background: #187a42; color: #fff; }
.share-fb { background: #1b4f9c; color: #fff; }
.share-native { background: var(--c-primary); color: #fff; }
.share-copy { background: #fff; color: var(--c-text); border-color: var(--c-border) !important; }
