:root {
  --brand: #1f5f4a;
  --ink: #1d2a26;
  --muted: #64736e;
  --line: #e2e8e5;
  --bg: #f4f6f5;
  --card: #fff;
  --ok: #2f855a;
  --warn: #b7791f;
  --err: #b42318;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 15px/1.5 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif; color: var(--ink); background: var(--bg); }
a { color: var(--brand); }
h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.01em; }
h2 { font-size: 18px; margin: 0 0 12px; }
h3 { font-size: 15px; margin: 0 0 8px; }
small, .muted { color: var(--muted); }
code, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; }
code { background: #eef2f0; padding: 1px 5px; border-radius: 4px; word-break: break-all; }
hr { border: 0; border-top: 1px solid var(--line); margin: 18px 0; }

/* ---------- topbar ---------- */
.topbar { display: flex; align-items: center; gap: 20px; padding: 0 20px; height: 56px; background: var(--brand); color: #fff; position: sticky; top: 0; z-index: 50; }
.topbar .logo { color: #fff; text-decoration: none; font-weight: 700; white-space: nowrap; }
.topbar .logo span { font-weight: 400; opacity: .75; }
.mainnav { display: flex; gap: 2px; flex: 1; overflow-x: auto; }
.mainnav a { color: rgba(255,255,255,.85); text-decoration: none; padding: 8px 12px; border-radius: 8px; white-space: nowrap; font-size: 14px; }
.mainnav a:hover { background: rgba(255,255,255,.12); color: #fff; }
.mainnav a.active { background: rgba(255,255,255,.2); color: #fff; font-weight: 600; }
.pill { display: inline-block; background: #fff; color: var(--brand); border-radius: 99px; padding: 0 7px; font-size: 12px; font-weight: 700; margin-left: 2px; }
.who { font-size: 13px; opacity: .9; white-space: nowrap; }
.linklike { background: none; border: 0; color: inherit; text-decoration: underline; cursor: pointer; font: inherit; padding: 0; }
form.inline { display: inline; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 24px 20px 60px; }
.pagehead { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.pagehead p { margin: 2px 0 0; color: var(--muted); }

/* ---------- cards / grid ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.card.tight { padding: 0; overflow: hidden; }
.card > h2:first-child { margin-top: 0; }
.grid { display: grid; gap: 16px; }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.side { grid-template-columns: minmax(0, 1.6fr) minmax(300px, 1fr); }
@media (max-width: 900px) { .g2, .g3, .g4, .side { grid-template-columns: 1fr; } }

.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; text-decoration: none; color: inherit; display: block; }
.stat b { display: block; font-size: 26px; line-height: 1.2; }
.stat span { color: var(--muted); font-size: 13px; }
a.stat:hover { border-color: var(--brand); }

/* ---------- tables ---------- */
table.list { width: 100%; border-collapse: collapse; }
table.list th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); background: #fafbfa; }
table.list td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list tr:last-child td { border-bottom: 0; }
table.list tr.click { cursor: pointer; }
table.list tr.click:hover td { background: #f7faf9; }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; }
.empty { padding: 28px; text-align: center; color: var(--muted); }

.badge { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px; color: var(--c); background: color-mix(in srgb, var(--c) 12%, white); border: 1px solid color-mix(in srgb, var(--c) 30%, white); white-space: nowrap; }
.tag { display: inline-block; font-size: 12px; padding: 1px 7px; border-radius: 5px; background: #eef2f0; color: var(--muted); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--c); vertical-align: middle; margin-right: 6px; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 12px; }
.field > span { font-size: 13px; font-weight: 600; }
.field small { font-size: 12px; }
input[type=text], input[type=email], input[type=tel], input[type=number], input[type=password], input[type=date], input[type=time], input[type=url], input[type=color], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid #cfd8d4; border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
input[type=color] { padding: 2px; height: 40px; }
textarea { min-height: 90px; resize: vertical; }
textarea.big { min-height: 260px; font-family: ui-monospace, Menlo, monospace; font-size: 13px; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--brand) 35%, white); border-color: var(--brand); }
.check { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; cursor: pointer; }
.check input { width: 17px; height: 17px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > .field { flex: 1 1 160px; }
.row > .field.narrow { flex: 0 1 110px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips label { border: 1px solid #cfd8d4; border-radius: 99px; padding: 5px 12px; cursor: pointer; display: flex; gap: 6px; align-items: center; background: #fff; font-size: 14px; }
.chips input:checked + span { font-weight: 600; color: var(--brand); }

.btn { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 8px; border: 1px solid var(--brand); background: var(--brand); color: #fff; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { filter: brightness(1.08); }
.btn.secondary { background: #fff; color: var(--brand); }
.btn.ghost { background: transparent; border-color: #cfd8d4; color: var(--ink); font-weight: 500; }
.btn.danger { background: #fff; color: var(--err); border-color: color-mix(in srgb, var(--err) 40%, white); }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; border: 1px solid; }
.flash.ok { background: #effaf3; border-color: #b7e4c7; color: #1e5631; }
.flash.err { background: #fef3f2; border-color: #fecdca; color: var(--err); }
.flash.warn { background: #fffaeb; border-color: #fedf89; color: #93370d; }
.note { background: #f7faf9; border: 1px dashed #cfd8d4; border-radius: 8px; padding: 10px 12px; font-size: 14px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; flex-wrap: wrap; }
.tabs a { padding: 9px 14px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; margin-bottom: -1px; font-weight: 500; }
.tabs a.active { color: var(--brand); border-color: var(--brand); }

/* ---------- details ---------- */
dl.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
dl.kv dt { color: var(--muted); font-size: 13px; padding-top: 1px; }
dl.kv dd { margin: 0; word-break: break-word; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 14px; }
.timeline li { padding: 7px 0 7px 16px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 13px; width: 8px; height: 8px; border-radius: 50%; background: #b9c6c1; }
.timeline time { color: var(--muted); font-size: 12px; display: block; }

.optlist { display: grid; gap: 8px; }
.opt { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.opt .when b { display: block; }
.opt .meta { font-size: 13px; color: var(--muted); }
.gain { color: var(--ok); font-weight: 600; }

/* ---------- planning ---------- */
.daynav { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; margin-bottom: 16px; }
.week a { display: block; text-decoration: none; color: inherit; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.week a.on { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.week a b { display: block; font-size: 13px; }
.week .bar { height: 5px; border-radius: 3px; background: #e8eeeb; margin-top: 6px; overflow: hidden; }
.week .bar i { display: block; height: 100%; background: var(--brand); }
@media (max-width: 700px) { .week { grid-template-columns: repeat(4, 1fr); } }
#map { height: 460px; border-radius: var(--radius); border: 1px solid var(--line); }
.route { list-style: none; margin: 0; padding: 0; }
.route li { display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.route li:last-child { border-bottom: 0; }
.route .n { width: 28px; height: 28px; border-radius: 50%; background: var(--c, var(--brand)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
.route .leg { font-size: 12px; color: var(--muted); padding: 2px 0 2px 44px; }
.marker-num { background: var(--c); color: #fff; border-radius: 50%; width: 26px; height: 26px; display: grid; place-items: center; font-weight: 700; font-size: 12px; border: 2px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.35); }

/* ---------- public ---------- */
body.public { background: #f2f5f4; }
body.public.embed { background: transparent; }
.pub-head { padding: 18px 20px; text-align: center; background: var(--brand); color: #fff; font-size: 18px; }
.pub-head img { max-height: 44px; }
.pub-wrap { max-width: 640px; margin: 0 auto; padding: 24px 16px 40px; }
.embed .pub-wrap { padding: 4px; max-width: none; }
.pub-foot { text-align: center; color: var(--muted); font-size: 13px; padding: 0 16px 30px; }
.panel { background: #fff; border-radius: 14px; padding: 22px; box-shadow: 0 1px 3px rgba(16,24,20,.06), 0 1px 2px rgba(16,24,20,.04); border: 1px solid var(--line); }
.panel h1 { font-size: 22px; }
.steps { display: flex; gap: 6px; margin-bottom: 18px; }
.steps span { flex: 1; height: 4px; border-radius: 3px; background: #e2e8e5; }
.steps span.on { background: var(--brand); }
.slotbtn { display: flex; justify-content: space-between; align-items: center; width: 100%; text-align: left; padding: 14px 16px; border: 1px solid #cfd8d4; border-radius: 10px; background: #fff; cursor: pointer; font: inherit; color: inherit; margin-bottom: 8px; }
.slotbtn:hover, .slotbtn.sel { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.slotbtn b { color: var(--brand); display: block; }
.slotbtn .go { font-weight: 600; color: var(--brand); }
.addr-ok { margin: 4px 0 14px; padding: 9px 12px; border-radius: 8px; background: #effaf3; color: #1e5631; font-size: 14px; }
.addr-err { margin: 4px 0 14px; padding: 9px 12px; border-radius: 8px; background: #fef3f2; color: var(--err); font-size: 14px; }
.hp { position: absolute; left: -9999px; }
.big-ok { font-size: 44px; line-height: 1; color: var(--ok); }
.center { text-align: center; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.5); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.login { max-width: 380px; margin: 9vh auto; }
