/* =====================================================================
   Icon Casa Properties — Viewing Booking System
   Shared design system
   ===================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Archivo:wght@400;500;600;700&display=swap');

:root{
  color-scheme: light dark;

  /* -- tokens (light) -- */
  --ink:        #17181d;
  --ink-soft:   #43413c;
  --muted:      #706c63;
  --paper:      #faf8f4;
  --surface:    #ffffff;
  --surface-2:  #f2efe7;
  --line:       #e4e0d5;
  --line-soft:  #edeae0;

  --accent:      #9c7a45;
  --accent-ink:  #6e5630;
  --accent-tint: #f2e9d8;

  --success:      #3f7d58;
  --success-tint: #e4f0e7;
  --warning:      #b67816;
  --warning-tint: #f8ecd8;
  --danger:       #b23a34;
  --danger-tint:  #f6e2e0;
  --info:         #3a6ea5;
  --info-tint:    #e4edf6;

  --shadow-sm: 0 1px 2px rgba(23,24,29,.06), 0 1px 1px rgba(23,24,29,.04);
  --shadow-md: 0 6px 20px rgba(23,24,29,.08), 0 2px 6px rgba(23,24,29,.05);
  --shadow-lg: 0 20px 48px rgba(23,24,29,.16), 0 4px 12px rgba(23,24,29,.08);

  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 22px;

  --font-display: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --font-body: 'Archivo', 'Helvetica Neue', Arial, sans-serif;
}

@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --ink:        #f1ede4;
    --ink-soft:   #d9d4c8;
    --muted:      #a19c8f;
    --paper:      #131318;
    --surface:    #1b1c22;
    --surface-2:  #22232a;
    --line:       #303138;
    --line-soft:  #292a30;

    --accent:      #cdac6e;
    --accent-ink:  #e9d9ae;
    --accent-tint: #362d1c;

    --success:      #6bb886;
    --success-tint: #16281d;
    --warning:      #e3ab52;
    --warning-tint: #332512;
    --danger:       #e2716b;
    --danger-tint:  #331c1a;
    --info:         #7aa8d6;
    --info-tint:    #182430;

    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 6px 20px rgba(0,0,0,.45);
    --shadow-lg: 0 20px 48px rgba(0,0,0,.55);
  }
}
:root[data-theme="dark"]{
  --ink:        #f1ede4;
  --ink-soft:   #d9d4c8;
  --muted:      #a19c8f;
  --paper:      #131318;
  --surface:    #1b1c22;
  --surface-2:  #22232a;
  --line:       #303138;
  --line-soft:  #292a30;

  --accent:      #cdac6e;
  --accent-ink:  #e9d9ae;
  --accent-tint: #362d1c;

  --success:      #6bb886;
  --success-tint: #16281d;
  --warning:      #e3ab52;
  --warning-tint: #332512;
  --danger:       #e2716b;
  --danger-tint:  #331c1a;
  --info:         #7aa8d6;
  --info-tint:    #182430;
}

*, *::before, *::after{ box-sizing:border-box; }
html, body{ height:100%; }
body{
  margin:0;
  background:var(--paper);
  color:var(--ink);
  font-family:var(--font-body);
  font-size:15px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  /* When opened as a Home Screen app on iOS, content otherwise renders
     underneath the status bar / camera cutout — this pushes everything
     down by the device's actual safe-area inset (0 in a normal browser
     tab, so this has no effect there). */
  padding-top:env(safe-area-inset-top);
}
img{ max-width:100%; display:block; }
a{ color:inherit; }
button, input, select, textarea{ font-family:inherit; font-size:inherit; color:inherit; }
[hidden]{ display:none !important; }

h1,h2,h3,h4{
  font-family:var(--font-display);
  font-weight:600;
  line-height:1.15;
  margin:0 0 .3em;
  text-wrap:balance;
}
h1{ font-size:clamp(28px,4vw,40px); }
h2{ font-size:clamp(20px,2.6vw,26px); }
h3{ font-size:18px; }
p{ margin:0 0 1em; color:var(--ink-soft); }
.eyebrow{
  font-family:var(--font-body);
  font-size:11.5px;
  font-weight:700;
  letter-spacing:.11em;
  text-transform:uppercase;
  color:var(--accent-ink);
}

/* ---------- layout helpers ---------- */
.wrap{ max-width:1120px; margin:0 inline auto; padding-inline:24px; }
.wrap{ margin-left:auto; margin-right:auto; }
.stack{ display:flex; flex-direction:column; }
.center-col{ max-width:640px; margin:0 auto; padding-inline:20px; }

/* ---------- top bar / brand ---------- */
.topbar{
  display:flex; align-items:center; justify-content:space-between; gap:10px;
  padding:18px 24px;
  border-bottom:1px solid var(--line);
  background:var(--surface);
}
.topbar > a.btn, .topbar > button{ flex:0 0 auto; }
.topbar > div{ flex:1 1 auto; min-width:0; } /* the back-btn + brand wrapper, when present, needs room to shrink */
.brand{ display:flex; align-items:center; gap:12px; text-decoration:none; min-width:0; }
.brand img{ height:34px; width:auto; flex:0 0 auto; }
.brand > span{ min-width:0; }
.brand-name, .brand-sub{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.brand-name{ font-family:var(--font-display); font-weight:600; font-size:16px; letter-spacing:.01em; }
.brand-sub{ font-size:11px; color:var(--muted); letter-spacing:.08em; text-transform:uppercase; margin-top:1px; }
@media (max-width:420px){
  .brand-sub{ display:none; }
  .brand-name{ font-size:14.5px; }
}

/* Opened as a Home Screen app, there's no browser back button at all —
   this gives the client an obvious way to go back a page. */
.icon-back-btn{
  display:inline-flex; align-items:center; justify-content:center; flex:0 0 auto;
  width:36px; height:36px; border-radius:999px; border:1px solid var(--line);
  background:var(--surface); color:var(--ink); cursor:pointer; font-size:18px; line-height:1;
  padding:0; transition:background .12s ease, transform .12s ease;
}
.icon-back-btn:hover{ background:var(--surface-2); }
.icon-back-btn:active{ transform:scale(.92); }

/* ---------- buttons ---------- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  padding:12px 20px; border-radius:999px; border:1px solid transparent;
  font-weight:600; font-size:14.5px; cursor:pointer;
  transition:transform .12s ease, box-shadow .12s ease, background .12s ease, border-color .12s ease;
  text-decoration:none;
  white-space:nowrap;
}
.btn:active{ transform:scale(.97); }
.btn:focus-visible{ outline:2px solid var(--accent); outline-offset:2px; }
.btn-primary{ background:var(--ink); color:var(--paper); }
.btn-primary:hover{ box-shadow:var(--shadow-md); }
:root[data-theme="dark"] .btn-primary, @media (prefers-color-scheme:dark){ }
.btn-accent{ background:var(--accent); color:#1b1305; }
.btn-accent:hover{ box-shadow:var(--shadow-md); }
.btn-outline{ background:transparent; border-color:var(--line); color:var(--ink); }
.btn-outline:hover{ border-color:var(--accent); }
.btn-ghost{ background:transparent; color:var(--ink-soft); padding:10px 14px; }
.btn-ghost:hover{ background:var(--surface-2); }
.btn-danger{ background:var(--danger-tint); color:var(--danger); }
.btn-sm{ padding:8px 14px; font-size:13px; }
.btn-block{ width:100%; }
.btn[disabled]{ opacity:.5; cursor:not-allowed; }

/* ---------- forms ---------- */
label{ display:block; font-size:13px; font-weight:600; margin-bottom:6px; color:var(--ink-soft); }
.field{ margin-bottom:16px; }
.hint{ font-size:12px; color:var(--muted); margin-top:5px; }
input[type=text], input[type=tel], input[type=number], input[type=date],
input[type=password], input[type=email], select, textarea{
  width:100%; padding:12px 14px; border-radius:var(--radius-sm);
  border:1px solid var(--line); background:var(--surface); color:var(--ink);
  outline:none; transition:border-color .12s ease, box-shadow .12s ease;
}
textarea{ resize:vertical; min-height:80px; }
input:focus, select:focus, textarea:focus{
  border-color:var(--accent); box-shadow:0 0 0 3px var(--accent-tint);
}
.row-2{ display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.req::after{ content:" *"; color:var(--danger); }

/* ---------- cards ---------- */
.card{
  background:var(--surface); border:1px solid var(--line);
  border-radius:var(--radius-md); box-shadow:var(--shadow-sm);
}
.card-pad{ padding:22px; }

/* ---------- badges / pills ---------- */
.pill{
  display:inline-flex; align-items:center; gap:6px;
  padding:4px 11px; border-radius:999px; font-size:12px; font-weight:600;
}
.pill-success{ background:var(--success-tint); color:var(--success); }
.pill-warning{ background:var(--warning-tint); color:var(--warning); }
.pill-danger{ background:var(--danger-tint); color:var(--danger); }
.pill-info{ background:var(--info-tint); color:var(--info); }
.pill-neutral{ background:var(--surface-2); color:var(--muted); }
.dot{ width:7px; height:7px; border-radius:50%; background:currentColor; }

/* ---------- date strip ---------- */
.date-strip{
  display:flex; gap:8px; overflow-x:auto; padding:4px 2px 12px;
  scrollbar-width:thin;
}
.date-chip{
  flex:0 0 auto; width:66px; padding:10px 4px; border-radius:14px;
  border:1px solid var(--line); background:var(--surface); text-align:center;
  cursor:pointer; transition:all .12s ease;
}
.date-chip .dow{ font-size:10.5px; letter-spacing:.06em; color:var(--muted); text-transform:uppercase; }
.date-chip .dom{ font-family:var(--font-display); font-size:19px; font-weight:600; margin-top:2px; }
.date-chip .mon{ font-size:10px; color:var(--muted); }
.date-chip.selected{ background:var(--ink); border-color:var(--ink); color:var(--paper); }
.date-chip.selected .dow, .date-chip.selected .mon{ color:var(--paper); opacity:.7; }
.date-chip.disabled{ opacity:.35; cursor:not-allowed; }

/* ---------- slot grid ---------- */
.slot-grid{ display:grid; grid-template-columns:repeat(auto-fill, minmax(92px,1fr)); gap:9px; }
.slot{
  padding:11px 8px; border-radius:10px; border:1px solid var(--line);
  background:var(--surface); text-align:center; font-weight:600; font-size:13.5px;
  cursor:pointer; font-variant-numeric:tabular-nums; transition:all .12s ease;
}
.slot:hover{ border-color:var(--accent); }
.slot.selected{ background:var(--accent); border-color:var(--accent); color:#1b1305; }
.slot.taken{ opacity:.32; text-decoration:line-through; cursor:not-allowed; background:var(--surface-2); }
.slot.lunch{ display:none; }

/* ---------- steps ---------- */
.steps{ display:flex; gap:6px; margin-bottom:22px; }
.steps .seg{ flex:1; height:4px; border-radius:99px; background:var(--line); }
.steps .seg.done{ background:var(--accent); }

/* ---------- always-open notifications rail ---------- */
.notif-rail{
  background:var(--surface); border-left:1px solid var(--line);
  display:flex; flex-direction:column; min-height:100vh; position:sticky; top:env(safe-area-inset-top,0px); align-self:start;
}
.notif-rail-head{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:18px 16px 14px; border-bottom:1px solid var(--line);
}
.notif-rail-head strong{ font-size:14px; }
.notif-list{ overflow-y:auto; flex:1; padding:6px 0; }
.notif-empty{ text-align:center; padding:40px 18px; color:var(--muted); font-size:13px; }
.notif-row{
  position:relative; display:flex; align-items:flex-start; gap:10px;
  padding:12px 16px 12px 22px; border-bottom:1px solid var(--line-soft);
  cursor:pointer; border-left:3px solid transparent;
}
.notif-row:hover{ background:var(--surface-2); }
.notif-row.unread{ background:var(--accent-tint); }
.notif-row.nr-booked{ border-left-color:var(--success); }
.notif-row.nr-amended{ border-left-color:var(--warning); }
.notif-row.nr-cancelled{ border-left-color:var(--danger); }
.notif-row .nr-dot{
  position:absolute; top:16px; left:8px; width:8px; height:8px; border-radius:50%;
  background:var(--danger);
}
.notif-row .nr-dot.hide{ display:none; }
.notif-row .nr-body{ flex:1; min-width:0; }
.notif-row .nr-label{ font-size:10.5px; font-weight:700; letter-spacing:.04em; text-transform:uppercase; color:var(--muted); margin-bottom:3px; }
.notif-row .nr-msg{ font-size:13px; font-weight:600; line-height:1.4; }
.notif-row .nr-time{ font-size:11px; color:var(--muted); margin-top:4px; }

/* ---------- admin shell ---------- */
.admin-shell{ display:grid; grid-template-columns:220px 1fr 300px; min-height:100vh; }
.admin-nav{ background:var(--surface); border-right:1px solid var(--line); padding:20px 14px; display:flex; flex-direction:column; gap:4px; }
.admin-nav a{ display:flex; align-items:center; gap:10px; padding:10px 12px; border-radius:10px; text-decoration:none; color:var(--ink-soft); font-weight:600; font-size:13.5px; }
.admin-nav a:hover{ background:var(--surface-2); }
.admin-nav a.active{ background:var(--ink); color:var(--paper); }
.admin-main{ padding:26px 30px 60px; max-width:1180px; }
.admin-topline{ display:flex; align-items:center; justify-content:space-between; margin-bottom:22px; gap:12px; flex-wrap:wrap; }

.tabs{ display:flex; gap:6px; background:var(--surface-2); padding:4px; border-radius:12px; width:fit-content; }
.tabs button{ border:none; background:transparent; padding:8px 16px; border-radius:9px; font-weight:600; font-size:13px; cursor:pointer; color:var(--muted); }
.tabs button.active{ background:var(--surface); color:var(--ink); box-shadow:var(--shadow-sm); }

/* ---------- calendar (month view) ---------- */
.cal-head{ display:flex; align-items:center; justify-content:space-between; margin-bottom:14px; }
.cal-grid{ display:grid; grid-template-columns:repeat(7,1fr); gap:8px; }
.cal-dow{ text-align:center; font-size:11px; font-weight:700; letter-spacing:.06em; color:var(--muted); text-transform:uppercase; padding-bottom:4px; }
.cal-cell{
  min-height:92px; border-radius:12px; border:1px solid var(--line); background:var(--surface);
  padding:8px; cursor:pointer; transition:border-color .12s ease;
  display:flex; flex-direction:column; gap:4px;
}
.cal-cell:hover{ border-color:var(--accent); }
.cal-cell.out{ opacity:.35; }
.cal-cell.today{ border-color:var(--accent); box-shadow:0 0 0 2px var(--accent-tint) inset; }
.cal-cell .dnum{ font-family:var(--font-display); font-weight:600; font-size:15px; }
.cal-cell .count{ font-size:11px; color:var(--muted); }
.cal-cell .mini-dots{ display:flex; gap:3px; flex-wrap:wrap; margin-top:auto; }
.cal-cell .mini-dots span{ width:6px; height:6px; border-radius:50%; }

/* ---------- day list ---------- */
.booking-row{
  display:flex; align-items:center; gap:14px; padding:14px 16px; border:1px solid var(--line);
  border-radius:12px; background:var(--surface); cursor:pointer; margin-bottom:9px;
}
.booking-row:hover{ border-color:var(--accent); }
.booking-time{ font-family:var(--font-display); font-weight:600; font-size:15px; width:64px; flex:0 0 auto; font-variant-numeric:tabular-nums; }
.booking-main{ flex:1; min-width:0; }
.booking-main .nm{ font-weight:700; }
.booking-main .sub{ font-size:12.5px; color:var(--muted); }

/* ---------- modal / drawer ---------- */
.modal-backdrop{ position:fixed; inset:0; background:rgba(15,14,10,.45); z-index:70; display:flex; align-items:flex-end; justify-content:center; }
@media(min-width:720px){ .modal-backdrop{ align-items:center; } }
.modal{
  background:var(--surface); width:100%; max-width:560px; max-height:92vh; overflow-y:auto;
  border-radius:20px 20px 0 0; box-shadow:var(--shadow-lg); padding:26px;
}
@media(min-width:720px){ .modal{ border-radius:20px; } }
.modal-close{ float:right; background:none; border:none; font-size:20px; cursor:pointer; color:var(--muted); }

/* ---------- read-only booking detail grid ---------- */
.detail-grid{ display:grid; grid-template-columns:1fr 1fr; gap:12px 18px; }
.detail-item .detail-label{ display:block; font-size:10.5px; font-weight:700; letter-spacing:.05em; text-transform:uppercase; color:var(--muted); margin-bottom:2px; }
.detail-item div:not(.detail-label){ font-size:14px; font-weight:600; word-break:break-word; }
@media (max-width:520px){ .detail-grid{ grid-template-columns:1fr; } }

/* ---------- settings ---------- */
.settings-block{ margin-bottom:30px; }
.day-row{ display:grid; grid-template-columns:110px 90px 1fr 1fr 1fr; gap:10px; align-items:center; padding:8px 0; border-bottom:1px solid var(--line-soft); }
.day-row label{ margin:0; }
.chip-list{ display:flex; flex-wrap:wrap; gap:8px; }
.chip{ display:flex; align-items:center; gap:8px; padding:7px 8px 7px 14px; border-radius:999px; background:var(--surface-2); font-size:13px; font-weight:600; }
.chip button{ background:none; border:none; cursor:pointer; color:var(--muted); font-size:15px; line-height:1; padding:2px; }

/* ---------- misc ---------- */
.divider{ height:1px; background:var(--line); margin:22px 0; border:none; }
.empty{ text-align:center; padding:50px 20px; color:var(--muted); }
.spinner{ width:20px; height:20px; border-radius:50%; border:2.5px solid var(--line); border-top-color:var(--accent); animation:spin .7s linear infinite; }
@keyframes spin{ to{ transform:rotate(360deg);} }
.toast{
  position:fixed; bottom:22px; left:50%; transform:translateX(-50%);
  background:var(--ink); color:var(--paper); padding:13px 22px; border-radius:999px;
  font-size:13.5px; font-weight:600; box-shadow:var(--shadow-lg); z-index:90;
  opacity:0; pointer-events:none; transition:opacity .2s ease, transform .2s ease;
}
.toast.show{ opacity:1; transform:translateX(-50%) translateY(-4px); }

@media (max-width:760px){
  .admin-shell{ grid-template-columns:1fr; }
  .admin-nav{
    flex-direction:row; align-items:center; flex-wrap:nowrap;
    overflow-x:auto; overflow-y:hidden; -webkit-overflow-scrolling:touch;
    border-right:none; border-bottom:1px solid var(--line);
    position:sticky; top:env(safe-area-inset-top,0px); background:var(--surface); z-index:20;
  }
  /* Without this, the nav links/logo shrink to fit and their text wraps
     onto a second line instead of the bar simply scrolling sideways —
     that's what caused the squashed, overlapping-looking header after
     sliding the nav and switching tabs. */
  .admin-nav > *{ flex:0 0 auto; }
  .admin-nav a{ white-space:nowrap; }
  .admin-nav .brand{ margin-bottom:0 !important; }
  .admin-main{ padding:18px 16px 60px; }
  .row-2{ grid-template-columns:1fr; }
  .day-row{ grid-template-columns:1fr 1fr; row-gap:6px; }
  .cal-cell{ min-height:64px; }
  .cal-cell .dnum{ font-size:13px; }
  .notif-rail{ position:static; min-height:0; border-left:none; border-top:1px solid var(--line); max-height:380px; }
  .notif-list{ max-height:320px; }
}
