/* ============================================
   SaaS Dashboard — Refined Utilitarian
   Typography: IBM Plex Sans + DM Serif Display
   Palette: Warm neutrals + deep teal accent
   ============================================ */

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

/* --- CSS Variables --- */
:root {
  /* Neutrals — warm stone */
  --bg-primary: #faf9f7;
  --bg-secondary: #f3f1ed;
  --bg-tertiary: #eae7e0;
  --bg-card: #ffffff;
  --bg-sidebar: #1c1917;
  --bg-sidebar-hover: #292524;
  --bg-sidebar-active: #362f2c;

  /* Text */
  --text-primary: #1c1917;
  --text-secondary: #57534e;
  --text-tertiary: #a8a29e;
  --text-inverse: #faf9f7;
  --text-sidebar: #d6d3d1;
  --text-sidebar-active: #ffffff;

  /* Accent — deep teal */
  --accent: #0d7377;
  --accent-hover: #0a5c5f;
  --accent-light: #e6f3f3;
  --accent-muted: #b2d8d8;

  /* Semantic */
  --success: #3d7a3d;
  --success-bg: #e8f5e8;
  --warning: #b27a1a;
  --warning-bg: #fef3d6;
  --danger: #b23a3a;
  --danger-bg: #fde8e8;
  --info: #2a6cb2;
  --info-bg: #e6f0fa;

  /* Borders */
  --border-light: #e7e5e4;
  --border-medium: #d6d3d1;
  --border-strong: #a8a29e;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 2px 8px rgba(28, 25, 23, 0.06);
  --shadow-lg: 0 4px 16px rgba(28, 25, 23, 0.08);
  --shadow-card: 0 1px 3px rgba(28, 25, 23, 0.04), 0 0 0 1px rgba(28, 25, 23, 0.03);

  /* Spacing */
  --space-xs: 4px;
  --space-sm: 8px;
  --space-md: 12px;
  --space-lg: 16px;
  --space-xl: 24px;
  --space-2xl: 32px;
  --space-3xl: 48px;

  /* Radii */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;

  /* Sidebar */
  --sidebar-width: 240px;

  /* Transitions */
  --transition-fast: 120ms ease;
  --transition-base: 200ms ease;
}

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

html {
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 400;
  color: var(--text-primary);
  background: var(--bg-primary);
  line-height: 1.5;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
}

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

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

img {
  display: block;
  max-width: 100%;
}

/* --- Typography --- */
h1, h2, h3 {
  font-family: 'DM Serif Display', serif;
  font-weight: 400;
  line-height: 1.2;
}

h1 { font-size: 1.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }

.label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}

.caption {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

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

/* --- Sidebar --- */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  padding: var(--space-xl) var(--space-xl) var(--space-lg);
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.sidebar-brand-icon {
  width: 32px;
  height: 32px;
  background: var(--accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  flex-shrink: 0;
}

.sidebar-brand-name {
  font-family: 'DM Serif Display', serif;
  font-size: 1.15rem;
  color: var(--text-inverse);
  letter-spacing: -0.01em;
}

.sidebar-section {
  padding: var(--space-sm) var(--space-md);
}

.sidebar-section-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-tertiary);
  padding: var(--space-lg) var(--space-md) var(--space-sm);
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  border-radius: var(--radius-md);
  color: var(--text-sidebar);
  font-size: 0.9rem;
  font-weight: 400;
  transition: all var(--transition-fast);
  text-decoration: none;
}

.sidebar-link:hover {
  background: var(--bg-sidebar-hover);
  color: var(--text-sidebar-active);
}

.sidebar-link.active {
  background: var(--bg-sidebar-active);
  color: var(--text-sidebar-active);
  font-weight: 500;
}

.sidebar-link .icon {
  width: 18px;
  height: 18px;
  opacity: 0.7;
  flex-shrink: 0;
}

.sidebar-link.active .icon {
  opacity: 1;
}

.sidebar-link .badge {
  margin-left: auto;
  background: var(--accent);
  color: white;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 10px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  margin-top: auto;
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.sidebar-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 0.8rem;
  flex-shrink: 0;
}

.sidebar-user-info {
  min-width: 0;
}

.sidebar-user-name {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-inverse);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-role {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

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

/* --- Top Bar --- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-2xl);
  border-bottom: 1px solid var(--border-light);
  background: var(--bg-card);
  position: sticky;
  top: 0;
  z-index: 50;
  gap: var(--space-xl);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: var(--space-lg);
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.breadcrumb a:hover {
  color: var(--text-secondary);
}

.breadcrumb-sep {
  font-size: 0.75rem;
}

.breadcrumb-current {
  color: var(--text-primary);
  font-weight: 500;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: var(--space-sm) var(--space-md);
  width: 280px;
  transition: all var(--transition-base);
}

.topbar-search:focus-within {
  border-color: var(--accent);
  background: var(--bg-card);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.topbar-search input {
  border: none;
  background: none;
  outline: none;
  width: 100%;
  color: var(--text-primary);
}

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

.topbar-search .icon {
  width: 16px;
  height: 16px;
  color: var(--text-tertiary);
  flex-shrink: 0;
}

.topbar-search kbd {
  font-family: 'IBM Plex Sans', sans-serif;
  font-size: 0.7rem;
  background: var(--bg-card);
  border: 1px solid var(--border-medium);
  border-radius: 3px;
  padding: 0 4px;
  color: var(--text-tertiary);
  line-height: 1.6;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.topbar-icon-btn {
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  position: relative;
  transition: all var(--transition-fast);
}

.topbar-icon-btn:hover {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

.topbar-icon-btn .icon {
  width: 18px;
  height: 18px;
}

.topbar-icon-btn .notification-dot {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 7px;
  height: 7px;
  background: var(--danger);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

/* --- Page Container --- */
.page {
  padding: var(--space-2xl);
  flex: 1;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: var(--space-2xl);
  gap: var(--space-xl);
}

.page-header-left h1 {
  margin-bottom: var(--space-xs);
}

.page-header-left p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-shrink: 0;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-sm);
  padding: var(--space-sm) var(--space-lg);
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all var(--transition-fast);
  white-space: nowrap;
  border: 1px solid transparent;
}

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

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

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

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

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

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

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

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover {
  background: #9a3030;
}

.btn-sm {
  padding: var(--space-xs) var(--space-md);
  font-size: 0.8rem;
}

/* --- Cards --- */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
}

.card-body {
  padding: var(--space-xl);
}

.card-body-flush {
  padding: 0;
}

/* --- Stat Cards --- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
  margin-bottom: var(--space-2xl);
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-xl);
  box-shadow: var(--shadow-card);
}

.stat-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-md);
}

.stat-card-label {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
}

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

.stat-card-icon .icon {
  width: 18px;
  height: 18px;
}

.stat-card-icon.teal {
  background: var(--accent-light);
  color: var(--accent);
}

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

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

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

.stat-card-value {
  font-size: 1.6rem;
  font-weight: 700;
  font-family: 'IBM Plex Sans', sans-serif;
  line-height: 1.1;
  margin-bottom: var(--space-xs);
}

.stat-card-change {
  font-size: 0.78rem;
  display: flex;
  align-items: center;
  gap: 3px;
}

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

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

.stat-card-change .icon {
  width: 14px;
  height: 14px;
}

/* --- Tables --- */
.table-wrapper {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  font-size: 0.85rem;
}

.data-table th {
  text-align: left;
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-tertiary);
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border-light);
  white-space: nowrap;
}

.data-table td {
  padding: var(--space-md) var(--space-xl);
  border-bottom: 1px solid var(--border-light);
  color: var(--text-primary);
  vertical-align: middle;
}

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

.data-table tbody tr:hover {
  background: var(--bg-secondary);
}

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

/* --- Badges / Tags --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}

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

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

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

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

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

.badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-success .badge-dot { background: var(--success); }
.badge-warning .badge-dot { background: var(--warning); }
.badge-danger .badge-dot { background: var(--danger); }
.badge-info .badge-dot { background: var(--info); }

/* --- Priority --- */
.priority {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
}

.priority-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.priority-critical .priority-dot { background: var(--danger); }
.priority-high .priority-dot { background: #d97706; }
.priority-medium .priority-dot { background: var(--warning); }
.priority-low .priority-dot { background: var(--text-tertiary); }

/* --- Progress Bars --- */
.progress-bar {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
  width: 100%;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

.progress-bar-fill.teal { background: var(--accent); }
.progress-bar-fill.green { background: var(--success); }
.progress-bar-fill.amber { background: var(--warning); }
.progress-bar-fill.red { background: var(--danger); }
.progress-bar-fill.blue { background: var(--info); }

/* --- Avatar Stack --- */
.avatar-stack {
  display: flex;
}

.avatar-stack .avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--bg-card);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  font-weight: 600;
  color: white;
  margin-left: -6px;
  position: relative;
}

.avatar-stack .avatar:first-child {
  margin-left: 0;
}

/* Avatar colors */
.avatar.av-1 { background: var(--accent); }
.avatar.av-2 { background: #6366f1; }
.avatar.av-3 { background: #d97706; }
.avatar.av-4 { background: #059669; }
.avatar.av-5 { background: #dc2626; }
.avatar.av-6 { background: #7c3aed; }
.avatar.av-7 { background: #0284c7; }

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--border-light);
  margin-bottom: var(--space-xl);
}

.tab {
  padding: var(--space-md) var(--space-lg);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-tertiary);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all var(--transition-fast);
  cursor: pointer;
}

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

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

.tab .tab-count {
  font-size: 0.75rem;
  background: var(--bg-secondary);
  padding: 0 6px;
  border-radius: 8px;
  margin-left: 4px;
  color: var(--text-tertiary);
}

.tab.active .tab-count {
  background: var(--accent-light);
  color: var(--accent);
}

/* --- Grid Layouts --- */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: var(--space-lg);
}

.grid-main-aside {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: var(--space-xl);
}

/* --- Chart Placeholder --- */
.chart-area {
  position: relative;
}

.chart-canvas {
  width: 100%;
  height: 200px;
  display: flex;
  align-items: flex-end;
  gap: 2px;
  padding-top: var(--space-lg);
}

.chart-bar-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-xs);
}

.chart-bar {
  width: 100%;
  max-width: 32px;
  border-radius: 3px 3px 0 0;
  transition: all var(--transition-base);
}

.chart-bar.teal {
  background: var(--accent);
}

.chart-bar.light {
  background: var(--accent-muted);
}

.chart-bar:hover {
  opacity: 0.8;
}

.chart-label {
  font-size: 0.65rem;
  color: var(--text-tertiary);
  text-align: center;
}

.chart-y-axis {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 30px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding-right: var(--space-sm);
}

.chart-y-label {
  font-size: 0.65rem;
  color: var(--text-tertiary);
}

/* --- Sparkline --- */
.sparkline {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 32px;
}

.sparkline-bar {
  width: 4px;
  border-radius: 2px;
  background: var(--accent-muted);
  transition: background var(--transition-fast);
}

.sparkline:hover .sparkline-bar {
  background: var(--accent);
}

/* --- Activity Feed --- */
.activity-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-md) 0;
}

.activity-item + .activity-item {
  border-top: 1px solid var(--border-light);
}

.activity-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
}

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

.activity-text {
  font-size: 0.85rem;
  line-height: 1.4;
}

.activity-text strong {
  font-weight: 600;
}

.activity-time {
  font-size: 0.75rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

/* --- Forms --- */
.form-group {
  margin-bottom: var(--space-xl);
}

.form-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: var(--space-sm);
}

.form-hint {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: var(--space-xs);
}

.form-input {
  width: 100%;
  padding: var(--space-sm) var(--space-md);
  border: 1px solid var(--border-medium);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  color: var(--text-primary);
  transition: all var(--transition-base);
  outline: none;
}

.form-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}

.form-input:disabled {
  background: var(--bg-secondary);
  color: var(--text-tertiary);
  cursor: not-allowed;
}

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

.form-select {
  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='%2357534e' 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 10px center;
  padding-right: 32px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

/* Toggle Switch */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
}

.toggle-row + .toggle-row {
  border-top: 1px solid var(--border-light);
}

.toggle-label {
  font-size: 0.85rem;
  font-weight: 500;
}

.toggle-desc {
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: 2px;
}

.toggle {
  position: relative;
  width: 36px;
  height: 20px;
  flex-shrink: 0;
}

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

.toggle-track {
  position: absolute;
  inset: 0;
  background: var(--border-medium);
  border-radius: 10px;
  transition: background var(--transition-base);
  cursor: pointer;
}

.toggle-track::after {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: white;
  top: 2px;
  left: 2px;
  transition: transform var(--transition-base);
  box-shadow: var(--shadow-sm);
}

.toggle input:checked + .toggle-track {
  background: var(--accent);
}

.toggle input:checked + .toggle-track::after {
  transform: translateX(16px);
}

/* --- Pagination --- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-lg) var(--space-xl);
  border-top: 1px solid var(--border-light);
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 2px;
}

.pagination-btn {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-secondary);
  transition: all var(--transition-fast);
}

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

.pagination-btn.active {
  background: var(--accent);
  color: white;
}

.pagination-btn .icon {
  width: 16px;
  height: 16px;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--space-3xl);
  color: var(--text-tertiary);
}

.empty-state .icon {
  width: 40px;
  height: 40px;
  margin: 0 auto var(--space-lg);
  opacity: 0.4;
}

.empty-state h3 {
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin-bottom: var(--space-sm);
}

.empty-state p {
  font-size: 0.85rem;
  max-width: 300px;
  margin: 0 auto var(--space-lg);
}

/* --- Footer --- */
.site-footer {
  padding: var(--space-xl) var(--space-2xl);
  border-top: 1px solid var(--border-light);
  text-align: center;
  font-size: 0.78rem;
  color: var(--text-tertiary);
  margin-top: auto;
}

.site-footer a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.site-footer a:hover {
  color: var(--accent-hover);
}

/* --- Misc utilities --- */
.text-truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.flex-center {
  display: flex;
  align-items: center;
}

.gap-sm { gap: var(--space-sm); }
.gap-md { gap: var(--space-md); }

.mt-lg { margin-top: var(--space-lg); }
.mt-xl { margin-top: var(--space-xl); }
.mb-lg { margin-bottom: var(--space-lg); }
.mb-xl { margin-bottom: var(--space-xl); }

/* --- Kanban Board --- */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-lg);
}

.kanban-column {
  min-width: 0;
}

.kanban-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  margin-bottom: var(--space-md);
}

.kanban-column-title {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.kanban-column-count {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-tertiary);
  font-size: 0.7rem;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
}

.kanban-card {
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  margin-bottom: var(--space-sm);
  box-shadow: var(--shadow-card);
  cursor: grab;
  transition: all var(--transition-base);
}

.kanban-card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--border-medium);
}

.kanban-card-title {
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: var(--space-sm);
  line-height: 1.3;
}

.kanban-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-md);
}

.kanban-card-id {
  font-size: 0.72rem;
  color: var(--text-tertiary);
  font-family: 'IBM Plex Sans', sans-serif;
  font-weight: 500;
}

/* --- Donut Chart --- */
.donut-chart {
  position: relative;
  width: 120px;
  height: 120px;
}

.donut-chart svg {
  transform: rotate(-90deg);
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.donut-value {
  font-size: 1.3rem;
  font-weight: 700;
}

.donut-label {
  font-size: 0.7rem;
  color: var(--text-tertiary);
}

/* --- List items --- */
.list-item {
  display: flex;
  align-items: center;
  gap: var(--space-md);
  padding: var(--space-md) var(--space-xl);
  transition: background var(--transition-fast);
}

.list-item:hover {
  background: var(--bg-secondary);
}

.list-item + .list-item {
  border-top: 1px solid var(--border-light);
}

/* --- Notification List --- */
.notification-item {
  display: flex;
  gap: var(--space-md);
  padding: var(--space-lg) var(--space-xl);
  border-bottom: 1px solid var(--border-light);
  transition: background var(--transition-fast);
}

.notification-item:hover {
  background: var(--bg-secondary);
}

.notification-item.unread {
  background: var(--accent-light);
}

.notification-item.unread:hover {
  background: #d4ecec;
}

/* --- Settings sections --- */
.settings-section {
  margin-bottom: var(--space-3xl);
}

.settings-section-header {
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid var(--border-light);
}

.settings-section-header h2 {
  margin-bottom: var(--space-xs);
}

.settings-section-header p {
  color: var(--text-secondary);
  font-size: 0.85rem;
}

/* --- Mini Bar Graph (for table cells) --- */
.mini-bar-container {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.mini-bar {
  width: 80px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.mini-bar-fill {
  height: 100%;
  border-radius: 2px;
}

/* --- Tag chips --- */
.tag-chips {
  display: flex;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.tag-chip {
  padding: 1px 8px;
  background: var(--bg-secondary);
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  color: var(--text-secondary);
  font-weight: 500;
}

/* --- Animations --- */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

.fade-in-delay-1 { animation-delay: 0.05s; opacity: 0; }
.fade-in-delay-2 { animation-delay: 0.1s; opacity: 0; }
.fade-in-delay-3 { animation-delay: 0.15s; opacity: 0; }
.fade-in-delay-4 { animation-delay: 0.2s; opacity: 0; }
.fade-in-delay-5 { animation-delay: 0.25s; opacity: 0; }
.fade-in-delay-6 { animation-delay: 0.3s; opacity: 0; }

/* --- Member row --- */
.member-row {
  display: flex;
  align-items: center;
  gap: var(--space-md);
}

.member-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.member-info {
  min-width: 0;
}

.member-name {
  font-weight: 500;
  font-size: 0.85rem;
}

.member-email {
  font-size: 0.75rem;
  color: var(--text-tertiary);
}

/* --- Inline donut legends --- */
.donut-legend {
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.donut-legend-item {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  font-size: 0.8rem;
}

.donut-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}

.donut-legend-value {
  margin-left: auto;
  font-weight: 600;
  font-size: 0.8rem;
}

/* --- Responsive --- */
@media (max-width: 1200px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  .grid-main-aside {
    grid-template-columns: 1fr;
  }
  .kanban-board {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .sidebar {
    display: none;
  }
  .main-content {
    margin-left: 0;
  }
  .stats-grid {
    grid-template-columns: 1fr;
  }
  .kanban-board {
    grid-template-columns: 1fr;
  }
  .form-row {
    grid-template-columns: 1fr;
  }
}
