:root {
  color-scheme: light;
  --bg: var(--a11y-ink-strong);
  --paper: var(--a11y-paper);
  --panel: var(--a11y-surface);
  --ink: var(--a11y-ink);
  --muted: var(--a11y-text-muted);
  --line: var(--a11y-line);
  --brand-blue: var(--a11y-blue-bright);
  --brand-blue-dark: var(--a11y-blue);
  --brand-red: var(--a11y-red);
  --brand-cyan: var(--a11y-cyan);
  --brand-blue-soft: #a9c8ff;
  --shadow: var(--a11y-shadow-float);
  --tight-shadow: var(--a11y-shadow-panel);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--a11y-canvas);
  color: var(--ink);
  font-family: "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: 0;
  overflow-x: hidden;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  border: 0;
  background: var(--brand-blue-dark);
  color: #fff;
  min-height: 40px;
  padding: 0 14px;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 850;
  transition: transform var(--a11y-motion-fast) ease, box-shadow var(--a11y-motion-standard) ease, background-color var(--a11y-motion-standard) ease, color var(--a11y-motion-standard) ease;
}

button:hover {
  box-shadow: var(--tight-shadow);
  transform: translateY(-1px);
}

button:active {
  transform: translateY(1px);
}

button.secondary {
  background: #e5e9f1;
  color: var(--ink);
}

button.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--line);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  transform: none;
  box-shadow: none;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
.task-item:focus-visible {
  outline: 3px solid var(--brand-cyan);
  outline-offset: 2px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  color: #ffffff;
  font-family: "Arial Black", "Segoe UI Black", "Segoe UI", sans-serif;
  font-size: 2.25rem;
  line-height: 1.02;
  overflow-wrap: anywhere;
}

h2 {
  margin-bottom: 0;
  font-size: 1.12rem;
  line-height: 1.18;
}

h3 {
  line-height: 1.2;
}

.app-shell {
  width: min(1540px, 100%);
  max-width: 100%;
  min-width: 0;
  margin: 0 auto;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 20px clamp(16px, 3vw, 32px);
  border-bottom: 1px solid #173467;
  background: rgba(2, 6, 21, 0.97);
  backdrop-filter: blur(8px);
  min-width: 0;
  max-width: 100%;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.brand-lockup > div {
  min-width: 0;
}

.brand-icon {
  width: 70px;
  height: 70px;
  flex: 0 0 auto;
  border-radius: 8px;
  border: 1px solid #28518d;
  background: var(--bg);
  box-shadow: var(--tight-shadow);
}

.brand-wordmark {
  display: block;
  width: min(480px, 100%);
  height: auto;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-red);
  font-size: 0.78rem;
  font-weight: 900;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.date-cluster {
  display: grid;
  grid-template-columns: auto minmax(155px, 1fr) 44px;
  gap: 8px;
  align-items: end;
  width: min(360px, 100%);
  min-width: 0;
}

.topbar-controls {
  display: flex;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 16px;
  min-width: 0;
}

.codex-usage {
  box-sizing: border-box;
  width: clamp(210px, 20vw, 280px);
  min-width: 0;
  padding: 11px 13px 10px;
  border: 1px solid #28518d;
  border-radius: 6px;
  background: #081631;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.06);
  color: #f8fbff;
}

.codex-usage-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
  font-weight: 750;
}

.codex-usage-heading strong {
  color: #8fd5ff;
  font-size: 1.08rem;
  white-space: nowrap;
}

.codex-usage-track {
  height: 6px;
  margin: 7px 0 6px;
  overflow: hidden;
  border-radius: 3px;
  background: #263957;
}

.codex-usage-track span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: #38bdf8;
  transition: width 180ms ease-out, background-color 180ms ease-out;
}

.codex-usage small {
  display: block;
  overflow: hidden;
  color: #b7c8e4;
  font-size: 0.72rem;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.codex-usage[data-status="warning"],
.codex-usage[data-status="critical"] {
  border-color: #ff6078;
  background: #2a0912;
}

.codex-usage[data-status="warning"] .codex-usage-heading strong,
.codex-usage[data-status="critical"] .codex-usage-heading strong {
  color: #ff9aaa;
}

.codex-usage[data-status="warning"] .codex-usage-track span,
.codex-usage[data-status="critical"] .codex-usage-track span {
  background: #ef233c;
}

.codex-usage[data-status="critical"] {
  box-shadow: 0 0 0 2px rgba(239, 35, 60, 0.22);
}

.codex-usage[data-status="stale"],
.codex-usage[data-status="unavailable"] {
  border-color: #64748b;
  background: #151d2b;
}

.codex-usage[data-status="stale"] .codex-usage-heading strong,
.codex-usage[data-status="unavailable"] .codex-usage-heading strong {
  color: #d1d5db;
}

.date-cluster label {
  grid-column: 1 / -1;
  font-weight: 750;
  color: #c7d8ff;
}

.date-cluster input,
.task-dialog input,
.task-dialog select,
.task-dialog textarea,
.doc-form input,
.doc-form textarea,
.gallery-toolbar input {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.date-cluster input {
  min-height: 44px;
  min-width: 0;
  width: 100%;
  padding: 0 12px;
}

.icon-button {
  width: 44px;
  padding: 0;
  font-size: 1.2rem;
}

.layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 22px;
  padding: 22px clamp(16px, 3vw, 32px) 36px;
  min-width: 0;
  max-width: 100%;
}

.daily-briefing {
  display: grid;
  grid-template-columns: minmax(230px, 0.7fr) minmax(0, 1.3fr);
  align-items: center;
  gap: 18px;
  min-width: 0;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #879ab5;
  border-left: 5px solid var(--brand-cyan);
  border-radius: var(--a11y-radius-panel);
  background: linear-gradient(90deg, #f8fbff 0%, #edf4ff 100%);
  box-shadow: 0 6px 18px rgba(2, 6, 21, 0.08);
}

.briefing-copy,
.briefing-queue {
  min-width: 0;
}

.briefing-copy .eyebrow {
  margin-bottom: 3px;
}

.briefing-copy strong {
  display: block;
  overflow-wrap: anywhere;
}

.briefing-queue {
  display: flex;
  justify-content: flex-end;
  gap: 7px;
  overflow-x: auto;
  padding: 2px;
}

.briefing-task {
  flex: 0 1 auto;
  min-height: 34px;
  max-width: 230px;
  padding: 6px 10px;
  overflow: hidden;
  border: 1px solid #9c1934;
  background: #fff0f3;
  color: #720017;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.briefing-clear {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
}

.work-state-chip,
.needs-barry-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid #8394ac;
  border-radius: 999px;
  background: #eef2f7;
  color: #28374f;
  font-size: 0.74rem;
  font-weight: 850;
}

.work-state-chip.started {
  border-color: #0b65b1;
  background: #e7f4ff;
  color: #063e70;
}

.work-state-chip.blocked,
.needs-barry-chip {
  border-color: #a42a41;
  background: #fff0f3;
  color: #770018;
}

.needs-barry-toggle {
  display: flex;
  align-items: center;
  align-self: end;
  gap: 9px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--a11y-radius-control);
  background: #fff6f7;
  color: #720017;
  font-weight: 850;
}

.needs-barry-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand-red);
}

.accessaibility-brand-footer {
  width: min(1540px, calc(100% - 32px));
  margin: 0 auto;
  padding: 10px clamp(16px, 3vw, 32px) 18px;
}

.team-rail {
  position: sticky;
  top: 16px;
  height: calc(100vh - 38px);
  border-right: 1px solid var(--line);
  padding-right: 18px;
  min-width: 0;
  max-width: 100%;
}

.rail-title {
  font-weight: 950;
  margin-bottom: 12px;
  color: var(--ink);
  text-transform: uppercase;
  font-size: 0.82rem;
}

.team-list {
  display: grid;
  gap: 9px;
  min-width: 0;
}

.team-button {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  background: var(--paper);
  color: var(--ink);
  border: 1px solid var(--line);
  border-left: 7px solid var(--team-color, var(--brand-blue));
  box-shadow: none;
  min-width: 0;
  max-width: 100%;
  text-align: left;
}

.team-button.is-active {
  border-color: var(--brand-blue);
  box-shadow: var(--tight-shadow);
}

.team-button.is-secondary {
  opacity: 0.58;
  filter: grayscale(0.8);
}

.team-button.is-guest {
  border-style: dashed;
}

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--team-color, var(--brand-blue));
  color: #fff;
  font-weight: 950;
}

.team-name {
  display: block;
  font-weight: 900;
  line-height: 1.15;
  overflow-wrap: anywhere;
}

.team-hint {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.workspace {
  display: grid;
  gap: 22px;
  min-width: 0;
  max-width: 100%;
}

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

.workspace-nav {
  display: grid;
  grid-template-columns: repeat(5, minmax(132px, 1fr));
  gap: 8px;
  padding: 8px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--tight-shadow);
  min-width: 0;
}

.workspace-tab {
  display: grid;
  gap: 3px;
  min-height: 58px;
  padding: 9px 11px;
  text-align: left;
  background: #eef1f5;
  color: var(--ink);
  border: 1px solid transparent;
  box-shadow: none;
}

.workspace-tab span {
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 600;
}

.workspace-tab.is-active {
  background: var(--ink);
  color: #fff;
  border-color: var(--brand-red);
  box-shadow: inset 0 -4px 0 var(--brand-red);
}

.workspace-tab.is-active span {
  color: #d7e4ff;
}

.task-filters {
  display: grid;
  grid-template-columns: minmax(160px, 0.9fr) minmax(190px, 1fr) minmax(160px, 0.9fr) auto auto;
  gap: 12px;
  align-items: end;
  padding: 14px;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 6px solid var(--brand-red);
  border-radius: 8px;
}

.task-filters label {
  display: grid;
  gap: 5px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.task-filters select {
  width: 100%;
  min-height: 42px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.add-task-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  white-space: nowrap;
  background: var(--brand-red);
  box-shadow: 0 7px 16px rgba(225, 29, 46, 0.2);
}

.add-task-button > span:first-child {
  font-size: 1.25rem;
  line-height: 1;
}

.splash-panel,
.welcome-panel,
.bucket,
.database-panel,
.gallery-panel,
.workload-panel,
.resilience-panel {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
  min-width: 0;
  max-width: 100%;
}

.splash-panel {
  min-height: 150px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(170px, 0.4fr);
  gap: 20px;
  align-items: center;
  overflow: hidden;
  padding: 22px;
  border-top: 5px solid var(--brand-blue);
  position: relative;
  background: #02071f;
  border-color: #173467;
}

.splash-copy {
  min-width: 0;
}

.splash-copy p {
  margin: 8px 0 0;
  max-width: 54ch;
  font-weight: 650;
  color: #c7d8ff;
}

.splash-ledges {
  position: relative;
  min-height: 110px;
}

.splash-ledges span {
  position: absolute;
  right: 0;
  width: 86%;
  height: 13px;
  background: var(--brand-blue);
  transform: rotate(-6deg);
}

.splash-ledges span:nth-child(1) {
  top: 16px;
  background: var(--brand-red);
}

.splash-ledges span:nth-child(2) {
  top: 52px;
  width: 65%;
}

.splash-ledges span:nth-child(3) {
  top: 88px;
  width: 42%;
  background: var(--brand-cyan);
}

.welcome-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(112px, 1fr));
  gap: 10px;
  width: 100%;
}

.metric {
  min-width: 0;
  padding: 10px 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
}

.metric strong {
  display: block;
  font-size: 1.45rem;
  color: var(--brand-blue);
}

.task-board {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 18px;
  min-width: 0;
  max-width: 100%;
}

.bucket {
  overflow: hidden;
}

.bucket.ordered {
  border-top: 5px solid var(--brand-blue);
}

.completed-bucket {
  grid-column: 1 / -1;
  border-top: 5px solid #138A61;
}

.completed-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.completed-header-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.segmented-control {
  display: inline-grid;
  grid-auto-flow: column;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #edf1f8;
}

.segmented-control button {
  min-height: 34px;
  padding: 6px 11px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  box-shadow: none;
}

.segmented-control button.is-active {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 4px 10px rgba(5, 14, 42, 0.18);
}

.bucket-header,
.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.count-pill {
  min-width: 34px;
  min-height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 950;
}

.task-list,
.documents-list,
.gallery-list {
  display: grid;
  gap: 10px;
  padding: 14px;
  min-width: 0;
  max-width: 100%;
}

.task-item,
.document-item,
.gallery-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
  min-width: 0;
  overflow-wrap: anywhere;
}

.task-item {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr);
  gap: 12px;
  min-height: 124px;
  cursor: pointer;
  transition: border-color 160ms ease, box-shadow 160ms ease, transform 160ms ease, background-color 160ms ease;
  animation: task-enter 220ms cubic-bezier(.2,.8,.2,1) both;
}

.task-item:nth-child(2n) { animation-delay: 25ms; }
.task-item:nth-child(3n) { animation-delay: 50ms; }

@keyframes task-enter {
  from { opacity: 0; transform: translateY(7px); }
  to { opacity: 1; transform: translateY(0); }
}

.task-item:hover,
.task-item:focus-within {
  border-color: var(--brand-blue);
  box-shadow: var(--tight-shadow);
  background: #fbfcff;
}

.task-item:active {
  transform: translateY(1px);
}

.completed-task-item {
  min-height: 0;
  background: #f8fffc;
  border-color: #b7e3d2;
}

.completed-check {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: #138A61;
  font-size: 1.35rem;
  font-weight: 950;
}

.completed-chip {
  border-radius: 4px;
  padding: 2px 7px;
  color: #075b3e;
  background: #d9f7ea;
  border: 1px solid #8dd4b9;
  font-weight: 900;
}

.closing-comment-bubble {
  margin-top: 10px;
  border: 1px solid #86ccb2;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: border-color 170ms ease, box-shadow 170ms ease, background-color 170ms ease;
}

.closing-comment-bubble:hover,
.closing-comment-bubble:focus-within,
.closing-comment-bubble[open] {
  border-color: #138A61;
  box-shadow: 0 7px 18px rgba(7, 91, 62, 0.12);
  background: #fbfffd;
}

.closing-comment-bubble summary {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  cursor: pointer;
  list-style: none;
  color: #075b3e;
  font-weight: 900;
}

.closing-comment-bubble summary::-webkit-details-marker { display: none; }

.closing-comment-bubble summary::after {
  content: '+';
  flex: 0 0 auto;
  font-size: 1.15rem;
  transition: transform 180ms cubic-bezier(.2,.8,.2,1);
}

.closing-comment-bubble[open] summary::after { transform: rotate(45deg); }

.closing-comment-bubble summary small {
  min-width: 0;
  color: var(--muted);
  font-weight: 700;
  overflow-wrap: anywhere;
}

.closing-comment-reveal {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition: grid-template-rows 220ms cubic-bezier(.2,.8,.2,1), opacity 150ms ease;
}

.closing-comment-reveal p {
  min-height: 0;
  overflow: hidden;
  margin: 0;
  padding: 0 12px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  color: #183f32;
  line-height: 1.5;
}

.closing-comment-bubble[open] .closing-comment-reveal {
  grid-template-rows: 1fr;
  opacity: 1;
}

.closing-comment-bubble[open] .closing-comment-reveal p { padding: 0 12px 12px; }

.no-closing-comment {
  margin: 9px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.task-content {
  min-width: 0;
  max-width: 100%;
}

.order-number,
.backlog-dot {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  font-size: 1.15rem;
  font-weight: 950;
}

.order-number {
  background: var(--brand-blue);
}

.backlog-dot {
  background: var(--brand-blue);
}

.task-title {
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 6px;
  overflow-wrap: anywhere;
}

.task-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  color: var(--muted);
  font-size: 0.84rem;
}

.task-meta span {
  min-width: 0;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.task-description-preview {
  margin: 8px 0 0;
  color: #334155;
  line-height: 1.35;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  overflow: hidden;
}

.task-description-preview.is-expanded {
  display: block;
  max-height: 42vh;
  overflow: auto;
  animation: description-reveal 180ms ease-out;
}

@keyframes description-reveal {
  from { opacity: 0.72; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.priority {
  border-radius: 999px;
  padding: 2px 8px;
  background: #edf2f7;
}

.task-type,
.project-chip,
.overdue-chip {
  border-radius: 4px;
  padding: 2px 7px;
  font-weight: 850;
}

.task-type {
  color: #fff;
  background: var(--task-type-color, #64748b);
}

.project-chip {
  color: #1f2937;
  background: #e8edf3;
}

.overdue-chip {
  color: #8a0d21;
  background: #ffe1e6;
  border: 1px solid #ff9cad;
}

.priority.high {
  background: #ffe4e6;
  color: var(--brand-red);
}

.priority.medium {
  background: #dbeafe;
  color: var(--brand-blue-dark);
}

.priority.low {
  background: #e0e7ff;
  color: var(--brand-blue-dark);
}

.task-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.task-actions button {
  min-height: 34px;
  padding-inline: 10px;
  flex: 0 1 auto;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.task-actions button[data-action="toggle-description"] {
  position: relative;
  overflow: hidden;
  background: var(--brand-blue);
}

.task-actions button[data-action="toggle-description"]::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.28), transparent);
  transform: translateX(-110%);
}

.task-actions button[data-action="toggle-description"]:hover::after {
  animation: sweep 520ms ease;
}

task-completion-button {
  display: inline-flex;
  max-width: 100%;
}

task-completion-button button {
  min-height: 34px;
  max-width: 100%;
}

task-completion-button .complete-action {
  background: #087f5b;
}

.add-to-order-toggle {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--ink);
  font-weight: 850;
}

.add-to-order-toggle input {
  width: 20px;
  height: 20px;
  accent-color: var(--brand-blue);
}

@keyframes sweep {
  to {
    transform: translateX(110%);
  }
}

.empty-state {
  padding: 24px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
}

.empty-state.compact {
  padding: 12px;
}

.database-panel,
.gallery-panel,
.workload-panel,
.resilience-panel {
  overflow: hidden;
}

.workload-list {
  display: grid;
  gap: 1px;
  background: var(--line);
}

.workload-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(360px, 1.2fr);
  gap: 18px;
  align-items: center;
  padding: 15px 18px;
  background: #fff;
  border-left: 6px solid var(--team-color, var(--brand-blue));
}

.workload-person {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
}

.workload-person h3,
.workload-person p {
  margin: 0;
}

.workload-person p {
  margin-top: 2px;
  color: var(--muted);
}

.workload-metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(72px, 1fr));
  gap: 8px;
}

.workload-metrics > span {
  padding: 8px;
  background: #eef1f5;
  border-radius: 6px;
  text-align: center;
}

.workload-metrics strong {
  display: block;
  font-size: 1.18rem;
}

.load-state.heavy { background: #ffe1e6; color: #8a0d21; }
.load-state.watch { background: #fff0c2; color: #6b4600; }
.load-state.balanced { background: #dff7e8; color: #075b39; }

.resilience-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 12px;
  padding: 16px;
}

.resilience-item {
  display: grid;
  gap: 7px;
  min-height: 92px;
  align-content: center;
  padding: 14px;
  border: 1px solid var(--line);
  border-left-width: 6px;
  border-radius: 6px;
  background: #fff;
}

.resilience-item span { color: var(--muted); font-weight: 750; }
.resilience-item strong { font-size: 1.05rem; overflow-wrap: anywhere; }
.resilience-item.good { border-left-color: #087f5b; }
.resilience-item.warn { border-left-color: #c2410c; }
.resilience-item.bad { border-left-color: var(--brand-red); }

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.tab-button {
  background: #e5e9f1;
  color: var(--ink);
  min-height: 36px;
}

.tab-button.active {
  background: var(--brand-blue);
  color: #fff;
}

.doc-form,
.gallery-toolbar {
  display: grid;
  gap: 10px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.gallery-toolbar {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
}

.doc-form.is-hidden {
  display: none;
}

.doc-form input,
.doc-form textarea,
.gallery-toolbar input {
  width: 100%;
  padding: 11px 12px;
}

.doc-form textarea {
  resize: vertical;
  min-height: 130px;
}

.document-item h3,
.gallery-item h3 {
  margin-bottom: 6px;
}

.doc-body {
  white-space: pre-wrap;
  color: #2f3b49;
  line-height: 1.45;
}

.gallery-meta {
  margin: 0;
  padding: 10px 14px 0;
  font-size: 0.9rem;
}

.gallery-item {
  display: grid;
  grid-template-columns: 70px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
}

.media-chip {
  min-height: 52px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--brand-blue);
  color: #fff;
  font-weight: 950;
}

.gallery-copy {
  min-width: 0;
}

.path-line {
  margin: 0;
  color: #334155;
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 0.78rem;
  overflow-wrap: anywhere;
}

.toast {
  position: fixed;
  right: 16px;
  bottom: 16px;
  max-width: min(440px, calc(100vw - 32px));
  background: var(--ink);
  color: #fff;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
  z-index: 12;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.task-dialog {
  width: min(980px, calc(100vw - 28px));
  max-height: calc(100vh - 28px);
  padding: 0;
  border: 0;
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.task-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
}

.task-dialog-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
  background: var(--paper);
  color: var(--ink);
  max-height: calc(100vh - 28px);
  overflow: auto;
  transform-origin: top center;
}

.task-dialog[open].is-opening .task-dialog-panel {
  animation: task-dialog-in 170ms ease-out;
}

@keyframes task-dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.task-dialog-head,
.task-dialog-actions,
.task-bucket-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.task-dialog-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(3, minmax(150px, 0.6fr)) minmax(180px, 0.75fr);
  gap: 12px;
}

.task-capsule {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 2px solid var(--line);
}

.task-capsule h3 { margin: 0; }

.task-attachments-panel {
  display: grid;
  gap: 12px;
  padding-top: 14px;
  border-top: 2px solid var(--line);
}

.task-attachments-panel h3 { margin: 0; }

.task-attachments-list {
  display: grid;
  gap: 8px;
}

.task-attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
}

.task-attachment-item > div {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.task-attachment-item strong,
.task-attachment-item span { overflow-wrap: anywhere; }

.task-attachment-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.attachment-download {
  flex: 0 0 auto;
  border-radius: 6px;
  padding: 9px 11px;
  background: var(--brand);
  color: #fff;
  font-weight: 850;
  text-decoration: none;
}

.attachment-copy {
  min-width: 96px;
  text-align: center;
}

.attachment-local-note {
  max-width: 220px;
  text-align: right;
}

.attachment-count-chip {
  color: #4c1d95;
  background: #ede9fe;
}

.task-completion-panel {
  margin-top: 2px;
  padding: 14px;
  border: 1px solid #b7e3d2;
  border-radius: 8px;
  background: #f8fffc;
}

.completion-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
}

.completion-heading h3 { margin: 0; }

.completion-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 10px;
  color: #425466;
  background: #e8edf3;
  font-weight: 900;
}

.completion-status.is-completed {
  color: #075b3e;
  background: #d9f7ea;
}

.closing-comment-toggle {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 9px !important;
  margin-top: 12px;
  cursor: pointer;
}

.task-dialog .closing-comment-toggle input {
  width: 20px;
  height: 20px;
  min-height: 20px;
  padding: 0;
  flex: 0 0 auto;
}

.closing-comment-fields {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transform: translateY(-4px);
  transition: grid-template-rows 220ms cubic-bezier(.2,.8,.2,1), opacity 160ms ease, transform 220ms ease;
}

.closing-comment-fields > div {
  min-height: 0;
  overflow: hidden;
}

.closing-comment-fields.is-expanded {
  grid-template-rows: 1fr;
  opacity: 1;
  transform: translateY(0);
}

.closing-comment-fields label { padding-top: 12px; }

.task-completion-panel textarea {
  min-height: 110px;
}

.task-capsule-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.task-capsule-grid textarea {
  min-height: 92px;
}

.task-capsule-grid .capsule-wide {
  grid-column: 1 / -1;
}

.task-dialog label,
.description-field {
  display: grid;
  gap: 6px;
  font-weight: 850;
}

.field-label,
.task-dialog label span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 900;
  text-transform: uppercase;
}

.task-dialog input,
.task-dialog select {
  min-height: 42px;
  min-width: 0;
  width: 100%;
  padding: 0 11px;
}

.task-dialog textarea {
  width: 100%;
  resize: vertical;
  min-height: 240px;
  padding: 12px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.readonly-field {
  min-height: 42px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
  color: #334155;
  overflow-wrap: anywhere;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .team-rail {
    position: static;
    height: auto;
    border-right: 0;
    padding-right: 0;
  }

  .team-list {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .task-board,
  .splash-panel {
    grid-template-columns: 1fr;
  }

  .workspace-nav {
    grid-template-columns: repeat(3, minmax(150px, 1fr));
  }

  .task-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .workload-row {
    grid-template-columns: 1fr;
  }

  .resilience-grid {
    grid-template-columns: repeat(2, minmax(160px, 1fr));
  }

  .splash-ledges {
    display: none;
  }

  .task-dialog-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 820px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-controls {
    width: 100%;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-controls {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .codex-usage {
    width: 100%;
  }

  .codex-usage-heading {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    gap: 3px;
  }

  .codex-usage-heading span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .codex-usage-heading strong {
    max-width: none;
    overflow: hidden;
    text-align: left;
    text-overflow: ellipsis;
  }

  .brand-icon {
    width: 58px;
    height: 58px;
  }

  h1 {
    font-size: 1.55rem;
  }

  .date-cluster {
    grid-template-columns: minmax(0, 1fr) 44px;
  }

  .date-cluster label {
    grid-column: 1 / -1;
  }

  .team-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    padding: 0 0 8px;
    scroll-snap-type: inline proximity;
  }

  .team-button {
    flex: 0 0 220px;
    min-width: 220px;
    scroll-snap-align: start;
  }

  .workspace-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scroll-snap-type: inline proximity;
  }

  .workspace-tab {
    flex: 0 0 155px;
    min-width: 155px;
    scroll-snap-align: start;
  }

  .task-filters,
  .workload-metrics,
  .resilience-grid,
  .task-capsule-grid {
    grid-template-columns: 1fr;
  }

  .task-capsule-grid .capsule-wide {
    grid-column: auto;
  }

  .welcome-panel {
    grid-template-columns: 1fr;
    min-width: 0;
  }

  .daily-briefing {
    grid-template-columns: 1fr;
  }

  .briefing-queue {
    display: grid;
    justify-content: stretch;
  }

  .briefing-task {
    width: 100%;
    max-width: none;
  }

  .metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metric-row .metric:last-child {
    grid-column: 1 / -1;
  }

  .bucket-header,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .tabs {
    justify-content: flex-start;
  }

  .task-item,
  .gallery-item {
    grid-template-columns: 1fr;
    min-height: 132px;
    width: 100%;
    max-width: 100%;
  }

  .task-content,
  .gallery-copy {
    width: 100%;
    max-width: 100%;
  }

  .task-title,
  .task-meta,
  .task-description-preview,
  .task-actions {
    max-width: 100%;
  }

  .task-title {
    overflow-wrap: break-word;
    word-break: normal;
  }

  .task-meta {
    display: grid;
    grid-template-columns: 1fr;
    justify-items: start;
  }

  .task-actions,
  .gallery-toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .task-actions button,
  .gallery-toolbar button {
    width: 100%;
  }

  .order-number,
  .backlog-dot {
    width: 38px;
    height: 38px;
  }

  .task-dialog-grid {
    grid-template-columns: 1fr;
  }

  .completed-list {
    grid-template-columns: 1fr;
  }

  .closing-comment-bubble summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .completion-heading {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
  }
}
.service-status {
  align-items: center;
  background: #fff2f2;
  border-block: 2px solid #d80b2f;
  color: #2b0710;
  display: flex;
  gap: 20px;
  justify-content: space-between;
  padding: 14px clamp(16px, 3vw, 40px);
}

.service-status[hidden] {
  display: none;
}

.service-status p {
  margin: 4px 0 0;
}

.workday-status {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-block-end: 1px solid currentColor;
}
.workday-status > span { flex: 1 1 240px; overflow-wrap: anywhere; }
.workday-status > button { max-width: 100%; white-space: normal; }
