:root {
  color-scheme: dark;
  --bg: #090b10;
  --bg-soft: #11151d;
  --surface: rgba(22, 27, 37, 0.92);
  --surface-strong: #1b2230;
  --surface-muted: #121821;
  --border: rgba(148, 163, 184, 0.18);
  --border-strong: rgba(148, 163, 184, 0.34);
  --text: #f7fafc;
  --text-muted: #a8b3c4;
  --text-soft: #d7dde7;
  --accent: #10b981;
  --accent-strong: #34d399;
  --accent-soft: rgba(16, 185, 129, 0.14);
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.14);
  --warning: #f59e0b;
  --info: #60a5fa;
  --shadow: 0 20px 70px rgba(0, 0, 0, 0.34);
  --shadow-soft: 0 10px 34px rgba(0, 0, 0, 0.20);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --sidebar-width: 250px;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f7fb;
  --bg-soft: #eef3f8;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --surface-muted: #f7fafc;
  --border: rgba(15, 23, 42, 0.10);
  --border-strong: rgba(15, 23, 42, 0.18);
  --text: #111827;
  --text-muted: #64748b;
  --text-soft: #334155;
  --accent: #059669;
  --accent-strong: #047857;
  --accent-soft: rgba(5, 150, 105, 0.12);
  --danger: #e11d48;
  --danger-soft: rgba(225, 29, 72, 0.10);
  --warning: #b45309;
  --info: #2563eb;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.10);
  --shadow-soft: 0 8px 24px rgba(15, 23, 42, 0.08);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(16, 185, 129, 0.12), transparent 34rem),
    linear-gradient(135deg, var(--bg), var(--bg-soft));
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

a { color: inherit; }
button, input, select, textarea { font: inherit; }
svg { display: block; }

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

.sidebar {
  position: sticky;
  top: 0;
  width: var(--sidebar-width);
  height: 100vh;
  flex: 0 0 var(--sidebar-width);
  border-right: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  padding: 18px;
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text);
  font-size: 16px;
  font-weight: 800;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), #14b8a6);
  color: #fff;
  box-shadow: 0 14px 28px rgba(16, 185, 129, 0.24);
}

.nav-list { display: grid; gap: 6px; margin-top: 28px; }

.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 42px;
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--text-muted);
  text-decoration: none;
  transition: background .18s ease, color .18s ease, transform .18s ease;
}

.nav-link:hover { background: var(--surface-muted); color: var(--text); transform: translateX(2px); }
.nav-link.active { background: var(--accent-soft); color: var(--accent-strong); }
.nav-link.active::before {
  content: "";
  position: absolute;
  left: -18px;
  width: 4px;
  height: 24px;
  border-radius: 999px;
  background: var(--accent);
}

.nav-section {
  margin: 20px 12px 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-main { min-width: 0; flex: 1; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 86%, transparent);
  padding: 14px 28px;
  backdrop-filter: blur(20px);
}

.page-heading p {
  margin: 0 0 2px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.page-heading h1 { margin: 0; font-size: 22px; line-height: 1.2; }
.topbar-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }

.main-container {
  width: min(1220px, 100%);
  margin: 0 auto;
  padding: 28px;
  animation: page-fade .28s ease both;
}

.panel, .auth-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 22px;
}

.auth-card { max-width: 430px; margin: 52px auto; }
.panel h2, .auth-card h2 { margin: 0 0 16px; font-size: 18px; }
.section-heading { margin-bottom: 18px; }
.section-heading h2 { margin-bottom: 4px; }
.section-heading p { margin: 0; color: var(--text-muted); font-size: 14px; }

.stack { display: grid; gap: 14px; }
.page-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.filters, .inline-actions, .assignment-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.form-field { display: grid; gap: 7px; }
.label { color: var(--text-soft); font-size: 14px; font-weight: 700; }

.input,
select,
textarea,
input[type=email],
input[type=password],
input[type=text],
input[type=date],
input[type=color],
input[type=file] {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--text);
  padding: 10px 12px;
  outline: none;
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

.input:focus,
input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.form-error { margin: 0; color: var(--danger); font-size: 13px; }
.check-row { display: flex; align-items: center; gap: 10px; color: var(--text-soft); font-size: 14px; font-weight: 700; }

.btn {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--text);
  padding: 9px 14px;
  font-size: 14px;
  font-weight: 750;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, border-color .18s ease, color .18s ease, box-shadow .18s ease;
}

.btn:hover { transform: translateY(-1px); border-color: var(--border-strong); background: var(--surface-strong); box-shadow: var(--shadow-soft); }
.btn-primary { border-color: transparent; background: linear-gradient(135deg, var(--accent), #14b8a6); color: #fff; }
.btn-danger { border-color: color-mix(in srgb, var(--danger) 42%, transparent); background: var(--danger-soft); color: var(--danger); }
.btn-sm { min-height: 34px; padding: 7px 10px; font-size: 13px; }

.icon { width: 18px; height: 18px; flex: 0 0 auto; }
.icon-btn {
  display: inline-grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  background: var(--surface-muted);
  color: var(--text-soft);
  cursor: pointer;
  transition: transform .18s ease, background .18s ease, color .18s ease;
}
.icon-btn:hover { transform: translateY(-1px); background: var(--surface-strong); color: var(--text); }

.theme-form { margin: 0; }
.theme-toggle .theme-sun { display: none; }
[data-theme="dark"] .theme-toggle .theme-moon { display: none; }
[data-theme="dark"] .theme-toggle .theme-sun { display: block; }

.status-pill {
  max-width: 360px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border: 1px solid color-mix(in srgb, var(--accent) 28%, transparent);
  border-radius: 999px;
  background: var(--accent-soft);
  padding: 8px 12px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.user-menu { position: relative; }
.user-summary { display: flex; align-items: center; gap: 10px; cursor: pointer; list-style: none; }
.user-summary::-webkit-details-marker { display: none; }
.user-dropdown {
  position: absolute;
  right: 0;
  top: 50px;
  display: grid;
  min-width: 220px;
  gap: 4px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface-strong);
  padding: 8px;
  box-shadow: var(--shadow);
  transform-origin: top right;
  animation: dropdown-pop .16s ease both;
}
.dropdown-item {
  display: flex;
  width: 100%;
  min-height: 40px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 11px;
  background: transparent;
  color: var(--text-soft);
  padding: 10px 12px;
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.dropdown-item:hover { background: var(--surface-muted); color: var(--text); }

.avatar {
  --avatar-size: 38px;
  display: grid;
  width: var(--avatar-size);
  height: var(--avatar-size);
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 999px;
  background: var(--avatar-color, var(--accent));
  color: #fff;
  font-size: calc(var(--avatar-size) * .42);
  font-weight: 850;
  line-height: 1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.12), var(--shadow-soft);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar > span { display: grid; place-items: center; transform: translateY(-.02em); }
.avatar-xs { --avatar-size: 28px; }
.avatar-sm, .h-8.w-8 { --avatar-size: 32px; }
.avatar-md, .h-9.w-9 { --avatar-size: 38px; }
.avatar-lg, .h-14.w-14 { --avatar-size: 52px; }
.avatar-xl { --avatar-size: 76px; }
.avatar-edit-preview { display: flex; align-items: center; gap: 16px; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 14px; background: var(--surface-muted); }
.avatar-edit-preview p { margin: 3px 0 0; color: var(--text-muted); font-size: 13px; }

.toast-stack { display: grid; gap: 10px; margin-bottom: 18px; }
.toast {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
  padding: 12px 14px;
  animation: toast-in .22s ease both;
}
.toast-success { border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.toast-error { border-color: color-mix(in srgb, var(--danger) 40%, transparent); }
.toast-info { border-color: color-mix(in srgb, var(--info) 35%, transparent); }
.toast-leaving { opacity: 0; transform: translateY(-6px); transition: opacity .24s ease, transform .24s ease; }

.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.client-card, .team-card {
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  padding: 16px;
  transition: transform .18s ease, border-color .18s ease, box-shadow .18s ease;
}
.client-card:hover, .team-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: var(--shadow-soft); }
.client-card h2 { margin: 0; font-size: 16px; }
.color-dot { display: inline-block; width: 10px; height: 10px; border-radius: 999px; margin-right: 7px; vertical-align: middle; }

.table-wrap { overflow: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { border-bottom: 1px solid var(--border); padding: 12px; text-align: left; vertical-align: middle; }
.table th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0; }

.row-user { display: flex; align-items: center; gap: 12px; min-width: 0; }
.row-user span, .list-item span { color: var(--text-muted); font-size: 13px; }
.list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  padding: 14px;
  color: inherit;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.list-item:hover { transform: translateY(-1px); border-color: var(--border-strong); background: var(--surface-strong); }

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 850;
}
.badge-planned { background: color-mix(in srgb, var(--text-muted) 18%, transparent); color: var(--text-soft); }
.badge-in_progress { background: rgba(96, 165, 250, .16); color: #93c5fd; }
.badge-completed { background: var(--accent-soft); color: var(--accent-strong); }
.badge-cancelled { background: var(--danger-soft); color: var(--danger); }
.badge-on_hold { background: rgba(245, 158, 11, .16); color: #fbbf24; }

.progress { display: grid; gap: 6px; }
.progress-meta { display: flex; align-items: center; justify-content: space-between; color: var(--text-muted); font-size: 12px; }
.progress-track { height: 8px; overflow: hidden; border-radius: 999px; background: color-mix(in srgb, var(--text-muted) 20%, transparent); }
.progress-fill { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--accent), #14b8a6); transition: width .28s ease; }

.prose-box { border-radius: var(--radius-md); background: var(--surface-muted); padding: 14px; color: var(--text-soft); }
.copy-box { overflow: auto; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface-muted); padding: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 30px; height: 30px; border: 2px solid var(--surface); border-radius: 999px; box-shadow: 0 0 0 1px var(--border-strong); cursor: pointer; }

.dashboard-grid, .profile-layout, .settings-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; margin-bottom: 16px; }

.trl-overview { display: grid; gap: 14px; }
.trl-user-row {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 14px;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface-muted);
  padding: 14px;
}
.trl-person {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius-lg);
  color: var(--text);
  font-weight: 800;
  text-decoration: none;
}
.trl-category-cards { display: grid; grid-template-columns: repeat(3, minmax(190px, 1fr)); gap: 12px; }
.trl-cell {
  display: grid;
  min-height: 150px;
  align-content: start;
  gap: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface);
  padding: 14px;
  color: inherit;
  text-decoration: none;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.trl-cell:hover { transform: translateY(-2px); border-color: var(--border-strong); background: var(--surface-strong); }
.trl-cell strong { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.25; }
.trl-label { color: var(--accent-strong); font-size: 12px; font-weight: 850; text-transform: uppercase; letter-spacing: 0; }
.trl-editor-page { display: grid; gap: 18px; }
.trl-profile-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--accent) 11%, transparent), transparent 46%),
    var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}
.trl-hero-copy p {
  margin: 0 0 2px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}
.trl-hero-copy h2 { margin: 0; font-size: 22px; }
.trl-hero-copy span { color: var(--text-muted); font-size: 14px; }
.trl-hero-stats { display: grid; grid-template-columns: repeat(3, minmax(94px, 1fr)); gap: 10px; }
.trl-stat {
  min-width: 96px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  padding: 10px 12px;
}
.trl-stat span {
  display: block;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}
.trl-stat strong { display: block; margin-top: 2px; font-size: 20px; }

.trl-workspace { display: grid; gap: 18px; }
.trl-workspace-card {
  --category-accent: var(--accent);
  border: 1px solid var(--border);
  border-left: 4px solid var(--category-accent);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}
.trl-workspace-card[data-category="tooling"] { --category-accent: #38bdf8; }
.trl-workspace-card[data-category="research"] { --category-accent: #a78bfa; }
.trl-workspace-card[data-category="learning"] { --category-accent: #f59e0b; }
.trl-workspace-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: start;
}
.trl-title-block { min-width: 0; }
.trl-category-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border: 1px solid color-mix(in srgb, var(--category-accent) 32%, transparent);
  border-radius: 999px;
  background: color-mix(in srgb, var(--category-accent) 14%, transparent);
  color: color-mix(in srgb, var(--category-accent) 82%, white);
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}
.trl-title-block h2 { margin: 10px 0 4px; font-size: 22px; line-height: 1.18; }
.trl-title-block p { margin: 0; color: var(--text-muted); font-size: 14px; }
.trl-workspace-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.trl-workspace-actions form { margin: 0; }
.trl-progress-wrap { margin-top: 18px; }
.trl-workspace-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 360px);
  gap: 22px;
  margin-top: 20px;
  align-items: start;
}
.trl-workspace-body-empty { grid-template-columns: minmax(0, 1fr) minmax(300px, 420px); }
.trl-main-pane { display: grid; gap: 20px; min-width: 0; }
.trl-description h3,
.trl-milestone-panel h3,
.trl-side-pane h3 { margin: 0; font-size: 15px; }
.trl-description .prose-box { margin-top: 8px; min-height: 72px; }
.trl-panel-heading {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}
.trl-panel-heading p { margin: 3px 0 0; color: var(--text-muted); font-size: 13px; }
.trl-side-pane {
  display: grid;
  gap: 16px;
  border-left: 1px solid var(--border);
  padding-left: 22px;
}
.trl-side-pane p { margin: 6px 0 0; color: var(--text-muted); font-size: 13px; }
.trl-side-kicker {
  color: var(--category-accent);
  font-size: 11px;
  font-weight: 850;
  text-transform: uppercase;
}
.trl-start-form { display: grid; gap: 12px; }
.trl-start-form textarea { resize: vertical; }
.trl-empty-editor {
  display: grid;
  min-height: 220px;
  place-items: center;
  align-content: center;
  gap: 8px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  padding: 28px;
  text-align: center;
}
.trl-empty-editor h3 { margin: 0; font-size: 17px; }
.trl-empty-editor p { margin: 0; max-width: 34rem; color: var(--text-muted); }
.trl-empty-icon { width: 28px; height: 28px; color: var(--category-accent); }

.milestone-list { display: grid; gap: 14px; }
.milestone-items { display: grid; gap: 10px; }
.milestone-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  padding: 12px;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.milestone-row:hover { transform: translateY(-1px); border-color: var(--border-strong); background: var(--surface-strong); }
.milestone-row.is-completed { opacity: .78; }
.milestone-state {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border-radius: 999px;
  background: color-mix(in srgb, var(--category-accent) 14%, transparent);
  color: var(--category-accent);
}
.milestone-content { min-width: 0; }
.milestone-content strong { display: block; color: var(--text); font-size: 14px; line-height: 1.35; }
.milestone-content p { margin: 3px 0 0; color: var(--text-muted); font-size: 13px; }
.milestone-row.is-completed .milestone-content strong { color: var(--text-muted); text-decoration: line-through; }
.milestone-actions { display: flex; align-items: center; gap: 8px; }
.milestone-actions form { margin: 0; }
.danger-icon {
  width: 36px;
  height: 36px;
  border-color: color-mix(in srgb, var(--danger) 34%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}
.milestone-add-form {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface-muted) 86%, transparent);
  padding: 12px;
}
.milestone-add-fields {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(220px, 1.2fr) auto;
  gap: 10px;
  align-items: center;
}
.milestone-empty {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  color: var(--text-muted);
  padding: 16px;
}

.trl-history-panel { margin-top: 2px; }
.history-item { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 12px; margin-top: 10px; background: var(--surface-muted); }
.history-item summary { cursor: pointer; font-weight: 750; }
.trl-edit-shell {
  --category-accent: var(--accent);
  max-width: 880px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--category-accent);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 22px;
}
.trl-edit-shell[data-category="tooling"] { --category-accent: #38bdf8; }
.trl-edit-shell[data-category="research"] { --category-accent: #a78bfa; }
.trl-edit-shell[data-category="learning"] { --category-accent: #f59e0b; }
.trl-edit-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}
.trl-edit-header h2 { margin: 10px 0 4px; font-size: 24px; }
.trl-edit-header p { margin: 0; color: var(--text-muted); }
.trl-edit-form { display: grid; gap: 16px; }
.trl-edit-actions { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; }

.segmented { display: inline-flex; border: 1px solid var(--border-strong); border-radius: 14px; overflow: hidden; background: var(--surface-muted); }
.segmented button { min-height: 38px; border: 0; background: transparent; color: var(--text-muted); padding: 9px 12px; cursor: pointer; font-weight: 800; }
.segmented .active { background: var(--accent); color: #fff; }

.modal { border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 0; color: var(--text); background: var(--surface-strong); box-shadow: var(--shadow); }
.modal::backdrop { background: rgba(0, 0, 0, .62); backdrop-filter: blur(4px); }
.modal-body { min-width: min(430px, 92vw); padding: 22px; }
.modal-close { float: right; }
.danger-panel { border-color: color-mix(in srgb, var(--danger) 28%, var(--border)); }
.danger-disclosure summary { list-style: none; width: max-content; }
.danger-disclosure summary::-webkit-details-marker { display: none; }
.empty-state { grid-column: 1/-1; border: 1px dashed var(--border-strong); border-radius: var(--radius-xl); padding: 34px; text-align: center; color: var(--text-muted); }

.min-w-0 { min-width: 0; }
.max-w-2xl { max-width: 42rem; }
.max-w-3xl { max-width: 48rem; }
.mt-2 { margin-top: .5rem; }
.mt-3 { margin-top: .75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mb-4 { margin-bottom: 1rem; }
.grid { display: grid; }
.flex { display: flex; }
.inline-flex { display: inline-flex; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.gap-2 { gap: .5rem; }
.gap-3 { gap: .75rem; }
.gap-4 { gap: 1rem; }
.gap-6 { gap: 1.5rem; }
.text-xs { font-size: 12px; }
.text-sm { font-size: 14px; }
.text-xl { font-size: 20px; }
.font-medium { font-weight: 650; }
.font-semibold { font-weight: 750; }
.font-bold { font-weight: 850; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0; }
.text-slate-500 { color: var(--text-muted); }
.text-slate-600 { color: var(--text-soft); }
.text-slate-900 { color: var(--text); }
.text-emerald-700 { color: var(--accent-strong); }
.text-amber-700 { color: #fbbf24; }
.bg-slate-100, .bg-white { background: var(--surface); }
.rounded-lg { border-radius: var(--radius-md); }
.border { border: 1px solid var(--border); }
.p-3 { padding: .75rem; }
.min-h-32 { min-height: 8rem; }
.overflow-hidden { overflow: hidden; }
.rounded-full { border-radius: 999px; }
.bg-slate-200 { background: color-mix(in srgb, var(--text-muted) 20%, transparent); }
.bg-emerald-500 { background: var(--accent); }
.h-2 { height: .5rem; }
.h-full { height: 100%; }
.w-40 { width: 10rem; }
.line-through { text-decoration: line-through; }

@keyframes page-fade { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes dropdown-pop { from { opacity: 0; transform: translateY(-6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

.htmx-swapping { opacity: .45; transition: opacity .18s ease; }
.htmx-settling { animation: page-fade .22s ease both; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}

@media (max-width: 980px) {
  .app-shell { display: block; }
  .sidebar { position: relative; width: 100%; height: auto; }
  .topbar { align-items: flex-start; flex-direction: column; padding: 16px; }
  .main-container { padding: 16px; }
  .dashboard-grid, .profile-layout, .settings-grid, .trl-user-row { grid-template-columns: 1fr; }
  .trl-category-cards { grid-template-columns: 1fr; }
  .trl-profile-hero { align-items: stretch; flex-direction: column; }
  .trl-hero-stats { width: 100%; }
  .trl-workspace-top,
  .trl-workspace-body,
  .trl-workspace-body-empty { grid-template-columns: 1fr; }
  .trl-workspace-actions { justify-content: flex-start; }
  .trl-side-pane { border-left: 0; border-top: 1px solid var(--border); padding-left: 0; padding-top: 18px; }
  .milestone-add-fields { grid-template-columns: 1fr; }
  .trl-edit-header { flex-direction: column; }
  .page-actions { align-items: flex-start; flex-direction: column; }
  .status-pill { max-width: 100%; }
  .topbar-actions { flex-wrap: wrap; }
}

@media (max-width: 640px) {
  .trl-hero-stats { grid-template-columns: 1fr; }
  .trl-workspace-card, .trl-profile-hero, .trl-edit-shell { padding: 16px; }
  .milestone-row { grid-template-columns: auto minmax(0, 1fr); align-items: start; }
  .milestone-actions { grid-column: 1 / -1; justify-content: flex-start; padding-left: 44px; }
}
