:root {
  color-scheme: light;
  font: 15px/1.55 Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --ink: #1a2736;
  --muted: #5d6b7a;
  --surface: #fff;
  --base: #f4f6f8;
  --edge: #dfe6eb;
  --nav: #101e2c;
  --accent: #0d6257;
  --accent-fade: #e8f4ef;
  background: var(--base);
  color: var(--ink);
}

* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, .button { cursor: pointer; }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #45a996;
  outline-offset: 3px;
}
.sr-only, .skip:not(:focus) {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}
.skip:focus { position: fixed; z-index: 10; left: 12px; top: 12px; background: white; padding: 8px 14px; }

.shell { display: grid; min-height: 100vh; grid-template-columns: 218px minmax(0, 1fr); }
.rail {
  display: flex; flex-direction: column; align-items: stretch; gap: 32px;
  padding: 30px 18px 22px; background: var(--nav); color: #d2dde5;
}
.brand {
  display: flex; align-items: center; gap: 10px; padding: 0 5px; color: white;
  font-size: 19px; letter-spacing: -0.035em; white-space: nowrap;
}
.brand:hover { text-decoration: none; }
.brand strong { color: #8cdec9; }
.brand-mark {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 9px;
  background: #abecd9; color: #123e39; font-weight: 800; font-size: 18px;
}
.rail nav { display: grid; gap: 7px; }
.rail nav a {
  display: flex; align-items: center; gap: 12px; min-height: 42px; padding: 7px 11px;
  border-radius: 7px; color: #c8d6df; font-size: 14px; font-weight: 550;
}
.rail nav a:hover { background: #223446; text-decoration: none; }
.rail nav a[aria-current] { color: #dbf7ed; background: #273f49; font-weight: 680; }
.nav-icon {
  display: inline-block; width: 13px; height: 13px; flex: 0 0 13px;
  border: 1.5px solid currentColor; border-radius: 3px; opacity: .9;
}
.nav-icon.work { height: 9px; margin: 2px 0; border-radius: 2px; box-shadow: 0 -3px 0 -1.5px currentColor; }
.nav-icon.flows { border-radius: 50%; border-right-color: transparent; transform: rotate(-40deg); }
.nav-icon.activity { border-radius: 50%; border-style: dotted; }
.rail-footer { margin-top: auto; padding: 10px 5px 0; color: #c8d5de; font-size: 13px; }
.rail-footer > span:last-child { color: #95a8b8; padding-left: 14px; font-size: 12px; }
.preview-dot { display: inline-block; margin-right: 7px; height: 7px; width: 7px; border-radius: 50%; background: #8cdec9; }

.workspace { min-width: 0; }
.topbar {
  min-height: 72px; display: flex; justify-content: space-between; align-items: center;
  padding: 10px clamp(18px, 4vw, 56px); gap: 12px; background: var(--surface); border-bottom: 1px solid var(--edge);
}
.top-title { font-size: 14px; font-weight: 650; color: #4a5867; }
.role-picker { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; }
.role-picker label { font-size: 12px; font-weight: 650; color: var(--muted); }
.role-picker select, .role-picker button { min-height: 35px; border-radius: 6px; }
.role-picker select { padding: 5px 9px; font-size: 13px; }
.apply { font-size: 12px; font-weight: 700; background: #edf2f5; color: var(--ink); border: 1px solid #e0e8ec; padding: 5px 10px; }

main { max-width: 1570px; margin: 0 auto; padding: 36px clamp(18px, 4vw, 56px) 48px; }
.page-heading { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 26px; }
h1, h2, p { margin: 0; }
h1 { font-size: clamp(1.65rem, 3vw, 2.25rem); line-height: 1.16; font-weight: 715; letter-spacing: -0.045em; }
h2 { font-size: 16px; font-weight: 700; letter-spacing: -0.018em; }
.page-heading p { color: var(--muted); margin-top: 7px; }
.button, button.primary, button.secondary {
  display: inline-flex; min-height: 38px; align-items: center; justify-content: center;
  padding: 8px 14px; border-radius: 7px; font-size: 13px; font-weight: 650; white-space: nowrap;
}
.primary { background: var(--accent); color: white; border: 1px solid var(--accent); }
.primary:hover { background: #0a5149; text-decoration: none; }
.secondary { background: #fff; color: #435666; border: 1px solid #d9e2e8; }
.secondary:hover { background: #f5f8f8; text-decoration: none; }

.metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.metric { min-height: 104px; padding: 16px 22px; display: grid; align-content: center; gap: 4px; }
.metric, .panel { background: var(--surface); border: 1px solid var(--edge); border-radius: 11px; }
.metric span { font-size: 13px; color: var(--muted); }
.metric strong { font-size: 1.9rem; line-height: 1; font-weight: 690; letter-spacing: -0.075em; }
.dashboard-grid { display: grid; align-items: start; grid-template-columns: minmax(0, 2.45fr) minmax(220px, 1fr); gap: 16px; }
.panel { overflow: hidden; min-width: 0; }
.panel-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; padding: 16px 18px; border-bottom: 1px solid #e9edf0; }
.panel-head a { font-size: 12px; font-weight: 650; }
.search { display: flex; gap: 6px; max-width: 100%; }
input, select, textarea { color: var(--ink); background: #fff; border: 1px solid #cfd9e0; border-radius: 6px; padding: 8px 10px; }
.search input { width: min(150px, 45vw); min-width: 0; font-size: 13px; }
.search button { min-height: 34px; padding: 5px 9px; }
.tabs { display: flex; flex-wrap: wrap; padding: 0 16px; gap: 17px; border-bottom: 1px solid #e5ebef; }
.tabs a { color: #526372; padding: 10px 2px 8px; border-bottom: 2px solid transparent; font-size: 13px; }
.tabs a[aria-current] { color: var(--accent); font-weight: 700; border-color: var(--accent); text-decoration: none; }
.tabs span { color: #617486; padding-left: 2px; }
.table-wrap { overflow: auto; }
table { border-collapse: collapse; width: 100%; text-align: left; }
th, td { padding: 12px 12px; font-size: 12px; text-align: left; vertical-align: middle; }
th:first-child, td:first-child { padding-left: 18px; }
th { background: #f8fafb; color: #566877; white-space: nowrap; font-weight: 650; }
td { border-top: 1px solid #edf1f3; }
td:last-child { white-space: nowrap; }
.work-name { display: flex; align-items: center; gap: 9px; min-width: 168px; }
.work-name a { font-size: 13px; font-weight: 680; color: var(--ink); }
.muted { color: var(--muted); }
.mobile-due { display: none; }
.item-meta { font-size: 11px; line-height: 1.3; margin-top: 3px; }
.type-icon {
  display: inline-grid; place-items: center; width: 30px; height: 30px; flex: 0 0 30px;
  border-radius: 7px; background: #e5f3ee; color: #245c54; font-weight: 750; font-size: 13px;
}
.type-icon.agreement { background: #edf0fa; color: #4e5699; }
.type-icon.prototype { background: #f6eee1; color: #765124; }
.owner-initial {
  display: inline-grid; place-items: center; height: 22px; min-width: 22px; padding: 0 3px; margin-right: 5px;
  background: #eef2f5; border-radius: 50%; color: #3e5366; font-size: 9px; font-weight: 740;
}
.badge { display: inline-flex; align-items: center; padding: 3px 7px; border-radius: 5px; font-size: 11px; font-weight: 680; white-space: nowrap; }
.badge.in-progress { background: #edf2fa; color: #354d73; }
.badge.complete { background: var(--accent-fade); color: #22584d; }

.activity-list { list-style: none; margin: 0; padding: 1px 17px 11px; }
.activity-list li { display: grid; grid-template-columns: 9px minmax(0, 1fr); gap: 8px; border-bottom: 1px solid #ebeff2; padding: 12px 0; font-size: 12px; }
.activity-list li:last-child { border-bottom: 0; }
.activity-dot { width: 7px; height: 7px; margin-top: 6px; border-radius: 50%; background: #7699ad; }
.activity-dot.done { background: #2c806a; }
.activity-role { color: var(--muted); }
.activity-list time, .activity-case { display: block; }
.activity-case { margin: 1px 0; overflow-wrap: anywhere; font-weight: 580; }
.activity-list time { color: var(--muted); font-size: 11px; margin-top: 2px; }
.activity-list .event-note { margin-top: 5px; overflow-wrap: anywhere; white-space: pre-wrap; }
.empty, .access-note { color: var(--muted); padding: 18px; font-size: 14px; }
.narrow, .form-panel { max-width: 780px; }

.templates { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 15px; }
.template { padding: 19px; }
.template h2 { margin-top: 10px; }
.template p { color: var(--muted); margin-top: 5px; font-size: 13px; }
.template ol { padding-left: 18px; margin: 13px 0 18px; font-size: 13px; }
.template li + li { margin-top: 7px; }
.template li span { display: block; color: var(--muted); font-size: 12px; }
.back { display: inline-block; font-size: 13px; font-weight: 650; margin-bottom: 9px; }
.case-heading { display: flex; align-items: center; gap: 9px; }
.case-grid { grid-template-columns: minmax(0, 1.8fr) minmax(230px, 1fr); }
.stages { list-style: none; padding: 6px 18px; margin: 0; }
.stages li { display: flex; gap: 9px; align-items: center; padding: 10px 0; border-bottom: 1px solid #edf1f3; }
.stages li:last-child { border: 0; }
.stage-number { display: inline-grid; place-items: center; height: 26px; width: 26px; flex: 0 0 26px; border-radius: 50%; background: #eef2f4; color: #52667a; font-size: 13px; }
.finished .stage-number, .current .stage-number { background: var(--accent-fade); color: var(--accent); }
.stage-owner { display: block; font-size: 12px; color: var(--muted); }
.stage-status { margin-left: auto; color: var(--accent); font-size: 11px; font-weight: 650; }
.action-panel { margin-top: 16px; }
.stack { display: grid; justify-items: start; gap: 13px; padding: 17px 18px 20px; }
.stack label { display: grid; gap: 5px; width: 100%; font-weight: 650; font-size: 13px; }
.stack input, .stack select, .stack textarea { width: 100%; font-size: 14px; font-weight: 400; }
.stack textarea { min-height: 89px; resize: vertical; }
.form-actions { display: flex; flex-wrap: wrap; gap: 9px; }

@media (max-width: 1150px) {
  .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
  .templates { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 710px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .rail { padding: 12px 13px; gap: 10px; }
  .rail nav { display: flex; flex-wrap: wrap; gap: 4px; }
  .rail nav a { min-height: 34px; gap: 5px; padding: 5px 8px; font-size: 12px; white-space: nowrap; }
  .rail-footer { display: none; }
  .topbar { min-height: 58px; }
  .top-title { display: none; }
  main { padding-top: 21px; }
  .page-heading { align-items: flex-start; flex-wrap: wrap; }
  .metric { padding: 12px 10px; min-height: 76px; }
  .metric span { font-size: 11px; }
  .metric strong { font-size: 1.4rem; }
  .templates { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 560px) {
  th, td { padding: 10px 8px; }
  th:first-child, td:first-child { padding-left: 13px; }
  th:last-child, td:last-child { display: none; }
  th { white-space: normal; }
  .work-name { min-width: 108px; gap: 7px; }
  .owner-initial { display: none; }
  .mobile-due { display: block; }
}
