/* ============================================================
   ROOMVIP — Full Application CSS
   IBM Plex Sans · Teal accent #0F766E · Small radii
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:ital,wght@0,400;0,500;0,600;0,700;1,400&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

/* ---- Reset & base ---- */
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

:root {
  --r-xs: 3px;
  --r-sm: 4px;
  --r-md: 6px;
  --r-lg: 8px;
  --font-sans: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, 'SF Mono', monospace;
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-7: 32px; --sp-8: 40px; --sp-9: 56px;
  --shadow-sm: 0 1px 2px rgba(16,24,28,.06), 0 1px 1px rgba(16,24,28,.04);
  --shadow-md: 0 4px 12px rgba(16,24,28,.08), 0 1px 3px rgba(16,24,28,.05);
  --shadow-lg: 0 16px 40px rgba(16,24,28,.16), 0 4px 12px rgba(16,24,28,.08);
  --shadow-pop: 0 12px 32px rgba(16,24,28,.18);
  --sidebar-w: 230px;
  --topbar-h: 60px;
}

/* ---- Light Theme (default) ---- */
:root, [data-theme="light"] {
  --bg: #F4F6F6;
  --bg-deep: #ECEFEF;
  --surface: #FFFFFF;
  --surface-2: #F8FAFA;
  --surface-3: #F1F4F4;
  --border: #E1E5E6;
  --border-strong: #CDD3D4;
  --text: #14191B;
  --text-2: #47535A;
  --text-3: #74828A;
  --text-inv: #FFFFFF;
  --accent: #0F766E;
  --accent-hover: #0B5C56;
  --accent-press: #094B46;
  --accent-soft: #E4F1EF;
  --accent-soft-2: #D2E8E5;
  --accent-text: #0B5C56;
  --on-accent: #FFFFFF;
  --focus: #0F766E;
  --st-blue-bg:#E5EEFB;   --st-blue-tx:#1E5BB8;   --st-blue-dot:#2E72D2;
  --st-amber-bg:#FBF0DC;  --st-amber-tx:#94640E;  --st-amber-dot:#C9881A;
  --st-teal-bg:#DCEFEC;   --st-teal-tx:#0B5C56;   --st-teal-dot:#0F766E;
  --st-indigo-bg:#E9E8FB; --st-indigo-tx:#4A3FBF; --st-indigo-dot:#5B4FE0;
  --st-green-bg:#DEF1E4;  --st-green-tx:#1B7A40;  --st-green-dot:#21A152;
  --st-red-bg:#FBE3E3;    --st-red-tx:#B23232;    --st-red-dot:#D94545;
  --st-cyan-bg:#DBEFF4;   --st-cyan-tx:#0B6178;   --st-cyan-dot:#1090AE;
  --st-gray-bg:#EAEEEF;   --st-gray-tx:#5B6970;   --st-gray-dot:#869098;
  --st-purple-bg:#F2E6F6; --st-purple-tx:#8A3CA0; --st-purple-dot:#A954C2;
}

/* ---- Dark Theme ---- */
[data-theme="dark"] {
  --bg: #0C1213;
  --bg-deep: #080D0E;
  --surface: #131B1C;
  --surface-2: #18211F;
  --surface-3: #1E2826;
  --border: #283431;
  --border-strong: #36443F;
  --text: #E9EFEE;
  --text-2: #A7B4B2;
  --text-3: #74837F;
  --text-inv: #0C1213;
  --accent: #2BBFAE;
  --accent-hover: #46CDBC;
  --accent-press: #5BD6C6;
  --accent-soft: #14302C;
  --accent-soft-2: #1B423C;
  --accent-text: #4FD3C3;
  --on-accent: #04201C;
  --focus: #2BBFAE;
  --st-blue-bg:#16263F;   --st-blue-tx:#7FB0F0;   --st-blue-dot:#4E8FE6;
  --st-amber-bg:#332813;  --st-amber-tx:#E5B458;  --st-amber-dot:#D79A2E;
  --st-teal-bg:#12302C;   --st-teal-tx:#54D3C4;   --st-teal-dot:#2BBFAE;
  --st-indigo-bg:#211F3D; --st-indigo-tx:#9B92F0; --st-indigo-dot:#7E72E8;
  --st-green-bg:#13301F;  --st-green-tx:#5FCB82;  --st-green-dot:#2FA85B;
  --st-red-bg:#371A1A;    --st-red-tx:#F08A8A;    --st-red-dot:#E05656;
  --st-cyan-bg:#10303A;   --st-cyan-tx:#54C2DC;   --st-cyan-dot:#23A6C6;
  --st-gray-bg:#1E2826;   --st-gray-tx:#94A29E;   --st-gray-dot:#6C7A76;
  --st-purple-bg:#2C1B33; --st-purple-tx:#CE8FE0; --st-purple-dot:#B25FCB;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
  --shadow-md: 0 4px 14px rgba(0,0,0,.5);
  --shadow-lg: 0 18px 44px rgba(0,0,0,.6);
  --shadow-pop: 0 14px 36px rgba(0,0,0,.55);
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-soft-2); color: var(--accent-text); }

*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 8px; border: 3px solid var(--bg); }
*::-webkit-scrollbar-track { background: transparent; }

input, button, textarea, select { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--font-mono); }
.tnum { font-variant-numeric: tabular-nums; }

/* ---- Animations ---- */
@keyframes fadeIn  { from { opacity:0; transform:translateY(4px); } to { opacity:1; transform:none; } }
@keyframes popIn   { from { opacity:0; transform:translateY(6px) scale(.98); } to { opacity:1; transform:none; } }
@keyframes slideIn { from { opacity:0; transform:translateX(28px); } to { opacity:1; transform:none; } }
@keyframes slideUp { from { opacity:0; transform:translateY(24px); } to { opacity:1; transform:none; } }
@keyframes pulse   { 0%,100% { opacity:1; } 50% { opacity:.4; } }
@keyframes spin    { to { transform:rotate(360deg); } }
@keyframes toastIn { from { opacity:0; transform:translateX(100%); } to { opacity:1; transform:none; } }

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

#app {
  display: flex;
  height: 100%;
  overflow: hidden;
}

/* ---- Sidebar ---- */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  height: 100%;
  transition: width .18s ease, min-width .18s ease;
  overflow: hidden;
  flex-shrink: 0;
}

#sidebar.collapsed {
  width: 64px;
  min-width: 64px;
}

.sidebar-logo {
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

#sidebar.collapsed .sidebar-logo {
  padding: 0;
  justify-content: center;
}

.sidebar-logo-icon {
  width: 30px;
  height: 30px;
  border-radius: var(--r-sm);
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -.03em;
  flex-shrink: 0;
}

.sidebar-logo-text { line-height: 1; }
.sidebar-logo-name { font-weight: 700; font-size: 15.5px; letter-spacing: -.02em; }
.sidebar-logo-sub  { font-size: 10.5px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; margin-top: 2px; }

#sidebar.collapsed .sidebar-logo-text { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 12px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-section-label {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .06em;
  padding: 8px 11px 5px;
  white-space: nowrap;
}

#sidebar.collapsed .sidebar-section-label { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 11px;
  border-radius: var(--r-sm);
  border: none;
  background: transparent;
  color: var(--text-2);
  font-size: 13.5px;
  font-weight: 500;
  position: relative;
  transition: background .12s, color .12s;
  white-space: nowrap;
  overflow: hidden;
  cursor: pointer;
  text-align: left;
}

.nav-item:hover { background: var(--surface-2); }
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent-text);
  font-weight: 600;
}

.nav-item .nav-active-bar {
  position: absolute;
  left: -1px; top: 7px; bottom: 7px;
  width: 3px;
  border-radius: 3px;
  background: var(--accent);
  display: none;
}
.nav-item.active .nav-active-bar { display: block; }

#sidebar.collapsed .nav-item {
  padding: 10px 0;
  justify-content: center;
}

.nav-label { flex: 1; }
#sidebar.collapsed .nav-label { display: none; }

.nav-badge {
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  text-align: center;
  padding: 1px 5px;
  border-radius: 99px;
  background: var(--st-blue-bg);
  color: var(--st-blue-tx);
}
.nav-item.active .nav-badge { background: var(--accent); color: #fff; }

.nav-dot {
  position: absolute;
  top: 6px; right: 12px;
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--st-blue-dot);
}

#sidebar.collapsed .nav-badge { display: none; }

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 8px 6px;
}

.sidebar-spacer { flex: 1; }

.sidebar-collapse-btn {
  height: 42px;
  border: none;
  border-top: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background .12s;
}
.sidebar-collapse-btn:hover { background: var(--surface-2); }

/* ---- Main area ---- */
#main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

/* ---- Topbar ---- */
#topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 22px;
  position: relative;
  z-index: 30;
  flex-shrink: 0;
}

.topbar-title {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -.02em;
  white-space: nowrap;
}

.topbar-search {
  flex: 1;
  max-width: 420px;
  margin-left: 8px;
}

.search-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  height: 38px;
  width: 100%;
  padding: 0 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-3);
  cursor: text;
  font-size: 13.5px;
}
.search-btn:hover { border-color: var(--border-strong); }

.search-hint {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--text-3);
  border: 1px solid var(--border-strong);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: var(--font-mono);
}

.topbar-spacer { flex: 1; }

.topbar-icon-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--r-sm);
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text-2);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background .12s, border-color .12s;
  position: relative;
  flex-shrink: 0;
}
.topbar-icon-btn:hover { background: var(--surface-3); border-color: var(--border-strong); }

.notif-dot {
  position: absolute;
  top: 7px; right: 8px;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--st-red-dot);
  border: 2px solid var(--surface);
}

.user-btn {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 4px 8px 4px 4px;
  border-radius: 99px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  cursor: pointer;
  transition: background .12s;
}
.user-btn:hover { background: var(--surface-3); }

.user-btn-info { text-align: left; line-height: 1.15; }
.user-btn-name { font-size: 12.5px; font-weight: 600; }
.user-btn-role { font-size: 10.5px; color: var(--text-3); }

/* ---- View content ---- */
#view-content {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

.view-pad { padding: 24px; }
.view-pad-sm { padding: 16px 24px; }

/* ============================================================
   COMPONENTS
   ============================================================ */

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: none;
  border-radius: var(--r-sm);
  font-weight: 600;
  cursor: pointer;
  transition: background .12s, color .12s, border-color .12s;
  white-space: nowrap;
  font-size: 13.5px;
  padding: 8px 14px;
  line-height: 1;
}

.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:active { background: var(--accent-press); }

.btn-secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { background: var(--surface-2); border-color: var(--border-strong); }

.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { background: var(--st-red-bg); color: var(--st-red-tx); }
.btn-danger:hover { background: var(--st-red-dot); color: #fff; }

.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 10px 18px; font-size: 15px; }
.btn-icon { padding: 8px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ---- Avatar ---- */
.avatar {
  border-radius: var(--r-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  letter-spacing: -.02em;
  flex-shrink: 0;
  font-size: 12px;
}

/* ---- Status badges ---- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px 2px 6px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.badge-blue   { background: var(--st-blue-bg);   color: var(--st-blue-tx);   }
.badge-blue   .badge-dot { background: var(--st-blue-dot); }
.badge-amber  { background: var(--st-amber-bg);  color: var(--st-amber-tx);  }
.badge-amber  .badge-dot { background: var(--st-amber-dot); }
.badge-teal   { background: var(--st-teal-bg);   color: var(--st-teal-tx);   }
.badge-teal   .badge-dot { background: var(--st-teal-dot); }
.badge-indigo { background: var(--st-indigo-bg); color: var(--st-indigo-tx); }
.badge-indigo .badge-dot { background: var(--st-indigo-dot); }
.badge-green  { background: var(--st-green-bg);  color: var(--st-green-tx);  }
.badge-green  .badge-dot { background: var(--st-green-dot); }
.badge-red    { background: var(--st-red-bg);    color: var(--st-red-tx);    }
.badge-red    .badge-dot { background: var(--st-red-dot); }
.badge-cyan   { background: var(--st-cyan-bg);   color: var(--st-cyan-tx);   }
.badge-cyan   .badge-dot { background: var(--st-cyan-dot); }
.badge-gray   { background: var(--st-gray-bg);   color: var(--st-gray-tx);   }
.badge-gray   .badge-dot { background: var(--st-gray-dot); }
.badge-purple { background: var(--st-purple-bg); color: var(--st-purple-tx); }
.badge-purple .badge-dot { background: var(--st-purple-dot); }

/* ---- Tables ---- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-3);
  letter-spacing: .04em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}

.data-table td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

.data-table tbody tr {
  transition: background .1s;
  cursor: pointer;
}
.data-table tbody tr:hover { background: var(--surface-2); }

/* ---- Cards ---- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 18px 20px;
  box-shadow: var(--shadow-sm);
  transition: box-shadow .15s;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card-label { font-size: 12px; font-weight: 600; color: var(--text-3); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.stat-card-value { font-size: 28px; font-weight: 700; letter-spacing: -.02em; line-height: 1; }
.stat-card-sub   { font-size: 12px; color: var(--text-3); margin-top: 6px; }
.stat-card-icon  { width: 36px; height: 36px; border-radius: var(--r-sm); display: flex; align-items: center; justify-content: center; }

/* ---- Drawer ---- */
.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 100;
  animation: fadeIn .15s;
}

.drawer {
  position: fixed;
  right: 0;
  top: 0;
  bottom: 0;
  width: 720px;
  max-width: 96vw;
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  z-index: 101;
  animation: slideIn .2s;
}

.drawer-header {
  padding: 18px 22px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: flex-start;
  gap: 14px;
  flex-shrink: 0;
}

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.drawer-footer {
  padding: 14px 22px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

/* ---- Modal ---- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: fadeIn .15s;
}

.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: popIn .18s;
}

.modal-lg { max-width: 720px; }
.modal-xl { max-width: 900px; }

.modal-header {
  padding: 18px 22px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.modal-title { font-size: 16px; font-weight: 600; flex: 1; }
.modal-body   { flex: 1; overflow-y: auto; padding: 20px 22px; }
.modal-footer { padding: 14px 22px; border-top: 1px solid var(--border); display: flex; align-items: center; justify-content: flex-end; gap: 10px; flex-shrink: 0; }

/* ---- Form elements ---- */
.form-group { margin-bottom: 16px; }
.form-label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-2); margin-bottom: 5px; }
.form-hint  { font-size: 11.5px; color: var(--text-3); margin-top: 4px; }

.form-input, .form-select, .form-textarea {
  display: block;
  width: 100%;
  padding: 8px 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 13.5px;
  transition: border-color .15s;
  outline: none;
}
.form-input:hover, .form-select:hover, .form-textarea:hover { border-color: var(--border-strong); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.form-textarea { min-height: 80px; resize: vertical; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

/* ---- Tabs ---- */
.tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  padding: 0 22px;
  background: var(--surface);
}

.tab-btn {
  padding: 10px 14px;
  border: none;
  background: transparent;
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: color .12s, border-color .12s;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
}
.tab-btn:hover { color: var(--text-2); }
.tab-btn.active { color: var(--accent-text); font-weight: 600; border-bottom-color: var(--accent); }
.tab-count { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: var(--surface-2); color: var(--text-3); }
.tab-btn.active .tab-count { background: var(--accent-soft); color: var(--accent-text); }

/* ---- Stepper ---- */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.step-circle {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  border: 2px solid var(--border);
  color: var(--text-3);
  background: var(--surface);
}

.step.done .step-circle   { background: var(--accent); border-color: var(--accent); color: #fff; }
.step.active .step-circle { background: var(--surface); border-color: var(--accent); color: var(--accent-text); }

.step-label { font-size: 12px; font-weight: 500; color: var(--text-3); }
.step.done .step-label   { color: var(--accent-text); }
.step.active .step-label { color: var(--text); font-weight: 600; }

.step-line { flex: 1; height: 2px; background: var(--border); min-width: 20px; max-width: 40px; }
.step.done + .step .step-line,
.step-line.done { background: var(--accent); }

/* ---- Toast ---- */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  min-width: 280px;
  max-width: 400px;
  animation: toastIn .22s ease;
  pointer-events: auto;
}

.toast-icon { flex-shrink: 0; margin-top: 1px; }
.toast-body { flex: 1; }
.toast-message { font-size: 13.5px; font-weight: 500; }
.toast-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.toast.success { border-left: 3px solid var(--st-green-dot); }
.toast.error   { border-left: 3px solid var(--st-red-dot); }
.toast.info    { border-left: 3px solid var(--st-blue-dot); }
.toast.warning { border-left: 3px solid var(--st-amber-dot); }

/* ---- Dropdown menus ---- */
.dropdown {
  position: absolute;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  z-index: 500;
  padding: 6px;
  min-width: 180px;
  animation: popIn .14s;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font-size: 13px;
  cursor: pointer;
  text-align: left;
  transition: background .1s, color .1s;
}
.dropdown-item:hover { background: var(--surface-2); color: var(--text); }
.dropdown-item.danger:hover { background: var(--st-red-bg); color: var(--st-red-tx); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ---- Checklist ---- */
.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
}
.checklist-item:last-child { border-bottom: none; }
.checklist-check {
  width: 18px;
  height: 18px;
  border-radius: var(--r-xs);
  border: 2px solid var(--border-strong);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, border-color .15s;
  cursor: pointer;
}
.checklist-check.checked { background: var(--accent); border-color: var(--accent); }
.checklist-label { flex: 1; font-size: 13.5px; }
.checklist-check.checked + .checklist-label { text-decoration: line-through; color: var(--text-3); }

/* ---- Kanban ---- */
.kanban-board {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding: 20px 24px;
  align-items: flex-start;
}

.kanban-col {
  flex-shrink: 0;
  width: 240px;
  background: var(--surface-2);
  border-radius: var(--r-md);
  overflow: hidden;
}

.kanban-col-header {
  padding: 10px 14px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kanban-col-count {
  padding: 1px 7px;
  border-radius: 99px;
  background: var(--surface);
  color: var(--text-3);
  font-size: 11px;
}

.kanban-col-body {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

.kanban-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 12px;
  cursor: pointer;
  transition: box-shadow .12s;
  animation: popIn .15s;
}
.kanban-card:hover { box-shadow: var(--shadow-md); }
.kanban-card-title { font-size: 13px; font-weight: 600; margin-bottom: 6px; }
.kanban-card-meta  { font-size: 11.5px; color: var(--text-3); display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* ---- Search / Command palette ---- */
.cmdpal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 800;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding-top: 80px;
}

.cmdpal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 580px;
  max-width: 96vw;
  overflow: hidden;
  animation: popIn .16s;
}

.cmdpal-input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.cmdpal-input {
  flex: 1;
  border: none;
  background: transparent;
  font-size: 15px;
  color: var(--text);
  outline: none;
}

.cmdpal-results { max-height: 360px; overflow-y: auto; }
.cmdpal-section { padding: 8px 8px 4px; font-size: 10.5px; font-weight: 700; color: var(--text-3); letter-spacing: .05em; text-transform: uppercase; }
.cmdpal-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background .1s;
  border-radius: var(--r-sm);
  margin: 1px 6px;
}
.cmdpal-item:hover, .cmdpal-item.active { background: var(--accent-soft); color: var(--accent-text); }

/* ---- Login screen ---- */
.login-page {
  min-height: 100vh;
  background: var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  width: 400px;
  max-width: 100%;
  padding: 36px;
  animation: popIn .2s;
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.login-logo-icon {
  width: 36px;
  height: 36px;
  background: var(--accent);
  border-radius: var(--r-sm);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
}

.login-logo-name { font-weight: 700; font-size: 20px; letter-spacing: -.02em; }
.login-logo-sub  { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: .04em; margin-top: 2px; }
.login-title     { font-size: 18px; font-weight: 600; margin-bottom: 22px; }


/* ---- View header ---- */
.view-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.view-header-title { font-size: 16px; font-weight: 600; }
.view-header-sub   { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }

/* ---- Filter bar ---- */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  flex-wrap: wrap;
}

.filter-input {
  height: 34px;
  padding: 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color .15s;
}
.filter-input:focus { border-color: var(--accent); }

.filter-select {
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%2374828A' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  outline: none;
}
.filter-select:focus { border-color: var(--accent); }

.filter-spacer { flex: 1; }

/* ---- Empty state ---- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 24px;
  color: var(--text-3);
  text-align: center;
}
.empty-state-icon { margin-bottom: 14px; color: var(--border-strong); }
.empty-state-title { font-size: 16px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-state-sub   { font-size: 13.5px; }

/* ---- Loading ---- */
.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.loading-row {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
  color: var(--text-3);
  gap: 12px;
}

/* ---- Duplicate warning ---- */
.dup-warning {
  background: var(--st-amber-bg);
  border: 1px solid var(--st-amber-dot);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 12px;
}
.dup-warning-text { font-size: 13px; color: var(--st-amber-tx); }
.dup-warning-label { font-weight: 600; margin-bottom: 2px; }

/* ---- Calendar ---- */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
}

.cal-day-header {
  background: var(--surface-2);
  padding: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-3);
}

.cal-day {
  background: var(--surface);
  min-height: 100px;
  padding: 6px;
  position: relative;
  transition: background .1s;
}
.cal-day:hover { background: var(--surface-2); }
.cal-day.other-month { background: var(--surface-3); }
.cal-day.today { background: var(--accent-soft); }
.cal-day-num {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 4px;
}
.cal-day.today .cal-day-num {
  color: var(--accent);
  background: var(--accent);
  color: #fff;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-event {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  cursor: pointer;
}
.cal-event.teal   { background: var(--st-teal-bg); color: var(--st-teal-tx); }
.cal-event.amber  { background: var(--st-amber-bg); color: var(--st-amber-tx); }
.cal-event.red    { background: var(--st-red-bg); color: var(--st-red-tx); }
.cal-event.purple { background: var(--st-purple-bg); color: var(--st-purple-tx); }
.cal-event.gray   { background: var(--st-gray-bg); color: var(--st-gray-tx); }

/* ---- Cold calling ---- */
.call-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  padding: 32px;
  max-width: 600px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
  animation: popIn .2s;
}

.call-company {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -.02em;
  margin-bottom: 4px;
}

.call-owner {
  font-size: 14px;
  color: var(--text-3);
  margin-bottom: 20px;
}

.call-phone {
  font-size: 28px;
  font-weight: 700;
  font-family: var(--font-mono);
  letter-spacing: .02em;
  color: var(--accent);
  margin-bottom: 24px;
}

.call-outcomes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.call-outcome-btn {
  padding: 12px;
  border-radius: var(--r-sm);
  border: 2px solid var(--border);
  background: var(--surface);
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
  transition: background .12s, border-color .12s, color .12s;
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: center;
}
.call-outcome-btn:hover { border-color: var(--accent); color: var(--accent); }
.call-outcome-btn.interested { border-color: var(--st-teal-dot); background: var(--st-teal-bg); color: var(--st-teal-tx); }
.call-outcome-btn.callback   { border-color: var(--st-blue-dot); background: var(--st-blue-bg); color: var(--st-blue-tx); }
.call-outcome-btn.not-int    { border-color: var(--st-red-dot); background: var(--st-red-bg); color: var(--st-red-tx); }
.call-outcome-btn.no-answer  { border-color: var(--st-amber-dot); background: var(--st-amber-bg); color: var(--st-amber-tx); }
.call-outcome-btn.wrong-num  { border-color: var(--st-gray-dot); background: var(--st-gray-bg); color: var(--st-gray-tx); }

/* ---- Stats charts ---- */
.bar-chart {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.bar-label {
  width: 160px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  text-align: right;
  flex-shrink: 0;
}

.bar-track {
  flex: 1;
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 4px;
  background: var(--accent);
  transition: width .5s ease;
}

.bar-value {
  width: 50px;
  font-size: 12.5px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

/* ---- Mailing ---- */
.email-preview {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  overflow: hidden;
  background: var(--surface);
}

.email-preview-toolbar {
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
}

.email-preview-body {
  padding: 24px;
  font-size: 14px;
  line-height: 1.6;
  min-height: 200px;
}

/* ---- Segment builder ---- */
.segment-rule {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: var(--surface-2);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
}

/* ---- Progress bar ---- */
.progress-bar {
  height: 6px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent);
}

/* ---- Tooltip ---- */
[data-tooltip] {
  position: relative;
}
[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--surface);
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: var(--r-xs);
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
}

/* ---- Priority indicators ---- */
.priority-high   { color: var(--st-red-dot); }
.priority-medium { color: var(--st-amber-dot); }
.priority-low    { color: var(--st-gray-dot); }

/* ---- User popover ---- */
.user-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 300px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-pop);
  z-index: 500;
  overflow: hidden;
  animation: popIn .15s;
}

/* ---- Section titles ---- */
.section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-3);
  margin-bottom: 12px;
}

/* ---- Tag ---- */
.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11.5px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-2);
}

/* ---- Responsive adjustments ---- */
@media (max-width: 900px) {
  #sidebar { display: none; }
  .drawer { width: 100%; max-width: 100%; }
}

/* ---- Focus ring utility ---- */
.fr:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
