/* ── JMT Expedition Planner — alpine design system ───────────────────── */
:root {
  --pine:    #1b3a2f;
  --pine-2:  #244a3b;
  --granite: #2c3836;
  --moss:    #3f6b53;
  --sage:    #7fa88c;
  --gold:    #e0a23c;
  --alpen:   #e07a4a;   /* alpenglow accent */
  --sky:     #6aa6c8;
  --snow:    #f6f4ec;
  --paper:   #fbfaf5;
  --ink:     #19211d;
  --muted:   #6b746e;
  --line:    #e2ddcf;
  --shadow:  0 10px 30px rgba(20,40,30,.10);
  --shadow-s:0 3px 12px rgba(20,40,30,.08);
  --radius:  16px;
  --maxw:    1180px;
  --sans: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--ink);
  background: var(--paper);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1,h2,h3,h4 { font-family: var(--serif); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; letter-spacing: -.01em; }
a { color: var(--moss); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }

/* ── Layout shell ───────────────────────────────────────────────── */
.app { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, var(--pine) 0%, var(--granite) 100%);
  color: #e9efe9;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 18px; }
.brand .logo {
  width: 40px; height: 40px; border-radius: 11px; flex: none;
  background: linear-gradient(135deg, var(--gold), var(--alpen));
  display: grid; place-items: center; font-size: 22px;
  box-shadow: 0 4px 14px rgba(224,122,74,.4);
}
.brand .t { font-family: var(--serif); font-size: 19px; font-weight: 600; line-height: 1.05; }
.brand .s { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--sage); }

.nav-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 13px; border-radius: 11px;
  color: #cfe0d4; font-size: 14.5px; font-weight: 500;
  border: none; background: none; width: 100%; text-align: left;
  transition: background .15s, color .15s;
}
.nav-link .ic { font-size: 17px; width: 22px; text-align: center; }
.nav-link:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.nav-link.active { background: rgba(224,162,60,.16); color: #fff; }
.nav-link.active .ic { filter: drop-shadow(0 0 6px rgba(224,162,60,.6)); }
.nav-sep { height: 1px; background: rgba(255,255,255,.08); margin: 12px 8px; }
.sidebar .foot { margin-top: auto; font-size: 11.5px; color: var(--sage); padding: 14px 8px 2px; }

.main { min-width: 0; }
.view { display: none; }
.view.active { display: block; animation: fade .35s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 34px 34px 80px; }

.page-head { margin-bottom: 26px; }
.page-head h1 { font-size: 34px; }
.page-head .sub { color: var(--muted); font-size: 15px; max-width: 64ch; }
.eyebrow { font-size: 12px; letter-spacing: .16em; text-transform: uppercase; color: var(--alpen); font-weight: 700; margin-bottom: 6px; }

/* ── Hero (dashboard) ───────────────────────────────────────────── */
.hero {
  position: relative; border-radius: 22px; overflow: hidden;
  min-height: 380px; display: flex; align-items: flex-end;
  color: #fff; box-shadow: var(--shadow);
  background: #234;
}
.hero .bg {
  position: absolute; inset: 0;
  background-image: url('https://images.unsplash.com/photo-1454496522488-7a8e488e8606?w=1600&q=80');
  background-size: cover; background-position: center;
  transform: scale(1.03);
}
.hero .scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(15,30,25,.15) 0%, rgba(15,30,25,.85) 100%); }
.hero .inner { position: relative; padding: 40px; width: 100%; }
.hero h1 { font-size: 46px; color: #fff; margin-bottom: 6px; text-shadow: 0 2px 20px rgba(0,0,0,.4); }
.hero .tag { font-size: 17px; opacity: .92; max-width: 60ch; }
.hero .route { display: inline-flex; gap: 8px; align-items: center; margin-top: 14px; font-weight: 600;
  background: rgba(0,0,0,.28); padding: 8px 15px; border-radius: 30px; backdrop-filter: blur(4px); font-size: 14px; }

/* countdown */
.countdown { display: flex; gap: 14px; margin: 22px 0 4px; flex-wrap: wrap; }
.cd-box { background: var(--paper); border: 1px solid var(--line); border-radius: 14px; padding: 14px 20px; text-align: center; box-shadow: var(--shadow-s); min-width: 92px; }
.cd-box .n { font-family: var(--serif); font-size: 32px; font-weight: 600; color: var(--pine); line-height: 1; }
.cd-box .l { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); margin-top: 6px; }

/* stat strip */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px,1fr)); gap: 14px; margin: 26px 0; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-s); }
.stat .v { font-family: var(--serif); font-size: 27px; color: var(--pine); }
.stat .k { font-size: 12.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; }
.stat .ic { font-size: 20px; }

/* ── Cards & grids ──────────────────────────────────────────────── */
.grid { display: grid; gap: 16px; }
.grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(330px,1fr)); }
.grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(270px,1fr)); }

.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-s); position: relative;
  transition: box-shadow .18s, transform .18s;
}
.card:hover { box-shadow: var(--shadow); }
.card h3 { font-size: 18px; }
.card .meta { color: var(--muted); font-size: 13px; }

.section { margin-bottom: 34px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.section-head h2 { font-size: 23px; margin: 0; }

/* itinerary timeline */
.day-card { display: grid; grid-template-columns: 64px 1fr; gap: 16px; align-items: start; }
.day-badge { background: linear-gradient(160deg, var(--pine), var(--moss)); color: #fff; border-radius: 13px; padding: 10px 6px; text-align: center; }
.day-badge .d { font-size: 11px; opacity: .8; text-transform: uppercase; letter-spacing: .06em; }
.day-badge .n { font-family: var(--serif); font-size: 26px; line-height: 1; }
.day-body h3 { margin-bottom: 4px; }
.leg { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.leg b { color: var(--ink); font-weight: 600; }
.chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 8px 0; }
.chip { font-size: 12px; padding: 4px 11px; border-radius: 30px; background: var(--snow); border: 1px solid var(--line); color: var(--granite); font-weight: 500; }
.chip.miles { background: #eaf2ec; border-color: #cfe2d4; color: var(--pine); }
.chip.gain  { background: #fff1e6; border-color: #f3d6bf; color: #b35a2c; }
.chip.pass  { background: #eef4f8; border-color: #cfe0ea; color: #3b6a85; }
.chip.resupply { background: #fbeede; border-color: #eccfa0; color: #97681a; }
.day-notes { font-size: 14px; color: #46514b; margin-top: 6px; }

/* ── Tables ─────────────────────────────────────────────────────── */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: #fff; box-shadow: var(--shadow-s); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: left; font-size: 11.5px; letter-spacing: .07em; text-transform: uppercase; color: var(--muted); padding: 13px 14px; border-bottom: 2px solid var(--line); white-space: nowrap; background: var(--snow); position: sticky; }
td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fcfbf6; }
.row-actions { display: flex; gap: 6px; }

/* ── Buttons & pills ────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 7px; border: 1px solid var(--line); background: #fff; color: var(--granite); padding: 9px 15px; border-radius: 11px; font-size: 14px; font-weight: 600; transition: .15s; }
.btn:hover { border-color: var(--moss); color: var(--pine); text-decoration: none; }
.btn.primary { background: linear-gradient(135deg, var(--moss), var(--pine)); color: #fff; border: none; box-shadow: 0 4px 14px rgba(31,72,55,.25); }
.btn.primary:hover { filter: brightness(1.07); color: #fff; }
.btn.gold { background: linear-gradient(135deg, var(--gold), var(--alpen)); color: #fff; border: none; }
.btn.sm { padding: 5px 10px; font-size: 12.5px; border-radius: 8px; }
.btn.ghost { background: none; }
.icon-btn { border: none; background: none; color: var(--muted); padding: 4px 7px; border-radius: 8px; font-size: 14px; }
.icon-btn:hover { background: var(--snow); color: var(--ink); }
.icon-btn.danger:hover { background: #fbe6e0; color: #b3402a; }

.tag-pill { font-size: 11.5px; padding: 3px 9px; border-radius: 20px; background: var(--snow); border: 1px solid var(--line); color: var(--granite); font-weight: 600; }
.kind-mail { background:#eaf2ec; color: var(--pine); border-color:#cfe2d4;}
.kind-store { background:#eef4f8; color:#3b6a85; border-color:#cfe0ea;}
.kind-spur, .kind-cache { background:#fff1e6; color:#b35a2c; border-color:#f3d6bf;}

/* category filter bar */
.filterbar { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filterbar button { border: 1px solid var(--line); background: #fff; color: var(--granite); padding: 6px 14px; border-radius: 30px; font-size: 13px; font-weight: 600; }
.filterbar button.active { background: var(--pine); color: #fff; border-color: var(--pine); }

/* meal columns */
.meal-cols { display: grid; grid-template-columns: repeat(auto-fit,minmax(220px,1fr)); gap: 16px; }
.meal-col h3 { display:flex; align-items:center; gap:8px; font-size:17px; padding-bottom:8px; border-bottom: 2px solid var(--line); }
.meal-item { background:#fff; border:1px solid var(--line); border-radius:12px; padding:12px 13px; margin-bottom:10px; box-shadow: var(--shadow-s); }
.meal-item .nm { font-weight:600; font-size:14.5px; }
.meal-item .sub { font-size:12.5px; color:var(--muted); margin-top:3px; }
.meal-item .nums { display:flex; gap:10px; font-size:12px; color:var(--moss); font-weight:600; margin-top:6px; }

/* side hikes */
.hike-card { border-left: 4px solid var(--sage); }
.hike-card.star { border-left-color: var(--gold); }
.hike-card .star-tag { color: var(--gold); font-weight: 700; font-size: 12px; }

/* gallery */
.gallery { columns: 3; column-gap: 16px; }
.gallery figure { margin: 0 0 16px; break-inside: avoid; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-s); position: relative; background:#ddd; }
.gallery img { width: 100%; transition: transform .4s; display:block; }
.gallery figure:hover img { transform: scale(1.05); }
.gallery figcaption { position:absolute; left:0; right:0; bottom:0; padding: 28px 14px 12px; color:#fff; font-size:13px;
  background: linear-gradient(transparent, rgba(0,0,0,.78)); }
.gallery figcaption b { display:block; font-family:var(--serif); font-size:15px; }

/* map */
#map { height: 560px; border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-s); z-index: 0; }
.legend { display:flex; flex-wrap:wrap; gap:14px; margin-top:14px; font-size:13px; color:var(--muted); }
.legend span { display:inline-flex; align-items:center; gap:7px; }
.dot { width:13px; height:13px; border-radius:50%; display:inline-block; border:2px solid #fff; box-shadow:0 0 0 1px rgba(0,0,0,.15); }

/* chat */
.chat-wrap { display: grid; grid-template-rows: 1fr auto; height: calc(100vh - 200px); min-height: 440px; border:1px solid var(--line); border-radius: var(--radius); background:#fff; box-shadow: var(--shadow-s); overflow:hidden; }
.chat-log { overflow-y:auto; padding: 20px; display:flex; flex-direction:column; gap: 14px; background: linear-gradient(180deg,#fbfaf5,#fff); }
.msg { max-width: 76%; }
.msg .bubble { background: var(--snow); border:1px solid var(--line); padding: 10px 14px; border-radius: 14px; border-top-left-radius: 4px; font-size:14.5px; }
.msg .who { font-size:12px; color:var(--muted); margin: 0 6px 4px; font-weight:600; }
.msg.me { align-self: flex-end; }
.msg.me .who { text-align:right; }
.msg.me .bubble { background: linear-gradient(135deg, var(--moss), var(--pine)); color:#fff; border:none; border-top-left-radius:14px; border-top-right-radius:4px; }
.chat-input { display:flex; gap:10px; padding: 14px; border-top:1px solid var(--line); background:#fff; }
.chat-input input[type=text] { flex:1; }

/* forms / inputs */
input[type=text], input[type=number], input[type=url], textarea, select {
  font-family: inherit; font-size: 14px; color: var(--ink);
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: #fff; width: 100%; transition: border .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus { outline:none; border-color: var(--moss); box-shadow: 0 0 0 3px rgba(63,107,83,.13); }
textarea { resize: vertical; min-height: 70px; }
label.field { display:block; margin-bottom: 14px; }
label.field .lab { font-size:12.5px; font-weight:600; color:var(--granite); margin-bottom:5px; display:block; }

/* modal */
.modal-back { position: fixed; inset:0; background: rgba(20,30,25,.5); backdrop-filter: blur(3px); display:none; align-items:center; justify-content:center; z-index:1000; padding:20px; }
.modal-back.open { display:flex; animation: fade .2s; }
.modal { background:#fff; border-radius: 18px; width: 540px; max-width:100%; max-height: 88vh; overflow-y:auto; box-shadow: 0 30px 70px rgba(0,0,0,.35); }
.modal header { padding: 20px 24px; border-bottom:1px solid var(--line); display:flex; justify-content:space-between; align-items:center; position:sticky; top:0; background:#fff; }
.modal header h3 { margin:0; font-size:20px; }
.modal .body { padding: 22px 24px; }
.modal footer { padding: 16px 24px; border-top:1px solid var(--line); display:flex; justify-content:flex-end; gap:10px; position:sticky; bottom:0; background:#fff; }

/* resources */
.link-card { display:flex; align-items:flex-start; gap:12px; }
.link-card .lic { font-size: 20px; flex:none; width: 38px; height:38px; border-radius:10px; display:grid; place-items:center; background: var(--snow); border:1px solid var(--line); }
.link-card .lt { font-weight:600; font-size:15px; }
.link-card .ln { font-size:13px; color:var(--muted); }

/* misc */
.muted { color: var(--muted); }
.callout { background: #eaf2ec; border:1px solid #cfe2d4; border-left:4px solid var(--moss); border-radius:12px; padding:14px 16px; font-size:14px; color:#33503f; margin: 16px 0; }
.callout.warn { background:#fdf3e3; border-color:#eccfa0; border-left-color:var(--gold); color:#6f5012; }
.empty { text-align:center; color:var(--muted); padding: 40px; }
.banner { background: linear-gradient(135deg, var(--pine), var(--granite)); color:#fff; border-radius:18px; padding: 26px 30px; box-shadow: var(--shadow); }
.banner h2 { color:#fff; }
.mobile-top { display:none; }

/* ── Responsive ─────────────────────────────────────────────────── */
@media (max-width: 880px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left:0; top:0; bottom:0; width: 248px; z-index:900; transform: translateX(-100%); transition: transform .25s; height:100vh; }
  .sidebar.open { transform: none; box-shadow: 0 0 40px rgba(0,0,0,.4); }
  .mobile-top { display:flex; align-items:center; gap:12px; padding: 12px 16px; background: var(--pine); color:#fff; position: sticky; top:0; z-index:800; }
  .mobile-top .logo { width:32px; height:32px; border-radius:9px; background:linear-gradient(135deg,var(--gold),var(--alpen)); display:grid; place-items:center; }
  .hamburger { font-size:24px; background:none; border:none; color:#fff; }
  .scrim-back { position:fixed; inset:0; background:rgba(0,0,0,.4); z-index:850; display:none; }
  .scrim-back.open { display:block; }
  .wrap { padding: 22px 18px 70px; }
  .hero h1 { font-size: 32px; }
  .gallery { columns: 2; }
}
@media (max-width: 540px) {
  .gallery { columns: 1; }
  .page-head h1 { font-size: 27px; }
}
