:root {
  --bg: #eef2f1;
  --card: #ffffff;
  --primary: #12a878;
  --primary-dark: #0d7d59;
  --primary-light: #e4f7f0;
  --text: #1f2a28;
  --muted: #6b7680;
  --border: #e3e9e6;
  --morning: #f5a524;
  --evening: #4f6df5;
  --full: #ef4444;
  --empty: #dfe4ea;
  --radius: 14px;
  --shadow: 0 2px 10px rgba(15, 43, 34, 0.06), 0 1px 2px rgba(15, 43, 34, 0.05);
  --shadow-md: 0 10px 26px rgba(15, 43, 34, 0.12);
}

* { box-sizing: border-box; }
.hidden { display: none !important; }
button, a, input, select, textarea { touch-action: manipulation; }

body {
  margin: 0;
  font-family: "Cairo", "Tahoma", "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  direction: rtl;
}
.skip-link { position: fixed; top: 8px; right: 8px; z-index: 120; transform: translateY(-150%); background: #fff; color: var(--primary-dark); border: 2px solid var(--primary); border-radius: 8px; padding: 9px 12px; font-weight: 700; }
.skip-link:focus { transform: translateY(0); }

.login-page { min-height: 100vh; }
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}
.login-card { width: min(100%, 420px); margin: 0; padding: 30px; }
.login-brand { font-size: 44px; text-align: center; }
.login-card h1 { text-align: center; margin: 8px 0; font-size: 24px; }
.login-card .hint { text-align: center; margin-bottom: 22px; }
.login-card label { display: block; margin-bottom: 14px; }
.login-card input { margin-top: 6px; }
.login-submit { width: 100%; margin-top: 8px; }
.login-error { min-height: 24px; color: #c0292c; font-size: 13px; font-weight: 700; }

/* ---------- Shell layout ---------- */
.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: linear-gradient(180deg, #103a2c 0%, #0b2b21 100%);
  color: #eafff5;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 6px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  margin-bottom: 14px;
}
.brand-icon { width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0; }
.brand h1 { font-size: 17px; margin: 0; color: #fff; font-weight: 700; line-height: 1.3; }

.tabs { display: flex; flex-direction: column; gap: 4px; flex: 1; }

.tab-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  text-align: right;
  border: none;
  background: transparent;
  color: #cfe9de;
  padding: 11px 14px;
  border-radius: 10px;
  font-size: 14.5px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.tab-btn .nav-icon { font-size: 16px; width: 20px; text-align: center; flex-shrink: 0; }
.nav-icon svg, .mobile-nav svg { width: 21px; height: 21px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; display: block; }
.tab-btn:hover { background: rgba(255, 255, 255, 0.08); color: #fff; }
.tab-btn.active {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 4px 14px rgba(18, 168, 120, 0.4);
}

.sidebar-footer {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.35);
  padding-top: 14px;
  margin-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.main-area { flex: 1; min-width: 0; }

.top-toolbar {
  min-height: 58px;
  padding: 9px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  position: sticky;
  top: 0;
  z-index: 18;
  background: rgba(238, 242, 241, .94);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(10px);
}
.live-sync-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; font-weight: 700; }
.live-sync-dot { width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; box-shadow: 0 0 0 3px rgba(148,163,184,.16); }
.live-sync-status.connected .live-sync-dot { background: var(--primary); box-shadow: 0 0 0 3px rgba(18,168,120,.16); }
.live-sync-status.syncing .live-sync-dot { background: var(--morning); animation: syncPulse .8s ease-in-out infinite alternate; }
.live-sync-status.disconnected .live-sync-dot { background: #dc2626; box-shadow: 0 0 0 3px rgba(220,38,38,.13); }
.refresh-page-btn { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; background: #fff; }
.refresh-page-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
@keyframes syncPulse { from { opacity: .45; transform: scale(.85); } to { opacity: 1; transform: scale(1.1); } }

main { padding: 26px 30px 70px; max-width: 1080px; margin: 0 auto; }

/* ---------- Daily command center ---------- */
.today-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 6px 0 18px;
}
.today-hero .page-title { margin: 4px 0; font-size: 26px; }
.today-hero p { margin: 0; color: var(--muted); }
.eyebrow { color: var(--primary-dark); font-size: 12px; font-weight: 800; }
.quick-primary { min-height: 46px; white-space: nowrap; }
.today-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.today-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; min-width: 0; box-shadow: var(--shadow); }
.skeleton-card { min-height: 132px; border-color: transparent; background: linear-gradient(90deg, #edf2f0 25%, #f8faf9 50%, #edf2f0 75%); background-size: 200% 100%; animation: skeletonMove 1.2s infinite linear; }
.today-card-head { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 8px; margin-bottom: 10px; }
.today-card-head h3 { font-size: 13px; margin: 0; }
.today-card-head strong { font-size: 22px; font-variant-numeric: tabular-nums; }
.today-dot { width: 9px; height: 9px; border-radius: 50%; background: #94a3b8; }
.tone-info .today-dot { background: #2563eb; }
.tone-success .today-dot { background: var(--primary); }
.tone-warning .today-dot { background: #e49a11; }
.tone-danger .today-dot { background: #dc2626; }
.today-card-list { display: grid; gap: 5px; }
.today-item { width: 100%; min-width: 0; border: 0; border-radius: 8px; background: #f7faf9; color: var(--text); min-height: 36px; padding: 7px 8px; display: flex; justify-content: space-between; align-items: center; gap: 8px; font-family: inherit; cursor: pointer; text-align: right; }
.today-item:hover { background: var(--primary-light); }
.today-item span { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.today-item small { color: var(--muted); flex-shrink: 0; }
.today-empty { color: var(--muted); font-size: 12px; margin: 12px 0 3px; }
.today-more { border: 0; background: transparent; color: var(--primary-dark); font-family: inherit; font-weight: 700; cursor: pointer; margin-top: 8px; padding: 5px 0; }
.quick-actions-card { display: flex; justify-content: space-between; align-items: center; gap: 18px; }
.quick-actions-card h2 { margin: 0; font-size: 16px; }
.quick-actions-card p { margin: 3px 0 0; }
.quick-actions-row { display: flex; gap: 8px; flex-wrap: wrap; }
.quick-action { border: 1px solid var(--border); background: #fff; border-radius: 11px; min-height: 46px; padding: 8px 12px; display: flex; align-items: center; gap: 7px; color: var(--text); font-family: inherit; cursor: pointer; }
.quick-action:hover { border-color: var(--primary); background: var(--primary-light); }
.quick-action span { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--primary-light); color: var(--primary-dark); font-size: 18px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin: 26px 0 10px; }
.section-heading h2 { margin: 2px 0 0; font-size: 20px; }
.dashboard-disclosure { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 0 16px; margin: 16px 0; box-shadow: var(--shadow); }
.dashboard-disclosure summary { cursor: pointer; min-height: 52px; display: flex; align-items: center; font-weight: 800; color: var(--primary-dark); }
.dashboard-disclosure .summary-cards { padding: 0 0 16px; }

.mobile-nav, .sheet-overlay { display: none; }

.page-head { margin-bottom: 18px; }
.page-title { font-size: 21px; margin: 0; font-weight: 800; color: var(--text); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ---------- Cards ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}
.card h2 { margin-top: 0; font-size: 17px; font-weight: 800; }

.card.subcard {
  background: #f7faf9;
  padding: 16px 18px;
  margin: 6px 0 18px;
  box-shadow: none;
}
.card.subcard h3 { margin: 0 0 8px; font-size: 14.5px; font-weight: 700; }

.other-service-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
  align-items: center;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--border);
}
.other-service-row .os-price { width: 110px; flex-shrink: 0; }
.other-service-row .os-third { width: 130px; flex-shrink: 0; }
.other-service-row .os-note { flex: 1; min-width: 140px; }
.other-service-row .os-remainder {
  flex-basis: 100%;
  font-size: 12px;
  color: var(--primary-dark);
  font-weight: 700;
}
.other-service-row .remove-row-btn {
  flex-shrink: 0;
  border: none;
  background: #fdecec;
  color: var(--full);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  font-size: 16px;
  cursor: pointer;
  transition: background 0.15s;
}
.other-service-row .remove-row-btn:hover { background: #fadbdb; }
.other-service-row { display: grid; grid-template-columns: 1.15fr .8fr 1fr 1.3fr 44px; align-items: end; }
.other-service-row label { min-width: 0; }
.other-service-row .os-type, .other-service-row .os-price, .other-service-row .os-third, .other-service-row .os-note { width: 100%; min-width: 0; }
.other-service-row .os-note-wrap { min-width: 0; }
.other-service-row .os-remainder { grid-column: 1 / 5; grid-row: 2; }
.other-service-row .remove-row-btn { grid-column: 5; grid-row: 1; width: 44px; height: 44px; }
.provider-summary-title { margin: 24px 0 10px; font-size: 16px; }
.provider-summary-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.provider-card { border: 1px solid var(--border); border-radius: 12px; padding: 13px; background: #f8fbfa; display: grid; gap: 10px; }
.provider-card > div:first-child { padding-bottom: 8px; border-bottom: 1px solid var(--border); }
.provider-card > div:not(:first-child) { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.provider-card small, .provider-card span { display: block; color: var(--muted); font-size: 11px; }
.provider-card > div:not(:first-child) strong { font-variant-numeric: tabular-nums; }

.booking-detail-cards {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}
.detail-card { background: var(--bg); border-radius: 10px; padding: 12px 14px; }
.detail-card.full-width { grid-column: 1 / -1; }
.detail-card .label { font-size: 11px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.detail-card .value { font-size: 15px; font-weight: 700; }
.detail-card.red { background: #fdecec; }
.detail-card.red .label { color: #8a2c2e; }
.detail-card.red .value { color: #c0292c; }
.detail-card.green { background: #e6f7ee; }
.detail-card.green .label { color: #1e6b3e; }
.detail-card.green .value { color: #1f8a4c; }

.search-input {
  width: 100%;
  margin-bottom: 16px;
  padding: 11px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}

.filters-grid {
  display: grid;
  grid-template-columns: minmax(190px, 2fr) repeat(6, minmax(125px, 1fr)) auto;
  gap: 8px;
  align-items: center;
  margin-bottom: 16px;
}
.filters-grid .search-input { margin-bottom: 0; }

.urgent-list { display: grid; gap: 10px; }
.notifications-list { display: grid; gap: 7px; margin-bottom: 12px; }
.notification-item { display: flex; justify-content: space-between; gap: 10px; width: 100%; border: 1px solid var(--border); border-inline-start: 4px solid var(--primary); background: white; border-radius: 9px; padding: 9px 11px; font-family: inherit; color: var(--text); text-align: right; cursor: pointer; }
.notification-item.danger { border-inline-start-color: var(--full); }
.notification-item.warning { border-inline-start-color: var(--morning); }
.notification-item small { color: var(--muted); white-space: nowrap; }
.urgent-group { border-inline-start: 4px solid var(--primary); background: var(--bg); border-radius: 10px; padding: 10px 12px; }
.urgent-group.danger { border-inline-start-color: var(--full); }
.urgent-group.warning { border-inline-start-color: var(--morning); }
.urgent-group > div { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }
.urgent-link { border: 1px solid var(--border); background: white; color: var(--text); border-radius: 8px; padding: 6px 9px; cursor: pointer; font-family: inherit; }

.finance-section { border-top: 1px solid var(--border); margin-top: 16px; padding-top: 14px; }
.finance-section h4 { margin: 0 0 10px; }
.history-list { display: grid; gap: 7px; margin-bottom: 10px; }
.history-item { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: var(--bg); border-radius: 9px; padding: 8px 10px; font-size: 12px; }
.inline-finance-form, .report-controls { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.inline-finance-form input, .inline-finance-form select { min-width: 130px; flex: 1; }
.deposit-summary { background: var(--primary-light); color: var(--primary-dark); padding: 9px 12px; border-radius: 9px; margin-bottom: 10px; font-size: 13px; font-weight: 700; }
.success-note { color: var(--primary-dark); font-weight: 700; }
.whatsapp-btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-color: #128c5e; background: #128c5e; color: white; }
.whatsapp-btn:hover { background: #0d744d; color: white; }
.share-doc-btn { border: 1px solid #128c5e; background: white; color: #0d744d; }
.share-doc-btn:hover { background: #e8f7f1; color: #095d3d; }
.whatsapp-btn svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.whatsapp-composer { margin-top: 16px; padding: 14px; border: 1px solid #b9dfd0; border-radius: 12px; background: #f1fbf7; }
.whatsapp-composer-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.whatsapp-composer-head > div { display: grid; gap: 2px; }
.whatsapp-composer-head small { color: var(--muted); }
.whatsapp-composer-grid { display: grid; grid-template-columns: minmax(180px, 260px) 1fr; gap: 10px; }
.whatsapp-composer-grid .full-width { grid-column: 1 / -1; }
.whatsapp-composer textarea { min-height: 135px; resize: vertical; line-height: 1.7; }
.report-controls { margin-bottom: 18px; }
.report-controls label { min-width: 150px; }
.status-control { display: flex; gap: 8px; align-items: center; }
.status-control select { flex: 1; }
.status-badge { display: inline-block; border-radius: 999px; padding: 3px 8px; font-size: 11px; font-weight: 800; background: var(--border); }
.status-confirmed { background: #e5edff; color: #3852b8; }
.status-checked_in { background: var(--primary-light); color: var(--primary-dark); }
.status-checked_out { background: #e8eceb; color: #4c5a56; }
.status-cancelled, .status-no_show { background: #fdecec; color: #b52c31; }
.status-new { background: #fff1d6; color: #99610a; }
.customer-stats { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.customer-stats span { background: var(--primary-light); color: var(--primary-dark); border-radius: 9px; padding: 7px 10px; font-size: 12px; font-weight: 700; }
.search-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-light); }

.stars-display {
  color: #f2b400;
  font-size: 13px;
  letter-spacing: 1px;
  margin-inline-start: 4px;
}

.rating-widget { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.rating-star { font-size: 26px; color: var(--empty); cursor: pointer; line-height: 1; transition: transform 0.1s; }
.rating-star.filled { color: #f2b400; }
.rating-star:hover { color: #f2b400; transform: scale(1.15); }

/* ---------- Calendar ---------- */
.month-nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.month-nav h2 { margin: 0; font-size: 18px; font-weight: 800; }

.icon-btn {
  border: 1px solid var(--border);
  background: var(--card);
  border-radius: 10px;
  padding: 9px 16px;
  cursor: pointer;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  color: var(--text);
  transition: background 0.15s, border-color 0.15s;
}
.icon-btn:hover { background: var(--primary-light); border-color: var(--primary); }

.calendar-legend {
  display: flex;
  gap: 18px;
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.dot {
  display: inline-block;
  width: 10px; height: 10px;
  border-radius: 50%;
  margin-left: 6px;
  vertical-align: middle;
}
.dot.full { background: var(--full); }
.dot.morning { background: var(--morning); }
.dot.evening { background: var(--evening); }
.dot.empty { background: var(--empty); }

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.calendar-grid > * { min-width: 0; }
.cal-weekday {
  text-align: center;
  font-size: 12px;
  color: var(--muted);
  padding: 4px 0 10px;
  font-weight: 700;
}
.cal-day {
  appearance: none;
  width: 100%;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  min-height: 82px;
  padding: 8px;
  cursor: pointer;
  position: relative;
  font-size: 12px;
  font-family: inherit;
  color: var(--text);
  text-align: right;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: transform 0.12s, box-shadow 0.12s, border-color 0.12s;
}
.cal-day:hover { transform: translateY(-3px); box-shadow: var(--shadow-md); border-color: var(--primary); }
.cal-day.today { border: 2px solid var(--primary); }
.cal-day.empty-cell { visibility: hidden; cursor: default; box-shadow: none; }
.cal-day .day-num { font-weight: 800; font-size: 13.5px; }
.cal-day .day-status-bar {
  height: 6px;
  border-radius: 4px;
  margin-top: auto;
}
.cal-day .day-status-bar.full { background: var(--full); }
.cal-day .day-status-bar.morning { background: var(--morning); }
.cal-day .day-status-bar.evening { background: var(--evening); }
.cal-day .day-status-bar.both { background: linear-gradient(90deg, var(--morning) 50%, var(--evening) 50%); }
.cal-day .day-status-bar.emptyday { background: var(--empty); }
.cal-day .day-guest { font-size: 10px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Summary cards ---------- */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
}
.summary-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: var(--shadow);
  transition: transform 0.12s, box-shadow 0.12s;
}
.summary-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.summary-card .label { font-size: 12px; color: var(--muted); margin-bottom: 8px; font-weight: 600; }
.summary-card .value { font-size: 21px; font-weight: 800; }
.summary-card.highlight { border-color: var(--primary); }
.summary-card.highlight .value { color: var(--primary); }

.summary-card.red { background: #fdecec; border-color: #f3b8b9; }
.summary-card.red .label { color: #8a2c2e; }
.summary-card.red .value { color: #c0292c; }

.summary-card.yellow { background: #fef8e6; border-color: #f2d98a; }
.summary-card.yellow .label { color: #8a6d00; }
.summary-card.yellow .value { color: #b38600; }

.summary-card.green { background: #e6f7ee; border-color: #a3ddba; }
.summary-card.green .label { color: #1e6b3e; }
.summary-card.green .value { color: #1f8a4c; }

.images-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.image-thumb {
  position: relative;
  width: 84px;
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.image-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.image-thumb .remove-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  font-size: 13px;
  line-height: 1;
  cursor: pointer;
}

/* ---------- Forms ---------- */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.form-grid > * { min-width: 0; }
label {
  display: flex;
  flex-direction: column;
  font-size: 13px;
  color: var(--muted);
  gap: 6px;
  font-weight: 600;
  min-width: 0;
}
label.full-width { grid-column: 1 / -1; }
input, select, textarea {
  font-family: inherit;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 14px;
  color: var(--text);
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
  max-width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}
input:disabled { background: var(--bg); color: var(--muted); }
input[type="file"] { padding: 8px; font-size: 13px; }

.type-row {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
  font-size: 14px;
}
.badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 20px;
  background: var(--empty);
  font-size: 13px;
  font-weight: 700;
}
.badge.morning { background: var(--morning); color: #4a2f00; }
.badge.evening { background: var(--evening); color: #fff; }
.badge.full { background: var(--full); color: #fff; }

.override-toggle { flex-direction: row; align-items: center; gap: 6px; font-weight: 500; }
.radio-inline { flex-direction: row; align-items: center; gap: 6px; font-size: 14px; font-weight: 500; }

.form-actions { display: flex; gap: 10px; }

.btn {
  border: none;
  border-radius: 10px;
  padding: 10px 22px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.1s, box-shadow 0.15s, background 0.15s;
}
.btn.primary { background: var(--primary); color: #fff; box-shadow: 0 3px 10px rgba(18, 168, 120, 0.3); }
.btn.primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn.ghost { background: #fff; border: 1px solid var(--border); color: var(--muted); }
.btn.ghost:hover { background: var(--bg); }
.btn.small { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn.danger { background: #fdecec; color: var(--full); }
.btn.danger:hover { background: #fadbdb; }
.btn.info { background: var(--primary-light); color: var(--primary-dark); }
.btn.info:hover { background: #cdeee2; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: 10px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 11px 12px; text-align: right; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 700; background: #f7faf9; }
tr:hover td { background: #f5f9f7; }

/* colored right-edge accent per booking type, for quick visual scanning */
#bookingsTable { border-collapse: separate; border-spacing: 0; }
#bookingsTable tbody tr td:first-child { border-inline-start: 4px solid transparent; }
#bookingsTable tbody tr.row-morning td:first-child { border-inline-start-color: var(--morning); }
#bookingsTable tbody tr.row-evening td:first-child { border-inline-start-color: var(--evening); }
#bookingsTable tbody tr.row-full td:first-child { border-inline-start-color: var(--full); }

.hint { font-size: 13px; color: var(--muted); line-height: 1.6; }

.debt-list { display: flex; flex-direction: column; gap: 10px; }
.debt-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg);
  border-radius: 10px;
  padding: 12px 16px;
  gap: 10px;
  flex-wrap: wrap;
}
.debt-item .name { font-weight: 700; }
.debt-item .amount { color: var(--full); font-weight: 800; }

/* ---------- Modals ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 24, 18, 0.5);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  animation: fadeIn 0.15s ease;
}
.modal-overlay.hidden { display: none; }
.modal {
  background: var(--card);
  border-radius: 18px;
  padding: 26px;
  max-width: 460px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  position: relative;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.28);
  animation: popIn 0.18s ease;
}
.modal-close {
  position: absolute;
  top: 12px; left: 12px;
  border: none;
  background: var(--bg);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  font-size: 18px;
  cursor: pointer;
  color: var(--muted);
}
.modal-close:hover { background: var(--border); }
.booking-detail-modal { width: min(94vw, 900px); max-width: 900px; padding: 26px 28px 30px; }
.modal-title-block { padding: 0 0 15px; margin-bottom: 18px; border-bottom: 1px solid var(--border); }
.modal-title-block h3 { margin: 3px 0 0; font-size: 21px; }
.day-booking-entry {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 10px;
  font-size: 13px;
  line-height: 1.9;
}
.day-booking-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.day-booking-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; color: var(--muted); }
.day-booking-meta span { min-width: 0; overflow-wrap: anywhere; }
.day-booking-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn {
  from { opacity: 0; transform: scale(0.96) translateY(6px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

/* ---------- Mobile (app-style bottom navigation) ---------- */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }

  .sidebar {
    width: 100%;
    height: auto;
    position: sticky;
    top: 0;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    padding: 12px 16px;
    z-index: 40;
  }
  .brand { border-bottom: none; margin-bottom: 0; padding: 0; }
  .sidebar-footer { display: none; }

  /* nav moves out of normal flow into a fixed app-style bottom bar */
  .tabs {
    position: fixed;
    bottom: 0;
    right: 0;
    left: 0;
    flex-direction: row;
    justify-content: space-around;
    align-items: stretch;
    gap: 0;
    background: #0b2b21;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.25);
    z-index: 50;
  }
  .tab-btn {
    flex-direction: column;
    flex: 1;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 2px;
    border-radius: 10px;
    font-size: 10.5px;
    text-align: center;
    min-width: 0;
  }
  .tab-btn .nav-icon { font-size: 19px; width: auto; }
  .tab-btn span:last-child {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
  }
  .tab-btn.active { box-shadow: none; }

  .top-toolbar { top: 58px; min-height: 52px; padding: 6px 14px; }
  .live-sync-status { font-size: 11px; }
  .refresh-page-btn { min-height: 40px; padding: 7px 10px; }
  main { padding: 14px 14px calc(84px + env(safe-area-inset-bottom, 0px)); }
  .form-grid { grid-template-columns: 1fr; }
  .filters-grid { grid-template-columns: 1fr 1fr; }
  .filters-grid .search-input { grid-column: 1 / -1; }
  .inline-finance-form, .report-controls { flex-direction: column; align-items: stretch; }
  .history-item { align-items: flex-start; }
  .page-title { font-size: 18px; }

  /* tighter calendar so all 7 columns stay comfortably tappable */
  .card { padding: 14px 12px; }
  .calendar-grid { gap: 4px; }
  .cal-day { min-height: 56px; padding: 5px; gap: 2px; }
  .cal-day .day-num { font-size: 12px; }
  .cal-day .day-guest { display: none; }
  .cal-weekday { font-size: 10.5px; padding: 2px 0 6px; }
  .calendar-legend { font-size: 11px; gap: 10px; }

  /* stacked "card" tables instead of horizontal scroll */
  .table-wrap { overflow-x: visible; }
  table, thead, tbody, th, td, tr { display: block; width: 100%; }
  thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  tbody tr {
    border: 1px solid var(--border);
    border-radius: 12px;
    margin-bottom: 12px;
    padding: 6px 12px;
    background: var(--card);
    box-shadow: var(--shadow);
  }
  #bookingsTable tbody tr td:first-child { border-inline-start: none; }
  #bookingsTable tbody tr { border-inline-start: 4px solid transparent; }
  #bookingsTable tbody tr.row-morning { border-inline-start-color: var(--morning); }
  #bookingsTable tbody tr.row-evening { border-inline-start-color: var(--evening); }
  #bookingsTable tbody tr.row-full { border-inline-start-color: var(--full); }
  td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 9px 2px;
    border-bottom: 1px dashed var(--border);
    white-space: normal;
    text-align: left;
  }
  td:last-child { border-bottom: none; justify-content: flex-start; flex-wrap: wrap; }
  td::before {
    content: attr(data-label);
    font-weight: 700;
    color: var(--muted);
    font-size: 12px;
    flex-shrink: 0;
  }
  td[data-label=""]::before { content: none; }
}

/* ---------- Focused mobile navigation ---------- */
@media (max-width: 900px) {
  .sidebar .tabs { display: none; }
  .mobile-nav {
    position: fixed;
    z-index: 80;
    bottom: 0;
    right: 0;
    left: 0;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    background: #0b2b21;
    padding: 5px 4px calc(5px + env(safe-area-inset-bottom, 0px));
    box-shadow: 0 -8px 24px rgba(0,0,0,.22);
  }
  .mobile-nav-btn { position: relative; border: 0; background: transparent; color: #bbd7cd; min-height: 54px; padding: 5px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-family: inherit; font-size: 10.5px; cursor: pointer; touch-action: manipulation; }
  .mobile-nav-btn.active { color: #fff; }
  .mobile-nav-btn.active::after { content: ""; position: absolute; bottom: 1px; width: 22px; height: 3px; border-radius: 4px; background: var(--primary); }
  .mobile-add-btn { color: #fff; }
  .mobile-add-btn.active::after { display: none; }
  .mobile-add-circle { width: 44px; height: 44px; margin-top: -24px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; border: 4px solid var(--bg); box-shadow: 0 4px 14px rgba(18,168,120,.4); }
  .mobile-add-circle svg { width: 23px; height: 23px; }
  .mobile-icon-wrap { position: relative; }
  .nav-badge { position: absolute; top: -7px; left: -10px; min-width: 17px; height: 17px; padding: 0 4px; display: grid; place-items: center; border-radius: 10px; background: #dc2626; color: #fff; font-size: 9px; font-style: normal; font-weight: 800; border: 2px solid #0b2b21; }
  .sheet-overlay { position: fixed; inset: 0; z-index: 100; display: flex; align-items: flex-end; background: rgba(7, 22, 17, .58); padding: 0; }
  .bottom-sheet { width: 100%; max-height: 82dvh; overflow-y: auto; background: var(--card); border-radius: 22px 22px 0 0; padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px)); box-shadow: 0 -12px 36px rgba(0,0,0,.24); animation: sheetUp .2s ease-out; }
  .sheet-handle { width: 42px; height: 4px; border-radius: 4px; background: #cbd5d1; margin: 2px auto 10px; }
  .sheet-head { display: flex; justify-content: space-between; align-items: center; }
  .sheet-head h2 { margin: 0; font-size: 19px; }
  .sheet-close { width: 44px; height: 44px; border: 0; border-radius: 50%; background: var(--bg); color: var(--text); font-size: 23px; cursor: pointer; }
  .sheet-actions { display: grid; gap: 9px; margin-top: 12px; }
  .sheet-actions > button { border: 1px solid var(--border); background: #fff; min-height: 64px; border-radius: 13px; padding: 10px 12px; display: grid; grid-template-columns: 40px 1fr; grid-template-rows: auto auto; column-gap: 10px; text-align: right; color: var(--text); font-family: inherit; cursor: pointer; }
  .sheet-actions > button > span { grid-row: 1 / 3; width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; background: var(--primary-light); color: var(--primary-dark); font-size: 22px; }
  .sheet-actions strong { align-self: end; }
  .sheet-actions small { color: var(--muted); align-self: start; }
  .more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 12px 0 18px; }
  .more-grid button { min-height: 74px; border: 1px solid var(--border); border-radius: 13px; background: #fff; color: var(--text); font-family: inherit; font-weight: 700; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; cursor: pointer; }
  .more-grid button svg { width: 23px; height: 23px; fill: none; stroke: var(--primary-dark); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
  .mobile-logout { width: 100%; min-height: 48px; border: 1px solid #f3b8b9; border-radius: 12px; background: #fff5f5; color: #a52124; font-family: inherit; font-weight: 800; cursor: pointer; }
  .today-hero { align-items: flex-start; padding-top: 2px; }
  .today-hero .page-title { font-size: 22px; }
  .today-hero p { font-size: 13px; }
  .today-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .today-card { padding: 11px; }
  .today-card-head { grid-template-columns: auto 1fr auto; gap: 6px; }
  .today-card-head h3 { font-size: 12px; }
  .today-card-head strong { font-size: 19px; }
  .today-item { min-height: 44px; }
  .quick-actions-card { align-items: stretch; flex-direction: column; }
  .quick-actions-row { display: grid; grid-template-columns: 1fr 1fr; }
  .quick-action { min-height: 50px; justify-content: flex-start; }
  input, select, textarea { min-height: 44px; font-size: 16px; }
  .btn { min-height: 44px; }
  .btn.small { min-height: 44px; padding: 8px 12px; }
  .modal-close { width: 44px; height: 44px; }
  .other-service-row { grid-template-columns: 1fr; align-items: stretch; padding: 12px; border: 1px solid var(--border); border-radius: 12px; }
  .other-service-row .os-remainder, .other-service-row .remove-row-btn { grid-column: 1; grid-row: auto; }
  .other-service-row .remove-row-btn { justify-self: end; }
  .provider-summary-grid { grid-template-columns: 1fr; }
}

@keyframes sheetUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes skeletonMove { from { background-position: 100% 0; } to { background-position: -100% 0; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; } }

@media (max-width: 380px) {
  .cal-day { min-height: 48px; }
  .tab-btn { font-size: 9.5px; }
  .tab-btn .nav-icon { font-size: 17px; }
  .filters-grid { grid-template-columns: 1fr; }
  .filters-grid .search-input { grid-column: auto; }
}

.tasks-list { display: grid; gap: 12px; }
.task-item { display: flex; justify-content: space-between; gap: 16px; align-items: center; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.task-item.overdue { border-inline-start: 4px solid #d64545; }
.task-item small, .history-item small { display: block; color: var(--muted); margin-top: 4px; }
.task-item p { margin: 6px 0 0; }
.task-actions { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; }
.task-filters { display: flex; gap: 10px; margin-bottom: 14px; }
.history-item { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 12px 0; border-bottom: 1px solid var(--border); }
.history-item:last-child { border-bottom: 0; }
.status-badge { border-radius: 999px; padding: 4px 9px; font-size: .8rem; white-space: nowrap; }
.status-pending { background: #fff1bf; color: #765600; }
.status-in_progress { background: #dcecff; color: #165c9c; }
.status-done { background: #d8f2e7; color: #176749; }
.status-cancelled { background: #eee; color: #666; }
@media (max-width: 720px) { .task-item, .history-item { align-items: stretch; flex-direction: column; } .tabs { overflow-x: auto; } }

/* ---------- Unified workspace pages (home intentionally excluded) ---------- */
.workspace-page { --workspace-gap: 16px; }
.workspace-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 4px 2px 18px;
  margin-bottom: 0;
  border-bottom: 1px solid var(--border);
}
.workspace-header .page-title { margin: 3px 0 4px; font-size: clamp(22px, 2.3vw, 29px); letter-spacing: -.02em; }
.workspace-header p { margin: 0; max-width: 620px; color: var(--muted); font-size: 13px; line-height: 1.7; }
.workspace-primary-action { min-height: 46px; white-space: nowrap; }

.workspace-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin: 16px 0;
}
.workspace-stat {
  min-width: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px 14px;
  box-shadow: 0 1px 3px rgba(15, 43, 34, .04);
  position: relative;
  overflow: hidden;
}
.workspace-stat::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 3px; background: #aab7b2; }
.workspace-stat.accent::before { background: var(--primary); }
.workspace-stat.warning::before { background: var(--morning); }
.workspace-stat.danger::before { background: #dc2626; }
.workspace-stat .stat-label { display: block; color: var(--muted); font-size: 11.5px; font-weight: 700; margin-bottom: 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.workspace-stat .stat-value { display: block; color: var(--text); font-size: 20px; line-height: 1.2; font-weight: 850; font-variant-numeric: tabular-nums; }
.workspace-stat .stat-note { display: block; color: var(--muted); font-size: 10.5px; margin-top: 3px; }

.workspace-card { border-radius: 16px; box-shadow: 0 5px 18px rgba(15, 43, 34, .055); }
.section-card-head { min-height: 45px; display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; padding-bottom: 14px; margin-bottom: 16px; border-bottom: 1px solid var(--border); }
.section-card-head h2, .workspace-card > h2 { margin: 2px 0 0; font-size: 17px; }
.section-kicker { display: block; color: var(--primary-dark); font-size: 10.5px; font-weight: 800; letter-spacing: .02em; }
.danger-kicker { color: #b42328; }
.workspace-search { max-width: 470px; }

#tab-tasks.active {
  display: grid;
  grid-template-columns: minmax(290px, .7fr) minmax(0, 1.3fr);
  gap: var(--workspace-gap);
  align-items: start;
}
#tab-tasks .workspace-header, #tab-tasks .workspace-stats { grid-column: 1 / -1; }
#tab-tasks .task-form-card, #tab-tasks .task-list-card { margin-bottom: 0; }
#tab-tasks .task-list-card { min-height: 100%; }
.task-filters { margin: 0; flex-wrap: wrap; justify-content: flex-end; }
.task-filters select { min-width: 135px; }
.task-item { background: #fbfdfc; box-shadow: 0 1px 2px rgba(15, 43, 34, .03); }

.booking-progress { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0; }
.booking-progress span { min-height: 46px; display: flex; align-items: center; gap: 8px; padding: 8px 11px; border: 1px solid var(--border); border-radius: 11px; background: rgba(255,255,255,.66); color: var(--muted); font-size: 12px; font-weight: 700; }
.booking-progress b { width: 25px; height: 25px; flex: 0 0 25px; display: grid; place-items: center; border-radius: 50%; background: #e5ebe8; color: #53615c; }
.booking-progress .active { background: var(--primary-light); color: var(--primary-dark); border-color: #b8e7d5; }
.booking-progress .active b { background: var(--primary); color: #fff; }
.booking-form-card { max-width: 920px; margin-inline: auto; }
.booking-form-card #bookingFormTitle { padding-bottom: 14px; margin-bottom: 17px; border-bottom: 1px solid var(--border); }
.booking-form-card .type-row { background: #f7faf9; border: 1px solid var(--border); border-radius: 12px; padding: 12px 14px; }
.booking-form-card .subcard { border-radius: 13px; }
.attachment-section input[type="file"] { width: 100%; border-style: dashed; background: #fff; }

.filters-grid { padding: 12px; border-radius: 12px; background: #f7faf9; border: 1px solid var(--border); }
.filters-grid input, .filters-grid select { min-width: 0; }
.workspace-card .table-wrap { border: 1px solid var(--border); }
.workspace-card table th { height: 44px; background: #f4f8f6; }
.workspace-card table tbody tr:last-child td { border-bottom: 0; }
.expense-list-card .table-wrap.seven-row-scroll {
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}
.expense-list-card .table-wrap.seven-row-scroll thead {
  position: sticky;
  top: 0;
  z-index: 2;
}

#tab-expenses.active {
  display: grid;
  grid-template-columns: minmax(290px, .72fr) minmax(0, 1.28fr);
  gap: var(--workspace-gap);
  align-items: start;
}
#tab-expenses .workspace-header, #tab-expenses .workspace-stats, #tab-expenses .debt-card { grid-column: 1 / -1; }
#tab-expenses .expense-form-card, #tab-expenses .expense-list-card, #tab-expenses .debt-card,
#tab-expenses .financial-debt-form-card, #tab-expenses .financial-debt-list-card { margin-bottom: 0; }
#tab-expenses .type-row { display: grid; align-items: stretch; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: #f8fbfa; }
#tab-expenses .radio-inline { min-height: 38px; flex-direction: row; }
.debt-card { border-color: #f0d1d2; }
.financial-debt-form-card { border-color: #eadcae; }

.report-controls { padding: 14px; margin-bottom: 20px; border: 1px solid var(--border); border-radius: 12px; background: #f7faf9; }
.report-controls label { flex: 1; }
.report-card .summary-cards { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.audit-card { margin-top: 2px; }

.comparison-controls { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 14px 0 18px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #f7faf9; }
.comparison-controls label { min-width: 155px; flex: 1; }
.comparison-change-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 9px; margin-bottom: 16px; }
.comparison-change-card { display: grid; gap: 4px; min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: white; }
.comparison-change-card > span:first-child, .comparison-change-card small { color: var(--muted); font-size: 11px; }
.comparison-change-card strong { overflow: hidden; font-size: 17px; text-overflow: ellipsis; }
.change-up, .change-down, .change-flat, .change-new { width: fit-content; border-radius: 999px; padding: 2px 7px; font-size: 11px; font-weight: 800; }
.change-up { color: #08754f; background: #e4f6ef; }
.change-down { color: #ad292e; background: #fdeced; }
.change-flat, .change-new { color: #586963; background: #edf2f0; }
.chart-shell { padding: 14px 12px 10px; border: 1px solid var(--border); border-radius: 12px; background: #fbfdfc; overflow: hidden; }
.chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.chart-head h3 { margin: 0; font-size: 14px; }
.chart-head p { margin: 3px 0 0; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; font-size: 11px; }
.chart-legend span { display: flex; align-items: center; gap: 5px; }
.chart-dot { display: inline-block; width: 9px; height: 9px; border-radius: 3px; }
.chart-dot.revenue, .monthly-bar.revenue { background: #0d7d59; }
.chart-dot.expenses, .monthly-bar.expenses { background: #d59131; }
.chart-dot.net, .monthly-bar.net { background: #3f6fc1; }
.monthly-chart { display: flex; align-items: stretch; gap: 7px; min-height: 230px; margin-top: 16px; padding: 8px 2px 0; border-bottom: 1px solid var(--border); overflow-x: auto; }
.monthly-group { display: flex; flex: 1 0 54px; min-width: 54px; flex-direction: column; justify-content: flex-end; gap: 7px; text-align: center; color: var(--muted); font-size: 10px; }
.monthly-bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; height: 185px; }
.monthly-bar { width: 10px; height: var(--bar-height); min-height: 3px; border-radius: 4px 4px 1px 1px; transition: opacity .15s; }
.monthly-bar:hover { opacity: .72; }
.monthly-bar.negative { background: #bc3c43; }
.comparison-table-wrap { margin-top: 14px; }
.comparison-table-wrap table { min-width: 780px; }

.document-settings-card { grid-column: 1 / -1; }
.logo-settings-row { display: flex; align-items: center; gap: 16px; margin: 16px 0 20px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #f7faf9; }
.document-logo-preview { display: grid; place-items: center; width: 96px; height: 96px; flex: 0 0 96px; overflow: hidden; border: 1px dashed #9eb3ac; border-radius: 14px; background: white; color: var(--muted); font-size: 11px; text-align: center; }
.document-logo-preview img { width: 100%; height: 100%; object-fit: contain; padding: 6px; }
.logo-upload-form { display: flex; flex: 1; align-items: end; gap: 10px; }
.logo-upload-form label { flex: 1; }
.settings-fieldset { margin: 0 0 16px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; }
.settings-fieldset legend { padding: 0 8px; color: var(--primary-dark); font-size: 13px; font-weight: 800; }
.settings-fieldset small { color: var(--muted); font-size: 11px; }

.time12-control {
  display: grid;
  grid-template-columns: minmax(62px, 1fr) auto minmax(66px, 1fr) minmax(88px, 1.15fr);
  align-items: center;
  gap: 6px;
  direction: ltr;
}
.time12-control select { min-width: 0; height: 44px; padding-inline: 8px; }
.time12-control > span { color: var(--muted); font-weight: 900; }
.time12-period { direction: rtl; }
.field-help { display: block; margin-top: 5px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.phone-with-flag { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; unicode-bidi: isolate; }
.country-flag { font-size: 18px; line-height: 1; }

#tab-settings.active { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--workspace-gap); align-items: start; }
#tab-settings .workspace-header, #tab-settings .settings-general-card, #tab-settings .document-settings-card { grid-column: 1 / -1; }
#tab-settings .workspace-card { margin-bottom: 0; }
#tab-settings .settings-install-card { align-self: stretch; }
#tab-settings .settings-install-card .btn { margin-top: 8px; }

@media (max-width: 1100px) {
  .workspace-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-card .summary-cards { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters-grid .search-input { grid-column: 1 / -1; }
  .comparison-change-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Tablet and compact desktop: avoid squeezing desktop columns beside the sidebar. */
@media (min-width: 901px) and (max-width: 1180px) {
  .sidebar { width: 220px; padding-inline: 12px; }
  main { max-width: none; padding: 22px 20px 64px; }
  .today-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .quick-actions-card { align-items: stretch; flex-direction: column; }
  .workspace-header { flex-wrap: wrap; }
  .workspace-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  #tab-tasks.active, #tab-expenses.active, #tab-settings.active { display: block; }
  #tab-tasks .workspace-card, #tab-expenses .workspace-card, #tab-settings .workspace-card { margin-bottom: 16px; }
  .filters-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters-grid .search-input { grid-column: 1 / -1; }
  .report-card .summary-cards, .provider-summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .report-controls label { flex: 1 1 calc(50% - 8px); }
  .other-service-row { position: relative; grid-template-columns: repeat(2, minmax(0, 1fr)); padding-inline-end: 0; padding-inline-start: 52px; }
  .other-service-row .os-note-wrap { grid-column: 1 / -1; }
  .other-service-row .os-remainder { grid-column: 1 / -1; grid-row: auto; }
  .other-service-row .remove-row-btn { position: absolute; left: 0; top: 22px; grid-column: auto; grid-row: auto; }
}

@media (max-width: 900px) {
  .workspace-header { min-height: 0; padding: 4px 1px 14px; align-items: flex-start; }
  .workspace-header .page-title { font-size: 22px; }
  .workspace-header p { font-size: 12.5px; }
  .workspace-primary-action { min-height: 44px; padding-inline: 13px; }
  .workspace-stats { margin: 12px 0; gap: 8px; }
  .workspace-stat { padding: 11px 12px; }
  .workspace-stat .stat-value { font-size: 18px; }
  #tab-tasks.active, #tab-expenses.active, #tab-settings.active { display: block; }
  #tab-tasks .workspace-card, #tab-expenses .workspace-card, #tab-settings .workspace-card { margin-bottom: 12px; }
  .section-card-head { align-items: stretch; flex-direction: column; }
  .section-card-head .task-filters { display: grid; grid-template-columns: 1fr 1fr; width: 100%; }
  .task-filters select { width: 100%; min-width: 0; }
  .booking-progress { margin: 12px 0; gap: 5px; }
  .booking-progress span { justify-content: center; min-height: 42px; padding: 6px; font-size: 10.5px; text-align: center; }
  .booking-progress b { display: none; }
  .booking-form-card { margin-inline: 0; }
  .booking-form-card .form-actions { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); z-index: 30; margin: 18px -12px -14px; padding: 10px 12px; background: rgba(255,255,255,.96); border-top: 1px solid var(--border); box-shadow: 0 -7px 18px rgba(15,43,34,.08); }
  .booking-form-card .form-actions .btn.primary { flex: 1; }
  .filters-grid { grid-template-columns: 1fr 1fr; padding: 10px; }
  .report-controls { padding: 11px; }
  .report-controls .btn { width: 100%; }
  .comparison-controls .btn { width: 100%; }
  .comparison-change-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .comparison-table-wrap table { min-width: 0; }
  .booking-detail-modal { width: calc(100% - 20px); max-height: calc(100dvh - 20px); padding: 22px 16px 24px; }
}

@media (max-width: 520px) {
  .workspace-header { display: block; }
  .workspace-primary-action { width: 100%; margin-top: 12px; }
  .workspace-stats { grid-template-columns: 1fr 1fr; }
  .workspace-stat .stat-label { white-space: normal; min-height: 30px; }
  .filters-grid { grid-template-columns: 1fr; }
  .filters-grid .search-input { grid-column: auto; }
  .report-card .summary-cards { grid-template-columns: 1fr; }
  .provider-summary-grid { grid-template-columns: 1fr; }
  .booking-detail-cards { grid-template-columns: 1fr; }
  .detail-card.full-width { grid-column: auto; }
  .day-booking-meta { grid-template-columns: 1fr; }
  .day-booking-actions .btn { width: 100%; }
  .status-control { align-items: stretch; flex-direction: column; }
  .comparison-controls { flex-direction: column; align-items: stretch; }
  .comparison-controls label { min-width: 0; }
  .comparison-change-grid { grid-template-columns: 1fr 1fr; }
  .comparison-change-card:last-child { grid-column: 1 / -1; }
  .chart-head { flex-direction: column; }
  .logo-settings-row, .logo-upload-form { align-items: stretch; flex-direction: column; }
  .document-logo-preview { width: 112px; height: 112px; align-self: center; }
  .logo-upload-form .btn { width: 100%; }
  .whatsapp-composer-grid { grid-template-columns: 1fr; }
  .whatsapp-composer .whatsapp-btn { width: 100%; min-height: 44px; }
  .booking-detail-modal > .form-actions .btn, .booking-detail-modal > .form-actions a { flex: 1 1 140px; min-height: 44px; }
  .time12-control { grid-template-columns: minmax(54px, 1fr) auto minmax(58px, 1fr) minmax(82px, 1.2fr); gap: 4px; }
  .time12-control select { padding-inline: 5px; }
}

/* Monthly close, draft recovery, and role management */
.form-feedback { margin: 0 0 14px; padding: 12px 14px; border-radius: 12px; font-weight: 700; line-height: 1.6; }
.form-feedback.error { color: #991b1b; background: #fef2f2; border: 1px solid #fecaca; }
.form-feedback.notice { color: #075985; background: #f0f9ff; border: 1px solid #bae6fd; }
.draft-status { min-height: 20px; margin: -6px 0 12px; color: var(--muted); font-size: .82rem; }
.close-controls, .close-actions { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; margin: 14px 0; }
.close-controls label { min-width: 210px; }
.close-actions input { flex: 1 1 260px; }
.close-status { display: grid; gap: 4px; padding: 13px 15px; margin-bottom: 16px; border: 1px solid var(--border); background: var(--surface-soft, #f7faf9); border-radius: 14px; }
.close-status span { color: var(--muted); font-size: .88rem; }
.status-pill { display: inline-flex; align-items: center; width: max-content; padding: 5px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; }
.status-pill.open { color: #166534; background: #dcfce7; }
.status-pill.closed { color: #991b1b; background: #fee2e2; }
.settlement-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.settlement-card { min-width: 0; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface, #fff); }
.settlement-card.settled { border-color: #bbf7d0; }
.settlement-head, .settlement-actions { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 8px; }
.settlement-head > div { display: grid; gap: 4px; }
.settlement-head strong { font-size: 1.25rem; }
.settlement-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 14px 0; }
.receipt-picker { position: relative; cursor: pointer; }
.receipt-picker input { position: absolute; inline-size: 1px; block-size: 1px; opacity: 0; }
.role-guide { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; margin-bottom: 18px; padding: 14px; border-radius: 14px; background: var(--surface-soft, #f7faf9); color: var(--muted); font-size: .86rem; }
.role-guide b { color: var(--text); }
.user-actions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px; }
.user-actions select { min-width: 140px; }

@media (max-width: 980px) { .settlement-grid { grid-template-columns: 1fr; } }
@media (max-width: 640px) {
  .close-controls, .close-actions { align-items: stretch; }
  .close-controls > *, .close-actions > * { width: 100%; }
  .settlement-form, .role-guide { grid-template-columns: 1fr; }
  .settlement-actions .btn, .settlement-actions .receipt-picker { flex: 1 1 130px; text-align: center; justify-content: center; }
  .user-actions { justify-content: stretch; }
  .user-actions select { width: 100%; }
}
