/*
 * CSV workspace layout.
 *
 * The page reuses the product tokens in styles.css and adds the review,
 * metric, and file-list pieces the workspace needs. Every panel is a normal
 * block so the 320 px layout can wrap without horizontal scrolling.
 */

.workspace-page { padding-block: 26px 56px; }
.ws-nav { display: flex; flex-wrap: wrap; gap: 2px 18px; border-bottom: 1px solid var(--line); margin-bottom: 24px; }
.ws-nav a { position: relative; padding: 11px 2px; color: var(--muted); text-decoration: none; font-weight: 560; min-height: 44px; display: inline-flex; align-items: center; }
.ws-nav a[aria-current="page"] { color: var(--accent); }
.ws-nav a[aria-current="page"]::after { content: ""; position: absolute; inset: auto 0 -1px; height: 2px; background: var(--accent); }

.ws-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 20px; }
.ws-head h1 { font-size: clamp(2rem, 3.4vw, 2.9rem); letter-spacing: -.03em; }
.ws-head p { color: var(--muted); max-width: 62ch; margin-top: .4rem; }

.ws-layout { display: grid; grid-template-columns: minmax(0, 2.1fr) minmax(268px, 1fr); gap: clamp(20px, 3.4vw, 38px); align-items: start; }
.ws-stack { display: grid; gap: 18px; min-width: 0; }
.ws-stack > * { min-width: 0; }

.ws-steps { display: flex; flex-wrap: wrap; gap: 6px 10px; list-style: none; margin: 0 0 16px; padding: 0; }
.ws-steps li { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border: 1px solid var(--line); border-radius: 999px; font-size: .82rem; color: var(--muted); background: var(--paper); }
.ws-steps li[aria-current="step"] { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); font-weight: 620; }

.ws-badge { display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; border-radius: 999px; font-size: .8rem; font-weight: 660; width: fit-content; }
.ws-badge.good { color: var(--green); background: var(--green-soft); }
.ws-badge.trial { color: var(--accent); background: var(--accent-soft); }
.ws-badge.warn { color: var(--amber); background: var(--amber-soft); }

.ws-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin: 14px 0 18px; }
.ws-metric { border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; background: #f8fafd; min-width: 0; }
.ws-metric span { display: block; font-size: .76rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.ws-metric strong { display: block; margin-top: 4px; font-size: clamp(1.05rem, 2.2vw, 1.45rem); font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }

.ws-inset { border: 1px solid var(--line); border-radius: 10px; background: #f8fafd; padding: 14px; display: grid; gap: 10px; }
.ws-file-control input[type="file"] { display: block; width: 100%; max-width: 100%; margin-bottom: 8px; }
.ws-file-control label { display: inline-flex; }

.ws-map { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px 14px; margin: 12px 0; }
.ws-map .field { min-width: 0; }
.ws-map select { max-width: 100%; }

.ws-review { display: grid; gap: 12px; }
.ws-review-item { border: 1px solid var(--line); border-radius: 10px; padding: 14px; background: var(--paper); }
.ws-review-item .row-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 16px; }
.ws-review-item h3 { font-size: 1.02rem; overflow-wrap: anywhere; }
.ws-review-item .ws-amount { font-variant-numeric: tabular-nums; font-weight: 680; white-space: nowrap; }
.ws-review-item form { display: grid; gap: 10px; margin-top: 10px; }
.ws-review-item .actions { margin-top: 2px; }
.ws-review-item .decision-tag { display: inline-flex; align-items: center; gap: 8px; padding: 5px 10px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: .82rem; font-weight: 620; }
.ws-review-item .decision-tag.excluded { background: var(--amber-soft); color: var(--amber); }

.ws-lines { display: grid; gap: 2px; margin-top: 10px; }
.ws-line { border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.ws-line + .ws-line { margin-top: 4px; }
.ws-line > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px 14px; padding: 9px 11px; cursor: pointer; }
.ws-line > summary span:first-child { min-width: 0; overflow-wrap: anywhere; }
.ws-line > summary .ws-amount { white-space: nowrap; font-variant-numeric: tabular-nums; }
.ws-line .ws-line-body { padding: 0 11px 11px; }

.ws-list { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 0; }
.ws-list li { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.ws-list li:last-child { border-bottom: 0; }
.ws-list strong { display: block; overflow-wrap: anywhere; }
.ws-list .line-label { display: block; color: var(--muted); font-size: .82rem; overflow-wrap: anywhere; }

.ws-table { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: .9rem; }
.ws-table th, .ws-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
.ws-table th:not(:first-child), .ws-table td:not(:first-child) { text-align: right; white-space: nowrap; }
.ws-table th:last-child, .ws-table td:last-child { text-align: right; }

.ws-files { display: grid; gap: 10px; margin-top: 12px; }
.ws-file-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 18px; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; background: var(--paper); }
.ws-file-row h3 { font-size: 1rem; }
.ws-file-row p { margin-top: 2px; }

.ws-gate { border-color: #e6cf9a; background: var(--amber-soft); }
.ws-gate h2 { font-size: 1.12rem; }

.bank-panel { border-top: 3px solid var(--accent); }
.bank-panel .bank-account { display: flex; align-items: baseline; flex-wrap: wrap; gap: 3px 12px; }
.bank-account span { font-size: .9rem; color: var(--muted); }
.bank-panel .ledger { margin-block-start: 14px; }
.bank-panel progress { display: block; width: min(100%, 300px); margin-block-start: 12px; accent-color: var(--accent); }
.bank-panel .bank-changes > ul { margin-block-start: 6px; }
.bank-options { list-style: none; padding: 0; display: grid; gap: 8px; margin: 17px 0 0; }
.bank-options .button { width: 100%; justify-content: start; text-align: start; }
.bank-permissions { margin-block-start: 14px; }
.bank-match { padding-inline-start: 10px; border-inline-start: 2px solid #b79b67; color: var(--amber); }
.ws-provider { border-color: #c6d0e4; background: #f7f9fd; }
.ws-provider-actions { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; margin-top: 10px; }
.ws-provider-actions .button { min-height: 40px; font-size: .84rem; padding: .4rem .7rem; }

.ws-side h2 { font-size: 1rem; }
.ws-side .ws-stack { gap: 14px; }
.ws-side .ledger { font-size: .88rem; }
.ws-side .ledger > div { padding: 6px 0; }

/* Three-column workspace: about rail, expanded tools, permanent tool cards. */
.ws-shell { display: grid; grid-template-columns: minmax(200px, .8fr) minmax(0, 2.5fr) minmax(260px, 1fr); gap: clamp(16px, 2.4vw, 30px); align-items: start; }
.ws-about { display: grid; gap: 14px; align-content: start; }
.ws-about h2 { font-size: 1rem; }
.ws-about p { color: var(--muted); font-size: .92rem; line-height: 1.5; }
.ws-about-plan { display: grid; gap: 6px; padding: 14px; border-radius: 12px; background: #1b2c4f; color: #fff; }
.ws-about-plan strong { font-size: .96rem; }
.ws-about-plan a { color: #dfe7ff; font-size: .88rem; }
.ws-about-links { list-style: none; padding: 0; margin: 0; display: grid; gap: 2px; }
.ws-about-links a { display: inline-flex; align-items: center; min-height: 44px; font-size: .92rem; }
.ws-tool-help { display: grid; gap: 2px; padding-top: 10px; border-top: 1px solid var(--line); }
.ws-tool-help h3 { font-size: .92rem; margin: 0; }
.ws-tool-help a { display: inline-flex; align-items: center; min-height: 44px; font-size: .92rem; }
.ws-about .panel { padding: 14px; }
.ws-about .panel h2 { font-size: 1rem; }
.ws-about .panel .ledger { font-size: .84rem; }
.ws-center { display: grid; gap: 18px; min-width: 0; }
.ws-tools { display: grid; gap: 12px; align-content: start; }
.ws-tools h2 { font-size: 1rem; }
.ws-tool-card { display: grid; gap: 6px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--paper); }
.ws-tool-card.open { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.ws-tool-card h3 { font-size: 1rem; }
.ws-tool-card h3 a { color: var(--ink); text-decoration: none; }
.ws-tool-card h3 a[aria-current="page"] { color: var(--accent); }
.ws-tool-card p { margin: 0; }
.ws-tool-card .button { justify-self: start; margin-top: 4px; }
.ws-tool-eyebrow { font-size: .72rem; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); margin: 0; }
.ws-tool-panel { border: 1px solid #b9c8e8; border-radius: 14px; padding: clamp(16px, 2.4vw, 24px); background: #f4f7ff; min-width: 0; }
.ws-tool-panel > .sheet, .ws-tool-panel > .panel { margin-bottom: 16px; }
.ws-tool-panel > .sheet:last-child, .ws-tool-panel > .panel:last-child { margin-bottom: 0; }
.ws-tool-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ws-tool-head h2 { font-size: clamp(1.2rem, 2.4vw, 1.5rem); }
.ws-tool-head .quiet { margin-left: auto; }
.ws-subnav { margin-top: 4px; }
.ws-used { margin-top: 16px; border-top: 1px solid var(--line); padding-top: 12px; }
.ws-empty { padding: 20px; border: 1px dashed var(--line); border-radius: 12px; color: var(--muted); background: var(--paper); }

.ws-dialog { border: 1px solid var(--line); border-radius: 14px; padding: 22px; max-width: min(560px, calc(100vw - 32px)); width: 100%; box-shadow: 0 24px 60px rgba(15, 30, 60, .25); }
.ws-dialog::backdrop { background: rgba(18, 30, 52, .42); }
.ws-dialog h2 { font-size: 1.2rem; }
.ws-dialog p { margin: 8px 0 16px; color: var(--muted); }
.ws-dialog .actions { justify-content: flex-end; }

.quiet { min-height: 44px; display: inline-flex; align-items: center; width: fit-content; border: 0; background: transparent; padding: 0; color: var(--accent); font: inherit; font-weight: 650; text-align: left; text-decoration: underline; text-underline-offset: .2em; }
.quiet:disabled { color: var(--muted); cursor: default; }
.list { padding-left: 1.2em; }
.list li + li { margin-top: 6px; }
.check { display: flex; align-items: start; gap: 9px; padding-block: 6px; min-height: 44px; font-size: .87rem; }
.check input { flex: none; width: 18px; height: 18px; margin: 2px 0 0; accent-color: var(--accent); }
.banner p { margin-top: 3px; }
.banner h3 { font-size: 1rem; }
.limit-count { font-variant-numeric: tabular-nums; }

.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; }

@media (max-width: 1100px) {
  .ws-shell { grid-template-columns: minmax(0, 1fr) minmax(260px, .9fr); }
  .ws-about { grid-column: 1 / -1; grid-template-columns: minmax(0, 1fr) minmax(220px, .7fr); align-items: start; }
  .ws-about-links { display: flex; flex-wrap: wrap; gap: 0 18px; }
}

@media (max-width: 900px) {
  .ws-layout { grid-template-columns: minmax(0, 1fr); }
  .ws-shell { grid-template-columns: minmax(0, 1fr); }
  .ws-about { grid-template-columns: minmax(0, 1fr); }
  .ws-side { order: 2; }
}

@media (max-width: 520px) {
  .ws-metrics { grid-template-columns: minmax(0, 1fr); }
  .ws-file-row, .ws-review-item .row-head, .ws-tool-head { display: grid; }
  .ws-tool-head .quiet { margin-left: 0; justify-self: start; }
  .ws-file-row .button { justify-self: start; }
  .ws-table { font-size: .82rem; }
  .ws-table th, .ws-table td { padding-inline: 3px; }
  .bank-panel .ledger > div, .bank-permissions > div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .bank-panel .ledger dd, .bank-permissions dd { text-align: start; max-width: 100%; }
  .ws-provider-actions .button { width: 100%; }
}