.button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 9px 17px; border: 1px solid transparent; border-radius: var(--radius-md); cursor: pointer; text-decoration: none; font-weight: 700; transition: background-color 180ms ease-out, color 180ms ease-out, border-color 180ms ease-out; }
.button-primary { background: var(--gold); color: var(--navy); }
.button-primary:hover { background: var(--gold-deep); color: var(--surface); }
.button-secondary { background: var(--surface); color: var(--navy); border-color: var(--border); }
.button-secondary:hover { border-color: var(--navy-soft); }
.button-ghost { background: transparent; color: inherit; border-color: transparent; padding-inline: 0; }
.button-danger { background: var(--danger-tint); color: var(--danger); border-color: oklch(0.78 0.09 28); }
.button-row { display: flex; flex-wrap: wrap; gap: 9px; }

.alert { border: 1px solid currentColor; border-radius: var(--radius-md); padding: 11px 14px; margin-bottom: 18px; }
.alert-success { color: var(--success); background: var(--success-tint); }
.alert-error { color: var(--danger); background: var(--danger-tint); }
.health-note { margin-top: 18px; }
.form-surface { display: grid; gap: 18px; padding: 24px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); }
.narrow-form { max-width: 650px; }
.stack-form { display: grid; gap: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 20px; }
.form-actions { display: flex; justify-content: flex-start; gap: 10px; padding-top: 4px; }
.form-hint { color: var(--muted); }
.form-context { display: flex; flex-wrap: wrap; gap: 10px 22px; padding: 12px 14px; background: var(--gold-tint); border-radius: var(--radius-md); }
.inline-form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; }
.inline-form label { flex: 1 1 280px; }
.check-label { min-height: 44px; display: flex; grid: none; align-items: center; gap: 10px; padding-block: 6px; font-weight: 500; cursor: pointer; }
.check-label input { width: 22px; height: 22px; min-height: 22px; flex: 0 0 22px; }
.choice-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 18px; }
.role-section[hidden] { display: none; }
.filter-bar { display: grid; grid-template-columns: 2fr 1fr 1fr auto; align-items: end; gap: 12px; margin-bottom: 18px; }

.table-wrap { width: 100%; overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { padding: 12px 14px; text-align: right; vertical-align: top; border-bottom: 1px solid var(--border); }
th { background: var(--gold-tint); font-size: 0.86rem; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: oklch(0.97 0.015 85); }
td strong + small { margin-top: 2px; }
td textarea, td select { min-width: 170px; }
.status { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 0.78rem; font-weight: 700; white-space: nowrap; background: var(--gold-tint); color: var(--navy); }
.status-completed, .status-deployed { background: var(--success-tint); color: var(--success); }
.status-returned, .status-cancelled, .status-stopped { background: var(--danger-tint); color: var(--danger); }
.status-pending_review, .status-awaiting_approval { background: var(--warning-tint); color: var(--warning); }
.status-in_progress, .status-testing, .status-ready_to_deploy { background: oklch(0.94 0.035 255); color: var(--info); }

.status-strip { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--border); }
.status-strip a { display: grid; gap: 2px; padding: 16px 18px; background: var(--surface); color: var(--navy); text-decoration: none; }
.status-strip strong { font-size: 1.5rem; }
.status-strip span { color: var(--muted); font-size: 0.84rem; }
.empty-state { padding: 42px 20px; text-align: center; border: 1px dashed var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.empty-state p { margin-inline: auto; color: var(--muted); }
.danger-zone { margin-top: 28px; padding: 20px; border: 1px solid oklch(0.78 0.09 28); border-radius: var(--radius-lg); background: var(--danger-tint); }
.task-summary { display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.task-summary > div { display: grid; gap: 6px; padding: 16px; background: var(--surface); border-inline-start: 1px solid var(--border); }
.task-summary > div:first-child { border-inline-start: 0; }
.task-summary span { color: var(--muted); font-size: 0.82rem; }
.detail-row { display: grid; grid-template-columns: minmax(140px, 25%) 1fr; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.detail-row span { color: var(--muted); }
.detail-row-emphasis { margin-top: 8px; padding: 12px; background: var(--gold-tint); border-radius: var(--radius-md); border-bottom: 0; }
.review-panel { margin-top: 28px; padding: 22px; background: var(--warning-tint); border: 1px solid oklch(0.82 0.08 80); border-radius: var(--radius-lg); }
.file-list { list-style: none; padding: 0; margin: 16px 0 0; }
.file-list li { min-width: 0; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.file-list span { color: var(--muted); font-size: 0.82rem; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 12px 0; border-bottom: 1px solid var(--border); }
.timeline li > div { display: flex; justify-content: space-between; gap: 12px; }
.timeline time { color: var(--muted); font-size: 0.82rem; }
.timeline p { margin-bottom: 0; }
.readiness { display: flex; align-items: center; flex-wrap: wrap; gap: 9px 14px; padding: 14px 16px; margin-bottom: 18px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--gold-tint); }
.readiness span { padding: 3px 9px; background: var(--surface); border-radius: 999px; font-size: 0.82rem; }
.readiness small { flex-basis: 100%; }
.report-editor { display: grid; gap: 22px; }
.sticky-actions { position: sticky; bottom: 12px; display: flex; justify-content: flex-end; gap: 9px; padding: 12px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: oklch(0.985 0.006 85 / 0.96); box-shadow: var(--shadow-raised); }
.refresh-form { margin-top: 12px; }
.export-panel { padding: 24px; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
.template-fields { display: grid; gap: 8px; }
.template-field { display: grid; grid-template-columns: 1.25fr 1fr .7fr 1.4fr .55fr; gap: 8px; align-items: center; }
.template-field-head { color: var(--muted); font-size: .78rem; font-weight: 700; padding: 0 4px; }
.target-list { list-style: none; padding: 0; margin: 18px 0 0; }
.target-list li { min-width: 0; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.social-form-intro { padding: 12px 14px; color: var(--navy); background: color-mix(in srgb, var(--gold) 12%, white); border-inline-start: 4px solid var(--gold); border-radius: var(--radius-sm); }
.field-hint { color: var(--muted); font-size: .82rem; font-weight: 400; }
.optional-fields { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--surface); }
.optional-fields summary { cursor: pointer; padding: 14px 16px; color: var(--navy); font-weight: 700; }
.optional-fields summary span { color: var(--muted); font-size: .8rem; font-weight: 400; }
.optional-fields[open] summary { border-bottom: 1px solid var(--border); }
.optional-fields > .form-grid { padding: 16px; }
.social-task-form .form-actions small { color: var(--muted); }
.pagination { display: flex; justify-content: center; gap: 10px; margin-top: 20px; }

@media (max-width: 900px) {
    .status-strip { grid-template-columns: repeat(2, 1fr); }
    .form-grid, .choice-grid, .task-summary { grid-template-columns: 1fr; }
    .template-field { grid-template-columns: 1fr; padding: 14px 0; border-bottom: 1px solid var(--border); }
    .template-field-head { display: none; }
    .task-summary > div { border-inline-start: 0; border-bottom: 1px solid var(--border); }
    .task-summary > div:last-child { border-bottom: 0; }
    .filter-bar { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 560px) {
    .filter-bar { grid-template-columns: 1fr; }
    .status-strip { grid-template-columns: 1fr 1fr; }
    .form-surface, .section-block { padding: 16px; }
    .sticky-actions { position: static; flex-direction: column; }
    .button-row .button, .sticky-actions .button { flex: 1 1 auto; }
}

@media (max-width: 720px) {
    .table-wrap { overflow: visible; border: 0; background: transparent; }
    table { display: block; min-width: 0; }
    thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
    tbody { display: grid; gap: 12px; }
    tbody tr { display: block; overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius-lg); background: var(--surface); }
    tbody tr:hover { background: var(--surface); }
    tbody td { min-width: 0; display: grid; grid-template-columns: minmax(7.5rem, 36%) minmax(0, 1fr); gap: 10px; padding: 10px 12px; text-align: start; }
    tbody td::before { content: attr(data-label); color: var(--muted); font-size: .78rem; font-weight: 700; }
    tbody td:empty { display: none; }
    td textarea, td select, td input { min-width: 0; }
    .detail-row { grid-template-columns: 1fr; gap: 2px; }
    .timeline li > div { flex-direction: column; gap: 2px; }
}

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