/* ============================================================
   She Starts Over — Tools Site
   Shared stylesheet — imported by every page
   v1.0 — 2026-08-12
   ============================================================ */

/* ============================================================
   DESIGN TOKENS
   ============================================================ */

:root {
  /* Brand palette */
  --burgundy:       #6B1E2E;
  --burgundy-deep:  #4A1020;
  --burgundy-faint: #F5EEF0;
  --rose:           #B8788A;
  --rose-faint:     #F7EDF0;
  --blush:          #F2DDD5;
  --blush-light:    #FAF3F0;
  --cream:          #FDF8F5;
  --ink:            #1C1410;
  --ink-mid:        #4A3728;
  --ink-light:      #8C6D5E;
  --white:          #FFFFFF;
  --divider:        #E8D5CC;

  /* Status colors */
  --status-active:  #6B1E2E;
  --status-pending: #B87333;
  --status-alumni:  #B8788A;
  --status-churned: #8C8C8C;

  /* Semantic */
  --surface:        var(--white);
  --bg:             #F5F0ED;
  --border:         var(--divider);
  --text:           var(--ink);
  --text-secondary: var(--ink-mid);
  --text-quiet:     var(--ink-light);
  --accent:         var(--burgundy);
  --accent-hover:   var(--burgundy-deep);
  --danger:         #C0392B;
  --danger-faint:   #FDECEA;
  --success:        #2E7D52;
  --success-faint:  #E8F5EE;
  --warning:        #B87333;
  --warning-faint:  #FEF4E8;

  /* Sidebar */
  --sidebar-width:  240px;
  --sidebar-bg:     var(--burgundy);
  --sidebar-text:   rgba(255,255,255,0.80);
  --sidebar-active: rgba(255,255,255,0.12);
  --sidebar-hover:  rgba(255,255,255,0.07);

  /* Typography */
  --font-body:      'DM Sans', sans-serif;
  --font-display:   'Playfair Display', serif;
  --text-xs:   0.75rem;
  --text-sm:   0.8125rem;
  --text-base: 0.9375rem;
  --text-lg:   1.0625rem;
  --text-xl:   1.25rem;
  --text-2xl:  1.5rem;
  --text-3xl:  1.875rem;
  --weight-normal:   400;
  --weight-medium:   500;
  --weight-semibold: 600;

  /* Spacing */
  --space-1:  0.25rem;
  --space-2:  0.5rem;
  --space-3:  0.75rem;
  --space-4:  1rem;
  --space-5:  1.25rem;
  --space-6:  1.5rem;
  --space-8:  2rem;
  --space-10: 2.5rem;
  --space-12: 3rem;

  /* Radii */
  --radius-sm:   4px;
  --radius-md:   8px;
  --radius-lg:   12px;
  --radius-xl:   16px;
  --radius-pill: 100px;

  /* Shadows */
  --shadow-sm: 0 1px 3px rgba(28,20,16,0.08), 0 1px 2px rgba(28,20,16,0.04);
  --shadow-md: 0 4px 12px rgba(28,20,16,0.10), 0 2px 4px rgba(28,20,16,0.06);
  --shadow-lg: 0 8px 24px rgba(28,20,16,0.12), 0 4px 8px rgba(28,20,16,0.06);
  --shadow-xl: 0 16px 40px rgba(28,20,16,0.14);

  /* Easing */
  --ease:        cubic-bezier(0.4, 0, 0.2, 1);
  --ease-out:    cubic-bezier(0, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-body);
  font-size: var(--text-base);
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

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

a:hover { text-decoration: underline; }

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--burgundy);
  outline-offset: 2px;
}

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

button { cursor: pointer; font-family: var(--font-body); }

/* ============================================================
   APP SHELL
   ============================================================ */

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: var(--sidebar-width);
  height: 100vh;
  background: var(--sidebar-bg);
  display: flex;
  flex-direction: column;
  z-index: 100;
  overflow: hidden;
}

.sidebar-logo {
  padding: var(--space-6) var(--space-6) var(--space-4);
  border-bottom: 1px solid rgba(255,255,255,0.10);
}

.sidebar-logo-wordmark {
  font-family: var(--font-display);
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--white);
  line-height: 1.2;
}

.sidebar-logo-sub {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.45);
  margin-top: 2px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) 0;
  overflow-y: auto;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 10px var(--space-5);
  color: var(--sidebar-text);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
  min-height: 44px;
  position: relative;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.sidebar-nav a:hover {
  background: var(--sidebar-hover);
  color: var(--white);
}

.sidebar-nav a.active {
  background: var(--sidebar-active);
  color: var(--white);
}

.sidebar-nav a.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--white);
  border-radius: 0 2px 2px 0;
}

.nav-icon {
  width: 18px;
  height: 18px;
  opacity: 0.75;
  flex-shrink: 0;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar-nav a:hover .nav-icon,
.sidebar-nav a.active .nav-icon {
  opacity: 1;
}

.sidebar-divider {
  height: 1px;
  background: rgba(255,255,255,0.10);
  margin: var(--space-3) var(--space-5);
}

.sidebar-footer {
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid rgba(255,255,255,0.10);
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.30);
}

/* Main content */

.main {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.page-header {
  padding: var(--space-8) var(--space-8) var(--space-6);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.page-title {
  font-family: var(--font-display);
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.25;
}

.page-subtitle {
  font-size: var(--text-sm);
  color: var(--text-quiet);
  margin-top: var(--space-1);
}

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

.page-body {
  padding: var(--space-8);
  flex: 1;
}

/* ============================================================
   CARDS
   ============================================================ */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
}

.card-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}

.card-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--ink);
}

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

.card-footer {
  padding: var(--space-4) var(--space-6);
  border-top: 1px solid var(--border);
  background: var(--blush-light);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Stat cards */

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-quiet);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-value {
  font-family: var(--font-display);
  font-size: var(--text-3xl);
  font-weight: 700;
  color: var(--ink);
  line-height: 1.1;
  margin-top: var(--space-2);
}

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

.stat-meta {
  font-size: var(--text-xs);
  color: var(--text-quiet);
  margin-top: var(--space-2);
}

/* ============================================================
   GRID HELPERS
   ============================================================ */

.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-5); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-5); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }

.grid-cols-main {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-6);
  align-items: start;
}

/* ============================================================
   BUTTONS
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: 0 var(--space-5);
  height: 40px;
  min-height: 44px;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  line-height: 1;
  border: none;
  border-radius: var(--radius-pill);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  position: relative;
  overflow: hidden;
  transition: background 0.2s var(--ease), box-shadow 0.2s var(--ease),
              transform 0.15s var(--ease), color 0.2s var(--ease);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}

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

.btn-primary:hover {
  background: var(--burgundy-deep);
  box-shadow: 0 4px 12px rgba(107,30,46,0.30);
  transform: translateY(-1px);
  color: var(--white);
  text-decoration: none;
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: none;
}

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

.btn-ghost:hover {
  background: var(--blush-light);
  color: var(--ink);
  border-color: var(--divider);
  text-decoration: none;
}

.btn-danger {
  background: var(--danger-faint);
  color: var(--danger);
  border: 1px solid rgba(192,57,43,0.20);
}

.btn-danger:hover {
  background: var(--danger);
  color: var(--white);
  text-decoration: none;
}

.btn-icon {
  width: 36px;
  height: 36px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-quiet);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s var(--ease), color 0.18s var(--ease);
}

.btn-icon:hover {
  background: var(--blush-light);
  color: var(--ink);
}

.btn-sm {
  height: 32px;
  min-height: 44px;
  padding: 0 var(--space-4);
  font-size: var(--text-xs);
}

.btn .spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(255,255,255,0.35);
  border-top-color: var(--white);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn-ghost .spinner,
.btn-danger .spinner {
  border-color: rgba(0,0,0,0.15);
  border-top-color: currentColor;
}

/* ============================================================
   BADGES
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  border-radius: var(--radius-pill);
  white-space: nowrap;
  line-height: 1.5;
}

/* Status */
.badge-active   { background: var(--burgundy-faint); color: var(--burgundy); }
.badge-pending  { background: var(--warning-faint);  color: var(--warning); }
.badge-alumni   { background: var(--rose-faint);     color: var(--rose); }
.badge-churned  { background: #F0F0F0;               color: #666; }

/* Cohort */
.badge-founding { background: var(--burgundy); color: var(--white); }
.badge-regular  { background: var(--blush);    color: var(--ink-mid); }

/* Note type */
.badge-general      { background: var(--blush);         color: var(--ink-mid); }
.badge-1on1         { background: var(--burgundy-faint); color: var(--burgundy); }
.badge-observation  { background: #EEF2FF;               color: #4338CA; }
.badge-introduction { background: #F0FDF4;               color: #166534; }
.badge-testimonial  { background: #FDF4FF;               color: #7C3AED; }
.badge-risk         { background: var(--danger-faint);   color: var(--danger); }

/* ============================================================
   FORMS
   ============================================================ */

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.form-label {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink-mid);
}

.form-label.required::after {
  content: ' *';
  color: var(--danger);
}

.form-input,
.form-select,
.form-textarea {
  width: 100%;
  padding: 10px var(--space-4);
  font-family: var(--font-body);
  font-size: var(--text-base);
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  min-height: 44px;
  appearance: none;
  -webkit-appearance: none;
  transition: border-color 0.18s var(--ease), box-shadow 0.18s var(--ease);
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus {
  outline: none;
  border-color: var(--burgundy);
  box-shadow: 0 0 0 3px rgba(107,30,46,0.12);
}

.form-input::placeholder,
.form-textarea::placeholder { color: var(--ink-light); }

.form-input.error,
.form-select.error,
.form-textarea.error {
  border-color: var(--danger);
  box-shadow: 0 0 0 3px rgba(192,57,43,0.10);
}

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

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238C6D5E' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: var(--space-10);
}

.form-hint  { font-size: var(--text-xs); color: var(--text-quiet); }
.form-error { font-size: var(--text-xs); color: var(--danger); display: flex; align-items: center; gap: 4px; }

.search-wrapper { position: relative; }

.search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-quiet);
  pointer-events: none;
  width: 16px;
  height: 16px;
}

.form-input.with-icon { padding-left: 36px; }

.checkbox-group {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  min-height: 44px;
}

.checkbox-input {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--burgundy);
  cursor: pointer;
}

.checkbox-label {
  font-size: var(--text-sm);
  color: var(--ink);
  cursor: pointer;
}

/* ============================================================
   TABLE
   ============================================================ */

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
}

thead th {
  padding: var(--space-3) var(--space-5);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-quiet);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  background: var(--blush-light);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td {
  padding: var(--space-4) var(--space-5);
  font-size: var(--text-sm);
  color: var(--ink);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

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

tbody tr {
  cursor: pointer;
  transition: background 0.15s var(--ease);
}

tbody tr:hover { background: var(--blush-light); }

/* ============================================================
   AVATAR
   ============================================================ */

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: var(--blush);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--burgundy);
  flex-shrink: 0;
  border: 1px solid var(--divider);
  overflow: hidden;
}

.avatar-lg  { width: 64px; height: 64px; font-size: var(--text-xl); }
.avatar-xl  { width: 88px; height: 88px; font-size: var(--text-2xl); }

.member-cell {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.member-cell-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--ink);
}

.member-cell-sub {
  font-size: var(--text-xs);
  color: var(--text-quiet);
  margin-top: 1px;
}

/* ============================================================
   PROGRESS
   ============================================================ */

.progress-bar {
  height: 6px;
  background: var(--blush);
  border-radius: var(--radius-pill);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: var(--burgundy);
  border-radius: var(--radius-pill);
  transition: width 0.4s var(--ease);
}

.progress-dots {
  display: flex;
  gap: 4px;
  align-items: center;
}

.progress-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--blush);
}

.progress-dot.done { background: var(--burgundy); }

/* ============================================================
   CHECKLIST
   ============================================================ */

.checklist {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.checklist-item {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  min-height: 44px;
  transition: background 0.15s var(--ease);
}

.checklist-item:hover { background: var(--blush-light); }

.checklist-item.completed { opacity: 0.60; }

.checklist-check {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--white);
  transition: border-color 0.18s var(--ease), background 0.18s var(--ease);
}

.checklist-check:hover { border-color: var(--burgundy); }

.checklist-item.completed .checklist-check {
  background: var(--burgundy);
  border-color: var(--burgundy);
}

.checklist-check svg {
  width: 10px;
  height: 10px;
  stroke: var(--white);
  display: none;
  fill: none;
  stroke-width: 2.5;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.checklist-item.completed .checklist-check svg { display: block; }

.checklist-text {
  flex: 1;
  font-size: var(--text-sm);
  color: var(--ink);
  line-height: 1.4;
  padding-top: 1px;
}

.checklist-item.completed .checklist-text {
  text-decoration: line-through;
  color: var(--text-quiet);
}

.checklist-ts {
  font-size: var(--text-xs);
  color: var(--text-quiet);
  white-space: nowrap;
  padding-top: 2px;
}

/* ============================================================
   NOTES LOG
   ============================================================ */

.notes-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

.note-item {
  padding: var(--space-4);
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: var(--surface);
}

.note-header {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}

.note-ts {
  font-size: var(--text-xs);
  color: var(--text-quiet);
  margin-left: auto;
}

.note-body {
  font-size: var(--text-sm);
  color: var(--ink);
  line-height: 1.6;
  white-space: pre-wrap;
}

/* ============================================================
   ALERTS
   ============================================================ */

.alert {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  line-height: 1.5;
}

.alert-info    { background: #EEF2FF; color: #4338CA; border: 1px solid #C7D2FE; }
.alert-success { background: var(--success-faint); color: var(--success); border: 1px solid #BBF7D0; }
.alert-warning { background: var(--warning-faint); color: var(--warning); border: 1px solid #FDE68A; }
.alert-danger  { background: var(--danger-faint);  color: var(--danger);  border: 1px solid #FECACA; }

/* ============================================================
   TAGS
   ============================================================ */

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  background: var(--blush);
  color: var(--ink-mid);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.tag-remove {
  width: 14px;
  height: 14px;
  min-width: 14px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink-light);
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s, color 0.15s;
}

.tag-remove:hover { background: var(--rose); color: var(--white); }

/* ============================================================
   MODAL
   ============================================================ */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28,20,16,0.50);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: var(--space-6);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s var(--ease);
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  transform: translateY(16px) scale(0.98);
  transition: transform 0.25s var(--ease);
}

.modal-overlay.open .modal {
  transform: translateY(0) scale(1);
}

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

.modal-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--ink);
}

.modal-close {
  width: 32px;
  height: 32px;
  min-width: 44px;
  min-height: 44px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-quiet);
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  transition: background 0.15s;
}

.modal-close:hover { background: var(--blush-light); }

.modal-body {
  padding: var(--space-6);
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: var(--space-5) var(--space-6);
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: var(--space-3);
}

/* ============================================================
   SLIDE-IN PANEL
   ============================================================ */

.panel-overlay {
  position: fixed;
  inset: 0;
  background: rgba(28,20,16,0.35);
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s var(--ease);
}

.panel-overlay.open {
  opacity: 1;
  pointer-events: auto;
}

.panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 480px;
  height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow-xl);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s var(--ease);
  z-index: 201;
}

.panel-overlay.open .panel {
  transform: translateX(0);
}

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

.panel-title {
  font-family: var(--font-display);
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--ink);
}

.panel-body {
  flex: 1;
  padding: var(--space-6);
  overflow-y: auto;
}

/* ============================================================
   AI OUTPUT
   ============================================================ */

.ai-output {
  background: var(--blush-light);
  border: 1px solid var(--divider);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--ink);
  white-space: pre-wrap;
}

.ai-label {
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  color: var(--text-quiet);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.ai-label::before {
  content: '✦';
  color: var(--rose);
  font-size: 10px;
}

/* ============================================================
   LOADING SKELETONS
   ============================================================ */

.skeleton {
  background: linear-gradient(90deg, var(--blush) 25%, var(--blush-light) 50%, var(--blush) 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text          { height: 14px; border-radius: 4px; }
.skeleton-text.short    { width: 40%; }
.skeleton-text.medium   { width: 65%; }
.skeleton-text.full     { width: 100%; }
.skeleton-avatar        { width: 36px; height: 36px; border-radius: 50%; }
.skeleton-badge         { width: 72px; height: 22px; border-radius: var(--radius-pill); }

.skeleton-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--border);
}

/* ============================================================
   EMPTY STATES
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-12) var(--space-8);
  text-align: center;
  gap: var(--space-3);
}

.empty-state-icon {
  width: 48px;
  height: 48px;
  color: var(--text-quiet);
  opacity: 0.4;
}

.empty-state-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--ink-mid);
}

.empty-state-body {
  font-size: var(--text-sm);
  color: var(--text-quiet);
  max-width: 320px;
  line-height: 1.6;
}

/* ============================================================
   ACTIVITY FEED
   ============================================================ */

.feed { display: flex; flex-direction: column; }

.feed-item {
  display: flex;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
  align-items: flex-start;
}

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

.feed-meta {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-wrap: wrap;
  margin-bottom: 4px;
}

.feed-name {
  font-weight: var(--weight-semibold);
  font-size: var(--text-sm);
  color: var(--ink);
}

.feed-ts {
  font-size: var(--text-xs);
  color: var(--text-quiet);
  margin-left: auto;
}

.feed-text {
  font-size: var(--text-sm);
  color: var(--text-secondary);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ============================================================
   SECTION / LAYOUT HELPERS
   ============================================================ */

.section { margin-bottom: var(--space-8); }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.section-title {
  font-size: var(--text-base);
  font-weight: var(--weight-semibold);
  color: var(--ink);
}

/* Collapsible */

.collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  padding: var(--space-4);
  border-radius: var(--radius-md);
  min-height: 44px;
  transition: background 0.15s;
}

.collapsible-header:hover { background: var(--blush-light); }

.collapsible-chevron {
  width: 16px;
  height: 16px;
  color: var(--text-quiet);
  flex-shrink: 0;
  transition: transform 0.2s var(--ease);
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.collapsible.open .collapsible-chevron { transform: rotate(180deg); }

.collapsible-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease);
}

.collapsible.open .collapsible-body { max-height: 2000px; }

/* Inline editable */

.field-editable {
  padding: var(--space-2) var(--space-3);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  min-height: 44px;
  display: flex;
  align-items: center;
  cursor: text;
  transition: border-color 0.15s, background 0.15s;
  font-size: var(--text-sm);
  color: var(--ink);
  line-height: 1.5;
  word-break: break-word;
}

.field-editable:hover {
  border-color: var(--border);
  background: var(--blush-light);
}

.field-editable.editing {
  border-color: var(--burgundy);
  background: var(--white);
  box-shadow: 0 0 0 3px rgba(107,30,46,0.10);
  cursor: auto;
}

/* ============================================================
   UTILITY
   ============================================================ */

.flex            { display: flex; }
.flex-col        { flex-direction: column; }
.items-center    { align-items: center; }
.items-start     { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-2           { gap: var(--space-2); }
.gap-3           { gap: var(--space-3); }
.gap-4           { gap: var(--space-4); }
.gap-6           { gap: var(--space-6); }

.text-xs       { font-size: var(--text-xs); }
.text-sm       { font-size: var(--text-sm); }
.text-quiet    { color: var(--text-quiet); }
.font-semibold { font-weight: var(--weight-semibold); }

.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }

.w-full  { width: 100%; }
.min-w-0 { min-width: 0; }

.divider {
  height: 1px;
  background: var(--border);
  margin: var(--space-5) 0;
}

.truncate {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

/* ============================================================
   ANIMATIONS
   ============================================================ */

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

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

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

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-8px); }
  40%       { transform: translateX(8px); }
  60%       { transform: translateX(-5px); }
  80%       { transform: translateX(5px); }
}

.animate-fade-in { animation: fade-in 0.3s var(--ease) both; }
.animate-shake   { animation: shake 0.4s var(--ease) both; }

/* ============================================================
   REDUCED MOTION
   ============================================================ */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0ms !important;
    transition-duration: 0ms !important;
  }
}

/* ============================================================
   RESPONSIVE (768px — iPad minimum)
   ============================================================ */

@media (max-width: 1024px) {
  .grid-4          { grid-template-columns: repeat(2, 1fr); }
  .grid-3          { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-main  { grid-template-columns: 1fr; }
  .panel           { width: 100%; }
}

@media (max-width: 768px) {
  :root { --sidebar-width: 0px; }

  .sidebar {
    display: none; /* mobile: collapse — add hamburger toggle if needed later */
  }

  .main { margin-left: 0; }

  .page-header {
    padding: var(--space-5);
    flex-direction: column;
    align-items: flex-start;
  }

  .page-body { padding: var(--space-5); }

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

  .modal { max-width: 100%; }
}

/* ============================================================
   AI EDITOR TOOLBAR
   ============================================================ */

.ai-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--ink);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  padding: 6px 10px;
  flex-wrap: wrap;
}

.ai-tb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 30px;
  height: 28px;
  padding: 0 6px;
  background: none;
  border: none;
  border-radius: 4px;
  color: rgba(255,255,255,0.80);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: var(--text-sm);
  line-height: 1;
  transition: background .12s, color .12s;
}

.ai-tb-btn:hover { background: rgba(255,255,255,0.14); color: #fff; }

.ai-tb-sep {
  display: inline-block;
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,0.18);
  margin: 0 4px;
  flex-shrink: 0;
}

.ai-tb-action {
  display: inline-flex;
  align-items: center;
  height: 26px;
  padding: 0 10px;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: var(--radius-pill);
  color: rgba(255,255,255,0.80);
  font-family: var(--font-body);
  font-size: var(--text-xs);
  font-weight: var(--weight-semibold);
  cursor: pointer;
  margin-left: 4px;
  transition: background .12s, color .12s;
}

.ai-tb-action:hover { background: rgba(255,255,255,0.20); color: #fff; }

.ai-tb-action.danger { color: #F4A4A4; border-color: rgba(244,164,164,0.30); }
.ai-tb-action.danger:hover { background: rgba(192,57,43,0.50); color: #fff; }

.ai-tb-saved {
  font-size: var(--text-xs);
  color: rgba(255,255,255,0.45);
  padding: 0 6px;
}

.ai-output-rich {
  border-radius: 0 0 var(--radius-md) var(--radius-md);
  border-top: none;
}

/* Note edit action button — pencil */

.note-action-btn:first-child:hover { background: var(--blush); color: var(--burgundy); }

/* ============================================================
   MOBILE BOTTOM NAV
   ============================================================ */

.mobile-nav {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: var(--burgundy);
  z-index: 300;
  border-top: 1px solid rgba(255,255,255,0.15);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.mobile-nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  color: rgba(255,255,255,0.55);
  font-size: 10px;
  font-weight: 600;
  text-decoration: none;
  padding: 8px 0;
  letter-spacing: 0.03em;
  transition: color 0.15s var(--ease);
  min-height: 44px;
}

.mobile-nav-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}

.mobile-nav-item.active { color: #fff; }

.mobile-nav-item:hover { color: rgba(255,255,255,0.85); text-decoration: none; }

@media (max-width: 768px) {
  .mobile-nav { display: flex; }
  body { padding-bottom: 60px; }
}

/* ============================================================
   AI HISTORY ACCORDION
   ============================================================ */

.ai-history { display: flex; flex-direction: column; gap: .5rem; margin-top: 1rem; }

.ai-history-item {
  border: 1px solid var(--divider);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--white);
}

.ai-history-toggle {
  display: flex;
  align-items: center;
  gap: .625rem;
  width: 100%;
  padding: .75rem 1rem;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--font-body);
  min-height: 44px;
  transition: background .15s;
}

.ai-history-toggle:hover { background: var(--blush-light); }

.ai-history-label {
  flex: 1;
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink);
}

.ai-history-meta {
  font-size: var(--text-xs);
  color: var(--text-quiet);
  white-space: nowrap;
}

.ai-history-chevron {
  width: 14px;
  height: 14px;
  color: var(--text-quiet);
  flex-shrink: 0;
  transition: transform 0.2s var(--ease);
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.ai-history-item.open .ai-history-chevron { transform: rotate(180deg); }

.ai-history-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s var(--ease);
}

.ai-history-item.open .ai-history-body { max-height: 4000px; }

.ai-history-content-wrap { padding: .75rem 1rem 1rem; border-top: 1px solid var(--border); }

/* Rich text output — rendered markdown */

.ai-output-rich {
  background: var(--blush-light);
  border: 1px solid var(--divider);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  font-size: var(--text-sm);
  line-height: 1.7;
  color: var(--ink);
  min-height: 60px;
  outline: none;
  cursor: text;
}

.ai-output-rich:focus {
  border-color: var(--burgundy);
  box-shadow: 0 0 0 3px rgba(107,30,46,0.10);
}

.ai-output-rich h3 {
  font-family: var(--font-display);
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--ink);
  margin: 1rem 0 .375rem;
  line-height: 1.3;
}

.ai-output-rich h4 {
  font-size: var(--text-sm);
  font-weight: var(--weight-semibold);
  color: var(--ink);
  margin: .875rem 0 .25rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-size: var(--text-xs);
  color: var(--text-quiet);
}

.ai-output-rich p { margin: .5rem 0; }

.ai-output-rich ul {
  margin: .5rem 0 .5rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.ai-output-rich li { line-height: 1.6; }

.ai-output-rich strong { font-weight: var(--weight-semibold); color: var(--ink); }

.ai-output-rich em { font-style: italic; color: var(--ink-mid); }

/* Floating rich-text toolbar */

.rt-toolbar {
  display: none;
  position: fixed;
  background: var(--ink);
  border-radius: var(--radius-md);
  padding: 4px 6px;
  gap: 2px;
  z-index: 500;
  box-shadow: var(--shadow-md);
  align-items: center;
}

.rt-toolbar.visible { display: flex; }

.rt-toolbar-btn {
  width: 28px;
  height: 28px;
  background: none;
  border: none;
  border-radius: 4px;
  color: rgba(255,255,255,0.85);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .12s, color .12s;
}

.rt-toolbar-btn:hover { background: rgba(255,255,255,0.15); color: #fff; }

.rt-toolbar-sep {
  width: 1px;
  height: 16px;
  background: rgba(255,255,255,0.2);
  margin: 0 2px;
}

/* Note actions */

.note-actions {
  display: flex;
  align-items: center;
  gap: .375rem;
  margin-left: auto;
  opacity: 0;
  transition: opacity .15s;
}

.note-item:hover .note-actions { opacity: 1; }

.note-action-btn {
  width: 24px;
  height: 24px;
  background: none;
  border: none;
  cursor: pointer;
  border-radius: 4px;
  color: var(--text-quiet);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background .12s, color .12s;
}

.note-action-btn:hover { background: var(--danger-faint); color: var(--danger); }
