/* Visual tokens follow Drawing Registry; application content remains independent. */
:root {
  --bg: #f4f6f8;
  --panel: #fff;
  --ink: #182230;
  --muted: #667085;
  --line: #d9e0e8;
  --section-dark: #4b4b4b;
  --sidebar: var(--section-dark);
  --sidebar-deep: var(--section-dark);
  --accent: #10367d;
  --shadow: 0 8px 22px rgba(16,24,40,.06);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: var(--bg);
}
.login-page { min-height: 100vh; padding: 24px; display: grid; place-items: center; background: linear-gradient(135deg, rgba(16,54,125,.08), transparent 34%), var(--bg); }
.login-card { width: min(420px,100%); display: grid; gap: 16px; padding: 30px; background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); }
.login-brand { color: var(--accent); font-size: 11px; font-weight: 800; text-transform: uppercase; margin-bottom: 8px; }
.login-card h1 { font-size: 24px; margin: 8px 0 0; }
.login-card form { display: grid; gap: 16px; }
.login-card label { display: block; font-size: 12px; margin: 0 0 -12px; }
.login-card .button { width: 100%; margin-top: 8px; }
#login-error { color: #b42318; margin: 0; }
#login-error:empty { display: none; }
* { box-sizing: border-box; }
body { margin: 0; }
button,input,select { font: inherit; }
button { cursor: pointer; }
a { color: inherit; }
.topbar { min-height: 76px; display: flex; align-items: center; gap: 32px; padding: 16px 26px; border-bottom: 1px solid var(--line); background: var(--panel); }
.brand { width: 196px; flex-shrink: 0; font-size: 13px; font-weight: 800; text-transform: uppercase; color: var(--accent); line-height: 1.5; }
.project-switch { display: flex; align-items: center; gap: 12px; max-width: 540px; flex: 1; }
.project-switch label { color: var(--muted); font-size: 12px; font-weight: 700; }
input,select { width: 100%; min-height: 38px; padding: 8px 10px; font-size: 14px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 6px; }
select:disabled { color: var(--muted); background: var(--bg); }
.sidebar { position: fixed; top: 76px; bottom: 0; width: 248px; display: flex; flex-direction: column; padding: 18px 12px 24px; background: var(--sidebar); border-right: 1px solid var(--sidebar); }
nav { display: grid; gap: 6px; }
nav a,.planned,.settings-link,.logout-link { display: flex; align-items: center; min-height: 42px; padding: 0 12px; border-left: 3px solid transparent; border-radius: 6px; font-weight: 750; text-decoration: none; color: #fff; }
nav a.active,.settings-link.active,nav a:hover,.settings-link:hover,.logout-link:hover { color: #fff; background: rgba(255,255,255,.16); border-left-color: #fff; }
.logout-link { flex-shrink: 0; width: 100%; background: transparent; border-top: 0; border-right: 0; border-bottom: 0; text-align: left; }
.planned { color: var(--muted); cursor: default; }
.settings-link { margin-top: auto; }
main { margin-left: 248px; padding: 26px; min-width: 0; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; min-height: 38px; }
h1 { font-size: 24px; margin: 0; letter-spacing: -.4px; }
h2 { font-size: 16px; margin: 0; }
p { color: var(--muted); line-height: 1.6; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 8px; box-shadow: var(--shadow); overflow: hidden; }
.card-title { min-height: 58px; padding: 14px 16px; display: flex; align-items: center; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.tag { color: var(--muted); font-size: 12px; }
.empty { min-height: 265px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 32px; text-align: center; }
.empty h2 { font-size: 18px; }
.empty p { margin: 10px 0 20px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 36px; padding: 8px 13px; font-size: 14px; font-weight: 750; text-decoration: none; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); }
.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.primary:hover { background: #0b275c; }
.secondary:hover { background: #e7ecf2; }
.button:active { transform: translateY(1px); }
.details { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 24px; margin: 0; padding: 24px 16px; }
.details dt { font-size: 12px; color: var(--muted); margin-bottom: 8px; }
.details dd { margin: 0; font-weight: 650; overflow-wrap: anywhere; }
.project-table { width: 100%; border-collapse: collapse; text-align: left; }
.project-table th { font-size: 14px; font-weight: 700; color: var(--ink); background: var(--bg); padding: 10px 16px; border-bottom: 1px solid var(--line); }
.package-title { font-weight: 800; }
.card-title .packages-heading { font-size: 14px; font-weight: 700; }
.project-table td { padding: 18px 16px; border-bottom: 1px solid var(--line); overflow-wrap: anywhere; }
.project-table tr:last-child td { border-bottom: 0; }
.project-table button { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; text-align: left; font-weight: 650; }
.project-table th .sort-button { color: inherit; text-decoration: none; font: inherit; width: 100%; }
dialog { margin: 0 0 0 auto; height: 100%; max-height: 100%; width: 460px; max-width: 100%; padding: 0; border: 0; color: var(--ink); box-shadow: -10px 0 45px #0002; }
dialog::backdrop { background: #18223055; }
dialog form { height: 100%; display: flex; flex-direction: column; }
.panel-head { min-height: 70px; padding: 16px 24px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.icon-button { width: 34px; height: 34px; border-radius: 6px; border: 1px solid var(--line); background: white; color: var(--ink); font-size: 23px; }
.panel-body { padding: 24px; overflow: auto; }
.panel-body label { display: block; font-size: 12px; font-weight: 700; margin-bottom: 22px; }
input { margin-top: 7px; font-weight: 400; }
.panel-footer { margin-top: auto; border-top: 1px solid var(--line); padding: 20px 24px; display: flex; justify-content: flex-end; gap: 10px; }
#form-error { color: #b42318; }
#notification:not(:empty) { position: fixed; bottom: 24px; right: 24px; padding: 14px 20px; border-radius: 6px; background: var(--ink); color: white; }
.skip { position: fixed; top: -100px; }
.skip:focus { top: 10px; background: white; padding: 12px; z-index: 9; }
:focus-visible { outline: 3px solid #2d6cdf; outline-offset: 3px; }
button:disabled { opacity: .6; cursor: wait; }
@media(max-width:800px) { .sidebar { width: 200px; } main { margin-left: 200px; padding: 20px; } .brand { width: 148px; } .topbar { gap: 24px; } }
@media(max-width:600px) { .topbar { flex-wrap: wrap; gap: 12px; padding: 16px; } .brand { width: 100%; } .project-switch { flex-basis: 100%; } .sidebar { position: static; width: 100%; padding: 12px; } nav { grid-template-columns: repeat(2,minmax(0,1fr)); } .settings-link { margin-top: 6px; } main { margin: 0; padding: 20px 16px; } .details { grid-template-columns: 1fr; } .project-table th,.project-table td { padding: 10px 8px; } }

/* Delivery workspace */
.topbar { position: sticky; top: 0; z-index: 3; height: 76px; }
main > .card { margin-bottom: 20px; }
.section-body { padding: 16px; }
.section-body > .button { margin-right: 8px; }
.section-body p { margin-top: 0; }
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin: 0 0 20px; flex-wrap: wrap; }
.tabs button { font-size: 12px; border: 0; border-bottom: 3px solid transparent; background: none; color: var(--muted); font-weight: 650; padding: 12px 16px; }
.tabs button.selected { color: var(--accent); border-bottom-color: var(--accent); }
.toolbar { display: flex; align-items: center; gap: 10px; margin: 0 0 18px; flex-wrap: wrap; }
.view-switch { margin-left: auto; display: flex; gap: 5px; }
.filters { display: grid; grid-template-columns: repeat(6,minmax(130px,1fr)); gap: 12px; padding: 16px; background: white; border: 1px solid var(--line); border-radius: 8px; }
.issue-date-controls { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(auto-fit,minmax(180px,1fr)); gap: 12px; }
.filters label { font-size: 12px; font-weight: 650; color: var(--muted); }
.filters select { margin-top: 7px; font-size: 13px; }
.filters .button { align-self: end; }
.results-count { color: var(--muted); font-size: 12px; margin: 16px 0; }
.item-grid { display: grid; grid-template-columns: repeat(auto-fill,minmax(290px,1fr)); gap: 16px; }
.item-card { border: 1px solid var(--line); border-radius: 8px; background: white; padding: 18px; box-shadow: var(--shadow); display: flex; flex-direction: column; min-width: 0; }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; color: var(--muted); font-size: 11px; }
.item-card h2 { line-height: 1.5; }
.text-button { background: transparent; border: 0; padding: 0; text-align: left; color: var(--accent); font: inherit; font-weight: 650; }
.text-button:hover { text-decoration: underline; }
.text-button[data-group="items"], .project-table .text-button[data-group="items"] { color: var(--ink); text-decoration: none; font-weight: 400; }
.item-card .description { font-size: 12px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.card-details { margin: auto 0 20px; }
.card-details div { display: grid; grid-template-columns: 95px 1fr; gap: 10px; font-size: 12px; margin-top: 10px; }
.card-details dt { color: var(--muted); }
.card-details dd { margin: 0; overflow-wrap: anywhere; }
.card-bottom { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding-top: 14px; border-top: 1px solid var(--line); }
.card-bottom .button { font-size: 11px; min-height: 30px; padding: 5px 8px; }
.badge { display: inline-block; padding: 4px 8px; background: #eef1f5; border-radius: 4px; font-size: 11px; color: #475467; white-space: nowrap; }
.badge.danger { background: #feeceb; color: #aa2b23; }
.badge.warning { background: #fff3d6; color: #895900; }
.badge.success { background: #e7f4ec; color: #216344; }
.red { color: #b42318; }
.metrics { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 16px; margin-bottom: 20px; }
.metric { display: flex; flex-direction: column; align-items: flex-start; gap: 14px; text-align: left; background: white; border: 1px solid var(--line); border-radius: 8px; padding: 18px; box-shadow: var(--shadow); color: var(--ink); }
.metric span { color: var(--muted); font-size: 12px; }
.metric strong { font-size: 28px; }
.metric:hover { border-color: var(--accent); }
.details { grid-template-columns: repeat(4,minmax(0,1fr)); }
.two-col { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 20px; }
.table-scroll { overflow-x: auto; }
.project-table { font-size: 12px; }
.project-table td { vertical-align: top; min-width: 90px; }
.project-table small { display: block; margin-top: 6px; color: var(--muted); line-height: 1.5; max-width: 350px; white-space: pre-wrap; }
.project-table small.red { color: #b42318; }
.empty.small { min-height: 120px; padding: 20px; }
dialog { width: 560px; }
.panel-head { flex-shrink: 0; }
.panel-body { flex: 1; }
.panel-body select { margin-top: 7px; }
textarea { display: block; width: 100%; resize: vertical; min-height: 88px; font: inherit; font-weight: 400; line-height: 1.6; color: var(--ink); padding: 10px; margin-top: 7px; border: 1px solid var(--line); border-radius: 6px; }
textarea[name=content] { min-height: 420px; }
fieldset { border: 1px solid var(--line); border-radius: 6px; margin: 0 0 22px; padding: 14px; }
legend { font-size: 12px; font-weight: 700; padding: 0 5px; }
.panel-body .check { display: flex; align-items: center; gap: 9px; margin: 0 0 12px; font-weight: 400; }
.check input { width: 16px; min-height: 16px; height: 16px; margin: 0; accent-color: var(--accent); }
.panel-footer { flex-shrink: 0; flex-wrap: wrap; }
.delete { margin-right: auto; color: #b42318; }
.muted { color: var(--muted); font-size: 12px; }
.linked-section { padding-top: 12px; border-top: 1px solid var(--line); }
h3 { font-size: 14px; }
.report-preview { white-space: pre-wrap; font: 13px/1.7 "Segoe UI",sans-serif; overflow-wrap: anywhere; }
@media(min-width:1550px) { .item-grid { grid-template-columns: repeat(3,minmax(0,1fr)); } }
@media(max-width:1100px) { .filters { grid-template-columns: repeat(3,minmax(120px,1fr)); } .two-col { grid-template-columns: 1fr; } }
@media(max-width:800px) { .metrics,.details { grid-template-columns: repeat(2,minmax(0,1fr)); } .filters { grid-template-columns: repeat(2,minmax(100px,1fr)); } }
@media(max-width:600px) { .topbar { position: static; height: auto; } .metrics { gap: 8px; } .item-grid { grid-template-columns: 1fr; } }

.audit-details summary { cursor: pointer; color: var(--accent); }
.audit-details dl { min-width: 220px; max-width: 520px; }
.audit-details dt { font-weight: 650; margin-top: 10px; }
.audit-details dd { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.row-actions { display: flex; gap: 28px; flex-wrap: wrap; }
.project-table .row-actions .button { min-height: 0; padding: 0; font-size: inherit; line-height: inherit; text-decoration: none; }
.package-issue-list { border-top: 1px solid var(--line); }
.package-issue-entry { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.package-issue-entry p { margin: 5px 0; white-space: pre-wrap; }
.package-issue-heading { display: grid; grid-template-columns: 60px minmax(0, 1fr); align-items: center; gap: 12px; }
.package-issue-heading > .badge { justify-self: start; }
.project-table .package-issue-heading .text-button[data-group="items"] { font-weight: 700; }
.issue-resolved { color: #067647; font-size: 11px; font-weight: 400; margin-left: 8px; }
.procore-reference-links { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 12px; margin-top: 8px; }
.procore-reference-links a { color: var(--accent); text-decoration: underline; }
.date-control { display: flex; position: relative; align-items: center; gap: 6px; }
.date-control > input[data-date-input] { flex: 1; min-width: 0; }
.project-table td, input[data-date-input] { font-variant-numeric: tabular-nums; }
.date-control > button { align-self: stretch; margin-top: 7px; border: 1px solid var(--line); border-radius: 6px; background: #fff; color: var(--ink); padding: 0 10px; font-size: 19px; }
.date-control > .date-picker-native { position: absolute; right: 0; bottom: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; padding: 0; border: 0; }
.assigned-packages { display: flex; flex-wrap: wrap; gap: 8px; margin: -10px 0 22px; }
.assigned-package { display: inline-flex; align-items: center; gap: 10px; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; }
.assigned-package button { background: none; border: 0; color: var(--ink); font-size: 18px; line-height: 1; padding: 0 2px; }
.package-issue-entry a { color: var(--accent); overflow-wrap: anywhere; }
.package-issue-entry .button { min-height: 30px; padding: 5px 9px; font-size: 12px; }
.project-table .package-issues-row > td { background: var(--bg); }
.project-table .package-issues-row > td:first-child { padding-left: 120px; }
.package-issues-row .package-issue-list { border-top: 0; margin-left: 16px; }
.package-issues-row .package-issue-entry:last-child { border-bottom: 0; }

.related-issue-search { display: flex; gap: 8px; margin-top: 6px; }
.related-issue-search input { flex: 1; min-width: 0; }
.related-issue-selections { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.related-issue-chip { display: inline-flex; align-items: center; gap: 8px; max-width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; overflow-wrap: anywhere; }
.related-issue-chip button { border: 0; background: none; color: var(--ink); padding: 0 3px; font-size: 18px; flex-shrink: 0; }

.card-title.dark-title { background: var(--section-dark); color: #fff; }
.card-title.dark-title h2 { color: inherit; }

.package-toggle { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 6px 0; border: 0; background: transparent; color: var(--ink); text-align: left; }
.package-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 3px; }
.package-issue-count { font-size: 12px; font-weight: 400; color: var(--muted); }

.card-title h2 { font-size: 14px; }

.project-table .package-toggle { gap: 10px; padding: 6px 0; color: var(--ink); text-decoration: none; }
.package-expand-icon { display: block; flex-shrink: 0; }
.package-toggle[aria-expanded="true"] .package-expand-icon { transform: rotate(90deg); }

.project-table tbody.package-summary:not(:first-of-type) > tr > td { border-top: 1px solid var(--line); }
