:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #0f172a;
  background: #f8fafc;
  font-synthesis: none;
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-muted: #f1f5f9;
  --text: #0f172a;
  --muted: #526173;
  --border: #dce3ea;
  --primary: #0369a1;
  --primary-dark: #07577e;
  --teal: #0f766e;
  --success: #157f3b;
  --warning: #a15c05;
  --danger: #b42318;
  --sidebar: #17211f;
  --sidebar-muted: #a8b8b2;
  --focus: #38bdf8;
  --shadow: 0 10px 30px rgb(15 23 42 / 8%);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { min-width: 320px; background: var(--bg); }
body { min-width: 320px; min-height: 100vh; margin: 0; background: var(--bg); overflow-x: hidden; }
body.drawer-open { overflow: hidden; }
button, input { font: inherit; letter-spacing: 0; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }
svg { width: 18px; height: 18px; flex: 0 0 auto; stroke-width: 1.8; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 8px; font-size: 28px; line-height: 1.25; letter-spacing: 0; }
h2 { margin-bottom: 0; font-size: 18px; line-height: 1.35; letter-spacing: 0; }
h3 { margin-bottom: 6px; font-size: 16px; line-height: 1.4; letter-spacing: 0; }
p { color: var(--muted); line-height: 1.65; }

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; padding: 10px 14px; border-radius: 6px; background: var(--surface); color: var(--primary); transform: translateY(-160%); }
.skip-link:focus { transform: translateY(0); }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; z-index: 30; inset: 0 auto 0 0; display: flex; width: 248px; flex-direction: column; padding: 20px 14px 16px; background: var(--sidebar); color: #fff; }
.brand { display: flex; min-height: 64px; align-items: center; gap: 12px; padding: 0 8px 18px; border-bottom: 1px solid rgb(255 255 255 / 10%); }
.brand-mark { display: grid; width: 40px; height: 40px; place-items: center; border-radius: 8px; background: #e4f4ef; color: #0f665f; }
.brand-mark svg { width: 22px; height: 22px; }
.brand strong, .brand small { display: block; letter-spacing: 0; }
.brand strong { font-size: 15px; }
.brand small { margin-top: 3px; color: var(--sidebar-muted); font-size: 12px; }
.primary-nav { flex: 1; overflow-y: auto; padding: 10px 0; }
.nav-label { margin: 14px 10px 6px; color: #779087; font-size: 11px; font-weight: 700; letter-spacing: 0; }
.nav-item { display: grid; width: 100%; min-height: 44px; grid-template-columns: 20px 1fr auto; align-items: center; gap: 10px; margin: 2px 0; padding: 0 10px; border: 1px solid transparent; border-radius: 6px; background: transparent; color: #dbe5e1; text-align: left; transition: background-color 180ms ease, color 180ms ease, border-color 180ms ease; }
.nav-item:hover { background: rgb(255 255 255 / 7%); color: #fff; }
.nav-item.is-active { border-color: rgb(111 214 193 / 25%); background: rgb(52 138 121 / 24%); color: #fff; }
.nav-count { color: #8da39b; font-size: 12px; }
.sidebar-footer { padding: 14px 4px 0; border-top: 1px solid rgb(255 255 255 / 10%); }
.environment-line { display: flex; align-items: center; gap: 8px; padding: 6px 8px 12px; color: var(--sidebar-muted); font-size: 12px; }
.online-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #22c55e; box-shadow: 0 0 0 3px rgb(34 197 94 / 14%); }
.quiet-button { display: flex; width: 100%; min-height: 44px; align-items: center; gap: 10px; padding: 0 8px; border: 0; border-radius: 6px; background: transparent; color: #c5d2cd; }
.quiet-button:hover { background: rgb(255 255 255 / 7%); color: #fff; }

.workspace { min-height: 100vh; margin-left: 248px; }
.topbar { position: sticky; z-index: 20; top: 0; display: flex; min-height: 72px; align-items: center; gap: 20px; padding: 10px 28px; border-bottom: 1px solid var(--border); background: rgb(255 255 255 / 94%); backdrop-filter: blur(12px); }
.menu-button { display: none !important; }
.project-context { min-width: 260px; }
.eyebrow { margin-bottom: 3px; color: #607082; font-size: 11px; font-weight: 750; text-transform: uppercase; letter-spacing: 0; }
.project-switcher { display: inline-flex; min-height: 32px; align-items: center; gap: 6px; padding: 0; border: 0; background: transparent; color: var(--text); font-weight: 700; }
.project-switcher:hover { color: var(--primary); }
.topbar-actions { display: flex; min-width: 0; flex: 1; align-items: center; justify-content: flex-end; gap: 10px; }
.global-search, .filter-search { display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: #6b7a8a; }
.global-search { width: min(360px, 36vw); padding: 0 12px; }
.global-search input, .filter-search input { width: 100%; min-width: 0; height: 42px; border: 0; outline: 0; background: transparent; color: var(--text); }
.environment-badge, .status-badge { display: inline-flex; align-items: center; gap: 8px; min-height: 28px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.environment-badge { border: 1px solid #b9ded2; background: #effaf6; color: #12634f; }
.avatar { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 50%; background: #dceef7; color: #07577e; font-size: 14px; font-weight: 800; }
.icon-button { position: relative; display: inline-grid; width: 44px; height: 44px; flex: 0 0 auto; place-items: center; padding: 0; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); color: #3f5265; transition: border-color 180ms ease, background-color 180ms ease, color 180ms ease; }
.icon-button:hover { border-color: #9db6c7; background: #f4f8fa; color: var(--primary); }
.notification-dot { position: absolute; top: 10px; right: 9px; width: 7px; height: 7px; border: 2px solid #fff; border-radius: 50%; background: var(--danger); }

#main-content { width: min(100%, 1520px); margin: 0 auto; padding: 28px; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 24px; }
.page-heading p:not(.eyebrow) { max-width: 760px; margin-bottom: 0; }
.primary-button, .secondary-button, .danger-button, .text-button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; padding: 0 15px; border-radius: 6px; font-weight: 700; transition: background-color 180ms ease, border-color 180ms ease, color 180ms ease; }
.primary-button { border: 1px solid var(--primary); background: var(--primary); color: #fff; }
.primary-button:hover { border-color: var(--primary-dark); background: var(--primary-dark); }
.secondary-button { border: 1px solid #b9c8d4; background: #fff; color: #294157; }
.secondary-button:hover { border-color: #7994a8; background: #f5f8fa; }
.danger-button { border: 1px solid var(--danger); background: var(--danger); color: #fff; }
.danger-button:hover { background: #8f1d14; }
.text-button { min-height: 36px; padding: 0 6px; border: 0; background: transparent; color: var(--primary); }
.text-button:hover { color: var(--primary-dark); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 24px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 18px rgb(15 23 42 / 4%); }
.metric-item { position: relative; min-width: 0; padding: 20px; border-right: 1px solid var(--border); }
.metric-item:last-child { border-right: 0; }
.metric-item::before { position: absolute; inset: 0 auto 0 0; width: 3px; background: var(--metric-color, var(--primary)); content: ""; }
.metric-item .metric-label { margin-bottom: 10px; color: var(--muted); font-size: 13px; }
.metric-item strong { display: block; margin-bottom: 7px; font-size: 26px; letter-spacing: 0; }
.metric-item small { color: #6a7887; font-size: 12px; }
.metric-item[data-tone="success"] { --metric-color: var(--success); }
.metric-item[data-tone="warning"] { --metric-color: var(--warning); }
.metric-item[data-tone="danger"] { --metric-color: var(--danger); }

.overview-layout, .executive-layout { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(320px, .85fr); gap: 20px; margin-bottom: 20px; }
.content-section { min-width: 0; padding: 20px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); box-shadow: 0 4px 18px rgb(15 23 42 / 4%); }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }
.section-heading .eyebrow { margin-bottom: 2px; }
.issue-row { display: grid; min-height: 72px; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid #e7edf2; }
.issue-row:first-child { border-top: 0; }
.issue-icon { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 6px; background: #edf6fa; color: var(--primary); }
.issue-main { min-width: 0; }
.issue-main strong { display: block; overflow: hidden; margin-bottom: 5px; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.issue-meta { display: flex; flex-wrap: wrap; gap: 6px 12px; color: #6b7a8a; font-size: 12px; }
.issue-row .status-badge { justify-self: end; }
.status-badge { border: 1px solid #cbd8e1; background: #f5f8fa; color: #43586c; }
.status-badge.success { border-color: #a8d8b6; background: #eff9f1; color: var(--success); }
.status-badge.warning { border-color: #efd19d; background: #fff8e8; color: #875006; }
.status-badge.danger { border-color: #efb2ad; background: #fff1f0; color: var(--danger); }
.status-badge.info { border-color: #b6d6e7; background: #eff8fc; color: var(--primary); }
.risk-item { padding: 14px 0; border-top: 1px solid #e7edf2; }
.risk-item:first-child { padding-top: 0; border-top: 0; }
.risk-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; }
.risk-item strong { display: block; margin-bottom: 6px; font-size: 14px; line-height: 1.5; }
.risk-item p { margin: 0; font-size: 12px; }
.journey-section { margin-bottom: 20px; }
.group-journey { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; overflow: hidden; border: 1px solid var(--border); border-radius: 6px; background: var(--border); }
.journey-item { position: relative; min-width: 0; padding: 16px; background: #fff; }
.journey-item::after { position: absolute; z-index: 1; top: 31px; right: -7px; width: 12px; height: 12px; border-top: 1px solid var(--border); border-right: 1px solid var(--border); background: #fff; content: ""; transform: rotate(45deg); }
.journey-item:last-child::after { display: none; }
.journey-item small { display: block; margin-bottom: 7px; color: #6b7a8a; }
.journey-item strong { display: block; overflow: hidden; margin-bottom: 10px; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }

.stage-summary, .management-band { margin-bottom: 20px; padding: 18px 20px; border-left: 4px solid var(--teal); background: #eef8f5; color: #214d47; }
.stage-summary p, .management-band p { margin: 0; color: inherit; }
.management-band { border: 1px solid #c8e4db; border-left: 4px solid var(--teal); border-radius: 0 8px 8px 0; background: #f4fbf8; }
.management-columns { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; }
.management-columns section { min-width: 0; }
.management-columns h2 { margin-bottom: 12px; }
.management-columns ul { margin: 0; padding: 0; list-style: none; }
.management-columns li { padding: 9px 0; border-top: 1px solid #d5e9e2; }
.management-columns li:first-child { border-top: 0; }
.management-columns li strong, .management-columns li span { display: block; }
.management-columns li strong { overflow: hidden; margin-bottom: 3px; color: #183d37; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.management-columns li span { color: #58736d; font-size: 11px; }
.feature-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.feature-card { display: flex; min-height: 212px; flex-direction: column; padding: 20px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); transition: border-color 180ms ease, box-shadow 180ms ease; }
.feature-card:hover { border-color: #9cb4c4; box-shadow: var(--shadow); }
.feature-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.feature-number { display: inline-flex; width: 34px; height: 34px; align-items: center; justify-content: center; border-radius: 6px; background: #eaf4f8; color: var(--primary); font-weight: 800; }
.feature-card p { margin-bottom: 16px; font-size: 14px; }
.feature-owner { display: flex; align-items: center; gap: 7px; margin: auto 0 14px; color: #5d6e7e; font-size: 12px; }
.feature-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 14px; border-top: 1px solid #e7edf2; }
.feature-card .text-button { padding-right: 0; }
.feature-grid.compact { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.feature-grid.compact .feature-card { min-height: 196px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 12px 10px; border-bottom: 1px solid #e7edf2; text-align: left; white-space: nowrap; }
th { color: #607082; font-size: 11px; font-weight: 750; }
tbody tr:last-child td { border-bottom: 0; }
.review-item { padding: 13px 0; border-top: 1px solid #e7edf2; }
.review-item:first-child { padding-top: 0; border-top: 0; }
.review-item strong { display: block; margin-bottom: 5px; font-size: 14px; }
.review-item p { margin: 0 0 5px; font-size: 12px; }
.review-item small { color: #6b7a8a; }

.acceptance-progress { min-width: 116px; padding: 10px 14px; border: 1px solid #b6d6e7; border-radius: 6px; background: #eff8fc; text-align: right; }
.acceptance-progress strong, .acceptance-progress span { display: block; }
.acceptance-progress strong { color: var(--primary); font-size: 18px; }
.acceptance-progress span { margin-top: 2px; color: #607082; font-size: 11px; }
.acceptance-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.filter-search { width: min(440px, 50vw); padding: 0 12px; }
.segmented-control { display: inline-flex; padding: 3px; border: 1px solid var(--border); border-radius: 6px; background: #eef2f6; }
.segmented-control button { min-height: 36px; padding: 0 13px; border: 0; border-radius: 4px; background: transparent; color: #526173; font-size: 13px; }
.segmented-control button.is-active { background: #fff; color: var(--primary); box-shadow: 0 1px 4px rgb(15 23 42 / 12%); }
.acceptance-list { overflow: hidden; border: 1px solid var(--border); border-radius: 8px; background: var(--surface); }
.acceptance-row { display: grid; min-height: 72px; grid-template-columns: 42px minmax(0, 1.6fr) minmax(120px, .7fr) minmax(120px, .7fr) 108px; align-items: center; gap: 12px; padding: 12px 16px; border-top: 1px solid #e7edf2; }
.acceptance-row:first-child { border-top: 0; }
.acceptance-row:hover { background: #f8fbfc; }
.acceptance-row .feature-number { width: 32px; height: 32px; }
.acceptance-name { min-width: 0; }
.acceptance-name strong, .acceptance-name small { display: block; }
.acceptance-name strong { overflow: hidden; margin-bottom: 4px; font-size: 14px; text-overflow: ellipsis; white-space: nowrap; }
.acceptance-name small, .acceptance-owner { color: #6a7887; font-size: 12px; }
.acceptance-row .text-button { justify-self: end; }
.empty-state { padding: 44px 20px; color: var(--muted); text-align: center; }

.drawer-backdrop, .mobile-backdrop { position: fixed; z-index: 40; inset: 0; background: rgb(15 23 42 / 42%); backdrop-filter: blur(2px); }
.task-drawer { position: fixed; z-index: 50; inset: 0 0 0 auto; display: grid; width: min(520px, 100%); grid-template-rows: auto 1fr auto; background: #fff; box-shadow: -18px 0 48px rgb(15 23 42 / 18%); }
.drawer-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px; border-bottom: 1px solid var(--border); }
.drawer-content { overflow-y: auto; padding: 24px; }
.drawer-footer { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 24px; border-top: 1px solid var(--border); background: #f8fafc; }
.drawer-section { margin-bottom: 24px; }
.drawer-section h3 { margin-bottom: 10px; }
.drawer-owner { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.boundary-note { display: flex; gap: 10px; padding: 14px; border-left: 3px solid var(--warning); background: #fff8e8; color: #714409; }
.boundary-note p { margin: 0; color: inherit; font-size: 13px; }
.step-list { margin: 0; padding: 0; list-style: none; counter-reset: step; }
.step-list li { position: relative; min-height: 48px; padding: 0 0 16px 42px; color: #33485b; font-size: 14px; line-height: 1.5; counter-increment: step; }
.step-list li::before { position: absolute; top: -2px; left: 0; display: grid; width: 28px; height: 28px; place-items: center; border: 1px solid #b9d4e2; border-radius: 50%; background: #eff8fc; color: var(--primary); content: counter(step); font-size: 12px; font-weight: 800; }
.step-list li::after { position: absolute; top: 28px; bottom: 0; left: 13px; width: 1px; background: #d9e4eb; content: ""; }
.step-list li:last-child::after { display: none; }
.confirmation-list { display: grid; gap: 8px; }
.confirmation-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--border); border-radius: 6px; color: #42566a; font-size: 13px; }
.confirmation-item svg { color: var(--success); }

.confirm-dialog { width: min(420px, calc(100% - 28px)); padding: 0; border: 0; border-radius: 8px; box-shadow: 0 24px 64px rgb(15 23 42 / 24%); }
.confirm-dialog::backdrop { background: rgb(15 23 42 / 48%); }
.confirm-dialog form { padding: 24px; text-align: center; }
.dialog-icon { display: grid; width: 44px; height: 44px; margin: 0 auto 14px; place-items: center; border-radius: 50%; background: #fff1f0; color: var(--danger); }
.confirm-dialog p { margin-bottom: 22px; }
.dialog-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.toast { position: fixed; z-index: 70; right: 24px; bottom: 24px; display: flex; max-width: min(420px, calc(100% - 32px)); min-height: 48px; align-items: center; gap: 10px; padding: 12px 16px; border: 1px solid #9fd2af; border-radius: 8px; background: #eff9f1; color: #106d32; box-shadow: var(--shadow); font-size: 14px; font-weight: 700; }
.load-error { max-width: 520px; margin: 80px auto; padding: 32px; border: 1px solid #efb2ad; border-radius: 8px; background: #fff; text-align: center; }
.load-error > svg { width: 36px; height: 36px; margin-bottom: 14px; color: var(--danger); }

@media (max-width: 1180px) {
  .global-search { width: 260px; }
  .feature-grid.compact { grid-template-columns: 1fr; }
  .acceptance-row { grid-template-columns: 38px minmax(0, 1fr) 110px 100px; }
  .acceptance-owner { display: none; }
}

@media (max-width: 960px) {
  .sidebar { transform: translateX(-100%); transition: transform 220ms ease; }
  .sidebar.is-open { transform: translateX(0); }
  .mobile-backdrop { z-index: 25; }
  .workspace { margin-left: 0; }
  .menu-button { display: inline-grid !important; }
  .topbar { padding: 10px 20px; }
  .project-context { min-width: 0; flex: 1; }
  .topbar-actions { flex: 0 0 auto; }
  .global-search { display: none; }
  .overview-layout, .executive-layout { grid-template-columns: 1fr; }
  .management-columns { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  h1 { font-size: 24px; }
  #main-content { padding: 20px 16px 32px; }
  .topbar { min-height: 64px; padding: 8px 14px; }
  .project-context .eyebrow, .environment-badge, .topbar-actions .icon-button { display: none; }
  .project-switcher { max-width: 52vw; }
  .project-switcher span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .page-heading { align-items: stretch; flex-direction: column; gap: 14px; }
  .page-heading > button { align-self: flex-start; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .metric-item { border-bottom: 1px solid var(--border); }
  .metric-item:nth-child(2) { border-right: 0; }
  .metric-item:nth-last-child(-n+2) { border-bottom: 0; }
  .group-journey { grid-template-columns: 1fr; }
  .journey-item::after { display: none; }
  .feature-grid { grid-template-columns: 1fr; }
  .feature-card { min-height: 190px; }
  .acceptance-toolbar { align-items: stretch; flex-direction: column; }
  .filter-search { width: 100%; }
  .segmented-control { align-self: flex-start; }
  .acceptance-row { grid-template-columns: 36px minmax(0, 1fr) 86px; gap: 8px; padding: 12px; }
  .acceptance-row > .status-badge { display: none; }
  .acceptance-row .text-button { padding: 0; font-size: 13px; }
  .task-drawer { top: 40px; border-radius: 8px 8px 0 0; }
  .drawer-header, .drawer-content { padding: 18px; }
  .drawer-footer { padding: 12px 18px; }
  .toast { right: 16px; bottom: 16px; }
}

@media (max-width: 420px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-item { border-right: 0; border-bottom: 1px solid var(--border) !important; }
  .metric-item:last-child { border-bottom: 0 !important; }
  .issue-row { grid-template-columns: 34px minmax(0, 1fr); }
  .issue-row .status-badge { display: none; }
  .content-section { padding: 16px; }
  .acceptance-progress { align-self: flex-start; text-align: left; }
  .drawer-footer { grid-template-columns: 1fr 1fr; }
  .drawer-footer button { flex: 1; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
}
