/* ============================================
   CallBook — Design System
   ============================================ */

/* --- CSS Custom Properties --- */
:root {
  /* Primary */
  --color-primary: #0f766e;
  --color-primary-hover: #0b5f59;
  --color-primary-light: #dbf1ef;
  --color-primary-50: rgba(15, 118, 110, 0.1);

  /* Semantic */
  --color-success: #1f8f55;
  --color-success-light: #ddf7e9;
  --color-warning: #b7791f;
  --color-warning-light: #fff1d6;
  --color-danger: #c24140;
  --color-danger-light: #fce6e6;
  --color-info: #0b3b66;
  --color-info-light: #deebf6;

  /* Surfaces */
  --color-bg: #eef4f7;
  --color-surface: #ffffff;
  --color-surface-hover: #f7fafc;
  --color-border: #d7e2e8;
  --color-border-light: #edf3f6;

  /* Text */
  --color-text: #12212b;
  --color-text-secondary: #627786;
  --color-text-tertiary: #8b9ca8;
  --color-text-inverse: #ffffff;

  /* Sidebar */
  --sidebar-w: 288px;
  --sidebar-w-collapsed: 84px;
  --sidebar-bg: #10232e;
  --sidebar-text: rgba(255,255,255,0.68);
  --sidebar-text-active: #ffffff;
  --sidebar-hover: rgba(255,255,255,0.1);
  --sidebar-active-bg: rgba(255,255,255,0.12);
  --sidebar-active-border: transparent;

  /* Typography */
  --font: "Manrope", "Inter", "Segoe UI", Roboto, sans-serif;
  --font-mono: "SF Mono", "IBM Plex Mono", Consolas, monospace;
  --text-xs: 11px;
  --text-sm: 13px;
  --text-base: 14px;
  --text-md: 15px;
  --text-lg: 18px;
  --text-xl: 22px;
  --text-2xl: 28px;

  /* Spacing */
  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 20px; --sp-6: 24px; --sp-8: 32px; --sp-10: 40px; --sp-12: 48px;

  /* Borders & Shadows */
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --radius-full: 9999px;
  --shadow-xs: 0 4px 12px rgba(18, 33, 43, 0.05);
  --shadow-sm: 0 12px 30px rgba(18, 33, 43, 0.08);
  --shadow-md: 0 18px 46px rgba(18, 33, 43, 0.12);
  --shadow-lg: 0 28px 60px rgba(18, 33, 43, 0.16);

  /* Transitions */
  --ease-fast: 150ms ease;
  --ease: 200ms ease;
  --ease-slow: 300ms ease;
}

/* --- Reset --- */
*, *::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: var(--font);
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.09), transparent 28%),
    radial-gradient(circle at top right, rgba(11, 59, 102, 0.1), transparent 24%),
    var(--color-bg);
  color: var(--color-text);
  min-height: 100vh;
  display: flex;
  line-height: 1.5;
}
a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* --- Layout: Sidebar + Content --- */
.app-layout { display: flex; min-height: 100vh; width: 100%; }

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  background:
    linear-gradient(180deg, rgba(11, 59, 102, 0.96), rgba(16, 35, 46, 0.98)),
    var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  transition: width var(--ease), transform var(--ease);
  overflow: hidden;
}
.sidebar.collapsed { width: var(--sidebar-w-collapsed); }

.sidebar-logo {
  height: 88px;
  display: flex;
  align-items: center;
  padding: 0 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.sidebar-logo .logo-text {
  font-size: 22px;
  font-weight: 700;
  color: rgba(255,255,255,0.92);
  letter-spacing: -0.04em;
  white-space: nowrap;
}
.sidebar-logo .logo-icon {
  width: 48px; height: 48px;
  flex-shrink: 0;
  padding: 10px;
  border-radius: 16px;
  background: linear-gradient(135deg, #16a394, #f3f6f8);
  stroke: #0a2a2e;
}
.sidebar.collapsed .logo-text { display: none; }

.sidebar-nav {
  flex: 1;
  padding: 20px 12px;
  overflow-y: auto;
}
.sidebar-group-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.36);
  padding: 10px 12px 8px;
  white-space: nowrap;
}
.sidebar.collapsed .sidebar-group-label { display: none; }

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  position: relative;
  overflow: hidden;
  padding: 0 14px;
  height: 46px;
  margin-bottom: 4px;
  color: var(--sidebar-text);
  font-size: var(--text-base);
  font-weight: 600;
  cursor: pointer;
  transition: all var(--ease-fast);
  border-left: 0;
  border-radius: 14px;
  text-decoration: none;
  white-space: nowrap;
}
.nav-item::before {
  content: "";
  position: absolute;
  left: 8px;
  top: 10px;
  bottom: 10px;
  width: 3px;
  border-radius: 999px;
  background: rgba(255,255,255,0.92);
  opacity: 0;
  transform: scaleY(0.6);
  transition: opacity var(--ease-fast), transform var(--ease-fast);
}
.nav-item:hover {
  background: var(--sidebar-hover);
  color: var(--sidebar-text-active);
  text-decoration: none;
  transform: translateX(2px);
}
.nav-item.active {
  background: var(--sidebar-active-bg);
  color: var(--sidebar-text-active);
  font-weight: 700;
}
.nav-item.active::before {
  opacity: 1;
  transform: scaleY(1);
}
.nav-item svg {
  width: 20px; height: 20px;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.nav-item .nav-label { white-space: nowrap; }
.sidebar.collapsed .nav-label { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 0; }

/* Sidebar User Section */
.sidebar-user {
  padding: 16px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.sidebar-user .team-selector { margin-bottom: var(--sp-2); }
.sidebar-user .team-selector select {
  width: 100%;
  padding: 10px 12px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.12);
  border-radius: 14px;
  color: var(--sidebar-text-active);
  font-size: var(--text-xs);
  cursor: pointer;
  outline: none;
}
.sidebar-user .team-selector select:hover { background: rgba(255,255,255,0.1); }
.sidebar-user .team-selector select:focus {
  border-color: rgba(255,255,255,0.12);
  box-shadow: none;
}
.sidebar-user .team-selector select option { background: var(--sidebar-bg); color: #fff; }
.sidebar-user .team-label {
  font-size: var(--text-xs);
  color: var(--sidebar-text);
  padding: 6px 0;
  margin-bottom: var(--sp-1);
}
.sidebar-user .user-info {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.sidebar-user .user-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255,255,255,0.14);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: 600;
  flex-shrink: 0;
}
.sidebar-user .user-details { flex: 1; min-width: 0; }
.sidebar-user .user-name {
  font-size: var(--text-sm);
  color: var(--sidebar-text-active);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user .user-role {
  font-size: var(--text-xs);
  color: var(--sidebar-text);
}
.sidebar-user .logout-btn {
  width: 28px;
  height: 28px;
  border: none;
  background: none;
  color: var(--sidebar-text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--ease-fast);
}
.sidebar-user .logout-btn:hover { background: rgba(255,255,255,0.1); color: var(--color-danger); }
.sidebar-user .logout-btn svg { stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sidebar.collapsed .sidebar-user .user-details,
.sidebar.collapsed .sidebar-user .team-selector,
.sidebar.collapsed .sidebar-user .team-label { display: none; }
.sidebar.collapsed .sidebar-user .user-info { justify-content: center; }
.sidebar.collapsed .sidebar-user .logout-btn { display: none; }

.sidebar-footer {
  padding: 16px 20px 20px;
  border-top: 1px solid rgba(255,255,255,0.08);
  flex-shrink: 0;
}
.sidebar-collapse-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  width: 100%;
  height: 40px;
  background: rgba(255,255,255,0.06);
  border: none;
  color: var(--sidebar-text);
  cursor: pointer;
  border-radius: var(--radius-sm);
  font-size: var(--text-sm);
  transition: all var(--ease-fast);
}
.sidebar-collapse-btn:hover { background: var(--sidebar-hover); color: var(--sidebar-text-active); }
.sidebar-collapse-btn svg { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.sidebar.collapsed .sidebar-collapse-btn .collapse-label { display: none; }

/* Main Content */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin-left var(--ease);
}
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-w-collapsed); }

.page-wrapper {
  max-width: 1440px;
  margin: 0 auto;
  padding: 30px 28px 56px;
}

/* Page Header */
.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  flex-wrap: wrap;
  gap: 18px;
}
.page-header h1 {
  font-size: clamp(2rem, 4vw, 2.7rem);
  line-height: 1.04;
  letter-spacing: -0.05em;
  font-weight: 800;
  color: var(--color-text);
}
.page-header-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}
.page-actions {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  flex-wrap: wrap;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  font-size: var(--text-sm);
  color: var(--color-text-tertiary);
  margin-bottom: var(--sp-2);
}
.breadcrumb a { color: var(--color-text-secondary); text-decoration: none; }
.breadcrumb a:hover { color: var(--color-primary); }
.breadcrumb .sep { color: var(--color-text-tertiary); }

/* --- Mobile hamburger --- */
.mobile-header {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0;
  height: 48px;
  background: var(--sidebar-bg);
  z-index: 99;
  align-items: center;
  padding: 0 var(--sp-4);
}
.hamburger-btn {
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  width: 36px; height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hamburger-btn svg { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.mobile-header .logo-text { font-size: var(--text-md); font-weight: 700; color: var(--color-primary); margin-left: var(--sp-3); }
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 99;
}

@media (max-width: 768px) {
  .mobile-header { display: flex; }
  .sidebar {
    transform: translateX(-100%);
    z-index: 200;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar-overlay.active { display: block; z-index: 150; }
  .main-content { margin-left: 0; padding-top: 48px; }
  .sidebar.collapsed ~ .main-content { margin-left: 0; }
  .page-wrapper { padding: var(--sp-4); }
  .page-header {
    align-items: stretch;
    gap: var(--sp-3);
    margin-bottom: var(--sp-5);
  }
  .page-header h1 {
    font-size: var(--text-lg);
  }
  .page-header-actions,
  .page-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .page-header-actions > *,
  .page-actions > * {
    max-width: 100%;
  }
}

/* --- Card --- */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(247,250,252,0.97));
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
  padding: 22px;
  margin-bottom: var(--sp-5);
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-4);
}
.card-title {
  font-size: var(--text-md);
  font-weight: 600;
  color: var(--color-text);
}
.card-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* KPI Card */
.kpi-card {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(255,255,255,0.97), rgba(247,250,252,0.97));
  border-radius: var(--radius-xl);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-xs);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.kpi-card::after {
  content: "";
  position: absolute;
  inset: auto -18px -42px auto;
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: rgba(15, 118, 110, 0.12);
}
.kpi-icon {
  width: 40px; height: 40px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--sp-2);
}
.kpi-icon svg { width: 20px; height: 20px; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; fill: none; }
.kpi-value {
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -0.05em;
}
.kpi-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-secondary);
}
.kpi-change {
  font-size: var(--text-xs);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 2px;
}
.kpi-change.up { color: var(--color-success); }
.kpi-change.down { color: var(--color-danger); }

/* --- Grid --- */
.grid { display: grid; gap: var(--sp-5); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-7-5 { grid-template-columns: 7fr 5fr; }
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-7-5 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
}

/* --- Data Table --- */
.table-wrapper {
  overflow-x: auto;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
}
.data-table th {
  text-align: left;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.data-table td {
  padding: var(--sp-3) var(--sp-4);
  border-bottom: 1px solid var(--color-border-light);
  font-size: var(--text-base);
  vertical-align: middle;
}
.data-table tbody tr {
  cursor: pointer;
  transition: background var(--ease-fast);
}
.data-table tbody tr:hover { background: var(--color-surface-hover); }
.data-table .cell-main {
  font-weight: 500;
  color: var(--color-text);
}
.data-table .cell-sub {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}
.data-table .cell-meta, .cell-meta {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
}
.data-table .cell-mono {
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

/* --- Badge --- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  font-weight: 700;
  white-space: nowrap;
  line-height: 1.6;
}
.badge-success { background: var(--color-success-light); color: var(--color-success); }
.badge-warning { background: var(--color-warning-light); color: #b45309; }
.badge-danger { background: var(--color-danger-light); color: var(--color-danger); }
.badge-info { background: var(--color-info-light); color: #0369a1; }
.badge-primary { background: var(--color-primary-light); color: var(--color-primary); }
.badge-neutral { background: var(--color-border-light); color: var(--color-text-secondary); }

/* --- Dot indicator --- */
.dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-success { background: var(--color-success); }
.dot-warning { background: var(--color-warning); }
.dot-danger { background: var(--color-danger); }
.dot-info { background: var(--color-info); }
.dot-neutral { background: var(--color-text-tertiary); }

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--sp-2);
  padding: 10px 16px;
  border: 1px solid transparent;
  border-radius: 12px;
  font-size: var(--text-base);
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all var(--ease-fast);
  text-decoration: none;
  white-space: nowrap;
  line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn svg { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }

.btn-primary {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-hover));
  color: var(--color-text-inverse);
  box-shadow: 0 14px 22px rgba(15, 118, 110, 0.18);
}
.btn-primary:hover { transform: translateY(-1px); }
.btn-success { background: var(--color-success); color: var(--color-text-inverse); }
.btn-success:hover { background: #15803d; }
.btn-danger { background: var(--color-danger); color: var(--color-text-inverse); }
.btn-danger:hover { background: #b91c1c; }
.btn-secondary { background: var(--color-surface); color: var(--color-text); border-color: var(--color-border); }
.btn-secondary:hover { background: var(--color-surface-hover); }
.btn-ghost { background: transparent; color: var(--color-info); border-color: rgba(11, 59, 102, 0.12); }
.btn-ghost:hover { background: rgba(11, 59, 102, 0.05); color: var(--color-info); }
.btn-sm { padding: 4px 10px; font-size: var(--text-sm); }
.btn-lg { padding: 12px 24px; font-size: var(--text-md); }
.btn-icon { width: 36px; height: 36px; padding: 0; justify-content: center; border-radius: var(--radius-md); }
.btn-icon.sm { width: 28px; height: 28px; }

/* --- Form Controls --- */
.form-group { margin-bottom: var(--sp-4); }
.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  margin-bottom: var(--sp-1);
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  font-size: var(--text-base);
  font-family: var(--font);
  color: var(--color-text);
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
  outline: none;
  background: var(--color-surface);
}
.form-input:focus, .form-textarea:focus {
  border-color: rgba(154, 179, 191, 0.94);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78);
}
.form-textarea { resize: vertical; line-height: 1.5; }
.form-input::placeholder { color: var(--color-text-tertiary); }

/* --- Search Bar --- */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 12px;
  padding: 0 12px;
  max-width: 320px;
  transition: border-color var(--ease-fast), box-shadow var(--ease-fast);
}
.search-bar:focus-within { border-color: var(--color-primary); box-shadow: 0 0 0 3px var(--color-primary-50); }
.search-bar svg { width: 16px; height: 16px; stroke: var(--color-text-tertiary); fill: none; stroke-width: 2; flex-shrink: 0; }
.search-bar input {
  border: none;
  outline: none;
  padding: 8px;
  font-size: var(--text-base);
  flex: 1;
  background: transparent;
  font-family: var(--font);
  color: var(--color-text);
}
.search-bar input::placeholder { color: var(--color-text-tertiary); }

/* --- Filter Pills --- */
.filter-bar {
  display: flex;
  gap: var(--sp-2);
  flex-wrap: wrap;
  align-items: center;
}
.filter-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 14px;
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  cursor: pointer;
  transition: all var(--ease-fast);
  color: var(--color-text-secondary);
  font-family: var(--font);
}
.filter-pill:hover { border-color: var(--color-primary); color: var(--color-primary); }
.filter-pill.active {
  background: var(--color-primary-light);
  border-color: var(--color-primary);
  color: var(--color-primary);
}

/* --- Toolbar --- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-4);
  margin-bottom: var(--sp-5);
  flex-wrap: wrap;
}
.toolbar-left { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.toolbar-right { display: flex; align-items: center; gap: var(--sp-3); }

/* --- Modal --- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--ease);
}
.modal-overlay.active { opacity: 1; pointer-events: all; }
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  max-width: 560px;
  width: 90%;
  max-height: 90vh;
  overflow-y: auto;
}
.modal-header {
  padding: var(--sp-6) var(--sp-6) 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2 { font-size: var(--text-lg); font-weight: 600; }
.modal-body { padding: var(--sp-6); }
.modal-footer {
  padding: 0 var(--sp-6) var(--sp-6);
  display: flex;
  gap: var(--sp-3);
  justify-content: flex-end;
}

/* --- Empty State --- */
.empty-state {
  text-align: center;
  padding: var(--sp-12) var(--sp-6);
  color: var(--color-text-tertiary);
}
.empty-state svg {
  width: 48px; height: 48px;
  margin: 0 auto var(--sp-4);
  opacity: 0.4;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
}
.empty-state h3 {
  font-size: var(--text-lg);
  color: var(--color-text-secondary);
  margin-bottom: var(--sp-2);
}
.empty-state p {
  font-size: var(--text-base);
  color: var(--color-text-tertiary);
  margin-bottom: var(--sp-5);
}

/* --- Skeleton Loader --- */
.skeleton {
  background: linear-gradient(90deg, var(--color-border-light) 25%, #e8edf2 50%, var(--color-border-light) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: var(--radius-sm);
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.skeleton-line { height: 14px; margin-bottom: var(--sp-3); }
.skeleton-line.w-75 { width: 75%; }
.skeleton-line.w-50 { width: 50%; }
.skeleton-line.w-25 { width: 25%; }

/* --- Toast --- */
.toast-container {
  position: fixed;
  bottom: var(--sp-6);
  right: var(--sp-6);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: var(--sp-2);
}
.toast {
  background: var(--color-text);
  color: var(--color-text-inverse);
  padding: var(--sp-3) var(--sp-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  animation: toast-in 0.3s ease;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}
.toast.toast-success { background: var(--color-success); }
.toast.toast-danger { background: var(--color-danger); }
.toast.toast-error { background: var(--color-danger); }
@keyframes toast-in {
  from { transform: translateY(10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* --- Progress Bar --- */
.progress-bar {
  height: 6px;
  background: var(--color-border-light);
  border-radius: var(--radius-full);
  overflow: hidden;
  width: 60px;
  display: inline-block;
  vertical-align: middle;
}
.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-primary);
  transition: width var(--ease);
}

/* --- Timeline --- */
.timeline { position: relative; }
.timeline::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: var(--color-border);
}
.timeline-item {
  display: flex;
  gap: var(--sp-4);
  padding: var(--sp-3) 0;
  position: relative;
}
.timeline-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--color-primary);
  flex-shrink: 0;
  margin-top: 5px;
  position: relative;
  z-index: 1;
  border: 2px solid var(--color-bg);
  margin-left: 10px;
}
.timeline-dot.success { background: var(--color-success); }
.timeline-dot.warning { background: var(--color-warning); }
.timeline-dot.neutral { background: var(--color-text-tertiary); }
.timeline-content { flex: 1; }
.timeline-text { font-size: var(--text-base); color: var(--color-text); }
.timeline-time { font-size: var(--text-xs); color: var(--color-text-tertiary); margin-top: 2px; }

/* --- Tabs --- */
.tabs {
  display: flex;
  gap: 0;
  border-bottom: 1px solid var(--color-border);
  margin-bottom: var(--sp-6);
  min-width: 0;
}
.tab {
  padding: var(--sp-3) var(--sp-5);
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text-secondary);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: all var(--ease-fast);
  font-family: var(--font);
  background: none;
  border-top: none;
  border-left: none;
  border-right: none;
  flex-shrink: 0;
  white-space: nowrap;
}
.tab:hover { color: var(--color-text); }
.tab.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}
.tab-content { display: none; }
.tab-content.active { display: block; }

/* --- Info Grid --- */
.info-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}
.info-item {}
.info-item .info-label {
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-tertiary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 2px;
}
.info-item .info-value {
  font-size: var(--text-base);
  color: var(--color-text);
}

/* --- Contact Box (tinted) --- */
.contact-box {
  background: var(--color-primary-50);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  border: 1px solid var(--color-primary-light);
}

/* --- Transcript --- */
.transcript-box {
  background: var(--color-bg);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  line-height: 1.7;
  max-height: 400px;
  overflow-y: auto;
  white-space: pre-wrap;
  border: 1px solid var(--color-border);
}

/* --- Task List --- */
.task-list { list-style: none; }
.task-item {
  display: flex;
  align-items: flex-start;
  gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--color-border-light);
}
.task-item:last-child { border-bottom: none; }
.task-checkbox {
  width: 18px; height: 18px;
  border-radius: var(--radius-sm);
  border: 2px solid var(--color-border);
  flex-shrink: 0;
  margin-top: 1px;
  cursor: pointer;
  transition: all var(--ease-fast);
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-surface);
}
.task-checkbox.checked {
  background: var(--color-success);
  border-color: var(--color-success);
}
.task-checkbox.checked::after {
  content: '';
  width: 5px; height: 9px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
  margin-bottom: 2px;
}
.task-body { flex: 1; }
.task-title { font-size: var(--text-base); font-weight: 500; }
.task-meta { font-size: var(--text-sm); color: var(--color-text-secondary); margin-top: 2px; }
.task-item.completed .task-title { text-decoration: line-through; color: var(--color-text-tertiary); }
.priority-indicator {
  width: 3px;
  border-radius: var(--radius-full);
  align-self: stretch;
  flex-shrink: 0;
}
.priority-hoch { background: var(--color-danger); }
.priority-normal { background: var(--color-warning); }
.priority-niedrig { background: var(--color-success); }

/* --- Dropzone --- */
.dropzone {
  border: 2px dashed rgba(15, 118, 110, 0.25);
  border-radius: 20px;
  padding: var(--sp-8) var(--sp-5);
  text-align: center;
  cursor: pointer;
  transition: all var(--ease-fast);
  color: var(--color-text-secondary);
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.04), rgba(11, 59, 102, 0.02));
}
.dropzone:hover, .dropzone.dragover {
  border-color: var(--color-primary);
  background: linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(11, 59, 102, 0.04));
  color: var(--color-primary);
}
.dropzone svg {
  width: 36px; height: 36px;
  margin: 0 auto var(--sp-3);
  stroke: currentColor;
  fill: none;
  stroke-width: 1.5;
  display: block;
}
.dropzone p { font-size: var(--text-base); }
.dropzone .hint { font-size: var(--text-sm); color: var(--color-text-tertiary); margin-top: var(--sp-2); }

/* --- Record Button --- */
.record-btn {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  border: none;
  background: var(--color-primary);
  color: white;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: var(--font);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--ease-fast);
  margin: 0 auto;
}
.record-btn:hover { background: var(--color-primary-hover); transform: scale(1.05); }
.record-btn.recording {
  background: var(--color-danger);
  animation: pulse 2s infinite;
}
.record-btn svg { width: 32px; height: 32px; margin-bottom: var(--sp-1); stroke: currentColor; fill: none; stroke-width: 1.75; }
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 rgba(220,38,38,0.4); }
  70% { box-shadow: 0 0 0 20px rgba(220,38,38,0); }
  100% { box-shadow: 0 0 0 0 rgba(220,38,38,0); }
}

/* --- Timer --- */
.timer-display {
  font-size: 36px;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  text-align: center;
  color: var(--color-text);
  margin-top: var(--sp-4);
}

/* --- Spinner --- */
.spinner {
  width: 20px; height: 20px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Document Grid --- */
.doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--sp-4);
}
.doc-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  transition: all var(--ease-fast);
}
.doc-card:hover { border-color: var(--color-primary); box-shadow: var(--shadow-sm); }
.doc-card-preview {
  height: 120px;
  background: var(--color-bg);
  display: flex;
  align-items: center;
  justify-content: center;
  border-bottom: 1px solid var(--color-border);
}
.doc-card-preview svg { width: 40px; height: 40px; stroke: var(--color-text-tertiary); fill: none; stroke-width: 1.25; }
.doc-card-body { padding: var(--sp-3); }
.doc-card-name { font-size: var(--text-sm); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.doc-card-meta { font-size: var(--text-xs); color: var(--color-text-tertiary); margin-top: 2px; }

/* --- Split Panel Layout --- */
.split-layout {
  display: flex;
  min-height: 480px;
}
.split-list {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  max-height: calc(100vh - 240px);
}
.split-panel {
  width: 420px;
  flex-shrink: 0;
  background: var(--color-surface);
  overflow-y: auto;
  max-height: calc(100vh - 240px);
  display: none;
  border-left: 1px solid var(--color-border);
}
.split-panel.open {
  display: flex;
  flex-direction: column;
}
.split-panel-header {
  padding: var(--sp-4) var(--sp-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--sp-3);
  border-bottom: 1px solid var(--color-border-light);
  flex-shrink: 0;
}
.split-panel-body {
  padding: var(--sp-5);
  flex: 1;
  overflow-y: auto;
}
.split-panel-section {
  margin-bottom: var(--sp-5);
}
.split-panel-section-label {
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-tertiary);
  margin-bottom: var(--sp-2);
}
.split-panel-footer {
  padding: var(--sp-4) var(--sp-5);
  border-top: 1px solid var(--color-border);
  display: flex;
  gap: var(--sp-3);
  justify-content: space-between;
  flex-shrink: 0;
  background: var(--color-surface);
}

/* Task list items (compact) */
.task-list-compact {}
.task-list-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  padding: var(--sp-3) var(--sp-4);
  cursor: pointer;
  border-bottom: 1px solid var(--color-border-light);
  transition: background var(--ease-fast);
  min-height: 48px;
}
.task-list-item:hover { background: var(--color-surface-hover); }
.task-list-item.active {
  background: var(--color-primary-50);
  border-left: 3px solid var(--color-primary);
  padding-left: calc(var(--sp-4) - 3px);
}
.task-list-item.done .task-list-title {
  text-decoration: line-through;
  color: var(--color-text-tertiary);
}
.task-list-body { flex: 1; min-width: 0; }
.task-list-title {
  font-size: var(--text-base);
  font-weight: 500;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.task-list-meta {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: var(--sp-2);
}

/* Priority bar in task list */
.task-list-item .priority-indicator {
  height: 28px;
  width: 3px;
  border-radius: var(--radius-full);
  flex-shrink: 0;
}

/* Task origin badge */
.origin-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: var(--radius-full);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.6;
  white-space: nowrap;
  vertical-align: middle;
}
.origin-badge-ki {
  background: linear-gradient(135deg, rgba(139,92,246,0.12), rgba(59,130,246,0.12));
  color: #7c3aed;
  border: 1px solid rgba(139,92,246,0.2);
}
.origin-badge-ki svg {
  width: 10px;
  height: 10px;
  stroke: #7c3aed;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.origin-badge-manual {
  background: var(--color-border-light);
  color: var(--color-text-tertiary);
  border: 1px solid var(--color-border);
}

/* Task group headers use inline styles (see aufgaben.html renderList) */

/* Protocol embed card */
.protocol-embed {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: var(--sp-4);
  cursor: pointer;
  transition: border-color var(--ease-fast);
}
.protocol-embed:hover { border-color: var(--color-primary); }
.protocol-embed-header {
  display: flex;
  align-items: center;
  gap: var(--sp-2);
  margin-bottom: var(--sp-2);
}
.protocol-embed-summary {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

@media (max-width: 1024px) {
  .split-panel {
    position: fixed;
    right: 0; top: 0; bottom: 0;
    z-index: 500;
    box-shadow: var(--shadow-lg);
    width: 400px;
    max-height: none;
    border-left: none;
  }
}
@media (max-width: 768px) {
  .split-panel { width: 100%; }
  .split-list { max-height: none; }
  html, body {
    overflow-x: hidden;
  }
  .card {
    padding: var(--sp-4);
    margin-bottom: var(--sp-4);
    border-radius: var(--radius-md);
  }
  .card-header {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: var(--sp-3);
  }
  .toolbar {
    flex-direction: column;
    align-items: stretch;
    gap: var(--sp-3);
  }
  .toolbar-left,
  .toolbar-right {
    width: 100%;
    align-items: stretch;
    justify-content: flex-start;
  }
  .toolbar-left > *,
  .toolbar-right > * {
    max-width: 100%;
  }
  .page-header-actions > *,
  .page-actions > * {
    width: 100%;
  }
  .page-header-actions .search-bar,
  .page-actions .search-bar,
  .page-header-actions .form-input,
  .page-header-actions .form-select,
  .page-actions .form-input,
  .page-actions .form-select,
  .page-actions .filter-bar,
  .page-header-actions .filter-bar {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }
  .tabs {
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    margin-bottom: var(--sp-4);
    padding-bottom: 2px;
  }
  .tabs::-webkit-scrollbar {
    display: none;
  }
  .search-bar {
    width: 100% !important;
    max-width: none !important;
    min-width: 0 !important;
  }
  .search-bar input {
    min-width: 0;
  }
  .filter-bar {
    width: 100%;
  }
  .filter-pill {
    min-height: 36px;
  }
  .btn {
    min-height: 40px;
    white-space: normal;
  }
  .btn-icon,
  .btn-icon.sm {
    min-height: 0;
    flex-shrink: 0;
  }
  .btn-icon {
    width: 36px;
    height: 36px;
  }
  .btn-icon.sm {
    width: 30px;
    height: 30px;
  }
  .form-input,
  .form-select,
  .form-textarea {
    font-size: 16px;
  }
  .modal-overlay {
    align-items: flex-end;
    padding: 8px;
  }
  .modal {
    width: 100% !important;
    max-width: none !important;
    max-height: calc(100dvh - 8px) !important;
    border-radius: 20px 20px 0 0 !important;
  }
  .modal-header {
    padding: var(--sp-4) var(--sp-4) 0;
  }
  .modal-body {
    padding: var(--sp-4);
  }
  .modal-footer {
    padding: 0 var(--sp-4) calc(var(--sp-4) + env(safe-area-inset-bottom));
    flex-direction: column-reverse;
    align-items: stretch;
  }
  .modal-footer .btn {
    width: 100%;
  }
  .table-wrapper {
    margin: 0 calc(-1 * var(--sp-2));
    padding: 0 var(--sp-2);
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table th,
  .data-table td {
    padding: var(--sp-3) var(--sp-2);
  }
  .data-table td {
    font-size: var(--text-sm);
  }
  .info-grid {
    grid-template-columns: 1fr !important;
  }
  [style*="grid-template-columns:1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr"],
  [style*="grid-template-columns:1fr 1fr 1fr"],
  [style*="grid-template-columns: 1fr 1fr 1fr"],
  [style*="grid-template-columns:repeat(2, 1fr)"],
  [style*="grid-template-columns: repeat(2, 1fr)"],
  [style*="grid-template-columns:repeat(3, 1fr)"],
  [style*="grid-template-columns: repeat(3, 1fr)"] {
    grid-template-columns: 1fr !important;
  }
  .dropzone {
    padding: var(--sp-5) var(--sp-4);
  }
}
@media (max-width: 480px) {
  .page-wrapper {
    padding: var(--sp-3);
  }
  .page-header {
    margin-bottom: var(--sp-4);
  }
  .card {
    padding: var(--sp-3);
  }
  .badge {
    white-space: normal;
  }
  .filter-pill {
    flex: 1 1 calc(50% - var(--sp-2));
    min-width: 0;
    text-align: center;
  }
  .modal-overlay {
    padding: 0;
  }
  .modal {
    max-height: 100dvh !important;
    border-radius: 18px 18px 0 0 !important;
  }
}

/* --- Utils --- */
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-sm { font-size: var(--text-sm); }
.text-xs { font-size: var(--text-xs); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary { color: var(--color-text-tertiary); }
.text-success { color: var(--color-success); }
.text-danger { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }
.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }
.mt-1 { margin-top: var(--sp-1); }
.mt-2 { margin-top: var(--sp-2); }
.mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); }
.mb-2 { margin-bottom: var(--sp-2); }
.mb-3 { margin-bottom: var(--sp-3); }
.mb-4 { margin-bottom: var(--sp-4); }
.mb-6 { margin-bottom: var(--sp-6); }
.gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); }
.gap-4 { gap: var(--sp-4); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.flex-1 { flex: 1; }
.flex-wrap { flex-wrap: wrap; }
.hidden { display: none; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.w-full { width: 100%; }
.cursor-pointer { cursor: pointer; }

/* --- Legacy Dashboard Reskin --- */
@supports selector(body:has(#dash-layout)) {
  body:has(#dash-layout) .page-wrapper {
    max-width: 1480px;
  }

  body:has(#dash-layout) .page-wrapper > .page-header {
    position: relative;
    overflow: hidden;
    padding: 30px 32px;
    margin-bottom: 20px !important;
    background:
      radial-gradient(circle at top right, rgba(15, 118, 110, 0.14), transparent 30%),
      radial-gradient(circle at bottom left, rgba(11, 59, 102, 0.1), transparent 28%),
      linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,248,250,0.98));
    border: 1px solid rgba(215, 226, 232, 0.96);
    border-radius: 30px;
    box-shadow: var(--shadow-sm);
  }

  body:has(#dash-layout) .page-wrapper > .page-header::after {
    content: "";
    position: absolute;
    inset: auto -64px -88px auto;
    width: 220px;
    height: 220px;
    border-radius: 50%;
    background: rgba(15, 118, 110, 0.08);
  }

  body:has(#dash-layout) .page-wrapper > .page-header > * {
    position: relative;
    z-index: 1;
  }
}

#greeting {
  padding: 8px 14px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.84);
  border: 1px solid rgba(15, 118, 110, 0.12);
  box-shadow: 0 10px 24px rgba(18, 33, 43, 0.06);
}

#dash-layout {
  grid-template-columns: minmax(0, 1.28fr) minmax(360px, 0.92fr);
  gap: 18px;
  align-items: start;
}

#dash-layout .dash-sec {
  min-width: 0;
}

#dash-layout .card {
  position: relative;
  overflow: hidden;
  margin-bottom: 0;
  border-radius: 28px;
  border: 1px solid rgba(215, 226, 232, 0.96);
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,248,250,0.96));
  box-shadow: 0 18px 44px rgba(18, 33, 43, 0.1);
}

#dash-layout .card::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255,255,255,0.54), transparent 48%);
}

#dash-layout .card > * {
  position: relative;
  z-index: 1;
}

#dash-upload-card {
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.12), transparent 35%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(241,247,249,0.96)) !important;
}

#dash-dropzone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 220px;
  padding: 32px 24px !important;
  background:
    radial-gradient(circle at top center, rgba(15, 118, 110, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(255,255,255,0.74), rgba(231, 239, 243, 0.84));
  border: none !important;
  border-radius: 0 !important;
}

#dash-dropzone::after {
  content: "";
  position: absolute;
  inset: 16px;
  border: 1.5px dashed rgba(15, 118, 110, 0.22);
  border-radius: 24px;
}

#dash-dropzone > * {
  position: relative;
  z-index: 1;
}

#dash-dropzone svg {
  width: 44px !important;
  height: 44px !important;
  stroke: var(--color-primary);
  fill: none;
  stroke-width: 1.8;
}

#dash-dropzone p {
  max-width: 24ch;
  text-align: center;
  color: var(--color-text);
}

#dash-dropzone span {
  background: rgba(255,255,255,0.9) !important;
  border-color: rgba(184, 200, 208, 0.56) !important;
  color: var(--color-text-secondary) !important;
}

#dash-file-info,
#dash-upload-progress {
  background: linear-gradient(180deg, rgba(255,255,255,0.72), rgba(243,248,250,0.94));
  border-top-color: rgba(215, 226, 232, 0.92) !important;
}

#dash-file-info > div:last-child {
  gap: 10px;
}

#dash-file-info > div:last-child .btn {
  min-width: 120px;
}

#dash-upload-status {
  font-weight: 600;
}

#dash-layout .dash-step-circle {
  width: 30px;
  height: 30px;
  border-width: 1.5px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.64);
}

#dash-layout .dash-step-line {
  height: 3px;
  border-radius: 999px;
  background: rgba(184, 200, 208, 0.7);
}

#dash-layout .dash-step-label {
  letter-spacing: 0.02em;
}

#dash-layout .dash-section-title {
  margin-bottom: 12px;
  padding: 0 4px;
  font-size: 11px;
  letter-spacing: 0.1em;
}

#dash-layout .dash-section-title .btn {
  border-radius: var(--radius-full);
  border-color: rgba(11, 59, 102, 0.12);
  background: rgba(255,255,255,0.76);
}

#dash-layout .dash-overdue-wrap {
  padding: 10px;
}

#dash-layout .dash-overdue-wrap.collapsed {
  max-height: 186px;
}

#dash-task-list,
#dash-overdue-list {
  display: grid;
  gap: 10px;
}

#dash-layout .dash-item {
  align-items: flex-start;
  padding: 14px 16px;
  border: 1px solid rgba(215, 226, 232, 0.84);
  border-bottom: 1px solid rgba(215, 226, 232, 0.84);
  border-radius: 18px;
  background: rgba(247, 250, 252, 0.88);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.66);
}

#dash-layout .dash-item:last-child {
  border-bottom: 1px solid rgba(215, 226, 232, 0.84);
}

#dash-layout .dash-item:hover {
  background: rgba(255,255,255,0.96);
  border-color: rgba(15, 118, 110, 0.18);
  box-shadow: 0 10px 24px rgba(18, 33, 43, 0.08);
  transform: translateY(-1px);
}

#dash-layout .dash-item-overdue {
  background: linear-gradient(180deg, rgba(252, 230, 230, 0.92), rgba(255,255,255,0.98));
  border-color: rgba(194, 65, 64, 0.14);
}

#dash-layout .dash-item-title {
  font-size: 13px;
  line-height: 1.4;
}

#dash-layout .dash-item-meta {
  margin-top: 4px;
}

#dash-layout .dash-empty {
  padding: 22px 18px;
}

#dash-layout .dash-overdue-fade {
  height: 72px;
  background: linear-gradient(180deg, rgba(244,248,250,0), rgba(244,248,250,0.78) 36%, rgba(244,248,250,1));
  padding-bottom: 10px;
}

#dash-layout .dash-overdue-toggle {
  padding: 7px 14px;
  background: rgba(255,255,255,0.92);
  border-color: rgba(215, 226, 232, 0.94);
  box-shadow: 0 10px 22px rgba(18, 33, 43, 0.08);
}

#dash-layout .dash-overdue-toggle:hover {
  background: #ffffff;
}

#dash-proto-boxes {
  gap: 12px !important;
}

#dash-proto-boxes .proto-box {
  position: relative;
  min-height: 132px;
  padding: 18px;
  border: 1px solid rgba(215, 226, 232, 0.88);
  border-left: none;
  border-radius: 22px;
  background: linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,248,250,0.96));
  box-shadow: 0 14px 28px rgba(18, 33, 43, 0.08);
}

#dash-proto-boxes .proto-box::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: linear-gradient(90deg, rgba(183, 121, 31, 0.92), rgba(183, 121, 31, 0.18));
}

#dash-proto-boxes .proto-box:hover {
  border-color: rgba(183, 121, 31, 0.32);
  box-shadow: 0 18px 32px rgba(18, 33, 43, 0.12);
}

#dash-proto-boxes .proto-box-title {
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

#dash-calendar {
  position: relative;
}

#dash-calendar .cal-nav {
  justify-content: space-between;
  padding: 0 2px 14px;
  margin-bottom: 12px;
}

#dash-calendar .cal-nav-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

#dash-calendar .cal-nav-btn {
  border-color: rgba(215, 226, 232, 0.94);
  box-shadow: 0 10px 22px rgba(18, 33, 43, 0.08);
}

#dash-calendar .cal-nav-today {
  font-weight: 700;
}

#dash-calendar .cal-grid {
  gap: 6px;
  padding: 6px;
  border: 1px solid rgba(215, 226, 232, 0.78);
  border-radius: 24px;
  background: linear-gradient(180deg, rgba(247,250,252,0.96), rgba(255,255,255,0.88));
}

#dash-calendar.cal-compact .cal-header-cell {
  padding: 6px 2px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
}

#dash-calendar.cal-compact .cal-cell {
  min-height: 58px;
  padding: 6px;
  border: 1px solid rgba(215, 226, 232, 0.7);
  border-radius: 16px;
  background: rgba(255,255,255,0.92);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.7);
}

#dash-calendar.cal-compact .cal-cell.weekend {
  background: rgba(247,250,252,0.88);
}

#dash-calendar.cal-compact .cal-cell:hover {
  border-color: rgba(15, 118, 110, 0.18);
  background: rgba(255,255,255,0.98);
  box-shadow: 0 8px 18px rgba(18, 33, 43, 0.08);
}

#dash-calendar.cal-compact .cal-cell.today {
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.2);
}

#dash-calendar.cal-compact .cal-day-num {
  width: 28px;
  height: 28px;
  margin-bottom: 4px;
  font-size: 12px;
  font-weight: 800;
}

#dash-calendar.cal-compact .cal-task-bars {
  gap: 2px;
}

#dash-calendar.cal-compact .cal-task-bar {
  height: 4px;
  border-radius: 999px;
}

#dash-calendar.cal-compact .cal-task-count {
  margin-top: 3px;
  font-size: 9px;
  font-weight: 800;
}

#cal-widget-popup {
  border-radius: 20px !important;
  border-color: rgba(215, 226, 232, 0.96) !important;
  box-shadow: 0 20px 48px rgba(18, 33, 43, 0.16) !important;
}

#cal-widget-popup .cal-hover-popup-header {
  font-size: 12px !important;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

@media (max-width: 1180px) {
  #dash-layout {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  @supports selector(body:has(#dash-layout)) {
    body:has(#dash-layout) .page-wrapper > .page-header {
      padding: 22px 18px;
      border-radius: 24px;
    }
  }

  #greeting {
    padding: 7px 12px;
  }

  #dash-layout {
    gap: 14px;
  }

  #dash-layout .card {
    border-radius: 24px;
  }

  #dash-dropzone {
    min-height: 188px;
    padding: 24px 18px !important;
  }

  #dash-dropzone::after {
    inset: 12px;
    border-radius: 18px;
  }

  #dash-file-info > div:last-child .btn {
    flex: 1 1 0;
    min-width: 0;
  }

  #dash-calendar .cal-grid {
    gap: 4px;
    padding: 4px;
    border-radius: 18px;
  }

  #dash-calendar.cal-compact .cal-cell {
    min-height: 50px;
    padding: 4px;
    border-radius: 14px;
  }

  #dash-calendar.cal-compact .cal-day-num {
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
  }

  #dash-proto-boxes {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 480px) {
  #dash-layout .dash-overdue-wrap,
  #dash-task-list,
  #dash-overdue-list {
    gap: 8px;
  }

  #dash-layout .dash-item {
    padding: 12px 14px;
  }

  #dash-layout .dash-overdue-fade {
    height: 64px;
  }
}

/* --- Enterprise UI Polish --- */
body {
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.1), transparent 30%),
    radial-gradient(circle at top right, rgba(11, 59, 102, 0.1), transparent 24%),
    linear-gradient(180deg, #f5f9fb 0%, #eef4f7 100%);
  color: #15232d;
}

.sidebar {
  background:
    linear-gradient(180deg, rgba(9, 48, 71, 0.98), rgba(14, 31, 42, 0.98)),
    #10232e;
  border-right: 1px solid rgba(255,255,255,0.06);
  box-shadow: 22px 0 48px rgba(7, 15, 21, 0.18);
}

.sidebar-logo {
  height: 92px;
  padding: 0 22px;
}

.sidebar-logo .logo-icon {
  width: 50px;
  height: 50px;
  border-radius: 18px;
  box-shadow: 0 12px 26px rgba(15, 118, 110, 0.26);
}

.nav-item {
  height: 48px;
  padding: 0 15px;
  border-radius: 16px;
  font-weight: 650;
}

.nav-item:hover {
  background: rgba(255,255,255,0.1);
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(255,255,255,0.22), rgba(255,255,255,0.08));
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 12px 26px rgba(7, 17, 24, 0.16);
}

.main-content {
  background: linear-gradient(180deg, rgba(255,255,255,0.02), transparent 22%);
}

.page-wrapper {
  max-width: 1500px;
  padding: 26px 30px 64px;
}

.page-header {
  position: relative;
  overflow: hidden;
  padding: 26px 28px;
  margin-bottom: 22px;
  border: 1px solid rgba(215, 226, 232, 0.94);
  border-radius: 28px;
  background:
    radial-gradient(circle at top right, rgba(15, 118, 110, 0.1), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(244,248,250,0.98));
  box-shadow: 0 18px 44px rgba(18, 33, 43, 0.1);
}

.page-header::after {
  content: "";
  position: absolute;
  inset: auto -70px -88px auto;
  width: 220px;
  height: 220px;
  border-radius: 50%;
  background: rgba(11, 59, 102, 0.06);
}

.page-header > * {
  position: relative;
  z-index: 1;
}

.page-header h1 {
  font-size: clamp(2rem, 4vw, 2.7rem);
  line-height: 1.02;
  letter-spacing: -0.055em;
}

.page-header-actions,
.page-actions {
  gap: 12px;
}

.toolbar {
  padding: 12px 14px;
  margin-bottom: 18px;
  border: 1px solid rgba(215, 226, 232, 0.9);
  border-radius: 22px;
  background: rgba(255,255,255,0.78);
  backdrop-filter: blur(14px);
  box-shadow: 0 14px 32px rgba(18, 33, 43, 0.08);
}

.card {
  border-radius: 28px;
  border-color: rgba(215, 226, 232, 0.96);
  box-shadow: 0 18px 44px rgba(18, 33, 43, 0.09);
}

.card-header {
  margin-bottom: 18px;
}

.card-title {
  font-size: 1rem;
  font-weight: 750;
  letter-spacing: -0.02em;
}

.btn {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 14px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.btn-sm {
  min-height: 32px;
  padding: 0 12px;
  border-radius: 12px;
}

.btn-primary {
  box-shadow: 0 14px 26px rgba(15, 118, 110, 0.2);
}

.btn-primary:hover {
  box-shadow: 0 18px 30px rgba(15, 118, 110, 0.24);
}

.btn-secondary,
.btn-ghost {
  background: rgba(255,255,255,0.88);
}

.search-bar,
.form-input,
.form-select,
.form-textarea {
  min-height: 44px;
  border-radius: 14px;
  border-color: rgba(215, 226, 232, 0.96);
  background: rgba(255,255,255,0.92);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.64);
}

.search-bar {
  min-height: 44px;
  padding: 0 14px;
  box-shadow: 0 10px 22px rgba(18, 33, 43, 0.06);
}

.search-bar svg {
  width: 17px;
  height: 17px;
}

.form-input:focus,
.form-textarea:focus,
.search-bar:focus-within {
  border-color: rgba(154, 179, 191, 0.94);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.78);
}

.form-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-tertiary);
  margin-bottom: 6px;
}

.filter-bar {
  gap: 10px;
}

.filter-pill {
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  border-color: rgba(215, 226, 232, 0.94);
  background: rgba(255,255,255,0.9);
  font-weight: 650;
  color: var(--color-text-secondary);
}

.filter-pill:hover {
  background: rgba(255,255,255,0.98);
  box-shadow: 0 10px 18px rgba(18, 33, 43, 0.06);
}

.filter-pill.active {
  background: linear-gradient(135deg, rgba(15, 118, 110, 0.12), rgba(15, 118, 110, 0.05));
  border-color: rgba(15, 118, 110, 0.28);
  box-shadow: 0 12px 22px rgba(15, 118, 110, 0.08);
}

.badge {
  border: 1px solid transparent;
}

.badge-neutral {
  border-color: rgba(215, 226, 232, 0.96);
}

.table-wrapper {
  background: transparent;
}

.data-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 14px 16px;
  background: rgba(243, 248, 250, 0.96);
  backdrop-filter: blur(8px);
}

.data-table td {
  padding: 14px 16px;
}

.data-table tbody tr:hover {
  background: rgba(15, 118, 110, 0.035);
}

.modal {
  border: 1px solid rgba(215, 226, 232, 0.96);
}

.modal-header {
  padding-top: 22px;
}

.modal-footer {
  padding-bottom: 22px;
}

.empty-state {
  padding: 52px 24px;
}

.empty-state h3 {
  font-weight: 750;
}

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

  .page-header {
    padding: 20px 18px;
    border-radius: 24px;
  }

  .toolbar {
    padding: 10px 12px;
    border-radius: 20px;
  }

  .card {
    border-radius: 24px;
  }
}

/* --- Form Surface Polish --- */
.form-group {
  margin-bottom: 18px;
}

.modal-body .form-group:last-child,
.task-edit-field:last-child {
  margin-bottom: 0;
}

.form-label,
.task-edit-field label {
  margin-bottom: 8px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #8ea0ab;
}

.form-input,
.form-select,
.form-textarea,
.stamm-edit-input,
.task-assignee-select,
.task-edit-field .form-input,
.task-edit-field .form-select,
.task-edit-field .form-textarea {
  width: 100%;
  min-height: 46px;
  padding: 0 16px;
  border-radius: 16px;
  border: 1px solid rgba(198, 212, 220, 0.96);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,250,252,0.98));
  color: var(--color-text);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.78),
    0 10px 22px rgba(18, 33, 43, 0.05);
  transition:
    border-color var(--ease-fast),
    box-shadow var(--ease-fast),
    background-color var(--ease-fast),
    transform var(--ease-fast);
}

.form-textarea,
.task-edit-field .form-textarea {
  min-height: 116px;
  padding: 14px 16px;
  line-height: 1.55;
  resize: vertical;
}

.form-input::placeholder,
.form-textarea::placeholder,
.stamm-edit-input::placeholder,
.task-edit-field .form-input::placeholder,
.task-edit-field .form-textarea::placeholder {
  color: #a7b5bf;
}

/* Hover: NUR border-color animieren — kein background:, weil shorthand
   das background-image (Pfeil) löschen würde und dabei das Safari System-Accent
   kurz durchblitzen kann */
.form-input:hover,
.form-textarea:hover,
.task-edit-field .form-input:hover,
.task-edit-field .form-textarea:hover {
  border-color: rgba(154, 179, 191, 0.94);
  background-color: #ffffff;
}
.form-select:hover,
.stamm-edit-input:hover,
.task-assignee-select:hover,
.task-edit-field .form-select:hover {
  border-color: rgba(154, 179, 191, 0.94);
  /* KEIN background:* hier - Pfeil-background-image muss erhalten bleiben */
}

.form-input:focus,
.form-textarea:focus,
.task-edit-field .form-input:focus,
.task-edit-field .form-textarea:focus {
  border-color: rgba(198, 212, 220, 0.96);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.78),
    0 10px 22px rgba(18, 33, 43, 0.05);
  outline: none;
  background: #ffffff;
}

.form-select,
.task-assignee-select,
.task-edit-field .form-select,
select.stamm-edit-input,
select.assign-select,
select.filter-select {
  appearance: none !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  padding-right: 42px;
  background-image:
    linear-gradient(45deg, transparent 50%, #7e94a0 50%),
    linear-gradient(135deg, #7e94a0 50%, transparent 50%),
    linear-gradient(180deg, rgba(255,255,255,0.98), rgba(246,250,252,0.98));
  background-position:
    calc(100% - 19px) calc(50% - 2px),
    calc(100% - 13px) calc(50% - 2px),
    0 0;
  background-size:
    6px 6px,
    6px 6px,
    100% 100%;
  background-repeat: no-repeat;
}

/* Select Focus: KEIN background-image override - der Pfeil von der Hauptregel
   bleibt erhalten, nur Border/Shadow ändern sich (oder gar nichts) */
.form-select:focus,
.task-assignee-select:focus,
.task-edit-field .form-select:focus,
select.stamm-edit-input:focus,
select.assign-select:focus,
select.filter-select:focus {
  border-color: rgba(198, 212, 220, 0.96);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.78),
    0 10px 22px rgba(18, 33, 43, 0.05);
  outline: none;
}

/* Browser-System-Akzentfarbe global überschreiben — verhindert grünes
   macOS Akzent auf <select>, <input type="checkbox">, <input type="radio"> etc. */
:root {
  accent-color: #2563eb;
}
html, body, select, input, textarea, button {
  accent-color: #2563eb;
}

input[type="date"].form-input,
.task-edit-field input[type="date"].form-input {
  min-height: 46px;
}

input[type="file"].form-input {
  padding: 10px 14px;
}

input[type="file"].form-input::file-selector-button {
  margin-right: 12px;
  padding: 8px 12px;
  border: 1px solid rgba(198, 212, 220, 0.96);
  border-radius: 12px;
  background: rgba(255,255,255,0.92);
  color: var(--color-text-secondary);
  font-weight: 700;
  cursor: pointer;
}

#modal-new-task-preview .form-group,
#modal-edit-task-company .form-group,
#modal-new-task .form-group,
#modal-upload-preview .form-group,
#modal-upload-doc .form-group,
#modal-upload .form-group {
  margin-bottom: 20px;
}

#modal-new-task-preview .modal-body,
#modal-edit-task-company .modal-body,
#modal-new-task .modal-body {
  padding-top: 20px;
}

@media (max-width: 768px) {
  .form-input,
  .form-select,
  .form-textarea,
  .stamm-edit-input,
  .task-assignee-select,
  .task-edit-field .form-input,
  .task-edit-field .form-select,
  .task-edit-field .form-textarea {
    border-radius: 14px;
  }

  .form-textarea,
  .task-edit-field .form-textarea {
    min-height: 104px;
  }
}
