:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --ink: #0f172a;
  --muted: #475569;
  --line: #cbd5e1;
  --line-strong: #94a3b8;
  --midnight: #0f172a;
  --royal: #2563eb;
  --royal-dark: #1d4ed8;
  --gold: #f59e0b;
  --silver: #cbd5e1;
  --complete: #10b981;
  --blocked: #dc2626;
  --green: #2563eb;
  --green-dark: #1d4ed8;
  --blue: #2563eb;
  --amber: #f59e0b;
  --red: #dc2626;
  --yellow: #f59e0b;
  --mint: #dbeafe;
  --sand: #f8fafc;
  --white: #ffffff;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.12);
  --brand-shadow: 0 12px 28px rgba(15, 23, 42, 0.18);
  --radius: 8px;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --custom-bg-image: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  background-attachment: fixed;
  background-position: center;
  background-size: cover;
  color: var(--ink);
  font-family: var(--sans);
  letter-spacing: 0;
}

body.has-custom-background {
  background-image: linear-gradient(rgba(255, 255, 255, 0.88), rgba(248, 250, 252, 0.92)), var(--custom-bg-image);
}

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

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 1em;
  height: 1em;
  fill: currentColor;
}

.app-shell {
  display: grid;
  grid-template-columns: 270px minmax(0, 1fr);
  min-height: 100vh;
}

body.signed-out .app-shell {
  display: none;
}

body.signed-in .auth-screen {
  display: none;
}

.auth-screen {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 58%, #eef2f7 100%);
}

.auth-card {
  display: grid;
  gap: 14px;
  width: min(500px, calc(100vw - 32px));
  padding: 22px;
  border: 1px solid var(--line);
  border-top: 4px solid var(--gold);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.auth-brand {
  margin-bottom: 4px;
}

.auth-status {
  margin: 0;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.auth-status.connected {
  border-color: rgba(16, 185, 129, 0.35);
  color: #047857;
  background: rgba(16, 185, 129, 0.1);
}

.auth-status.error {
  border-color: rgba(220, 38, 38, 0.35);
  color: var(--red);
  background: rgba(220, 38, 38, 0.08);
}

.auth-form {
  display: grid;
  gap: 14px;
}

#loginForm {
  order: 1;
}

.auth-card label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

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

.create-account-panel {
  order: 2;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.create-account-panel summary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--royal);
  font-weight: 900;
  list-style: none;
  cursor: pointer;
}

.create-account-panel summary::-webkit-details-marker {
  display: none;
}

.auth-summary-signin {
  display: none;
}

.create-account-panel[open] {
  order: 1;
  border-top: 0;
  padding-top: 0;
}

.create-account-panel[open] summary {
  margin-bottom: 14px;
  border-color: var(--gold);
  color: var(--midnight);
  background: rgba(245, 158, 11, 0.1);
}

.create-account-panel[open] + #loginForm {
  display: none;
}

.create-account-panel[open] .auth-summary-create {
  display: none;
}

.create-account-panel[open] .auth-summary-signin {
  display: inline;
}

.login-error {
  min-height: 18px;
  margin: 0;
  color: var(--red);
  font-size: 0.82rem;
  font-weight: 800;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 22px;
  min-height: 100vh;
  padding: 22px 18px;
  background: linear-gradient(180deg, #071534 0%, var(--midnight) 58%, #09111f 100%);
  color: var(--white);
  border-right: 1px solid rgba(255, 255, 255, 0.14);
}

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

.brand-mark {
  display: block;
  flex: 0 0 46px;
  width: 46px;
  height: 46px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: var(--brand-shadow);
}

.auth-brand .brand-mark {
  flex-basis: 64px;
  width: 64px;
  height: 64px;
  border-radius: 16px;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel h3,
.panel p,
.project-toolbar h3,
.project-toolbar p,
.dialog-header h3,
.dialog-header p {
  margin: 0;
}

.brand h1 {
  font-size: 1.16rem;
  line-height: 1.15;
}

.brand p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.brand-wordmark {
  letter-spacing: 0;
  font-weight: 900;
}

.brand-word-proj {
  color: var(--midnight);
}

.brand-word-dex,
.tag-deliver {
  color: var(--gold);
}

.tag-plan {
  color: var(--royal);
}

.tag-coordinate {
  color: #64748b;
}

.brand-tagline {
  font-weight: 900;
}

.auth-brand .brand-wordmark {
  font-size: 1.7rem;
}

.sidebar .brand-word-proj {
  color: var(--white);
}

.sidebar .brand p {
  color: rgba(255, 255, 255, 0.74);
}

.sidebar .tag-coordinate {
  color: var(--silver);
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 10px 11px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  text-align: left;
}

.nav-item:hover,
.nav-item:focus-visible {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
  outline: none;
}

.nav-item.active {
  background: var(--white);
  color: var(--midnight);
  border-color: rgba(245, 158, 11, 0.72);
  box-shadow: inset 4px 0 0 var(--gold);
}

.icon {
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  width: 20px;
  height: 20px;
}

.sidebar-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: auto;
}

.account-panel {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.account-panel .avatar {
  width: 38px;
  height: 38px;
}

.account-panel strong {
  display: block;
  overflow: hidden;
  color: var(--white);
  font-size: 0.86rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-panel p {
  margin: 3px 0 0;
  color: rgba(255, 255, 255, 0.68);
  font-size: 0.72rem;
}

.account-panel .tiny-icon {
  background: rgba(255, 255, 255, 0.08);
  color: var(--white);
}

.account-panel + .sidebar-footer {
  margin-top: 0;
}

.mini-stat {
  min-width: 0;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.mini-stat span {
  display: block;
  color: var(--complete);
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1;
}

.mini-stat.amber span {
  color: var(--gold);
}

.mini-stat p {
  margin: 6px 0 0;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.72rem;
}

.workspace {
  min-width: 0;
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.eyebrow {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar h2 {
  margin-top: 4px;
  font-size: clamp(1.35rem, 2.2vw, 2rem);
  line-height: 1.1;
}

.topbar-actions,
.toolbar-controls,
.agent-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(360px, 42vw);
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.icon-button,
.primary-button,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: 8px;
  border: 1px solid transparent;
  text-decoration: none;
  transition: transform 120ms ease, background 120ms ease, border 120ms ease;
}

.icon-button {
  width: 42px;
  color: var(--white);
  background: var(--royal);
}

.icon-button.neutral {
  color: var(--ink);
  background: var(--surface-strong);
  border-color: var(--line);
}

.icon-button.small {
  width: 34px;
  min-height: 34px;
}

.icon-button:hover,
.primary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
}

.primary-button {
  padding: 0 14px;
  color: var(--white);
  background: var(--royal);
  box-shadow: 0 8px 18px rgba(37, 99, 235, 0.18);
}

.primary-button:hover,
.icon-button:hover {
  background: var(--royal-dark);
}

.icon-button.neutral:hover {
  background: #f8fafc;
}

.ghost-button {
  padding: 0 13px;
  color: var(--ink);
  background: var(--surface-strong);
  border-color: var(--line);
}

.ghost-button:hover {
  border-color: var(--line-strong);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 16px;
}

.summary-strip {
  display: grid;
  grid-column: 1 / -1;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.metric {
  min-width: 0;
  padding: 16px;
  border-top: 3px solid var(--silver);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 700;
}

.metric strong {
  display: block;
  margin-top: 8px;
  color: var(--royal);
  font-size: 2rem;
  line-height: 1;
}

.metric.warning strong {
  color: var(--amber);
}

.metric.warning {
  border-top-color: var(--gold);
}

.metric.danger strong {
  color: var(--red);
}

.metric.danger {
  border-top-color: var(--red);
}

.panel {
  min-width: 0;
  padding: 16px;
}

.panel-heading,
.project-toolbar,
.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.list-actions,
.image-actions,
.card-actions,
.timeline-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.list-actions select {
  width: auto;
  min-width: 112px;
}

.panel h3,
.project-toolbar h3,
.dialog-header h3 {
  margin-top: 3px;
  font-size: 1.04rem;
  line-height: 1.25;
}

select,
input,
textarea {
  width: 100%;
  min-width: 0;
  min-height: 38px;
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
  padding: 8px 10px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

.dashboard-wide {
  grid-column: 1 / -1;
}

.portfolio-panel {
  grid-column: 1 / -1;
}

.dashboard-task-feed {
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.portfolio-due-list {
  display: grid;
  gap: 10px;
}

.portfolio-due-item {
  display: grid;
  gap: 9px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.portfolio-due-item h4 {
  margin: 0;
  overflow-wrap: anywhere;
}

.task-feed,
.project-list,
.template-list,
.template-task-list,
.digest-list {
  display: grid;
  gap: 10px;
}

.feed-item,
.project-card,
.template-card,
.template-step,
.digest-card,
.contact-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.feed-item,
.template-step,
.digest-card {
  padding: 12px;
}

.feed-item {
  display: grid;
  gap: 8px;
}

.upcoming-task-card {
  align-content: space-between;
  min-height: 150px;
}

.feed-project {
  margin: 0;
  color: var(--ink);
  font-size: 1rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.feed-task {
  margin: 7px 0 0;
  color: var(--muted);
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.feed-bottom {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.owner-label {
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.due-label {
  display: grid;
  gap: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.72rem;
  text-align: right;
  white-space: nowrap;
}

.due-label strong {
  color: var(--blue);
  font-family: var(--sans);
  font-size: 0.82rem;
}

.due-label.soon strong {
  color: var(--amber);
}

.due-label.overdue strong {
  color: var(--red);
}

.feed-title,
.task-title,
.digest-card h4,
.contact-card h4,
.project-card h4,
.template-card h4 {
  margin: 0;
  overflow-wrap: anywhere;
}

.meta-row,
.chip-row,
.task-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

.chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--sand);
  color: var(--midnight);
  font-size: 0.72rem;
  font-weight: 800;
}

.chip.green {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

.chip.blue {
  background: rgba(37, 99, 235, 0.12);
  color: var(--blue);
}

.chip.amber {
  background: rgba(245, 158, 11, 0.16);
  color: #92400e;
}

.chip.red {
  background: rgba(220, 38, 38, 0.12);
  color: var(--red);
}

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

.empty-state {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.76);
  color: var(--muted);
  text-align: center;
}

.split-layout,
.template-layout,
.agent-layout {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.contacts-layout {
  display: block;
}

.project-list-panel {
  position: sticky;
  top: 18px;
}

.project-card,
.template-card {
  width: 100%;
  padding: 12px;
  color: var(--ink);
  cursor: default;
}

.project-card {
  display: grid;
  gap: 10px;
}

.project-card.active,
.template-card.active {
  border-color: var(--royal);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.project-card h4,
.template-card h4 {
  font-size: 0.94rem;
}

.project-card p,
.template-card p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}

.progress-line {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.progress-line span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--gold);
}

.card-main {
  display: grid;
  gap: 10px;
  width: 100%;
  min-height: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.card-main:hover h4 {
  color: var(--royal);
}

.card-actions {
  justify-content: flex-end;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.project-card.archived,
.template-card.archived {
  background: #f8fafc;
}

.project-detail {
  min-width: 0;
}

.project-toolbar {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.project-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.project-timeline-panel {
  margin-bottom: 14px;
}

.project-timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.timeline-item {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: start;
  gap: 10px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
}

.timeline-item .chip {
  grid-column: 1 / 3;
  justify-self: start;
}

.timeline-delete {
  grid-column: 3;
  grid-row: 1 / span 2;
}

.timeline-marker {
  width: 12px;
  height: 12px;
  margin-top: 4px;
  border: 3px solid rgba(37, 99, 235, 0.18);
  border-radius: 50%;
  background: var(--blue);
}

.timeline-item.soon .timeline-marker {
  border-color: rgba(245, 158, 11, 0.22);
  background: var(--amber);
}

.timeline-item.past .timeline-marker {
  border-color: rgba(220, 38, 38, 0.18);
  background: var(--red);
}

.timeline-item h4 {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.timeline-item p {
  margin: 4px 0 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.74rem;
}

.task-board {
  display: grid;
  grid-template-columns: repeat(5, minmax(210px, 1fr));
  gap: 12px;
  align-items: start;
  overflow-x: auto;
  padding-bottom: 6px;
}

.task-column {
  display: grid;
  gap: 10px;
  min-width: 210px;
  min-height: 320px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.86);
}

.task-column.drag-over {
  border-color: var(--royal);
  background: rgba(37, 99, 235, 0.1);
}

.task-column h4 {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.task-card {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  box-shadow: 0 8px 18px rgba(15, 23, 42, 0.08);
}

.task-card[draggable="true"] {
  cursor: grab;
}

.task-card.dragging {
  opacity: 0.55;
  cursor: grabbing;
}

.task-card .task-title {
  font-size: 0.92rem;
  line-height: 1.25;
}

.task-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tiny-icon {
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
  color: var(--ink);
}

.tiny-icon:hover {
  border-color: var(--line-strong);
}

.task-date {
  font-family: var(--mono);
  font-size: 0.72rem;
  color: var(--muted);
}

.task-date.overdue {
  color: var(--red);
  font-weight: 800;
}

.template-card {
  display: grid;
  gap: 10px;
}

.template-step {
  display: grid;
  gap: 9px;
}

.step-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.step-actions {
  display: flex;
  gap: 6px;
}

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}

.contact-card {
  display: grid;
  gap: 10px;
  padding: 14px;
}

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

.avatar {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--mint);
  color: var(--royal);
  font-weight: 900;
}

.contact-card a {
  color: var(--blue);
  overflow-wrap: anywhere;
  text-decoration: none;
}

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

.settings-grid label,
.dialog-fields label,
.field-block {
  display: grid;
  gap: 6px;
  min-width: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.field-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.digest-card .ghost-button[disabled] {
  opacity: 0.55;
  pointer-events: none;
}

.agent-actions {
  margin-top: 14px;
  justify-content: flex-start;
  flex-wrap: wrap;
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}

.switch input {
  position: absolute;
  opacity: 0;
}

.switch span {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--silver);
  transition: background 120ms ease;
}

.switch span::after {
  content: "";
  position: absolute;
  width: 22px;
  height: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: var(--white);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
  transition: transform 120ms ease;
}

.switch input:checked + span {
  background: var(--royal);
}

.switch input:checked + span::after {
  transform: translateX(20px);
}

.digest-card {
  display: grid;
  gap: 10px;
}

.digest-card h4 {
  font-size: 0.98rem;
}

.digest-card pre {
  max-height: 160px;
  margin: 0;
  padding: 10px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--midnight);
  font-family: var(--mono);
  font-size: 0.75rem;
  white-space: pre-wrap;
}

dialog {
  width: min(700px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
  color: var(--ink);
}

dialog::backdrop {
  background: rgba(15, 23, 42, 0.48);
}

.dialog-card {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

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

.multi-check-list {
  display: grid;
  gap: 6px;
  max-height: 160px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--white);
}

.dialog-fields label.check-row {
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 700;
}

.check-row input {
  width: 16px;
  min-height: 16px;
}

.dialog-fields label.full {
  grid-column: 1 / -1;
}

.dialog-fields .field-block.full {
  grid-column: 1 / -1;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 16px;
}

#toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 30;
  max-width: min(520px, calc(100vw - 32px));
  padding: 10px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 8px;
  background: var(--midnight);
  color: var(--white);
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 160ms ease, transform 160ms ease;
}

#toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 1180px) {
  .task-board {
    grid-template-columns: repeat(5, minmax(225px, 1fr));
  }
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    min-height: auto;
    position: sticky;
    top: 0;
    z-index: 10;
    display: grid;
    grid-template-columns: minmax(180px, auto) 1fr auto;
    align-items: center;
    padding: 12px;
  }

  .nav-list {
    display: flex;
    overflow-x: auto;
  }

  .nav-item {
    white-space: nowrap;
  }

  .sidebar-footer {
    display: none;
  }

  .dashboard-grid,
  .split-layout,
  .template-layout,
  .agent-layout {
    grid-template-columns: 1fr;
  }

  .project-list-panel {
    position: static;
  }

  .project-list,
  .template-list {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  }

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

@media (max-width: 720px) {
  .workspace {
    padding: 14px;
  }

  .topbar,
  .project-toolbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar-actions,
  .toolbar-controls {
    width: 100%;
    flex-wrap: wrap;
  }

  .search-box {
    width: 100%;
  }

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

  .settings-grid,
  .create-account-fields,
  .dialog-fields {
    grid-template-columns: 1fr;
  }

  .dialog-fields label.full {
    grid-column: auto;
  }
}

@media (max-width: 540px) {
  .sidebar {
    grid-template-columns: 1fr;
  }

  .brand {
    padding: 2px 4px;
  }

  .nav-item {
    flex: 0 0 auto;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .metric strong {
    font-size: 1.72rem;
  }

  .toolbar-controls > select,
  .toolbar-controls > button,
  .timeline-actions > button,
  .agent-actions > button {
    width: 100%;
  }

  .project-timeline {
    grid-template-columns: 1fr;
  }

  .feed-bottom {
    align-items: flex-start;
    flex-direction: column;
  }

  .due-label {
    text-align: left;
  }
}
