/* ===========================================================================
   Owner dashboard styles (loaded on top of styles.css)
   =========================================================================*/
body.admin { background: #F6F4F1; display: grid; grid-template-columns: 258px 1fr; min-height: 100vh; }

/* ---- Sidebar ------------------------------------------------------------*/
.aside {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column;
  background: var(--ink); color: color-mix(in srgb, var(--cream) 72%, transparent);
  padding: 1rem .75rem; overflow-y: auto; z-index: 40;
}
.aside-head { padding: .4rem .5rem 1.1rem; }
.alogo { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--cream); }
.alogo img { border-radius: 9px; }
.alogo span { display: flex; flex-direction: column; line-height: 1.15; }
.alogo strong { font-family: var(--font-display); font-size: 1.02rem; }
.alogo em { font-style: normal; font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; opacity: .55; }

.anav { display: grid; gap: 2px; }
.anav a {
  display: flex; align-items: center; gap: .7rem; padding: .62rem .7rem;
  border-radius: 9px; color: inherit; text-decoration: none; font-size: .92rem; font-weight: 500;
}
.anav a:hover { background: color-mix(in srgb, var(--cream) 9%, transparent); color: var(--cream); }
.anav a.is-on { background: var(--brand); color: #fff; font-weight: 620; }
.anav-badge { margin-left: auto; min-width: 21px; height: 21px; padding: 0 .35rem; display: grid; place-items: center; border-radius: 999px; background: var(--accent); color: #2A2320; font-size: .74rem; font-weight: 800; }
.anav a.is-on .anav-badge { background: #fff; color: var(--brand-dark); }

.aside-foot { margin-top: auto; padding-top: 1rem; display: grid; gap: 2px; border-top: 1px solid color-mix(in srgb, var(--cream) 12%, transparent); }
.anav-mini { display: flex; align-items: center; gap: .55rem; padding: .5rem .7rem; border-radius: 9px; font-size: .84rem; color: inherit; text-decoration: none; background: none; border: 0; cursor: pointer; width: 100%; text-align: left; }
.anav-mini:hover { background: color-mix(in srgb, var(--cream) 9%, transparent); color: var(--cream); }
.aside-note { margin-top: .6rem; padding: .6rem .7rem; font-size: .76rem; line-height: 1.6; color: color-mix(in srgb, var(--cream) 55%, transparent); }
.aside-note a { color: var(--accent); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: .45rem; vertical-align: middle; }
.dot.good { background: #4ADE80; } .dot.warn { background: var(--accent); } .dot.bad { background: #F87171; }

/* ---- Main ---------------------------------------------------------------*/
.amain { min-width: 0; display: flex; flex-direction: column; }
.ahead {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem clamp(1rem, 2.5vw, 2rem); min-height: 68px;
  background: rgba(246,244,241,.86); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.ahead h1 { font-size: 1.42rem; }
.ahead-actions { margin-left: auto; display: flex; gap: .5rem; flex-wrap: wrap; }
.aside-toggle { display: none; background: none; border: 1px solid var(--line-2); border-radius: 8px; padding: .4rem; cursor: pointer; }
.abody { padding: clamp(1.1rem, 2.5vw, 2rem); max-width: 1240px; width: 100%; }
.abody.is-wide { max-width: none; }

@media (max-width: 900px) {
  body.admin { grid-template-columns: 1fr; }
  .aside { position: fixed; inset: 0 auto 0 0; width: 258px; transform: translateX(-100%); transition: transform .25s var(--ease); }
  .aside.is-open { transform: none; box-shadow: var(--sh-3); }
  .aside-toggle { display: flex; }
}

/* ---- Stat tiles ---------------------------------------------------------*/
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 186px), 1fr)); gap: 12px; margin-bottom: 1.6rem; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 1rem 1.15rem; display: flex; flex-direction: column; gap: .28rem; }
.stat-label { font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-35); font-weight: 700; }
.stat-value { font-family: var(--font-display); font-size: 2rem; line-height: 1.05; }
.stat-sub { font-size: .8rem; color: var(--ink-55); }
.stat.accent { background: var(--ink); color: var(--cream); border-color: var(--ink); }
.stat.accent .stat-label { color: var(--accent); }
.stat.accent .stat-sub { color: color-mix(in srgb, var(--cream) 60%, transparent); }
.stat a { text-decoration: none; }

/* ---- Panels -------------------------------------------------------------*/
.panel { background: #fff; border: 1px solid var(--line); border-radius: 16px; margin-bottom: 1.4rem; overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: .8rem; padding: .95rem 1.2rem; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h2 { font-size: 1.14rem; }
.panel-head .spacer { flex: 1; }
.panel-body { padding: 1.2rem; }
.panel-body.flush { padding: 0; }
.panel .tbl th:first-child, .panel .tbl td:first-child { padding-left: 1.2rem; }
.panel .tbl th:last-child, .panel .tbl td:last-child { padding-right: 1.2rem; }
.panel .tbl tbody tr:last-child td { border-bottom: 0; }

.cols { display: grid; grid-template-columns: 1.6fr 1fr; gap: 1.4rem; align-items: start; }
.cols-even { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; align-items: start; }
@media (max-width: 1000px) { .cols, .cols-even { grid-template-columns: 1fr; } }

/* ---- Compact forms ------------------------------------------------------*/
.admin .fld { margin-bottom: .85rem; }
.admin .fld input, .admin .fld select, .admin .fld textarea { padding: .58rem .7rem; font-size: .92rem; border-radius: 8px; }
.admin .fld label { font-size: .8rem; }
.inline-form { display: flex; gap: .5rem; align-items: flex-end; flex-wrap: wrap; }
.inline-form .fld { margin-bottom: 0; }

/* ---- Toolbar / filters --------------------------------------------------*/
.toolbar { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.1rem; }
.toolbar .chip { padding: .42rem .8rem; font-size: .84rem; }
.toolbar select, .toolbar input { padding: .5rem .7rem; border: 1.5px solid var(--line-2); border-radius: 999px; background: #fff; font-size: .87rem; }

/* ---- Calendar -----------------------------------------------------------*/
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.cal-dow { background: #FAF8F6; padding: .5rem; text-align: center; font-size: .72rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--ink-35); }
.cal-day { background: #fff; min-height: 116px; padding: .45rem .5rem; display: flex; flex-direction: column; gap: .22rem; }
.cal-day.is-out { background: #FBFAF9; color: var(--ink-35); }
.cal-day.is-today { background: color-mix(in srgb, var(--brand) 7%, #fff); }
.cal-day.is-today .cal-num { background: var(--brand); color: #fff; border-radius: 999px; }
.cal-num { font-size: .8rem; font-weight: 700; width: 24px; height: 22px; display: grid; place-items: center; }
.cal-ev { display: block; font-size: .72rem; line-height: 1.3; padding: .2rem .35rem; border-radius: 5px; background: var(--tint); color: var(--brand-dark); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-ev:hover { background: var(--tint-2); }
.cal-ev.is-delivery { background: var(--info-bg); color: var(--info); }
.cal-ev.is-pickup { background: var(--warn-bg); color: var(--warn); }
.cal-ev.is-closed { background: var(--bad-bg); color: var(--bad); }
@media (max-width: 760px) { .cal-day { min-height: 78px; } .cal-ev { font-size: .64rem; } }

/* ---- Route list ---------------------------------------------------------*/
.route { display: grid; gap: 8px; }
.route-stop { display: grid; grid-template-columns: 42px 1fr auto; gap: .8rem; align-items: center; padding: .8rem 1rem; background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.route-n { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--ink); color: var(--cream); font-weight: 700; font-size: .88rem; }
.route-stop.is-pickup .route-n { background: var(--accent); color: #2A2320; }
.route-when { font-size: .8rem; color: var(--ink-55); }

/* ---- Line item editor ---------------------------------------------------*/
.lines { width: 100%; border-collapse: collapse; font-size: .9rem; }
.lines th { text-align: left; font-size: .7rem; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-35); padding: .4rem .5rem; }
.lines td { padding: .3rem .5rem; border-top: 1px solid var(--line); }
.lines input { width: 100%; padding: .45rem .55rem; border: 1px solid var(--line-2); border-radius: 7px; font-size: .9rem; }
.lines input.qty { width: 72px; text-align: center; }
.lines input.amt { width: 104px; text-align: right; }
.lines .rm { background: none; border: 0; color: var(--bad); cursor: pointer; padding: .3rem; font-size: 1.1rem; line-height: 1; }

/* ---- Login --------------------------------------------------------------*/
.login-body { display: grid; place-items: center; min-height: 100vh; background: linear-gradient(160deg, var(--sand), var(--cream)); padding: 1.4rem; }
.login-card { width: min(100%, 380px); background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 2.2rem; box-shadow: var(--sh-2); text-align: center; }
.login-card img { margin: 0 auto 1rem; border-radius: 12px; }
.login-card h1 { font-size: 1.5rem; }
.login-card form { margin-top: 1.4rem; text-align: left; }
.login-card code { background: var(--sand); padding: .1em .35em; border-radius: 4px; font-size: .88em; }

/* ---- Misc ---------------------------------------------------------------*/
.admin .empty { background: #fff; }
.hint { font-size: .84rem; color: var(--ink-55); background: var(--info-bg); border-left: 3px solid var(--info); padding: .7rem .9rem; border-radius: 0 8px 8px 0; margin-bottom: 1rem; }
.hint strong { color: var(--info); }
.kv { display: grid; grid-template-columns: auto 1fr; gap: .35rem 1rem; font-size: .9rem; }
.kv dt { color: var(--ink-55); }
.kv dd { margin: 0; font-weight: 550; }
.thumb { width: 46px; height: 46px; border-radius: 8px; object-fit: cover; background: var(--sand); }
.tag-in { font-size: .78rem; background: var(--sand); padding: .18em .55em; border-radius: 999px; margin-right: .25rem; display: inline-block; }
.drag { cursor: grab; color: var(--ink-35); }

/* ---- Content module additions (photo manager) — src/modules/content.js -*/
.photo-card .fld { margin-bottom: .65rem; }
.photo-card .check { padding: .2rem 0; }

/* ---------------------------------------------------------------------------
   Link tidy-ups: tiles and checklist rows are whole-block links, so the
   underline belongs on hover only, not permanently.
   -------------------------------------------------------------------------*/
a.stat, .stat a, .panel a.block-link { text-decoration: none; color: inherit; }
a.stat { transition: transform .16s var(--ease), box-shadow .16s var(--ease), border-color .16s; }
a.stat:hover { transform: translateY(-2px); box-shadow: var(--sh-2); border-color: var(--brand); color: inherit; }
a.stat .stat-value, a.stat .stat-sub { color: inherit; }
a.stat .stat-sub { text-decoration: underline; text-decoration-color: var(--line-2); text-underline-offset: 3px; }
.checklist a, .panel-body ul.checklist a { text-decoration: none; }
.checklist a:hover { text-decoration: underline; }
.checklist { list-style: none; padding: 0; }
.check-row { display: grid; grid-template-columns: 22px 1fr; gap: .6rem; align-items: start; }
.check-mark { display: grid; place-items: center; width: 20px; height: 20px; border-radius: 50%; background: var(--warn-bg); color: var(--warn); margin-top: .12rem; }
.check-row.is-done .check-mark { background: var(--good-bg); color: var(--good); }
.check-body { display: flex; flex-direction: column; gap: .12rem; }
.check-row.is-done .check-body strong { color: var(--ink-55); font-weight: 500; }
.check-body .micro { line-height: 1.5; }
