/* CentralSuite+ Ultra-Clean Modern Minimalist System with Lucide Icons & Theme Engine */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Default Light Theme */
  --bg-body: #f8fafc;
  --bg-surface: #ffffff;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-hover: #e2e8f0;
  --bg-drawer: #ffffff;

  --border-color: #e2e8f0;
  --border-subtle: #f1f5f9;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-tertiary: #94a3b8;

  --accent-primary: #2563eb;
  --accent-light: #eff6ff;
  --accent-text: #1d4ed8;

  --status-green-bg: #dcfce7;
  --status-green-text: #15803d;
  --status-amber-bg: #fef3c7;
  --status-amber-text: #b45309;
  --status-red-bg: #fee2e2;
  --status-red-text: #b91c1c;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-pill: 9999px;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.08), 0 1px 2px -1px rgba(0, 0, 0, 0.08);

  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
  --transition: 0.15s ease-in-out;
}

[data-theme="dark"] {
  --bg-body: #09090b;
  --bg-surface: #18181b;
  --bg-card: #18181b;
  --bg-subtle: #27272a;
  --bg-hover: #3f3f46;
  --bg-drawer: #09090b;

  --border-color: #27272a;
  --border-subtle: #18181b;

  --text-primary: #f4f4f5;
  --text-secondary: #a1a1aa;
  --text-tertiary: #71717a;

  --accent-primary: #3b82f6;
  --accent-light: rgba(59, 130, 246, 0.12);
  --accent-text: #60a5fa;

  --status-green-bg: rgba(34, 197, 94, 0.15);
  --status-green-text: #4ade80;
  --status-amber-bg: rgba(245, 158, 11, 0.15);
  --status-amber-text: #fbbf24;
  --status-red-bg: rgba(239, 68, 68, 0.15);
  --status-red-text: #f87171;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-card: 0 1px 3px 0 rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-body);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  transition: background-color var(--transition), color var(--transition);
  touch-action: manipulation;
  padding-bottom: env(safe-area-inset-bottom, 0);
}

i[data-lucide], svg.lucide {
  width: 18px; height: 18px; stroke-width: 2px;
  vertical-align: middle; display: inline-block;
}

/* FULL-SCREEN INITIAL APP STATION LOGIN SCREEN OVERLAY */
.login-screen-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
  background: var(--bg-body); z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none; transition: opacity 0.25s ease;
  padding: 1rem;
}
.login-screen-overlay.active { opacity: 1; pointer-events: auto; }

.login-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); width: 100%; max-width: 400px;
  padding: 2rem 1.5rem; text-align: center;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, 0.35);
  max-height: 95vh; overflow-y: auto; -webkit-overflow-scrolling: touch;
}

.login-brand-box { margin-bottom: 1.25rem; }
.login-logo-img { width: 48px; height: 48px; margin-bottom: 0.5rem; }
.login-title { font-size: 1.4rem; font-weight: 800; letter-spacing: -0.02em; }
.login-subtitle { font-size: 0.8rem; color: var(--text-secondary); margin-top: 0.15rem; }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: 0.75rem;
  width: 100%; height: 48px;
  background: var(--bg-card); color: var(--text-primary);
  border: 1px solid var(--border-color); border-radius: var(--radius-md);
  font-weight: 700; font-size: 0.95rem; cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  transition: all 0.2s ease;
}
.btn-google:hover {
  background: var(--bg-subtle); border-color: var(--accent-primary);
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.15);
  transform: translateY(-1px);
}
.btn-google:active { transform: translateY(0); }

/* FLOATING TOAST NOTIFICATION STYLING */
.toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem; z-index: 10000;
  display: flex; flex-direction: column; gap: 0.6rem; pointer-events: none;
  max-width: calc(100vw - 2rem);
}

.toast-card {
  pointer-events: auto; display: flex; align-items: center; gap: 0.75rem;
  min-width: 260px; max-width: 420px; padding: 0.85rem 1.1rem;
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.25);
  color: var(--text-primary); font-size: 0.875rem; font-weight: 500;
  transform: translateX(120%); opacity: 0; transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
.toast-card.show { transform: translateX(0); opacity: 1; }

.toast-card.success { border-left: 4px solid var(--status-green-text); }
.toast-card.info { border-left: 4px solid var(--accent-primary); }
.toast-card.warning { border-left: 4px solid var(--status-amber-text); }
.toast-card.danger { border-left: 4px solid var(--status-red-text); }

.toast-icon { display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.toast-card.success .toast-icon { color: var(--status-green-text); }
.toast-card.info .toast-icon { color: var(--accent-primary); }
.toast-card.warning .toast-icon { color: var(--status-amber-text); }
.toast-card.danger .toast-icon { color: var(--status-red-text); }

.toast-close {
  margin-left: auto; background: none; border: none; color: var(--text-tertiary);
  font-size: 1.1rem; cursor: pointer; padding: 0 0.2rem; transition: var(--transition);
  min-width: 32px; min-height: 32px; display: flex; align-items: center; justify-content: center;
}
.toast-close:hover { color: var(--text-primary); }

/* APP BRAND LOGO FOR LIGHT & DARK THEMES */
.app-logo-img {
  width: 26px;
  height: 26px;
  object-fit: contain;
  vertical-align: middle;
}

.logo-for-light { display: inline-block; }
.logo-for-dark { display: none; }

[data-theme="dark"] .logo-for-light { display: none; }
[data-theme="dark"] .logo-for-dark { display: inline-block; }

/* Header Layout (Desktop vs Mobile Separated) */
.app-header {
  position: sticky; top: 0; z-index: 100;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border-color);
  padding: 0.85rem 1.75rem;
  padding-top: max(0.85rem, env(safe-area-inset-top));
  transition: background var(--transition), border-color var(--transition);
}

.nav-container {
  max-width: 1500px; margin: 0 auto;
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0.75rem;
}

.nav-left-group {
  grid-column: 1; display: flex; align-items: center; gap: 0.5rem; flex-wrap: nowrap;
}

.header-actions {
  grid-column: 2; display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0;
}

.global-search {
  grid-column: 1 / -1; width: 100%; position: relative;
}

/* DESKTOP / PC SINGLE HORIZONTAL ROW LAYOUT (>= 992px) */
@media (min-width: 992px) {
  .app-header { padding: 0.85rem 1.75rem; }
  .nav-container {
    display: flex; flex-direction: row; align-items: center; justify-content: space-between; gap: 1.5rem;
  }
  .nav-left-group { flex-shrink: 0; }
  .global-search { flex: 1; max-width: 480px; }
  .header-actions { flex-shrink: 0; }
}

.hamburger-btn {
  width: 38px; height: 38px; border-radius: var(--radius-md);
  background: transparent; border: 1px solid var(--border-color);
  color: var(--text-primary); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition); flex-shrink: 0;
  touch-action: manipulation;
}
.hamburger-btn:hover { background: var(--bg-subtle); }

.brand-logo { display: flex; align-items: center; gap: 0.55rem; text-decoration: none; color: var(--text-primary); }
.brand-title { font-size: 1.15rem; font-weight: 800; letter-spacing: -0.02em; }

@media (max-width: 768px) {
  .brand-title { display: none; }
}

.user-login-badge {
  display: inline-flex; align-items: center; gap: 0.45rem;
  font-size: 0.775rem; font-weight: 600; padding: 0.35rem 0.85rem;
  background: var(--accent-light); color: var(--accent-text);
  border: 1px solid rgba(37, 99, 235, 0.2); border-radius: var(--radius-pill);
  cursor: pointer; transition: var(--transition); min-height: 36px;
  touch-action: manipulation;
}
.user-login-badge:hover { background: var(--bg-hover); transform: translateY(-1px); }

.global-search { position: relative; flex: 1; width: 100%; max-width: 480px; margin: 0 auto; }
.global-search input {
  width: 100%; padding: 0.6rem 1rem 0.6rem 2.5rem;
  background: var(--bg-body); border: 1px solid var(--border-color);
  border-radius: var(--radius-md); color: var(--text-primary); font-size: 0.875rem;
  transition: var(--transition); height: 38px;
}
.global-search input:focus { outline: none; border-color: var(--accent-primary); background: var(--bg-surface); box-shadow: 0 0 0 3px var(--accent-light); }
.search-icon { position: absolute; left: 0.85rem; top: 50%; transform: translateY(-50%); color: var(--text-tertiary); }

/* GLOBAL OMNISEARCH SPOTLIGHT POPOVER OVERLAY */
.global-search-popover {
  position: absolute; top: calc(100% + 0.5rem); left: 0; width: 100%;
  max-height: 60vh; overflow-y: auto; background: var(--bg-card);
  border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  box-shadow: 0 12px 30px -5px rgba(0, 0, 0, 0.25); z-index: 1000;
  display: none; padding: 0.75rem 0;
  -webkit-overflow-scrolling: touch;
}
.global-search-popover.active { display: block; }

.search-category-group { margin-bottom: 0.75rem; }
.search-category-group:last-child { margin-bottom: 0; }

.search-category-header {
  padding: 0.4rem 1rem; font-size: 0.725rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-tertiary);
  display: flex; align-items: center; justify-content: space-between;
}

.search-result-item {
  display: flex; align-items: center; gap: 0.85rem; padding: 0.75rem 1rem;
  cursor: pointer; transition: var(--transition); text-decoration: none; color: var(--text-primary);
  min-height: 48px; touch-action: manipulation;
}
.search-result-item:hover, .search-result-item.highlighted { background: var(--bg-subtle); }

.search-result-icon-box {
  width: 32px; height: 32px; border-radius: var(--radius-md);
  background: var(--accent-light); color: var(--accent-primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

.search-result-details { flex: 1; min-width: 0; }
.search-result-title { font-size: 0.875rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-subtitle { font-size: 0.775rem; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.search-result-tag {
  font-size: 0.7rem; font-weight: 600; background: var(--bg-subtle);
  color: var(--text-secondary); padding: 0.15rem 0.5rem; border-radius: var(--radius-pill);
  border: 1px solid var(--border-color); flex-shrink: 0;
}

mark.search-highlight { background: rgba(250, 204, 21, 0.4); color: inherit; padding: 0 0.15rem; border-radius: 2px; }

/* Header Actions */
.header-actions { display: flex; align-items: center; gap: 0.6rem; flex-shrink: 0; }

.status-notifier-pill {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.45rem 0.95rem;
  background: var(--bg-body); border: 1px solid var(--border-color);
  border-radius: var(--radius-pill); color: var(--text-secondary); font-size: 0.8rem; font-weight: 600; cursor: pointer;
  transition: var(--transition); min-height: 36px;
}
.status-notifier-pill:hover { background: var(--bg-subtle); color: var(--text-primary); }

@media (max-width: 768px) {
  .status-notifier-pill { display: none; }
}

.status-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--text-tertiary); transition: background 0.2s ease;
}
.status-dot.synced { background: #22c55e; box-shadow: 0 0 8px rgba(34, 197, 94, 0.4); }
.status-dot.syncing { background: var(--accent-primary); animation: pulse 1s infinite; }
.status-dot.saved { background: #3b82f6; }

@keyframes pulse {
  0% { opacity: 0.4; transform: scale(0.85); }
  50% { opacity: 1; transform: scale(1.15); }
  100% { opacity: 0.4; transform: scale(0.85); }
}

.manual-sync-btn {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--bg-body); border: 1px solid var(--border-color);
  color: var(--text-secondary); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition); touch-action: manipulation;
}
.manual-sync-btn:hover { background: var(--bg-subtle); color: var(--accent-primary); border-color: var(--accent-primary); }

.spin-animation { animation: spinRotate 0.8s linear infinite; }
@keyframes spinRotate { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } }

/* APP INITIALIZATION SPLASH SCREEN */
.splash-screen {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
  background: var(--bg-body); z-index: 99999;
  display: flex; align-items: center; justify-content: center;
  opacity: 1; transition: opacity 0.35s ease, visibility 0.35s ease;
  visibility: visible;
}
.splash-screen.fade-out {
  opacity: 0; visibility: hidden; pointer-events: none;
}
.splash-content {
  display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center;
  padding: 2rem;
}
.splash-logo {
  width: 64px; height: 64px; object-fit: contain;
  animation: logoClockwiseRotate 1.8s linear infinite;
}
@keyframes logoClockwiseRotate {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Drawer Layout & Menu Item at Very Bottom */
.drawer-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
  background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px); z-index: 1000;
  opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
}
.drawer-overlay.active { opacity: 1; pointer-events: auto; }

.drawer-content {
  position: fixed; top: 0; left: 0; width: 285px; max-width: 82vw; height: 100vh; height: 100dvh;
  background: var(--bg-drawer); border-right: 1px solid var(--border-color);
  padding: 1.25rem; padding-top: max(1.25rem, env(safe-area-inset-top)); display: flex; flex-direction: column;
  transform: translateX(-100%); transition: transform 0.2s ease; z-index: 1001;
  -webkit-overflow-scrolling: touch;
}
.drawer-overlay.active .drawer-content { transform: translateX(0); }

.drawer-header { display: flex; align-items: center; justify-content: space-between; padding-bottom: 0.85rem; margin-bottom: 1rem; border-bottom: 1px solid var(--border-color); }
.drawer-pin-btn {
  background: transparent; border: 1px solid var(--border-color);
  color: var(--text-secondary); border-radius: var(--radius-md);
  width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; transition: var(--transition);
}
.drawer-pin-btn:hover { background: var(--bg-subtle); color: var(--text-primary); }
.drawer-pin-btn.pinned {
  background: var(--accent-light); color: var(--accent-primary); border-color: var(--accent-primary);
}

.drawer-close {
  background: none; border: none; color: var(--text-secondary); font-size: 1.5rem; cursor: pointer;
  min-width: 36px; min-height: 36px; display: flex; align-items: center; justify-content: center;
}

/* PINNED SIDEBAR MODE (DESKTOP >= 992px) */
@media (min-width: 992px) {
  body.drawer-pinned .drawer-overlay {
    position: fixed; width: 285px; height: 100vh;
    background: transparent; backdrop-filter: none; pointer-events: auto; opacity: 1;
  }
  body.drawer-pinned .drawer-content {
    transform: translateX(0) !important; box-shadow: none;
  }
  body.drawer-pinned .app-header,
  body.drawer-pinned .sub-nav-bar,
  body.drawer-pinned .main-container {
    margin-left: 285px; width: calc(100% - 285px);
  }
  body.drawer-pinned .hamburger-btn {
    display: none;
  }
}

.drawer-menu-list { display: flex; flex-direction: column; flex: 1; }

.main-menu-item {
  display: flex; align-items: center; gap: 0.75rem;
  width: 100%; padding: 0.65rem 0.85rem; border-radius: var(--radius-md); color: var(--text-secondary);
  font-size: 0.9rem; font-weight: 500; background: transparent; border: none; cursor: pointer; transition: var(--transition); margin-bottom: 0.25rem;
  min-height: 40px; touch-action: manipulation;
}
.main-menu-item:hover { background: var(--bg-subtle); color: var(--text-primary); }
.main-menu-item.active { background: var(--accent-light); color: var(--accent-primary); font-weight: 600; }
.main-menu-item.hidden { display: none !important; }

/* Very Bottom Drawer Menu Separator & Item */
.drawer-menu-bottom-divider {
  margin-top: 0.75rem; margin-bottom: 0.75rem; border-top: 1px solid var(--border-color);
}
.profile-menu-item {
  color: var(--accent-primary) !important; font-weight: 600 !important; background: var(--accent-light);
}

/* Sub Nav Bar */
.sub-nav-bar { background: var(--bg-surface); border-bottom: 1px solid var(--border-color); padding: 0.4rem 1.75rem; }
.sub-nav-container {
  max-width: 1500px; margin: 0 auto; display: flex; align-items: center; gap: 0.35rem;
  overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain;
  scrollbar-width: none;
}
.sub-nav-container::-webkit-scrollbar { display: none; }

.sub-tab-btn {
  display: flex; align-items: center; gap: 0.45rem; padding: 0.45rem 0.85rem;
  background: transparent; border: none; border-radius: var(--radius-md);
  color: var(--text-secondary); font-size: 0.85rem; font-weight: 500; cursor: pointer; transition: var(--transition);
  user-select: none; flex-shrink: 0; min-height: 38px; touch-action: manipulation;
}
.sub-tab-btn:hover { color: var(--text-primary); background: var(--bg-subtle); }
.sub-tab-btn.active { color: var(--text-primary); background: var(--bg-body); font-weight: 600; border: 1px solid var(--border-color); }

.sub-tab-btn[draggable="true"] { cursor: grab; }
.sub-tab-btn[draggable="true"]:active { cursor: grabbing; }
.sub-tab-btn.dragging { opacity: 0.4; border: 1px dashed var(--accent-primary); background: var(--accent-light); }
.sub-tab-btn.drag-over { border-left: 3px solid var(--accent-primary); background: var(--bg-hover); }

/* Main Content Area */
.main-container { max-width: 1500px; margin: 0 auto; padding: 1.75rem; }

@media (max-width: 768px) {
  .main-container { padding: 1.25rem 1rem; }
}

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

/* Responsive Card Headers & Layout Grids */
.clean-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow-card);
  margin-bottom: 1.25rem;
}

.card-header-flex {
  display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem;
}
@media (min-width: 576px) {
  .card-header-flex { flex-direction: row; justify-content: space-between; align-items: center; }
}

.dashboard-grid-layout, .schema-view-grid {
  display: grid; grid-template-columns: 1fr; gap: 1.25rem;
}
@media (min-width: 992px) {
  .dashboard-grid-layout, .schema-view-grid { grid-template-columns: 2fr 1fr; }
}

.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 1.25rem; margin-bottom: 1.5rem; }
.metric-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); padding: 1.25rem; display: flex; align-items: center; gap: 1rem;
}
.metric-icon-box {
  width: 44px; height: 44px; border-radius: var(--radius-md);
  background: var(--bg-subtle); color: var(--text-primary);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}

/* Touch-Friendly Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  padding: 0.55rem 1rem; border-radius: var(--radius-md); font-size: 0.85rem; font-weight: 600;
  cursor: pointer; border: 1px solid transparent; transition: var(--transition);
  min-height: 40px; touch-action: manipulation;
}
.btn-primary { background: var(--accent-primary); color: #ffffff; }
.btn-primary:hover { opacity: 0.9; }
.btn-secondary { background: var(--bg-subtle); color: var(--text-primary); border-color: var(--border-color); }
.btn-secondary:hover { background: var(--bg-hover); }
.btn-sm { padding: 0.35rem 0.75rem; font-size: 0.8rem; min-height: 36px; }

/* Responsive Data Tables */
.table-responsive { width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
.data-table { width: 100%; border-collapse: collapse; text-align: left; font-size: 0.85rem; }
.data-table th { background: var(--bg-subtle); padding: 0.75rem 1rem; color: var(--text-secondary); font-weight: 600; font-size: 0.775rem; border-bottom: 1px solid var(--border-color); white-space: nowrap; }
.data-table td { padding: 0.85rem 1rem; border-bottom: 1px solid var(--border-color); color: var(--text-primary); }

.source-pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.65rem; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 600; background: var(--bg-subtle); color: var(--text-secondary); border: 1px solid var(--border-color); }

.status-pill { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.2rem 0.6rem; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 600; }
.status-pill.success { background: var(--status-green-bg); color: var(--status-green-text); }
.status-pill.warning { background: var(--status-amber-bg); color: var(--status-amber-text); }
.status-pill.danger { background: var(--status-red-bg); color: var(--status-red-text); }

/* Role Badges */
.role-badge { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.2rem 0.65rem; border-radius: var(--radius-pill); font-size: 0.75rem; font-weight: 700; text-transform: uppercase; }
.role-badge.owner { background: #fef3c7; color: #b45309; }
.role-badge.admin { background: #e0e7ff; color: #4338ca; }
.role-badge.manager { background: #dcfce7; color: #15803d; }
.role-badge.cook { background: #ffedd5; color: #c2410c; }
.role-badge.guest { background: #f1f5f9; color: #475569; }

/* Access Matrix Table Grid */
.access-matrix-table th, .access-matrix-table td { text-align: center; }

/* AppSheet ENUM Values List Styling */
.enum-values-list { display: flex; flex-direction: column; gap: 0.45rem; margin-bottom: 0.75rem; }
.enum-value-item {
  display: flex; align-items: center; gap: 0.5rem;
  background: var(--bg-surface); border: 1px solid var(--border-color);
  padding: 0.4rem 0.6rem; border-radius: var(--radius-md);
}
.enum-drag-handle { cursor: grab; color: var(--text-tertiary); display: flex; align-items: center; }
.enum-drag-handle:active { cursor: grabbing; }

/* PIN Keypad Modal UI */
.pin-display-dots {
  display: flex; justify-content: center; gap: 0.85rem; margin: 1.25rem 0;
}
.pin-dot {
  width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--border-color);
  transition: background 0.15s ease, border-color 0.15s ease;
}
.pin-dot.filled { background: var(--accent-primary); border-color: var(--accent-primary); }

.pin-pad-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; max-width: 280px; margin: 0 auto;
}
.pin-digit-btn {
  height: 56px; border-radius: var(--radius-lg); font-size: 1.35rem; font-weight: 700;
  background: var(--bg-subtle); border: 1px solid var(--border-color); color: var(--text-primary);
  cursor: pointer; transition: var(--transition); touch-action: manipulation;
}
.pin-digit-btn:hover { background: var(--bg-hover); border-color: var(--accent-primary); }
.pin-digit-btn:active { transform: scale(0.95); }

/* Accordion Schema Table Cards */
.schema-accordion-card {
  background: var(--bg-card); border: 1px solid var(--border-color);
  border-radius: var(--radius-lg); margin-bottom: 0.85rem; overflow: hidden;
}
.schema-accordion-header {
  padding: 1rem 1.25rem; display: flex; align-items: center; justify-content: space-between;
  cursor: pointer; user-select: none; background: var(--bg-card); transition: var(--transition);
  touch-action: manipulation;
}
.schema-accordion-header:hover { background: var(--bg-subtle); }

.schema-accordion-body {
  display: none; padding: 1.25rem; border-top: 1px solid var(--border-color); background: var(--bg-body);
}
.schema-accordion-card.open .schema-accordion-body { display: block; }
.chevron-icon { transition: transform 0.2s ease; color: var(--text-tertiary); }
.schema-accordion-card.open .chevron-icon { transform: rotate(180deg); color: var(--accent-primary); }

/* Settings View UI */
.theme-selector-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1rem; }
.theme-option-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.6rem;
  padding: 1.25rem; border-radius: var(--radius-lg); border: 2px solid var(--border-color);
  background: var(--bg-card); color: var(--text-secondary); cursor: pointer; transition: var(--transition);
  touch-action: manipulation;
}
.theme-option-btn:hover { border-color: var(--accent-primary); color: var(--text-primary); }
.theme-option-btn.active { border-color: var(--accent-primary); background: var(--accent-light); color: var(--accent-primary); font-weight: 600; }

/* Modals */
.modal-overlay {
  position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; height: 100dvh;
  background: rgba(0, 0, 0, 0.4); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  padding: 1rem;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal-card {
  background: var(--bg-card); border: 1px solid var(--border-color); border-radius: var(--radius-lg);
  width: 100%; max-width: 580px; max-height: 90vh; max-height: 90dvh; overflow-y: auto;
  padding: 1.75rem; box-shadow: var(--shadow-card);
  -webkit-overflow-scrolling: touch;
}

.form-grid-2col { display: grid; grid-template-columns: 1fr; gap: 0.75rem; margin-bottom: 0.75rem; }
@media (min-width: 576px) {
  .form-grid-2col { grid-template-columns: 1fr 1fr; gap: 1rem; }
}

.form-group { margin-bottom: 1.1rem; }
.form-group label { display: block; font-size: 0.8rem; font-weight: 600; color: var(--text-secondary); margin-bottom: 0.35rem; }
.form-control { width: 100%; padding: 0.6rem 0.85rem; background: var(--bg-body); border: 1px solid var(--border-color); border-radius: var(--radius-md); color: var(--text-primary); font-size: 0.875rem; }
.form-control:focus { outline: none; border-color: var(--accent-primary); }
