:root {
  --tw-red: #e31c2b;
  --tw-red-dark: #bd1420;
  --tw-red-soft: #fff0f1;
  --tw-ink: #17191d;
  --tw-ink-2: #25282e;
  --tw-slate: #5f6570;
  --tw-muted: #8d939d;
  --tw-line: #e8e7e4;
  --tw-canvas: #f5f4f1;
  --tw-surface: #fff;
  --tw-success: #168263;
  --tw-success-soft: #e9f7f2;
  --tw-warning: #b76b06;
  --tw-warning-soft: #fff6e4;
  --tw-info: #3366d5;
  --tw-danger: #c92c3a;
  --tw-radius: 16px;
  --tw-radius-sm: 10px;
  --tw-shadow: 0 18px 45px rgba(19, 21, 25, .07);
  --tw-sidebar: 252px;
  --bs-primary: #e31c2b;
  --bs-primary-rgb: 227, 28, 43;
  color-scheme: light;
}

html { font-size: 15px; }
body { margin: 0; color: var(--tw-ink); font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; background: var(--tw-canvas); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; }
a { color: inherit; text-decoration: none; }
a:hover { color: inherit; }
::selection { color: #fff; background: var(--tw-red); }
:focus-visible { outline: 3px solid rgba(227, 28, 43, .25); outline-offset: 2px; }
.skip-link { position: fixed; z-index: 3000; top: 10px; left: 10px; padding: .7rem 1rem; color: #fff; background: var(--tw-ink); border-radius: 8px; transform: translateY(-150%); }
.skip-link:focus { transform: translateY(0); }

/* Brand */
.brand { display: inline-flex; align-items: center; gap: .65rem; min-width: 0; }
.brand-word { color: #fff; font-size: 1.55rem; font-weight: 820; letter-spacing: -.07em; line-height: 1; }
.brand-word span { color: var(--tw-red); }
.brand-mark { position: relative; display: inline-block; width: 26px; height: 25px; flex: 0 0 26px; transform: skewX(-10deg); }
.brand-mark::before, .brand-mark::after, .brand-mark i, .brand-mark b { content: ""; position: absolute; height: 6px; border-radius: 1px; background: var(--tw-red); transform: skewX(-20deg); }
.brand-mark::before { top: 2px; left: 0; width: 25px; }
.brand-mark::after { top: 10px; left: 6px; width: 19px; }
.brand-mark i { top: 18px; left: 12px; width: 13px; }
.brand-mark b { top: 7px; left: 2px; width: 7px; height: 7px; background: #fff; transform: skewX(20deg); opacity: .9; }
.brand-large .brand-word { font-size: 2rem; }
.brand-large .brand-mark { transform: skewX(-10deg) scale(1.2); }

/* Application chrome */
.app-shell { min-height: 100vh; }
.app-sidebar { position: fixed; inset: 0 auto 0 0; z-index: 1040; display: flex; flex-direction: column; width: var(--tw-sidebar); color: #d7d8db; background: var(--tw-ink); border-right: 1px solid rgba(255,255,255,.06); }
.sidebar-head { display: flex; align-items: center; justify-content: space-between; height: 76px; padding: 0 22px; border-bottom: 1px solid rgba(255,255,255,.07); }
.sidebar-nav { flex: 1; min-height: 0; padding: 20px 12px; overflow-y: auto; scrollbar-width: thin; }
.nav-eyebrow { margin: 20px 12px 8px; color: #70757e; font-size: .66rem; font-weight: 750; letter-spacing: .14em; text-transform: uppercase; }
.nav-eyebrow:first-child { margin-top: 0; }
.sidebar-nav .nav-link { position: relative; display: flex; align-items: center; gap: .8rem; min-height: 42px; margin: 2px 0; padding: .66rem .78rem; color: #aeb2ba; font-size: .87rem; font-weight: 560; border-radius: 9px; transition: color .18s ease, background .18s ease, transform .18s ease; }
.sidebar-nav .nav-link:hover { color: #fff; background: rgba(255,255,255,.055); transform: translateX(2px); }
.sidebar-nav .nav-link.is-active { color: #fff; background: linear-gradient(90deg, rgba(227,28,43,.22), rgba(227,28,43,.07)); }
.sidebar-nav .nav-link.is-active::before { content: ""; position: absolute; left: -12px; width: 3px; height: 22px; background: var(--tw-red); border-radius: 0 5px 5px 0; }
.nav-icon { display: inline-grid; place-items: center; width: 21px; height: 21px; color: #8e939b; font-size: 1.12rem; font-weight: 400; }
.is-active .nav-icon { color: #ff5864; }
.nav-pulse { width: 6px; height: 6px; margin-left: auto; background: var(--tw-red); border-radius: 50%; box-shadow: 0 0 0 4px rgba(227,28,43,.13); }
.sidebar-foot { padding: 13px 12px 14px; border-top: 1px solid rgba(255,255,255,.07); }
.sidebar-verify { display: grid; grid-template-columns: 29px 1fr auto; align-items: center; gap: .55rem; margin-bottom: 10px; padding: .72rem; color: #d7d8db; font-size: .76rem; background: rgba(255,255,255,.045); border: 1px solid rgba(255,255,255,.06); border-radius: 10px; }
.sidebar-verify:hover { color: #fff; background: rgba(255,255,255,.075); }
.sidebar-verify strong, .sidebar-verify small { display: block; }
.sidebar-verify small { margin-top: 2px; color: #7f848d; font-size: .67rem; }
.verify-symbol { display: grid; place-items: center; width: 28px; height: 28px; color: #ff5965; background: rgba(227,28,43,.15); border-radius: 8px; }
.sidebar-user { position: relative; display: flex; align-items: center; gap: .65rem; padding: .6rem .45rem; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; flex: 0 0 34px; color: #fff; font-size: .7rem; font-weight: 750; letter-spacing: .04em; background: #34373e; border: 1px solid rgba(255,255,255,.1); border-radius: 9px; }
.user-copy { min-width: 0; flex: 1; }
.user-copy strong, .user-copy small { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.user-copy strong { color: #f4f4f5; font-size: .76rem; }
.user-copy small { margin-top: 2px; color: #7f848d; font-size: .67rem; }
.sidebar-user .icon-button { color: #7e838c; }
.app-stage { min-height: 100vh; margin-left: var(--tw-sidebar); }
.topbar { position: sticky; top: 0; z-index: 1020; display: flex; align-items: center; justify-content: space-between; height: 76px; padding: 0 clamp(18px, 3vw, 38px); background: rgba(245,244,241,.9); border-bottom: 1px solid rgba(215,213,208,.76); backdrop-filter: blur(14px); }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: .65rem; }
.page-identity small, .page-identity strong { display: block; }
.page-identity small { margin-bottom: 1px; color: var(--tw-muted); font-size: .61rem; font-weight: 730; letter-spacing: .12em; text-transform: uppercase; }
.page-identity strong { font-size: .95rem; font-weight: 690; }
.icon-button { display: inline-grid; place-items: center; width: 36px; height: 36px; padding: 0; color: inherit; background: transparent; border: 0; border-radius: 9px; }
.icon-button:hover { background: rgba(80,82,87,.08); }
.top-action { position: relative; color: #555b65; background: rgba(255,255,255,.65); border: 1px solid var(--tw-line); }
.notification-dot { position: absolute; top: 7px; right: 7px; width: 6px; height: 6px; background: var(--tw-red); border: 1px solid #fff; border-radius: 50%; }
.command-button { align-items: center; gap: .55rem; min-width: 220px; height: 38px; padding: 0 .65rem; color: #7b8089; font-size: .77rem; text-align: left; background: rgba(255,255,255,.7); border: 1px solid var(--tw-line); border-radius: 9px; }
.command-button span:nth-child(2) { flex: 1; }
kbd { padding: .17rem .35rem; color: #7d8189; font: 600 .62rem/1.1 inherit; background: #efefed; border: 1px solid #deddd9; border-radius: 4px; box-shadow: none; }
.app-main { padding: clamp(22px, 3.2vw, 40px); }
.sidebar-scrim { display: none; }

/* Typography and page composition */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 25px; }
.page-head h1 { margin: 4px 0 7px; font-size: clamp(1.7rem, 2.6vw, 2.3rem); font-weight: 760; letter-spacing: -.045em; }
.page-head p { max-width: 680px; margin: 0; color: var(--tw-slate); font-size: .92rem; line-height: 1.6; }
.page-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.eyebrow { display: inline-flex; align-items: center; gap: .45rem; color: var(--tw-red); font-size: .68rem; font-weight: 780; letter-spacing: .13em; text-transform: uppercase; }
.eyebrow::before { content: ""; display: block; width: 18px; height: 2px; background: currentColor; }
.eyebrow.light { color: #ff5360; }
.section-title { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 30px 0 14px; }
.section-title h2 { margin: 0; font-size: 1.05rem; font-weight: 720; letter-spacing: -.02em; }
.section-title p { margin: 4px 0 0; color: var(--tw-muted); font-size: .76rem; }
.section-title a { color: var(--tw-red); font-size: .76rem; font-weight: 650; }
.text-muted { color: var(--tw-slate) !important; }
.tiny { font-size: .7rem; }
.muted-dot { color: #c2c1be; }
.text-link { color: var(--tw-red); font-weight: 650; }
.text-link:hover { color: var(--tw-red-dark); text-decoration: underline; }

/* Controls */
.btn { min-height: 38px; padding: .54rem .92rem; font-size: .8rem; font-weight: 650; border-radius: 9px; transition: transform .15s ease, box-shadow .15s ease, background .15s ease; }
.btn:hover { transform: translateY(-1px); }
.btn-sm { min-height: 34px; padding: .43rem .75rem; font-size: .75rem; }
.btn-lg { min-height: 47px; padding: .72rem 1.1rem; font-size: .9rem; border-radius: 10px; }
.btn-brand { color: #fff; background: var(--tw-red); border: 1px solid var(--tw-red); box-shadow: 0 8px 18px rgba(227,28,43,.17); }
.btn-brand:hover, .btn-brand:focus { color: #fff; background: var(--tw-red-dark); border-color: var(--tw-red-dark); box-shadow: 0 10px 24px rgba(227,28,43,.22); }
.btn-quiet { color: #4f545c; background: #fff; border: 1px solid var(--tw-line); }
.btn-quiet:hover { color: var(--tw-ink); background: #fafaf9; border-color: #d4d3cf; }
.btn-dark { background: var(--tw-ink); border-color: var(--tw-ink); }
.btn-danger { background: var(--tw-danger); border-color: var(--tw-danger); }
.btn-soft-danger { color: var(--tw-red-dark); background: var(--tw-red-soft); border: 1px solid #ffdadd; }
.btn-icon { display: inline-flex; align-items: center; justify-content: center; gap: .45rem; }
.form-label { margin-bottom: .43rem; color: #363a41; font-size: .75rem; font-weight: 670; }
.label-note { margin-left: .35rem; color: var(--tw-muted); font-weight: 450; }
.form-control, .form-select { min-height: 42px; color: var(--tw-ink); font-size: .83rem; background-color: #fff; border-color: #dfdedb; border-radius: 9px; box-shadow: none; }
.form-control:focus, .form-select:focus { border-color: rgba(227,28,43,.58); box-shadow: 0 0 0 3px rgba(227,28,43,.09); }
.form-control::placeholder { color: #aaadb3; }
textarea.form-control { min-height: 105px; }
.form-text { color: var(--tw-muted); font-size: .7rem; }
.input-group-text { color: #777c84; font-size: .76rem; background: #f8f8f6; border-color: #dfdedb; }
.form-check-input:checked { background-color: var(--tw-red); border-color: var(--tw-red); }
.field-validation-error, .validation-summary-errors { color: var(--tw-danger); font-size: .72rem; }
.input-icon { position: relative; }
.input-icon > span { position: absolute; z-index: 2; top: 50%; left: 13px; color: #9a9da3; transform: translateY(-50%); }
.input-icon .form-control { padding-left: 36px; }
.search-control { width: min(100%, 310px); }
.switch-field { display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: .9rem 0; border-bottom: 1px solid #efeeeb; }
.switch-field:last-child { border-bottom: 0; }
.switch-field strong, .switch-field small { display: block; }
.switch-field strong { font-size: .8rem; }
.switch-field small { margin-top: 3px; color: var(--tw-muted); font-size: .7rem; }

/* Cards and metrics */
.surface { background: var(--tw-surface); border: 1px solid var(--tw-line); border-radius: var(--tw-radius); box-shadow: 0 1px 0 rgba(20,22,25,.02); }
.surface-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 18px 20px; border-bottom: 1px solid var(--tw-line); }
.surface-head h2, .surface-head h3 { margin: 0; font-size: .9rem; font-weight: 720; letter-spacing: -.015em; }
.surface-head p { margin: 3px 0 0; color: var(--tw-muted); font-size: .7rem; }
.surface-body { padding: 20px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.metric-card { position: relative; min-height: 132px; padding: 18px; overflow: hidden; background: #fff; border: 1px solid var(--tw-line); border-radius: 14px; }
.metric-card::after { content: ""; position: absolute; right: -28px; bottom: -40px; width: 95px; height: 95px; background: radial-gradient(circle, rgba(227,28,43,.07), transparent 67%); }
.metric-top { display: flex; align-items: center; justify-content: space-between; color: var(--tw-slate); font-size: .7rem; font-weight: 620; }
.metric-icon { display: grid; place-items: center; width: 30px; height: 30px; color: var(--tw-red); background: var(--tw-red-soft); border-radius: 8px; }
.metric-value { display: block; margin-top: 18px; font-size: 1.68rem; font-weight: 760; letter-spacing: -.05em; line-height: 1; }
.metric-foot { display: flex; align-items: center; gap: 5px; margin-top: 9px; color: var(--tw-muted); font-size: .66rem; }
.metric-foot .up { color: var(--tw-success); font-weight: 700; }
.metric-foot .warn { color: var(--tw-warning); font-weight: 700; }
.metric-card.highlight { color: #fff; background: var(--tw-ink); border-color: var(--tw-ink); }
.metric-card.highlight .metric-top, .metric-card.highlight .metric-foot { color: #9da1a9; }
.metric-card.highlight .metric-icon { color: #fff; background: var(--tw-red); }
.metric-card.highlight::after { background: radial-gradient(circle, rgba(227,28,43,.24), transparent 65%); }
.skeleton { position: relative; color: transparent !important; overflow: hidden; background: #ececea !important; border-radius: 5px; }
.skeleton::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); transform: translateX(-100%); animation: shimmer 1.5s infinite; }
@keyframes shimmer { to { transform: translateX(100%); } }

/* Tables */
.table-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 14px 16px; border-bottom: 1px solid var(--tw-line); }
.table-tools, .filter-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.filter-chip { display: inline-flex; align-items: center; gap: .42rem; height: 35px; padding: 0 .7rem; color: #636871; font-size: .72rem; font-weight: 600; background: #fff; border: 1px solid var(--tw-line); border-radius: 8px; }
.filter-chip.is-active { color: var(--tw-red-dark); background: var(--tw-red-soft); border-color: #ffd7da; }
.data-table { width: 100%; margin: 0; border-collapse: collapse; }
.data-table th { padding: .78rem 1rem; color: #8a8e95; font-size: .64rem; font-weight: 730; letter-spacing: .085em; text-align: left; text-transform: uppercase; background: #fafaf8; border-bottom: 1px solid var(--tw-line); white-space: nowrap; }
.data-table td { padding: .88rem 1rem; color: #454a52; font-size: .77rem; vertical-align: middle; border-bottom: 1px solid #efeeeb; }
.data-table tr:last-child td { border-bottom: 0; }
.data-table tbody tr { transition: background .15s ease; }
.data-table tbody tr:hover { background: #fbfbfa; }
.table-main { display: flex; align-items: center; gap: .72rem; min-width: 180px; }
.table-main strong, .table-main small { display: block; }
.table-main strong { max-width: 260px; overflow: hidden; color: var(--tw-ink); font-size: .78rem; white-space: nowrap; text-overflow: ellipsis; }
.table-main small { margin-top: 3px; color: var(--tw-muted); font-size: .67rem; }
.doc-mini { display: grid; place-items: center; width: 34px; height: 40px; flex: 0 0 34px; color: var(--tw-red); font-size: .62rem; font-weight: 780; background: #fff6f6; border: 1px solid #ffdadd; border-radius: 5px; }
.ref-code { color: #3d424a; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .71rem; font-weight: 650; }
.status-badge { display: inline-flex; align-items: center; gap: .36rem; min-height: 25px; padding: .25rem .52rem; color: #5b6069; font-size: .64rem; font-weight: 690; background: #f1f1ef; border: 1px solid #e7e6e3; border-radius: 999px; white-space: nowrap; }
.status-badge::before { content: ""; width: 5px; height: 5px; background: currentColor; border-radius: 50%; }
.status-badge.success, .status-badge.approved, .status-badge.valid, .status-badge.active { color: var(--tw-success); background: var(--tw-success-soft); border-color: #d2eee4; }
.status-badge.pending, .status-badge.draft { color: var(--tw-warning); background: var(--tw-warning-soft); border-color: #f4e4c5; }
.status-badge.sent, .status-badge.generated { color: var(--tw-info); background: #eef3ff; border-color: #dce6ff; }
.status-badge.revoked, .status-badge.rejected, .status-badge.failed { color: var(--tw-danger); background: var(--tw-red-soft); border-color: #ffdadd; }
.row-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; }
.row-action { display: inline-grid; place-items: center; width: 31px; height: 31px; padding: 0; color: #777c84; background: transparent; border: 0; border-radius: 7px; }
.row-action:hover { color: var(--tw-ink); background: #eeedea; }
.table-pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 13px 16px; color: var(--tw-muted); font-size: .68rem; border-top: 1px solid var(--tw-line); }
.table-pagination nav { display: flex; align-items: center; gap: 8px; }
.page-button { display: inline-grid; place-items: center; width: 30px; height: 30px; color: #555a62; background: #fff; border: 1px solid var(--tw-line); border-radius: 7px; }
.page-button:disabled { opacity: .4; }
.empty-state { display: grid; place-items: center; min-height: 260px; padding: 34px; text-align: center; }
.empty-glyph { display: grid; place-items: center; width: 52px; height: 52px; margin-bottom: 15px; color: var(--tw-red); font-size: 1.5rem; background: var(--tw-red-soft); border-radius: 15px; transform: rotate(-5deg); }
.empty-state h3 { margin: 0; font-size: .95rem; font-weight: 720; }
.empty-state p { max-width: 370px; margin: 7px 0 18px; color: var(--tw-muted); font-size: .75rem; line-height: 1.55; }

/* Dashboard charts and activity */
.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, .85fr); gap: 14px; }
.chart-wrap { position: relative; height: 280px; padding: 12px 8px 2px; }
.chart-wrap canvas { width: 100%; height: 100%; }
.donut-layout { display: grid; grid-template-columns: 150px 1fr; align-items: center; min-height: 280px; padding: 20px; }
.donut-chart { position: relative; width: 132px; height: 132px; margin: auto; border-radius: 50%; background: conic-gradient(var(--tw-red) 0 38%, #292c31 38% 65%, #efaa49 65% 80%, #d9d9d5 80% 100%); }
.donut-chart::after { content: attr(data-total); position: absolute; inset: 22px; display: grid; place-items: center; color: var(--tw-ink); font-size: 1.2rem; font-weight: 750; background: #fff; border-radius: 50%; white-space: pre-line; }
.chart-legend { display: grid; gap: 11px; }
.legend-item { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; color: #555a62; font-size: .7rem; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-item strong { color: var(--tw-ink); }
.activity-list { padding: 5px 20px 14px; }
.activity-item { position: relative; display: grid; grid-template-columns: 34px 1fr auto; gap: 10px; padding: 14px 0; border-bottom: 1px solid #efeeeb; }
.activity-item:last-child { border-bottom: 0; }
.activity-icon { display: grid; place-items: center; width: 32px; height: 32px; color: var(--tw-red); font-size: .72rem; background: var(--tw-red-soft); border-radius: 9px; }
.activity-copy strong, .activity-copy small { display: block; }
.activity-copy strong { font-size: .75rem; font-weight: 660; }
.activity-copy small { margin-top: 4px; color: var(--tw-muted); font-size: .66rem; }
.activity-time { color: var(--tw-muted); font-size: .63rem; white-space: nowrap; }

/* Detail blocks, timelines and lists */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(280px, .7fr); gap: 14px; align-items: start; }
.detail-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0; margin: 0; }
.detail-list > div { padding: 14px 0; border-bottom: 1px solid #efeeeb; }
.detail-list > div:nth-child(odd) { margin-right: 24px; }
.detail-list dt { color: var(--tw-muted); font-size: .65rem; font-weight: 640; letter-spacing: .04em; text-transform: uppercase; }
.detail-list dd { margin: 6px 0 0; color: #343840; font-size: .78rem; font-weight: 570; }
.avatar-stack { display: flex; }
.avatar-stack .avatar { margin-left: -7px; border: 2px solid #fff; }
.avatar-stack .avatar:first-child { margin-left: 0; }
.person-card { display: flex; align-items: center; gap: 12px; padding: 12px; border: 1px solid var(--tw-line); border-radius: 11px; }
.person-card .avatar { width: 40px; height: 40px; flex-basis: 40px; color: var(--tw-ink); background: #f0efec; }
.person-card strong, .person-card small { display: block; }
.person-card strong { font-size: .78rem; }
.person-card small { margin-top: 3px; color: var(--tw-muted); font-size: .67rem; }
.timeline { position: relative; padding: 5px 0; }
.timeline::before { content: ""; position: absolute; top: 20px; bottom: 20px; left: 15px; width: 1px; background: #e4e3e0; }
.timeline-item { position: relative; display: grid; grid-template-columns: 31px 1fr; gap: 12px; padding: 10px 0; }
.timeline-dot { z-index: 1; display: grid; place-items: center; width: 31px; height: 31px; color: #70757d; font-size: .65rem; background: #f5f4f1; border: 1px solid #dfdedb; border-radius: 50%; }
.timeline-item.is-complete .timeline-dot { color: #fff; background: var(--tw-success); border-color: var(--tw-success); }
.timeline-item.is-current .timeline-dot { color: #fff; background: var(--tw-red); border-color: var(--tw-red); box-shadow: 0 0 0 4px var(--tw-red-soft); }
.timeline-copy strong, .timeline-copy span, .timeline-copy small { display: block; }
.timeline-copy strong { font-size: .76rem; }
.timeline-copy span { margin-top: 3px; color: #5c6169; font-size: .7rem; }
.timeline-copy small { margin-top: 3px; color: var(--tw-muted); font-size: .63rem; }
.meta-strip { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 20px; padding: 12px 16px; color: var(--tw-muted); font-size: .68rem; background: #fafaf8; border: 1px solid var(--tw-line); border-radius: 10px; }
.meta-strip strong { margin-left: 4px; color: #484d55; }

/* Forms, steps and builders */
.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 16px; align-items: start; }
.form-stack { display: grid; gap: 14px; }
.form-section { padding: 22px; background: #fff; border: 1px solid var(--tw-line); border-radius: var(--tw-radius); }
.form-section-head { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 20px; }
.step-number { display: grid; place-items: center; width: 27px; height: 27px; flex: 0 0 27px; color: var(--tw-red); font-size: .7rem; font-weight: 750; background: var(--tw-red-soft); border-radius: 8px; }
.form-section-head h2 { margin: 1px 0 4px; font-size: .9rem; font-weight: 720; }
.form-section-head p { margin: 0; color: var(--tw-muted); font-size: .69rem; }
.form-actions-sticky { position: sticky; bottom: 15px; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px; background: rgba(255,255,255,.92); border: 1px solid var(--tw-line); border-radius: 13px; box-shadow: var(--tw-shadow); backdrop-filter: blur(12px); }
.aside-note { padding: 15px; color: #6c7179; font-size: .7rem; line-height: 1.55; background: #fbfbf9; border: 1px dashed #d9d8d4; border-radius: 11px; }
.aside-note strong { display: block; margin-bottom: 4px; color: var(--tw-ink); font-size: .73rem; }
.steps { display: flex; align-items: center; gap: 0; margin-bottom: 20px; }
.step { display: flex; align-items: center; flex: 1; color: #999da4; font-size: .67rem; font-weight: 650; }
.step::after { content: ""; height: 1px; flex: 1; margin: 0 10px; background: #deddda; }
.step:last-child { flex: 0 0 auto; }
.step:last-child::after { display: none; }
.step b { display: grid; place-items: center; width: 24px; height: 24px; margin-right: 6px; font-size: .62rem; background: #e9e8e5; border-radius: 50%; }
.step.is-active, .step.is-complete { color: var(--tw-ink); }
.step.is-active b { color: #fff; background: var(--tw-red); box-shadow: 0 0 0 4px var(--tw-red-soft); }
.step.is-complete b { color: #fff; background: var(--tw-success); }
.dropzone { display: grid; place-items: center; min-height: 118px; padding: 18px; color: var(--tw-muted); text-align: center; background: #fafaf8; border: 1px dashed #cfceca; border-radius: 11px; cursor: pointer; }
.dropzone:hover { color: var(--tw-red); background: var(--tw-red-soft); border-color: #f0aeb3; }
.dropzone strong, .dropzone small { display: block; }
.dropzone strong { margin: 7px 0 2px; color: var(--tw-ink); font-size: .76rem; }
.dropzone small { font-size: .66rem; }

/* Signatory editor */
.signatory-list { display: grid; gap: 9px; }
.signatory-row { display: grid; grid-template-columns: 32px minmax(130px, 1.25fr) minmax(120px, 1fr) minmax(120px, 1fr) auto auto; align-items: end; gap: 8px; padding: 12px; background: #fafaf8; border: 1px solid #e9e8e5; border-radius: 11px; }
.drag-handle { align-self: center; display: grid; place-items: center; width: 30px; height: 40px; color: #a1a4aa; cursor: grab; }
.signatory-row label { display: block; margin-bottom: 4px; color: #777c84; font-size: .62rem; font-weight: 660; }
.signatory-row .form-control, .signatory-row .form-select { min-height: 38px; font-size: .75rem; }
.signatory-required { align-self: center; padding-top: 17px; white-space: nowrap; }
.signatory-remove { align-self: center; margin-top: 17px; }
.signature-swatch { height: 70px; padding: 13px; overflow: hidden; color: var(--tw-ink); font-family: "Segoe Script", "Bradley Hand", cursive; font-size: 1.25rem; background: #fff; border: 1px solid var(--tw-line); border-radius: 9px; }

/* Template builder */
.builder-shell { display: grid; grid-template-columns: 250px minmax(420px, 1fr) minmax(360px, .9fr); min-height: calc(100vh - 155px); overflow: hidden; background: #fff; border: 1px solid var(--tw-line); border-radius: var(--tw-radius); }
.builder-sidebar, .builder-editor, .builder-preview { min-width: 0; }
.builder-sidebar { background: #fafaf8; border-right: 1px solid var(--tw-line); }
.builder-editor { border-right: 1px solid var(--tw-line); }
.builder-pane-head { display: flex; align-items: center; justify-content: space-between; height: 54px; padding: 0 15px; border-bottom: 1px solid var(--tw-line); }
.builder-pane-head strong { font-size: .76rem; }
.placeholder-search { padding: 12px; }
.placeholder-groups { max-height: calc(100vh - 275px); padding: 0 12px 15px; overflow-y: auto; }
.placeholder-group h3 { margin: 14px 3px 7px; color: var(--tw-muted); font-size: .61rem; letter-spacing: .09em; text-transform: uppercase; }
.placeholder-button { display: flex; align-items: center; justify-content: space-between; width: 100%; margin: 4px 0; padding: .52rem .6rem; color: #535860; font-size: .7rem; text-align: left; background: #fff; border: 1px solid #e6e5e2; border-radius: 7px; }
.placeholder-button:hover { color: var(--tw-red); border-color: #efb5b9; }
.placeholder-button code { color: #969aa1; font-size: .59rem; }
.editor-toolbar { display: flex; align-items: center; gap: 2px; padding: 8px 12px; background: #fafaf8; border-bottom: 1px solid var(--tw-line); }
.editor-tool { display: grid; place-items: center; min-width: 30px; height: 30px; padding: 0 7px; color: #626770; font-size: .68rem; font-weight: 650; background: transparent; border: 0; border-radius: 6px; }
.editor-tool:hover, .editor-tool.is-active { color: var(--tw-ink); background: #e9e8e5; }
.html-editor { width: 100%; min-height: 360px; padding: 18px; color: #2f343a; font: .74rem/1.65 ui-monospace, SFMono-Regular, Consolas, monospace; background: #fff; border: 0; resize: vertical; outline: 0; }
.css-editor-wrap { border-top: 1px solid var(--tw-line); }
.builder-pane-head-compact { min-height: 42px; padding-block: 10px; background: #fafaf8; }
.css-editor { min-height: 205px; color: #394150; background: #fcfcfb; }
.builder-preview { padding-bottom: 15px; background: #efeeeb; }
.builder-preview .preview-stage { height: calc(100vh - 235px); padding: 24px; overflow: auto; }

/* Toasts, modals and command palette */
.toast-stack { position: fixed; z-index: 2200; right: 20px; bottom: 20px; display: grid; gap: 9px; width: min(370px, calc(100vw - 32px)); }
.app-toast { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; padding: 12px; color: #fff; background: #202329; border: 1px solid rgba(255,255,255,.09); border-radius: 11px; box-shadow: 0 18px 45px rgba(0,0,0,.22); animation: toast-in .25s ease both; }
.app-toast.success .toast-symbol { color: #8ce0c3; background: rgba(46,171,131,.18); }
.app-toast.error .toast-symbol { color: #ff9da5; background: rgba(227,28,43,.18); }
.toast-symbol { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 8px; }
.toast-copy strong, .toast-copy small { display: block; }
.toast-copy strong { font-size: .74rem; }
.toast-copy small { margin-top: 3px; color: #aaaeb5; font-size: .65rem; }
.toast-close { color: #858a92; background: none; border: 0; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }
.premium-modal { border: 0; border-radius: 15px; box-shadow: 0 25px 70px rgba(0,0,0,.19); }
.modal-symbol { display: grid; place-items: center; width: 40px; height: 40px; font-weight: 800; background: #f2f1ef; border-radius: 11px; }
.modal-symbol.danger { color: var(--tw-danger); background: var(--tw-red-soft); }
.modal-header { border-color: var(--tw-line); }
.modal-footer { border-color: var(--tw-line); }
.command-palette { position: fixed; z-index: 2100; inset: 0; padding: 11vh 16px 20px; background: rgba(14,16,19,.56); backdrop-filter: blur(5px); }
.command-palette[hidden] { display: none; }
.command-dialog { width: min(610px, 100%); margin: auto; overflow: hidden; background: #fff; border: 1px solid rgba(255,255,255,.4); border-radius: 15px; box-shadow: 0 30px 100px rgba(0,0,0,.28); }
.command-search { display: flex; align-items: center; gap: 10px; padding: 15px; border-bottom: 1px solid var(--tw-line); }
.command-search input { flex: 1; min-width: 0; padding: 0; font-size: .9rem; background: transparent; border: 0; outline: 0; }
.command-results { padding: 9px; }
.command-label { margin: 7px 9px; color: var(--tw-muted); font-size: .61rem; font-weight: 720; letter-spacing: .1em; text-transform: uppercase; }
.command-results a { display: grid; grid-template-columns: 32px 1fr auto; align-items: center; gap: 10px; padding: 10px; border-radius: 9px; }
.command-results a:hover { background: #f4f3f0; }
.command-results strong, .command-results small { display: block; }
.command-results strong { font-size: .75rem; }
.command-results small { margin-top: 2px; color: var(--tw-muted); font-size: .65rem; }

/* Responsive */
@media (max-width: 1199.98px) {
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .builder-shell { grid-template-columns: 220px minmax(390px, 1fr); }
  .builder-preview { grid-column: 1 / -1; border-top: 1px solid var(--tw-line); }
  .builder-preview .preview-stage { height: auto; max-height: 700px; }
}
@media (max-width: 991.98px) {
  .app-sidebar { transform: translateX(-105%); transition: transform .22s ease; box-shadow: 25px 0 70px rgba(0,0,0,.2); }
  .app-stage { margin-left: 0; }
  .app-shell.sidebar-visible .app-sidebar { transform: translateX(0); }
  .app-shell.sidebar-visible .sidebar-scrim { position: fixed; z-index: 1030; inset: 0; display: block; background: rgba(15,17,20,.45); }
  .dashboard-grid, .detail-grid, .form-layout { grid-template-columns: 1fr; }
  .form-layout > aside { position: static !important; }
  .signatory-row { grid-template-columns: 30px 1fr 1fr; }
  .signatory-row .signatory-role { grid-column: 2; }
}
@media (max-width: 767.98px) {
  html { font-size: 14px; }
  .app-main { padding: 20px 15px 34px; }
  .topbar { height: 66px; padding: 0 14px; }
  .top-create span:last-child { display: none; }
  .page-head { align-items: flex-start; flex-direction: column; margin-bottom: 20px; }
  .page-actions { justify-content: flex-start; width: 100%; }
  .metric-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .metric-card { min-height: 116px; padding: 14px; }
  .metric-value { margin-top: 13px; font-size: 1.45rem; }
  .dashboard-grid { gap: 10px; }
  .data-table { min-width: 760px; }
  .surface.table-surface { overflow-x: auto; }
  .surface.table-surface .table-toolbar, .surface.table-surface .table-pagination { position: sticky; left: 0; width: calc(100vw - 30px); }
  .detail-list { grid-template-columns: 1fr; }
  .detail-list > div:nth-child(odd) { margin-right: 0; }
  .builder-shell { display: block; }
  .builder-sidebar, .builder-editor { border-right: 0; border-bottom: 1px solid var(--tw-line); }
  .placeholder-groups { max-height: 280px; }
  .html-editor { min-height: 320px; }
  .css-editor { min-height: 190px; }
  .signatory-row { grid-template-columns: 30px 1fr auto; }
  .signatory-row > div:not(.drag-handle):not(.signatory-remove) { grid-column: 2 / -1; }
  .signatory-required { grid-column: 2; }
  .signatory-remove { grid-column: 3; grid-row: 1; }
  .table-pagination { align-items: flex-start; flex-direction: column; }
}
@media (max-width: 479.98px) {
  .metric-grid { grid-template-columns: 1fr; }
  .metric-card { min-height: 105px; }
  .donut-layout { grid-template-columns: 1fr; gap: 25px; }
  .page-identity small { display: none; }
  .topbar-actions { gap: 4px; }
  .form-section { padding: 17px; }
}

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