/* Layout: one calm column. Trip tiles on home; on a trip, every day and stop on one scroll with small square photos. */
:root{
  --bg:#FFFFFF; --surface:#FFFFFF; --sunk:#F4F4F4; --ink:#111111; --soft:#555555; --muted:#8A8A8A; --faint:#C4C4C4; --line:#EDEDED;
  --accent:#111111; --accent-ink:#FFFFFF; --map:#F4F4F2; --grid:#E4E4E0; --route:#111111;
  --k-place:#111111; --k-stay:#111111; --k-flight:#111111; --k-activity:#111111; --k-food:#111111; --k-transit:#111111;
  --danger:#B42318; --pin-ink:#FFFFFF; --scrim:rgb(0 0 0 / .32);
  --shadow:0 1px 2px rgb(0 0 0 / .05), 0 12px 32px rgb(0 0 0 / .08);
  --f-body:"Geist",system-ui,-apple-system,"Segoe UI",sans-serif;
  --f-mono:"Geist Mono",ui-monospace,"SF Mono",Menlo,monospace;
  --gutter-l:max(20px, env(safe-area-inset-left, 0px));
  --gutter-r:max(20px, env(safe-area-inset-right, 0px));
}
@media (prefers-color-scheme: dark){ :root:not([data-theme="light"]){
  --bg:#0E0E0E; --surface:#171717; --sunk:#1E1E1E; --ink:#EDEDED; --soft:#B5B5B5; --muted:#8C8C8C; --faint:#4A4A4A; --line:#242424;
  --accent:#EDEDED; --accent-ink:#0E0E0E; --map:#161616; --grid:#262626; --route:#EDEDED;
  --k-place:#EDEDED; --k-stay:#EDEDED; --k-flight:#EDEDED; --k-activity:#EDEDED; --k-food:#EDEDED; --k-transit:#EDEDED;
  --danger:#FF8A80; --pin-ink:#0E0E0E; --scrim:rgb(0 0 0 / .55);
  --shadow:0 1px 2px rgb(0 0 0 / .4), 0 12px 32px rgb(0 0 0 / .4);
  color-scheme:dark;
}}
:root[data-theme="dark"]{
  --bg:#0E0E0E; --surface:#171717; --sunk:#1E1E1E; --ink:#EDEDED; --soft:#B5B5B5; --muted:#8C8C8C; --faint:#4A4A4A; --line:#242424;
  --accent:#EDEDED; --accent-ink:#0E0E0E; --map:#161616; --grid:#262626; --route:#EDEDED;
  --k-place:#EDEDED; --k-stay:#EDEDED; --k-flight:#EDEDED; --k-activity:#EDEDED; --k-food:#EDEDED; --k-transit:#EDEDED;
  --danger:#FF8A80; --pin-ink:#0E0E0E; --scrim:rgb(0 0 0 / .55);
  --shadow:0 1px 2px rgb(0 0 0 / .4), 0 12px 32px rgb(0 0 0 / .4);
  color-scheme:dark;
}
html{min-height:100%}
body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.45 var(--f-body);letter-spacing:-.01em;-webkit-font-smoothing:antialiased}
body::before{content:"";position:fixed;inset:0 0 auto;height:env(safe-area-inset-top,0px);z-index:10;background:var(--bg)}
a{color:inherit}
button,input,textarea,select{font:inherit;color:inherit;letter-spacing:inherit}
:focus-visible{outline:2px solid var(--ink);outline-offset:2px;border-radius:6px}
.mono{font-family:var(--f-mono);font-variant-numeric:tabular-nums;letter-spacing:0}
.num{font-variant-numeric:tabular-nums}
.ico{width:18px;height:18px;fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;stroke-linejoin:round;flex:none}
[hidden]{display:none!important}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.spacer{flex:1}
.muted{color:var(--muted)}

/* buttons */
.btn{display:inline-flex;align-items:center;justify-content:center;gap:6px;height:36px;padding:0 14px;border-radius:999px;border:1px solid var(--line);background:var(--surface);cursor:pointer;font-size:13.5px;font-weight:500;text-decoration:none;white-space:nowrap}
.btn:hover{border-color:var(--faint)}
.btn.primary{background:var(--ink);border-color:var(--ink);color:var(--bg)}
.btn.primary:hover{opacity:.88}
.btn.ghost{background:transparent;border-color:transparent}
.btn.ghost:hover{background:var(--sunk)}
.btn.danger{color:var(--danger)}
.btn.sm{height:30px;padding:0 10px;font-size:12.5px}
.icon-btn{display:inline-grid;place-items:center;width:40px;height:40px;border-radius:999px;border:0;background:transparent;cursor:pointer;color:var(--muted);text-decoration:none}
.icon-btn:hover{background:var(--sunk);color:var(--ink)}
.icon-btn.line{border:1px solid var(--line);color:var(--ink)}

.wrap{max-width:640px;margin:0 auto;padding-left:var(--gutter-l);padding-right:var(--gutter-r)}
.topbar{display:flex;align-items:center;gap:8px;min-height:44px;padding-top:16px}
.brand{font-size:15px;font-weight:600}
.status{font-size:12px;color:var(--muted);display:inline-flex;align-items:center;gap:6px}
.status::before{content:"";width:6px;height:6px;border-radius:50%;background:var(--faint)}
.status.live::before{background:#2E9E5B}
.chip{display:inline-flex;align-items:center;font-size:11px;font-weight:500;padding:2px 8px;border-radius:999px;background:var(--sunk);color:var(--muted)}

/* home */
.home{padding-bottom:64px}
.home h1{font-weight:500;font-size:32px;line-height:1.1;letter-spacing:-.035em;margin:28px 0 4px}
.lede{color:var(--muted);margin:0 0 22px;font-size:14px}
.trip-list{display:grid;gap:24px}
@media (min-width:700px){ .home.wrap{max-width:980px} .trip-list{grid-template-columns:repeat(auto-fill,minmax(280px,1fr));gap:28px 20px} }
.tile{display:flex;flex-direction:column;gap:10px;text-decoration:none;color:var(--ink)}
.cover{position:relative;height:170px;border-radius:12px;overflow:hidden;background:var(--sunk)}
.trip-list > .tile:first-child .cover{height:220px}
@media (min-width:700px){ .trip-list > .tile:first-child .cover,.cover{height:200px} }
.cover img{width:100%;height:100%;object-fit:cover;display:block}
.tile:hover .cover{opacity:.94}
.tile-row{display:flex;justify-content:space-between;align-items:baseline;gap:12px}
.tile-title{font-size:17px;font-weight:500}
.tile-dates{flex:none;font-size:13px;color:var(--muted)}
.tile-meta{margin-top:-6px;font-size:13px;color:var(--muted)}
.new-tile{display:flex;align-items:center;justify-content:center;gap:6px;min-height:72px;border:1px dashed var(--faint);border-radius:12px;background:transparent;cursor:pointer;color:var(--muted);font-size:14px}
.new-tile:hover{color:var(--ink);border-color:var(--muted)}
.empty{padding:40px 0;color:var(--muted)}

/* trip */
.trip{padding-bottom:calc(110px + env(safe-area-inset-bottom,0px))}
.trip-head{padding:18px 0 22px}
.trip-head h1{margin:0;font-weight:500;font-size:34px;line-height:1.08;letter-spacing:-.04em;text-wrap:balance}
.trip-when{margin-top:6px;font-size:14px;color:var(--muted);display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.pills{display:flex;flex-wrap:wrap;gap:6px;margin-top:14px}
.pill{display:inline-flex;align-items:center;gap:5px;height:28px;padding:0 10px;border-radius:14px;background:var(--sunk);font-size:12.5px;font-weight:500;color:var(--soft)}
.pill b{font-weight:600;color:var(--ink)}
.avatars{display:flex}
.av{width:26px;height:26px;border-radius:13px;border:2px solid var(--bg);background:var(--ink);color:var(--bg);font-size:11px;font-weight:600;display:grid;place-items:center;overflow:hidden;flex:none}
.av + .av{margin-left:-7px}
.av:nth-child(2){background:var(--muted)} .av:nth-child(3){background:var(--faint);color:var(--ink)}
.av img{width:100%;height:100%;object-fit:cover}
.av.sm{width:18px;height:18px;border:0;font-size:9.5px;background:var(--muted);color:var(--bg)}

.day-head{display:flex;align-items:center;justify-content:space-between;min-height:48px;border-top:1px solid var(--line)}
.day-head h2{margin:0;font-size:15px;font-weight:600;display:flex;align-items:baseline;gap:8px}
.day-head h2 span{font-size:13px;font-weight:400;color:var(--muted)}
.day-head .icon-btn{width:36px;height:36px;margin-right:-8px}
.night{font-size:12.5px;color:var(--muted);margin:-6px 0 10px}
.stop{display:grid;grid-template-columns:40px 64px minmax(0,1fr) 34px;column-gap:12px;padding:6px 0 18px}
.stop .t{padding-top:2px;font-size:12.5px;color:var(--muted)}
.thumb{position:relative;width:64px;height:64px;border-radius:10px;overflow:hidden;border:0;padding:0;background:var(--sunk);display:block;cursor:default}
.thumb img{width:100%;height:100%;object-fit:cover;display:block}
.thumb .code{position:absolute;left:0;right:0;bottom:6px;text-align:center;font-size:11px;font-weight:600;color:#FFFFFF;letter-spacing:.02em}
.thumb .ki{position:absolute;inset:0;display:grid;place-items:center;color:rgb(255 255 255 / .9)}
.thumb .ki .ico{width:20px;height:20px}
.can-edit .thumb,.can-edit .stop .title{cursor:pointer}
.body{min-width:0;display:flex;flex-direction:column;gap:2px}
.title{font-size:15px;font-weight:500;line-height:1.3;overflow-wrap:anywhere;background:none;border:0;padding:0;text-align:left}
.can-edit .stop .title:hover{text-decoration:underline;text-underline-offset:3px;text-decoration-color:var(--faint)}
.sub{font-size:12.5px;color:var(--muted);overflow-wrap:anywhere}
.note{font-size:13px;color:var(--soft);white-space:pre-wrap;overflow-wrap:anywhere;margin-top:2px}
.links{display:flex;flex-wrap:wrap;gap:4px 14px;margin-top:5px}
.links a{display:inline-flex;align-items:center;gap:3px;font-size:12.5px;font-weight:500;text-decoration:none;color:var(--ink)}
.links a:hover{text-decoration:underline;text-underline-offset:3px}
.links .ico{width:11px;height:11px;stroke-width:2.2}
.comments{display:grid;gap:6px;margin-top:9px}
.cmt{display:flex;align-items:flex-start;gap:7px;font-size:12.5px;line-height:1.4;color:var(--soft)}
.cmt .who{color:var(--ink);font-weight:500}
.cmt .x{margin-left:auto;border:0;background:none;color:var(--faint);cursor:pointer;padding:0 2px;font-size:14px;line-height:1}
.cmt .x:hover{color:var(--danger)}
.composer{display:flex;gap:6px;margin-top:8px}
.composer input{flex:1;min-width:0;height:34px;border-radius:17px;border:1px solid var(--line);background:var(--sunk);padding:0 12px;font-size:13px}
.composer input:focus{outline:none;border-color:var(--muted);background:var(--surface)}
.cbtn{width:34px;height:28px;border:0;background:transparent;color:var(--faint);display:flex;align-items:center;justify-content:flex-end;gap:2px;cursor:pointer;font-size:11px;font-weight:600;padding:0}
.cbtn:hover{color:var(--ink)}
.cbtn.has{color:var(--ink)}
.cbtn .ico{width:16px;height:16px;stroke-width:1.7}
.stop.sel .title{text-decoration:underline;text-underline-offset:3px}
.trip-empty{margin-top:8px;padding:24px;border:1px dashed var(--faint);border-radius:14px;color:var(--muted);display:grid;gap:12px;justify-items:start}
.unsched .t{visibility:hidden}

.dock{position:fixed;left:0;right:0;bottom:0;z-index:20;background:var(--bg);border-top:1px solid var(--line);padding:12px 0 calc(14px + env(safe-area-inset-bottom,0px))}
.dock .wrap{display:flex;gap:8px}
.paste{flex:1;height:46px;padding:0 16px;border-radius:23px;border:0;background:var(--sunk);color:var(--muted);font-size:14px;text-align:left;cursor:pointer;display:flex;align-items:center;gap:8px}
.paste:hover{color:var(--ink)}
.dock .round{width:46px;height:46px;border-radius:23px;border:0;background:var(--ink);color:var(--bg);display:grid;place-items:center;cursor:pointer;flex:none}

/* sheet */
.scrim{position:fixed;inset:0;background:var(--scrim);z-index:50;display:flex;align-items:center;justify-content:center;padding:24px;animation:fade .18s ease}
.sheet{background:var(--surface);width:min(560px,100%);max-height:min(88vh,900px);overflow-y:auto;border-radius:20px;padding:22px;box-shadow:var(--shadow);animation:rise .22s cubic-bezier(.2,.8,.2,1);box-sizing:border-box}
.sheet.wide{width:min(900px,100%)}
.sheet h2{font-weight:500;font-size:22px;letter-spacing:-.03em;margin:0 0 14px}
@media (max-width:600px){
  .scrim{align-items:flex-end;padding:0}
  .sheet{border-radius:20px 20px 0 0;max-height:92vh;padding-bottom:calc(20px + env(safe-area-inset-bottom,0px));padding-left:max(20px,env(safe-area-inset-left,0px));padding-right:max(20px,env(safe-area-inset-right,0px))}
}
@keyframes fade{from{opacity:0}}
@keyframes rise{from{transform:translateY(16px);opacity:.4}}
@media (prefers-reduced-motion: reduce){ *{animation:none!important;transition:none!important} }
.form{display:grid;gap:14px}
.field{display:grid;gap:5px}
.field > span{font-size:12px;font-weight:500;color:var(--muted)}
.input{width:100%;box-sizing:border-box;height:42px;border-radius:10px;border:1px solid var(--line);background:var(--sunk);padding:0 12px;min-width:0}
textarea.input{height:auto;min-height:72px;padding:10px 12px;resize:vertical}
.input:focus{outline:none;border-color:var(--muted);background:var(--surface)}
.smart{position:relative}
.smart .input{height:50px;padding-left:42px;font-size:15px}
.smart .ico{position:absolute;left:14px;top:16px;color:var(--muted)}
.row{display:grid;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));gap:10px}
.detect{display:flex;flex-wrap:wrap;gap:6px;align-items:center;font-size:13px;color:var(--muted);min-height:22px}
.detect .src{font-weight:600;color:var(--ink)}
.findon{display:grid;gap:6px}
.findon .lbl{font-size:12px;color:var(--muted)}
.findon .links{margin-top:0}
.seg{display:flex;flex-wrap:wrap;gap:6px}
.seg label{cursor:pointer}
.seg input{position:absolute;opacity:0;pointer-events:none}
.seg span{display:inline-flex;align-items:center;gap:6px;height:32px;padding:0 12px;border-radius:999px;border:1px solid var(--line);font-size:13px;font-weight:500;color:var(--soft)}
.seg span .ico{width:15px;height:15px}
.seg input:checked + span{background:var(--ink);border-color:var(--ink);color:var(--bg)}
.seg input:focus-visible + span{outline:2px solid var(--ink);outline-offset:2px}
.photo-field{display:flex;align-items:center;gap:12px;flex-wrap:wrap}
.photo-field .thumb{cursor:default}
.coord{font-size:12px;color:var(--muted);display:flex;gap:8px;align-items:center;flex-wrap:wrap}
.sheet-actions{display:flex;gap:8px;align-items:center;justify-content:flex-end;flex-wrap:wrap;margin-top:6px}
.confirm{display:flex;gap:8px;align-items:center;flex-wrap:wrap;font-size:13px;color:var(--danger)}
.share-text{width:100%;box-sizing:border-box;min-height:200px;font:12.5px/1.55 var(--f-mono);border-radius:10px;border:1px solid var(--line);background:var(--sunk);padding:12px;resize:vertical}
.p{margin:0 0 12px;max-width:62ch;font-size:14px}
.toast{position:fixed;left:50%;bottom:calc(84px + env(safe-area-inset-bottom,0px));transform:translateX(-50%);background:var(--ink);color:var(--bg);padding:10px 16px;border-radius:999px;font-size:14px;z-index:60;box-shadow:var(--shadow);max-width:calc(100% - 32px)}
.loading{display:grid;place-items:center;min-height:60vh;color:var(--muted)}
.map-box{position:relative;height:min(62vh,560px);border-radius:14px;overflow:hidden;background:var(--map)}
.map-box svg{display:block;width:100%;height:100%}
.map-empty{position:absolute;inset:0;display:grid;place-items:center;text-align:center;color:var(--muted);padding:24px;font-size:14px}

/* map svg */
.g-line{stroke:var(--grid);stroke-width:1}
.g-lbl{fill:var(--muted);font:10px var(--f-mono);opacity:.85}
.route{fill:none;stroke:var(--route);stroke-width:1.6;opacity:.5;stroke-linecap:round;stroke-linejoin:round}
.route.air{stroke-dasharray:2 5;opacity:.65}
.pin circle.dot{fill:var(--k);stroke:var(--map);stroke-width:3}
.pin text{fill:var(--pin-ink);font:600 10.5px var(--f-mono);text-anchor:middle;dominant-baseline:central;pointer-events:none}
.pin{cursor:pointer}
.pin .ring{fill:none;stroke:var(--k);stroke-width:2;opacity:0}
.pin.sel .ring{opacity:1}
.end circle{fill:var(--map);stroke:var(--k);stroke-width:2}
.end text,.pin-lbl{fill:var(--ink);font:500 10.5px var(--f-mono)}
.pin-lbl{paint-order:stroke;stroke:var(--map);stroke-width:4px;stroke-linejoin:round}
.scale line{stroke:var(--ink);stroke-width:1.5}
.scale text{fill:var(--ink);font:10px var(--f-mono)}
.k-place{--k:var(--k-place)} .k-stay{--k:var(--k-stay)} .k-flight{--k:var(--k-flight)}
.k-activity{--k:var(--k-activity)} .k-food{--k:var(--k-food)} .k-transit{--k:var(--k-transit)}
