/* ForwardWorks Team Portal — uses the forwardworks.net design tokens */
*, *::before, *::after { box-sizing: border-box; }
:root {
  --blue: #0078aa; --blue-hover: #005f87; --blue-light: #e6f4fb; --blue-text: #004d6e;
  --green: #468520; --green-hover: #39700f; --green-light: #eef6e6; --green-text: #2d5a10;
  --amber-light: #fdf3dc; --amber-text: #6b4a00; --amber-border: #e0b64a;
  --red: #b3261e; --red-light: #fdecea;
  --text: #1a1a2e; --text-mid: #3d4a5c; --text-light: #595f68;
  --border: #b0b8c4; --border-light: #d6dce4;
  --bg: #fff; --bg-soft: #f5f7fa;
  --focus-ring: 0 0 0 3px #0078aa, 0 0 0 5px #fff;
  --radius: 10px;
}
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: 'DM Sans', system-ui, -apple-system, 'Segoe UI', sans-serif; color: var(--text); background: var(--bg-soft); font-size: 16px; line-height: 1.6; }
h1, h2, h3 { font-family: 'Inter', 'DM Sans', sans-serif; line-height: 1.25; color: var(--text); margin: 0 0 .5rem; }
h1 { font-size: clamp(1.6rem, 3vw, 2.1rem); letter-spacing: -0.3px; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
.h-small { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--blue-text); text-underline-offset: 2px; }
a:hover { color: var(--blue-hover); }
:focus-visible { outline: none; box-shadow: var(--focus-ring) !important; border-radius: 4px; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92em; background: var(--bg-soft); padding: 1px 5px; border-radius: 4px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .92rem; }
.muted { color: var(--text-light); }
.small { font-size: .875rem; }
.count { font-weight: 500; color: var(--text-light); font-size: .9em; }
.optional { font-weight: 400; color: var(--text-light); font-size: .875rem; }
.prewrap { white-space: pre-wrap; overflow-wrap: anywhere; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

/* Skip link */
.skip-link { position: absolute; top: -100px; left: 16px; z-index: 999; background: var(--blue); color: #fff; padding: 10px 18px; border-radius: 0 0 8px 8px; font-weight: 500; text-decoration: none; }
.skip-link:focus { top: 0; color: #fff; }

/* Top bar */
.topbar { background: #fff; border-bottom: 2px solid var(--border-light); }
.topbar-inner { max-width: 1200px; margin: 0 auto; padding: 10px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; }
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand-logo { height: 40px; width: auto; display: block; }
.brand-name { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1rem; color: var(--blue-text); border-left: 2px solid var(--border-light); padding-left: 10px; }
.mainnav { flex: 1 1 auto; }
.mainnav ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.mainnav a { display: inline-block; padding: 8px 12px; border-radius: 6px; text-decoration: none; color: var(--text-mid); font-size: .95rem; }
.mainnav a:hover { background: var(--blue-light); color: var(--blue-text); }
.mainnav a[aria-current="page"] { background: var(--blue-light); color: var(--blue-text); font-weight: 600; }
.account { display: flex; align-items: center; gap: 14px; font-size: .9rem; }
.account-name { color: var(--text-light); }

/* Layout */
main { outline: none; }
.container { max-width: 1200px; margin: 0 auto; padding: 24px 20px 48px; }
.site-footer { border-top: 1px solid var(--border-light); background: #fff; color: var(--text-light); font-size: .85rem; }
.site-footer .container { padding: 16px 20px; }
.section { margin: 28px 0; }
.crumbs { font-size: .9rem; color: var(--text-light); margin-bottom: .4rem; }
.eyebrow { font-size: .78rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--blue); margin: 0 0 4px; }
.empty { color: var(--text-light); background: #fff; border: 1px dashed var(--border); border-radius: var(--radius); padding: 16px; }

/* Panels */
.panel { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.panel-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px 16px; margin-bottom: 8px; }
.panel-quiet { background: var(--bg-soft); }
.panel-highlight { border: 2px solid var(--green); background: var(--green-light); }
.panel-request { border-left: 4px solid var(--blue); }

/* Flash messages */
.flashes { margin-bottom: 16px; }
.flash { border-radius: 8px; padding: 12px 16px; margin: 0 0 8px; border: 1px solid; }
.flash-success { background: var(--green-light); border-color: #a9cf8e; color: var(--green-text); }
.flash-error { background: var(--red-light); border-color: #f1a9a4; color: #7a1a14; }
.flash-info { background: var(--blue-light); border-color: #9fd0e8; color: var(--blue-text); }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; padding: 11px 22px; border-radius: var(--radius); font: inherit; font-weight: 600; font-size: .95rem; line-height: 1.1; text-decoration: none; cursor: pointer; border: 2px solid transparent; white-space: nowrap; }
.btn-primary { background: var(--green); color: #fff; border-color: var(--green); }
.btn-primary:hover { background: var(--green-hover); border-color: var(--green-hover); color: #fff; }
.btn-secondary { background: #fff; color: var(--blue-text); border-color: var(--blue); }
.btn-secondary:hover { background: var(--blue-light); color: var(--blue-text); }
.btn-danger { background: #fff; color: var(--red); border-color: var(--red); }
.btn-danger:hover { background: var(--red-light); }
.btn-sm { padding: 7px 14px; font-size: .875rem; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--blue-text); text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
.link-button:hover { color: var(--blue-hover); }
.link-button.danger, a.danger { color: var(--red); }
.inline-form { display: inline; margin: 0; }
.row-actions { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; margin: 8px 0 0; }
.form-actions { display: flex; gap: 18px; align-items: center; margin-top: 8px; }

/* Forms */
.stack > * + * { margin-top: 14px; }
.stack-sm > * + * { margin-top: 10px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .field legend { font-weight: 600; font-size: .92rem; color: var(--text); }
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
fieldset.panel { padding: 20px; border: 1px solid var(--border-light); }
fieldset.panel > legend { font-family: 'Inter', sans-serif; font-weight: 700; font-size: 1.1rem; padding: 0 6px; margin-left: -6px; }
fieldset.panel > * + * { margin-top: 14px; }
.hint { font-size: .85rem; color: var(--text-light); margin: 0; }
input[type=text], input[type=email], input[type=password], input[type=url], input[type=date], input[type=search], input:not([type]), select, textarea {
  font: inherit; font-size: 1rem; color: var(--text); background: #fff; border: 1.5px solid var(--border); border-radius: 8px; padding: 9px 11px; width: 100%; min-height: 44px;
}
textarea { min-height: 0; resize: vertical; line-height: 1.5; }
input:hover, select:hover, textarea:hover { border-color: var(--text-light); }
input:focus-visible, select:focus-visible, textarea:focus-visible { border-color: var(--blue); }
[aria-invalid="true"] { border-color: var(--red) !important; }
.field-error { color: var(--red); font-size: .88rem; font-weight: 500; margin: 2px 0 0; }
.field-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; align-items: end; }
.field-button { justify-content: flex-end; }
.check-row { display: flex; gap: 10px; align-items: flex-start; }
.check-row input[type=checkbox], .field-check input { width: 20px; height: 20px; margin-top: 3px; accent-color: var(--green); flex: none; }
.check-row label { font-weight: 500; }
.form-grid { display: grid; gap: 20px; max-width: 860px; }

/* Auth pages */
.auth-card { max-width: 440px; margin: 40px auto; background: #fff; border: 1px solid var(--border-light); border-radius: 14px; padding: 32px; }
.auth-card-wide { max-width: 600px; }

/* Space header, tabs, filters */
.space-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 12px 24px; margin-bottom: 12px; }
.tabs { border-bottom: 2px solid var(--border-light); margin-bottom: 20px; }
.tabs ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.tabs a { display: inline-block; padding: 10px 14px; text-decoration: none; color: var(--text-mid); border-bottom: 3px solid transparent; margin-bottom: -2px; font-weight: 500; }
.tabs a:hover { color: var(--blue-text); }
.tabs a[aria-current="page"] { color: var(--blue-text); border-bottom-color: var(--blue); font-weight: 600; }
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px 14px; align-items: end; background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }
.filters .field label { font-size: .85rem; }
.field-check { flex-direction: row; align-items: center; gap: 8px; min-height: 44px; }
.filter-actions { display: flex; gap: 14px; align-items: center; min-height: 44px; }

/* Task lists */
.task-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.task-card { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); padding: 14px 16px; }
.task-card:hover { border-color: var(--border); }
.task-card-title { font-size: 1.02rem; margin: 0 0 4px; }
.task-card-title a { text-decoration: none; color: var(--text); }
.task-card-title a:hover { color: var(--blue-text); text-decoration: underline; }
.task-card-meta, .task-meta { display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: .88rem; color: var(--text-mid); margin: 0 0 8px; }
.task-card-foot { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; }
.task-list-compact .task-card { padding: 10px 14px; }

/* Badges, progress, due */
.badge { display: inline-block; font-size: .8rem; font-weight: 600; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border-light); background: var(--bg-soft); color: var(--text-mid); white-space: nowrap; }
.badge-not_started { background: #f0f2f5; color: #3d4a5c; border-color: #cfd6df; }
.badge-in_progress { background: var(--blue-light); color: var(--blue-text); border-color: #9fd0e8; }
.badge-review { background: var(--amber-light); color: var(--amber-text); border-color: var(--amber-border); }
.badge-done { background: var(--green-light); color: var(--green-text); border-color: #a9cf8e; }
.progress { display: inline-flex; align-items: center; gap: 8px; font-size: .85rem; color: var(--text-mid); }
.progress progress { width: 110px; height: 8px; appearance: none; -webkit-appearance: none; border: 0; border-radius: 99px; background: var(--border-light); overflow: hidden; }
.progress progress::-webkit-progress-bar { background: var(--border-light); border-radius: 99px; }
.progress progress::-webkit-progress-value { background: var(--green); border-radius: 99px; }
.progress progress::-moz-progress-bar { background: var(--green); border-radius: 99px; }
.due { font-weight: 500; }
.due-late { color: var(--red); font-weight: 600; }

/* Task page */
.task-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 32px; margin-bottom: 20px; }
.task-head > div:first-child { flex: 1 1 480px; }
.status-box { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); padding: 14px 16px; align-self: flex-start; }
.status-now { margin: 0 0 8px; font-weight: 600; }
.status-form { display: flex; gap: 8px; align-items: center; }
.status-form select { width: auto; }
.task-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); gap: 20px; align-items: start; }
@media (max-width: 900px) { .task-layout { grid-template-columns: 1fr; } }

/* Checklist */
.steps { list-style: none; margin: 8px 0 0; padding: 0; }
.step { display: flex; gap: 14px; padding: 12px 0; border-top: 1px solid var(--border-light); }
.step:first-child { border-top: 0; }
.step-toggle { margin: 0; flex: none; }
.check { width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center; background: none; border: 0; padding: 0; cursor: pointer; border-radius: 8px; flex: none; }
.check:hover .check-box { border-color: var(--green); background: var(--green-light); }
.check-box { width: 26px; height: 26px; border: 2px solid var(--border); border-radius: 6px; background: #fff; position: relative; display: block; }
.check[aria-pressed="true"] .check-box, .step.is-done .check-static .check-box { background: var(--green); border-color: var(--green); }
.check[aria-pressed="true"] .check-box::after, .step.is-done .check-static .check-box::after { content: ''; position: absolute; left: 7px; top: 2px; width: 7px; height: 13px; border: solid #fff; border-width: 0 3px 3px 0; transform: rotate(45deg); }
.check-static { cursor: default; }
.step-body { flex: 1 1 auto; min-width: 0; padding-top: 9px; }
.step-label { margin: 0; font-weight: 500; }
.step.is-done .step-label { color: var(--text-light); }
.step-num { color: var(--text-light); font-weight: 400; }
.step-help { margin: 2px 0 0; font-size: .87rem; color: var(--text-light); }
.step-meta { margin: 2px 0 0; font-size: .82rem; color: var(--green-text); font-weight: 500; }
.step-meta:empty { display: none; }
.step-note { margin: 6px 0 0; font-size: .9rem; background: var(--amber-light); border-left: 3px solid var(--amber-border); padding: 6px 10px; border-radius: 0 6px 6px 0; }
.note-label { font-weight: 600; }
details { margin-top: 8px; }
summary { cursor: pointer; color: var(--blue-text); font-weight: 500; font-size: .9rem; width: fit-content; padding: 2px 0; }
summary:hover { text-decoration: underline; }
details[open] > summary { margin-bottom: 8px; }
.step-more form + form { margin-top: 8px; }
.add-step { border-top: 1px solid var(--border-light); padding-top: 12px; }

/* Request */
.request-meta { font-size: .85rem; color: var(--text-mid); margin: 0 0 6px; }
.lock { display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--blue-text); background: var(--blue-light); border-radius: 4px; padding: 1px 7px; margin-right: 6px; }
.request-quote { margin: 0 0 12px; padding: 12px 16px; background: var(--bg-soft); border-radius: 8px; font-size: .97rem; }
.addenda, .request-list, .comments, .history, .links, .type-steps { margin: 0; padding: 0; list-style: none; }
.addenda > li + li, .comments > li + li { margin-top: 12px; }
.request-item { background: #fff; border: 1px solid var(--border-light); border-left: 4px solid var(--blue); border-radius: var(--radius); padding: 14px 16px; margin-bottom: 12px; }

/* Comments, links, history */
.comment { border-top: 1px solid var(--border-light); padding-top: 10px; }
.comment:first-child { border-top: 0; padding-top: 0; }
.comment-meta { font-size: .85rem; color: var(--text-mid); margin: 0 0 2px; }
.links li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 12px; padding: 6px 0; border-top: 1px solid var(--border-light); }
.links li:first-child { border-top: 0; }
.history li { font-size: .87rem; padding: 5px 0; border-top: 1px solid var(--border-light); }
.history-when { color: var(--text-light); display: block; font-size: .8rem; }
.type-steps { counter-reset: s; }
.type-steps li { counter-increment: s; padding: 4px 0 4px 28px; position: relative; }
.type-steps li::before { content: counter(s) '.'; position: absolute; left: 0; color: var(--text-light); }

/* Dashboard */
.space-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.space-card { background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); padding: 16px 18px; }

/* Tables */
.table { width: 100%; border-collapse: collapse; background: #fff; border: 1px solid var(--border-light); border-radius: var(--radius); margin-bottom: 20px; font-size: .93rem; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border-light); vertical-align: top; }
.table thead th { background: var(--bg-soft); font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-mid); }
.table tbody th { font-weight: 600; }
.table .actions { display: flex; flex-wrap: wrap; gap: 6px 14px; }
.row-muted { color: var(--text-light); }
.temp-pw code { font-size: 1.15rem; padding: 3px 8px; background: #fff; }
.board-row { border-top: 1px solid var(--border-light); padding-top: 12px; margin-top: 12px; }
.board-name { margin: 0; align-self: center; }

@media (max-width: 640px) {
  .container { padding: 16px 16px 40px; }
  .panel, fieldset.panel { padding: 16px; }
  .table thead { display: none; }
  .table, .table tbody, .table tr, .table th, .table td { display: block; width: 100%; }
  .table tr { border-bottom: 2px solid var(--border-light); padding: 6px 0; }
  .table th, .table td { border: 0; padding: 4px 12px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
@media (forced-colors: active) { .check-box { border: 2px solid CanvasText; } .check[aria-pressed="true"] .check-box { background: Highlight; } }

/* Branch tabs (boards) at the top of a space */
.branches { margin: 0 0 16px; }
.branches ul { list-style: none; margin: 0; padding: 4px; display: inline-flex; flex-wrap: wrap; gap: 4px; background: #fff; border: 1px solid var(--border-light); border-radius: 12px; }
.branches a { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 8px 18px; border-radius: 9px; text-decoration: none; color: var(--text-mid); font-weight: 600; }
.branches a:hover { background: var(--blue-light); color: var(--blue-text); }
.branches a[aria-current="page"] { background: var(--blue); color: #fff; }
.branch-count { font-size: .8rem; font-weight: 600; min-width: 1.6em; padding: 1px 7px; border-radius: 999px; background: var(--bg-soft); color: var(--text-mid); text-align: center; }
.branches a[aria-current="page"] .branch-count { background: rgba(255,255,255,.22); color: #fff; }
.branch-owner { margin: 8px 0 0; }
@media (forced-colors: active) { .branches a[aria-current="page"] { outline: 2px solid Highlight; } }
