/* =========================================================
 * Aquozy admin styles — chunk 3
 * Brand: primary #244572, accent #5FA9C9, soft bg #F5F7FA
 * ========================================================= */

:root {
  --primary: #244572;
  --primary-dark: #1a3559;
  --accent: #5FA9C9;
  --accent-soft: #cbe5f0;
  --bg: #FFFFFF;
  --bg-soft: #F5F7FA;
  --bg-page: #f0f3f7;
  --text: #2B2B2B;
  --muted: #6b7585;
  --line: #e6ecf2;
  --line-strong: #d6dee8;
  --success: #2f8f53;
  --success-soft: #e6f6ec;
  --danger: #c93838;
  --danger-soft: #fbe9e9;
  --warning: #b48008;
  --warning-soft: #fff5e0;
  --info: #5FA9C9;
  --info-soft: #e6f3f9;
  --radius: 12px;
  --radius-sm: 8px;
  --radius-pill: 999px;
  --shadow-sm: 0 1px 3px rgba(20,42,71,.06);
  --shadow: 0 6px 22px rgba(20,42,71,.10);
  --sidebar-w: 240px;
  --topbar-h: 56px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: 'Manrope', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg-page);
  color: var(--text);
  line-height: 1.55;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .9em; background: var(--bg-soft); padding: 1px 6px; border-radius: 4px; color: var(--primary); }

/* ---------- App shell ---------- */
.admin-shell { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  background: var(--primary); color: #fff;
  display: flex; align-items: center; padding: 0 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,.08);
}
.topbar .brand { display: flex; align-items: center; font-weight: 700; color: #fff; text-decoration: none; }
.topbar .brand-img { height: 26px; width: auto; display: block; }
/* legacy text-mark fallback */
.topbar .brand-mark {
  width: 30px; height: 30px; border-radius: 7px; background: rgba(255,255,255,.14);
  display: grid; place-items: center; color: #fff; font-family: 'Fraunces', Georgia, serif;
  font-size: 17px; font-weight: 700; margin-right: 10px;
}
.topbar .brand-name { font-family: 'Fraunces', Georgia, serif; font-size: 18px; letter-spacing: -.01em; margin-left: 10px; }
.topbar .brand-tag { color: rgba(255,255,255,.6); font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; padding-left: 12px; margin-left: 12px; border-left: 1px solid rgba(255,255,255,.22); }
.topbar .right { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .92rem; }
.topbar .right .who { color: rgba(255,255,255,.78); font-weight: 500; }
.topbar .right .who strong { color: #fff; font-weight: 600; }
.topbar .right .logout-btn {
  background: rgba(255,255,255,.10); color: #fff; border: 0; padding: 7px 14px;
  border-radius: 7px; font-size: .87rem; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.topbar .right .logout-btn:hover { background: rgba(255,255,255,.18); }
.sidebar-toggle {
  display: none; background: transparent; border: 0; color: #fff; padding: 8px;
  cursor: pointer; margin-right: 10px;
}
.sidebar-toggle svg { width: 22px; height: 22px; }

.body-wrap { display: flex; flex: 1; min-height: 0; }
.sidebar {
  width: var(--sidebar-w); background: #fff; border-right: 1px solid var(--line);
  padding: 22px 14px; flex-shrink: 0;
  position: sticky; top: var(--topbar-h); align-self: flex-start;
  height: calc(100vh - var(--topbar-h)); overflow-y: auto;
}
.sidebar .nav-section { font-size: .68rem; font-weight: 700; color: var(--muted);
  text-transform: uppercase; letter-spacing: .12em; padding: 16px 12px 8px; }
.sidebar a {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 9px; color: var(--text);
  font-weight: 500; font-size: .94rem; margin-bottom: 2px;
  transition: background .12s, color .12s;
}
.sidebar a:hover { background: var(--bg-soft); color: var(--primary); }
.sidebar a.active { background: var(--primary); color: #fff; }
.sidebar a.active .badge { background: rgba(255,255,255,.22); color: #fff; }
.sidebar a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar .badge {
  margin-left: auto; background: var(--accent); color: #fff;
  padding: 1px 8px; border-radius: var(--radius-pill);
  font-size: .72rem; font-weight: 700;
}
.sidebar .disabled { color: var(--muted); cursor: not-allowed; }
.sidebar .disabled:hover { background: transparent; color: var(--muted); }
.sidebar .disabled .small { color: var(--muted); font-size: .7rem; font-weight: 600;
  margin-left: auto; padding: 1px 7px; background: var(--bg-soft); border-radius: 999px; }

.main {
  flex: 1; min-width: 0;
  padding: 26px 28px;
}
@media (max-width: 900px) {
  .sidebar-toggle { display: inline-flex; align-items: center; }
  .sidebar { position: fixed; top: var(--topbar-h); left: 0; bottom: 0; z-index: 40;
    transform: translateX(-100%); transition: transform .2s; box-shadow: 0 0 30px rgba(0,0,0,.15); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open::after { content: ''; position: fixed; inset: var(--topbar-h) 0 0 var(--sidebar-w);
    background: rgba(0,0,0,.4); z-index: 39; }
  .main { padding: 20px 18px; }
}

/* ---------- Page head ---------- */
.back-link { display: inline-block; color: var(--muted); text-decoration: none; font-size: .88rem; margin-bottom: 6px; }
.back-link:hover { color: var(--primary); }
.page-head { margin-bottom: 22px; }
.page-head h1 { font-family: 'Fraunces', Georgia, serif; font-weight: 700; color: var(--primary);
  font-size: 1.6rem; line-height: 1.2; letter-spacing: -.01em; margin-bottom: 6px; }
.page-head .page-sub { color: var(--muted); font-size: .94rem; max-width: 720px; }
.page-head .actions { margin-top: 12px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Cards ---------- */
.card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 22px 24px; box-shadow: var(--shadow-sm);
}
.card h2 { color: var(--primary); font-size: 1.05rem; margin-bottom: 12px; font-weight: 700; }
.card h3 { color: var(--primary); font-size: .98rem; margin-bottom: 10px; font-weight: 700; }
.card .muted { color: var(--muted); }

.cards-stack > * + * { margin-top: 18px; }
.grid-2 { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid-2 { grid-template-columns: 2fr 1fr; } }

/* ---------- Stat cards ---------- */
.stats-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 22px; }
.stat-card {
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px 20px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column;
}
.stat-card .label { color: var(--muted); font-size: .78rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .06em; }
.stat-card .number { font-size: 2rem; font-weight: 800; color: var(--primary);
  letter-spacing: -.02em; line-height: 1.1; margin-top: 4px; }
.stat-card .sub { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.stat-card.is-warn { border-left: 3px solid var(--warning); }
.stat-card.is-success { border-left: 3px solid var(--success); }
.stat-card.is-info { border-left: 3px solid var(--info); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 10px 18px; border-radius: 8px;
  font-weight: 600; font-size: .92rem; cursor: pointer; border: 0;
  background: var(--primary); color: #fff; transition: background .12s, color .12s, box-shadow .12s;
  text-decoration: none; font-family: inherit;
}
.btn:hover { background: var(--primary-dark); color: #fff; }
.btn:active { transform: translateY(1px); }
.btn-sm { padding: 7px 13px; font-size: .85rem; }
.btn-lg { padding: 13px 24px; font-size: 1rem; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); color: #fff; }
.btn-accent { background: var(--accent); color: #0b1a2e; }
.btn-accent:hover { background: #4d97b9; color: #0b1a2e; }
.btn-ghost { background: transparent; color: var(--primary); border: 1.5px solid var(--line); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); background: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { background: #a82d2d; color: #fff; }
.btn-wa { background: #25D366; color: #fff; }
.btn-wa:hover { background: #1fb957; color: #fff; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Forms ---------- */
.field { margin-bottom: 14px; }
.field label { display: block; font-size: .78rem; font-weight: 700; color: var(--muted);
  margin-bottom: 6px; text-transform: uppercase; letter-spacing: .04em; }
.field input, .field select, .field textarea {
  width: 100%; padding: 10px 12px; font: inherit; font-size: .94rem;
  background: #fff; color: var(--text);
  border: 1.5px solid var(--line); border-radius: 8px;
  transition: border-color .12s, box-shadow .12s;
  font-family: inherit;
}
.field input:focus, .field select:focus, .field textarea:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(95,169,201,.18);
}
.field textarea { min-height: 110px; resize: vertical; line-height: 1.6; }
.field .hint { font-size: .8rem; color: var(--muted); margin-top: 5px; }
.form-grid { display: grid; gap: 14px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .form-grid.cols-2 { grid-template-columns: 1fr 1fr; } .form-grid.cols-3 { grid-template-columns: repeat(3, 1fr); } .form-grid.cols-4 { grid-template-columns: repeat(4, 1fr); } }
.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 14px; align-items: center; }

.alert {
  padding: 12px 16px; border-radius: 8px; margin-bottom: 16px;
  font-size: .93rem; font-weight: 500; border: 1px solid; line-height: 1.5;
}
.alert.error   { background: var(--danger-soft);  color: var(--danger);  border-color: #f0c8c8; }
.alert.success { background: var(--success-soft); color: var(--success); border-color: #c8e8d2; }
.alert.warn    { background: var(--warning-soft); color: var(--warning); border-color: #f4dca0; }
.alert.info    { background: var(--info-soft);    color: var(--primary); border-color: #cbe5f0; }
.alert .alert-actions { margin-top: 10px; display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Status pill ---------- */
.status-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: var(--radius-pill);
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--line);
}
.status-pill::before {
  content: ''; width: 6px; height: 6px; border-radius: 50%;
  background: currentColor; display: inline-block;
}
.status-pill.s-new       { background: var(--info-soft);    color: var(--info);    border-color: #cbe5f0; }
.status-pill.s-contacted { background: var(--warning-soft); color: var(--warning); border-color: #f4dca0; }
.status-pill.s-confirmed { background: var(--success-soft); color: var(--success); border-color: #c8e8d2; }
.status-pill.s-completed { background: #e8eef6;             color: var(--primary); border-color: #c5d3e6; }
.status-pill.s-cancelled { background: #f0f1f3;             color: #6b7585;        border-color: #dde0e5; }

/* ---------- Tables ---------- */
.data-table { width: 100%; border-collapse: collapse; font-size: .92rem; }
.data-table th, .data-table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
.data-table th { font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  color: var(--muted); background: var(--bg-soft); border-bottom: 1px solid var(--line-strong); white-space: nowrap; }
.data-table tbody tr { transition: background .1s; }
.data-table tbody tr:hover { background: var(--bg-soft); }
.data-table .ref { font-weight: 700; color: var(--primary); font-family: 'Manrope', sans-serif; letter-spacing: .01em; white-space: nowrap; }
.data-table .nm { font-weight: 600; }
.data-table .row-link { color: inherit; }
.data-table .row-link:hover { color: var(--primary); }
.data-table .empty { text-align: center; color: var(--muted); padding: 36px 16px; font-style: italic; }
.data-table .nowrap { white-space: nowrap; }
.data-table-wrap { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow-sm); overflow: hidden; }
.data-table-wrap.scroll-x { overflow-x: auto; }

/* ---------- Filter bar ---------- */
.filter-bar { background: #fff; border: 1px solid var(--line); border-radius: var(--radius);
  padding: 16px 18px; margin-bottom: 18px; box-shadow: var(--shadow-sm); }
.filter-grid { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 720px) { .filter-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .filter-grid { grid-template-columns: 2fr 1fr 1fr 1fr 1fr; } }
.filter-bar .field { margin-bottom: 0; }
.filter-bar .filter-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

/* Compact single-row filter bar (used on the Customers page) */
.filter-bar-compact { padding: 14px 16px; }
.filter-bar-compact .filter-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; }
.filter-bar-compact .f-grow { flex: 1 1 240px; min-width: 200px; }
.filter-bar-compact .f-fixed { flex: 0 0 200px; }
.filter-bar-compact .f-actions { flex: 1 1 auto; }
.filter-bar-compact .f-action-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.filter-bar-compact .f-result-count { margin-left: auto; font-size: .88rem; }
@media (max-width: 600px) {
  .filter-bar-compact .f-fixed { flex: 1 1 100%; }
  .filter-bar-compact .f-result-count { margin-left: 0; }
}

/* ---------- Pagination ---------- */
.pager { display: flex; gap: 6px; justify-content: center; margin-top: 18px; flex-wrap: wrap; }
.pager a, .pager .num, .pager .ellipsis {
  padding: 7px 13px; border-radius: 7px; background: #fff; border: 1px solid var(--line);
  font-size: .88rem; font-weight: 600; color: var(--text);
}
.pager a:hover { border-color: var(--accent); color: var(--accent); background: #fff; }
.pager .num.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager .num.disabled { color: var(--muted); pointer-events: none; opacity: .5; }
.pager .ellipsis { background: transparent; border: 0; color: var(--muted); padding: 7px 4px; }
.pager-meta { text-align: center; color: var(--muted); font-size: .85rem; margin-top: 6px; }

/* ---------- Dashboard recent bookings card ---------- */
.recent-bookings .empty { padding: 28px; text-align: center; color: var(--muted); font-style: italic; }

/* ---------- Detail page ---------- */
.detail-grid { display: grid; gap: 18px; grid-template-columns: 1fr; }
@media (min-width: 1000px) { .detail-grid { grid-template-columns: 2fr 1fr; } }

.detail-row { display: grid; grid-template-columns: 130px 1fr; gap: 8px 14px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.detail-row:last-child { border-bottom: 0; }
.detail-row .lbl { color: var(--muted); font-size: .8rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .04em; padding-top: 2px; }
.detail-row .val { font-size: .96rem; color: var(--text); word-break: break-word; }
.detail-row .val a { color: var(--primary); }
.detail-row .val a:hover { color: var(--accent); }

.timeline { list-style: none; padding: 6px 0; }
.timeline li { position: relative; padding-left: 22px; padding-bottom: 14px; border-left: 2px solid var(--line); margin-left: 8px; }
.timeline li:last-child { border-left-color: transparent; padding-bottom: 4px; }
.timeline li::before {
  content: ''; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line);
}
.timeline .when { color: var(--muted); font-size: .78rem; font-weight: 600; }
.timeline .what { font-size: .92rem; margin-top: 2px; }
.timeline .who { color: var(--muted); font-size: .82rem; margin-top: 2px; }
.timeline .reason { background: var(--bg-soft); color: var(--text); padding: 6px 10px; border-radius: 6px;
  font-size: .85rem; margin-top: 6px; line-height: 1.5; }

.message-block { background: var(--bg-soft); border-radius: 8px; padding: 12px 14px; line-height: 1.6;
  white-space: pre-wrap; color: var(--text); font-size: .94rem; }

/* ---------- Quick action chips on booking detail ---------- */
.action-chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-link {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 12px; border-radius: var(--radius-pill);
  background: var(--bg-soft); border: 1px solid var(--line);
  color: var(--primary); font-size: .85rem; font-weight: 600;
  text-decoration: none;
}
.chip-link:hover { background: #fff; border-color: var(--accent); color: var(--accent); }
.chip-link.wa { background: #d6f5e0; color: #1a7a3a; border-color: #b8e9c8; }
.chip-link.wa:hover { background: #c0eecf; color: #156330; }
.chip-link svg { width: 16px; height: 16px; }

/* ---------- Auth (login) page ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--bg-page); }
.auth-card { background: #fff; border-radius: 16px; padding: 36px;
  box-shadow: 0 14px 40px rgba(20,42,71,.12); max-width: 400px; width: 100%; border: 1px solid var(--line); }
.auth-brand { font-family: 'Fraunces', Georgia, serif; font-weight: 700; font-size: 1.6rem; color: var(--primary);
  letter-spacing: -.02em; margin-bottom: 4px; }
.auth-logo { margin-bottom: 6px; }
.auth-logo img { height: 38px; width: auto; display: block; }
.auth-sub { color: var(--muted); font-size: .92rem; margin-bottom: 22px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card .btn { width: 100%; margin-top: 10px; }

/* ---------- Activity log ---------- */
.row-fail { background: rgba(220, 53, 69, 0.04); }
.details-json { background: var(--bg-soft); padding: 10px 12px; border-radius: 6px; font-size: .82rem;
  margin-top: 8px; white-space: pre-wrap; word-break: break-word; max-width: 480px; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary::after { content: ' (hide)'; }
details:not([open]) > summary::after { content: ''; }

/* ---------- Calendar / agenda ---------- */
.cal-nav { display: flex; align-items: center; gap: 8px; margin-bottom: 18px; flex-wrap: wrap; }
.cal-date-form input[type="date"] { padding: 7px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font: inherit; cursor: pointer; }
.cal-day-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 14px; padding-bottom: 12px; border-bottom: 2px solid var(--line); }
.cal-day-head h2 { font-family: 'Fraunces', Georgia, serif; color: var(--primary); font-size: 1.5rem; font-weight: 700; }
.cal-slot { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 16px 18px; margin-bottom: 14px; box-shadow: 0 1px 2px rgba(20,42,71,.04); }
.cal-slot-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; padding-bottom: 10px; border-bottom: 1px dashed var(--line); }
.cal-slot-head h3 { font-size: 1rem; color: var(--text); font-weight: 700; margin: 0; }
.cal-slot-icon { font-size: 18px; }
.cal-empty { padding: 16px 6px; font-size: .9rem; }
.cal-list { display: flex; flex-direction: column; gap: 6px; }
.cal-item { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center;
  padding: 10px 12px; background: var(--bg-soft); border-radius: 8px; text-decoration: none; color: var(--text); transition: background .15s; }
.cal-item:hover { background: rgba(95,169,201,.10); }
.cal-item-ref { font-family: ui-monospace, Menlo, monospace; font-size: .82rem; font-weight: 700; color: var(--primary); }
.cal-item-main { min-width: 0; }
.cal-item-customer { font-size: .94rem; }
.cal-item-service { font-size: .84rem; color: var(--muted); margin-top: 2px; }
@media (max-width: 600px) {
  .cal-item { grid-template-columns: 1fr; gap: 4px; }
  .cal-item-ref { font-size: .76rem; }
}

/* ---------- Settings page ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; }
@media (max-width: 760px) { .settings-grid { grid-template-columns: 1fr; } }
.settings-grid .field label { display: flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.badge-pill { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em;
  padding: 2px 8px; border-radius: 999px; background: rgba(95,169,201,.15); color: var(--accent); }
.badge-pill.muted-pill { background: var(--bg-soft); color: var(--muted); }
.status-line { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 4px; }
.status-line code { background: var(--bg-soft); padding: 1px 6px; border-radius: 4px; font-size: .82em; }

/* ---------- Misc ---------- */
.muted { color: var(--muted); }
.text-right { text-align: right; }
.nowrap { white-space: nowrap; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 14px; } .mt-4 { margin-top: 22px; }
.mb-0 { margin-bottom: 0; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 8px; vertical-align: middle; }
.dot-ok { background: var(--success); }
.dot-warn { background: var(--warning); }
.dot-err { background: var(--danger); }
.check-list { list-style: none; padding: 0; }
.check-list li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }
.check-list li:last-child { border-bottom: 0; }
.flex-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: 0; }
