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

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

:root {
  --bg-base:       #0E0E0D;
  --bg-surface:    #161614;
  --bg-elevated:   #1D1D1B;
  --border:        #272724;
  --border-hover:  #363633;
  --accent:        #C8A96E;
  --accent-hover:  #D9BC8A;
  --accent-dim:    rgba(200, 169, 110, 0.10);
  --text-primary:  #EDE8DC;
  --text-secondary:#8A857A;
  --text-muted:    #565350;
  --danger:        #BF5050;
  --info:          #4E8FC0;
  --success:       #4E9B6E;
  --warning:       #C08040;

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

  --font-heading: 'DM Serif Display', Georgia, serif;
  --font-body:    'DM Sans', system-ui, sans-serif;

  --transition: 150ms ease;
}

html, body {
  height: 100%;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text-primary);
  background: var(--bg-base);
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, textarea, select { font-family: inherit; }

/* ─── Login Page ────────────────────────────────────────── */

.login-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-base);
}

.login-wordmark {
  position: fixed;
  top: 28px;
  left: 32px;
  font-family: var(--font-heading);
  font-size: 28px;
  color: var(--accent);
  letter-spacing: -0.02em;
}

.login-center {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
}

.login-card h1 {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.login-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 6px;
  margin-bottom: 2rem;
}

.form-group {
  margin-bottom: 1rem;
}

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 6px;
}

.form-input {
  width: 100%;
  height: 44px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  transition: border-color var(--transition);
}

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

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

.form-textarea {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  resize: vertical;
  min-height: 80px;
  transition: border-color var(--transition);
  line-height: 1.5;
}

.form-textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

.form-textarea::placeholder {
  color: var(--text-muted);
}

.form-select {
  width: 100%;
  height: 44px;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0 14px;
  font-size: 14px;
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238A857A' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  cursor: pointer;
}

.form-select:focus {
  border-color: var(--accent);
}

.form-select option {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

.btn-primary {
  width: 100%;
  height: 44px;
  background: var(--accent);
  color: #111110;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background var(--transition);
  margin-top: 1.25rem;
}

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

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-outline {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

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

.btn-outline.full-width {
  width: 100%;
}

.btn-danger {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  padding: 0 12px;
  background: transparent;
  border: 1px solid rgba(191, 80, 80, 0.3);
  border-radius: var(--radius-md);
  color: var(--danger);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition);
}

.btn-danger:hover {
  background: rgba(191, 80, 80, 0.08);
  border-color: rgba(191, 80, 80, 0.5);
}

.btn-save {
  height: 36px;
  padding: 0 18px;
  background: var(--accent);
  color: #111110;
  font-weight: 600;
  font-size: 13px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background var(--transition);
}

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

.btn-cancel {
  height: 36px;
  padding: 0 14px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

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

.login-error {
  display: none;
  font-size: 13px;
  color: var(--danger);
  margin-top: 0.75rem;
  text-align: center;
}

.login-error.visible { display: block; }

/* ─── Dashboard Layout ─────────────────────────────────── */

.dashboard {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ─── Sidebar ──────────────────────────────────────────── */

.sidebar {
  width: 240px;
  flex-shrink: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.sidebar-top {
  padding: 24px 20px 16px;
}

.sidebar-wordmark {
  font-family: var(--font-heading);
  font-size: 26px;
  color: var(--accent);
  letter-spacing: -0.02em;
  line-height: 1;
}

.sidebar-project-name {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

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

.sidebar-nav {
  flex: 1;
  padding: 12px 12px;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
  border-left: 2px solid transparent;
  margin-bottom: 2px;
  user-select: none;
}

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

.nav-item.active {
  background: var(--accent-dim);
  color: var(--accent);
  border-left-color: var(--accent);
}

.nav-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.7;
}

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

.nav-badge {
  margin-left: auto;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
  box-shadow: 0 0 0 2px var(--bg-base);
}

.nav-badge.hidden { display: none; }

.sidebar-bottom {
  padding: 16px 20px;
  border-top: 1px solid var(--border);
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.role-badge {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: var(--radius-pill);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-top: 2px;
}

.role-badge.dev {
  background: rgba(78, 143, 192, 0.18);
  color: var(--info);
}

.role-badge.client {
  background: rgba(200, 169, 110, 0.18);
  color: var(--accent);
}

.btn-logout {
  width: 100%;
  height: 34px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  cursor: pointer;
  transition: border-color var(--transition), color var(--transition);
}

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

/* ─── Main Content ─────────────────────────────────────── */

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--bg-base);
}

.top-bar {
  height: 60px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
  flex-shrink: 0;
  background: var(--bg-surface);
}

.top-bar-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.02em;
}

.top-bar-meta {
  font-size: 12px;
  color: var(--text-muted);
}

.content-area {
  flex: 1;
  overflow-y: auto;
  padding: 32px;
}

/* ─── Overview ─────────────────────────────────────────── */

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}

.metric-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.metric-value {
  font-family: var(--font-heading);
  font-size: 32px;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 8px;
}

.metric-label {
  font-size: 11px;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
}

.progress-bar-wrap {
  background: var(--bg-elevated);
  border-radius: 3px;
  height: 6px;
  margin-bottom: 28px;
  overflow: hidden;
}

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

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

.section-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.section-card-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 1rem;
}

/* ─── Activity Feed ────────────────────────────────────── */

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

.activity-item {
  display: flex;
  gap: 12px;
  min-height: 0;
}

.activity-spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 20px;
}

.activity-dot {
  font-size: 13px;
  line-height: 1;
  flex-shrink: 0;
  margin-top: 1px;
}

.activity-line {
  width: 1px;
  background: var(--border);
  flex: 1;
  min-height: 12px;
  margin: 4px 0;
}

.activity-body {
  padding-bottom: 14px;
  flex: 1;
  min-width: 0;
}

.activity-detail {
  font-size: 12.5px;
  color: var(--text-secondary);
  line-height: 1.45;
  word-break: break-word;
}

.activity-time {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}

/* ─── Task Board ───────────────────────────────────────── */

.board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  align-items: start;
}

.kanban-col {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

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

.kanban-col-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
}

.count-badge {
  background: var(--bg-elevated);
  color: var(--text-secondary);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  font-weight: 500;
}

.kanban-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 60px;
}

.task-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}

.task-card:hover {
  border-color: var(--border-hover);
  transform: translateY(-1px);
}

.task-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 10px;
}

.task-card-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.type-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
}

.type-feature  { background: rgba(78, 143, 192, 0.12); color: var(--info); }
.type-automation { background: rgba(78, 155, 110, 0.12); color: var(--success); }
.type-bug      { background: rgba(191, 80, 80, 0.12); color: var(--danger); }
.type-milestone { background: rgba(192, 128, 64, 0.12); color: var(--warning); }

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

.priority-high   { background: var(--danger); }
.priority-medium { background: var(--warning); }
.priority-low    { background: var(--success); }

.comment-count {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
}

.comment-count svg {
  width: 12px;
  height: 12px;
}

.add-task-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  color: var(--text-muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: var(--radius-sm);
  transition: color var(--transition), background var(--transition);
  border: none;
  background: none;
}

.add-task-btn:hover {
  color: var(--accent);
  background: var(--accent-dim);
}

.inline-form {
  border-top: 1px solid var(--border);
  padding: 12px;
  background: var(--bg-base);
}

.inline-form-row {
  display: flex;
  gap: 8px;
  margin-top: 8px;
}

.inline-form-actions {
  display: flex;
  gap: 8px;
  margin-top: 10px;
  justify-content: flex-end;
}

.field-error {
  font-size: 11px;
  color: var(--danger);
  margin-top: 4px;
}

/* ─── Weekly Updates ───────────────────────────────────── */

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.update-cards {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.update-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
}

.update-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 1.25rem;
}

.update-week-label {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.update-date {
  font-size: 12px;
  color: var(--text-secondary);
}

.update-sections {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.update-section {
  padding-left: 16px;
  border-left: 2px solid var(--border);
}

.update-section.completed { border-left-color: var(--success); }
.update-section.in-progress { border-left-color: var(--info); }
.update-section.blocked { border-left-color: var(--danger); }
.update-section.next-week { border-left-color: var(--warning); }

.update-section-title {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.update-section.completed .update-section-title { color: var(--success); }
.update-section.in-progress .update-section-title { color: var(--info); }
.update-section.blocked .update-section-title { color: var(--danger); }
.update-section.next-week .update-section-title { color: var(--warning); }

.update-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.update-bullets li {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.5;
  display: flex;
  gap: 8px;
}

.update-bullets li::before {
  content: '·';
  flex-shrink: 0;
  color: var(--text-muted);
}

/* ─── Staging Links ────────────────────────────────────── */

.staging-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

.staging-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: relative;
}

.staging-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
}

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

.version-badge {
  font-size: 11px;
  font-weight: 500;
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent-dim);
  color: var(--accent);
}

.staging-url {
  font-family: 'SF Mono', 'Fira Mono', monospace;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 8px;
}

.staging-note {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 14px;
}

.staging-delete {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 24px;
  height: 24px;
  background: transparent;
  border: 1px solid rgba(191, 80, 80, 0.2);
  border-radius: var(--radius-sm);
  color: var(--danger);
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--transition), border-color var(--transition);
  line-height: 1;
}

.staging-delete:hover {
  background: rgba(191, 80, 80, 0.1);
  border-color: rgba(191, 80, 80, 0.4);
}

.add-link-form {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 20px;
}

.add-link-form h4 {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}

.form-group-sm label {
  display: block;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 5px;
}

/* ─── Milestones ───────────────────────────────────────── */

.milestone-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.milestone-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  position: relative;
  transition: border-left-color var(--transition);
}

.milestone-card.status-ready   { border-left-color: var(--info); }
.milestone-card.status-signed  { border-left-color: var(--success); }

.milestone-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 8px;
}

.milestone-name {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

.milestone-amount {
  font-family: var(--font-heading);
  font-size: 18px;
  color: var(--accent);
  letter-spacing: -0.01em;
  white-space: nowrap;
  margin-left: 16px;
}

.milestone-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  padding: 3px 9px;
  border-radius: var(--radius-pill);
  margin-bottom: 10px;
}

.milestone-status-badge.pending  { background: var(--bg-elevated); color: var(--text-secondary); }
.milestone-status-badge.ready    { background: rgba(78, 143, 192, 0.12); color: var(--info); }
.milestone-status-badge.signed   { background: rgba(78, 155, 110, 0.12); color: var(--success); }

.milestone-description {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin-bottom: 16px;
}

.milestone-signoff-btn {
  width: 100%;
  height: 44px;
  background: var(--accent);
  color: #111110;
  font-weight: 600;
  font-size: 14px;
  border-radius: var(--radius-md);
  border: none;
  cursor: pointer;
  transition: background var(--transition);
}

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

.signed-info {
  font-size: 13px;
  color: var(--success);
  display: flex;
  align-items: center;
  gap: 6px;
}

.signed-info::before {
  content: '✓';
  font-weight: 700;
}

.milestone-actions {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
}

/* ─── Task Modal ───────────────────────────────────────── */

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
  backdrop-filter: blur(2px);
}

.modal-overlay.hidden { display: none; }

.modal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 540px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.modal-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  line-height: 1.3;
  flex: 1;
  margin-right: 12px;
}

.modal-close {
  width: 28px;
  height: 28px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: color var(--transition), border-color var(--transition);
}

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

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.modal-badges {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.status-select {
  height: 28px;
  font-size: 11px;
  padding: 0 24px 0 8px;
  background: var(--bg-base);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238A857A' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 8px center;
  cursor: pointer;
  font-family: var(--font-body);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

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

.task-description-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 8px;
}

.task-description-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  white-space: pre-wrap;
}

.task-description-empty {
  font-size: 14px;
  color: var(--text-muted);
  font-style: italic;
}

.comments-section { margin-top: 4px; }

.comments-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 12px;
}

.comments-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 16px;
}

.comment-item {
  padding: 12px;
  border-radius: var(--radius-md);
  background: var(--bg-base);
  border: 1px solid var(--border);
}

.comment-item:nth-child(even) {
  background: var(--bg-surface);
}

.comment-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 6px;
}

.comment-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.comment-avatar.dev    { background: rgba(78, 143, 192, 0.2); color: var(--info); }
.comment-avatar.client { background: rgba(200, 169, 110, 0.2); color: var(--accent); }

.comment-author { font-size: 13px; font-weight: 500; color: var(--text-primary); }
.comment-time   { font-size: 11px; color: var(--text-muted); margin-left: auto; }
.comment-body   { font-size: 13px; color: var(--text-secondary); line-height: 1.5; }

.comment-input-area {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

/* ─── Generic Modal (for forms) ────────────────────────── */

.generic-modal-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 460px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

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

.generic-modal-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 400;
  color: var(--text-primary);
  letter-spacing: -0.01em;
}

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

.generic-modal-footer {
  padding: 14px 20px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-shrink: 0;
}

/* ─── Toast ────────────────────────────────────────────── */

.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 2000;
  pointer-events: none;
}

.toast {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-left: 3px solid var(--text-muted);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  font-size: 13px;
  color: var(--text-primary);
  max-width: 320px;
  pointer-events: auto;
  animation: toastIn 200ms ease forwards;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  line-height: 1.4;
}

.toast.success { border-left-color: var(--success); }
.toast.error   { border-left-color: var(--danger); }

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

.toast.removing {
  animation: toastOut 200ms ease forwards;
}

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

/* ─── Empty States ─────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 13px;
}

.empty-state-icon {
  font-size: 28px;
  margin-bottom: 10px;
  opacity: 0.4;
}

/* ─── Utility ──────────────────────────────────────────── */

.flex-row { display: flex; align-items: center; }
.flex-gap { gap: 8px; }
.ml-auto  { margin-left: auto; }
.mt-1     { margin-top: 8px; }
.mt-2     { margin-top: 16px; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-hover); }

/* ─── Settings ─────────────────────────────────────────── */

.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(380px, 1fr));
  gap: 20px;
  align-items: start;
}

.settings-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
}

.settings-card-title {
  font-family: var(--font-heading);
  font-size: 17px;
  color: var(--text-primary);
  margin-bottom: 6px;
}

.settings-card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
  margin-bottom: 20px;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-btn {
  align-self: flex-start;
  margin-top: 4px;
}
