:root {
  --bg: #f5f5f3;
  --card: #fff;
  --border: #000;
  --border-light: #ddd;
  --text: #000;
  --text-muted: #666;
  --shadow: 0 8px 19px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 4px 10px rgba(0, 0, 0, 0.12);
  --radius: 4px;
  --green: #169156;
  --blue: #2563eb;
  --blue-light: #dde6fd;
  --amber: #d97706;
  --red: #dc2626;
  --gray: #6b7280;
  --dark-gray: #374151;
  --panel-width: 440px;
  --sidebar-width: 176px;
  --accent: #2563eb;

  /* Category colors */
  --cat-operations: #1446A0;
  --cat-billing: #2979FF;
  --cat-messaging: #4D9EFF;
  --cat-space: #82B1FF;
  --cat-calendar: #B8D4FF;
  --cat-integrations: #7C4DFF;
  --cat-dashboard: #AA66FF;
  --cat-reports: #CE93FF;
  --cat-settings: #000;

  /* Active theme color (set by JS via data-theme) */
  --theme-color: #000;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Brandon Grotesque', 'Brandon Text', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

.base-app {
  height: 100vh;
  max-width: calc(50vw + 700px);
  margin: 0 auto;
  padding: 10px 20px 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ===== LOGIN ===== */

.base-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.login-logo {
  display: block;
  margin: 0 auto 8px;
  height: auto;
  max-height: 30px;
  width: auto;
  max-width: 100%;
}

.login-subtitle {
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 2px;
  text-transform: uppercase;
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 32px;
}

.login-card .base-btn.primary {
  background: #000;
  color: #fff;
}

.login-card .base-btn.primary:hover { background: #222; }

.step-label {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 20px;
  line-height: 1.5;
}

.qr-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 20px;
}

.qr-wrap img {
  width: 200px;
  height: 200px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.login-error {
  margin-top: 12px;
  font-size: 13px;
  color: var(--red);
  text-align: center;
}

/* ===== FORMS ===== */

.form-group {
  margin-bottom: 16px;
  flex: 1;
}

.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
  color: #333;
}

.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group select {
  width: 100%;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  transition: border-color 0.2s ease;
  -webkit-appearance: none;
  appearance: none;
  background: var(--card);
}

.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

.form-group input:not([type="checkbox"]):not([type="radio"]):focus,
.form-group select:focus {
  outline: none;
  border-color: var(--border);
}

.form-row {
  display: flex;
  gap: 16px;
}

/* ===== BUTTONS ===== */

.base-btn {
  padding: 10px 20px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background 0.2s ease;
  border: 1px solid #000;
}

.base-btn.primary {
  background: var(--accent);
  color: #fff;
  width: 100%;
}

.base-btn.primary:hover { background: #1d4ed8; }

.base-btn.secondary {
  background: var(--card);
  color: var(--text);
  box-shadow: none;
}

.base-btn.secondary:hover { background: var(--bg); }

.base-btn.blue {
  background: var(--blue);
  color: #fff;
  box-shadow: none;
}

.base-btn.blue:hover { background: var(--blue-hover); }

.base-btn.outline-blue {
  background: #fff;
  color: var(--blue);
  border-color: var(--blue);
  box-shadow: none;
}

.base-btn.outline-blue:hover { background: var(--blue-light, #eff6ff); }

.base-btn.outline-amber {
  background: #fff;
  color: #d97706;
  border-color: #d97706;
  box-shadow: none;
}

.base-btn.outline-amber:hover { background: #fffbeb; }

.base-btn.outline-red {
  background: #fff;
  color: #dc2626;
  border-color: #dc2626;
  box-shadow: none;
}

.base-btn.outline-red:hover { background: #fef2f2; }

.base-btn.small {
  padding: 6px 14px;
  font-size: 11px;
}

.base-btn.danger {
  background: var(--red);
  color: #fff;
}

.base-btn.danger:hover { background: #b91c1c; }

.base-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.text-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 8px 0;
  width: 100%;
  text-align: center;
}

.text-btn:hover { color: var(--text); }

.base-dashboard {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ===== TOP INFO ROW ===== */

.top-info-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 5px;
  flex-shrink: 0;
}

.header-stats {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.stat-item {
  font-size: 11px;
  font-weight: 400;
  color: #000;
}

.stat-label { font-weight: 400; }

.stat-sep {
  font-size: 11px;
  font-weight: 400;
  color: #000;
}

.synced-at {
  font-size: 11px;
  font-weight: 400;
  color: #999;
  margin: 0;
  text-align: right;
  min-height: 16px;
}

/* ===== TOP BAR ===== */

.top-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 8px;
  flex-shrink: 0;
}

.top-bar-logo {
  height: 28px;
  width: auto;
  flex-shrink: 0;
}

.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
}

.ctrl-btn {
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  background: var(--card);
  cursor: pointer;
  transition: all 0.15s ease;
  color: var(--text);
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  padding: 0;
}

.ctrl-btn:hover { border-color: var(--border); }

/* Menu flyout (Altitude-style, opens left) */
.header-menu {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  flex-direction: row-reverse;
}

.header-menu-toggle {
  position: relative;
  z-index: 2;
}

.header-menu-items {
  display: flex;
  align-items: center;
  gap: 4px;
  overflow: hidden;
  max-width: 0;
  opacity: 0;
  transition: max-width 0.3s ease, opacity 0.2s ease;
}

.header-menu.open .header-menu-items {
  max-width: 200px;
  opacity: 1;
}

/* ===== BILLING MODE INDICATOR ===== */

.billing-mode-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: 12px;
  padding: 4px 10px;
  border-radius: 3px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.billing-mode-indicator.mode-test {
  background: #fef3c7;
  border: 1px solid #f59e0b;
  color: #92400e;
}

.billing-mode-indicator.mode-live {
  background: #dcfce7;
  border: 1px solid #22c55e;
  color: #166534;
}

.billing-mode-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
}

.mode-test .billing-mode-dot { background: #f59e0b; }
.mode-live .billing-mode-dot { background: #22c55e; }

/* ===== SETTINGS PANEL ===== */

.settings-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
}

.settings-panel h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.settings-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 16px;
}

/* Section header: title+desc left, CTA button right */
.section-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 16px;
}

.section-header .section-header-text {
  flex: 1;
  min-width: 0;
}

.section-header h3 {
  margin-bottom: 4px;
}

.section-header .settings-desc {
  margin-bottom: 0;
}

/* Uniform CTA button: fixed width, right-aligned, drop shadow */
.section-cta {
  width: 200px !important;
  min-width: 200px;
  flex-shrink: 0;
  text-align: center;
  box-shadow: 0 2px 6px rgba(0,0,0,0.18);
  white-space: nowrap;
}

.section-cta:hover {
  box-shadow: 0 3px 8px rgba(0,0,0,0.22);
}

.billing-toggle-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.billing-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
}

.billing-toggle-option {
  padding: 8px 20px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  transition: all 0.2s ease;
  color: var(--text-muted);
  background: var(--card);
}

.billing-toggle-option.active-test {
  background: #f59e0b;
  color: #fff;
}

.billing-toggle-option.active-live {
  background: var(--accent);
  color: #fff;
}

.billing-toggle-status {
  font-size: 11px;
  color: var(--text-muted);
}

/* ===== BILLING SETTINGS ===== */

.settings-radio-label {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  margin-bottom: 8px;
}

.settings-radio-label input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  margin-top: 2px;
  flex-shrink: 0;
}

.settings-radio-label span {
  line-height: 1.4;
}

.settings-help {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 8px;
}

.bs-inv-preview {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 12px;
  padding: 10px 14px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

.bs-inv-preview strong {
  color: var(--text);
  font-family: 'SF Mono', 'Consolas', monospace;
  letter-spacing: 0.5px;
}

/* ===== DASHBOARD LAYOUT ===== */

.dashboard-layout {
  display: flex;
  gap: 8px;
  flex: 1;
  min-height: 0;
  padding-bottom: 20px;
}

/* ===== LEFT SIDEBAR ===== */

.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  align-self: stretch;
}

.sidebar-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: var(--text-muted);
  padding: 16px 18px 12px;
}

.sidebar-nav {
  flex: 1;
}

/* Category spacing — 8px white gap between each category block */
.nav-category {
  margin-top: 8px;
}

.nav-category:first-child {
  margin-top: 8px;
}

/* Category button */
.nav-category-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: calc(100% - 16px);
  margin: 4px 8px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  transition: background 0.5s ease, border-color 0.5s ease, color 0.5s ease;
  text-align: left;
}

.nav-category-btn:hover {
  background: none;
  border-color: transparent;
  color: var(--accent);
}

.nav-category-btn.active {
  background: none;
  border-color: transparent;
  color: var(--accent);
  transition: color 0.1s ease;
}

.nav-category-btn:hover .nav-icon,
.nav-category-btn:hover .nav-chevron,
.nav-category-btn.active .nav-icon,
.nav-category-btn.active .nav-chevron {
  color: var(--accent);
}

.nav-icon {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: color 0.5s ease;
}

.nav-category-btn .nav-icon {
  color: var(--text);
}

/* .nav-category-btn.active .nav-icon — handled above with hover rule */

.nav-category-btn span {
  flex: 1;
  transition: color 0.5s ease;
}

.nav-category-btn.active span {
  transition: color 0.1s ease;
}

.nav-chevron {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s ease, color 0.5s ease;
}

.nav-category-btn.active .nav-chevron,
.nav-category.open .nav-category-btn .nav-chevron {
  transform: rotate(90deg);
}

/* Subcategories */
.nav-subcategories {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.25s ease;
}

.nav-subcategories.open {
  max-height: 400px;
}

.nav-sub-btn {
  display: block;
  width: calc(100% - 26px);
  margin: 4px 8px 4px 18px;
  padding: 7px 10px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 400;
  color: var(--text-muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 3px;
  cursor: pointer;
  text-align: left;
  transition: background 0.5s ease, border-color 0.5s ease, color 0.5s ease;
}

.nav-sub-btn:hover {
  color: var(--accent);
  background: none;
  border-color: transparent;
}

.nav-sub-btn.active {
  color: var(--accent);
  background: none;
  border-color: transparent;
  transition: color 0.1s ease;
}

/* Category label color when active — all use accent blue */
.nav-category .nav-category-btn.active span { color: var(--accent); }

/* Standalone nav item colors when active */
.nav-sub-btn[data-view="dashboard"].active { color: var(--accent); }
.nav-sub-btn[data-view="reports"].active { color: var(--accent); }

/* Active sub-btn uses accent blue */
.nav-sub-btn.active { color: var(--accent); }
.nav-sub-btn[data-view="migration"].active { color: var(--accent); }

/* Sidebar footer */
.sidebar-footer {
  padding: 8px 0;
}

.sidebar-stats {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
}

.stat-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--border-light);
}

/* ===== MAIN CONTENT ===== */

.content-area {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* ===== FILTER BAR ===== */

.filter-bar-wrap {
  flex-shrink: 0;
  padding-bottom: 8px;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.filter-search-wrap {
  flex: 0 0 auto;
  width: 220px;
}

input[type="date"],
input[type="datetime-local"] {
  font-family: inherit;
}

.filter-search-input,
.filter-input,
.base-input,
.form-input {
  width: 100%;
  padding: 5px 10px;
  font-family: inherit;
  font-size: 11px;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  background: var(--card);
  -webkit-appearance: none;
  appearance: none;
}

.filter-search-input:focus,
.filter-input:focus,
.base-input:focus,
.form-input:focus {
  outline: none;
  border-color: var(--border);
}

.filter-actions-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

.filter-group label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  white-space: nowrap;
}

.filter-group select {
  padding: 5px 28px 5px 10px;
  font-family: inherit;
  font-size: 11px;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  background: var(--card);
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%23666' stroke-width='1.5' fill='none'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
}

.filter-group select:focus { outline: none; border-color: var(--border); }

.filter-result-count {
  font-size: 11px;
  color: var(--text-muted);
}

.view-content {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ===== PANEL WRAP (scrollable bordered container for settings views) ===== */

.panel-wrap {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
}

.panel-wrap .settings-panel {
  border-color: var(--border-light);
}

.panel-wrap .settings-panel:last-child {
  margin-bottom: 0;
}

.panel-wrap .table-wrap {
  border-color: var(--border-light);
}

.panel-wrap .placeholder-view {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

/* ===== DATA TABLE ===== */

.table-wrap {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.base-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  font-family: inherit;
}

.base-table th {
  padding: 8px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.base-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
  font-size: 12px;
  color: var(--text);
}

.base-table tbody tr:last-child td { border-bottom: none; }

.base-table .base-btn {
  width: auto;
}

.data-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}

.data-table thead th {
  box-shadow: 0 1px 0 var(--border);
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  background: var(--card);
  user-select: none;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 2;
}

.data-table th.sortable { cursor: pointer; }
.data-table th.sortable:hover { color: var(--text); }

.data-table th .sort-arrow {
  font-size: 9px;
  margin-left: 3px;
  opacity: 0.4;
}

.data-table th.sort-active .sort-arrow { opacity: 1; }

.data-table td {
  padding: 9px 14px;
  border-top: 1px solid transparent;
  border-bottom: 1px solid #eee;
  border-left: 1px solid transparent;
  border-right: 1px solid transparent;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.data-table tbody tr {
  cursor: pointer;
}

.data-table tbody tr:hover td {
  background: var(--bg);
}
.data-table tbody tr:last-child td { border-bottom: none; }

.table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 11px;
  color: var(--text-muted);
}

.table-loading {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
  font-size: 13px;
}

/* Status badges */
.status-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  white-space: nowrap;
}

.status-active { color: #169156; padding: 0; border-radius: 0; }
.status-upgrading { color: #1d4ed8; padding: 0; border-radius: 0; }
.status-downgrading { color: #92400e; padding: 0; border-radius: 0; }
.status-switching { color: #169156; padding: 0; border-radius: 0; }
.status-pausing { color: #c2410c; padding: 0; border-radius: 0; }
.status-pending { color: #d97706; padding: 0; border-radius: 0; }
.status-pass_holder { color: #c2410c; padding: 0; border-radius: 0; }
.status-former { color: #9ca3af; padding: 0; border-radius: 0; }
.status-contact { color: #6b7280; padding: 0; border-radius: 0; }
.status-leaving { color: #dc2626; padding: 0; border-radius: 0; }
.status-ended { color: #9ca3af; padding: 0; border-radius: 0; }
.status-draft { color: #6b7280; padding: 0; border-radius: 0; }

.member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.member-avatar-initials {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #e5e7eb;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: #666;
  flex-shrink: 0;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.price-cell { font-variant-numeric: tabular-nums; }

/* Placeholder views */
.placeholder-view {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-muted);
  font-size: 14px;
}

/* ===== MEMBER DETAIL VIEW (FULL PAGE) ===== */

.md-back {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: border-color 0.15s ease;
}

.md-back:hover { border-color: var(--border); }

.md-back svg { color: var(--text); }

/* Outer bounding box for entire detail view */
#memberDetailContent,
#companyDetailContent {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #e8e8e5;
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#resourceDetailContent {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #e8e8e5;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 12px;
}

.md-layout {
  display: flex;
  gap: 12px;
  padding: 12px;
  flex: 1;
  min-height: 0;
}

/* Left sidebar column — fixed, no scroll */
.md-left {
  width: 300px;
  flex-shrink: 0;
  align-self: stretch;
  overflow: hidden;
}

.md-left-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 16px;
  height: 100%;
  overflow-y: auto;
}

.md-left-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.md-avatar {
  width: 90px;
  height: 90px;
  border-radius: 4px;
  object-fit: cover;
  display: block;
  margin-bottom: 10px;
}

.md-avatar-initials {
  width: 90px;
  height: 90px;
  border-radius: 4px;
  background: #e5e7eb;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  font-weight: 700;
  color: #6b7280;
  margin-bottom: 10px;
}

/* Edit/Save icon button */
.md-edit-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background: none;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.md-edit-toggle:hover { border-color: var(--border); }

.md-edit-toggle.saving {
  border-color: var(--accent, #2563eb);
  background: var(--blue-light);
}

/* Edit mode field inputs */
.md-field-edit-input {
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--accent, #2563eb);
  border-radius: 3px;
  padding: 2px 6px;
  width: 100%;
  max-width: 160px;
  text-align: right;
  background: var(--card);
}

.md-field-edit-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Editable name/email in edit mode */
.md-name-input, .md-email-input {
  font-family: inherit;
  border: 1px solid var(--accent, #2563eb);
  border-radius: 3px;
  padding: 3px 6px;
  width: 100%;
  background: var(--card);
}

.md-name-input {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 4px;
}

.md-email-input {
  font-size: 12px;
  margin-bottom: 10px;
}

.md-name-input:focus, .md-email-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* Notes field — full width under section title */
.md-notes-value {
  font-size: 12px;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.md-notes-input {
  font-size: 12px;
  font-family: inherit;
  border: 1px solid var(--accent, #2563eb);
  border-radius: 3px;
  padding: 6px 8px;
  width: 100%;
  background: var(--card);
  resize: vertical;
  box-sizing: border-box;
}

.md-notes-input:focus {
  outline: none;
  border-color: var(--accent);
}

.md-name {
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 0.3px;
  margin-bottom: 1px;
}

.md-email {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 10px;
  word-break: break-all;
}

.md-section {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid #eee;
}

.md-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--text-muted);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.md-field {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 4px 0;
  font-size: 12px;
  border-bottom: 1px solid #f5f5f3;
}

.md-field:last-child { border-bottom: none; }

.md-field-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
}

.md-field-value {
  text-align: right;
  word-break: break-all;
}

.md-field-value.editable {
  cursor: pointer;
  border-bottom: 1px dashed var(--border-light);
  padding-bottom: 1px;
}

.md-field-value.editable:hover { border-color: var(--border); }

/* Right content column — scrollable */
.md-right {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  align-self: stretch;
}

.md-right-section {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 12px;
}

.md-right-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.md-right-header h3 {
  font-size: 14px;
  font-weight: 700;
}

.md-right-header .base-btn {
  font-size: 10px;
  padding: 4px 12px;
  color: var(--blue);
  border-color: var(--blue);
  background: #fff;
}
.md-right-header .base-btn:hover {
  background: var(--blue);
  color: #fff;
}
.md-right-header .base-btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}
.md-right-header .base-btn.primary:hover {
  background: #1d4ed8;
  border-color: #1d4ed8;
}

/* Membership cards */
.md-ms-card {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
}

.md-ms-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.md-ms-name { font-size: 13px; font-weight: 600; }
.md-ms-price { font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.md-ms-dates { font-size: 11px; color: var(--text-muted); margin-top: 4px; }

.md-ms-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 6px;
}

.md-ms-status {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.md-ms-status.ms-active { color: #169156; }
.md-ms-status.ms-ended { color: var(--gray); }
.md-ms-status.ms-future { color: var(--blue); }
.md-ms-status.ms-pending { color: var(--orange, #e67e22); }

.md-ms-action {
  font-size: 11px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  font-weight: 600;
  padding: 0;
}

.md-ms-action:hover { text-decoration: underline; }

/* Fee rows */
.md-fee-row {
  display: flex;
  align-items: center;
  padding: 8px 0;
  font-size: 12px;
  border-bottom: 1px solid #f0f0f0;
  gap: 12px;
}

.md-fee-row:hover { background: var(--bg); }
.md-fee-row:last-child { border-bottom: none; }
.md-fee-name { flex: 1; font-weight: 500; }
.md-fee-amount { font-weight: 600; font-variant-numeric: tabular-nums; }
.md-fee-date { font-size: 11px; color: var(--text-muted); }
.md-fee-status {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 600;
}

.md-fee-status.fee-paid { color: #169156; }
.md-fee-status.fee-pending { color: var(--amber); }
.md-fee-status.fee-test { color: var(--gray); }

/* Comments */
.md-comment-form {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.md-comment-form textarea {
  flex: 1;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 8px 10px;
  font-size: 12px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
  max-height: 140px;
}

.md-comment-form textarea:focus {
  outline: none;
  border-color: var(--border);
}

.md-comment {
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
}

.md-comment:last-child { border-bottom: none; }

.md-comment-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}

.md-comment-author { font-size: 12px; font-weight: 600; }
.md-comment-date { font-size: 11px; color: var(--text-muted); font-style: italic; }
.md-comment-text { font-size: 12px; line-height: 1.5; color: #333; }

/* Billing card */
.md-billing-card {
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 8px;
  font-size: 12px;
}


/* Resource detail control bar */
.res-detail-control-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 12px;
  flex-shrink: 0;
}
.res-detail-control-bar h2 {
  margin: 0;
  font-size: 16px;
}

/* Day pass summary — override billing-card bottom margin inside flex row */
#dayPassSummaryCards .md-billing-card {
  margin-bottom: 0;
}

/* Resource detail stat cards */
.res-detail-stats {
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}
.res-detail-stat {
  flex: 1;
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  text-align: center;
}
.res-detail-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.res-detail-stat-value {
  font-size: 20px;
  font-weight: 700;
  margin-top: 2px;
}

/* Resource avatar in table list */
.res-table-avatar {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
  display: block;
}
.res-table-avatar-placeholder {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  background: #e5e7eb;
  flex-shrink: 0;
  display: block;
}

/* Resource detail inline edit form */
.res-edit-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin-bottom: 12px;
}
.res-edit-section-title {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  font-weight: 600;
}
.res-edit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.res-edit-grid .form-group {
  margin-bottom: 0;
}
.res-edit-grid .form-group label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: block;
}
.res-edit-grid .form-group input,
.res-edit-grid .form-group select {
  width: 100%;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background-color: var(--bg);
  color: var(--text);
}
.res-edit-grid .form-group.full-width {
  grid-column: 1 / -1;
}
.res-edit-image-wrap {
  display: flex;
  align-items: flex-start;
  gap: 16px;
}
.res-edit-image-preview {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--border);
  flex-shrink: 0;
}
.res-edit-image-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 8px;
  background: #f3f4f6;
  border: 1px dashed var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 11px;
  flex-shrink: 0;
}
.res-edit-image-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.res-edit-toggles {
  display: flex;
  gap: 16px;
  align-items: center;
  margin-top: 4px;
}

/* Empty state */
.md-empty {
  font-size: 12px;
  color: var(--text-muted);
  padding: 12px 0;
}

/* Inline edit input */
.inline-edit-input {
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--accent);
  border-radius: 3px;
  padding: 2px 6px;
  width: 100%;
  max-width: 180px;
  text-align: right;
}

.inline-edit-input:focus { outline: none; }

/* Edit mode: show inputs instead of text */
.md-edit-input {
  font-size: 13px;
  font-family: inherit;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  padding: 4px 8px;
  width: 100%;
  text-align: right;
}

.md-edit-input:focus {
  outline: none;
  border-color: var(--accent);
}

/* ===== MODAL ===== */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border-light);
}

.modal-header h3 {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.detail-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
}

.detail-close:hover {
  color: var(--text);
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0;
  line-height: 1;
}
.modal-close:hover { color: var(--text); }

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

.form-error {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
}

.modal-body { padding: 20px 24px; }

.modal-footer {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 16px 24px 20px;
  border-top: 1px solid var(--border-light);
}

/* ===== MIGRATION VIEW ===== */

.migration-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow-sm);
}

.migration-panel h3 {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 20px;
}

.migration-grid { margin-bottom: 20px; }

.migration-grid table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.migration-grid th,
.migration-grid td {
  padding: 8px 14px;
  text-align: left;
  border-bottom: 1px solid #eee;
}

.migration-grid th {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.migration-grid .match { color: #169156; }
.migration-grid .mismatch { color: var(--red); font-weight: 600; }

.migration-actions { display: flex; gap: 12px; }
.migration-actions .base-btn { width: auto; }

.muted { color: var(--text-muted); font-size: 13px; }

#migrationResult {
  margin-top: 16px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius);
  font-size: 12px;
  white-space: pre-wrap;
  font-family: 'SF Mono', 'Menlo', monospace;
}

/* ===== INLINE EDIT ===== */

.inline-edit-input {
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--border);
  border-radius: 3px;
  padding: 3px 6px;
  width: 100%;
  max-width: 180px;
  text-align: right;
}

.inline-edit-input:focus { outline: none; }

/* ===== LOADING STATE ===== */

.loading-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border-light);
  border-top-color: var(--border);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Filter Buttons */
.filter-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-left: auto;
}

.filter-btn {
  padding: 5px 10px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid var(--border-light);
  border-radius: 3px;
  background: var(--card);
  cursor: pointer;
  white-space: nowrap;
  color: var(--text-muted);
  transition: all 0.15s ease;
}

.filter-btn:hover {
  border-color: var(--border);
  color: var(--text);
}

.filter-btn.active {
  background: transparent;
  color: var(--accent);
  border-color: var(--border-light);
  font-weight: 700;
}

.filter-btn-icon {
  padding: 5px 7px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* Theme-aware CTA buttons — all use accent blue */
.content-area[data-theme] .base-btn.primary {
  background: var(--accent);
}
.content-area[data-theme] .base-btn.primary:hover {
  filter: brightness(1.15);
}
.content-area[data-theme] .filter-bar {
  border-color: var(--border);
}

/* Per-theme color variables */
.content-area[data-theme="operations"] { --theme-color: var(--cat-operations); }
.content-area[data-theme="billing"] { --theme-color: var(--cat-billing); }
.content-area[data-theme="messaging"] { --theme-color: var(--cat-messaging); }
.content-area[data-theme="space"] { --theme-color: var(--cat-space); }
.content-area[data-theme="calendar"] { --theme-color: var(--cat-calendar); }
.content-area[data-theme="integrations"] { --theme-color: var(--cat-integrations); }
.content-area[data-theme="dashboard"] { --theme-color: var(--cat-dashboard); }
.content-area[data-theme="reports"] { --theme-color: var(--cat-reports); }
.content-area[data-theme="data"] { --theme-color: var(--cat-dashboard); }
.content-area[data-theme="settings"] { --theme-color: var(--cat-settings); }

.filter-count {
  font-weight: 400;
  opacity: 0.7;
}

/* ===== PLAN MODAL ===== */

.modal-wide {
  max-width: 640px;
}

.plan-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.plan-tab {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.plan-tab:hover {
  color: var(--text);
}

.plan-tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.plan-tab-content {
  display: none;
}

.plan-tab-content.active {
  display: block;
}

.plan-calc {
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface);
  padding: 10px 12px;
  border-radius: 4px;
  margin-top: 8px;
}

.toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
  margin-top: 24px;
}

.toggle-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
}

.plan-active-warning {
  font-size: 12px;
  color: #b45309;
  background: #fef3c7;
  padding: 8px 12px;
  border-radius: 4px;
  margin-top: 12px;
}

.clickable-row {
  cursor: pointer;
}

.clickable-row:hover td {
  background: var(--bg);
}

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

.btn-sm {
  padding: 6px 12px;
  font-size: 12px;
  white-space: nowrap;
}

.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 4px;
  max-height: 180px;
  overflow-y: auto;
  padding: 6px 8px;
  border: 1px solid #ccc;
  border-radius: 4px;
  background: var(--surface);
}

.checkbox-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  cursor: pointer;
}

.checkbox-item input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent);
}

.form-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin: 2px 0 6px 0;
}

code {
  background: var(--surface);
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  font-weight: 600;
}

.md-ms-discount {
  font-size: 11px;
  color: var(--accent);
  margin-top: 2px;
}

.bill-run-summary {
  background: var(--surface);
  padding: 12px 16px;
  border-radius: 4px;
  margin-bottom: 8px;
}

.bill-run-summary p {
  margin: 4px 0;
  font-size: 13px;
}

.invoice-actions {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-select {
  padding: 5px 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 12px;
  background: #fff;
  color: var(--text);
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .sidebar { display: none; }
  .content-area { padding: 10px 12px; }
  .filter-search-wrap { width: 160px; }
  .form-row { flex-direction: column; gap: 0; }
  .md-layout { flex-direction: column; overflow-y: auto; }
  .md-left { width: 100%; }
  .md-right { overflow-y: visible; align-self: auto; }
  .data-table { font-size: 11px; }
  .data-table td, .data-table th { padding: 7px 10px; }
  .filter-bar { flex-wrap: wrap; }
}

/* ===== KISI ACCESS ===== */
.kisi-mapping-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.kisi-mapping-form .filter-select {
  min-width: 180px;
}
.kisi-status {
  font-size: 13px;
  margin-top: 8px;
}
.kisi-status.kisi-ok {
  color: #169156;
  font-weight: 600;
}
.kisi-status.kisi-err {
  color: var(--red);
  font-weight: 600;
}

/* ===== EMAIL CAMPAIGNS ===== */

.ec-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
  overflow-y: auto;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
}

/* Step indicators */
.ec-steps {
  display: flex;
  align-items: center;
  gap: 0;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 20px;
}

.ec-step {
  display: flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  padding: 6px 12px;
  border-radius: 3px;
  transition: all 0.15s ease;
}

.ec-step:hover { color: var(--text); }

.ec-step.active {
  color: var(--accent);
  font-weight: 700;
  background: var(--blue-light);
}

.ec-step.completed {
  color: var(--accent);
}

.ec-step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border-light);
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.ec-step.active .ec-step-num {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.ec-step.completed .ec-step-num {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.ec-step-divider {
  flex: 1;
  height: 1px;
  background: var(--border-light);
  margin: 0 4px;
}

/* Step content panels */
.ec-step-content {
  display: none;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  min-height: 0;
}

.ec-step-content.active {
  display: flex;
}

.ec-panel {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 20px 24px;
}

.ec-panel-title {
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 16px;
}

/* Template row */
.ec-template-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.ec-template-row select {
  flex: 1;
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--card);
}

/* Mode toggle (Rich Text / HTML) */
.ec-mode-toggle {
  display: flex;
  gap: 0;
  margin-bottom: 0;
  border: 1px solid var(--border-light);
  border-bottom: none;
  border-radius: var(--radius) var(--radius) 0 0;
  overflow: hidden;
}

.ec-mode-btn {
  padding: 6px 16px;
  font-family: inherit;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border: none;
  background: var(--bg);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.ec-mode-btn.active {
  background: var(--card);
  color: var(--text);
}

.ec-mode-btn:hover { color: var(--text); }

/* Editor wrap */
.ec-editor-wrap {
  border: 1px solid var(--border-light);
  border-radius: 0 var(--radius) var(--radius) var(--radius);
  overflow: hidden;
}

/* Toolbar */
.ec-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  background: var(--bg);
  border-bottom: 1px solid var(--border-light);
  flex-wrap: wrap;
}

.ec-tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 3px;
  background: none;
  cursor: pointer;
  font-family: inherit;
  font-size: 12px;
  color: var(--text-muted);
  transition: all 0.1s ease;
}

.ec-tb-btn:hover {
  background: var(--card);
  color: var(--text);
}

.ec-tb-btn.active {
  background: #e5e7eb;
  color: var(--text);
}

.ec-tb-sep {
  width: 1px;
  height: 18px;
  background: var(--border-light);
  margin: 0 4px;
}

/* TipTap editor content */
.ec-editor {
  min-height: 300px;
  max-height: 500px;
  overflow-y: auto;
  padding: 16px 20px;
  font-size: 14px;
  line-height: 1.6;
  background: var(--card);
  outline: none;
}

.ec-editor:focus { outline: none; }

.ec-editor .ProseMirror {
  outline: none;
  min-height: 260px;
}

.ec-editor .ProseMirror p { margin: 0 0 8px; }
.ec-editor .ProseMirror h2 { font-size: 20px; margin: 16px 0 8px; }
.ec-editor .ProseMirror h3 { font-size: 16px; margin: 12px 0 6px; }
.ec-editor .ProseMirror ul, .ec-editor .ProseMirror ol { padding-left: 24px; margin: 8px 0; }
.ec-editor .ProseMirror li { margin: 4px 0; }
.ec-editor .ProseMirror a { color: var(--blue); text-decoration: underline; }
.ec-editor .ProseMirror img { max-width: 100%; height: auto; border-radius: 4px; margin: 8px 0; }
.ec-editor .ProseMirror hr { border: none; border-top: 1px solid var(--border-light); margin: 16px 0; }
.ec-editor .ProseMirror p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: #adb5bd;
  pointer-events: none;
  height: 0;
}

/* HTML raw editor */
.ec-html-editor {
  width: 100%;
  min-height: 400px;
  padding: 16px 20px;
  font-family: 'SF Mono', 'Menlo', 'Monaco', monospace;
  font-size: 12px;
  line-height: 1.6;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  resize: vertical;
  background: var(--card);
}

.ec-html-editor:focus { outline: none; border-color: var(--border); }

/* Segment preview */
.ec-preview-count {
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  font-size: 13px;
  margin-top: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.ec-preview-list {
  margin-top: 12px;
}

.ec-preview-header {
  font-size: 13px;
  margin-bottom: 8px;
}

.ec-preview-members {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  background: var(--card);
}

.ec-preview-member {
  display: flex;
  justify-content: space-between;
  padding: 6px 12px;
  font-size: 12px;
  border-bottom: 1px solid #f0f0f0;
}

.ec-preview-member:last-child { border-bottom: none; }
.ec-preview-member-name { font-weight: 500; }
.ec-preview-member-email { color: var(--text-muted); }

/* Template variable buttons */
.ec-var-btn {
  display: inline-block;
  padding: 3px 10px;
  font-size: 12px;
  font-family: 'SF Mono', SFMono-Regular, Consolas, monospace;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text);
  transition: all 0.15s ease;
}
.ec-var-btn:hover {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* Member search */
.ec-member-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  max-height: 200px;
  overflow-y: auto;
  z-index: 100;
}
.ec-search-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid #f0f0f0;
}
.ec-search-item:hover { background: var(--bg); }
.ec-search-item:last-child { border-bottom: none; }
.ec-search-item-email { color: var(--text-muted); font-size: 12px; }

/* Manual recipients */
.ec-manual-recipients {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.ec-manual-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  font-size: 12px;
}
.ec-manual-tag-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  background: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1;
  border-radius: 50%;
}
.ec-manual-tag-remove:hover { background: #e5e7eb; color: var(--red); }

/* Review step */
.ec-review-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f0;
  font-size: 13px;
}

.ec-review-row:last-of-type { border-bottom: none; }

.ec-review-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}

.ec-review-value {
  text-align: right;
  font-weight: 500;
}

.ec-review-preview {
  margin-top: 16px;
}

.ec-review-preview label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.ec-email-preview {
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 24px;
  background: #fff;
  max-height: 400px;
  overflow-y: auto;
  font-size: 14px;
  line-height: 1.6;
}

.ec-email-preview img { max-width: 100%; height: auto; }

/* Schedule row */
.ec-schedule-row {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.ec-schedule-row .toggle-label { margin-top: 0; }

.ec-schedule-picker input {
  padding: 8px 12px;
  font-family: inherit;
  font-size: 13px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
}

/* Nav buttons */
.ec-nav-buttons {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  padding: 4px 0;
}

.ec-nav-buttons .base-btn { width: auto; }

/* Detail view */
.ec-detail-header {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 20px;
}

.ec-detail-header h3 {
  flex: 1;
  font-size: 15px;
  font-weight: 700;
}

.ec-detail-actions {
  display: flex;
  gap: 8px;
}

.ec-detail-meta {
  display: flex;
  gap: 24px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 14px 20px;
  font-size: 12px;
}

.ec-detail-meta-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.ec-detail-meta-label {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  font-size: 10px;
}

/* Email status badges */
.email-status {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 8px;
  border-radius: 3px;
}

.email-status-draft { background: #f3f4f6; color: #6b7280; border: 1px solid #d1d5db; }
.email-status-scheduled { background: var(--blue-light); color: #2563eb; border: 1px solid #bfdbfe; }
.email-status-sending { background: #fffbeb; color: #d97706; border: 1px solid #fde68a; }
.email-status-sent { background: #f0fdf4; color: #169156; border: 1px solid #bbf7d0; }
.email-status-failed { background: #fef2f2; color: #dc2626; border: 1px solid #fecaca; }

/* Gmail connection status in settings */
.ec-gmail-status {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 13px;
}

.ec-gmail-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.ec-gmail-dot.connected { background: #169156; }
.ec-gmail-dot.disconnected { background: var(--red); }

/* ===== BOOKINGS CALENDAR ===== */

.booking-calendar {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: auto;
  position: relative;
  flex: 1;
  min-height: 0;
}

.booking-day-grid,
.booking-week-grid {
  display: grid;
  position: relative;
  min-width: 100%;
}

.booking-corner {
  background: var(--card);
  border-bottom: 2px solid var(--border);
  border-right: 1px solid var(--border-light);
  position: sticky;
  top: 0;
  z-index: 3;
  height: auto;
  padding: 8px 10px;
  display: flex;
  align-items: center;
}

.booking-corner.booking-time-label {
  height: auto;
}

.booking-time-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 0 8px;
  height: 32px;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
  text-align: right;
  white-space: nowrap;
  border-right: 1px solid var(--border-light);
  background: var(--card);
}

.booking-time-label.on-hour {
  border-top: 1px solid #e5e7eb;
}

.booking-resource-header {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text);
  padding: 8px 10px;
  text-align: center;
  border-bottom: 2px solid var(--border);
  border-left: 1px solid var(--border-light);
  background: var(--card);
  position: sticky;
  top: 0;
  z-index: 3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.booking-slot {
  height: 32px;
  border-bottom: 1px solid #f5f5f3;
  border-left: 1px solid var(--border-light);
  cursor: pointer;
  transition: background 0.1s ease;
}

.booking-slot.on-hour {
  border-top: 1px solid #e5e7eb;
}

.booking-slot:hover {
  background: var(--blue-light);
}

.booking-block {
  position: absolute;
  background: #169156;
  color: #fff;
  border-radius: 3px;
  padding: 3px 6px;
  font-size: 11px;
  overflow: hidden;
  cursor: pointer;
  z-index: 2;
  transition: box-shadow 0.15s ease;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.booking-block:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  z-index: 4;
}

.booking-block.cancelled {
  background: #e5e7eb;
  color: #666;
}

.booking-block.tentative {
  background: #fbbf24;
  border: 1px dashed #d97706;
}

.booking-block-name {
  font-weight: 700;
  font-size: 11px;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.booking-block-time {
  font-size: 10px;
  opacity: 0.85;
  white-space: nowrap;
}

/* ===== DASHBOARD VIEW ===== */
#dashboardView {
  overflow: hidden;
}

.dash-panel {
  border: 1px solid #000;
  border-radius: var(--radius);
  overflow-y: auto;
  flex: 1;
  min-height: 0;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.dash-stats-row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  flex-shrink: 0;
}

.dash-stat-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 14px;
  box-shadow: var(--shadow-sm);
}

.dash-stat-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.1;
}

.dash-stat-label {
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 4px;
}

.dash-stat-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.dash-chart-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 16px 20px;
  box-shadow: var(--shadow-sm);
  position: relative;
  flex-shrink: 0;
}

.dash-chart-card canvas {
  max-height: 220px !important;
}

.dash-chart-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.dash-chart-header .dash-chart-title {
  margin-bottom: 0;
}

.dash-chart-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.dash-custom-dates {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dash-custom-dates .base-btn {
  padding: 4px 10px;
  font-size: 11px;
}

.dash-date-sep {
  font-size: 11px;
  color: var(--text-muted);
}

.dash-chart-title {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.dash-charts-thirds {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

/* ===== REPORTS VIEW ===== */
.reports-header .base-btn {
  width: auto;
}

.report-summary {
  display: flex;
  gap: 16px;
  padding: 12px 0;
  flex-wrap: wrap;
}

.report-summary-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 20px;
  box-shadow: var(--shadow-sm);
}

.report-summary-value {
  font-size: 20px;
  font-weight: 700;
}

.report-summary-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

@media (max-width: 1200px) {
  .dash-stats-row { grid-template-columns: repeat(3, 1fr); }
  .dash-charts-thirds { grid-template-columns: 1fr; }
}

/* ===== FLOOR PLAN EDITOR ===== */

/* .fp-topbar is now a .filter-bar — no extra styles needed */

.fp-floor-name {
  font-weight: 600;
  font-size: 14px;
  color: var(--text);
  flex-shrink: 0;
  white-space: nowrap;
}

.fp-mode-toggle {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.fp-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

/* Toolbar */
.fp-toolbar {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-wrap: nowrap;
}

.fp-toolbar .base-btn {
  width: auto;
  flex-shrink: 0;
}

.fp-tool-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}

.fp-tool-btn:hover { border-color: var(--text); color: var(--text); }
.fp-tool-btn.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.fp-tool-btn.active svg { stroke: #fff; }

.fp-tool-sep {
  width: 1px;
  height: 24px;
  background: var(--border-light);
  margin: 0 4px;
}

.fp-tool-options {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
}

.fp-tool-options input[type="number"] {
  padding: 3px 6px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 12px;
  text-align: center;
}

/* Canvas area */
.fp-canvas-wrap {
  flex: 1;
  min-height: 0;
  display: flex;
  gap: 12px;
  padding: 0;
}

.fp-canvas-area {
  flex: 1;
  min-height: 0;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  position: relative;
}

.fp-canvas {
  position: absolute;
  top: 0;
  left: 0;
  transform-origin: 0 0;
  background: #fff;
}

.fp-bg-image {
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

.fp-svg-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
}

.fp-no-image {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #999;
  font-size: 14px;
}

.fp-no-image p { margin: 0; }

/* Side panel */
.fp-side-panel {
  position: absolute;
  top: 0;
  right: 0;
  height: 100%;
  z-index: 10;
  width: 300px;
  min-width: 300px;
  background: var(--card);
  border-left: 1px solid var(--border-light);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.fp-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border-light);
}

.fp-panel-title {
  font-weight: 600;
  font-size: 14px;
}

.fp-panel-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0 4px;
  line-height: 1;
}

.fp-panel-close:hover { color: var(--text); }

.fp-panel-body {
  padding: 16px;
  flex: 1;
}

.fp-panel-section {
  margin-bottom: 16px;
}

.fp-panel-section + .fp-panel-section {
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

.fp-section-title {
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.fp-panel-field {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  font-size: 13px;
}

.fp-label {
  color: var(--text-muted);
  font-size: 12px;
}

.fp-assignment-card {
  background: var(--bg);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
}

.fp-assign-name {
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 2px;
}

.fp-assign-plan {
  font-size: 12px;
  color: var(--text-muted);
}

.fp-assign-date {
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.fp-panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.fp-panel-actions .base-btn { flex: 1; min-width: 100px; }

/* Status colors in shapes */
.fp-shape { transition: opacity 0.15s; }
.fp-shape:hover { opacity: 0.8; }

/* Occupancy stat cards */
.fp-occupancy-bar {
  display: flex;
  gap: 12px;
  padding: 0;
  margin-bottom: 12px;
}
.fp-stat {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  flex: 1;
  text-align: center;
}
.fp-stat-value {
  font-size: 20px;
  font-weight: 700;
  display: block;
  color: var(--text);
}
.fp-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Background controls bar */
.fp-bg-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 12px;
}

.fp-bg-controls .base-btn {
  width: auto;
  flex-shrink: 0;
}

/* Desk/Furniture preset palette */
.fp-preset-palette {
  display: flex;
  gap: 4px;
}
.fp-preset-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}
.fp-preset-btn:hover { border-color: var(--text); color: var(--text); }
.fp-preset-btn.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}
.fp-preset-icon {
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.fp-preset-label {
  font-size: 12px;
  white-space: nowrap;
}

/* Resize & rotate handles */
.fp-resize-handle { pointer-events: all; }
.fp-rotate-handle { pointer-events: all; }

/* ===== RIGHT PANEL (manage mode) ===== */
.fp-right-panel {
  width: 320px;
  min-width: 320px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
}

.fp-panel-tabs {
  display: flex;
  border-bottom: 1px solid var(--border-light);
  background: var(--bg);
}
.fp-tab-btn {
  flex: 1;
  padding: 8px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.15s;
}
.fp-tab-btn:hover { color: var(--text); background: #f5f5f3; }
.fp-tab-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}
.fp-right-panel-body {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
}

/* Donut chart */
.fp-donut-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px 0;
}
.fp-donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin-top: 8px;
}
.fp-legend-item {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
}
.fp-legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* Status badges in panel */
.fp-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 600;
}
.fp-status-badge .fp-badge-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

/* Members tab */
.fp-member-search {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  font-size: 12px;
  margin-bottom: 8px;
}
.fp-member-list {
  max-height: 100%;
  overflow-y: auto;
}
.fp-member-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  transition: background 0.1s;
}
.fp-member-item:hover { background: var(--bg); }
.fp-member-item .fp-member-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
}
.fp-member-item .fp-member-info { flex: 1; min-width: 0; }
.fp-member-item .fp-member-name { font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-member-item .fp-member-plan { font-size: 11px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Selection tab - multi select */
.fp-selection-count {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 8px;
  padding: 8px;
  background: var(--bg);
  border-radius: var(--radius);
  text-align: center;
}
.fp-bulk-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 8px;
}

/* Rubber band selection */
.fp-rubber-band {
  fill: rgba(66, 133, 244, 0.1);
  stroke: #4285f4;
  stroke-width: 1;
  stroke-dasharray: 4 2;
}

/* Shape multi-select highlight */
.fp-multi-highlight {
  fill: none;
  stroke: #FF9800;
  stroke-width: 2;
  stroke-dasharray: 4 3;
}

/* Layers dropdown */
.fp-layers-dropdown { position: relative; }
.fp-layers-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 180px;
  z-index: 50;
  padding: 4px 0;
  display: none;
}
.fp-layers-menu.show { display: block; }
.fp-layer-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: background 0.1s;
}
.fp-layer-item:hover { background: var(--bg); }
.fp-layer-item input[type="checkbox"] { margin: 0; }

/* Zoom controls */
.fp-zoom-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.fp-zoom-slider {
  width: 80px;
  height: 4px;
  -webkit-appearance: none;
  background: var(--border-light);
  border-radius: 2px;
  outline: none;
}
.fp-zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--text);
  cursor: pointer;
}
.fp-zoom-pct {
  font-size: 11px;
  color: var(--text-muted);
  min-width: 36px;
  text-align: center;
}
/* Legend dropdown */
.fp-legend-dropdown { position: relative; }
.fp-legend-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 4px;
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  min-width: 200px;
  z-index: 50;
  font-size: 11px;
  font-weight: 400;
  color: var(--text-muted);
  line-height: 1.6;
}
.fp-legend-dropdown:hover .fp-legend-menu { display: block; }
.fp-help-legend-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 4px;
}
.fp-help-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  flex-shrink: 0;
}

/* Mobile overlay for right panel */
@media (max-width: 768px) {
  .fp-right-panel {
    position: absolute;
    right: 12px;
    top: 0;
    bottom: 12px;
    z-index: 20;
    box-shadow: -4px 0 12px rgba(0,0,0,0.15);
  }
}

/* Floor plan view layout */
#floorPlanView {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
}

/* btn-sm helper */
.btn-sm {
  padding: 5px 12px !important;
  font-size: 12px !important;
}

.base-btn.danger {
  background: var(--red);
  color: #fff;
}
.base-btn.danger:hover { background: #b91c1c; }
.base-btn.danger.small { padding: 6px 20px; }

/* ===== EMAIL ACTIVITY LOG ===== */

.ea-stats-row {
  display: flex;
  gap: 12px;
  padding: 0;
  margin-bottom: 12px;
}

.ea-stat {
  background: #fff;
  border: 1px solid var(--border-light);
  border-radius: var(--radius);
  padding: 12px 16px;
  flex: 1;
  text-align: center;
}

.ea-stat-value {
  font-size: 20px;
  font-weight: 700;
  display: block;
}

.ea-stat-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Category badges */
.ea-cat {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 500;
}
.ea-cat-transactional { background: var(--blue-light); color: #1565c0; }
.ea-cat-campaign { background: #f3e5f5; color: #7b1fa2; }
.ea-cat-billing { background: #fff3e0; color: #e65100; }
.ea-cat-system { background: #f5f5f5; color: #616161; }

/* Status badges */
.ea-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 3px;
  font-weight: 600;
}
.ea-status-sent { color: #1565c0; }
.ea-status-delivered { color: #169156; }
.ea-status-opened { color: #7b1fa2; }
.ea-status-clicked { color: #e65100; }
.ea-status-failed { color: #dc2626; }
.ea-status-bounced { color: #dc2626; }

/* Row expansion */
.ea-row { cursor: pointer; }
.ea-row:hover { background: #fafaf8; }

.ea-detail-row td { padding: 0 !important; }

.ea-detail {
  background: #fafaf8;
  padding: 16px 20px;
  border-top: 1px solid var(--border-light);
  border-bottom: 1px solid var(--border-light);
}

.ea-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 16px;
}

.ea-detail-field {
  font-size: 13px;
}

.ea-detail-label {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

/* Delivery timeline */
.ea-timeline {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
}

.ea-timeline-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  position: relative;
  padding-top: 16px;
}

.ea-timeline-step::before {
  content: '';
  position: absolute;
  top: 8px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--border-light);
}

.ea-timeline-step:first-child::before { left: 50%; }
.ea-timeline-step:last-child::before { right: 50%; }

.ea-timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-light);
  border: 2px solid var(--card);
  position: relative;
  z-index: 1;
}

.ea-step-active .ea-timeline-dot { background: #169156; }
.ea-step-active { color: var(--text); font-weight: 500; }
.ea-step-active::before { background: #169156; }
.ea-step-failed .ea-timeline-dot { background: var(--red); }
.ea-step-failed { color: var(--red); }
.ea-step-failed::before { background: var(--red); }

.ea-timeline-time {
  font-size: 10px;
  color: var(--text-muted);
  font-weight: 400;
}

.ea-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 12px;
}

/* Lifecycle Timeline */
.md-timeline { display: flex; flex-direction: column; gap: 0; }
.md-timeline-entry { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-left: 2px solid var(--border-light); margin-left: 7px; padding-left: 16px; position: relative; }
.md-timeline-entry:last-child { border-left-color: transparent; }
.md-timeline-icon { position: absolute; left: -8px; top: 8px; width: 14px; height: 14px; background: var(--card); display: flex; align-items: center; justify-content: center; }
.md-timeline-body { flex: 1; min-width: 0; }
.md-timeline-title { font-size: 12px; color: var(--text); line-height: 1.4; }
.md-timeline-date { font-size: 11px; color: var(--text-muted); margin-top: 2px; }

/* ===== TOGGLE SWITCH ===== */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute;
  cursor: pointer;
  inset: 0;
  background: #ccc;
  border-radius: 20px;
  transition: background 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
}
.toggle-switch input:checked + .toggle-slider { background: #169156; }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(16px); }
