/* Cave Direct house colours: bottle green, brass, bone. */
:root {
  --green:      #032626;
  --green-lift: #0a3b3a;
  --green-line: #17504d;
  --brass:      #cab02d;
  --bone:       #f4f1e8;
  --ink:        #101816;
  --muted:      #8fa9a6;

  --active:   #3fa66b;
  --slipping: #e0b23c;
  --cold:     #e07b39;
  --dormant:  #cc3b30;

  --panel-w: 390px;
  font-synthesis-weight: none;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--green);
  -webkit-font-smoothing: antialiased;
}

h1, h2, .eyebrow, .stat-n, .band-n {
  font-family: "Bebas Neue", Impact, sans-serif;
  font-weight: 400;
  letter-spacing: .04em;
}

/* ── Sign-in ─────────────────────────────────────────────────────────────── */
body.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(90rem 50rem at 15% -10%, #0a3b3a 0%, transparent 60%),
    var(--green);
}
.login-card {
  width: min(420px, 100%);
  background: rgba(255, 255, 255, .04);
  border: 1px solid var(--green-line);
  border-radius: 14px;
  padding: 40px 32px 28px;
  color: var(--bone);
  text-align: center;
}
.eyebrow {
  margin: 0;
  color: var(--brass);
  font-size: .95rem;
  letter-spacing: .22em;
  text-transform: uppercase;
}
.login-card h1 { margin: 2px 0 14px; font-size: 2.9rem; line-height: 1; }
.lede { margin: 0 0 26px; color: var(--muted); font-size: .92rem; line-height: 1.55; }
.alert {
  margin: 0 0 18px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(204, 59, 48, .15);
  border: 1px solid rgba(204, 59, 48, .45);
  color: #ffc9c4;
  font-size: .85rem;
}
.btn-google {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  padding: 13px 18px;
  border-radius: 9px;
  background: var(--bone);
  color: #17232b;
  font-weight: 600;
  font-size: .95rem;
  text-decoration: none;
  transition: transform .12s ease, box-shadow .12s ease;
}
.btn-google:hover { transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0, 0, 0, .35); }
.foot { margin: 20px 0 0; color: var(--muted); font-size: .76rem; }

/* ── App shell ───────────────────────────────────────────────────────────── */
body.app {
  height: 100dvh;
  display: grid;
  grid-template-columns: var(--panel-w) 1fr;
  overflow: hidden;
}
#map { height: 100%; background: #dfe6e3; }

#panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--green);
  color: var(--bone);
  border-right: 1px solid var(--green-line);
}

.masthead {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--green-line);
}
.masthead h1 { margin: 0; font-size: 1.75rem; line-height: 1; }
.masthead .eyebrow { font-size: .72rem; letter-spacing: .2em; }
.signout {
  color: var(--muted);
  font-size: .75rem;
  text-decoration: none;
  border: 1px solid var(--green-line);
  border-radius: 6px;
  padding: 5px 9px;
  white-space: nowrap;
}
.signout:hover { color: var(--bone); border-color: var(--brass); }

/* Band chips double as the primary filter. */
.bands {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1px;
  background: var(--green-line);
  border-bottom: 1px solid var(--green-line);
}
.band {
  appearance: none;
  border: 0;
  background: var(--green);
  color: var(--bone);
  padding: 11px 6px 10px;
  cursor: pointer;
  text-align: center;
  font: inherit;
  border-top: 3px solid transparent;
  transition: background .12s ease;
}
.band:hover { background: var(--green-lift); }
.band[aria-pressed="true"] { background: var(--green-lift); }
.band[aria-pressed="false"] { opacity: .42; }
.band-n { display: block; font-size: 1.5rem; line-height: 1; }
.band-l { display: block; font-size: .62rem; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.band[data-band="active"]   { border-top-color: var(--active); }
.band[data-band="slipping"] { border-top-color: var(--slipping); }
.band[data-band="cold"]     { border-top-color: var(--cold); }
.band[data-band="dormant"]  { border-top-color: var(--dormant); }

.controls { padding: 12px 14px 10px; display: grid; gap: 8px; border-bottom: 1px solid var(--green-line); }
.controls input[type=search], .controls select, .sortrow button {
  width: 100%;
  background: var(--green-lift);
  color: var(--bone);
  border: 1px solid var(--green-line);
  border-radius: 7px;
  padding: 8px 10px;
  font: inherit;
  font-size: .82rem;
}
.controls input[type=search]::placeholder { color: var(--muted); }
.controls :focus-visible { outline: 2px solid var(--brass); outline-offset: 1px; }
.selects { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.toggles { display: flex; gap: 14px; flex-wrap: wrap; font-size: .76rem; color: var(--muted); }
.toggles label { display: flex; gap: 6px; align-items: center; cursor: pointer; }
.toggles input { accent-color: var(--brass); }
.sortrow { display: grid; grid-template-columns: 1fr auto; gap: 7px; }
.sortrow button { width: auto; padding: 8px 14px; cursor: pointer; font-weight: 600; letter-spacing: .04em; }
.sortrow button:hover { border-color: var(--brass); color: var(--brass); }

.resultcount {
  margin: 0;
  padding: 9px 16px;
  font-size: .72rem;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--green-line);
}

.list { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; }
.row {
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 10px;
  align-items: start;
  padding: 11px 16px;
  border-bottom: 1px solid rgba(23, 80, 77, .55);
  cursor: pointer;
}
.row:hover, .row.on { background: var(--green-lift); }
.dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 5px; }
.dot.active { background: var(--active); }
.dot.slipping { background: var(--slipping); }
.dot.cold { background: var(--cold); }
.dot.dormant { background: var(--dormant); }
.row-name { font-size: .87rem; font-weight: 500; line-height: 1.3; }
.row-sub { font-size: .74rem; color: var(--muted); margin-top: 2px; line-height: 1.35; }
.row-meta { text-align: right; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.row-meta strong { display: block; color: var(--bone); font-size: .78rem; font-weight: 600; }
.warn { color: var(--dormant); }

.empty { padding: 30px 18px; color: var(--muted); font-size: .84rem; text-align: center; }

/* ── Detail ──────────────────────────────────────────────────────────────── */
#detail {
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--panel-w);
  background: var(--green);
  color: var(--bone);
  border-right: 1px solid var(--green-line);
  overflow-y: auto;
  z-index: 5;
  display: flex;
  flex-direction: column;
}
#detail[hidden] { display: none; }
.d-head { padding: 16px 18px 14px; border-bottom: 1px solid var(--green-line); }
.d-back {
  appearance: none; background: none; border: 0; color: var(--muted);
  font: inherit; font-size: .76rem; cursor: pointer; padding: 0 0 10px;
}
.d-back:hover { color: var(--brass); }
.d-head h2 { margin: 0; font-size: 1.55rem; line-height: 1.05; }
.d-site { margin: 4px 0 0; font-size: .84rem; color: var(--brass); }
.d-addr { margin: 8px 0 0; font-size: .82rem; color: var(--muted); line-height: 1.5; }
.pill {
  display: inline-block; margin-top: 10px; padding: 3px 9px; border-radius: 999px;
  font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 600;
}
.pill.active   { background: rgba(63,166,107,.18);  color: #8fe3b0; }
.pill.slipping { background: rgba(224,178,60,.18);  color: #f2d78a; }
.pill.cold     { background: rgba(224,123,57,.18);  color: #f5b98c; }
.pill.dormant  { background: rgba(204,59,48,.2);    color: #ff9c94; }

.d-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--green-line); }
.stat { padding: 13px 10px; text-align: center; border-right: 1px solid var(--green-line); }
.stat:last-child { border-right: 0; }
.stat-n { display: block; font-size: 1.45rem; line-height: 1; }
.stat-l { display: block; font-size: .62rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

.d-actions { display: flex; gap: 8px; padding: 12px 16px; flex-wrap: wrap; border-bottom: 1px solid var(--green-line); }
.d-actions a {
  flex: 1 1 auto; text-align: center; padding: 9px 12px; border-radius: 7px;
  background: var(--green-lift); border: 1px solid var(--green-line);
  color: var(--bone); text-decoration: none; font-size: .78rem; font-weight: 500;
}
.d-actions a:hover { border-color: var(--brass); color: var(--brass); }

.d-block { padding: 14px 18px; border-bottom: 1px solid var(--green-line); }
.d-block h3 {
  margin: 0 0 9px; font-size: .68rem; letter-spacing: .13em; text-transform: uppercase;
  color: var(--brass); font-weight: 600;
}
.hours { margin: 0; font-size: .8rem; line-height: 1.75; color: var(--muted); }
.hours li { list-style: none; display: flex; justify-content: space-between; gap: 12px; }
.hours li.today { color: var(--bone); font-weight: 600; }
.kv { margin: 0; font-size: .8rem; line-height: 1.7; }
.kv div { display: flex; justify-content: space-between; gap: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; }
.prods { margin: 0; padding-left: 16px; font-size: .78rem; line-height: 1.6; color: var(--muted); }
.note { font-size: .76rem; color: var(--muted); line-height: 1.5; margin: 0; }
.note.bad { color: #ff9c94; }

/* ── Map bits ────────────────────────────────────────────────────────────── */
.gm-style .iw-card { font-family: Inter, sans-serif; min-width: 180px; }
.iw-card b { display: block; font-size: .9rem; margin-bottom: 2px; }
.iw-card span { font-size: .78rem; color: #5c6b68; }
.iw-card button {
  margin-top: 8px; width: 100%; padding: 6px 10px; border-radius: 6px; cursor: pointer;
  border: 1px solid #032626; background: #032626; color: #f4f1e8; font: inherit; font-size: .76rem;
}

#panel-toggle { display: none; }

/* ── Phone ───────────────────────────────────────────────────────────────── */
@media (max-width: 880px) {
  body.app { grid-template-columns: 1fr; grid-template-rows: 1fr; position: relative; }
  #map { height: 100dvh; }
  #panel, #detail {
    position: absolute;
    inset: auto 0 0 0;
    width: auto;
    height: 72dvh;
    border-right: 0;
    border-top: 1px solid var(--green-line);
    border-radius: 14px 14px 0 0;
    box-shadow: 0 -12px 34px rgba(0, 0, 0, .4);
    z-index: 6;
    transform: translateY(calc(100% - 0px));
    transition: transform .22s ease;
  }
  body.app.panel-open #panel { transform: none; }
  #detail { transform: none; }
  #panel-toggle {
    display: block;
    position: absolute;
    right: 14px;
    bottom: 22px;
    z-index: 7;
    padding: 11px 20px;
    border-radius: 999px;
    border: 1px solid var(--green-line);
    background: var(--green);
    color: var(--bone);
    font: inherit;
    font-weight: 600;
    font-size: .82rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
    cursor: pointer;
  }
  body.app.panel-open #panel-toggle { bottom: calc(72dvh + 14px); }
}

/* Accounts that trade but have no location record — a data gap, not a pin. */
.orphan-note {
  display: block;
  width: 100%;
  text-align: left;
  appearance: none;
  border: 0;
  border-bottom: 1px solid var(--green-line);
  background: rgba(202, 176, 45, .1);
  color: var(--brass);
  font: inherit;
  font-size: .74rem;
  line-height: 1.4;
  padding: 9px 16px;
  cursor: pointer;
}
.orphan-note:hover { background: rgba(202, 176, 45, .18); }
