/* ============================================================================
   Clearspace — Product UI component styles (Flask + Jinja2 + Tailwind)
   Load order: 1) colors_and_type.css  2) this file  3) Tailwind (CDN)
   ============================================================================ */
*, *::before, *::after { box-sizing: border-box; }

/* ── App shell ── */
.app { display: flex; height: 100vh; overflow: hidden; }
.app button { font-family: inherit; cursor: pointer; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden; }
.content { padding: 36px 40px; }
.stack { display: flex; flex-direction: column; gap: 32px; }
.stack-sm { display: flex; flex-direction: column; gap: 24px; }

/* ── Sidebar — prescribed. NEVER scrolls horizontally; .sidebar stays overflow:visible
   (the collapse nub sits at right:-14px); vertical scroll lives on .sidebar-nav. ── */
.sidebar { width: 260px; background: var(--cs-dark-blue); color: #fff; flex-shrink: 0; display: flex; flex-direction: column; transition: width 0.2s ease; position: sticky; top: 0; height: 100vh; max-height: 100vh; overflow: visible; z-index: 5; }
.sidebar.collapsed { width: 72px; }
.sidebar-brand { padding: 24px 20px 18px; height: 88px; box-sizing: border-box; position: relative; display: flex; flex-direction: column; justify-content: center; }
.sidebar.collapsed .sidebar-brand { padding: 24px 10px 18px; align-items: center; justify-content: center; }
.sidebar-brand img.wordmark,
.sidebar-brand img[alt="Clearspace"]:not(.mark) { height: 22px; width: auto; max-width: 100%; align-self: flex-start; flex-shrink: 0; margin-bottom: 8px; }
.sidebar-brand img.mark { width: 22px; height: 22px; align-self: center; flex-shrink: 0; }
.sidebar-brand .brand-link { display: block; }
.sidebar.collapsed .sidebar-brand .brand-link { display: flex; justify-content: center; }
.sidebar-brand .wordmark { display: block; }
.sidebar-brand .mark { display: none; }
.sidebar.collapsed .sidebar-brand .wordmark { display: none; }
.sidebar.collapsed .sidebar-brand img.mark,
.sidebar.collapsed .sidebar-brand .mark { display: block; }
.sidebar-brand .brand-sysname { font-size: 12px; color: #fff; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 500; }
.sidebar.collapsed .sidebar-brand .brand-sysname { display: none; }
.sidebar-collapse-btn { position: absolute; top: 32px; right: -14px; width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; border-radius: 9999px; color: var(--cs-n-500); background: #fff; border: 1px solid var(--cs-n-200); cursor: pointer; z-index: 10; box-shadow: 0 1px 4px rgba(22,25,26,0.06); padding: 0; transition: all 0.15s ease; }
.sidebar-collapse-btn:hover { color: var(--cs-charcoal); border-color: var(--cs-n-300); }
.sidebar-collapse-btn svg { width: 14px; height: 14px; stroke-width: 2; transition: transform 0.2s ease; }
.sidebar.collapsed .sidebar-collapse-btn svg { transform: rotate(180deg); }
.sidebar-nav { flex: 1; padding: 0 10px; display: flex; flex-direction: column; gap: 2px; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.nav-link { display: flex; align-items: center; gap: 14px; padding: 11px 14px; border-radius: 8px; color: rgba(255,255,255,0.9); font-size: 16px; letter-spacing: -0.01em; transition: all 0.15s ease; cursor: pointer; white-space: nowrap; overflow: hidden; background: none; border: 0; width: 100%; text-align: left; }
.sidebar.collapsed .nav-link { justify-content: center; gap: 0; padding: 11px 0; }
.sidebar.collapsed .nav-divider { margin: 12px 14px; }
.sidebar.collapsed .sidebar-foot .user-row { justify-content: center; gap: 0; padding: 12px 0; }
.nav-link:hover { color: #fff; background: rgba(255,255,255,0.06); }
.nav-link.active { color: var(--cs-light-blue); background: rgba(59,171,255,0.12); font-weight: 500; }
.nav-link svg { width: 22px; height: 22px; flex-shrink: 0; stroke-width: 1.5; }
.nav-label { min-width: 0; flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar.collapsed .nav-label { display: none; }
.nav-divider { height: 1px; background: rgba(255,255,255,0.08); margin: 12px 12px; }
.sidebar-foot { padding: 0 10px 14px; margin: 0; display: flex; flex-direction: column; gap: 2px; }
.sidebar-foot .user-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; margin-top: 4px; color: rgba(255,255,255,0.9); }
.sidebar-foot .user-icon { width: 22px; height: 22px; flex-shrink: 0; stroke-width: 1.5; }
.sidebar-foot .name { color: #fff; font-size: 16px; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar.collapsed .sidebar-foot .name { display: none; }

/* ── Page header / cards / stat cards ── */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.page-header h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; color: var(--cs-charcoal); margin: 0; }
.page-header p { font-size: 15px; color: #6B7280; margin: 4px 0 0; }
.card { background: #fff; border: 1px solid #E5E7EB; border-radius: 14px; padding: 28px; }
.card.p-0 { padding: 0; overflow: hidden; }
.card-title { font-size: 12px; font-weight: 600; color: #9CA3AF; text-transform: uppercase; letter-spacing: 0.07em; margin: 0 0 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.stat-card { background: #fff; border: 1px solid #E5E7EB; border-radius: 14px; padding: 24px 28px; }
.stat-label { font-size: 11px; font-weight: 600; color: #9CA3AF; text-transform: uppercase; letter-spacing: 0.07em; margin: 0; }
.stat-label .muted { color: #D1D5DB; font-weight: 400; }
.stat-value { font-size: 32px; font-weight: 600; line-height: 1.15; margin-top: 6px; letter-spacing: -0.03em; color: var(--cs-charcoal); }
.stat-value.blue { color: var(--cs-light-blue); } .stat-value.green-dark { color: var(--cs-dark-green); } .stat-value.amber { color: #F59E0B; }

/* ── Inputs ── */
.input-field { display: block; padding: 9px 14px; font-size: 15px; line-height: 1.5; border: 1px solid #D1D5DB; border-radius: 8px; background: #fff; color: var(--cs-charcoal); transition: all 0.15s ease; font-family: inherit; width: 100%; }
.input-field:focus { outline: none; border-color: var(--cs-light-blue); box-shadow: 0 0 0 3px rgba(59,171,255,0.1); }
.input-field::placeholder { color: #9CA3AF; }
select.input-field { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; cursor: pointer; }
.field-label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 6px; color: #334155; }

/* ── Tables ── */
.table-main { border-collapse: collapse; width: 100%; }
.table-main thead { background: #F9FAFB; border-bottom: 1px solid #E5E7EB; }
.table-main th { padding: 14px 20px; font-size: 11px; font-weight: 600; color: #9CA3AF; text-transform: uppercase; letter-spacing: 0.07em; text-align: left; }
.table-main th.right { text-align: right; }
.table-main th .th-sort { display: inline-flex; align-items: center; gap: 6px; width: 100%; padding: 0; border: 0; background: none; cursor: pointer; font: inherit; color: inherit; letter-spacing: inherit; text-transform: inherit; user-select: none; }
.table-main th.right .th-sort { justify-content: flex-end; }
.table-main th .th-sort:hover { color: var(--cs-n-600); }
.table-main th .th-sort:focus-visible { outline: none; box-shadow: var(--focus-ring); border-radius: 4px; }
.table-main th .sort-ico { width: 8px; height: 11px; flex-shrink: 0; }
.table-main th .sort-ico path { fill: currentColor; opacity: 0.28; transition: opacity 0.12s ease; }
.table-main th .th-sort.is-asc { color: var(--cs-charcoal); } .table-main th .th-sort.is-desc { color: var(--cs-charcoal); }
.table-main th .th-sort.is-asc .up { opacity: 1; } .table-main th .th-sort.is-desc .down { opacity: 1; }
.table-main td { padding: 16px 20px; font-size: 15px; border-bottom: 1px solid #F3F4F6; color: var(--cs-charcoal); }
.table-main tbody tr:last-child td { border-bottom: none; }
.table-main tbody tr.clickable { cursor: pointer; transition: background 0.15s ease; }
.table-main tbody tr.clickable:hover td { background: #FAFAFA; }
.table-main td.muted { color: #6B7280; font-size: 14px; } .table-main td.dim { color: #9CA3AF; font-size: 12px; }
.table-main td.right { text-align: right; font-variant-numeric: tabular-nums; } .table-main td.num { font-variant-numeric: tabular-nums; }
.link-blue { color: var(--cs-light-blue); } .link-blue:hover { text-decoration: underline; }
.table-main tr.subtotal td { background: #F9FAFB; font-size: 12px; font-weight: 600; color: #6B7280; }
.table-main tr.group-row td { background: #F9FAFB; font-size: 11px; font-weight: 600; color: #6B7280; text-transform: uppercase; letter-spacing: 0.05em; padding: 8px 20px; }
.table-main tr.is-hidden { display: none; }

/* ── Stage badges ── */
.stage-badge { display: inline-block; padding: 3px 10px; font-size: 12px; font-weight: 500; border-radius: 9999px; white-space: nowrap; letter-spacing: -0.005em; }
.stage-identified, .stage-qualified, .stage-feasibility { background: var(--cs-light-blue); color: #fff; }
.stage-on-hold { background: #F3F4F6; color: #9CA3AF; }
.stage-closed-won { background: rgba(179,193,0,0.15); color: var(--cs-dark-green); }
.stage-closed-lost { background: rgba(240,90,90,0.1); color: #C0392B; }

/* ── Table toolbar — search (left) + multi-select filters (right) ── */
.table-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.toolbar-search { position: relative; flex: 1 1 240px; min-width: 0; max-width: 360px; }
.toolbar-search .search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: #9CA3AF; pointer-events: none; stroke-width: 2; }
.toolbar-search .input-field { width: 100%; padding-left: 36px; }
.toolbar-search .input-field[type="search"]::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.toolbar-filters { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.toolbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.filter-multi { position: relative; }
.filter-multi-btn { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px; border-radius: 8px; border: 1px solid var(--cs-n-200); background: #fff; color: var(--cs-charcoal); font-size: 14px; font-weight: 500; cursor: pointer; transition: all 0.15s ease; }
.filter-multi-btn:hover { border-color: var(--cs-n-300); background: var(--cs-n-50); }
.filter-multi-btn.has-value { border-color: var(--cs-light-blue); color: var(--cs-charcoal); }
.filter-multi-btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.filter-multi-btn .filter-count[hidden] { display: none; }
.filter-multi-btn .filter-count { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--cs-light-blue); color: #fff; font-size: 11px; font-weight: 600; }
.filter-multi-btn .filter-caret { width: 14px; height: 14px; color: #9CA3AF; }
.filter-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; min-width: 200px; max-height: 320px; overflow-y: auto; background: #fff; border: 1px solid var(--cs-n-200); border-radius: 8px; box-shadow: 0 8px 28px rgba(22,25,26,0.12); padding: 6px; }
.filter-menu[hidden] { display: none; }
.filter-menu-head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 8px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: #9CA3AF; }
.filter-clear { border: 0; background: none; color: var(--cs-light-blue); font-size: 12px; font-weight: 500; cursor: pointer; padding: 0; text-transform: none; letter-spacing: 0; }
.filter-clear:hover { text-decoration: underline; }
.filter-opt { display: flex; align-items: center; gap: 10px; padding: 8px 8px; border-radius: 7px; cursor: pointer; font-size: 14px; color: var(--cs-charcoal); }
.filter-opt:hover { background: var(--cs-n-50); }
.filter-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.filter-check { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex-shrink: 0; border: 1.5px solid var(--cs-n-300); border-radius: 5px; background: #fff; transition: all 0.12s ease; }
.filter-check svg { width: 12px; height: 12px; color: #fff; opacity: 0; }
.filter-opt input:checked + .filter-check { background: var(--cs-light-blue); border-color: var(--cs-light-blue); }
.filter-opt input:checked + .filter-check svg { opacity: 1; }
.filter-opt input:focus-visible + .filter-check { box-shadow: var(--focus-ring); }

/* ── Flash ── */
.flash { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-radius: 8px; font-size: 15px; }
.flash.success { background: #F0FDF4; color: var(--cs-dark-green); border: 1px solid #BBF7D0; }
.flash .close { opacity: 0.6; font-size: 18px; line-height: 1; background: none; border: none; cursor: pointer; }
.flash .close:hover { opacity: 1; }

/* ── Login (split-screen Microsoft-365 SSO) ── */
.login-split { display: grid; grid-template-columns: 1fr 1fr; min-height: 100vh; }
.login-brand { position: relative; display: flex; flex-direction: column; justify-content: center; gap: 28px; padding: 56px 60px; background: var(--cs-dark-blue); color: #fff; overflow: hidden; }
/* align-self:flex-start stops the column-flex parent from stretching the <img> to panel
   width (which would distort a wide wordmark); max-width keeps it inside the panel on mobile. */
.login-hero-logo { height: 64px; width: auto; max-width: 100%; align-self: flex-start; display: block; }
.login-lede { max-width: 420px; margin: 0; font-size: 18px; line-height: 1.6; color: rgba(255,255,255,0.62); }
.login-foot { position: absolute; left: 60px; right: 60px; bottom: 40px; display: flex; gap: 26px; font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: rgba(255,255,255,0.34); }
.login-signin { display: flex; align-items: center; justify-content: center; padding: 48px; background: #fff; }
.login-card { width: 100%; max-width: 400px; border: 1px solid var(--cs-n-200); border-radius: var(--radius-xl); padding: 36px; box-shadow: var(--shadow-card); }
.login-card-title { font-size: 24px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; color: var(--cs-charcoal); }
.login-card-sub { font-size: 14px; line-height: 1.5; color: var(--cs-n-500); margin: 0 0 26px; }
.login-btn-ms { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; height: var(--btn-h-lg); padding: 0 16px; font-family: inherit; font-size: 15px; font-weight: 500; color: #1E293B; background: #fff; border: 1px solid var(--cs-n-300); border-radius: var(--radius-md); cursor: pointer; transition: background 0.15s ease, border-color 0.15s ease; }
.login-btn-ms:hover { background: var(--cs-n-50); border-color: var(--cs-n-400); }
.login-note { margin: 22px 0 0; font-size: 13px; line-height: 1.5; color: var(--cs-n-400); }
@media (max-width: 767.98px) {
  .login-split { grid-template-columns: 1fr; min-height: 100vh; }
  .login-brand { padding: 40px 28px; gap: 16px; min-height: 38vh; justify-content: flex-end; }
  .login-hero-logo { height: 44px; }
  .login-lede { font-size: 16px; }
  .login-foot { display: none; }
  .login-signin { padding: 28px 24px; align-items: flex-start; }
}

/* ── Auth/status utility pages (403, access-denied, reset-password, callback) — centered card.
   Kept project-local: these status pages reuse the .login-card above inside a centered shell. ── */
.login-body { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--cs-n-50); }
.login-container { width: 100%; max-width: 400px; padding: 24px; }
.login-brand-logo { height: 26px; width: auto; display: block; margin-bottom: 28px; }
.login-title { font-size: 30px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 6px; color: var(--cs-charcoal); }
.login-subtitle { font-size: 14px; color: var(--cs-n-500); margin: 0 0 28px; line-height: 1.5; }
.login-field { margin-bottom: 16px; }

/* ── Misc utilities ── */
.flex-row { display: flex; align-items: center; gap: 8px; } .space-between { justify-content: space-between; }
.muted { color: #6B7280; } .dim { color: #9CA3AF; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 24px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; }
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px 32px; }
.field-grid.single { grid-template-columns: 1fr; }

/* ── Modal — z-index 200 (above bottom tab bar); only .modal-body scrolls ── */
.modal-overlay { position: fixed; inset: 0; z-index: 200; display: none; align-items: center; justify-content: center; padding: 24px; background: rgba(22,25,26,0.45); overflow-y: auto; overscroll-behavior: contain; }
.modal-overlay.is-open { display: flex; }
.modal { background: #fff; border-radius: var(--radius-xl); box-shadow: var(--shadow-modal); width: 100%; max-width: 480px; max-height: calc(100vh - 48px); display: flex; flex-direction: column; overflow: hidden; }
.modal-head { flex-shrink: 0; padding: 24px 24px 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.modal-title { margin: 0; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; color: var(--cs-charcoal); }
.modal-sub { margin: 4px 0 0; font-size: 14px; color: var(--cs-n-500); }
.modal-close { flex-shrink: 0; width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border: 0; background: transparent; color: var(--cs-n-500); border-radius: var(--radius-md); cursor: pointer; transition: background 0.15s ease, color 0.15s ease; }
.modal-close:hover { background: var(--cs-n-100); color: var(--cs-charcoal); }
.modal-close svg { width: 20px; height: 20px; stroke-width: 2; }
.modal-body { flex: 1 1 auto; min-height: 0; padding: 0 24px; overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.modal-foot { flex-shrink: 0; padding: 16px 24px 24px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; }
html.cs-modal-lock, html.cs-modal-lock body { overflow: hidden; }

/* Note: this project's comments/activity thread is a bespoke, backend-wired feature
   (templates/page.html + the .cs-comments/.cs-avatar block in static/css/app.css), not the
   kit's generic comments component. The kit's component is intentionally omitted here to avoid
   colliding on those class names — see design-system/README.md. */

/* Mobile chrome — hidden by default, shown < 768px. */
.bottom-nav { display: none; }
.app-scrim { display: none; }

/* ============================================================================
   RESPONSIVE — desktop-first. Literal px MUST match the --bp-* tokens.
   ============================================================================ */
@media (min-width: 768px) and (max-width: 1023.98px) {
  .content { padding: 28px 28px; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 767.98px) {
  .app { flex-direction: column; height: auto; overflow: visible; }
  .main { overflow: visible; }
  .content, .sidebar, .table-card-reflow { scrollbar-width: none; -ms-overflow-style: none; }
  .content::-webkit-scrollbar, .sidebar::-webkit-scrollbar, .table-card-reflow::-webkit-scrollbar { width: 0; height: 0; display: none; }
  .bottom-nav { display: flex; position: fixed; z-index: 60; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom, 0px)); background: var(--cs-dark-blue); border-radius: 14px; padding: 6px; box-shadow: 0 10px 30px rgba(22,25,26,0.30); }
  .bottom-nav .tab { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px; padding: 8px 4px; min-height: var(--touch-min); border: 0; background: transparent; cursor: pointer; color: rgba(255,255,255,0.62); border-radius: 8px; transition: color 0.15s ease, background 0.15s ease; }
  .bottom-nav .tab svg { width: 22px; height: 22px; stroke-width: 1.8; flex-shrink: 0; }
  .bottom-nav .tab .tab-label { font-size: 11px; font-weight: 500; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .bottom-nav .tab.active { color: #fff; background: rgba(255,255,255,0.12); }
  .bottom-nav .tab .tab-icon-wrap { position: relative; display: flex; }
  .bottom-nav .tab .tab-badge { position: absolute; top: -4px; right: -8px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px; background: var(--cs-light-red); color: #fff; font-size: 10px; font-weight: 600; line-height: 16px; text-align: center; }
  .sidebar { position: fixed; left: 12px; right: 12px; top: auto; width: auto; max-width: none; height: auto; max-height: 74vh; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; bottom: calc(64px + env(safe-area-inset-bottom, 0px)); border-radius: 14px; transform: translateY(calc(100% + 84px)); transition: transform 0.26s cubic-bezier(.32,.72,0,1), border-radius 0.2s ease; z-index: 50; box-shadow: none; padding-bottom: 16px; }
  .sidebar::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 2px; background: rgba(255,255,255,0.28); margin: 10px auto 2px; }
  .sidebar .sidebar-collapse-btn { display: none; }
  .sidebar .drawer-close-btn { position: absolute; top: 8px; right: 10px; width: var(--touch-min); height: var(--touch-min); display: flex; align-items: center; justify-content: center; background: transparent; border: 0; cursor: pointer; color: rgba(255,255,255,0.85); border-radius: 10px; transition: background 0.15s ease, color 0.15s ease; }
  .sidebar .drawer-close-btn:hover { background: rgba(255,255,255,0.10); color: #fff; }
  .sidebar .drawer-close-btn svg { width: 22px; height: 22px; stroke-width: 2; }
  .sidebar.collapsed { width: auto; }
  .sidebar.collapsed .nav-label, .sidebar.collapsed .sidebar-foot .name, .sidebar.collapsed .sidebar-brand .brand-sysname { display: block; }
  .sidebar.collapsed .sidebar-brand .wordmark { display: block; }
  .sidebar.collapsed .sidebar-brand .mark { display: none; }
  .sidebar.collapsed .nav-link { justify-content: flex-start; gap: 14px; padding: 11px 14px; }
  .app--drawer-open .sidebar { transform: translateY(0); box-shadow: 0 -16px 40px rgba(22,25,26,0.30); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .app--drawer-open .bottom-nav { border-top-left-radius: 0; border-top-right-radius: 0; box-shadow: 0 16px 40px rgba(22,25,26,0.30); transition: border-radius 0.2s ease; }
  .app-scrim { display: block; position: fixed; inset: 0; background: rgba(22,25,26,0.45); z-index: 45; opacity: 0; pointer-events: none; transition: opacity 0.2s ease; }
  .app--drawer-open .app-scrim { opacity: 1; pointer-events: auto; }
  .drawer-close-btn { display: flex; }
  .main { width: 100%; }
  .content { padding: 20px 16px calc(86px + env(safe-area-inset-bottom, 0px)); }
  .modal-overlay { align-items: flex-end; padding: 0; }
  .modal { max-width: none; border-radius: 16px 16px 0 0; max-height: 90vh; padding-bottom: env(safe-area-inset-bottom, 0px); }
  .stack { gap: 24px; } .stack-sm { gap: 20px; }
  .table-card-reflow, .table-card-reflow tbody { display: block; width: 100%; }
  .table-card-reflow thead { display: none; }
  .table-card-reflow tr { display: block; background: #fff; border: 1px solid var(--cs-n-200); border-radius: 14px; padding: 14px 16px; margin-bottom: 12px; }
  .table-card-reflow tr:last-child { margin-bottom: 0; }
  .table-card-reflow tr.clickable:hover td { background: transparent; }
  .table-card-reflow td { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; padding: 6px 0; border: none; font-size: 14px; text-align: right; }
  .table-card-reflow td::before { content: attr(data-label); flex-shrink: 0; text-align: left; font-size: 11px; font-weight: 600; color: var(--cs-n-400); text-transform: uppercase; letter-spacing: 0.06em; transform: translateY(1px); }
  .table-card-reflow td[data-label=""], .table-card-reflow td.card-title-cell { display: block; text-align: left; font-size: 16px; font-weight: 500; padding: 2px 0 8px; margin-bottom: 6px; border-bottom: 1px solid var(--cs-n-100); }
  .table-card-reflow td[data-label=""]::before, .table-card-reflow td.card-title-cell::before { content: none; }
  .table-card-reflow td .stage-badge { margin-left: auto; }
  .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .stat-card { padding: 16px; min-width: 0; } .stat-value { font-size: 24px; overflow-wrap: anywhere; }
  .grid-2, .grid-3, .field-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .page-header { flex-direction: column; align-items: stretch; gap: 12px; } .page-header h1 { font-size: 24px; }
  .page-header .flex-row { width: 100%; } .page-header .flex-row > .cs-btn { flex: 1; width: 100%; }
  .table-toolbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .toolbar-search { max-width: none; flex-basis: auto; }
  .toolbar-filters { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .toolbar-filters .filter-multi { width: 100%; }
  .filter-multi-btn { width: 100%; justify-content: space-between; height: var(--touch-min); }
  .toolbar-actions { margin-left: 0; } .toolbar-actions > * { flex: 1; }
  .filter-menu { left: 0; right: 0; min-width: 0; }
  .cs-btn:not(.cs-btn--sm) { height: var(--touch-min); min-height: var(--touch-min); }
  .input-field { padding-top: 11px; padding-bottom: 11px; }
}
@media print { .app-scrim { display: none !important; } .sidebar { position: static; transform: none; } }
