/* ============================================================
   GestãoImpulse — Impulse Art Studios
   Direção: mesa de estúdio. Sidebar em tinta, conteúdo claro e
   plano (bordas finas, sem sombras decorativas), amarelo da
   marca usado como marcador. O "medidor" de 6 segmentos é o
   motivo recorrente: etapas do contrato e split sheet.
   ============================================================ */

/* Inter (SIL OFL 1.1), variável em peso e tamanho óptico, subconjunto latino, hospedada localmente. */
@font-face {
    font-family: 'Inter';
    src: url('/assets/fonts/inter-latin-var.woff2') format('woff2');
    font-weight: 100 900;
    font-style: normal;
    font-display: swap;
}

:root {
    color-scheme: light;

    --canvas:       #ECEDEE;
    --paper:        #FFFFFF;
    --sunk:         #F5F5F6;
    --line:         #D9DADD;
    --line-strong:  #B4B6BC;

    --ink:          #141414;
    --ink-hover:    rgba(255, 255, 255, 0.07);
    --on-ink:       #B4B6BB;

    --text:         #141414;
    --muted:        #565960;
    --faint:        #74777E;

    --yellow:       #F5C200;
    --yellow-press: #E0B000;
    --yellow-soft:  #FFF4C2;
    --yellow-edge:  #E8CF6A;
    --yellow-text:  #7A5A00;

    --green:        #167A4B;
    --green-soft:   #DDF3E6;
    --red:          #C62828;
    --red-soft:     #FBE4E2;

    /* Cores de canal do split sheet (ordem de participante) */
    --seg-0: #141414;
    --seg-1: #F5C200;
    --seg-2: #6B6E75;
    --seg-3: #B38900;
    --seg-4: #A9ABB2;
    --seg-5: #3A3B40;

    --font-head: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;

    --r-panel: 12px;
    --r-control: 8px;
    --r-chip: 6px;

    --sidebar-w:    248px;
    --sidebar-rail: 72px;
    --topbar-h:     56px;
    --gutter:       32px;

    --ease: cubic-bezier(0.32, 0.72, 0, 1);
    --t: 180ms var(--ease);
}

/* ---- Reset ---- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font-body);
    font-size: 15px;
    line-height: 1.55;
    color: var(--text);
    background: var(--canvas);
    font-optical-sizing: auto;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body.is-locked { overflow: hidden; }

h1, h2, h3 { font-family: var(--font-head); }

button { font: inherit; color: inherit; }
img, svg { display: block; max-width: 100%; }

/* Alpine: esconde elementos com x-show/x-if até a inicialização */
[x-cloak] { display: none !important; }

a { color: inherit; text-decoration: none; }

/* Links soltos no texto ganham sublinhado amarelo */
a:not([class]) {
    text-decoration: underline;
    text-decoration-color: var(--yellow);
    text-decoration-thickness: 2px;
    text-underline-offset: 3px;
    overflow-wrap: anywhere;
}
a:not([class]):hover { background: var(--yellow-soft); }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    clip-path: inset(50%);
    white-space: nowrap;
}

/* ============================================================
   Shell: sidebar, topbar, conteúdo
   ============================================================ */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    width: var(--sidebar-w);
    flex: none;
    display: flex;
    flex-direction: column;
    background: var(--ink);
    color: var(--on-ink);
    z-index: 50;
    transition: width var(--t);
}

.sidebar__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    height: 64px;
    padding: 0 12px 0 18px;
    flex: none;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
    color: #fff;
}

.brand__tile {
    width: 36px; height: 36px;
    flex: none;
    display: grid;
    place-items: center;
    background: var(--yellow);
    color: var(--ink);
    border-radius: 9px;
}

.brand__text { min-width: 0; line-height: 1.15; }
.brand__name {
    display: block;
    font-family: var(--font-head);
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -0.01em;
    white-space: nowrap;
}
.brand__sub {
    display: block;
    font-size: 11.5px;
    color: #8E9096;
    white-space: nowrap;
}

.sidebar .sidebar__close { display: none; }

.sidebar__nav {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 12px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar__footer {
    flex: none;
    padding: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.09);
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 0;
    border-radius: var(--r-control);
    background: transparent;
    color: var(--on-ink);
    font-size: 14px;
    font-weight: 500;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--t), color var(--t);
}
.nav-item svg { flex: none; }
.nav-item:hover { background: var(--ink-hover); color: #fff; }

.nav-item[aria-current="page"] { background: rgba(255, 255, 255, 0.09); color: #fff; }
.nav-item[aria-current="page"] svg { color: var(--yellow); }
.nav-item[aria-current="page"]::before {
    content: '';
    position: absolute;
    left: -12px; top: 9px; bottom: 9px;
    width: 3px;
    background: var(--yellow);
    border-radius: 0 3px 3px 0;
}

.sidebar :focus-visible { outline: 2px solid var(--yellow); outline-offset: -2px; }

.collapse-icon { transition: transform var(--t); }

/* Menu recolhido (desktop): só ícones. O estado vem de <html data-sidebar>,
   definido no <head> antes da primeira pintura — sem flash. */
@media (min-width: 861px) {
    html[data-sidebar="closed"] .sidebar { width: var(--sidebar-rail); }
    html[data-sidebar="closed"] .sidebar__header { padding: 0 18px; }
    html[data-sidebar="closed"] .brand__text,
    html[data-sidebar="closed"] .nav-label {
        position: absolute;
        width: 1px; height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
    html[data-sidebar="closed"] .nav-item { padding: 0; justify-content: center; }
    html[data-sidebar="closed"] .collapse-icon { transform: scaleX(-1); }
}

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    align-items: center;
    gap: 8px;
    height: var(--topbar-h);
    padding: 0 var(--gutter);
    background: rgba(236, 237, 238, 0.88);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--line);
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 40px; height: 40px;
    flex: none;
    border: 0;
    border-radius: var(--r-control);
    background: transparent;
    color: var(--text);
    cursor: pointer;
    transition: background var(--t);
}
.icon-btn:hover { background: rgba(0, 0, 0, 0.06); }
.icon-btn--sm { width: 32px; height: 32px; }
.sidebar .icon-btn { color: var(--on-ink); }
.sidebar .icon-btn:hover { background: var(--ink-hover); color: #fff; }

.menu-btn { display: none; margin-left: -10px; }

.crumbs {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
    flex: 1;
    font-size: 13.5px;
    color: var(--muted);
}
.crumbs__link:hover { color: var(--text); text-decoration: underline; }
.crumbs__sep { color: var(--line-strong); }
.crumbs > * { white-space: nowrap; }
.crumbs > :last-child { color: var(--text); font-weight: 600; overflow: hidden; text-overflow: ellipsis; }

.topbar__actions { display: flex; align-items: center; gap: 8px; }

.scrim {
    position: fixed;
    inset: 0;
    z-index: 40;
    background: rgba(0, 0, 0, 0.5);
}

.content {
    width: 100%;
    max-width: 1160px;
    margin-inline: auto;
    padding: 32px var(--gutter) 72px;
    flex: 1;
}

/* ---- Page header ---- */
.page-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px 24px;
    flex-wrap: wrap;
    margin-bottom: 28px;
}

.page-header__title { min-width: 0; }

.page-header h1 {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.12;
    letter-spacing: -0.025em;
    overflow-wrap: anywhere;
}

.page-header p {
    margin-top: 6px;
    max-width: 62ch;
    color: var(--muted);
}

.page-header__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

.avatar {
    display: inline-grid;
    place-items: center;
    width: 52px; height: 52px;
    flex: none;
    border-radius: 12px;
    background: var(--yellow);
    color: var(--ink);
    font-family: var(--font-head);
    font-size: 19px;
    font-weight: 700;
}
.page-header--person { justify-content: flex-start; flex-wrap: nowrap; align-items: center; }
.page-header--person .page-header__actions { margin-left: auto; }

.section-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 36px 0 12px;
}
.section-head:first-child { margin-top: 0; }
.section-head h2 {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.015em;
}
.section-head__hint { font-size: 13px; color: var(--muted); }

/* ============================================================
   Botões
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 40px;
    padding: 0 16px;
    border: 1px solid transparent;
    border-radius: var(--r-control);
    font-size: 14px;
    font-weight: 600;
    line-height: 1;
    white-space: nowrap;
    cursor: pointer;
    transition: background var(--t), border-color var(--t), transform 90ms ease;
}
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; transform: none; }

.btn--primary { background: var(--yellow); color: var(--ink); }
.btn--primary:hover { background: var(--yellow-press); }

.btn--secondary { background: var(--paper); color: var(--text); border-color: var(--line-strong); }
.btn--secondary:hover { background: var(--sunk); border-color: var(--muted); }

.btn--ghost { background: transparent; color: var(--text); }
.btn--ghost:hover { background: rgba(0, 0, 0, 0.06); }

.btn--block { width: 100%; }
.btn--sm { height: 32px; padding: 0 12px; font-size: 13px; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* ============================================================
   Formulários
   ============================================================ */
.form {
    max-width: 720px;
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
}
.form--wide { max-width: 820px; }

.form__body { padding: 28px 28px 8px; }

.form__actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding: 16px 28px;
    background: var(--sunk);
    border-top: 1px solid var(--line);
    border-radius: 0 0 var(--r-panel) var(--r-panel);
}

.field { margin-bottom: 20px; min-width: 0; }

.field__label {
    display: block;
    margin-bottom: 6px;
    font-size: 13.5px;
    font-weight: 500;
}

.field__input,
.field__select,
.field__textarea {
    display: block;
    width: 100%;
    height: 40px;
    padding: 0 12px;
    background: var(--paper);
    border: 1px solid var(--line-strong);
    border-radius: var(--r-control);
    color: var(--text);
    font: inherit;
    font-size: 15px;
    transition: border-color var(--t), box-shadow var(--t);
}

.field__textarea { height: auto; min-height: 92px; padding: 10px 12px; resize: vertical; line-height: 1.5; }

.field__input::placeholder,
.field__textarea::placeholder { color: var(--faint); }

.field__input:hover,
.field__select:hover,
.field__textarea:hover { border-color: var(--muted); }

.field__input:focus,
.field__select:focus,
.field__textarea:focus {
    outline: none;
    border-color: var(--ink);
    box-shadow: 0 0 0 3px rgba(245, 194, 0, 0.6);
}

.field__select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 36px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23565960' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    text-overflow: ellipsis;
}

.field--error .field__input,
.field--error .field__select { border-color: var(--red); }

.field__hint { margin-top: 6px; font-size: 13px; color: var(--muted); }
.field__error { margin-top: 6px; font-size: 13px; font-weight: 500; color: var(--red); }

.field-row { display: grid; gap: 0 16px; grid-template-columns: 1fr 1fr; }

.form__section {
    margin-top: 28px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}
.form__section:first-child { margin-top: 0; padding-top: 0; border-top: 0; }

.form__section-title {
    margin-bottom: 4px;
    font-family: var(--font-head);
    font-size: 16px;
    font-weight: 600;
    letter-spacing: -0.01em;
}
.form__section-hint { margin-bottom: 18px; font-size: 13.5px; color: var(--muted); max-width: 60ch; }
.form__section-title:not(:has(+ .form__section-hint)) { margin-bottom: 18px; }

.disclosure {
    display: flex;
    align-items: center;
    gap: 8px;
    width: 100%;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    text-align: left;
}
.disclosure svg { transition: transform var(--t); }
.disclosure[aria-expanded="true"] svg { transform: rotate(90deg); }

/* ---- Split sheet ---- */
.splitbar {
    display: flex;
    gap: 2px;
    height: 16px;
    border-radius: 5px;
    overflow: hidden;
    background: repeating-linear-gradient(135deg, var(--line) 0 5px, var(--sunk) 5px 10px);
}
.splitbar > i { display: block; flex: none; height: 100%; transition: width var(--t); }
.splitbar--over { outline: 2px solid var(--red); outline-offset: 2px; }

.seg-0 { background: var(--seg-0); }
.seg-1 { background: var(--seg-1); }
.seg-2 { background: var(--seg-2); }
.seg-3 { background: var(--seg-3); }
.seg-4 { background: var(--seg-4); }
.seg-5 { background: var(--seg-5); }

.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; flex: none; }

.split-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 12px;
    font-size: 13.5px;
}

.split-total {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    height: 28px;
    padding: 0 10px;
    border-radius: var(--r-chip);
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    background: var(--yellow-soft);
    color: var(--yellow-text);
}
.split-total--ok   { background: var(--green-soft); color: var(--green); }
.split-total--over { background: var(--red-soft);   color: var(--red); }

.split-rows { margin-top: 20px; display: flex; flex-direction: column; gap: 12px; }

.split-row {
    display: grid;
    grid-template-columns: 12px minmax(0, 2fr) minmax(0, 1.3fr) 108px 40px;
    gap: 12px;
    align-items: end;
}
.split-row .field { margin-bottom: 0; }
.split-row__swatch { height: 40px; display: grid; place-items: center; }

.split-add { margin: 16px 0 20px; }

@media (min-width: 721px) {
    /* Só a primeira linha mostra rótulos; nas demais ficam só para leitores de tela */
    .split-row:not(.split-row--first) .field__label {
        position: absolute;
        width: 1px; height: 1px;
        overflow: hidden;
        clip: rect(0 0 0 0);
        white-space: nowrap;
    }
}

/* ============================================================
   Painéis, tabelas, listas
   ============================================================ */
.panel {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
}
.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    font-family: var(--font-head);
    font-size: 15px;
    font-weight: 600;
}
.panel__body { padding: 20px; }

.facts > div {
    display: grid;
    grid-template-columns: 124px minmax(0, 1fr);
    gap: 12px;
    padding: 11px 20px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
}
.facts > div:last-child { border-bottom: 0; }
.facts dt { color: var(--muted); }
.facts dd { overflow-wrap: anywhere; }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }

.table-wrap {
    background: var(--paper);
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    overflow-x: auto;
}

.table { width: 100%; border-collapse: collapse; font-size: 14px; }

.table th {
    padding: 10px 16px;
    text-align: left;
    font-size: 12.5px;
    font-weight: 500;
    color: var(--muted);
    background: var(--sunk);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

.table td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--line);
    vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #FAFAFB; }

.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-end { width: 1%; text-align: right; white-space: nowrap; }
.table .muted { color: var(--muted); }
.table .date { color: var(--muted); font-size: 13px; white-space: nowrap; font-variant-numeric: tabular-nums; }

.cell-title {
    font-weight: 600;
    overflow-wrap: anywhere;
}
a.cell-title:hover { text-decoration: underline; text-decoration-color: var(--yellow); text-decoration-thickness: 2px; text-underline-offset: 3px; }
.cell-sub { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }

.badge {
    display: inline-flex;
    align-items: center;
    height: 22px;
    padding: 0 8px;
    border: 1px solid var(--line);
    border-radius: var(--r-chip);
    background: var(--sunk);
    color: var(--muted);
    font-size: 12.5px;
    font-weight: 500;
    white-space: nowrap;
}
.badge--progress { background: var(--yellow-soft); border-color: var(--yellow-edge); color: var(--yellow-text); }
.badge--done     { background: var(--green-soft); border-color: #A9DBBE; color: var(--green); }

/* ---- Medidor de etapas do contrato ---- */
.status {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    font-size: 13.5px;
    font-weight: 500;
    white-space: nowrap;
}
.status--assinado { color: var(--green); }

.meter { display: inline-flex; gap: 2px; align-items: flex-end; flex: none; }
.meter i {
    display: block;
    width: 5px; height: 14px;
    border-radius: 1.5px;
    background: var(--line);
}
.meter i.on  { background: var(--ink); }
.status--assinado .meter i.on { background: var(--green); }
.meter i.now {
    background: var(--yellow);
    box-shadow: inset 0 0 0 1px var(--ink);
}

.progress { display: inline-flex; align-items: center; gap: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.progress__bar { width: 56px; height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.progress__bar i { display: block; height: 100%; background: var(--ink); }
.progress--full .progress__bar i { background: var(--green); }

/* ---- Filtros e busca ---- */
.toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.search { position: relative; flex: 1 1 260px; max-width: 360px; }
.search svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.search .field__input { padding-left: 38px; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.chip {
    display: inline-flex;
    align-items: center;
    height: 32px;
    padding: 0 14px;
    border: 1px solid var(--line-strong);
    border-radius: 16px;
    background: var(--paper);
    font-size: 13.5px;
    font-weight: 500;
    transition: background var(--t), border-color var(--t);
}
.chip:hover { border-color: var(--ink); }
.chip[aria-current="page"] { background: var(--ink); border-color: var(--ink); color: #fff; }

/* ---- Alertas ---- */
.alert {
    margin-bottom: 24px;
    padding: 12px 16px;
    border: 1px solid var(--line-strong);
    border-left-width: 4px;
    border-radius: var(--r-control);
    background: var(--paper);
    font-size: 14px;
    transition: opacity 300ms ease;
}
.alert.is-leaving { opacity: 0; }
.alert--success { background: var(--green-soft);  border-color: var(--green); }
.alert--error   { background: var(--red-soft);    border-color: var(--red); }
.alert--info    { background: var(--yellow-soft); border-color: var(--yellow); }

/* ---- Estado vazio ---- */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 48px 24px;
    text-align: center;
    border: 1px dashed var(--line-strong);
    border-radius: var(--r-panel);
}
.empty-state__icon {
    display: grid;
    place-items: center;
    width: 44px; height: 44px;
    margin-bottom: 16px;
    border-radius: 10px;
    background: var(--yellow);
    color: var(--ink);
}
.empty-state h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.empty-state p { max-width: 46ch; margin: 6px 0 20px; color: var(--muted); }
.empty-state p:last-child { margin-bottom: 0; }
.empty-state--compact { padding: 28px 24px; }

/* ============================================================
   Dashboard
   ============================================================ */
.pipe {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1px;
    background: var(--line);
    border: 1px solid var(--line);
    border-radius: var(--r-panel);
    overflow: hidden;
}

.pipe__cell {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px 14px;
    background: var(--paper);
    transition: background var(--t);
}
a.pipe__cell:hover { background: var(--sunk); }
.pipe__cell--wait { background: var(--yellow-soft); }
a.pipe__cell--wait:hover { background: #FFEDA0; }

.pipe__label { font-size: 13px; color: var(--muted); line-height: 1.3; min-height: 2.6em; }
.pipe__cell--wait .pipe__label { color: var(--yellow-text); }

.pipe__count {
    font-family: var(--font-head);
    font-size: 38px;
    font-weight: 700;
    line-height: 1.05;
    letter-spacing: -0.03em;
    font-variant-numeric: tabular-nums;
}
.pipe__cell--done .pipe__count { color: var(--green); }

.pipe__bar { height: 4px; margin-top: 8px; border-radius: 2px; background: var(--line); overflow: hidden; }
.pipe__cell--wait .pipe__bar { background: rgba(122, 90, 0, 0.18); }
.pipe__bar i { display: block; height: 100%; background: var(--ink); }
.pipe__cell--wait .pipe__bar i { background: var(--yellow-text); }
.pipe__cell--done .pipe__bar i { background: var(--green); }

.dash { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 24px; align-items: start; margin-top: 36px; }
.dash .section-head { margin-top: 0; }
.dash__side { display: flex; flex-direction: column; gap: 32px; }

.ledger { overflow: hidden; }
.ledger a {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 20px;
    border-bottom: 1px solid var(--line);
    transition: background var(--t);
}
.ledger a { text-decoration: none; }
.ledger a:last-child { border-bottom: 0; }
.ledger a:hover { background: var(--sunk); }
.ledger__count { font-family: var(--font-head); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }

.feed { list-style: none; }
.feed li {
    display: flex;
    flex-direction: column;
    gap: 6px;
    padding: 13px 20px;
    border-bottom: 1px solid var(--line);
}
.feed li:last-child { border-bottom: 0; }

/* ============================================================
   Página do contrato
   ============================================================ */
.track {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    list-style: none;
    padding: 28px 20px 24px;
}

.track__step { position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 0 6px; }

.track__step::before {
    content: '';
    position: absolute;
    top: 11px;
    right: 50%;
    width: 100%;
    height: 2px;
    background: var(--line);
}
.track__step:first-child::before { display: none; }
.track__step.is-done::before,
.track__step.is-current::before { background: var(--ink); }

.track__dot {
    position: relative;
    z-index: 1;
    display: grid;
    place-items: center;
    width: 24px; height: 24px;
    border-radius: 50%;
    background: var(--paper);
    border: 2px solid var(--line-strong);
    color: #fff;
}
.track__step.is-done .track__dot { background: var(--ink); border-color: var(--ink); }
.track__step.is-current .track__dot {
    background: var(--yellow);
    border-color: var(--ink);
    box-shadow: 0 0 0 5px var(--yellow-soft);
}
.track__step.is-signed .track__dot { background: var(--green); border-color: var(--green); box-shadow: 0 0 0 5px var(--green-soft); color: #fff; }
.track__step.is-signed::before { background: var(--green); }

.track__label { font-size: 13px; line-height: 1.3; color: var(--muted); }
.track__step.is-done .track__label { color: var(--text); }
.track__step.is-current .track__label { color: var(--text); font-weight: 600; }
.track__step.is-signed .track__label { color: var(--green); font-weight: 600; }

.actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 24px 0 32px; }
.actions form { display: contents; }

.inline-form { display: flex; gap: 8px; }
.inline-form .field__select { flex: 1; min-width: 0; }

.note { margin-top: 16px; font-size: 13.5px; color: var(--muted); max-width: 64ch; }

/* ============================================================
   Login
   ============================================================ */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); background: var(--paper); }

.auth__brand {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    gap: 48px;
    padding: 48px;
    background: var(--ink);
    color: #fff;
    overflow: hidden;
}

.auth__headline {
    margin-top: 56px;
    max-width: 14ch;
    font-size: clamp(36px, 4.4vw, 56px);
    font-weight: 700;
    line-height: 1.02;
    letter-spacing: -0.022em;
}
.auth__lead { max-width: 38ch; margin-top: 18px; color: var(--on-ink); font-size: 16px; }

.auth__pulse { width: 100%; height: auto; margin-bottom: -8px; }
.auth__pulse path {
    fill: none;
    stroke: var(--yellow);
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
}

@media (prefers-reduced-motion: no-preference) {
    .auth__pulse path { stroke-dasharray: 1; animation: draw 1.8s var(--ease) 0.2s both; }
    @keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
}

.auth__form { display: grid; place-items: center; padding: 48px 32px; }
.auth__box { width: 100%; max-width: 360px; }
.auth__title { font-size: 28px; font-weight: 700; letter-spacing: -0.025em; }
.auth__sub { margin: 6px 0 28px; color: var(--muted); }

/* ============================================================
   Responsivo
   ============================================================ */
@media (max-width: 1080px) {
    .dash { grid-template-columns: minmax(0, 1fr); }
    .pipe { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* Gaveta de navegação no mobile */
@media (max-width: 860px) {
    :root { --gutter: 16px; }

    .sidebar {
        position: fixed;
        inset: 0 auto 0 0;
        width: min(288px, 86vw);
        transform: translateX(-100%);
        visibility: hidden;
        transition: transform 260ms var(--ease), visibility 0s linear 260ms;
    }
    .sidebar.is-open {
        transform: none;
        visibility: visible;
        transition-delay: 0s;
        box-shadow: 0 0 48px rgba(0, 0, 0, 0.35);
    }

    .sidebar .sidebar__collapse { display: none; }
    .sidebar .sidebar__close { display: inline-grid; }
    .menu-btn { display: inline-grid; }

    .content { padding-top: 24px; padding-bottom: 56px; }
    .page-header h1 { font-size: 26px; }
    .form__body { padding: 20px 20px 0; }
    .form__actions { padding: 14px 20px; }
}

@media (max-width: 720px) {
    .hide-sm { display: none; }
    .grid-2 { grid-template-columns: minmax(0, 1fr); }
    .field-row { grid-template-columns: minmax(0, 1fr); }

    .split-row {
        grid-template-columns: 12px minmax(0, 1fr) 40px;
        padding: 14px 12px;
        border: 1px solid var(--line);
        border-radius: var(--r-control);
        background: var(--sunk);
        align-items: start;
    }
    .split-row > .field:nth-of-type(1) { grid-column: 2; }
    .split-row > .field:nth-of-type(2),
    .split-row > .field:nth-of-type(3) { grid-column: 2 / 4; }
    .split-row > .icon-btn { grid-column: 3; grid-row: 1; align-self: start; }
    .split-row__swatch { height: 20px; margin-top: 30px; grid-row: 1; }

    .facts > div { grid-template-columns: minmax(0, 1fr); gap: 2px; }

    .pipe { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .pipe__label { min-height: 0; }

    .page-header--person { flex-wrap: wrap; }
    .page-header--person .page-header__actions { margin-left: 0; }

    /* Trilha do contrato vira lista vertical */
    .track { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 20px 20px 16px; }
    .track__step { flex-direction: row; align-items: center; gap: 14px; text-align: left; padding: 0 0 18px; }
    .track__step:last-child { padding-bottom: 0; }
    .track__step::before { top: -18px; right: auto; left: 11px; width: 2px; height: 18px; }
    .track__step:first-child::before { display: none; }

    .auth { grid-template-columns: minmax(0, 1fr); }
    .auth__brand { padding: 24px; gap: 20px; }
    .auth__headline, .auth__lead { display: none; }
    .auth__pulse { max-height: 56px; }
    .auth__form { padding: 32px 20px 48px; align-items: start; }
}

@media (max-width: 480px) {
    .actions .btn { flex: 1 1 100%; }
    .inline-form { flex-direction: column; }
    .page-header__actions .btn { flex: 1 1 auto; }
}

/* ============================================================
   Preferências do usuário
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media (prefers-reduced-transparency: reduce) {
    .topbar { background: var(--canvas); -webkit-backdrop-filter: none; backdrop-filter: none; }
}

@media (prefers-contrast: more) {
    :root { --line: #8A8C92; --line-strong: #4A4C52; --muted: #3A3C42; --faint: #4A4C52; }
}

/* Sair é um formulário (POST) para não ser acionável por link externo */
.sidebar__footer form { display: contents; }
