/* Lounger Lock — establishment panel (Iteration 7).
   Mobile-first, dependency-free. Status colour lives in these tokens; cards back
   it with a dot + label so meaning never rests on colour alone. */

:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --text: #1f2430;
  --muted: #6b7280;
  --border: #e4e7ec;
  --primary: #2563eb;
  --primary-ink: #ffffff;
  --radius: 14px;
  --radius-sm: 9px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 8px 24px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 40px rgba(16, 24, 40, .18);

  /* status palette: solid accent + soft tint */
  --available: #16a34a;  --available-bg: #e8f7ee;
  --rented:    #dc2626;  --rented-bg:    #fdeaea;
  --grace:     #eab308;  --grace-bg:     #fef6db;
  --out:       #6b7280;  --out-bg:       #f1f2f4;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1115;
    --surface: #171a21;
    --text: #e6e8ec;
    --muted: #9aa1ad;
    --border: #262b34;
    --primary: #4b8bff;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35);
    --shadow-lg: 0 12px 40px rgba(0,0,0,.55);
    --available-bg: #11271b; --rented-bg: #2a1414; --grace-bg: #2a2010; --out-bg: #1c2027;
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---------- buttons ---------- */
.btn {
  appearance: none;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: .6rem 1rem;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
}
.btn:active { transform: translateY(1px); }
.btn--primary { background: var(--primary); color: var(--primary-ink); }
.btn--primary:hover { filter: brightness(1.05); }
.btn--ghost { background: transparent; border-color: var(--border); color: var(--text); }
.btn--ghost:hover { background: var(--bg); }
.btn--block { width: 100%; margin-top: .25rem; }

.link { color: var(--primary); text-decoration: none; font-weight: 600; }
.link:hover { text-decoration: underline; }

/* ---------- form fields ---------- */
.field { display: flex; flex-direction: column; gap: .35rem; margin-bottom: 1rem; }
.field__label { font-size: .8rem; font-weight: 600; color: var(--muted); }
.field input, .field textarea {
  width: 100%;
  padding: .6rem .7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font: inherit;
}
.field input:focus, .field textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 25%, transparent);
}
.field textarea { resize: vertical; }
.field__error { color: var(--rented); font-size: .8rem; }
.field__hint { color: var(--muted); font-size: .75rem; }

/* ---------- auth (login / activate) ---------- */
.auth { min-height: 100dvh; display: grid; place-items: center; padding: 1.25rem; }
.auth__card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
}
.auth__brand { margin: 0 0 .15rem; font-size: 1.5rem; letter-spacing: -.02em; }
.auth__logo { display: block; width: 100%; max-width: 320px; margin: 0 auto 1.25rem; }
.auth__logo img { display: block; width: 100%; height: auto; }
.auth__sub { margin: 0 0 1.25rem; color: var(--muted); }
.auth__note { margin: 0 0 1.25rem; color: var(--muted); font-size: .92rem; }
.auth__error {
  margin: 0 0 1rem; padding: .6rem .75rem;
  background: var(--rented-bg); color: var(--rented);
  border-radius: var(--radius-sm); font-size: .9rem;
}

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; flex-wrap: wrap;
  padding: .75rem 1rem;
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar__brand { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.topbar__logo { display: block; height: 40px; max-width: 200px; }
.topbar__logo img { height: 100%; width: auto; max-width: 100%; object-fit: contain; display: block; }
.topbar__est { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar__user { display: flex; align-items: center; gap: .75rem; }
.topbar__email { color: var(--muted); font-size: .85rem; }
@media (max-width: 480px) { .topbar__email { display: none; } }

/* ---------- board ---------- */
.board-wrap { max-width: 1100px; margin: 0 auto; padding: 1rem; }

.counts {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
  gap: .6rem;
  margin-bottom: 1.1rem;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--muted);
  border-radius: var(--radius-sm);
  padding: .6rem .8rem;
  box-shadow: var(--shadow);
  display: flex; flex-direction: column;
}
.stat__num { font-size: 1.5rem; font-weight: 700; line-height: 1.1; }
.stat__label { font-size: .75rem; color: var(--muted); }
.stat--available { border-left-color: var(--available); }
.stat--rented    { border-left-color: var(--rented); }
.stat--grace     { border-left-color: var(--grace); }
.stat--out       { border-left-color: var(--out); }
.stat--total     { border-left-color: var(--primary); }

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: .7rem;
}

/* cards (the whole card is a <button>) */
.card {
  text-align: left;
  cursor: pointer;
  border: 1px solid var(--border);
  border-top: 4px solid var(--out);
  border-radius: var(--radius-sm);
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: .8rem .85rem;
  min-height: 84px;
  display: flex; flex-direction: column; justify-content: space-between; gap: .5rem;
  font: inherit; color: var(--text);
  transition: transform .06s ease, box-shadow .15s ease;
}
.card:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.card:focus-visible { outline: 3px solid color-mix(in srgb, var(--primary) 45%, transparent); outline-offset: 2px; }
.card__name { font-weight: 700; letter-spacing: -.01em; word-break: break-word; }
.card__status { display: inline-flex; align-items: center; gap: .4rem; font-size: .82rem; color: var(--muted); }
.dot { width: .6rem; height: .6rem; border-radius: 50%; background: var(--out); flex: none; }

.card.is-available { border-top-color: var(--available); background: var(--available-bg); }
.card.is-available .dot { background: var(--available); }
.card.is-rented    { border-top-color: var(--rented);    background: var(--rented-bg); }
.card.is-rented .dot { background: var(--rented); }
.card.is-grace     { border-top-color: var(--grace);     background: var(--grace-bg); }
.card.is-grace .dot { background: var(--grace); }
.card.is-out       { border-top-color: var(--out);       background: var(--out-bg); opacity: .85; }
.card.is-out .dot  { background: var(--out); }

.empty { color: var(--muted); text-align: center; padding: 3rem 1rem; }

/* ---------- modal ---------- */
.modal { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 1rem; }
.modal__backdrop { position: absolute; inset: 0; background: rgba(16, 24, 40, .5); }
.modal__dialog {
  position: relative;
  width: 100%;
  max-width: 420px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 1.4rem;
  animation: modal-in .12s ease-out;
}
@keyframes modal-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.modal__title { margin: 0 0 1rem; font-size: 1.15rem; }
.modal__actions { display: flex; justify-content: flex-end; gap: .6rem; margin-top: .5rem; }
