:root {
  --acp-ink: #1a1a1a;
  --acp-muted: #6b7280;
  --acp-border: #e5e7eb;
  --acp-bg: #f7f7f8;
  --acp-primary: #2563eb;
  --acp-primary-dark: #1d4ed8;
  --acp-danger: #b3261e;
  --acp-sidebar: #111827;
  --acp-sidebar-text: #d1d5db;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  color: var(--acp-ink);
  background: var(--acp-bg);
}
a { color: var(--acp-primary); }

.acp-shell { display: flex; min-height: 100vh; }
.acp-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--acp-sidebar);
  color: var(--acp-sidebar-text);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
}
.acp-sidebar .brand { color: #fff; font-weight: 700; font-size: 16px; margin-bottom: 24px; padding: 0 8px; }
.acp-sidebar nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.acp-sidebar a {
  color: var(--acp-sidebar-text);
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 6px;
  font-size: 14px;
}
.acp-sidebar a:hover { background: rgba(255,255,255,.08); color: #fff; }
.acp-sidebar a.active { background: var(--acp-primary); color: #fff; }
.acp-sidebar button.logout {
  background: none; border: 1px solid rgba(255,255,255,.25); color: var(--acp-sidebar-text);
  padding: 8px 10px; border-radius: 6px; cursor: pointer; font-size: 13px;
}
.acp-sidebar button.logout:hover { background: rgba(255,255,255,.08); color: #fff; }

.acp-main { flex: 1; padding: 32px 40px; max-width: 920px; }
.acp-main h1 { margin-top: 0; font-size: 22px; }
.acp-main h2 { font-size: 16px; color: var(--acp-muted); font-weight: 600; margin: 28px 0 10px; }

.acp-card {
  background: #fff; border: 1px solid var(--acp-border); border-radius: 10px;
  padding: 18px 20px; margin-bottom: 16px;
}
.acp-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 12px; }
.acp-stat .value { font-size: 26px; font-weight: 700; }
.acp-stat .label { font-size: 12px; color: var(--acp-muted); text-transform: uppercase; letter-spacing: .03em; }

table.acp-table { width: 100%; border-collapse: collapse; font-size: 14px; }
table.acp-table th { text-align: left; font-size: 12px; color: var(--acp-muted); text-transform: uppercase; padding: 6px 8px; border-bottom: 1px solid var(--acp-border); }
table.acp-table td { padding: 8px; border-bottom: 1px solid var(--acp-border); vertical-align: top; }
table.acp-table tr:last-child td { border-bottom: none; }

.acp-form label { display: block; font-size: 13px; font-weight: 600; margin: 10px 0 4px; }
.acp-form input[type=text], .acp-form input[type=email], .acp-form input[type=password],
.acp-form input[type=url], .acp-form textarea, .acp-form select {
  width: 100%; padding: 8px 10px; border: 1px solid var(--acp-border); border-radius: 6px; font-size: 14px; font-family: inherit;
}
.acp-form textarea { min-height: 70px; resize: vertical; }
.acp-form .row { display: flex; gap: 12px; }
.acp-form .row > * { flex: 1; }

.acp-btn {
  background: var(--acp-primary); color: #fff; border: none; border-radius: 6px;
  padding: 8px 16px; font-size: 14px; cursor: pointer;
  display: inline-block; text-decoration: none;
}
.acp-btn:hover { background: var(--acp-primary-dark); text-decoration: none; }
.acp-btn:disabled { opacity: .5; cursor: default; }
.acp-btn.secondary { background: #fff; color: var(--acp-ink); border: 1px solid var(--acp-border); }
.acp-btn.danger { background: #fff; color: var(--acp-danger); border: 1px solid #f0c9c6; }
.acp-btn.danger:hover { background: #fdecea; }
.acp-btn.small { padding: 4px 10px; font-size: 12px; }

.acp-error { color: var(--acp-danger); font-size: 13px; margin-top: 8px; }
.acp-empty { color: var(--acp-muted); font-size: 14px; padding: 10px 0; }
.acp-badge { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: 10px; background: #eef2ff; color: var(--acp-primary); }
.acp-badge.inactive { background: #f3f4f6; color: var(--acp-muted); }
.acp-badge.success { background: #e9f9ee; color: #0a7a3c; }
.acp-badge.warn { background: #fff4e5; color: #92610f; }
.acp-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 13px; }

/* Sidebar organization context + grouped navigation */
.acp-sidebar .org { padding: 8px; margin-bottom: 16px; border-radius: 6px; background: rgba(255,255,255,.06); }
.acp-sidebar .org-label { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; opacity: .7; }
.acp-sidebar .org-name { color: #fff; font-weight: 600; margin-top: 2px; }
.acp-sidebar .org-switch { width: 100%; margin-top: 4px; }
.acp-sidebar .org-role { font-size: 12px; opacity: .7; margin-top: 2px; }
.acp-sidebar .nav-group { font-size: 11px; text-transform: uppercase; letter-spacing: .05em; opacity: .6; margin: 16px 8px 4px; }

/* Booking UI */
[x-cloak] { display: none !important; }
.acp-badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: #e5e7eb; color: #374151; }
.acp-badge.confirmed { background: #dcfce7; color: #166534; }
.acp-badge.rescheduled { background: #ede9fe; color: #5b21b6; }
.acp-badge.pending { background: #fef3c7; color: #92400e; }
.acp-badge.completed { background: #dbeafe; color: #1e40af; }
.acp-badge.cancelled { background: #f3f4f6; color: #6b7280; text-decoration: line-through; }
.acp-badge.no_show { background: #fee2e2; color: #991b1b; }
.acp-modal-backdrop { position: fixed; inset: 0; background: rgba(17,24,39,.5); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow-y: auto; z-index: 50; }
.acp-modal { position: relative; background: #fff; border-radius: 10px; width: 100%; max-width: 560px; padding: 22px 24px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }
.acp-modal-close { position: absolute; top: 8px; right: 12px; background: none; border: 0; font-size: 26px; line-height: 1; cursor: pointer; color: var(--acp-muted); }
.acp-dl { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; margin: 0; }
.acp-dl dt { color: var(--acp-muted); font-size: 13px; }
.acp-dl dd { margin: 0; }
.acp-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.acp-subpanel { margin-top: 12px; padding: 12px; border: 1px solid var(--acp-border); border-radius: 8px; background: #f9fafb; }
.acp-history { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.acp-history li { padding: 4px 0; border-bottom: 1px solid var(--acp-border); }
.acp-chip { border: 1px solid var(--acp-border); background: #fff; border-radius: 6px; padding: 4px 10px; margin: 0 6px 6px 0; cursor: pointer; font-size: 13px; }
.acp-chip.on { background: var(--acp-primary); color: #fff; border-color: var(--acp-primary); }
.acp-kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.acp-kpi { background: #fff; border: 1px solid var(--acp-border); border-radius: 8px; padding: 14px; }
.acp-kpi .value { font-size: 26px; font-weight: 700; }
.acp-kpi .label { color: var(--acp-muted); font-size: 12px; text-transform: uppercase; }
.acp-toolbar { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin: 10px 0; }
.acp-toolbar select, .acp-toolbar input { padding: 6px 8px; border: 1px solid var(--acp-border); border-radius: 6px; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: #f9fafb; }

/* Calendar */
.cal-month { display: grid; grid-template-columns: repeat(7, 1fr); border-left: 1px solid var(--acp-border); border-top: 1px solid var(--acp-border); background: #fff; }
.cal-month .head { padding: 6px; font-size: 12px; color: var(--acp-muted); text-transform: uppercase; border-right: 1px solid var(--acp-border); border-bottom: 1px solid var(--acp-border); background: #f9fafb; }
.cal-cell { min-height: 104px; padding: 4px; border-right: 1px solid var(--acp-border); border-bottom: 1px solid var(--acp-border); font-size: 12px; cursor: pointer; }
.cal-cell.other { background: #fafafa; color: #9ca3af; }
.cal-cell.today .num { background: var(--acp-primary); color: #fff; border-radius: 999px; padding: 1px 6px; }
.cal-ev { display: block; width: 100%; text-align: left; border: 0; border-left: 3px solid var(--acp-primary); background: #eef2ff; border-radius: 3px; padding: 2px 4px; margin-top: 2px; font-size: 12px; cursor: pointer; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.cal-ev.rescheduled { border-left-color: #7c3aed; background: #f5f3ff; }
.cal-ev.pending { border-left-color: #d97706; background: #fffbeb; }
.cal-ev.completed { border-left-color: #2563eb; background: #eff6ff; }
.cal-ev.no_show { border-left-color: #dc2626; background: #fef2f2; }
.cal-ev.cancelled { border-left-color: #9ca3af; background: #f3f4f6; color: #6b7280; text-decoration: line-through; }
.cal-grid { display: grid; background: #fff; border: 1px solid var(--acp-border); }
.cal-grid .colhead { padding: 6px; text-align: center; font-size: 12px; border-bottom: 1px solid var(--acp-border); border-left: 1px solid var(--acp-border); background: #f9fafb; }
.cal-grid .colhead.today { color: var(--acp-primary); font-weight: 700; }
.cal-grid .gutter { font-size: 11px; color: var(--acp-muted); text-align: right; padding-right: 6px; }
.cal-col { position: relative; border-left: 1px solid var(--acp-border); cursor: pointer; background-image: linear-gradient(var(--acp-border) 1px, transparent 1px); background-size: 100% 48px; }
.cal-col .cal-ev { position: absolute; width: auto; margin: 0; white-space: normal; box-sizing: border-box; }
