/* ============================================================
   AI Agent Admin Dashboard — Custom Styles
   Palette: Terracotta Sunset
   ============================================================ */

/* ----- CSS Variables ----- */
:root {
  --color-espresso: #4E2C23;
  --color-espresso-light: #6B3F33;
  --color-espresso-dark: #3A1F18;
  --color-burnt-peach: #E2725B;
  --color-burnt-peach-hover: #D06048;
  --color-burnt-peach-light: #FDE8E3;
  --color-soft-apricot: #FFDAB9;
  --color-soft-apricot-light: #FFF0E0;
  --color-bg: #FFF4EC;
  --color-bg-white: #FFFFFF;
  --color-text-primary: #4E2C23;
  --color-text-secondary: #7A5C53;
  --color-text-muted: #A08980;
  --color-border: #F0DDD0;
  --color-border-light: #F8EBE0;
  --color-success: #2D8B5E;
  --color-success-bg: #E8F5EE;
  --color-warning: #C7821A;
  --color-warning-bg: #FEF3E0;
  --color-danger: #D14343;
  --color-danger-bg: #FDE8E8;
  --color-info: #3B82C4;
  --color-info-bg: #E5F0FA;
  --color-purple: #7C3AED;
  --color-purple-bg: #F0E8FD;

  --sidebar-width: 260px;
  --sidebar-collapsed: 72px;
  --navbar-height: 64px;
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --shadow-sm: 0 1px 2px rgba(78, 44, 35, 0.04);
  --shadow-md: 0 4px 12px rgba(78, 44, 35, 0.06);
  --shadow-lg: 0 8px 24px rgba(78, 44, 35, 0.08);
  --shadow-xl: 0 12px 36px rgba(78, 44, 35, 0.10);
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 350ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* ----- Reset & Base ----- */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--color-bg);
  color: var(--color-text-primary);
  line-height: 1.6;
  overflow-x: hidden;
  min-height: 100vh;
}

/* ----- Scrollbar ----- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

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

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-muted);
}

/* ----- Layout ----- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ----- Sidebar ----- */
.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-espresso);
  color: #FFFFFF;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: width var(--transition-base), transform var(--transition-base);
  overflow: hidden;
}

.sidebar-collapsed .sidebar {
  width: var(--sidebar-collapsed);
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  min-height: var(--navbar-height);
}

.sidebar-brand-icon {
  width: 36px;
  height: 36px;
  background: var(--color-burnt-peach);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.sidebar-brand-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.3px;
  white-space: nowrap;
  opacity: 1;
  transition: opacity var(--transition-fast);
}

.sidebar-collapsed .sidebar-brand-text {
  opacity: 0;
  width: 0;
}

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

.sidebar-nav-section {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.35);
  padding: 16px 12px 6px;
  white-space: nowrap;
  overflow: hidden;
  transition: opacity var(--transition-fast);
}

.sidebar-nav-section::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.sidebar-collapsed .sidebar-nav-section {
  opacity: 0;
}

.sidebar-nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: rgba(255, 255, 255, 0.65);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition-fast);
  white-space: nowrap;
  position: relative;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.sidebar-nav-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #FFFFFF;
}

.sidebar-nav-item.active {
  background: rgba(226, 114, 91, 0.25);
  color: var(--color-burnt-peach);
  font-weight: 600;
}

.sidebar-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--color-burnt-peach);
  border-radius: 0 3px 3px 0;
}

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

.sidebar-nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.sidebar-nav-badge {
  margin-left: auto;
  background: var(--color-burnt-peach);
  color: #FFFFFF;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
  transition: opacity var(--transition-fast);
}

.sidebar-collapsed .sidebar-nav-badge {
  opacity: 0;
}

.sidebar-nav-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity var(--transition-fast);
}

.sidebar-collapsed .sidebar-nav-label {
  opacity: 0;
  width: 0;
}

.sidebar-nav-item.is-disabled {
  cursor: default;
  opacity: 0.48;
}

.sidebar-nav-item.is-disabled:hover {
  background: transparent;
  color: rgba(255, 255, 255, 0.65);
}

.sidebar-empty {
  padding: 20px 12px;
  color: rgba(255, 255, 255, 0.45);
  font-size: 12px;
  line-height: 1.5;
}

/* Sidebar Footer */
.sidebar-footer {
  padding: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.sidebar-user:hover {
  background: rgba(255, 255, 255, 0.08);
}

.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background: linear-gradient(135deg, var(--color-burnt-peach), var(--color-soft-apricot));
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: var(--color-espresso);
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
  transition: opacity var(--transition-fast);
}

.sidebar-collapsed .sidebar-user-info {
  opacity: 0;
  width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 600;
  color: #FFFFFF;
  line-height: 1.2;
}

.sidebar-user-role {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.2;
}

/* ----- Sidebar Toggle ----- */
.sidebar-toggle {
  position: fixed;
  bottom: 24px;
  left: calc(var(--sidebar-width) - 16px);
  width: 28px;
  height: 28px;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 110;
  transition: left var(--transition-base);
  box-shadow: var(--shadow-md);
  color: var(--color-text-secondary);
}

.sidebar-collapsed .sidebar-toggle {
  left: calc(var(--sidebar-collapsed) - 16px);
}

.sidebar-toggle:hover {
  box-shadow: var(--shadow-lg);
  color: var(--color-text-primary);
}

.sidebar-toggle svg {
  width: 14px;
  height: 14px;
  transition: transform var(--transition-base);
}

.sidebar-collapsed .sidebar-toggle svg {
  transform: rotate(180deg);
}

/* ----- Main Content ----- */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  transition: margin-left var(--transition-base);
}

.sidebar-collapsed .main-content {
  margin-left: var(--sidebar-collapsed);
}

/* ----- Top Navbar ----- */
.navbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--navbar-height);
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  gap: 16px;
}

.navbar-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.navbar-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--color-text-muted);
}

.navbar-breadcrumb span {
  color: var(--color-text-primary);
  font-weight: 600;
}

/* -- Search -- */
.search-wrapper {
  position: relative;
  width: 360px;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 16px 0 40px;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--color-text-primary);
  outline: none;
  transition: all var(--transition-fast);
  font-family: inherit;
}

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

.search-input:focus {
  border-color: var(--color-burnt-peach);
  box-shadow: 0 0 0 3px rgba(226, 114, 91, 0.1);
}

.search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--color-text-muted);
  pointer-events: none;
}

.search-shortcut {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--color-text-muted);
  background: var(--color-border-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 500;
  pointer-events: none;
}

/* -- Navbar Right -- */
.navbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.navbar-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
  position: relative;
}

.navbar-icon-btn:hover {
  background: var(--color-border-light);
  color: var(--color-text-primary);
}

.navbar-icon-btn .badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  background: var(--color-burnt-peach);
  border-radius: 9999px;
  border: 2px solid #FFFFFF;
}

.navbar-divider {
  width: 1px;
  height: 24px;
  background: var(--color-border);
  margin: 0 4px;
}

/* ----- Page Container ----- */
.page-container {
  padding: 24px;
  width: 100%;
}

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

.page-header-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.4px;
  color: var(--color-text-primary);
}

.page-header-subtitle {
  font-size: 14px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

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

/* ----- Buttons ----- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
  line-height: 1.4;
}

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

.btn-primary {
  background: var(--color-burnt-peach);
  color: #FFFFFF;
  border-color: var(--color-burnt-peach);
}

.btn-primary:hover {
  background: var(--color-burnt-peach-hover);
  border-color: var(--color-burnt-peach-hover);
  box-shadow: 0 4px 12px rgba(226, 114, 91, 0.3);
}

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

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

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
  border-color: transparent;
}

.btn-ghost:hover {
  background: var(--color-border-light);
  color: var(--color-text-primary);
}

.btn-danger {
  background: var(--color-danger);
  color: #FFFFFF;
  border-color: var(--color-danger);
}

.btn-danger:hover {
  background: #B83333;
  box-shadow: 0 4px 12px rgba(209, 67, 67, 0.3);
}

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

.btn-lg {
  padding: 12px 24px;
  font-size: 15px;
}

.btn-icon {
  width: 36px;
  height: 36px;
  padding: 0;
}

.btn svg {
  width: 16px;
  height: 16px;
}

/* ----- Cards ----- */
.card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
}

.card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border);
}

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

.card-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--color-text-primary);
  letter-spacing: -0.2px;
}

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

/* ----- Stat Cards ----- */
.stat-cards {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  transition: all var(--transition-base);
  cursor: pointer;
}

.stat-card:hover {
  box-shadow: var(--shadow-lg);
  border-color: var(--color-border);
  transform: translateY(-2px);
}

.stat-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.stat-card-icon.blue {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.stat-card-icon.green {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.stat-card-icon.orange {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.stat-card-icon.purple {
  background: var(--color-purple-bg);
  color: var(--color-purple);
}

.stat-card-value {
  font-size: 28px;
  font-weight: 700;
  letter-spacing: -0.5px;
  line-height: 1.2;
  color: var(--color-text-primary);
}

.stat-card-label {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.stat-card-change {
  font-size: 12px;
  font-weight: 600;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stat-card-change.up {
  color: var(--color-success);
}

.stat-card-change.down {
  color: var(--color-danger);
}

/* ----- Table ----- */
.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  background: var(--color-bg-white);
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table thead {
  background: var(--color-soft-apricot-light);
}

.table th {
  padding: 12px 16px;
  text-align: center;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-muted);
  white-space: nowrap;
  border-bottom: 1px solid var(--color-border-light);
}

.table td {
  padding: 14px 16px;
  text-align: left;
  border-bottom: 1px solid var(--color-border-light);
  color: var(--color-text-primary);
  vertical-align: middle;
}

.table .table-cell-center {
  text-align: center;
}

.table tbody tr {
  transition: background var(--transition-fast);
}

.table tbody tr:hover {
  background: var(--color-soft-apricot-light);
}

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

/* -- Status Badge -- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
}

.badge-success {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.badge-warning {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.badge-danger {
  background: var(--color-danger-bg);
  color: var(--color-danger);
}

.badge-info {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.badge-neutral {
  background: var(--color-border-light);
  color: var(--color-text-secondary);
}

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 9999px;
  background: currentColor;
}

/* -- Agent Avatar -- */
.agent-avatar {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
  color: #FFFFFF;
  flex-shrink: 0;
}

.agent-info {
  display: flex;
  align-items: center;
  gap: 10px;
}

.agent-name,
.record-name {
  font-weight: 600;
  color: var(--color-text-primary);
}

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

/* -- Action Menu -- */
.table-actions {
  display: flex;
  align-items: center;
  gap: 4px;
}

.table-action-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  color: var(--color-text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.table-action-btn:hover {
  background: var(--color-border-light);
  color: var(--color-text-primary);
}

/* ----- Charts Section ----- */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 24px;
}

.chart-placeholder {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  min-height: 250px;
  display: flex;
  flex-direction: column;
}

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

.chart-canvas-area {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-soft-apricot-light);
  border-radius: var(--radius-md);
  border: 2px dashed var(--color-border);
  color: var(--color-text-muted);
  font-size: 13px;
  min-height: 180px;
  position: relative;
  overflow: hidden;
}

/* Small variant — for doughnut / compact charts */
.chart-placeholder--small {
  min-height: 220px;
  padding: 16px 20px;
}

.chart-canvas-area--small {
  min-height: 150px;
}

/* -- Simple Bar Chart -- */
.bar-chart {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  height: 200px;
  padding: 0 8px;
  width: 100%;
}

.bar-chart-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.bar-chart-bar {
  width: 100%;
  max-width: 48px;
  background: linear-gradient(180deg, var(--color-burnt-peach), var(--color-soft-apricot));
  border-radius: var(--radius-sm) var(--radius-sm) 0 0;
  transition: height var(--transition-slow);
  position: relative;
  cursor: pointer;
}

.bar-chart-bar:hover {
  filter: brightness(1.1);
  box-shadow: 0 4px 12px rgba(226, 114, 91, 0.3);
}

.bar-chart-label {
  font-size: 11px;
  color: var(--color-text-muted);
  font-weight: 500;
}

/* -- Simple Line Chart (SVG) -- */
.line-chart-svg {
  width: 100%;
  height: 200px;
}

.line-chart-svg polyline {
  fill: none;
  stroke: var(--color-burnt-peach);
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-chart-svg .area {
  fill: url(#lineGradient);
}

/* ----- Activity Timeline ----- */
.timeline {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.timeline-item {
  display: flex;
  gap: 16px;
  padding: 14px 0;
  position: relative;
}

.timeline-item:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 16px;
  top: 40px;
  bottom: 0;
  width: 1px;
  background: var(--color-border);
}

.timeline-dot {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 14px;
  position: relative;
  z-index: 1;
}

.timeline-dot.blue {
  background: var(--color-info-bg);
  color: var(--color-info);
}

.timeline-dot.green {
  background: var(--color-success-bg);
  color: var(--color-success);
}

.timeline-dot.orange {
  background: var(--color-warning-bg);
  color: var(--color-warning);
}

.timeline-dot.purple {
  background: var(--color-purple-bg);
  color: var(--color-purple);
}

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

.timeline-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
  line-height: 1.3;
}

.timeline-desc {
  font-size: 13px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

.timeline-time {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ----- Tabs ----- */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--color-border-light);
  padding: 4px;
  border-radius: var(--radius-sm);
  width: fit-content;
}

.tab-item {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  font-family: inherit;
  white-space: nowrap;
}

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

.tab-item.active {
  background: var(--color-bg-white);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-sm);
  font-weight: 600;
}

/* ----- Settings ----- */
.settings-section {
  margin-bottom: 32px;
}

.settings-section-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 16px;
  color: var(--color-text-primary);
}

.settings-card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  gap: 16px;
}

.settings-row:not(:last-child) {
  border-bottom: 1px solid var(--color-border-light);
}

.settings-row-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--color-text-primary);
}

.settings-row-desc {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 2px;
}

/* ----- Logo / Favicon Preview ----- */
.logo-preview-box {
  width: 100px;
  height: 100px;
  border: 2px dashed var(--color-border-light);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--color-bg);
  flex-shrink: 0;
}

.logo-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.logo-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--color-text-muted);
}

.favicon-preview-box {
  width: 64px;
  height: 64px;
  border: 2px dashed var(--color-border-light);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: var(--color-bg);
  flex-shrink: 0;
}

.favicon-preview-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.favicon-preview-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font-size: 10px;
  color: var(--color-text-muted);
}

.form-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

/* ----- Toggle Switch ----- */
.toggle {
  position: relative;
  width: 44px;
  height: 24px;
  cursor: pointer;
}

.toggle input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--color-border);
  border-radius: 9999px;
  transition: background var(--transition-fast);
}

.toggle-slider::before {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: #FFFFFF;
  border-radius: 9999px;
  transition: transform var(--transition-fast);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked+.toggle-slider {
  background: var(--color-burnt-peach);
}

.toggle input:checked+.toggle-slider::before {
  transform: translateX(20px);
}

/* ----- Dropdown ----- */
.dropdown {
  position: relative;
  display: inline-block;
}

.dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 200px;
  background: var(--color-bg-white);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-xl);
  padding: 6px;
  z-index: 200;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: all var(--transition-fast);
}

.dropdown-menu.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  cursor: pointer;
  transition: background var(--transition-fast);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: inherit;
}

.dropdown-item:hover {
  background: var(--color-border-light);
}

.dropdown-item.danger {
  color: var(--color-danger);
}

.dropdown-divider {
  height: 1px;
  background: var(--color-border-light);
  margin: 4px 0;
}

/* ----- Modal ----- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(78, 44, 35, 0.4);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 40px 0;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
  overflow-y: auto;
}

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

.modal {
  background: var(--color-bg-white);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 90%;
  max-width: 520px;
  max-height: 85vh;
  overflow-y: auto;
  transform: translateY(20px);
  transition: transform var(--transition-base);
}

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

.modal-sm {
  max-width: 380px !important;
}

.modal-lg {
  max-width: 720px !important;
}

.modal-xl {
  max-width: 960px !important;
}

.modal-full {
  max-width: 95vw !important;
}

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

.modal-title {
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.2px;
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-border-light);
  color: var(--color-text-primary);
}

.modal-body {
  padding: 24px;
}

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

/* ----- Form Elements ----- */
.form-group {
  margin-bottom: 16px;
}

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

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px 14px;
  font-size: 14px;
  font-family: inherit;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  background: var(--color-bg-white);
  color: var(--color-text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.form-input::placeholder,
.form-textarea::placeholder {
  color: var(--color-text-muted);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  border-color: var(--color-burnt-peach);
  box-shadow: 0 0 0 3px rgba(226, 114, 91, 0.1);
}

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

.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23A08980' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'%3E%3C/path%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.form-hint {
  font-size: 12px;
  color: var(--color-text-muted);
  margin-top: 4px;
}

.form-error {
  color: var(--color-danger) !important;
  font-size: 12px;
  margin-top: 4px;
}

.form-input-error {
  border-color: var(--color-danger);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px 20px;
}

.form-card {
  width: 100%;
}

.form-group-switch {
  display: flex;
  flex-direction: column;
}

.check-control {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-sm);
  cursor: pointer;
}

.check-control input {
  width: 16px;
  height: 16px;
  accent-color: var(--color-burnt-peach);
}

.check-control span {
  display: flex;
  flex-direction: column;
  line-height: 1.3;
}

.check-control strong {
  font-size: 13px;
}

.check-control small {
  color: var(--color-text-muted);
  font-size: 11px;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 20px;
  margin-top: 4px;
  border-top: 1px solid var(--color-border-light);
}

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

.record-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  color: var(--color-burnt-peach);
  background: var(--color-burnt-peach-light);
}

.record-icon svg,
.table-action-btn svg {
  width: 16px;
  height: 16px;
}

.code-label {
  display: inline-block;
  max-width: 260px;
  padding: 3px 7px;
  overflow: hidden;
  border-radius: 5px;
  background: var(--color-border-light);
  color: var(--color-text-secondary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.table-action-danger:hover {
  color: var(--color-danger);
  background: var(--color-danger-bg);
}

/* ----- Empty State ----- */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  text-align: center;
}

.empty-state-icon {
  width: 64px;
  height: 64px;
  border-radius: 9999px;
  background: var(--color-border-light);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 16px;
  color: var(--color-text-muted);
}

.empty-state-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: 4px;
}

.empty-state-desc {
  font-size: 14px;
  color: var(--color-text-muted);
  max-width: 320px;
}

/* ----- Pagination ----- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0 0;
  font-size: 13px;
  color: var(--color-text-muted);
}

.pagination-buttons {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-white);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  color: var(--color-text-primary);
  transition: all var(--transition-fast);
  font-family: inherit;
}

.pagination-btn:hover:not(:disabled) {
  border-color: var(--color-burnt-peach);
  color: var(--color-burnt-peach);
}

.pagination-btn.active {
  background: var(--color-burnt-peach);
  border-color: var(--color-burnt-peach);
  color: #FFFFFF;
}

.pagination-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* ----- Progress Bar ----- */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--color-border-light);
  border-radius: 9999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--color-burnt-peach);
  border-radius: 9999px;
  transition: width var(--transition-slow);
}

/* ----- Toast ----- */
.toast-container {
  position: fixed;
  top: 24px;
  right: 24px;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 14px 20px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  gap: 10px;
  animation: slideInRight 0.3s ease-out;
  max-width: 380px;
}

.toast-success {
  background: var(--color-success-bg);
  color: var(--color-success);
  border: 1px solid #C8E6D4;
}

.toast-error {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border: 1px solid #F5C6C6;
}

.toast-info {
  background: var(--color-info-bg);
  color: var(--color-info);
  border: 1px solid #C8DCF0;
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }

  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

/* ----- Mobile Menu Button ----- */
.mobile-menu-btn {
  display: none;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg-white);
  cursor: pointer;
  align-items: center;
  justify-content: center;
  color: var(--color-text-primary);
}

/* ----- Page Sections Visibility ----- */
.page-section {
  display: none;
}

.page-section.active {
  display: block;
}

/* ----- Responsive ----- */
@media (max-width: 1200px) {
  .stat-cards {
    grid-template-columns: repeat(2, 1fr);
  }

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

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

  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width);
  }

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

  .sidebar-toggle {
    display: none;
  }

  .main-content {
    margin-left: 0 !important;
  }

  .mobile-menu-btn {
    display: flex;
  }

  .search-wrapper {
    display: none;
  }

  .stat-cards {
    grid-template-columns: 1fr;
  }

  .page-container {
    padding: 16px;
  }

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

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

  .navbar {
    padding: 0 16px;
  }

  .table th:nth-child(4),
  .table td:nth-child(4),
  .table th:nth-child(5),
  .table td:nth-child(5) {
    display: none;
  }
}

/* Mobile overlay */
.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(78, 44, 35, 0.4);
  z-index: 99;
  opacity: 0;
  visibility: hidden;
  transition: all var(--transition-base);
}

.sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* ----- Quick Action Grid ----- */
.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 24px;
}

.quick-action-card {
  background: var(--color-bg-white);
  border: 1px solid var(--color-border-light);
  border-radius: var(--radius-md);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: center;
  gap: 12px;
}

.quick-action-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-burnt-peach);
  transform: translateY(-1px);
}

.quick-action-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  background: var(--color-burnt-peach-light);
  color: var(--color-burnt-peach);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.quick-action-label {
  font-size: 14px;
  font-weight: 600;
  color: var(--color-text-primary);
}

.quick-action-desc {
  font-size: 12px;
  color: var(--color-text-muted);
}

@media (max-width: 768px) {
  .quick-actions {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 480px) {
  .quick-actions {
    grid-template-columns: 1fr;
  }
}