/* ============================================
   5TH CREATIVE STUDIO OS — DESIGN SYSTEM
   Dark Editorial Luxury Aesthetic
   ============================================ */

:root {
  /* Core Palette */
  --bg-base:        #0e0e0c;
  --bg-surface:     #141412;
  --bg-elevated:    #1c1c19;
  --bg-hover:       #222220;
  --bg-border:      #2a2a27;

  /* Typography */
  --text-primary:   #f0ede4;
  --text-secondary: #8a8880;
  --text-muted:     #4a4a47;
  --text-accent:    #c9a96e;

  /* Accent — Warm Gold */
  --accent:         #c9a96e;
  --accent-dim:     #c9a96e22;
  --accent-hover:   #d4b87e;

  /* Status */
  --status-active:   #6fb87a;
  --status-onboard:  #c9a96e;
  --status-paused:   #8a8880;
  --status-done:     #4a7abf;

  /* Priority */
  --priority-urgent: #d45f5f;
  --priority-high:   #c9a96e;
  --priority-normal: #6fb87a;

  /* Spacing */
  --sidebar-w: 240px;
  --topbar-h: 64px;
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;

  /* Type Scale */
  --font-display: 'Bebas Neue', sans-serif;
  --font-body:    'DM Sans', sans-serif;
  --font-mono:    'DM Mono', monospace;
}

/* ============ RESET ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  height: 100%;
  font-family: var(--font-body);
  background: var(--bg-base);
  color: var(--text-primary);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  overflow: hidden;
}

/* ============ LAYOUT ============ */
#app {
  display: flex;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-surface);
  border-right: 1px solid var(--bg-border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 22px 20px 20px;
  border-bottom: 1px solid var(--bg-border);
  flex-shrink: 0;
}

.brand-mark {
  width: 36px;
  height: 36px;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.brand-name {
  display: block;
  font-family: var(--font-display);
  font-size: 15px;
  letter-spacing: 0.12em;
  color: var(--text-primary);
  line-height: 1;
}

.brand-sub {
  display: block;
  font-size: 10px;
  letter-spacing: 0.15em;
  color: var(--text-muted);
  text-transform: uppercase;
  margin-top: 2px;
  font-family: var(--font-mono);
}

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

.nav-section-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  padding: 12px 8px 6px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 400;
  transition: all 0.15s ease;
  position: relative;
  cursor: pointer;
}

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

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

.nav-item svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.nav-item.active svg { opacity: 1; }

.nav-badge {
  margin-left: auto;
  font-size: 11px;
  font-family: var(--font-mono);
  background: var(--bg-border);
  color: var(--text-secondary);
  padding: 1px 6px;
  border-radius: 20px;
  min-width: 20px;
  text-align: center;
}

.nav-badge.urgent {
  background: var(--priority-urgent);
  color: white;
}

.nav-status {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  margin-left: auto;
  flex-shrink: 0;
}

.nav-status.connected { background: var(--status-active); }
.nav-status.disconnected { background: var(--text-muted); }

.sidebar-footer {
  padding: 14px 12px;
  border-top: 1px solid var(--bg-border);
  flex-shrink: 0;
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: var(--radius-sm);
}

.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--accent-dim);
  border: 1px solid var(--accent);
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  font-family: var(--font-mono);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  letter-spacing: 0.05em;
}

.user-name {
  display: block;
  font-size: 12.5px;
  color: var(--text-primary);
  font-weight: 500;
}

.user-role {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
}

/* ============ MAIN ============ */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* ============ TOPBAR ============ */
.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  border-bottom: 1px solid var(--bg-border);
  background: var(--bg-base);
  z-index: 50;
  flex-shrink: 0;
}

.topbar-left {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.page-title {
  font-family: var(--font-display);
  font-size: 26px;
  letter-spacing: 0.06em;
  color: var(--text-primary);
  line-height: 1;
}

.page-date {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
}

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

.search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  min-width: 220px;
  transition: border-color 0.15s ease;
}

.search-bar:focus-within {
  border-color: var(--accent);
}

.search-bar svg { color: var(--text-muted); flex-shrink: 0; }

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13px;
  font-family: var(--font-body);
  width: 100%;
}

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

/* ============ BUTTONS ============ */
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 9px 16px;
  background: var(--accent);
  color: #0e0e0c;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

.btn-primary:hover { background: var(--accent-hover); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-elevated);
  color: var(--text-primary);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 400;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  color: var(--priority-urgent);
  border: 1px solid rgba(212, 95, 95, 0.27);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-danger:hover { background: rgba(212, 95, 95, 0.094); }

.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: none;
  color: var(--text-secondary);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-back:hover { color: var(--text-primary); border-color: var(--text-muted); }

.btn-mini {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 10px;
  background: var(--bg-hover);
  color: var(--text-secondary);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  font-size: 11.5px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
}

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

/* ============ VIEWS ============ */
.views-wrapper {
  flex: 1;
  overflow: hidden;
  position: relative;
}

.view {
  display: none;
  height: 100%;
  overflow-y: auto;
  padding: 28px;
  animation: fadeIn 0.2s ease;
}

.view.active { display: block; }

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

/* ============ OVERVIEW ============ */
.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  padding: 20px 22px;
  transition: border-color 0.2s ease;
}

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

.stat-card.accent-card {
  border-color: rgba(201, 169, 110, 0.2);
  background: linear-gradient(135deg, var(--bg-surface) 0%, #1a1810 100%);
}

.stat-label {
  font-size: 9.5px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 8px;
}

.stat-value {
  font-family: var(--font-display);
  font-size: 42px;
  line-height: 1;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.accent-card .stat-value { color: var(--accent); }

.stat-sub {
  font-size: 11px;
  color: var(--text-muted);
}

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

/* ============ PANELS ============ */
.panel {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

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

.panel-title {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.panel-link {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s;
}

.panel-link:hover { opacity: 0.7; }

/* ============ CLIENTS GRID ============ */
.clients-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.client-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.client-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: var(--client-color, var(--accent));
  opacity: 0.7;
}

.client-card:hover {
  border-color: var(--text-muted);
  transform: translateY(-2px);
  box-shadow: 0 8px 30px rgba(0,0,0,0.3);
}

.client-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.client-avatar {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 18px;
  letter-spacing: 0.05em;
  flex-shrink: 0;
  background: var(--client-color-dim, var(--accent-dim));
  color: var(--client-color, var(--accent));
  border: 1px solid var(--client-color, var(--accent))33;
}

.client-card-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.client-card-industry {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 2px;
}

.client-card-services {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-bottom: 14px;
}

.service-chip {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  border: 1px solid var(--bg-border);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.client-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 12px;
  border-top: 1px solid var(--bg-border);
}

.client-status-badge {
  font-size: 10px;
  padding: 3px 9px;
  border-radius: 20px;
  font-family: var(--font-mono);
  letter-spacing: 0.08em;
  font-weight: 500;
}

.status-active   { background: rgba(111, 184, 122, 0.13); color: var(--status-active); }
.status-onboarding { background: rgba(201, 169, 110, 0.13); color: var(--status-onboard); }
.status-paused   { background: rgba(74, 74, 71, 0.13); color: var(--text-muted); }
.status-completed { background: rgba(74, 122, 191, 0.13); color: var(--status-done); }

.client-task-progress {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.client-add-card {
  border: 2px dashed var(--bg-border);
  border-radius: var(--radius-md);
  padding: 40px 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  cursor: pointer;
  color: var(--text-muted);
  transition: all 0.2s ease;
  font-size: 13px;
}

.client-add-card:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

/* ============ CLIENT DETAIL ============ */
.client-detail-header {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.client-detail-meta {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: 1;
}

.client-avatar-lg {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 24px;
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(201, 169, 110, 0.2);
  flex-shrink: 0;
}

.client-detail-name {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.05em;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 8px;
}

.client-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}

.client-detail-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.client-detail-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 20px;
  height: calc(100vh - 240px);
}

.client-tasks-panel,
.client-notes-panel {
  overflow-y: auto;
}

/* ============ CHECKLIST ============ */
.checklist-sections {
  padding: 16px 20px;
}

.checklist-category {
  margin-bottom: 20px;
}

.checklist-category-label {
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.checklist-category-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--bg-border);
}

.task-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  transition: background 0.15s ease;
  margin-bottom: 4px;
  group: task-item;
}

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

.task-checkbox {
  width: 17px;
  height: 17px;
  border-radius: 4px;
  border: 1.5px solid var(--bg-border);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
  transition: all 0.15s ease;
}

.task-checkbox:hover { border-color: var(--accent); }

.task-checkbox.checked {
  background: var(--accent);
  border-color: var(--accent);
}

.task-checkbox.checked::after {
  content: '';
  width: 9px;
  height: 5px;
  border-left: 1.5px solid #0e0e0c;
  border-bottom: 1.5px solid #0e0e0c;
  transform: rotate(-45deg) translateY(-1px);
  display: block;
}

.task-item-body {
  flex: 1;
  min-width: 0;
}

.task-item-title {
  font-size: 13.5px;
  color: var(--text-primary);
  line-height: 1.4;
  transition: all 0.15s ease;
}

.task-item-title.done {
  color: var(--text-muted);
  text-decoration: line-through;
}

.task-item-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
}

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

.priority-urgent-dot { background: var(--priority-urgent); }
.priority-high-dot   { background: var(--priority-high); }
.priority-normal-dot { background: var(--priority-normal); }

.task-due {
  font-size: 10.5px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.task-due.overdue { color: var(--priority-urgent); }

.task-delete-btn {
  opacity: 0;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  border: none;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.task-item:hover .task-delete-btn { opacity: 1; }
.task-delete-btn:hover { color: var(--priority-urgent); background: rgba(212, 95, 95, 0.094); }

/* ============ NOTES AREA ============ */
.notes-area {
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: var(--font-body);
  line-height: 1.7;
  padding: 16px 20px;
  resize: none;
  min-height: 200px;
}

.notes-area::placeholder { color: var(--text-muted); }

/* ============ FILE LINKS ============ */
.file-links-list {
  padding: 10px 20px 16px;
}

.file-link-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-border);
  margin-bottom: 6px;
  transition: border-color 0.15s ease;
}

.file-link-item:hover { border-color: var(--text-muted); }

.file-link-icon {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  background: var(--bg-elevated);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  flex-shrink: 0;
}

.file-link-name {
  font-size: 12.5px;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-link-open {
  font-size: 11px;
  color: var(--accent);
  text-decoration: none;
  flex-shrink: 0;
}

/* ============ QUICK LISTS ============ */
.client-quick-list,
.task-quick-list {
  padding: 8px 12px;
}

.quick-client-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s ease;
  border-bottom: 1px solid var(--bg-border);
}

.quick-client-item:last-child { border-bottom: none; }
.quick-client-item:hover { background: var(--bg-hover); }

.quick-client-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.quick-client-name {
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
}

.quick-client-tasks {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.quick-task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px;
  border-radius: var(--radius-sm);
  border-bottom: 1px solid var(--bg-border);
}

.quick-task-item:last-child { border-bottom: none; }

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

.quick-task-name {
  font-size: 13px;
  color: var(--text-primary);
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.quick-task-client {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ============ ALL TASKS VIEW ============ */
.tasks-controls {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.filter-tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  padding: 4px;
}

.filter-tab {
  padding: 6px 14px;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 12.5px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-tab.active {
  background: var(--accent);
  color: #0e0e0c;
  font-weight: 600;
}

.client-filter-select {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 12.5px;
  font-family: var(--font-body);
  padding: 7px 12px;
  cursor: pointer;
  outline: none;
}

.all-tasks-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.all-task-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  transition: all 0.15s ease;
}

.all-task-row:hover { border-color: var(--text-muted); }

.all-task-client-badge {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 20px;
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-family: var(--font-mono);
  white-space: nowrap;
  border: 1px solid var(--bg-border);
}

.all-task-title {
  flex: 1;
  font-size: 13.5px;
  color: var(--text-primary);
}

.all-task-title.done {
  color: var(--text-muted);
  text-decoration: line-through;
}

.all-task-due {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

.all-task-due.overdue { color: var(--priority-urgent); }

/* ============ INTEGRATION VIEWS ============ */
.integration-banner {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  margin-bottom: 20px;
}

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

.integration-name {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-primary);
}

.integration-desc {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.integration-banner .btn-primary { margin-left: auto; }

/* ============ EMAIL / DRIVE / NOTION ITEMS ============ */
.email-item, .drive-item, .notion-item {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 14px 18px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease;
}

.email-item:hover, .drive-item:hover, .notion-item:hover {
  border-color: var(--text-muted);
}

.email-from {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 3px;
}

.email-subject {
  font-size: 12.5px;
  color: var(--text-secondary);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.email-date {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ============ EMPTY STATES ============ */
.empty-state {
  padding: 28px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
  font-style: italic;
}

/* ============ MODAL ============ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

.modal-overlay.open {
  display: flex;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.2s ease;
  box-shadow: 0 32px 80px rgba(0,0,0,0.6);
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: 22px;
  letter-spacing: 0.06em;
  color: var(--text-primary);
}

.modal-close {
  width: 30px;
  height: 30px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--bg-hover);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
}

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

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

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

/* ============ FORM ELEMENTS ============ */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.form-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  text-transform: uppercase;
}

.form-input {
  background: var(--bg-hover);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: var(--font-body);
  padding: 10px 12px;
  outline: none;
  transition: border-color 0.15s ease;
  width: 100%;
}

.form-input:focus { border-color: var(--accent); }
.form-input::placeholder { color: var(--text-muted); }

.form-color {
  width: 40px;
  height: 36px;
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  background: none;
  cursor: pointer;
  padding: 3px;
}

/* ============ SERVICE TAG BUTTONS ============ */
.service-options {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.service-tag-btn {
  padding: 6px 12px;
  border-radius: 20px;
  border: 1px solid var(--bg-border);
  background: var(--bg-hover);
  color: var(--text-secondary);
  font-size: 12px;
  font-family: var(--font-body);
  cursor: pointer;
  transition: all 0.15s ease;
}

.service-tag-btn.selected {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}

/* ============ PROGRESS BAR ============ */
.progress-bar-wrap {
  height: 3px;
  background: var(--bg-border);
  border-radius: 2px;
  margin-top: 6px;
  overflow: hidden;
}

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

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 4px; height: 4px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--bg-border); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ TOAST NOTIFICATION ============ */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  font-size: 13px;
  color: var(--text-primary);
  z-index: 2000;
  box-shadow: 0 8px 30px rgba(0,0,0,0.4);
  animation: toastIn 0.3s ease;
  display: flex;
  align-items: center;
  gap: 10px;
}

.toast.success { border-left: 3px solid var(--status-active); }
.toast.error   { border-left: 3px solid var(--priority-urgent); }
.toast.info    { border-left: 3px solid var(--accent); }

@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* ============ LOADING SPINNER ============ */
.loading-spinner {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 12.5px;
  padding: 20px;
}

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--bg-border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============ RESPONSIVE ============ */
@media (max-width: 1100px) {
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .overview-grid { grid-template-columns: 1fr; }
  .client-detail-grid { grid-template-columns: 1fr; }
}

@media (max-width: 768px) {
  :root { --sidebar-w: 60px; }
  .brand-text, .nav-item span, .user-info, .nav-badge, .nav-status { display: none; }
  .nav-item { justify-content: center; padding: 12px; }
  .sidebar-brand { justify-content: center; padding: 16px 0; }
  .brand-mark { margin: 0; }
  .sidebar-footer { padding: 10px; }
  .user-pill { justify-content: center; }
}

/* ============ SETTINGS BUTTON ============ */
.settings-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 8px;
  background: none;
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 13px;
  font-family: var(--font-body);
  cursor: pointer;
  margin-bottom: 10px;
  transition: all 0.15s ease;
}

.settings-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-dim);
}

.api-key-status {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-muted);
  flex-shrink: 0;
}

.api-key-status.active { background: var(--status-active); }

/* ============ SETTINGS MODAL ============ */
.settings-section-title {
  font-size: 10px;
  letter-spacing: 0.2em;
  color: var(--text-muted);
  font-family: var(--font-mono);
  margin-bottom: 10px;
}

.settings-desc {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.api-key-input-wrap {
  display: flex;
  gap: 8px;
  align-items: center;
}

.api-key-input-wrap .form-input {
  flex: 1;
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: 0.05em;
}

.api-key-hint {
  font-size: 12px;
  margin-top: 6px;
  min-height: 18px;
}

.api-key-hint.ok    { color: var(--status-active); }
.api-key-hint.error { color: var(--priority-urgent); }
.api-key-hint.warn  { color: var(--status-onboard); }

.api-key-steps {
  margin-top: 18px;
  padding: 14px 16px;
  background: var(--bg-hover);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
}

.steps-title {
  font-size: 11px;
  color: var(--text-muted);
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  margin-bottom: 10px;
}

.steps-list {
  padding-left: 18px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.steps-list li {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.steps-list strong { color: var(--text-primary); font-weight: 500; }

.link-accent {
  color: var(--accent);
  text-decoration: none;
}

.link-accent:hover { text-decoration: underline; }

/* ============ INTEGRATION STATUS LIST ============ */
.integration-status-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.integration-status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-hover);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-secondary);
}

.integration-status-row svg { color: var(--text-muted); flex-shrink: 0; }

.int-status-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 20px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  background: var(--bg-border);
  color: var(--text-muted);
}

.int-status-badge.ok      { background: rgba(111, 184, 122, 0.13); color: var(--status-active); }
.int-status-badge.error   { background: rgba(212, 95, 95, 0.13); color: var(--priority-urgent); }
.int-status-badge.testing { background: rgba(201, 169, 110, 0.13); color: var(--status-onboard); }

/* ============ REDIRECT HERO BANNER ============ */
.redirect-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 20px 24px;
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  margin-bottom: 24px;
}

.redirect-hero-icon {
  width: 56px;
  height: 56px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  border: 1px solid rgba(201, 169, 110, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--accent);
  flex-shrink: 0;
}

.redirect-hero-text { flex: 1; }

.redirect-hero-title {
  font-size: 17px;
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.redirect-hero-desc {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

.redirect-how-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-family: var(--font-mono);
  letter-spacing: 0.06em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(201, 169, 110, 0.2);
  padding: 5px 10px;
  border-radius: 20px;
  flex-shrink: 0;
  white-space: nowrap;
}

/* ============ REDIRECT ACTION CARDS ============ */
.redirect-actions-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.redirect-action-card {
  background: var(--bg-surface);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-md);
  padding: 20px;
  cursor: pointer;
  transition: all 0.18s ease;
  display: flex;
  flex-direction: column;
  gap: 8px;
  position: relative;
  overflow: hidden;
}

.redirect-action-card::after {
  content: '↗';
  position: absolute;
  top: 12px;
  right: 14px;
  font-size: 13px;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.redirect-action-card:hover {
  border-color: var(--accent);
  background: var(--bg-elevated);
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0,0,0,0.25);
}

.redirect-action-card:hover::after { opacity: 1; }

.redirect-action-card--custom {
  cursor: default;
}

.redirect-action-card--custom:hover {
  transform: none;
  box-shadow: none;
  border-color: var(--bg-border);
  background: var(--bg-surface);
}

.redirect-action-icon {
  font-size: 22px;
  line-height: 1;
  margin-bottom: 2px;
}

.redirect-action-label {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.redirect-action-desc {
  font-size: 12px;
  color: var(--text-muted);
  line-height: 1.4;
}

/* ============ REDIRECT SEARCH INPUT ============ */
.redirect-custom-input {
  display: flex;
  gap: 7px;
  margin-top: 6px;
  align-items: center;
}

.redirect-input {
  flex: 1;
  background: var(--bg-hover);
  border: 1px solid var(--bg-border);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  font-size: 12.5px;
  font-family: var(--font-body);
  padding: 7px 10px;
  outline: none;
  transition: border-color 0.15s ease;
  min-width: 0;
}

.redirect-input:focus { border-color: var(--accent); }
.redirect-input::placeholder { color: var(--text-muted); }

/* ============ CLIENT QUICK ACTION BUTTONS ============ */
.client-quick-actions {
  padding: 10px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.client-qa-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-border);
  background: var(--bg-hover);
  cursor: pointer;
  transition: all 0.15s ease;
}

.client-qa-btn:hover {
  border-color: var(--accent);
  background: var(--accent-dim);
}

.client-qa-icon { font-size: 15px; flex-shrink: 0; }

.client-qa-text { flex: 1; min-width: 0; }

.client-qa-label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.2;
}

.client-qa-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 1px;
}

.client-qa-arrow {
  color: var(--text-muted);
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.client-qa-btn:hover .client-qa-arrow {
  opacity: 1;
  color: var(--accent);
}

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