/* ====================================================
   DoubleWriting — Design System
   ==================================================== */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ── Tokens ─────────────────────────────────────────── */
:root {
  /* Brand */
  --green-50:  #f0f7f2;
  --green-100: #d8edd9;
  --green-200: #b0dab4;
  --green-500: #3a8a3d;
  --green-700: #2c5f2d;
  --green-900: #1a3a1b;

  /* Semantic */
  --primary:        var(--green-700);
  --primary-hover:  var(--green-900);
  --primary-light:  var(--green-50);
  --primary-mid:    var(--green-100);

  /* Surface */
  --bg:      #f7f6f3;
  --surface: #ffffff;
  --surface-raised: #fdfcfa;

  /* Text */
  --text:        #111827;
  --text-muted:  #6b7280;
  --text-subtle: #9ca3af;

  /* Border */
  --border:       #e5e7eb;
  --border-strong: #d1d5db;

  /* Feedback */
  --red:    #dc2626;
  --red-bg: #fef2f2;
  --amber:  #d97706;
  --amber-bg: #fffbeb;

  /* Misc */
  --radius:   10px;
  --radius-lg: 14px;
  --radius-sm: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
  --shadow:    0 1px 4px rgba(0,0,0,0.06), 0 2px 8px rgba(0,0,0,0.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.08), 0 1px 4px rgba(0,0,0,0.04);
  --max-w: 960px;
}

/* ── Reset ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-font-smoothing: antialiased; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: none; }
img { max-width: 100%; }

/* ── Navbar ──────────────────────────────────────────── */
.navbar {
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  position: sticky;
  top: 0;
  z-index: 200;
  height: 58px;
  display: flex;
  align-items: center;
}
.nav-container {
  max-width: var(--max-w);
  margin: 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.nav-brand {
  font-size: 1.1rem;
  font-weight: 800;
  color: var(--primary);
  letter-spacing: -0.02em;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.nav-brand:hover { opacity: 0.85; }
.nav-links { display: flex; align-items: center; gap: 0.5rem; }
.nav-greeting {
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  padding: 0 0.5rem;
}

/* ── Buttons ─────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.48rem 1.1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.14s ease;
  white-space: nowrap;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }

.btn-outline {
  background: transparent;
  color: var(--primary);
  border-color: var(--border-strong);
}
.btn-outline:hover { background: var(--green-50); border-color: var(--primary); }

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

.btn-danger {
  background: transparent;
  color: var(--red);
  border-color: #fca5a5;
}
.btn-danger:hover { background: var(--red-bg); border-color: var(--red); }

.btn-lg  { padding: 0.7rem 1.75rem; font-size: 1rem; border-radius: var(--radius); }
.btn-sm  { padding: 0.32rem 0.8rem; font-size: 0.8rem; }
.btn-xs  { padding: 0.22rem 0.6rem; font-size: 0.75rem; }
.btn-full { width: 100%; }

/* ── Notification bell ───────────────────────────────── */
.notif-btn {
  position: relative;
  padding: 0.4rem 0.65rem;
  font-size: 1rem;
  line-height: 1;
}
.notif-badge {
  position: absolute;
  top: -4px; right: -4px;
  background: var(--red);
  color: #fff;
  border-radius: 20px;
  min-width: 18px; height: 18px;
  font-size: 0.65rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  border: 2px solid var(--surface);
}

/* ── Container ───────────────────────────────────────── */
.container {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: 2rem 1.5rem;
  flex: 1;
}

/* ── Cards ───────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}
.card-panel h3 {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-subtle);
  margin-bottom: 1rem;
}

/* ── Section headers ─────────────────────────────────── */
.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.page-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.friends-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.friends-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* ── Forms ───────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.35rem; }
.form-group label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"] {
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--green-100);
}
.form-group input::placeholder { color: var(--text-subtle); }

.error-msg {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.875rem;
  color: var(--red);
  background: var(--red-bg);
  border: 1px solid #fca5a5;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
}
.success-msg {
  font-size: 0.875rem;
  color: #065f46;
  background: #d1fae5;
  border: 1px solid #6ee7b7;
  border-radius: var(--radius-sm);
  padding: 0.55rem 0.9rem;
}
.auth-alt {
  text-align: center;
  margin-top: 1.25rem;
  font-size: 0.875rem;
  color: var(--text-muted);
}

/* ── Auth pages ──────────────────────────────────────── */
.auth-section {
  max-width: 400px;
  margin: 3rem auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2rem 2rem 1.75rem;
  box-shadow: var(--shadow-md);
}
.auth-section h2 {
  font-size: 1.5rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 0.4rem;
}
.auth-section > p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}
.auth-form { display: flex; flex-direction: column; gap: 1rem; }

/* ── Hero ────────────────────────────────────────────── */
.hero {
  text-align: center;
  padding: 4rem 1rem 3rem;
}
.hero h1 {
  font-size: 3rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 1.1rem;
  color: var(--text);
}
.hero-sub {
  font-size: 1.1rem;
  color: var(--text-muted);
  max-width: 520px;
  margin: 0 auto 2rem;
  line-height: 1.7;
}
.hero-actions { display: flex; justify-content: center; gap: 0.75rem; flex-wrap: wrap; }

/* ── Features ────────────────────────────────────────── */
.features {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 1rem;
  padding: 1.5rem 0 2rem;
}
.feature-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.15s, transform 0.15s;
}
.feature-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.feature-card h3 { font-size: 1rem; font-weight: 700; margin-bottom: 0.5rem; }
.feature-card p { font-size: 0.875rem; color: var(--text-muted); line-height: 1.6; }

/* ── Visibility table ────────────────────────────────── */
.how-it-works { padding: 1rem 0 2rem; }
.how-it-works h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: -0.02em;
}
.vis-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}
.vis-table th, .vis-table td {
  padding: 0.75rem 1rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  font-size: 0.875rem;
}
.vis-table th {
  background: var(--green-50);
  font-weight: 700;
  font-size: 0.8rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--primary);
}
.vis-table td:first-child, .vis-table th:first-child { text-align: left; }
.vis-table tr:last-child td { border-bottom: none; }

/* ── Dashboard ───────────────────────────────────────── */
.loading-msg {
  text-align: center;
  padding: 4rem;
  color: var(--text-subtle);
  font-size: 0.9rem;
}
.dash-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.75rem;
  flex-wrap: wrap;
  gap: 0.75rem;
}
.dash-header h2 {
  font-size: 1.4rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}

/* Stats row */
.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
}
.stat-num {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--primary);
  line-height: 1;
  margin-bottom: 0.25rem;
}
.stat-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-subtle);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ── Calendar ────────────────────────────────────────── */
.calendar-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
  margin-bottom: 1.25rem;
  box-shadow: var(--shadow-sm);
}
.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.9rem;
}
.calendar-nav h3 {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.cal-day-name {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--text-subtle);
  padding: 0.25rem 0;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.cal-day {
  text-align: center;
  font-size: 0.82rem;
  padding: 0.3rem 0.15rem;
  border-radius: var(--radius-sm);
  cursor: default;
  transition: background 0.1s;
  font-weight: 500;
  color: var(--text-muted);
}
.cal-day.empty { opacity: 0; }
.cal-day.has-entry {
  background: var(--green-100);
  color: var(--primary);
  font-weight: 700;
  cursor: pointer;
}
.cal-day.has-entry:hover { background: var(--primary); color: #fff; }
.cal-day.today {
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}
.cal-day.today.has-entry { background: var(--green-900); }

/* ── Entry list ──────────────────────────────────────── */
.entry-list { display: flex; flex-direction: column; gap: 0.6rem; }
.entry-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  cursor: pointer;
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
  text-decoration: none;
  color: inherit;
}
.entry-card:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}
.entry-card-body { flex: 1; min-width: 0; }
.entry-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text);
}
.entry-card-preview {
  font-size: 0.83rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.entry-card-meta {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.35rem;
  flex-shrink: 0;
}
.entry-date {
  font-size: 0.75rem;
  color: var(--text-subtle);
  white-space: nowrap;
  font-weight: 500;
}

/* Vis badges */
.vis-badge {
  font-size: 0.68rem;
  font-weight: 700;
  padding: 0.15rem 0.55rem;
  border-radius: 20px;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.vis-private  { background: #f3f4f6; color: var(--text-subtle); }
.vis-guide    { background: #dbeafe; color: #1d4ed8; }
.vis-observer { background: #fef3c7; color: #92400e; }
.vis-both     { background: var(--green-100); color: var(--primary); }

/* ── Empty states ────────────────────────────────────── */
.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-subtle);
  font-size: 0.9rem;
  line-height: 1.6;
}
.empty-state-icon {
  font-size: 2rem;
  margin-bottom: 0.5rem;
  opacity: 0.5;
}

/* ── Writing editor ──────────────────────────────────── */
/* ── Editor (note card style) ────────────────────────── */
.editor-page { max-width: 720px; margin: 0 auto; }

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

.note-card-meta {
  padding: 0.75rem 1.5rem 0;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-subtle);
  letter-spacing: 0.01em;
}

.entry-title-input {
  width: 100%;
  font-size: 1.65rem;
  font-weight: 800;
  border: none;
  background: transparent;
  padding: 0.6rem 1.5rem 0.2rem;
  color: var(--text);
  outline: none;
  font-family: inherit;
  letter-spacing: -0.025em;
  line-height: 1.3;
  /* Override browser autofill coloring */
  -webkit-box-shadow: 0 0 0 100px var(--surface) inset !important;
  box-shadow: 0 0 0 100px var(--surface) inset !important;
  -webkit-text-fill-color: var(--text) !important;
}
.entry-title-input::placeholder { color: var(--border-strong); }

.entry-body-input {
  width: 100%;
  min-height: 380px;
  padding: 0.75rem 1.5rem 1.5rem;
  font-size: 1rem;
  line-height: 1.85;
  font-family: 'Georgia', 'Times New Roman', serif;
  background: transparent;
  border: none;
  resize: vertical;
  outline: none;
  color: var(--text);
  display: block;
  -webkit-box-shadow: 0 0 0 100px var(--surface) inset !important;
  box-shadow: 0 0 0 100px var(--surface) inset !important;
  -webkit-text-fill-color: var(--text) !important;
}
.entry-body-input::placeholder { color: var(--text-subtle); font-style: italic; font-family: inherit; }

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

.note-card-toolbar {
  padding: 0.85rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  background: var(--surface-raised);
}

.toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.toolbar-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-subtle);
  white-space: nowrap;
}

.toolbar-select {
  padding: 0.3rem 0.65rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color 0.13s;
}
.toolbar-select:focus { border-color: var(--primary); }

.vis-options { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.vis-option input[type="radio"] { display: none; }
.vis-option-card {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: 20px;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  transition: all 0.13s;
  color: var(--text-muted);
}
.vis-option-card:hover { border-color: var(--primary); background: var(--green-50); color: var(--primary); }
.vis-option input[type="radio"]:checked + .vis-option-card {
  border-color: var(--primary);
  background: var(--green-50);
  color: var(--primary);
  font-weight: 600;
}
.vis-icon { font-size: 0.85rem; }

.toolbar-spacer { flex: 1; }

.editor-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

/* Legacy vis-selector (used in entry-edit) */
.vis-selector { margin: 1.25rem 0; }
.vis-selector .vis-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-subtle);
  margin-bottom: 0.6rem;
}

/* Body display (read-only view) */
.lined-paper-view {
  width: 100%;
  min-height: 200px;
  padding: 1rem 0;
  font-size: 1rem;
  line-height: 1.85;
  font-family: 'Georgia', 'Times New Roman', serif;
  white-space: pre-wrap;
  word-wrap: break-word;
  color: var(--text);
}

/* ── Entry view ──────────────────────────────────────── */
.entry-view-page { max-width: 700px; margin: 0 auto; }
.entry-view-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.entry-view-header { margin-bottom: 1.5rem; }
.entry-view-title {
  font-size: 1.75rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.25;
}
.entry-view-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

/* Feedback */
.feedback-section { margin-top: 2.5rem; padding-top: 1.5rem; border-top: 1px solid var(--border); }
.feedback-section h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 1rem;
  letter-spacing: -0.01em;
}
.feedback-list { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1.25rem; }
.feedback-item {
  background: var(--surface-raised);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 0.9rem 1.1rem;
}
.feedback-item-header {
  font-size: 0.78rem;
  color: var(--text-subtle);
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.feedback-body {
  font-size: 0.925rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}
.feedback-textarea {
  width: 100%;
  min-height: 100px;
  padding: 0.65rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  margin-bottom: 0.6rem;
}
.feedback-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--green-100);
}
.feedback-form-card {
  background: var(--green-50);
  border: 1.5px solid var(--green-100);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-top: 0.5rem;
}
.feedback-edit-area {
  width: 100%;
  min-height: 80px;
  padding: 0.5rem 0.7rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  resize: vertical;
  margin-top: 0.4rem;
}
.feedback-edit-area:focus { outline: none; border-color: var(--primary); }

/* ── Friends & People ────────────────────────────────── */
.search-section { }
.search-row { display: flex; gap: 0.5rem; }
.search-row input {
  flex: 1;
  padding: 0.62rem 0.9rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.search-row input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--green-100); }
.search-results { margin-top: 0.75rem; display: flex; flex-direction: column; gap: 0.4rem; }

.person-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  transition: border-color 0.13s, background 0.13s;
}
.person-row:hover { border-color: var(--border-strong); background: var(--surface-raised); }
.person-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--green-100);
  color: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  flex-shrink: 0;
}
.person-info { flex: 1; min-width: 0; }
.person-name { font-weight: 600; font-size: 0.9rem; color: var(--text); }
.person-sub { font-size: 0.78rem; color: var(--text-subtle); margin-top: 0.05rem; }
.person-actions { display: flex; gap: 0.4rem; flex-shrink: 0; flex-wrap: wrap; align-items: center; }
.pending-label { font-size: 0.78rem; color: var(--text-subtle); font-style: italic; }

/* ── Projects ────────────────────────────────────────── */
.projects-page { max-width: 680px; margin: 0 auto; }
.project-card {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  padding: 1rem 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.14s;
  text-decoration: none;
  color: inherit;
  margin-bottom: 0.6rem;
}
.project-card:hover { border-color: var(--primary); box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; color: inherit; }
.project-icon { font-size: 1.5rem; flex-shrink: 0; margin-top: 0.1rem; }
.project-body { flex: 1; min-width: 0; }
.project-name { font-weight: 700; font-size: 0.95rem; margin-bottom: 0.2rem; }
.project-meta { font-size: 0.8rem; color: var(--text-muted); }
.project-code {
  font-size: 0.78rem;
  background: var(--green-100);
  color: var(--primary);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-family: 'SF Mono', 'Fira Code', monospace;
  font-weight: 700;
  margin-left: 0.35rem;
  cursor: copy;
  letter-spacing: 0.05em;
}
.role-badge-teacher { background: #dbeafe; color: #1d4ed8; border-radius: 20px; padding: 0.12rem 0.55rem; font-size: 0.72rem; font-weight: 700; margin-left: 0.35rem; }
.role-badge-student { background: var(--green-100); color: var(--primary); border-radius: 20px; padding: 0.12rem 0.55rem; font-size: 0.72rem; font-weight: 700; margin-left: 0.35rem; }

/* Project view */
.project-entry-card {
  padding: 0.8rem 1rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 0.5rem;
  background: var(--surface);
  transition: border-color 0.14s, transform 0.14s;
}
.project-entry-card:hover { border-color: var(--primary); transform: translateY(-1px); }
.project-entry-title { font-weight: 700; font-size: 0.9rem; }
.project-entry-meta  { font-size: 0.78rem; color: var(--text-muted); margin-top: 0.12rem; }
.project-entry-preview { font-size: 0.83rem; color: var(--text-muted); margin-top: 0.18rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.member-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  transition: background 0.12s;
}
.member-row:hover { background: var(--green-50); }
.role-badge-owner { background: #fef3c7; color: #92400e; border-radius: 20px; padding: 0.12rem 0.55rem; font-size: 0.72rem; font-weight: 700; }

/* ── Notifications ───────────────────────────────────── */
.notifications-page { max-width: 640px; margin: 0 auto; }
.notif-item {
  display: flex;
  gap: 0.75rem;
  align-items: flex-start;
  padding: 0.9rem 1.1rem;
  border: 1px solid var(--border);
  border-left: 3px solid transparent;
  border-radius: var(--radius-sm);
  background: var(--surface);
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: border-color 0.13s, border-left-color 0.13s, background 0.13s;
}
.notif-item:hover { border-color: var(--border-strong); background: var(--surface-raised); }
.notif-item.unread { border-left-color: var(--primary); background: var(--green-50); }
.notif-icon { font-size: 1.2rem; flex-shrink: 0; }
.notif-body { flex: 1; min-width: 0; }
.notif-title { font-weight: 600; font-size: 0.9rem; }
.notif-text { font-size: 0.85rem; color: var(--text-muted); margin-top: 0.15rem; word-break: break-word; }
.notif-meta { font-size: 0.75rem; color: var(--text-subtle); margin-top: 0.2rem; }
.unread-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--primary);
  flex-shrink: 0;
  margin-top: 0.5rem;
}

/* ── Toast ───────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 0.65rem 1.4rem;
  border-radius: 30px;
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 999;
  opacity: 0;
  transition: opacity 0.25s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { opacity: 1; }

/* ── Footer ──────────────────────────────────────────── */
.footer {
  text-align: center;
  padding: 1.25rem;
  font-size: 0.8rem;
  color: var(--text-subtle);
  border-top: 1px solid var(--border);
  margin-top: auto;
}

/* ── Utilities ───────────────────────────────────────── */
.text-muted { color: var(--text-muted); }
.text-subtle { color: var(--text-subtle); }
.divider { border: none; border-top: 1px solid var(--border); margin: 1rem 0; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
  .hero h1 { font-size: 2rem; }
  .hero-sub { font-size: 1rem; }
  .dash-stats { grid-template-columns: repeat(3, 1fr); gap: 0.5rem; }
  .stat-num { font-size: 1.4rem; }
  .navbar { padding: 0 1rem; }
  .container { padding: 1.25rem 1rem; }
  .auth-section { margin: 1.5rem auto; padding: 1.5rem; }
  .entry-view-title { font-size: 1.5rem; }
  .vis-options { flex-direction: column; }
  .editor-actions { flex-direction: column; }
  .nav-greeting { display: none; }
}
@media (max-width: 480px) {
  .dash-stats { grid-template-columns: 1fr; }
}
