:root,
[data-theme="light"] {
  --bg: #f7f6f3;
  --surface: #ffffff;
  --surface-2: #f7f6f3;
  --text: #1c1c1a;
  --text-2: #5f5e5a;
  --text-3: #888780;
  --border: #e0ded8;
  --border-strong: #c8c6c0;
  --focus: rgba(83, 74, 183, 0.25);

  --teal-50: #e1f5ee;
  --teal-600: #0f6e56;
  --teal-800: #085041;

  --blue-50: #e6f1fb;
  --blue-600: #185fa5;
  --blue-800: #0c447c;

  --amber-50: #faeeda;
  --amber-600: #ba7517;
  --amber-800: #633806;

  --green-50: #eaf3de;
  --green-800: #27500a;

  --red-50: #fcebeb;
  --red-200: #f09595;
  --red-400: #e24b4a;
  --red-800: #791f1f;

  --purple-50: #eeedfe;
  --purple-600: #534ab7;
  --purple-800: #3c3489;

  --gray-50: #f1efe8;
  --gray-800: #444441;

  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-6: 24px;
  --space-8: 32px;
  --space-12: 48px;
}

[data-theme="dark"] {
  --bg: #151517;
  --surface: #1c1d21;
  --surface-2: #22242a;
  --text: #f5f6f7;
  --text-2: #c2c6cc;
  --text-3: #949aa4;
  --border: #343841;
  --border-strong: #4b515b;
  --focus: rgba(83, 74, 183, 0.35);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}
button, input, textarea, select { font: inherit; }
a { color: inherit; text-decoration: none; }
.skip-link {
  position: absolute;
  left: 12px;
  top: -40px;
  background: var(--purple-600);
  color: #fff;
  padding: 8px 12px;
  border-radius: 6px;
}
.skip-link:focus { top: 12px; }
:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--focus);
}

.shell {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: var(--space-6);
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}
.brand {
  display: flex;
  gap: var(--space-3);
  align-items: center;
}
.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--purple-50);
  color: var(--purple-800);
  display: grid;
  place-items: center;
  font-weight: 500;
}
.brand h1, .page-title, h3, h4 { margin: 0; font-weight: 500; }
.nav { display: grid; gap: var(--space-1); }
.nav-link {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text-2);
}
.nav-link:hover, .nav-link.active {
  color: var(--purple-600);
  background: var(--purple-50);
}
.sidebar-card {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: var(--radius-md);
  padding: var(--space-4);
}
.role-switch { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: 8px; }
.main {
  width: min(1280px, 100%);
  padding: var(--space-6);
  margin: 0 auto;
  /* display: grid; */
  gap: var(--space-8);
}
.page-top, .screen-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: var(--space-4);
}
.page-title { font-size: 16px; }
.section-label {
  color: var(--text-3);
  font-size: 11px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}
.small { font-size: 11px; }
.tiny { display: block; color: var(--text-3); font-size: 10px; }
.muted { color: var(--text-2); }
.mono { font-family: 'IBM Plex Mono', monospace; }
.right { text-align: right; }
.overdue, .danger-text { color: var(--red-800); }
.warning-text { color: var(--amber-800); }
.toolbar, .header-actions, .card-actions, .panel-actions, .feedback-actions {
  display: flex;
  gap: var(--space-2);
  flex-wrap: wrap;
  align-items: center;
}
.full { width: 100%; }

.screen {
  display: grid;
  gap: var(--space-4);
  scroll-margin-top: 16px;
}
.panel, .project-card, .metric-card, .task-card, .kanban-card, .modal {
  background: var(--surface);
  border: 0.5px solid var(--border);
  border-radius: 8px;
}
.panel:hover, .project-card:hover, .task-card:hover, .kanban-card:hover {
  border-color: var(--border-strong);
}
.panel, .metric-card, .task-card, .kanban-card { padding: var(--space-4); }
.project-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-4);
}
.project-card { padding: var(--space-4); display: grid; gap: var(--space-4); }
.project-card-top, .task-card-top { display: flex; justify-content: space-between; gap: var(--space-3); align-items: start; }
.metrics-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
}
.progress {
  height: 3px;
  background: var(--gray-50);
  border-radius: 2px;
  overflow: hidden;
}
.progress span {
  display: block;
  height: 100%;
  background: var(--teal-600);
}
.stats-row, .three-col {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}
.metric-label { color: var(--text-3); margin-bottom: 8px; }
.metric-value { font-size: 16px; font-weight: 500; }
.two-col {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: var(--space-4);
}
.form-panel, .stack-sm, .detail-stack { display: grid; gap: var(--space-4); }
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}
.form-grid.two-up { grid-template-columns: repeat(2, 1fr); }
.field { display: grid; gap: 4px; }
.field > span {
  color: var(--text-2);
  font-size: 12px;
}
.col-span-2 { grid-column: span 2; }
.input {
  width: 100%;
  height: 34px;
  border-radius: 6px;
  border: 0.5px solid var(--border);
  background: var(--surface);
  padding: 0 10px;
  color: var(--text);
}
.textarea {
  min-height: 92px;
  padding: 10px;
  resize: vertical;
}
.input:focus {
  border: 1.5px solid var(--purple-600);
}
.error-field {
  border: 1.5px solid var(--red-400);
  background: var(--red-50);
}
.error-text {
  margin-top: 4px;
  color: var(--red-400);
  font-size: 11px;
}
.compact { min-width: 150px; }
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 8px;
  flex-wrap: wrap;
}
.tab {
  background: transparent;
  border: none;
  color: var(--text-2);
  padding: 8px 12px;
  border-radius: 6px;
  cursor: pointer;
}
.tab.active {
  color: var(--purple-600);
  background: var(--purple-50);
}
.panel-title { font-size: 14px; font-weight: 500; }
.team-list, .feedback-list { border: 0.5px solid var(--border); border-radius: 8px; overflow: hidden; }
.team-row, .feedback-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  padding: 12px 16px;
  background: var(--surface);
  border-bottom: 0.5px solid var(--border);
}
.feedback-row.alt, .asset-row.alt, .task-row.alt { background: var(--surface-2); }
.team-row:last-child, .feedback-row:last-child { border-bottom: none; }
.detail-list { margin: 0; display: grid; gap: 12px; }
.detail-list div { display: flex; justify-content: space-between; gap: 12px; }
.detail-list dt { color: var(--text-2); }
.detail-list dd { margin: 0; font-weight: 500; }
.mini-progress { display: grid; gap: 8px; }
.mini-progress label { color: var(--text-2); }
.table-wrap {
  overflow: auto;
  border: 0.5px solid var(--border);
  border-radius: 8px;
}
.swat-table {
  width: 100%;
  border-collapse: collapse;
}
.swat-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 12px;
  background: var(--surface-2);
}
.swat-table td {
  padding: 12px;
  border-top: 0.5px solid var(--border);
  background: transparent;
}
.asset-row td { font-weight: 500; }
.task-row .indent { padding-left: 30px; }
.hidden { display: none; }
.row-toggle, .icon-btn {
  border: none;
  background: transparent;
  color: var(--text-2);
  cursor: pointer;
}
.empty-state {
  border: 1px dashed var(--border-strong);
  background: var(--surface-2);
  border-radius: 8px;
  padding: var(--space-6);
  display: flex;
  gap: var(--space-4);
  align-items: center;
  justify-content: space-between;
}
.compact-empty { justify-content: start; }
.empty-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--gray-50);
  display: grid;
  place-items: center;
  color: var(--gray-800);
}
.kanban {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--space-4);
}
.kanban-col {
  border: 0.5px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: var(--surface-2);
}
.kanban-head {
  padding: 12px 16px;
  font-weight: 500;
  display: flex;
  justify-content: space-between;
}
.head-teal { background: var(--teal-50); color: var(--teal-800); }
.head-blue { background: var(--blue-50); color: var(--blue-800); }
.head-purple { background: var(--purple-50); color: var(--purple-800); }
.head-red { background: var(--red-50); color: var(--red-800); }
.kanban-card { margin: 12px; display: grid; gap: 8px; }
.kanban-title { font-weight: 500; }
.kanban-sub, .kanban-mid { color: var(--text-2); }
.kanban-foot { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.artist-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}
.task-lines {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-3);
  margin-top: 8px;
}
.task-lines div { display: grid; gap: 4px; }
.task-lines span { color: var(--text-3); }
.task-panel-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: var(--space-4);
}
.panel-context, .panel-drawer { min-height: 320px; }
.detail-stack div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 0.5px solid var(--border);
  padding-bottom: 8px;
}
.timeline { display: grid; gap: 16px; }
.timeline-item {
  display: grid;
  grid-template-columns: 16px 1fr;
  gap: 12px;
}
.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 4px;
}
.dot-blue { background: var(--blue-600); }
.dot-amber { background: var(--amber-600); }
.dot-purple { background: var(--purple-600); }
.modal-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-4);
}
.modal-surface {
  min-height: 420px;
  border-radius: 10px;
  background: rgba(0,0,0,0.3);
  padding: 20px;
  display: grid;
  place-items: center;
}
.modal {
  width: min(100%, 560px);
  overflow: hidden;
  border: 1px solid var(--purple-600);
  border-radius: 10px;
}
.modal-head, .modal-foot {
  padding: 16px 20px;
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}
.modal-body { padding: 20px; }
.modal-foot { background: var(--surface-2); }
.danger {
  border-color: var(--red-200);
}
.danger-head {
  background: var(--red-50);
  border-bottom: 1px solid var(--red-200);
}

.dialog-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.42);
  z-index: 1200;
  padding: 20px;
  display: none;
  place-items: center;
}

.dialog-overlay.open {
  display: grid;
}

body.dialog-open {
  overflow: hidden;
}

.dialog-overlay .modal {
  background: var(--surface);
}

.dialog-overlay .icon-btn[aria-disabled="true"] {
  opacity: 0.45;
  cursor: not-allowed;
  pointer-events: none;
}
.btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  font-weight: 500;
}
.btn-xs { height: 28px; }
.btn-primary { background: var(--teal-600); color: #fff; }
.btn-authority { background: var(--purple-600); color: #fff; }
.btn-warning { background: var(--amber-600); color: #fff; }
.btn-secondary { border-color: var(--border); color: var(--text); background: transparent; }
.btn-ghost { color: var(--text-2); }
.btn-danger-fill { background: var(--red-400); color: #fff; }
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 999px;
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}
.badge-teal { background: var(--teal-50); color: var(--teal-800); }
.badge-blue { background: var(--blue-50); color: var(--blue-800); }
.badge-amber { background: var(--amber-50); color: var(--amber-800); }
.badge-red { background: var(--red-50); color: var(--red-800); }
.badge-green { background: var(--green-50); color: var(--green-800); }
.badge-purple { background: var(--purple-50); color: var(--purple-800); }
.badge-gray { background: var(--gray-50); color: var(--gray-800); }

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

.control-card {
  display: grid;
  gap: var(--space-3);
}

.control-stack {
  display: grid;
  gap: var(--space-2);
}

.choice-row,
.switch-row {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--text-2);
}

.switch-row input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.switch-ui {
  width: 34px;
  height: 20px;
  border-radius: 999px;
  background: var(--border-strong);
  position: relative;
  flex: 0 0 auto;
}

.switch-ui::after {
  content: "";
  position: absolute;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #fff;
  top: 3px;
  left: 3px;
  transition: transform 120ms ease;
}

.switch-row input:checked + .switch-ui {
  background: var(--teal-600);
}

.switch-row input:checked + .switch-ui::after {
  transform: translateX(14px);
}

.switch-row input:disabled + .switch-ui {
  opacity: 0.55;
}

.multi-select {
  height: auto;
  min-height: 88px;
  padding: 8px;
}

.tree-view,
.tree-view ul {
  margin: 0;
  padding-left: 18px;
}

.tree-view {
  color: var(--text-2);
}

.tree-view summary {
  cursor: pointer;
  color: var(--text);
}

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1000;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--purple-600);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
  padding: 10px 12px;
}

.toast.success {
  border-left-color: var(--teal-600);
}

.toast.error {
  border-left-color: var(--red-400);
}

.toast-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  margin-bottom: 2px;
}

.toast-body {
  color: var(--text-2);
}

.hidden-panel {
  display: none !important;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: min(460px, 100vw);
  height: 100vh;
  background: var(--surface);
  border-left: 1px solid var(--border);
  box-shadow: -10px 0 30px rgba(0, 0, 0, 0.14);
  z-index: 1100;
  display: grid;
  grid-template-rows: auto 1fr auto;
  transform: translateX(100%);
  transition: transform 220ms ease;
}

.drawer.open {
  transform: translateX(0);
}

.drawer-head,
.drawer-foot {
  padding: 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}

.drawer-foot {
  border-top: 1px solid var(--border);
  border-bottom: none;
  display: flex;
  justify-content: flex-end;
  gap: var(--space-2);
}

.drawer-body {
  padding: 16px;
  overflow: auto;
  display: grid;
  align-content: start;
  grid-auto-rows: max-content;
  gap: var(--space-4);
}

.drawer .tabs {
  gap: 4px;
  padding-bottom: 8px;
}

.drawer .tab {
  padding: 6px 10px;
  font-size: 12px;
  line-height: 1.2;
}

@media (max-width: 1180px) {
  .project-grid, .stats-row, .three-col, .kanban, .modal-grid, .controls-grid { grid-template-columns: repeat(2, 1fr); }
  .two-col, .task-panel-layout { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: relative;
    height: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .project-grid, .stats-row, .three-col, .artist-grid, .kanban, .modal-grid, .form-grid, .controls-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; animation: none !important; }
}
