:root {
  --bg: #0b0b0f;
  --panel: #14141b;
  --panel-2: #1b1a22;
  --line: rgba(255, 255, 255, 0.09);
  --text: #f8f0e6;
  --muted: #b7aa98;
  --soft: #7f7568;
  --gold: #d99b42;
  --gold-2: #ffbd67;
  --danger: #ef6b5b;
  --ok: #69d094;
  --warn: #f4bc55;
  --shadow: 0 18px 60px rgba(0, 0, 0, 0.34);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(217, 155, 66, 0.12), transparent 32rem),
    linear-gradient(180deg, #0b0b0f, #101014 45%, #09090c);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  padding-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px clamp(16px, 4vw, 32px);
  background: rgba(11, 11, 15, 0.86);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  text-decoration: none;
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid rgba(217, 155, 66, 0.45);
  background: rgba(217, 155, 66, 0.08);
  flex-shrink: 0;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(217, 155, 66, 0.55);
  border-radius: 10px;
  background: linear-gradient(145deg, rgba(217, 155, 66, 0.2), rgba(255, 255, 255, 0.03));
  color: var(--gold-2);
  font-weight: 800;
}

.brand-text {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.05;
}

.brand strong,
.brand small {
  display: block;
}

.brand strong {
  color: var(--text);
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.005em;
}

.brand small {
  margin-top: 2px;
  color: var(--gold-2);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  opacity: 0.85;
  transition: color 0.18s ease, opacity 0.18s ease;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.cloud-pill {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 11px;
  background: rgba(255, 255, 255, 0.035);
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 850;
  white-space: nowrap;
  cursor: pointer;
}

button.cloud-pill {
  font: inherit;
}

.cloud-pill.online {
  border-color: rgba(105, 208, 148, 0.38);
  color: #baf7d2;
  background: rgba(105, 208, 148, 0.09);
}

.cloud-pill.warn {
  border-color: rgba(244, 188, 85, 0.4);
  color: var(--gold-2);
  background: rgba(217, 155, 66, 0.1);
}

.backup-action {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(217, 155, 66, 0.32);
  border-radius: 8px;
  padding: 9px 12px;
  background: rgba(36, 34, 43, 0.82);
  color: var(--gold-2);
  font-weight: 850;
  cursor: pointer;
}

.backup-action:hover {
  border-color: rgba(255, 189, 103, 0.58);
  background: rgba(217, 155, 66, 0.12);
}

.sync-action {
  border-color: rgba(105, 208, 148, 0.28);
  color: #baf7d2;
}

.sync-panel {
  display: grid;
  gap: 8px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid rgba(217, 155, 66, 0.24);
  border-radius: 8px;
  background: rgba(217, 155, 66, 0.07);
}

.sync-panel--danger {
  border-color: rgba(246, 110, 93, 0.42);
  background: rgba(246, 110, 93, 0.1);
}

.auth-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 18px;
}

.auth-tabs button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted);
  font-weight: 900;
  cursor: pointer;
}

.auth-tabs button.active {
  border-color: rgba(217, 155, 66, 0.48);
  color: var(--cream);
  background: rgba(217, 155, 66, 0.14);
}

.auth-card form.auth-panel {
  display: none;
}

.auth-card form.auth-panel.active {
  display: grid;
}

.primary-action,
.button {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 0;
  border-radius: 8px;
  padding: 11px 16px;
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: #17100a;
  font-weight: 800;
  cursor: pointer;
}

.button.secondary {
  background: #24222b;
  color: var(--text);
  border: 1px solid var(--line);
}

.button.danger {
  background: rgba(239, 107, 91, 0.14);
  color: #ffd4ce;
  border: 1px solid rgba(239, 107, 91, 0.38);
}

.button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}

.main {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 20px clamp(14px, 4vw, 32px) 32px;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin: 10px 0 18px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--gold-2);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.74rem;
  font-weight: 800;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.12;
}

h1 {
  font-size: clamp(2rem, 7vw, 4.5rem);
}

h2 {
  font-size: clamp(1.35rem, 5vw, 2.1rem);
}

h3 {
  font-size: 1.02rem;
}

.muted {
  color: var(--muted);
}

.grid {
  display: grid;
  gap: 12px;
}

.metric-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card,
.metric,
.form-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.015));
  box-shadow: var(--shadow);
}

.metric {
  padding: 14px;
}

.metric--hero {
  min-height: 132px;
  padding: 18px;
  border-color: rgba(217, 155, 66, 0.22);
  background:
    linear-gradient(145deg, rgba(217, 155, 66, 0.11), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.018));
}

.metric--warn {
  border-color: rgba(244, 188, 85, 0.28);
  background:
    linear-gradient(145deg, rgba(244, 188, 85, 0.11), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.016));
}

.metric--tax {
  border-color: rgba(255, 189, 103, 0.32);
}

.metric span {
  color: var(--muted);
  font-size: 0.78rem;
}

.metric strong {
  display: block;
  margin-top: 7px;
  font-size: 1.28rem;
}

.metric--hero > strong {
  margin-top: 10px;
  color: var(--text);
  font-size: clamp(1.7rem, 4vw, 2.35rem);
}

.metric-breakdown {
  display: grid;
  gap: 9px;
}

.metric-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
}

.metric-row small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.metric-row strong {
  margin-top: 0;
  font-size: 1.05rem;
  text-align: right;
}

.metric--hero .metric-row strong {
  font-size: clamp(1.15rem, 2.5vw, 1.45rem);
}

.command-center {
  display: grid;
  gap: 12px;
  margin: 18px 0;
}

.command-center {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.insight-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.012)),
    rgba(255, 255, 255, 0.015);
  box-shadow: var(--shadow);
}

.insight-card {
  min-height: 118px;
  padding: 14px;
}

.insight-card span,
.insight-card small {
  color: var(--muted);
}

.insight-card strong {
  display: block;
  margin: 7px 0 4px;
  color: var(--text);
  font-size: clamp(1.05rem, 3vw, 1.45rem);
  line-height: 1.15;
}

.insight-card--ok {
  border-color: rgba(105, 208, 148, 0.2);
}

.insight-card--warn {
  border-color: rgba(244, 188, 85, 0.28);
  background:
    linear-gradient(145deg, rgba(244, 188, 85, 0.12), transparent 62%),
    rgba(255, 255, 255, 0.014);
}

.insight-card--risk {
  border-color: rgba(239, 107, 91, 0.32);
  background:
    linear-gradient(145deg, rgba(239, 107, 91, 0.12), transparent 62%),
    rgba(255, 255, 255, 0.014);
}

.recovery-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 16px;
  margin-top: 12px;
}

.recovery-card h3 {
  margin-bottom: 5px;
}

.recovery-card p {
  margin: 0;
}

.auth-card {
  width: min(560px, 100%);
  margin: 42px auto;
  padding: 22px;
}

.auth-card h1 {
  font-size: clamp(2rem, 8vw, 3.2rem);
}

.auth-card form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.archive-overview {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.archive-filters {
  margin-top: 14px;
  align-items: end;
}

.archive-hero {
  border: 1px solid rgba(217, 155, 66, 0.28);
  border-radius: 8px;
  padding: 18px;
  background:
    linear-gradient(135deg, rgba(217, 155, 66, 0.16), rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.02);
  box-shadow: var(--shadow);
}

.archive-hero span,
.archive-hero p {
  color: var(--muted);
  font-weight: 800;
}

.archive-hero strong {
  display: block;
  margin: 6px 0;
  color: var(--gold-2);
  font-size: clamp(3rem, 12vw, 6rem);
  line-height: 0.95;
}

.archive-hero p {
  margin: 0;
}

.type-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.type-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.032);
  color: inherit;
  cursor: pointer;
  text-align: left;
  transition: border-color 160ms ease, background 160ms ease, transform 120ms ease;
}

.type-card:hover,
.type-card.active {
  border-color: rgba(217, 155, 66, 0.55);
  background: rgba(217, 155, 66, 0.09);
}

.type-card:active {
  transform: translateY(1px);
}

.type-card span {
  color: var(--muted);
  font-weight: 800;
}

.type-card strong {
  display: grid;
  min-width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 999px;
  color: var(--gold-2);
  background: rgba(217, 155, 66, 0.14);
}

.section {
  margin-top: 22px;
  --section-accent: var(--gold);
  --section-bg: rgba(255, 255, 255, 0.018);
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: stretch;
  gap: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--section-accent);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--section-accent) 14%, transparent), transparent 44%),
    var(--section-bg);
}

.section-title p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.collapsed-section > summary {
  cursor: pointer;
  list-style: none;
}

.collapsed-section > summary::-webkit-details-marker {
  display: none;
}

.collapsed-section > summary::after {
  content: "Open";
  align-self: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  padding: 7px 10px;
  color: var(--gold-2);
  font-size: 0.74rem;
  font-weight: 900;
}

.collapsed-section[open] > summary {
  margin-bottom: 14px;
}

.collapsed-section[open] > summary::after {
  content: "Hide";
}

.section-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 8px;
  border: 1px solid color-mix(in srgb, var(--section-accent) 55%, transparent);
  border-radius: 999px;
  padding: 4px 9px;
  color: var(--section-accent);
  background: color-mix(in srgb, var(--section-accent) 10%, transparent);
  font-size: 0.72rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.section-kicker b {
  min-width: 24px;
  border-radius: 999px;
  padding: 2px 7px;
  background: color-mix(in srgb, var(--section-accent) 18%, rgba(255, 255, 255, 0.04));
  color: var(--text);
  font-size: 0.8rem;
  letter-spacing: 0;
  text-align: center;
}

.section-count {
  align-self: flex-start;
  display: grid;
  min-width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 999px;
  color: var(--section-accent);
  background: color-mix(in srgb, var(--section-accent) 14%, rgba(255, 255, 255, 0.04));
  font-weight: 900;
}

.section--today {
  --section-accent: #ffbd67;
  --section-bg: rgba(217, 155, 66, 0.045);
}

.section--tomorrow,
.section--booked,
.section--active {
  --section-accent: #d99b42;
  --section-bg: rgba(217, 155, 66, 0.025);
}

.section--payment {
  --section-accent: #f4bc55;
  --section-bg: rgba(244, 188, 85, 0.04);
}

.section--ready {
  --section-accent: #69d094;
  --section-bg: rgba(105, 208, 148, 0.035);
}

.section--risk {
  --section-accent: #ef6b5b;
  --section-bg: rgba(239, 107, 91, 0.04);
}

.section--complete,
.section--archive {
  --section-accent: #9f988c;
  --section-bg: rgba(255, 255, 255, 0.018);
}

.section--today .booking-card,
.section--tomorrow .booking-card,
.section--payment .booking-card,
.section--ready .booking-card,
.section--risk .booking-card,
.section--booked .booking-card,
.section--active .booking-card,
.section--complete .booking-card,
.section--archive .booking-card {
  border-left: 3px solid color-mix(in srgb, var(--section-accent) 70%, transparent);
}

.booking-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.booking-card__top,
.booking-card__meta,
.booking-card__actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.booking-card__top {
  align-items: flex-start;
}

.booking-card__side {
  display: grid;
  justify-items: end;
  gap: 8px;
  text-align: right;
}

.booking-card__location {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  margin-top: 7px;
  border: 1px solid rgba(217, 155, 66, 0.28);
  border-radius: 999px;
  padding: 4px 9px;
  background: rgba(217, 155, 66, 0.08);
  color: #ffd79d;
  font-size: 0.82rem;
  font-weight: 800;
  line-height: 1.2;
}

.delivery-state {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 0.74rem;
  font-weight: 900;
  white-space: nowrap;
}

.delivery-state.delivered {
  border: 1px solid rgba(105, 208, 148, 0.42);
  background: rgba(105, 208, 148, 0.13);
  color: #b9f4ce;
}

.delivery-state.ready {
  border: 1px solid rgba(244, 188, 85, 0.45);
  background: rgba(244, 188, 85, 0.13);
  color: #ffe1a8;
}

.delivery-state.waiting {
  border: 1px solid rgba(239, 107, 91, 0.38);
  background: rgba(239, 107, 91, 0.12);
  color: #ffd0c9;
}

.booking-card__meta {
  flex-wrap: wrap;
  justify-content: flex-start;
  color: var(--muted);
  font-size: 0.9rem;
}

.booking-card__actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.deadline {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid rgba(217, 155, 66, 0.32);
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(217, 155, 66, 0.1);
  color: #ffd79d;
  font-size: 0.78rem;
  font-weight: 900;
  white-space: nowrap;
}

.deadline.due {
  border-color: rgba(244, 188, 85, 0.55);
  background: rgba(244, 188, 85, 0.16);
  color: #ffe1a8;
}

.deadline.overdue {
  border-color: rgba(239, 107, 91, 0.55);
  background: rgba(239, 107, 91, 0.16);
  color: #ffd0c9;
}

.booking-card__badges:empty {
  display: none;
}

.status-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 9px;
}

.status-button {
  min-height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.065);
  border-radius: 8px;
  padding: 10px 8px;
  background: rgba(255, 255, 255, 0.026);
  color: rgba(183, 170, 152, 0.58);
  font-weight: 900;
  cursor: pointer;
  box-shadow: none;
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease, transform 120ms ease;
}

.status-button:hover {
  border-color: rgba(217, 155, 66, 0.24);
  color: rgba(248, 240, 230, 0.78);
  background: rgba(255, 255, 255, 0.045);
}

.status-button.active.confirmed {
  border-color: rgba(217, 155, 66, 0.68);
  background: linear-gradient(180deg, rgba(217, 155, 66, 0.24), rgba(217, 155, 66, 0.12));
  color: #ffd79d;
  box-shadow: inset 0 0 0 1px rgba(255, 189, 103, 0.1);
}

.status-button.active.shoot-done {
  border-color: rgba(255, 189, 103, 0.58);
  background: linear-gradient(180deg, rgba(255, 189, 103, 0.18), rgba(217, 155, 66, 0.1));
  color: #ffe1b8;
  box-shadow: inset 0 0 0 1px rgba(255, 189, 103, 0.08);
}

.status-button.active.paid {
  border-color: rgba(105, 208, 148, 0.58);
  background: linear-gradient(180deg, rgba(105, 208, 148, 0.2), rgba(105, 208, 148, 0.09));
  color: #b9f4ce;
  box-shadow: inset 0 0 0 1px rgba(185, 244, 206, 0.08);
}

.status-button.active.delivered {
  border-color: rgba(105, 208, 148, 0.62);
  background: linear-gradient(180deg, rgba(105, 208, 148, 0.24), rgba(105, 208, 148, 0.12));
  color: #b9f4ce;
  box-shadow: inset 0 0 0 1px rgba(185, 244, 206, 0.1);
}

.status-button.active.credit {
  border-color: rgba(244, 188, 85, 0.58);
  background: linear-gradient(180deg, rgba(244, 188, 85, 0.2), rgba(244, 188, 85, 0.08));
  color: #ffe1a8;
  box-shadow: inset 0 0 0 1px rgba(255, 225, 168, 0.08);
}

.status-button.active.gallery {
  border-color: rgba(130, 180, 240, 0.58);
  background: linear-gradient(180deg, rgba(130, 180, 240, 0.2), rgba(130, 180, 240, 0.08));
  color: #cfe5ff;
  box-shadow: inset 0 0 0 1px rgba(207, 229, 255, 0.08);
}

/* External (Google Calendar) events in owner calendar view */
.calendar-cell.has-external {
  background: linear-gradient(180deg, rgba(130, 180, 240, 0.06), rgba(130, 180, 240, 0.02));
}
.calendar-external-event {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.72rem;
  padding: 3px 6px;
  margin-top: 3px;
  border-radius: 6px;
  border: 1px dashed rgba(130, 180, 240, 0.35);
  color: rgba(207, 229, 255, 0.85);
  background: rgba(130, 180, 240, 0.08);
}
.calendar-external-event > span {
  font-weight: 600;
  color: #cfe5ff;
  min-width: 36px;
}
.calendar-external-event > em {
  font-style: normal;
  opacity: 0.85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.calendar-external-more {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  opacity: 0.6;
  font-style: italic;
}

/* Collapsible form section (Tax & Team Cost) */
.form-collapsible {
  padding-top: 18px;
}
.form-collapsible > summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin: -18px -24px 0;
  padding: 18px 24px;
  border-radius: 16px;
  transition: background 0.15s ease;
}
.form-collapsible > summary::-webkit-details-marker { display: none; }
.form-collapsible > summary::after {
  content: "▾";
  position: absolute;
  right: 28px;
  margin-top: 4px;
  opacity: 0.5;
  transition: transform 0.2s ease;
}
.form-collapsible[open] > summary::after {
  transform: rotate(180deg);
}
.form-collapsible > summary:hover {
  background: rgba(255, 255, 255, 0.025);
}
.form-collapsible > summary > h2 {
  margin: 0;
}
.form-collapsible > summary > .muted {
  font-size: 0.85rem;
}
.form-collapsible > .two-col,
.form-collapsible > .finance-summary {
  margin-top: 18px;
}

.status-button.locked {
  border-color: rgba(255, 255, 255, 0.065);
  color: rgba(183, 170, 152, 0.46);
  background: rgba(255, 255, 255, 0.022);
}

.status-button:active {
  transform: translateY(1px);
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 5px 10px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.gold {
  background: rgba(217, 155, 66, 0.16);
  color: #ffd79d;
}

.badge.green {
  background: rgba(105, 208, 148, 0.15);
  color: #b9f4ce;
}

.badge.red {
  background: rgba(239, 107, 91, 0.14);
  color: #ffd0c9;
}

.badge.warn {
  background: rgba(244, 188, 85, 0.16);
  color: #ffe1a8;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}

.filters .wide {
  grid-column: 1 / -1;
}

.queue-control {
  margin: 16px 0;
  border: 1px solid rgba(217, 155, 66, 0.2);
  border-radius: 8px;
  padding: 14px;
  background:
    linear-gradient(135deg, rgba(217, 155, 66, 0.08), transparent 46%),
    rgba(255, 255, 255, 0.015);
  box-shadow: var(--shadow);
}

.queue-control__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.queue-control__head > div {
  min-width: 0;
}

/* Queue Control — flush-left header with proportional Thai/English type
 * English kicker reduced to a clean uppercase label (no pill chrome) so
 * the Thai title sits on the exact same vertical line.
 */
.queue-control .section-kicker {
  display: block;
  margin: 0 0 6px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold-2);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0.78;
}
.queue-control__head h2 {
  margin: 0;
  font-size: clamp(1.35rem, 3.6vw, 1.75rem);
  font-weight: 900;
  line-height: 1.2;
  letter-spacing: -0.005em;
}

.button.compact {
  min-height: 38px;
  padding: 9px 12px;
  font-size: 0.84rem;
}

.queue-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.queue-card {
  min-height: 98px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.014));
  color: var(--text);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 120ms ease;
}

.queue-card:hover,
.queue-card.active {
  border-color: rgba(217, 155, 66, 0.58);
  background:
    linear-gradient(145deg, rgba(217, 155, 66, 0.17), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.052), rgba(255, 255, 255, 0.018));
}

.queue-card:active {
  transform: translateY(1px);
}

.queue-card span,
.queue-card small {
  display: block;
}

.queue-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.queue-card strong {
  display: block;
  margin: 5px 0;
  font-size: clamp(1.7rem, 5vw, 2.45rem);
}

.queue-card small {
  color: rgba(183, 170, 152, 0.72);
  font-size: 0.74rem;
  line-height: 1.35;
}

.field {
  display: grid;
  gap: 7px;
}

.field label,
.toggle span {
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  outline: none;
}

select option {
  color: #161616;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: rgba(217, 155, 66, 0.7);
  box-shadow: 0 0 0 3px rgba(217, 155, 66, 0.12);
}

.form-card {
  padding: 14px;
}

.form-grid {
  display: grid;
  gap: 12px;
}

.two-col {
  display: grid;
  gap: 12px;
}

.toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 54px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.035);
}

.toggle input {
  width: 24px;
  height: 24px;
  min-height: 24px;
  accent-color: var(--gold);
}

.workflow-head {
  display: grid;
  gap: 12px;
}

.workflow-head p {
  margin: 8px 0 0;
}

.status-readout {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(217, 155, 66, 0.28);
  border-radius: 8px;
  padding: 12px;
  background: rgba(217, 155, 66, 0.08);
}

.status-readout span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
}

.status-readout strong {
  color: var(--gold-2);
  font-size: 1.12rem;
}

.finance-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.finance-summary div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.035);
}

.finance-summary span,
.finance-summary strong {
  display: block;
}

.finance-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.finance-summary strong {
  margin-top: 6px;
  color: var(--text);
  font-size: 1rem;
}

.workflow-grid {
  display: grid;
  gap: 12px;
}

details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.035);
}

summary {
  min-height: 54px;
  display: flex;
  align-items: center;
  padding: 0 14px;
  color: var(--gold-2);
  cursor: pointer;
  font-weight: 800;
}

details .form-grid {
  padding: 0 14px 14px;
}

.sticky-save {
  position: sticky;
  bottom: 100px;
  z-index: 8;
  display: grid;
  gap: 10px;
  margin-top: 14px;
  margin-bottom: 24px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(15, 14, 18, 0.92);
  backdrop-filter: blur(14px);
}

.save-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.saved {
  color: var(--ok);
  font-weight: 800;
}

.warning {
  border: 1px solid rgba(244, 188, 85, 0.32);
  border-radius: 8px;
  padding: 11px 12px;
  color: #ffe1a8;
  background: rgba(244, 188, 85, 0.1);
}

.danger-zone {
  margin-top: 24px;
  border-color: rgba(239, 107, 91, 0.25);
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  /* Sits above modals (z-index ~1000) so the nav stays visible/accessible
   * even while a modal is open — owner never loses navigation context. */
  z-index: 1200;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  border-top: 1px solid var(--line);
  background: rgba(11, 11, 15, 0.94);
  backdrop-filter: blur(18px);
}

.bottom-nav a {
  min-height: 66px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

.bottom-nav a.active {
  color: var(--gold-2);
}

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  /* Above bottom-nav (z-index 1200) so modal buttons aren't hidden */
  z-index: 1300;
  display: grid;
  place-items: center;
  /* Bottom padding clears the fixed bottom nav so the modal panel never
   * sits underneath it (matches .personal-modal pattern) */
  padding: 16px 16px calc(120px + env(safe-area-inset-bottom, 0px));
  background: rgba(0, 0, 0, 0.62);
  overflow-y: auto;
}

.modal {
  width: min(560px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #15141b;
  box-shadow: var(--shadow);
}

.modal-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

.copy-textarea {
  width: 100%;
  min-height: 220px;
  margin-top: 12px;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 94px;
  z-index: 60;
  transform: translateX(-50%);
  border: 1px solid rgba(105, 208, 148, 0.35);
  border-radius: 999px;
  padding: 10px 14px;
  background: rgba(18, 48, 34, 0.94);
  color: #b9f4ce;
  font-weight: 900;
  box-shadow: var(--shadow);
}

.calendar-head {
  display: grid;
  grid-template-columns: 1fr;
  justify-items: center;
  text-align: center;
  gap: 16px;
}

.calendar-head > div:first-child {
  width: 100%;
}

.calendar-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.calendar-controls strong {
  min-width: 170px;
  text-align: center;
}

.calendar-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.015);
  box-shadow: var(--shadow);
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.calendar-weekdays span {
  padding: 10px;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-align: center;
}

.calendar-cell {
  min-height: 118px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  padding: 8px;
}

.calendar-cell:nth-child(7n) {
  border-right: 0;
}

.calendar-cell.booked {
  background: linear-gradient(145deg, rgba(217, 155, 66, 0.1), transparent 65%);
}

.calendar-date {
  margin-bottom: 6px;
  color: var(--text);
  font-weight: 900;
}

.calendar-job {
  display: grid;
  gap: 2px;
  margin-top: 5px;
  border-radius: 7px;
  padding: 6px;
  background: rgba(217, 155, 66, 0.13);
  color: var(--text);
  font-size: 0.72rem;
}

.calendar-job span {
  color: var(--gold-2);
  font-weight: 900;
}

@media (min-width: 720px) {
  .app-shell {
    padding-bottom: 0;
  }

  .bottom-nav {
    left: 50%;
    right: auto;
    bottom: 18px;
    width: min(640px, calc(100% - 32px));
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 8px;
    overflow: hidden;
  }

  .metric-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .metric--hero {
    grid-column: span 2;
  }

  .archive-overview {
    grid-template-columns: 1fr 2fr;
    align-items: stretch;
  }

  .type-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .queue-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .command-center {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: 2fr 1fr 1fr 1fr;
  }

  .filters .wide {
    grid-column: auto;
  }

  .sticky-save {
    bottom: 110px;
    margin-bottom: 28px;
    grid-template-columns: 1fr auto;
    align-items: center;
  }

  .save-actions {
    grid-template-columns: auto auto;
  }

  .status-actions {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .workflow-head {
    grid-template-columns: 1fr 220px;
    align-items: start;
  }

  .workflow-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .finance-summary {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .modal-backdrop {
    place-items: center;
  }
}

@media (max-width: 719px) {
  .topbar-actions {
    gap: 8px;
  }

  .backup-action {
    min-height: 36px;
    padding: 8px 10px;
    font-size: 0.82rem;
  }

  .cloud-pill {
    display: none;
  }

  .topbar .primary-action {
    min-height: 38px;
    padding: 9px 11px;
    font-size: 0.84rem;
  }

  .calendar-head,
  .calendar-controls,
  .queue-control__head {
    display: grid;
  }

  .calendar-controls {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .calendar-weekdays span {
    padding: 8px 2px;
    font-size: 0.62rem;
  }

  .calendar-cell {
    min-height: 82px;
    padding: 5px;
  }

  .calendar-job {
    padding: 4px;
    font-size: 0.62rem;
  }

  .collapsed-section > summary {
    align-items: flex-start;
  }

  .recovery-card {
    display: grid;
  }
}

.public-page {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 28px clamp(16px, 5vw, 36px) 52px;
}

.public-hero {
  min-height: 34vh;
  display: grid;
  align-content: end;
  gap: 12px;
  padding: 40px 0 24px;
}

.public-hero h1 {
  max-width: 760px;
  font-size: clamp(3rem, 12vw, 6.5rem);
}

.public-card {
  border-color: rgba(217, 155, 66, 0.24);
}

.availability-result {
  padding: 14px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  font-weight: 800;
}

.availability-result.ok {
  border-color: rgba(105, 208, 148, 0.4);
  background: rgba(105, 208, 148, 0.1);
  color: #baf7d2;
}

.availability-result.warn {
  border-color: rgba(244, 188, 85, 0.42);
  background: rgba(217, 155, 66, 0.1);
  color: #ffe0a8;
}

/* =====================================================================
   Booking Request — Confirm modal + Success card
   ===================================================================== */
.request-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.request-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
}
.request-modal-panel {
  position: relative;
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  background: var(--panel, #14130f);
  border: 1px solid rgba(217, 155, 66, 0.4);
  border-radius: 18px;
  padding: 28px 26px 24px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.6);
  animation: req-modal-in 0.22s ease;
}
@keyframes req-modal-in {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.request-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 999px;
}
.request-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink, #f4e7c1);
}
.request-modal-panel .eyebrow {
  letter-spacing: 0.2em;
  font-size: 11px;
  color: #a08a5c;
  margin: 0 0 6px;
  text-transform: uppercase;
}
.request-modal-panel h3 {
  margin: 0 0 4px;
  font-size: 1.4rem;
  color: var(--ink, #f4e7c1);
}
.request-modal-panel p {
  margin: 4px 0 14px;
  font-size: 0.92rem;
}

.request-summary {
  margin: 12px 0 18px;
  padding: 0;
  display: grid;
  gap: 0;
  border: 1px solid rgba(217, 155, 66, 0.18);
  border-radius: 12px;
  background: rgba(217, 155, 66, 0.05);
  overflow: hidden;
}
.request-summary > div {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.request-summary > div:last-child {
  border-bottom: none;
}
.request-summary dt {
  font-size: 0.78rem;
  color: #a08a5c;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin: 0;
  align-self: start;
  padding-top: 2px;
}
.request-summary dd {
  margin: 0;
  font-size: 0.95rem;
  color: var(--ink, #f4e7c1);
  font-weight: 500;
  word-break: break-word;
}
.request-summary-msg {
  font-weight: 400 !important;
  font-style: italic;
  color: rgba(244, 231, 193, 0.85) !important;
  white-space: pre-wrap;
}
@media (max-width: 480px) {
  .request-summary > div {
    grid-template-columns: 90px 1fr;
    padding: 8px 12px;
    gap: 8px;
  }
  .request-summary dd { font-size: 0.88rem; }
}

.request-modal-error {
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(217, 100, 100, 0.12);
  border: 1px solid rgba(217, 100, 100, 0.4);
  color: #ffb4b4;
  font-size: 0.85rem;
}

.request-modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: flex-end;
}
.request-modal-actions .button {
  flex: 1 1 auto;
  text-align: center;
}
.request-modal-actions .backup-action {
  padding: 10px 16px;
}
.request-modal-actions button:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

/* Success card (replaces the form after submission) */
.request-success {
  text-align: center;
  padding: 16px 8px 8px;
}
.request-success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 16px;
  border-radius: 999px;
  background: rgba(105, 208, 148, 0.15);
  border: 1px solid rgba(105, 208, 148, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #baf7d2;
  font-size: 2rem;
  font-weight: 500;
  animation: req-check-pop 0.4s cubic-bezier(.18,.89,.32,1.28);
}
@keyframes req-check-pop {
  from { transform: scale(0.4); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}
.request-success .eyebrow {
  letter-spacing: 0.2em;
  font-size: 11px;
  color: #baf7d2;
  margin: 0 0 6px;
  text-transform: uppercase;
}
.request-success h2 {
  margin: 0 0 14px;
  font-size: clamp(1.4rem, 4vw, 1.8rem);
  color: var(--ink, #f4e7c1);
}
.request-success p {
  margin: 8px 0;
  font-size: 0.95rem;
  max-width: 460px;
  margin-left: auto;
  margin-right: auto;
}
.request-success p strong {
  color: #ffe0a8;
  font-weight: 600;
}
.request-ref {
  display: inline-block;
  margin-top: 14px !important;
  font-size: 0.82rem !important;
  padding: 6px 14px;
  background: rgba(217, 155, 66, 0.1);
  border: 1px solid rgba(217, 155, 66, 0.3);
  border-radius: 999px;
  color: var(--muted) !important;
}
.request-ref code {
  color: #ffe0a8;
  font-weight: 600;
  letter-spacing: 0.05em;
  font-family: var(--font-mono, ui-monospace, monospace);
}
.request-success-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin: 22px 0 14px;
}
.request-success-foot {
  font-size: 0.82rem !important;
  margin-top: 18px !important;
}
.request-success-foot a {
  color: #ffe0a8;
  text-decoration: none;
  border-bottom: 1px solid rgba(255, 224, 168, 0.35);
}
.request-success-foot a:hover {
  border-bottom-color: rgba(255, 224, 168, 0.8);
}

/* =====================================================================
   Public Calendar (calendar.html)
   ===================================================================== */
.calendar-card {
  padding: clamp(16px, 3vw, 28px);
}

.calendar-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.calendar-toolbar h2 {
  margin: 0;
  font-size: clamp(1.1rem, 3.5vw, 1.5rem);
  letter-spacing: 0.02em;
  text-align: center;
  flex: 1;
}

.calendar-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  border: 1px solid rgba(217, 155, 66, 0.35);
  background: transparent;
  color: var(--ink, #f4e7c1);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.18s, transform 0.12s;
}
.calendar-nav-btn:hover {
  background: rgba(217, 155, 66, 0.12);
}
.calendar-nav-btn:active {
  transform: scale(0.94);
}

.calendar-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  font-size: 0.78rem;
  color: var(--muted);
  margin-bottom: 18px;
  justify-content: center;
}
.calendar-legend .dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-right: 4px;
  vertical-align: -1px;
}
.dot-free { background: rgba(105, 208, 148, 0.7); }
.dot-some { background: rgba(244, 188, 85, 0.85); }
.dot-full { background: rgba(217, 100, 100, 0.75); }
.dot-past { background: rgba(255, 255, 255, 0.18); }

.calendar-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 2px 6px;
}
.calendar-weekdays span {
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar-cell {
  position: relative;
  min-height: 78px;
  padding: 8px 6px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  flex-direction: column;
  gap: 4px;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.1s;
  overflow: hidden;
}
.calendar-cell.is-future:hover {
  background: rgba(217, 155, 66, 0.08);
  border-color: rgba(217, 155, 66, 0.32);
}
.calendar-cell.is-future:active {
  transform: scale(0.98);
}
.calendar-cell.is-past {
  cursor: not-allowed;
  opacity: 0.4;
}
.calendar-cell.is-other-month {
  opacity: 0.35;
}
.calendar-cell.is-today {
  border-color: rgba(217, 155, 66, 0.6);
  box-shadow: inset 0 0 0 1px rgba(244, 188, 85, 0.35);
}
.calendar-cell.state-free {
  background: rgba(105, 208, 148, 0.04);
}
.calendar-cell.state-some {
  background: rgba(244, 188, 85, 0.08);
  border-color: rgba(244, 188, 85, 0.28);
}
.calendar-cell.state-full {
  background: rgba(217, 100, 100, 0.1);
  border-color: rgba(217, 100, 100, 0.4);
}

.calendar-cell-num {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--ink, #f4e7c1);
}

.calendar-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: auto;
}
.calendar-chip {
  font-size: 0.65rem;
  padding: 2px 5px;
  border-radius: 4px;
  background: rgba(217, 155, 66, 0.18);
  border: 1px solid rgba(217, 155, 66, 0.3);
  color: #ffe0a8;
  white-space: nowrap;
  line-height: 1.2;
}
.calendar-chip-more {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: var(--muted);
}
.calendar-chip-empty {
  background: rgba(105, 208, 148, 0.1);
  border-color: rgba(105, 208, 148, 0.25);
  color: #baf7d2;
  font-weight: 600;
}

.calendar-loading,
.calendar-error {
  grid-column: 1 / -1;
  padding: 40px;
  text-align: center;
  color: var(--muted);
}
.calendar-error {
  color: #ffb4b4;
}

.calendar-foot {
  margin-top: 16px;
  font-size: 0.78rem;
  text-align: center;
}

/* Mobile (≤ 540px) — shrink cells but keep usable */
@media (max-width: 540px) {
  .calendar-cell {
    min-height: 58px;
    padding: 5px 3px;
    border-radius: 7px;
  }
  .calendar-cell-num {
    font-size: 0.82rem;
  }
  .calendar-chip {
    font-size: 0.58rem;
    padding: 1px 4px;
  }
  .calendar-legend {
    font-size: 0.7rem;
    gap: 8px;
  }
}

/* Day detail modal */
.calendar-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.calendar-modal[hidden] {
  display: none;
}
.calendar-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(3px);
}
.calendar-modal-panel {
  position: relative;
  width: min(520px, 100%);
  background: var(--panel, #14130f);
  border-top: 1px solid rgba(217, 155, 66, 0.4);
  border-radius: 18px 18px 0 0;
  padding: 24px 22px 28px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.5);
  animation: calendar-slide-up 0.22s ease;
}
@keyframes calendar-slide-up {
  from { transform: translateY(20px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
@media (min-width: 720px) {
  .calendar-modal {
    align-items: center;
  }
  .calendar-modal-panel {
    border-radius: 18px;
    border-top: 1px solid rgba(217, 155, 66, 0.4);
  }
}
.calendar-modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: transparent;
  color: var(--muted);
  border: none;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 999px;
}
.calendar-modal-close:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--ink, #f4e7c1);
}
.calendar-modal-panel h3 {
  margin: 0 0 6px;
  font-size: 1.15rem;
  color: var(--ink, #f4e7c1);
}
.calendar-modal-panel p {
  margin: 0 0 14px;
  font-size: 0.88rem;
}
.calendar-slot-list {
  list-style: none;
  padding: 0;
  margin: 0 0 18px;
  display: grid;
  gap: 6px;
}
.calendar-slot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 14px;
  background: rgba(217, 155, 66, 0.1);
  border: 1px solid rgba(217, 155, 66, 0.25);
  border-radius: 9px;
  font-size: 0.92rem;
}
.calendar-slot-time { font-weight: 700; color: #ffe0a8; }
.calendar-slot-status {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: rgba(255, 255, 255, 0.55);
}
.calendar-slot-empty {
  justify-content: center;
  background: rgba(105, 208, 148, 0.08);
  border-color: rgba(105, 208, 148, 0.25);
  color: #baf7d2;
  font-weight: 600;
}
.calendar-modal-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}
.calendar-modal-actions .button {
  flex: 1;
  text-align: center;
}

/* =====================================================================
 * Bottom nav — 2 rows (4 primary + 5 secondary), icons + Thai labels
 * Color only on .active (the section currently open); neutral otherwise
 * ===================================================================== */
.bottom-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.bottom-nav .nav-row {
  display: grid;
  gap: 2px;
}
.bottom-nav .nav-row-primary {
  grid-template-columns: repeat(4, 1fr);
}
.bottom-nav .nav-row-secondary {
  /* auto-fit so the row still looks right if aidept hasn't injected
   * Leads + Inbox yet (e.g. first paint, slow boot, or missing flag) */
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
}
.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 7px 1px;
  font-size: 0.68rem;
  line-height: 1.05;
  text-align: center;
  border-radius: 8px;
  text-decoration: none;
  color: rgba(212, 200, 180, 0.55);
  transition: color 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
  min-height: 0;
}
.bottom-nav a:hover {
  color: rgba(232, 227, 216, 0.95);
  background: rgba(255, 255, 255, 0.03);
}
.bottom-nav .nav-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}
/* Active states (Variant D) — top accent bar + tinted bg
 * Single brand color (gold) for ALL active sections so the nav reads as
 * one consistent surface. Per-section colors removed by request. */
.bottom-nav a.active,
.bottom-nav a.active.nav-personal,
.bottom-nav a.active.nav-analytics,
.bottom-nav a.active.nav-leads,
.bottom-nav a.active.nav-inbox {
  color: #f4bc55;
  background: rgba(244, 188, 85, 0.14);
  box-shadow: inset 0 2px 0 #f4bc55;
}

/* =====================================================================
 * Personal item modal
 * ===================================================================== */
.personal-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  /* Bottom padding clears the bottom nav (z-index 1200, ~110px tall)
   * so the modal panel never sits underneath it. */
  padding: 16px 16px calc(120px + env(safe-area-inset-bottom, 0px));
}
.personal-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(4px);
}
.personal-modal-panel {
  position: relative;
  width: 100%;
  max-width: 400px;
  background: #16161e;
  border: 1px solid rgba(244, 188, 85, 0.12);
  border-radius: 16px;
  padding: 22px 22px 18px;
  color: #e8e3d8;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}
.personal-modal-close {
  position: absolute;
  top: 8px;
  right: 12px;
  background: transparent;
  border: 0;
  color: rgba(232, 227, 216, 0.55);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.personal-modal-close:hover {
  color: #f4bc55;
}
.personal-modal-panel .eyebrow {
  margin: 0 0 4px;
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  color: #f4bc55;
  text-transform: uppercase;
}
.personal-modal-panel h3 {
  margin: 0 0 16px;
  font-size: 1.15rem;
  font-weight: 600;
}
.personal-type-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.personal-type-btn {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: rgba(232, 227, 216, 0.65);
  padding: 10px 8px;
  border-radius: 10px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.personal-type-btn:hover {
  border-color: rgba(130, 180, 240, 0.35);
  color: #cfe5ff;
}
.personal-type-btn.active {
  background: linear-gradient(180deg, rgba(130, 180, 240, 0.2), rgba(130, 180, 240, 0.08));
  border-color: rgba(130, 180, 240, 0.6);
  color: #cfe5ff;
}
.personal-icon {
  margin-right: 4px;
}
.personal-field {
  margin-bottom: 12px;
}
.personal-field label {
  display: block;
  font-size: 0.75rem;
  color: rgba(232, 227, 216, 0.55);
  margin-bottom: 4px;
}
.personal-field input {
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e8e3d8;
  padding: 9px 12px;
  border-radius: 8px;
  font-size: 0.92rem;
}
.personal-field input:focus {
  outline: none;
  border-color: rgba(130, 180, 240, 0.55);
  background: rgba(130, 180, 240, 0.04);
}
.personal-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
.personal-row .personal-field {
  margin-bottom: 0;
}
.personal-modal-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}
.personal-btn-cancel,
.personal-btn-save,
.personal-btn-danger {
  border: 1px solid;
  border-radius: 8px;
  padding: 8px 16px;
  font-size: 0.88rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.personal-btn-cancel {
  background: transparent;
  border-color: rgba(255, 255, 255, 0.12);
  color: rgba(232, 227, 216, 0.7);
}
.personal-btn-cancel:hover {
  border-color: rgba(232, 227, 216, 0.3);
  color: #e8e3d8;
}
.personal-btn-save {
  background: linear-gradient(180deg, rgba(130, 180, 240, 0.25), rgba(130, 180, 240, 0.12));
  border-color: rgba(130, 180, 240, 0.6);
  color: #cfe5ff;
}
.personal-btn-save:hover {
  background: linear-gradient(180deg, rgba(130, 180, 240, 0.35), rgba(130, 180, 240, 0.2));
}
.personal-btn-danger {
  background: transparent;
  border-color: rgba(229, 100, 100, 0.4);
  color: rgba(229, 140, 140, 0.85);
  margin-right: auto;
}
.personal-btn-danger:hover {
  background: rgba(229, 100, 100, 0.1);
  color: #ffadad;
}

/* =====================================================================
 * Personal items inside calendar cells (blue=appointment, grey=reminder)
 * ===================================================================== */
.calendar-cell.has-personal {
  background: linear-gradient(180deg, rgba(130, 180, 240, 0.04), rgba(130, 180, 240, 0.01));
}
.personal-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
  font-size: 0.72rem;
  padding: 4px 6px;
  margin-top: 3px;
  border-radius: 6px;
  border-left: 3px solid;
  cursor: pointer;
  overflow: hidden;
}
.personal-item-appointment {
  background: rgba(130, 180, 240, 0.12);
  border-left-color: #82b4f0;
  color: #cfe5ff;
}
.personal-item-appointment:hover {
  background: rgba(130, 180, 240, 0.2);
}
.personal-item-reminder {
  background: rgba(180, 178, 169, 0.08);
  border-left-color: #888780;
  color: rgba(232, 227, 216, 0.85);
}
.personal-item-reminder:hover {
  background: rgba(180, 178, 169, 0.15);
}
.personal-item .personal-time {
  font-weight: 500;
  font-size: 0.7rem;
  flex-shrink: 0;
}
.personal-item em {
  font-style: normal;
  opacity: 0.85;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.personal-more {
  display: block;
  margin-top: 2px;
  font-size: 0.68rem;
  opacity: 0.55;
  font-style: italic;
}

/* =====================================================================
 * Analytics page
 * ===================================================================== */
.analytics-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}
.analytics-mode-toggle {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 10px;
  padding: 3px;
}
.analytics-mode-btn {
  background: transparent;
  border: 0;
  color: rgba(232, 227, 216, 0.65);
  padding: 7px 16px;
  border-radius: 8px;
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.15s ease;
}
.analytics-mode-btn:hover {
  color: #e8e3d8;
}
.analytics-mode-btn.active {
  background: linear-gradient(180deg, rgba(140, 220, 180, 0.2), rgba(140, 220, 180, 0.08));
  color: #b5f0d4;
  box-shadow: inset 0 0 0 1px rgba(140, 220, 180, 0.3);
}
.analytics-period {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #e8e3d8;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-left: auto;
}
.analytics-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}
.analytics-stat {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 12px;
  padding: 14px 16px;
}
.analytics-stat-label {
  font-size: 0.78rem;
  color: rgba(232, 227, 216, 0.55);
  margin-bottom: 4px;
}
.analytics-stat-value {
  font-size: 1.45rem;
  font-weight: 600;
  color: #f4bc55;
  line-height: 1.2;
}
.analytics-charts {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 12px;
}
.analytics-chart-card h3 {
  margin: 0 0 12px;
  font-size: 0.95rem;
  font-weight: 500;
}
.analytics-canvas-wrap {
  position: relative;
  height: 220px;
}
.analytics-legend {
  list-style: none;
  margin: 12px 0 0;
  padding: 0;
  font-size: 0.82rem;
}
.analytics-legend li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}
.analytics-legend li:last-child {
  border-bottom: 0;
}
.analytics-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex-shrink: 0;
}
.analytics-legend-name {
  flex: 1;
  color: rgba(232, 227, 216, 0.85);
}
.analytics-legend-count {
  color: rgba(232, 227, 216, 0.55);
  font-size: 0.78rem;
}

/* Responsive — stack analytics charts on narrow screens */
@media (max-width: 720px) {
  .analytics-charts { grid-template-columns: 1fr; }
  .analytics-stats { grid-template-columns: repeat(3, 1fr); gap: 8px; }
  .analytics-stat-value { font-size: 1.2rem; }
  .bottom-nav a { font-size: 0.66rem; padding: 6px 1px; min-height: 0; }
  .bottom-nav .nav-icon { width: 18px; height: 18px; }
}

/* =====================================================================
 * Bookings page — filters/search as collapsible (rarely used)
 * ===================================================================== */
.filters-collapsible {
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 14px;
  padding: 0;
  margin-bottom: 14px;
  overflow: hidden;
}
.filters-collapsible > summary {
  cursor: pointer;
  list-style: none;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  transition: background 0.15s ease;
}
.filters-collapsible > summary::-webkit-details-marker { display: none; }
.filters-collapsible > summary::after {
  content: "▾";
  margin-left: auto;
  opacity: 0.5;
  transition: transform 0.2s ease;
}
.filters-collapsible[open] > summary::after {
  transform: rotate(180deg);
}
.filters-collapsible > summary:hover {
  background: rgba(255, 255, 255, 0.03);
}
.filters-collapsible > summary > strong {
  font-size: 0.95rem;
  font-weight: 600;
}
.filters-collapsible > summary > .muted {
  font-size: 0.78rem;
  opacity: 0.6;
}
.filters-collapsible > .filters {
  padding: 12px 16px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.04);
}

/* =====================================================================
 * Calendar — Prev/Next pager with prominent month name
 * ===================================================================== */
.calendar-month-pager {
  display: inline-flex;
  align-items: center;
  gap: 14px;
  background: rgba(244, 188, 85, 0.04);
  border: 1px solid rgba(244, 188, 85, 0.18);
  border-radius: 14px;
  padding: 6px 8px;
}
.calendar-arrow {
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(244, 188, 85, 0.25);
  border-radius: 10px;
  color: #f4bc55;
  cursor: pointer;
  transition: background 0.15s ease, transform 0.15s ease, border-color 0.15s ease;
}
.calendar-arrow:hover {
  background: rgba(244, 188, 85, 0.12);
  border-color: rgba(244, 188, 85, 0.5);
}
.calendar-arrow:active {
  transform: scale(0.94);
}
.calendar-arrow svg {
  width: 20px;
  height: 20px;
}
.calendar-month-label {
  min-width: 180px;
  text-align: center;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: #f8e7c0;
  white-space: nowrap;
}
@media (max-width: 720px) {
  .calendar-month-label {
    min-width: 130px;
    font-size: 1.15rem;
  }
  .calendar-arrow {
    width: 34px;
    height: 34px;
  }
}

/* =====================================================================
 * Toast stack (lib/toast.js)
 * ===================================================================== */
#fk-toast-stack {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
  max-width: calc(100vw - 32px);
}
.fk-toast {
  background: #1a1a22;
  color: #e8e3d8;
  border: 1px solid rgba(244, 188, 85, 0.25);
  border-left: 3px solid #f4bc55;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 0.88rem;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transform: translateX(20px);
  transition: opacity 0.2s ease, transform 0.2s ease;
  max-width: 360px;
}
.fk-toast--in { opacity: 1; transform: translateX(0); }
.fk-toast--success { border-left-color: #5dcaa5; }
.fk-toast--warn    { border-left-color: #f4bc55; }
.fk-toast--error   { border-left-color: #e57272; }

/* =====================================================================
 * Offline banner (lib/offline.js)
 * ===================================================================== */
#fk-offline-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1900;
  background: linear-gradient(90deg, rgba(229, 114, 114, 0.95), rgba(229, 114, 114, 0.85));
  color: white;
  padding: 8px 16px;
  font-size: 0.85rem;
  text-align: center;
  font-weight: 500;
  transform: translateY(-100%);
  transition: transform 0.25s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}
#fk-offline-banner.fk-offline-banner--show { transform: translateY(0); }

/* =====================================================================
 * Shortcuts cheatsheet (lib/shortcuts.js)
 * ===================================================================== */
.fk-shortcuts-cheat {
  position: fixed;
  inset: 0;
  z-index: 1800;
  background: rgba(8, 8, 12, 0.72);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.fk-shortcuts-cheat-panel {
  background: #16161e;
  border: 1px solid rgba(244, 188, 85, 0.18);
  border-radius: 14px;
  padding: 22px 26px;
  max-width: 380px;
  width: 100%;
  color: #e8e3d8;
}
.fk-shortcuts-cheat-panel h3 {
  margin: 0 0 14px;
  font-size: 1.1rem;
  color: #f4bc55;
}
.fk-shortcuts-cheat-panel table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.fk-shortcuts-cheat-panel td {
  padding: 6px 0;
}
.fk-shortcuts-cheat-panel td:first-child {
  width: 100px;
}
.fk-shortcuts-cheat-panel kbd {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom-width: 2px;
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 0.78rem;
  font-family: ui-monospace, monospace;
  color: #f4bc55;
  margin-right: 3px;
}
.fk-shortcuts-cheat-panel .muted {
  margin-top: 12px;
  font-size: 0.75rem;
  opacity: 0.6;
}
.fk-shortcuts-close {
  margin-top: 14px;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #e8e3d8;
  padding: 8px 18px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.88rem;
  width: 100%;
}
.fk-shortcuts-close:hover {
  border-color: rgba(244, 188, 85, 0.4);
  color: #f4bc55;
}

/* =====================================================================
 * Calendar Export .ics button (lib/ical-export.js)
 * ===================================================================== */
.fk-ical-btn {
  margin-top: 12px;
  font-size: 0.82rem;
  padding: 6px 14px;
}

/* =====================================================================
 * Lead card with quick-delete icon (lib/aidept/ui.js leadCard)
 * ===================================================================== */
.aidept-lead-card-wrap {
  position: relative;
}
.aidept-lead-card-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(229, 100, 100, 0.08);
  border: 1px solid rgba(229, 100, 100, 0.25);
  color: rgba(229, 140, 140, 0.85);
  border-radius: 8px;
  font-size: 0.95rem;
  cursor: pointer;
  z-index: 2;
  opacity: 0.65;
  transition: opacity 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.aidept-lead-card-delete:hover {
  opacity: 1;
  background: rgba(229, 100, 100, 0.18);
  border-color: rgba(229, 100, 100, 0.55);
  color: #ffadad;
}

/* =====================================================================
 * Heartbeat banner (lib/heartbeat-check.js)
 * Shown when a cron has stopped firing for longer than the threshold
 * ===================================================================== */
#fk-heartbeat-banner {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 1950;
  background: linear-gradient(90deg, #c43030, #a82121);
  color: #fff;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.85rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.4);
  transform: translateY(-100%);
  transition: transform 0.25s ease;
}
#fk-heartbeat-banner.fk-heartbeat-banner--show { transform: translateY(0); }
.fk-heartbeat-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}
.fk-heartbeat-msg {
  flex: 1;
  line-height: 1.4;
}
.fk-heartbeat-msg strong {
  display: block;
  margin-bottom: 2px;
}
.fk-heartbeat-msg div {
  font-size: 0.78rem;
  opacity: 0.92;
}
.fk-heartbeat-close {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}
.fk-heartbeat-close:hover {
  background: rgba(255, 255, 255, 0.25);
}

/* =====================================================================
 * Calendar page — fit to viewport (no page scroll)
 * Uses :has() to target only when calendar shell is rendered, so other
 * pages keep their normal scrollable layout.
 * ===================================================================== */
/* Calendar — cells grow with content so every booking shows legibly.
 * Page scrolls naturally; each week stretches to fit its tallest cell. */
body:has(.calendar-shell) .main {
  padding-top: 8px;
  padding-bottom: calc(110px + env(safe-area-inset-bottom, 0px));
}
body:has(.calendar-shell) .calendar-head {
  gap: 8px;
  margin: 0 0 10px;
}
body:has(.calendar-shell) .calendar-head h1 {
  font-size: 1.4rem;
  margin: 0;
}
body:has(.calendar-shell) .calendar-weekdays span {
  padding: 6px 4px;
  font-size: 0.66rem;
}
body:has(.calendar-shell) .calendar-grid {
  grid-auto-rows: minmax(90px, auto);
}
/* Calendar cell — elegant overview layout.
 * Date in top-left, max 2 items shown compactly underneath. Excess items
 * collapse to a tiny "+N" pill at bottom-right. Each item shows time +
 * first name on a single tight line. Visual harmony of the whole month
 * is prioritized over per-cell density (user can zoom to click). */
body:has(.calendar-shell) .calendar-cell {
  min-height: 0;
  padding: 5px 6px;
  overflow: hidden;
  display: flex;
  position: relative;
}
body:has(.calendar-shell) .calendar-cell.booked {
  background: linear-gradient(180deg, rgba(217, 155, 66, 0.06), transparent 70%);
}
body:has(.calendar-shell) .calendar-cell__inner {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
body:has(.calendar-shell) .calendar-date {
  font-size: 0.78rem;
  font-weight: 800;
  line-height: 1;
  margin: 0;
  color: var(--text);
  opacity: 0.8;
  flex-shrink: 0;
  letter-spacing: -0.01em;
}
body:has(.calendar-shell) .calendar-cell.booked .calendar-date {
  color: var(--gold-2);
  opacity: 1;
}
body:has(.calendar-shell) .calendar-cell__items {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
body:has(.calendar-shell) .calendar-job {
  display: flex;
  flex-direction: column;
  gap: 0;
  min-width: 0;
  padding: 2px 4px;
  border-radius: 4px;
  background: rgba(217, 155, 66, 0.14);
  border-left: 2px solid var(--gold-2);
  color: var(--text);
  text-decoration: none;
  cursor: pointer;
  text-align: left;
  font: inherit;
  transition: background 0.15s ease;
  overflow: hidden;
}
body:has(.calendar-shell) .calendar-job:hover {
  background: rgba(217, 155, 66, 0.22);
}
body:has(.calendar-shell) .calendar-job__time {
  display: block;
  font-weight: 900;
  color: var(--gold-2);
  letter-spacing: -0.02em;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* Name allowed to wrap to multiple lines (user said: "ถ้าไม่สวย เพิ่มบรรทัดได้")
 * — caps at 3 lines so very long names don't blow the cell apart. */
body:has(.calendar-shell) .calendar-job__name {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  font-weight: 600;
  line-height: 1.15;
  overflow: hidden;
  word-break: break-word;
  overflow-wrap: anywhere;
  opacity: 0.92;
}
body:has(.calendar-shell) .calendar-job--personal {
  background: rgba(130, 180, 240, 0.12);
  border-left-color: #82b4f0;
}
body:has(.calendar-shell) .calendar-job--personal .calendar-job__time {
  color: #cfe5ff;
}

/* Default booking pill — micro type, fits 5-char times like "14:30" on
 * one line in narrow mobile columns. Name is ~50% smaller and may wrap
 * up to 3 lines if it doesn't fit. User can pinch-zoom for fine detail.
 */
body:has(.calendar-shell) .calendar-cell .calendar-job__time {
  font-size: 0.48rem;
  line-height: 1.15;
}
body:has(.calendar-shell) .calendar-cell .calendar-job__name {
  font-size: 0.4rem;
  line-height: 1.15;
}

/* =====================================================================
 * Booking form — Main Status compact row
 * Heading + value on the left, Pending toggle on the right (single line)
 * ===================================================================== */
.main-status-card {
  gap: 0;
}
.main-status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.main-status-readout {
  display: flex;
  align-items: baseline;
  gap: 12px;
  min-width: 0;
}
.main-status-readout h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
  white-space: nowrap;
}
.main-status-readout strong {
  font-size: 1.15rem;
  color: var(--gold-2);
  font-weight: 900;
}
.main-status-toggle {
  flex-shrink: 0;
}
.main-status-toggle .toggle {
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  gap: 12px;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .main-status-toggle .toggle {
    padding: 7px 10px;
    font-size: 0.85rem;
  }
}

/* =====================================================================
 * Save bar — single primary button, centered for new bookings
 * ===================================================================== */
/* Single-button save bar — Apple-style floating button, no surrounding frame */
.sticky-save--single {
  grid-template-columns: 1fr !important;
  border: 0 !important;
  background: transparent !important;
  backdrop-filter: none !important;
  padding: 0 !important;
  margin-bottom: 28px;
}
.sticky-save--single .save-actions {
  display: flex !important;
  justify-content: center;
  grid-template-columns: none !important;
}
.sticky-save--single .save-primary {
  min-width: 260px;
  width: min(360px, 92%);
  font-size: 1.05rem;
  padding: 16px 32px;
  font-weight: 700;
  border-radius: 18px;
  letter-spacing: 0.01em;
  background: linear-gradient(180deg, #f8c66a 0%, #e9a83a 100%);
  color: #1a1208;
  border: 0;
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.35) inset,
    0 -1px 0 rgba(0, 0, 0, 0.18) inset,
    0 10px 28px -10px rgba(244, 188, 85, 0.55),
    0 4px 12px -4px rgba(0, 0, 0, 0.45);
  transition: transform 0.12s ease, box-shadow 0.18s ease, filter 0.18s ease;
}
.sticky-save--single .save-primary:hover {
  filter: brightness(1.04);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.4) inset,
    0 -1px 0 rgba(0, 0, 0, 0.18) inset,
    0 14px 32px -10px rgba(244, 188, 85, 0.7),
    0 6px 14px -4px rgba(0, 0, 0, 0.5);
}
.sticky-save--single .save-primary:active {
  transform: scale(0.985);
  filter: brightness(0.96);
}

/* =====================================================================
 * Nested details (e.g. Payment inside Advanced Details)
 * Slightly inset + lighter surface so the sub-dropdown reads as nested
 * ===================================================================== */
.nested-details {
  margin: 4px 0 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}
.nested-details > summary {
  cursor: pointer;
  font-weight: 800;
  font-size: 0.95rem;
  color: var(--gold-2);
  padding: 2px 0;
}
.nested-details[open] > summary {
  margin-bottom: 10px;
}

/* =====================================================================
 * Just-saved booking highlight (gentle gold glow + pulse)
 * Applied on dashboard right after Save → quick visual confirmation
 * ===================================================================== */
.booking-card--just-saved {
  animation: fk-just-saved 2.2s ease-out;
  border-color: rgba(244, 188, 85, 0.6) !important;
  box-shadow: 0 0 0 2px rgba(244, 188, 85, 0.25), 0 8px 24px rgba(244, 188, 85, 0.12);
}
@keyframes fk-just-saved {
  0%   { background: rgba(244, 188, 85, 0.16); }
  60%  { background: rgba(244, 188, 85, 0.08); }
  100% { background: transparent; }
}

/* =====================================================================
 * Sync icon button (top-right) — Apple-style, no surrounding frame
 * Idle: muted icon only. Hover: faint circle bg. Syncing: gold glow ring
 * + rotating icon. Still clickable while syncing.
 * ===================================================================== */
.sync-icon-btn {
  position: relative;
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 0;
  background: transparent;
  color: rgba(232, 227, 216, 0.7);
  cursor: pointer;
  border-radius: 50%;
  transition: color 0.15s ease, background 0.18s ease, transform 0.1s ease;
}
.sync-icon-btn:hover {
  color: var(--gold-2);
  background: rgba(244, 188, 85, 0.08);
}
.sync-icon-btn:active {
  transform: scale(0.94);
}
.sync-icon {
  width: 22px;
  height: 22px;
  position: relative;
  z-index: 1;
  transition: transform 0.3s ease;
}
.sync-icon-glow {
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
/* Active sync state — glow ring + spinning icon, breath pulse */
.sync-icon-btn.is-syncing {
  color: var(--gold-2);
}
.sync-icon-btn.is-syncing .sync-icon {
  animation: fk-sync-spin 1.1s linear infinite;
}
.sync-icon-btn.is-syncing .sync-icon-glow {
  opacity: 1;
  background: radial-gradient(circle, rgba(244, 188, 85, 0.32) 0%, rgba(244, 188, 85, 0) 70%);
  box-shadow:
    0 0 0 1px rgba(244, 188, 85, 0.45),
    0 0 18px 2px rgba(244, 188, 85, 0.35);
  animation: fk-sync-breath 1.6s ease-in-out infinite;
}
@keyframes fk-sync-spin {
  to { transform: rotate(360deg); }
}
@keyframes fk-sync-breath {
  0%, 100% { box-shadow: 0 0 0 1px rgba(244, 188, 85, 0.32), 0 0 14px 1px rgba(244, 188, 85, 0.28); }
  50%      { box-shadow: 0 0 0 1px rgba(244, 188, 85, 0.55), 0 0 24px 4px rgba(244, 188, 85, 0.45); }
}

/* =====================================================================
 * Home title — single line, elegant brand mark + soft secondary
 * "FK Studio" prominent, "Booking Manager" muted on same baseline
 * ===================================================================== */
.home-title {
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 10px;
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -0.01em;
  line-height: 1.15;
}
.home-title__sub {
  font-size: 0.92rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--gold-2);
  text-transform: uppercase;
  opacity: 0.85;
}
@media (max-width: 480px) {
  .home-title { font-size: 1.45rem; gap: 8px; }
  .home-title__sub { font-size: 0.78rem; }
}

/* =====================================================================
 * Calendar load-level colors (month overview at a glance)
 * 1 short  → green  | 1 long  → yellow
 * 2 items  → red    | 3+ items → purple
 * Each level tints the whole cell PLUS the booking pills inside, so
 * the eye reads load instantly without comparing pill counts.
 * ===================================================================== */

/* GREEN — 1 booking ≤2 hours (easy day) */
body:has(.calendar-shell) .calendar-cell.cell-light {
  background: linear-gradient(180deg, rgba(105, 208, 148, 0.26), rgba(105, 208, 148, 0.08));
  box-shadow: inset 3px 0 0 #69d094, inset 0 0 0 1px rgba(105, 208, 148, 0.32);
}
body:has(.calendar-shell) .calendar-cell.cell-light .calendar-date { color: #baf7d2; opacity: 1; }
body:has(.calendar-shell) .calendar-cell.cell-light .calendar-job {
  background: rgba(105, 208, 148, 0.2);
  border-left-color: #69d094;
}
body:has(.calendar-shell) .calendar-cell.cell-light .calendar-job__time { color: #baf7d2; }

/* YELLOW — 1 booking >2 hours (long day, focus) */
body:has(.calendar-shell) .calendar-cell.cell-medium {
  background: linear-gradient(180deg, rgba(244, 188, 85, 0.26), rgba(244, 188, 85, 0.08));
  box-shadow: inset 3px 0 0 #f4bc55, inset 0 0 0 1px rgba(244, 188, 85, 0.32);
}
body:has(.calendar-shell) .calendar-cell.cell-medium .calendar-date { color: #ffd99a; opacity: 1; }
body:has(.calendar-shell) .calendar-cell.cell-medium .calendar-job {
  background: rgba(244, 188, 85, 0.2);
  border-left-color: #f4bc55;
}
body:has(.calendar-shell) .calendar-cell.cell-medium .calendar-job__time { color: #ffd99a; }

/* RED — 2 bookings (fully booked) */
body:has(.calendar-shell) .calendar-cell.cell-busy {
  background: linear-gradient(180deg, rgba(229, 114, 114, 0.28), rgba(229, 114, 114, 0.08));
  box-shadow: inset 3px 0 0 #e57272, inset 0 0 0 1px rgba(229, 114, 114, 0.32);
}
body:has(.calendar-shell) .calendar-cell.cell-busy .calendar-date { color: #ffb0b0; opacity: 1; }
body:has(.calendar-shell) .calendar-cell.cell-busy .calendar-job {
  background: rgba(229, 114, 114, 0.22);
  border-left-color: #e57272;
}
body:has(.calendar-shell) .calendar-cell.cell-busy .calendar-job__time { color: #ffb0b0; }

/* PURPLE — 3+ bookings (overbooked, double-check) */
body:has(.calendar-shell) .calendar-cell.cell-full {
  background: linear-gradient(180deg, rgba(167, 130, 215, 0.32), rgba(167, 130, 215, 0.1));
  box-shadow: inset 3px 0 0 #a782d7, inset 0 0 0 1px rgba(167, 130, 215, 0.32);
}
body:has(.calendar-shell) .calendar-cell.cell-full .calendar-date { color: #d8c0ff; opacity: 1; }
body:has(.calendar-shell) .calendar-cell.cell-full .calendar-job {
  background: rgba(167, 130, 215, 0.24);
  border-left-color: #a782d7;
}
body:has(.calendar-shell) .calendar-cell.cell-full .calendar-job__time { color: #d8c0ff; }

/* Personal items inside any cell stay blue-tinted so they're visually
 * distinct from photo bookings (different icon system + role). Keep the
 * blue accent regardless of cell load. */
body:has(.calendar-shell) .calendar-cell .calendar-job--personal {
  background: rgba(130, 180, 240, 0.22) !important;
  border-left-color: #82b4f0 !important;
}
body:has(.calendar-shell) .calendar-cell .calendar-job--personal .calendar-job__time {
  color: #cfe5ff !important;
}

/* =====================================================================
 * Calendar cell as a tap target — uniform pill, opens day-detail popup
 * ===================================================================== */
.calendar-cell[data-day-open] {
  border: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
}
.calendar-cell[data-day-open]:hover {
  filter: brightness(1.05);
}
.calendar-cell[data-day-open]:active {
  transform: scale(0.98);
  transition: transform 0.08s ease;
}

/* +N badge — distinct pill at bottom right showing hidden count */
body:has(.calendar-shell) .calendar-more {
  align-self: flex-end;
  margin-top: auto;
  font-size: 0.6rem;
  font-weight: 800;
  color: var(--gold-2);
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(217, 155, 66, 0.18);
  letter-spacing: 0.02em;
  line-height: 1.15;
}

/* =====================================================================
 * Day detail popup — full list of bookings + personal items for that day
 * ===================================================================== */
.day-detail-head {
  margin: 0 0 14px;
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--text);
}
.day-detail-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 60vh;
  overflow-y: auto;
  padding-right: 2px;
}
.day-detail-empty {
  text-align: center;
  padding: 24px 8px;
  margin: 0;
}
.day-detail-item {
  display: grid;
  grid-template-columns: 70px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.02);
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.day-detail-item:hover {
  background: rgba(217, 155, 66, 0.08);
  border-color: rgba(217, 155, 66, 0.4);
}
.day-detail-item--booking {
  border-left: 3px solid var(--gold-2);
}
.day-detail-item--personal {
  border-left: 3px solid #82b4f0;
}
.day-detail-time {
  font-size: 0.85rem;
  font-weight: 900;
  color: var(--gold-2);
  white-space: nowrap;
}
.day-detail-item--personal .day-detail-time {
  color: #cfe5ff;
}
.day-detail-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.day-detail-main strong {
  font-size: 0.95rem;
  font-weight: 800;
  line-height: 1.2;
}
.day-detail-main small {
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.25;
}
.day-detail-loc {
  font-style: italic;
  opacity: 0.85;
}
.day-detail-price {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--gold-2);
  white-space: nowrap;
}

/* =====================================================================
 * Section header icons (gold outline, matches insight-card icons)
 * Inline before the h2 text label.
 * ===================================================================== */
.section-h2-icon {
  flex-shrink: 0;
  color: var(--gold-2);
  vertical-align: -3px;
  margin-right: 8px;
}
h2 .section-h2-icon { vertical-align: -4px; }
summary .section-h2-icon { vertical-align: -3px; }

/* =====================================================================
 * Metric / Insight card icons — gold outline matching insight cards in
 * command center. Sits inline before the label text.
 * ===================================================================== */
.metric-icon {
  flex-shrink: 0;
  color: var(--gold-2);
  margin-right: 8px;
  vertical-align: -5px;
}
.insight-card__label,
.metric-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  line-height: 1.2;
}
.insight-card__label .metric-icon,
.metric-label .metric-icon {
  margin-right: 4px;
  vertical-align: middle;
}

/* =====================================================================
 * Custom select dropdown (lib/custom-select.js)
 * Replaces native <select> on mobile to avoid fullscreen native picker.
 * Pops a small inline list below the field — minimal, matches form
 * input styling so it fits seamlessly inside .field wrappers.
 * ===================================================================== */
.fk-select { position: relative; }
.fk-select__native {
  /* Keep in DOM for FormData but hide visually; never tap-able */
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
  clip: rect(0 0 0 0);
}
.fk-select__btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  text-align: left;
  gap: 10px;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.fk-select__btn:hover {
  border-color: rgba(217, 155, 66, 0.4);
  background: rgba(217, 155, 66, 0.05);
}
.fk-select--open .fk-select__btn {
  border-color: var(--gold-2);
  background: rgba(217, 155, 66, 0.08);
}
.fk-select__btn-text {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fk-select__chev {
  flex-shrink: 0;
  color: var(--gold-2);
  transition: transform 0.18s ease;
}
.fk-select--open .fk-select__chev { transform: rotate(180deg); }

.fk-select__pop {
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  z-index: 50;
  max-height: 280px;
  overflow-y: auto;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(20, 19, 25, 0.98);
  backdrop-filter: blur(14px);
  box-shadow: 0 12px 36px -12px rgba(0, 0, 0, 0.6), 0 4px 12px -4px rgba(0, 0, 0, 0.4);
  -webkit-overflow-scrolling: touch;
}
.fk-select__opt {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.fk-select__opt:hover {
  background: rgba(217, 155, 66, 0.12);
}
.fk-select__opt.is-active {
  background: rgba(217, 155, 66, 0.18);
  color: var(--gold-2);
  font-weight: 700;
}
