:root {
  color-scheme: dark;
  --bg-primary: #0D0F12;
  --bg-secondary: #14171C;
  --bg-card: #1B1F25;
  --bg-card-hover: #222730;
  --accent: #FF8A00;
  --accent-hover: #E67A00;
  --accent-light: rgba(255, 138, 0, 0.12);
  --text-primary: #F5F5F5;
  --text-secondary: #9CA3AF;
  --text-muted: #6B7280;
  --border-color: #2B3038;
  --border-subtle: #1F242C;
  --success: #22C55E;
  --success-bg: rgba(34, 197, 94, 0.12);
  --warning: #F59E0B;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --error: #EF4444;
  --error-bg: rgba(239, 68, 68, 0.12);
  --info: #3B82F6;
  --info-bg: rgba(59, 130, 246, 0.12);
  --sidebar-width: 260px;
  --topbar-height: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-full: 9999px;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.4);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4), 0 2px 4px -2px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5), 0 4px 6px -4px rgba(0, 0, 0, 0.5);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  color-scheme: light;
  --bg-primary: #F8FAFC;
  --bg-secondary: #FFFFFF;
  --bg-card: #FFFFFF;
  --bg-card-hover: #F1F5F9;
  --accent: #FF8A00;
  --accent-hover: #E67A00;
  --accent-light: rgba(255, 138, 0, 0.12);
  --text-primary: #0F172A;
  --text-secondary: #475569;
  --text-muted: #94A3B8;
  --border-color: #E2E8F0;
  --border-subtle: #F1F5F9;
  --shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.08);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

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

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  background-color: var(--bg-primary);
  color: var(--text-primary);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a {
  color: inherit;
  text-decoration: none;
  transition: var(--transition);
}

button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

.app-wrapper {
  display: flex;
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.sidebar {
  width: var(--sidebar-width);
  background-color: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 50;
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar-header {
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  border-bottom: 1px solid var(--border-color);
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo-img {
  height: 32px;
  width: auto;
  object-fit: contain;
}

.brand-title-wrap {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.brand-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--accent);
  letter-spacing: 0.05em;
}

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

.nav-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  padding: 12px 12px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-weight: 500;
  font-size: 13.5px;
  transition: var(--transition);
  position: relative;
}

.nav-item:hover {
  background-color: var(--bg-card);
  color: var(--text-primary);
}

.nav-item.active {
  background-color: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 6px;
  bottom: 6px;
  width: 3px;
  background-color: var(--accent);
  border-radius: 0 4px 4px 0;
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background-color: var(--accent);
  color: #0D0F12;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.user-profile-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  overflow: hidden;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-full);
  background-color: var(--accent);
  color: #0D0F12;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.user-display-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-role-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  width: calc(100% - var(--sidebar-width));
}

.topbar {
  height: var(--topbar-height);
  background-color: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.menu-toggle-btn {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-primary);
  padding: 6px;
  border-radius: var(--radius-sm);
}

.topbar-org-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.topbar-org-dot {
  width: 7px;
  height: 7px;
  border-radius: var(--radius-full);
  background-color: var(--success);
}

.icon-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: var(--transition);
  position: relative;
}

.icon-btn:hover {
  background: var(--bg-card-hover);
  color: var(--text-primary);
  border-color: var(--text-muted);
}

.badge-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 8px;
  height: 8px;
  background-color: var(--accent);
  border-radius: var(--radius-full);
  border: 2px solid var(--bg-card);
}

.page-body {
  flex: 1;
  padding: 28px;
  max-width: 1440px;
  width: 100%;
  margin: 0 auto;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 16px;
}

.page-header-text h1 {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.page-header-text p {
  color: var(--text-secondary);
  font-size: 13.5px;
  margin-top: 4px;
}

.page-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-group {
  display: inline-flex;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 2px;
}

.filter-btn {
  background: transparent;
  border: none;
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

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

.filter-btn.active {
  background-color: var(--bg-card);
  color: var(--accent);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.grid-metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.metric-card:hover {
  border-color: var(--accent);
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}

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

.metric-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-secondary);
}

.metric-icon-wrap {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background-color: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
}

.metric-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.metric-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11.5px;
  color: var(--text-muted);
}

.metric-trend {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}

.metric-trend.positive {
  color: var(--success);
  background-color: var(--success-bg);
}

.metric-trend.negative {
  color: var(--error);
  background-color: var(--error-bg);
}

.panel-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
  overflow: hidden;
}

.panel-header {
  padding: 18px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-body {
  padding: 24px;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.custom-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
}

.custom-table th {
  padding: 12px 18px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-color);
  background-color: var(--bg-secondary);
}

.custom-table td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--text-primary);
  font-size: 13.5px;
  vertical-align: middle;
}

.custom-table tr:hover td {
  background-color: var(--bg-card-hover);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--radius-full);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.2;
}

.badge-success {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.2);
}

.badge-warning {
  background-color: var(--warning-bg);
  color: var(--warning);
  border: 1px solid rgba(245, 158, 11, 0.2);
}

.badge-error {
  background-color: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-info {
  background-color: var(--info-bg);
  color: var(--info);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.badge-neutral {
  background-color: var(--bg-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border-color);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 18px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: var(--transition);
  white-space: nowrap;
}

.btn-primary {
  background-color: var(--accent);
  color: #0D0F12;
}

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

.btn-secondary {
  background-color: var(--bg-card);
  border-color: var(--border-color);
  color: var(--text-primary);
}

.btn-secondary:hover {
  background-color: var(--bg-card-hover);
  border-color: var(--text-muted);
}

.btn-outline-danger {
  background-color: transparent;
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--error);
}

.btn-outline-danger:hover {
  background-color: var(--error-bg);
  border-color: var(--error);
}

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

.form-group {
  margin-bottom: 18px;
}

.form-label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 6px;
}

.form-control {
  width: 100%;
  padding: 10px 14px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
  transition: var(--transition);
}

select.form-control {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  color-scheme: dark;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239CA3AF' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 14px 14px;
  padding-right: 36px;
  cursor: pointer;
}

[data-theme="light"] select.form-control {
  color-scheme: light;
}

select.form-control option {
  background-color: var(--bg-card);
  color: var(--text-primary);
  padding: 8px 12px;
}

.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

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

textarea.form-control {
  min-height: 100px;
  resize: vertical;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 20px;
}

.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.alert-success {
  background-color: var(--success-bg);
  color: var(--success);
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.alert-error {
  background-color: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.empty-state {
  text-align: center;
  padding: 48px 24px;
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--text-muted);
}

.empty-state-text {
  font-size: 14px;
  color: var(--text-muted);
  max-width: 400px;
  margin: 0 auto;
}

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  background-color: var(--bg-primary);
}

.auth-panel-form {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}

.auth-box {
  width: 100%;
  max-width: 420px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-top: 3px solid var(--accent);
  border-radius: var(--radius-lg);
  padding: 36px 32px;
  box-shadow: 0 20px 40px -15px rgba(0, 0, 0, 0.7);
}

.auth-panel-branding {
  flex: 1;
  background: radial-gradient(circle at 70% 30%, rgba(255, 138, 0, 0.08) 0%, transparent 60%), linear-gradient(135deg, #14171C 0%, #0D0F12 100%);
  border-left: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 40px 32px;
  position: relative;
  overflow: hidden;
}

.auth-branding-content {
  width: 100%;
  max-width: 420px;
  z-index: 2;
}

.auth-branding-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  line-height: 1.3;
  margin-bottom: 10px;
}

.auth-branding-desc {
  font-size: 13.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.auth-features-list {
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-feature-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-md);
  transition: var(--transition);
}

.auth-feature-item:hover {
  background: rgba(255, 138, 0, 0.04);
  border-color: rgba(255, 138, 0, 0.2);
}

.auth-feature-bullet {
  width: 28px;
  height: 28px;
  border-radius: var(--radius-sm);
  background-color: var(--accent-light);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  width: 320px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  padding: 8px 0;
  z-index: 100;
  display: none;
}

.dropdown-menu.show {
  display: block;
}

.dropdown-header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-color);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dropdown-item {
  padding: 10px 16px;
  display: flex;
  flex-direction: column;
  gap: 3px;
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition);
}

.dropdown-item:hover {
  background-color: var(--bg-card-hover);
}

.dropdown-item-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.dropdown-item-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.6);
  z-index: 45;
  backdrop-filter: blur(2px);
}

.services-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.service-tag {
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.service-tag.active {
  border-color: var(--accent);
  color: var(--accent);
  background-color: var(--accent-light);
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.chat-bubble {
  max-width: 80%;
  padding: 14px 18px;
  border-radius: var(--radius-md);
  font-size: 13.5px;
  line-height: 1.5;
}

.chat-bubble.admin {
  align-self: flex-start;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
}

.chat-bubble.client {
  align-self: flex-end;
  background-color: var(--accent-light);
  border: 1px solid rgba(255, 138, 0, 0.25);
  color: var(--text-primary);
}

.chat-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
}

.calendar-day-header {
  padding: 8px;
  text-align: center;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.calendar-cell {
  min-height: 110px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-date-num {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.calendar-post-badge {
  font-size: 11px;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  transition: var(--transition);
}

.calendar-post-badge:hover {
  border-color: var(--accent);
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }

  .main-content {
    margin-left: 0;
    width: 100%;
  }

  .menu-toggle-btn {
    display: inline-flex;
  }

  .grid-3 {
    grid-template-columns: 1fr;
  }

  .auth-panel-branding {
    display: none;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 0 16px;
  }

  .page-body {
    padding: 16px;
  }

  .grid-2 {
    grid-template-columns: 1fr;
  }

  .page-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .page-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .calendar-grid {
    grid-template-columns: 1fr;
  }
}

.custom-dropdown-container {
  position: relative;
  display: inline-block;
  user-select: none;
}

.custom-dropdown-native {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

.custom-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  min-height: 38px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.custom-dropdown-trigger:hover {
  background-color: var(--bg-card);
  border-color: var(--accent);
}

.custom-dropdown-trigger:focus-visible,
.custom-dropdown-container.open .custom-dropdown-trigger {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
  background-color: var(--bg-card);
}

.custom-dropdown-icon {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.custom-dropdown-label {
  max-width: 220px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: left;
}

.custom-dropdown-chevron {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  margin-left: auto;
}

.custom-dropdown-container.open .custom-dropdown-chevron {
  transform: rotate(180deg);
  color: var(--accent);
}

.custom-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 280px;
  max-width: 380px;
  width: max-content;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.7), 0 8px 10px -6px rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  pointer-events: none;
  transition: opacity 0.18s cubic-bezier(0.16, 1, 0.3, 1), transform 0.18s cubic-bezier(0.16, 1, 0.3, 1), visibility 0.18s;
  overflow: hidden;
}

.custom-dropdown-container.open .custom-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
  pointer-events: auto;
}

.custom-dropdown-search-wrapper {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.custom-dropdown-search-icon {
  width: 14px;
  height: 14px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.custom-dropdown-search {
  width: 100%;
  padding: 6px 8px;
  background-color: var(--bg-secondary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12.5px;
  outline: none;
  transition: var(--transition);
}

.custom-dropdown-search:focus {
  border-color: var(--accent);
}

.custom-dropdown-list {
  max-height: 250px;
  overflow-y: auto;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.custom-dropdown-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  outline: none;
}

.custom-dropdown-option:hover,
.custom-dropdown-option:focus-visible {
  background-color: var(--bg-card-hover);
  color: var(--accent);
}

.custom-dropdown-option.selected {
  background-color: var(--accent-light);
  color: var(--accent);
  font-weight: 600;
}

.custom-dropdown-option-icon {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.custom-dropdown-option.selected .custom-dropdown-option-icon {
  color: var(--accent);
}

.custom-dropdown-option-text {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.custom-dropdown-check {
  width: 14px;
  height: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
  margin-left: auto;
}

.btn:active {
  transform: scale(0.98);
}

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

.toast-message {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  color: var(--text-primary);
  font-size: 13px;
  max-width: 380px;
  animation: toastSlideIn 0.25s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast-message.toast-success {
  border-left: 4px solid var(--success);
}

.toast-message.toast-error {
  border-left: 4px solid var(--error);
}

.toast-message.toast-info {
  border-left: 4px solid var(--accent);
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-secondary);
}

::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--accent);
}

@media (max-width: 480px) {
  .custom-dropdown-label {
    max-width: 150px;
  }

  .custom-dropdown-menu {
    max-width: calc(100vw - 32px);
    width: calc(100vw - 32px);
    left: 0;
  }

  .filter-btn {
    padding: 6px 10px;
    font-size: 11.5px;
  }

  .metric-value {
    font-size: 22px;
  }

  .page-header-text h1 {
    font-size: 20px;
  }
}

@media (max-width: 360px) {
  .topbar {
    padding: 0 10px;
  }

  .page-body {
    padding: 12px;
  }

  .custom-dropdown-label {
    max-width: 120px;
  }

  .filter-group {
    width: 100%;
    justify-content: space-between;
  }

  .filter-btn {
    flex: 1;
    text-align: center;
    padding: 5px 6px;
    font-size: 11px;
  }
}

.badge-danger {
  background-color: var(--error-bg);
  color: var(--error);
  border: 1px solid rgba(239, 68, 68, 0.2);
}

.badge-muted {
  background-color: var(--bg-secondary);
  color: var(--text-muted);
  border: 1px solid var(--border-color);
}

.badge-count {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  background-color: var(--accent);
  color: #fff;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid var(--bg-card);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.notif-dropdown-box {
  width: 360px;
  max-width: calc(100vw - 32px);
  padding: 0;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.45);
  overflow: hidden;
  z-index: 100;
}

.notif-item {
  padding: 12px 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  border-bottom: 1px solid var(--border-subtle);
  transition: var(--transition);
  text-decoration: none;
  cursor: pointer;
}

.notif-item:hover {
  background-color: var(--bg-card-hover);
}

.notif-item.unread {
  background-color: rgba(255, 138, 0, 0.05);
}

.notif-item-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: var(--accent);
}

.notif-item.unread .notif-item-icon {
  background: rgba(255, 138, 0, 0.12);
  border-color: var(--accent);
}

.notif-item-content {
  flex: 1;
  min-width: 0;
}

.notif-item-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.notif-item-desc {
  font-size: 11.5px;
  color: var(--text-secondary);
  line-height: 1.4;
  margin-bottom: 4px;
}

.notif-item-time {
  font-size: 10.5px;
  color: var(--text-muted);
}

.notif-unread-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  margin-left: 6px;
}

.notif-card.notif-unread {
  border-left: 3px solid var(--accent);
  background: rgba(255, 138, 0, 0.03);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
}

.modal-backdrop.show {
  opacity: 1;
  visibility: visible;
}

.modal-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 580px;
  max-height: calc(100vh - 40px);
  display: flex;
  flex-direction: column;
  box-shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
  transform: translateY(16px);
  transition: transform 0.2s ease;
  overflow: hidden;
}

.modal-backdrop.show .modal-card {
  transform: translateY(0);
}

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

.modal-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  background-color: var(--bg-secondary);
}

.btn i, .btn svg, .nav-item i, .nav-item svg, .icon-btn i, .icon-btn svg {
  flex-shrink: 0;
}

.metric-value.updated {
  animation: metricPulse 0.4s ease-out;
}

@keyframes metricPulse {
  0% { opacity: 0.5; transform: translateY(-3px); }
  100% { opacity: 1; transform: translateY(0); }
}

.chat-bubble.newly-added {
  animation: bubbleFadeIn 0.25s ease-out;
}

@keyframes bubbleFadeIn {
  0% { opacity: 0; transform: translateY(8px); }
  100% { opacity: 1; transform: translateY(0); }
}

.sound-toggle-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 2px 4px;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.sound-toggle-btn:hover {
  color: var(--accent);
}

.sound-toggle-btn.sound-on {
  color: var(--accent);
}

.topbar-org-pill {
  max-width: 280px;
}

.topbar-org-pill span:not(.topbar-org-dot) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-secondary) 25%, var(--bg-card-hover) 50%, var(--bg-secondary) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

@media (max-width: 768px) {
  .topbar-org-pill {
    max-width: 170px;
    font-size: 11.5px;
    padding: 4px 10px;
  }
}

@media (max-width: 428px) {
  .topbar-org-pill {
    max-width: 130px;
  }
}

@media (max-width: 360px) {
  .topbar-org-pill {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 16px 20px;
  transition: var(--transition);
}

.kpi-card:hover {
  border-color: var(--border-hover);
}

svg[data-lucide], i[data-lucide] {
  vertical-align: middle;
  display: inline-block;
  flex-shrink: 0;
}

.table-responsive {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

@media (max-width: 480px) {
  .dropdown-menu {
    width: 290px;
    max-width: calc(100vw - 24px);
    right: -10px;
  }
  .notif-dropdown-box {
    width: 290px;
    max-width: calc(100vw - 24px);
  }
  .modal-backdrop {
    padding: 12px;
  }
  .modal-card {
    max-height: calc(100vh - 24px);
  }
  .modal-footer {
    flex-direction: column-reverse;
    gap: 8px;
  }
  .modal-footer .btn {
    width: 100%;
  }
}

@media (max-width: 375px) {
  .page-header h1 {
    font-size: 18px;
  }
  .kpi-card {
    padding: 12px 14px;
  }
  .kpi-value {
    font-size: 18px;
  }
}

@media (max-width: 320px) {
  .topbar {
    padding: 0 8px;
  }
  .page-body {
    padding: 12px 8px;
  }
}
