/* Shared portal shell and document workspace, based on the approved design. */
:root { --blue: #244f83; --blue-dark: #20334b; --muted: #5f6e81; --border: #dce3ec; --shadow: none; color: #20334b; background: #f4f6f9; color-scheme: light; }
body { min-width: 0; }
h1 { font-size: clamp(1.65rem, 2.5vw, 2.05rem); font-weight: 600; letter-spacing: -.035em; margin: .35rem 0 .65rem; }
h2 { font-weight: 600; font-size: 1.05rem; }
h3 { font-weight: 600; }
p { line-height: 1.6; }
button, .button { min-height: 42px; padding: .65rem .95rem; border-radius: 8px; font-weight: 600; font-size: .875rem; }
button:hover, .button:hover { box-shadow: none; }
.secondary { border-color: var(--border); color: var(--blue-dark); }
input, select, textarea { border-color: var(--border); min-width: 0; }
label { font-weight: 500; }
.portal-icon { width: 19px; height: 19px; flex-shrink: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
.site-header { background: #fff; }
.header-inner { min-height: 82px; max-width: 1600px; padding: 1rem 1.75rem; gap: 1.75rem; }
.brand { gap: .65rem; }
.brand-mark { width: 36px; height: 38px; border-radius: 9px; }
.brand-mark svg { width: 23px; height: 23px; }
.brand-name { font-size: 1.22rem; font-weight: 650; }
.brand-name small { font-size: .55rem; margin-top: .35rem; }
.brand-plus { font-size: .78rem; }
.workspace-picker { padding-left: 1.75rem; border-left: 1px solid var(--border); min-width: 0; }
.workspace-caption { display: block; font-size: .68rem; color: var(--muted); margin-bottom: .25rem; }
.workspace-picker strong, .workspace-picker summary { font-size: .85rem; font-weight: 600; overflow-wrap: anywhere; color: var(--blue-dark); }
.workspace-picker details { position: relative; }
.workspace-picker nav { position: absolute; z-index: 10; top: 100%; left: 0; width: max-content; min-width: 200px; max-width: min(320px, calc(100vw - 3rem)); padding: .5rem; background: #fff; border: 1px solid var(--border); border-radius: 9px; box-shadow: 0 8px 25px #20334b16; }
.workspace-picker nav a { display: block; padding: .75rem; border-radius: 6px; font-size: .85rem; text-decoration: none; }
.workspace-picker nav a:hover, .workspace-picker nav a[aria-current=true] { background: #eaf1fa; }
.account-menu { margin-left: auto; gap: .8rem; }
.account-identity { min-width: 0; }
.account-name { display: block; max-width: 230px; }
.account-role { display: block; font-size: .7rem; color: var(--muted); margin-top: .15rem; }
.test-banner { background: #fff; border-bottom: 1px solid var(--border); color: var(--muted); font-weight: 400; font-size: .7rem; padding: .55rem 1.5rem; }
.app-shell { max-width: 1600px; margin: 0 auto; }
.app-shell.has-workspace { display: grid; grid-template-columns: 210px minmax(0, 1fr); }
.workspace-sidebar { padding: 2rem .85rem; border-right: 1px solid var(--border); background: #fff; }
.nav-caption { padding: 0 .7rem; margin: 0 0 1.1rem; color: var(--muted); font-size: .65rem; letter-spacing: .12em; text-transform: uppercase; }
.workspace-nav { display: grid; gap: .4rem; }
.workspace-nav a { display: flex; align-items: center; gap: .65rem; padding: .75rem .7rem; min-height: 44px; border-radius: 8px; text-decoration: none; color: var(--muted); font-size: .83rem; }
.workspace-nav a:hover { background: #f4f6f9; color: var(--blue); }
.workspace-nav a.active { background: #eaf1fa; color: var(--blue); font-weight: 600; }
.workspace-nav .organizations-link { margin-top: 1rem; border-top: 1px solid var(--border); border-radius: 0; }
.sidebar-note { margin: 2rem .7rem 0; padding-top: 1.15rem; border-top: 1px solid var(--border); color: var(--muted); font-size: .7rem; }
.workspace-content { min-width: 0; }
main { padding: 2.25rem 2rem; max-width: 1300px; min-height: calc(100vh - 232px); }
.has-workspace main { max-width: none; }
.site-footer { max-width: 1236px; margin: 0 2rem; padding: 1.3rem 0; font-size: .72rem; }
.eyebrow { font-size: .65rem; letter-spacing: .12em; font-weight: 500; color: var(--muted); }
.page-description { font-size: .9rem; }
.page-heading { gap: 1.25rem; margin-bottom: 1.6rem; flex-wrap: wrap; }
.page-heading > div:first-child { flex: 1; min-width: 200px; }
.page-heading > .status-stack { flex: none; }
.breadcrumb { margin-bottom: 1.1rem; font-size: .8rem; }
.panel, .card, .stat-card { border-radius: 12px; padding: 1.3rem; box-shadow: none; }
.panel { margin: 0 0 1.25rem; }
.panel-heading { gap: .75rem; flex-wrap: wrap; }
.panel-heading .muted, .panel-heading > a { font-size: .78rem; }
.flush-panel { padding: 0; }
.flush-panel > .panel-heading { padding: 1.1rem 1.3rem; margin: 0; border-bottom: 1px solid var(--border); }
.flush-panel > .panel-heading h2 { margin: 0; }
.flush-panel > .empty-state { margin: 1.3rem; }
.stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin: 0 0 1.6rem; }
.stat-card { text-decoration: none; color: var(--blue-dark); }
a.stat-card:hover { background: #fff; border-color: var(--blue); }
.stat-value { color: var(--blue-dark); font-size: 2rem; font-weight: 600; margin: .5rem 0 .25rem; }
.stat-label { font-size: .8rem; font-weight: 400; }
.stat-card .muted { font-size: .73rem; }
.task-row { display: flex; align-items: center; gap: 1rem; padding: 1.1rem 1.3rem; }
.task-row + .task-row { border-top: 1px solid var(--border); }
.task-row > div { flex: 1; min-width: 0; }
.task-row strong { font-size: .875rem; font-weight: 600; }
.task-row p { margin: .25rem 0 0; font-size: .78rem; overflow-wrap: anywhere; }
.task-row > .button { flex-shrink: 0; }
.badge { white-space: normal; overflow-wrap: anywhere; font-weight: 500; font-size: .72rem; line-height: 1.5; }
.badge-active { background: #eaf1fa; color: #244f83; }
.badge-success { background: #eaf5ef; color: #27624d; }
.badge-danger { background: #fbeeee; color: #983d3e; }
.badge-warning { background: #faf1de; color: #785413; }
.badge-neutral { background: #f0f3f6; color: #59677b; }
.status-stack { display: flex; flex-direction: column; align-items: flex-start; gap: .35rem; }
.document-list { table-layout: fixed; width: 100%; border-collapse: collapse; }
.document-list th { padding: .75rem 1.3rem; font-size: .72rem; font-weight: 500; background: #f7f9fb; }
.document-list th:nth-child(1) { width: 44%; }
.document-list th:nth-child(2) { width: 24%; }
.document-list th:nth-child(3) { width: 32%; }
.document-list td { vertical-align: middle; padding: 1rem 1.3rem; border-bottom: 0; border-top: 1px solid var(--border); overflow-wrap: anywhere; }
.document-list tr:last-child td { border-bottom: 0; }
.document-cell { display: flex; align-items: center; gap: .75rem; }
.document-cell > div { min-width: 0; }
.file-symbol { display: grid; place-items: center; flex-shrink: 0; width: 35px; height: 41px; border: 1px solid var(--border); background: #fff; border-radius: 6px; font-size: .58rem; color: var(--muted); }
.document-link { color: var(--blue-dark); font-weight: 600; font-size: .82rem; text-decoration: none; overflow-wrap: anywhere; }
.document-link:hover { text-decoration: underline; }
.document-meta { display: block; font-size: .7rem; color: var(--muted); margin-top: .2rem; }
.case-label { font-size: .8rem; }
.inbox-filters { display: flex; align-items: end; gap: 1rem; padding: 1rem 1.3rem; }
.inbox-filters label { min-width: 180px; margin: 0; flex: 1; }
.inbox-filters > a { font-size: .8rem; align-self: center; }
.pagination { margin: 0; padding: 1rem 1.3rem; border-top: 1px solid var(--border); font-size: .8rem; }
.upload-grid { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(210px, 1fr); gap: 1.75rem; align-items: start; }
.upload-form { display: grid; gap: 1.25rem; }
.upload-form label { margin: 0; }
.upload-file-field { border: 1px dashed #b9c8da; background: #f7f9fc; border-radius: 9px; padding: 1.3rem; }
.upload-file-field input { font-size: .85rem; background: #fff; margin-top: .35rem; }
.upload-file-field .form-hint { margin-bottom: 0; }
.form-actions { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-wrap: wrap; padding-top: 1.25rem; border-top: 1px solid var(--border); }
.form-actions .muted { font-size: .75rem; }
.upload-help { padding-top: .5rem; }
.upload-steps { list-style: none; padding: 0; counter-reset: upload; margin: 1.5rem 0; }
.upload-steps li { counter-increment: upload; position: relative; padding-left: 2.3rem; margin-bottom: 1.5rem; font-size: .85rem; }
.upload-steps li::before { content: counter(upload); position: absolute; left: 0; top: 0; display: grid; place-items: center; width: 25px; height: 25px; background: #fff; color: var(--blue); border: 1px solid var(--border); border-radius: 50%; font-size: .75rem; }
.upload-steps strong { font-weight: 600; }
.upload-steps p { font-size: .8rem; color: var(--muted); margin: .35rem 0 0; }
.upload-help .notice { font-size: .8rem; }
.document-review-grid { grid-template-columns: minmax(0, 1.15fr) minmax(300px, 1fr); gap: 1.25rem; align-items: start; }
.document-review-grid .panel { margin: 0 0 1.25rem; }
.document-title { font-size: clamp(1.3rem, 2vw, 1.7rem); }
.document-preview > h2 { margin-bottom: 1.25rem; }
.document-preview details { border-top: 1px solid var(--border); padding-top: 1rem; font-size: .8rem; }
.review-panel > h2 { margin-bottom: 1rem; }
.review-panel p { font-size: .85rem; }
.scan-clear { color: #27624d; }
.review-actions { flex-direction: column; align-items: stretch; gap: .6rem; }
.assignment-select { margin: 1rem 0; }
.assignment-select label { margin-top: 0; }
.assignment-select button { width: 100%; }
.reject-document summary { color: #983d3e; }
.delivery-panel p { font-size: .85rem; }
.delivery-details { margin-top: 1rem; }
.delivery-details summary { font-size: .8rem; }
.activity-list { margin-top: 1.25rem; }
portal-pdf-preview canvas { background: #fff; }
.pdf-controls button:disabled { background: #f0f3f6; color: #5f6e81; border-color: var(--border); cursor: default; }
.auth-shell { box-shadow: none; }
@media (max-width: 1000px) {
    .document-review-grid { grid-template-columns: minmax(0, 1fr); }
    .account-name { max-width: 190px; }
}
@media (max-width: 850px) {
    .app-shell.has-workspace { grid-template-columns: minmax(0, 1fr); }
    .workspace-sidebar { padding: .65rem 1rem; border-right: 0; border-bottom: 1px solid var(--border); }
    .nav-caption, .sidebar-note { display: none; }
    .workspace-nav { display: flex; flex-wrap: wrap; gap: .25rem; }
    .workspace-nav a { padding: .65rem .75rem; font-size: .8rem; }
    .workspace-nav .organizations-link { margin-top: 0; border: 0; border-radius: 8px; }
    main { padding: 1.75rem 1.5rem; }
    .header-inner { flex-wrap: wrap; gap: 1rem; padding: 1rem 1.5rem; }
    .workspace-picker { order: 3; flex-basis: 100%; border-left: 0; border-top: 1px solid var(--border); padding: .7rem 0 0; }
    .upload-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .document-review-grid { grid-template-columns: minmax(0, 1.15fr) minmax(270px, 1fr); }
}
@media (max-width: 640px) {
    .header-inner { padding: .9rem 1rem; }
    .account-menu { gap: .5rem; }
    .account-name { max-width: 140px; font-size: .7rem; }
    .account-role { font-size: .65rem; }
    .account-menu button { font-size: .75rem; padding: .6rem; }
    main { padding: 1.5rem 1rem; }
    .site-footer { margin: 0 1rem; }
    .test-banner { text-align: center; padding: .55rem 1rem; }
    .page-heading > div:first-child { min-width: 0; }
    .page-heading { align-items: flex-start; gap: 1rem; }
    .panel, .card, .stat-card { padding: 1rem; }
    .flush-panel { padding: 0; }
    .flush-panel > .panel-heading { padding: 1rem; }
    .stats-grid { grid-template-columns: 1fr; gap: .65rem; }
    .dashboard-metrics .stat-card { display: grid; grid-template-columns: minmax(0, 1fr) auto; }
    .dashboard-metrics .stat-value { grid-column: 2; grid-row: 1 / 3; align-self: center; margin: 0 0 0 1rem; font-size: 1.7rem; }
    .task-row { flex-wrap: wrap; padding: 1rem; }
    .task-row > div { flex-basis: 100%; }
    .task-row > .button { width: 100%; }
    .inbox-filters { padding: 1rem; gap: .85rem; }
    .inbox-filters label { flex-basis: 100%; min-width: 0; }
    .document-list, .document-list tbody, .document-list tr, .document-list td { display: block; width: 100%; }
    .document-list thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
    .document-list tr { padding: 1rem; border-top: 1px solid var(--border); }
    .document-list td { border: 0; padding: .2rem 0; }
    .document-list td:nth-child(2), .document-list td:nth-child(3) { padding-left: 47px; }
    .document-review-grid { grid-template-columns: minmax(0, 1fr); }
    .upload-file-field { padding: 1rem; }
    .form-actions button { width: 100%; }
    .empty-state { padding: 1.25rem; }
    .member label { min-width: 0; }
    .document-preview .button { width: 100%; }
    .pdf-controls { flex-wrap: wrap; }
}
@media (max-width: 380px) {
    .account-identity { max-width: 95px; }
    .account-name { max-width: 95px; }
    .brand-name { font-size: 1.05rem; }
    .brand-mark { width: 30px; height: 34px; }
    .brand { gap: .4rem; }
    .header-inner { gap: .5rem; }
}
@media (pointer: coarse) {
    button, .button, .workspace-nav a { min-height: 44px; }
    input, select, textarea { font-size: 1rem; }
}
