@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url("/static/fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: 'Inter'; font-weight: 500; font-display: swap; src: url("/static/fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url("/static/fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url("/static/fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: 'Instrument Serif'; font-weight: 400; font-display: swap; src: url("/static/fonts/instrument-serif-latin-400-normal.woff2") format("woff2"); }

:root {
  --accent: #4F46E5;
  --accent-soft: color-mix(in srgb, var(--accent) 9%, white);
  --accent-mid: color-mix(in srgb, var(--accent) 22%, white);
  --accent-dark: color-mix(in srgb, var(--accent) 82%, black);
  --bg: #F5F6FA;
  --surface: #FFFFFF;
  --ink: #0F172A;
  --ink-2: #334155;
  --muted: #64748B;
  --faint: #94A3B8;
  --line: #E6E8EF;
  --line-2: #EEF0F5;
  --green: #059669; --green-bg: #ECFDF5;
  --amber: #B45309; --amber-bg: #FFFBEB;
  --red: #DC2626; --red-bg: #FEF2F2;
  --blue: #2563EB; --blue-bg: #EFF6FF;
  --gray-bg: #F1F5F9;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 4px 16px rgba(15, 23, 42, .04);
  --shadow-lg: 0 24px 60px rgba(15, 23, 42, .22);
  --sidebar: 244px;
  --font: 'Inter', -apple-system, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --serif: 'Instrument Serif', Georgia, serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 14px/1.5 var(--font); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
h1, h2, h3, p { margin: 0; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.mono { font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.grow { flex: 1; }
.row { display: flex; align-items: center; gap: 10px; }
.row.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 14px; }
.sp { height: 14px; }
.ic { display: inline-flex; vertical-align: middle; flex: none; }
.ic svg { display: block; }

/* ------------------------------------------------------------ layout */
.app { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 22px 14px 16px; z-index: 20; }
.brand { display: flex; align-items: center; gap: 11px; padding: 2px 8px 22px; }
.brand img { height: 34px; width: auto; max-width: 46px; object-fit: contain; }
.brand .mark { width: 34px; height: 34px; border-radius: 10px; background: var(--accent); color: #fff; display: grid; place-items: center; font: 400 19px var(--serif); }
.brand b { display: block; font-size: 14.5px; letter-spacing: -.01em; line-height: 1.15; }
.brand small { color: var(--muted); font-size: 11.5px; }
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 11px; border-radius: 10px; color: var(--ink-2); font-weight: 500; transition: background .12s, color .12s; }
.nav a:hover { background: var(--gray-bg); }
.nav a.active { background: var(--accent-soft); color: var(--accent-dark); }
.nav a .ic { color: var(--faint); }
.nav a.active .ic { color: var(--accent); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.side-new { width: 100%; justify-content: center; }
.user { display: flex; align-items: center; gap: 10px; padding: 10px 8px 0; border-top: 1px solid var(--line-2); }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: grid; place-items: center; font-weight: 700; font-size: 12.5px; flex: none; }
.user .nm { font-weight: 600; font-size: 13px; line-height: 1.2; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user .nm small { display: block; font-weight: 400; color: var(--muted); font-size: 11.5px; }
.main { margin-left: var(--sidebar); flex: 1; min-width: 0; }
#view { max-width: 1160px; margin: 0 auto; padding: 34px 36px 80px; animation: fade .22s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }

.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font: 400 34px/1.05 var(--serif); letter-spacing: -.01em; }
.page-head .sub { color: var(--muted); margin-top: 6px; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-weight: 500; margin-bottom: 12px; }
.back:hover { color: var(--ink); }

.tabbar { display: none; }

/* ------------------------------------------------------------ boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 38px; padding: 0 15px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; font-size: 13.5px; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s, box-shadow .12s; }
.btn:hover { background: var(--gray-bg); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: 0 1px 2px rgba(15, 23, 42, .12), inset 0 1px 0 rgba(255, 255, 255, .14); }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: var(--red-bg); border-color: #FECACA; }
.btn.solid-danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.solid-danger:hover { background: #B91C1C; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--gray-bg); }
.btn.sm { height: 32px; padding: 0 11px; font-size: 13px; border-radius: 9px; }
.btn.icon-only { width: 34px; padding: 0; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn .spin { width: 14px; height: 14px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: rot .7s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ cartes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 20px 22px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 22px 0; }
.card-head h2 { font-size: 14.5px; font-weight: 650; letter-spacing: -.005em; }
.card-head .hint { color: var(--muted); font-size: 12.5px; }
.card-body { padding: 16px 22px 20px; }
.label-s { font-size: 11px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }

.grid { display: grid; gap: 16px; }
.kpis { grid-template-columns: repeat(4, 1fr); margin-bottom: 16px; }
.kpi { padding: 18px 20px; }
.kpi .k { display: flex; align-items: center; justify-content: space-between; color: var(--muted); font-weight: 500; font-size: 13px; }
.kpi .v { font-size: 27px; font-weight: 700; letter-spacing: -.02em; margin-top: 10px; font-variant-numeric: tabular-nums; }
.kpi .s { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.kpi .dot { width: 30px; height: 30px; border-radius: 9px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); }
.kpi.warn .dot { background: var(--red-bg); color: var(--red); }
.kpi.warn .v { color: var(--red); }
.kpi.ok .dot { background: var(--green-bg); color: var(--green); }
.kpi.amber .dot { background: var(--amber-bg); color: var(--amber); }
.bar { height: 7px; border-radius: 99px; background: var(--gray-bg); overflow: hidden; margin-top: 10px; }
.bar i { display: block; height: 100%; border-radius: 99px; background: var(--accent); transition: width .5s ease; }
.bar i.hot { background: var(--amber); }
.bar i.max { background: var(--red); }
.cols-2 { grid-template-columns: 1.65fr 1fr; align-items: start; }

/* ------------------------------------------------------------ graphique */
.chart { width: 100%; height: auto; display: block; }
.chart text { font: 500 11px var(--font); fill: var(--faint); }
.legend { display: flex; gap: 16px; color: var(--muted); font-size: 12.5px; }
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

/* ------------------------------------------------------------ listes / tableaux */
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 22px; border-top: 1px solid var(--line-2); cursor: pointer; transition: background .1s; }
.list-row:first-child { border-top: 0; }
.list-row:hover { background: #FAFBFD; }
.list-row .t { font-weight: 600; }
.list-row .s { color: var(--muted); font-size: 12.5px; }
.list-head { padding-bottom: 6px; }

.table-wrap { overflow: hidden; }
table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; padding: 12px 16px; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); font-weight: 650; border-bottom: 1px solid var(--line); background: #FBFBFD; white-space: nowrap; }
.tbl td { padding: 14px 16px; border-top: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr:first-child td { border-top: 0; }
.tbl tbody tr { cursor: pointer; transition: background .1s; }
.tbl tbody tr:hover { background: #FAFBFD; }
.tbl .num { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl .r { text-align: right; }
.tbl .sub { color: var(--muted); font-size: 12.5px; max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tbl .neg { color: var(--red); }

.pill { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 99px; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--gray-bg); color: var(--ink-2); }
.pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber); }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.blue { background: var(--blue-bg); color: var(--blue); }
.pill.gray { background: var(--gray-bg); color: var(--muted); }

.tabs { display: flex; gap: 4px; padding: 4px; background: var(--gray-bg); border-radius: 12px; overflow-x: auto; max-width: 100%; }
.tabs button { border: 0; background: transparent; padding: 7px 13px; border-radius: 9px; font-weight: 600; color: var(--muted); white-space: nowrap; font-size: 13px; }
.tabs button:hover { color: var(--ink); }
.tabs button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(15, 23, 42, .1); }
.tabs button em { font-style: normal; font-weight: 600; color: var(--faint); margin-left: 5px; font-size: 12px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.search { position: relative; }
.search .ic { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--faint); }
.search input { padding-left: 36px; width: 260px; }

.empty { text-align: center; padding: 56px 24px; }
.empty .big { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; margin: 0 auto 16px; background: var(--accent-soft); color: var(--accent); }
.empty h3 { font-size: 16px; margin-bottom: 4px; }
.empty p { color: var(--muted); max-width: 380px; margin: 0 auto 18px; }

/* ------------------------------------------------------------ formulaires */
label.f { display: block; }
label.f > span.l { display: block; font-size: 12.5px; font-weight: 600; color: var(--ink-2); margin-bottom: 6px; }
label.f > span.l em { font-style: normal; font-weight: 400; color: var(--faint); }
.inp, select.inp, textarea.inp { width: 100%; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 10px; background: #fff; font: inherit; color: var(--ink); transition: border-color .12s, box-shadow .12s; appearance: none; -webkit-appearance: none; }
select.inp { padding-right: 34px; background: #fff 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='%2394A3B8' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E") no-repeat right 11px center; }
textarea.inp { height: auto; min-height: 84px; padding: 10px 12px; resize: vertical; line-height: 1.5; }
.inp:hover { border-color: #D3D8E2; }
.inp:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--accent) 16%, transparent); }
.inp[readonly] { background: var(--gray-bg); }
.hint { color: var(--muted); font-size: 12.5px; margin-top: 6px; }
.fgrid { display: grid; grid-template-columns: repeat(12, 1fr); gap: 14px 16px; }
.c12 { grid-column: span 12; } .c8 { grid-column: span 8; } .c6 { grid-column: span 6; } .c4 { grid-column: span 4; } .c3 { grid-column: span 3; } .c2 { grid-column: span 2; }
.switch { display: flex; align-items: flex-start; gap: 12px; cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch .tr { position: relative; flex: none; width: 40px; height: 24px; border-radius: 99px; background: #CBD5E1; transition: background .15s; margin-top: 1px; }
.switch .tr::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, .25); transition: transform .15s; }
.switch input:checked + .tr { background: var(--accent); }
.switch input:checked + .tr::after { transform: translateX(16px); }
.switch input:focus-visible + .tr { outline: 2px solid var(--accent); outline-offset: 2px; }
.switch b { display: block; font-weight: 600; }
.switch small { display: block; color: var(--muted); font-size: 12.5px; }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 9px; border-radius: 8px; background: var(--gray-bg); border: 1px solid var(--line); font: 500 12px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--ink-2); cursor: pointer; }
.chip:hover { background: var(--accent-soft); border-color: var(--accent-mid); color: var(--accent-dark); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.swatch.on { box-shadow: 0 0 0 2px var(--ink); }
input[type=color].inp { width: 56px; padding: 3px; }
.notice { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: 12px; background: var(--amber-bg); color: #78350F; border: 1px solid #FDE68A; }
.notice.info { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent-mid); }
.notice.err { background: var(--red-bg); color: #991B1B; border-color: #FECACA; }
.notice .ic { margin-top: 1px; }
.notice ul { margin: 6px 0 0; padding-left: 18px; }
.notice a { text-decoration: underline; font-weight: 600; }
.savebar { position: sticky; bottom: 16px; z-index: 5; display: flex; justify-content: flex-end; gap: 10px; align-items: center; margin-top: 18px; padding: 12px 14px; border-radius: 14px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(10px); border: 1px solid var(--line); box-shadow: var(--shadow-lg); }

/* ------------------------------------------------------------ éditeur de facture */
.editor { display: grid; grid-template-columns: 1fr 340px; gap: 16px; align-items: start; }
.lines { display: flex; flex-direction: column; gap: 10px; }
.line { display: grid; grid-template-columns: 1fr 78px 78px 110px 30px; gap: 10px; align-items: start; padding: 14px; border: 1px solid var(--line); border-radius: 12px; background: #FCFCFE; }
.line.vat { grid-template-columns: 1fr 78px 78px 110px 78px 30px; }
.line .tot { text-align: right; font-weight: 700; padding-top: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.line .del { margin-top: 5px; }
.line .col-l { font-size: 11px; color: var(--muted); font-weight: 600; margin-bottom: 4px; display: none; }
.line textarea.inp { min-height: 66px; }
.summary-card { position: sticky; top: 20px; }
.sum-row { display: flex; justify-content: space-between; padding: 8px 0; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.sum-row.grand { margin-top: 8px; padding: 14px 16px; background: var(--accent); color: #fff; border-radius: 12px; font-weight: 700; font-size: 17px; }

/* ------------------------------------------------------------ détail facture */
.detail { display: grid; grid-template-columns: 1fr 360px; gap: 16px; align-items: start; }
.preview { overflow: hidden; background: #E9EBF2; }
.preview iframe { display: block; width: 100%; height: 78vh; min-height: 620px; border: 0; background: #E9EBF2; }
.amount-big { font-size: 32px; font-weight: 700; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 9px 12px; font-size: 13.5px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 500; word-break: break-word; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 14px 22px; font-size: 13px; }
.timeline li::before { content: ""; position: absolute; left: 3px; top: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.timeline li::after { content: ""; position: absolute; left: 6.5px; top: 16px; bottom: -2px; width: 1px; background: var(--line); }
.timeline li:last-child { padding-bottom: 0; }
.timeline li:last-child::after { display: none; }
.timeline small { display: block; color: var(--muted); }
.actions { display: flex; flex-direction: column; gap: 8px; }

/* ------------------------------------------------------------ menu déroulant */
.menu-wrap { position: relative; display: inline-flex; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 224px; background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; animation: fade .12s ease; }
.menu.up { top: auto; bottom: calc(100% + 6px); }
.menu.left { right: auto; left: 0; }
.menu a, .menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: 0; background: transparent; border-radius: 8px; text-align: left; font-weight: 500; font-size: 13.5px; }
.menu a:hover, .menu button:hover { background: var(--gray-bg); }
.menu .danger { color: var(--red); }
.menu .ic { color: var(--faint); }
.menu .danger .ic { color: var(--red); }
.menu hr { border: 0; border-top: 1px solid var(--line-2); margin: 5px 0; }
.menu small { margin-left: auto; color: var(--faint); }

/* ------------------------------------------------------------ modales & toasts */
.overlay { position: fixed; inset: 0; z-index: 100; background: rgba(15, 23, 42, .45); backdrop-filter: blur(3px); display: grid; place-items: center; padding: 20px; animation: fadeIn .15s ease; overflow-y: auto; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal { width: 100%; max-width: 520px; background: #fff; border-radius: 18px; box-shadow: var(--shadow-lg); animation: pop .18s ease; margin: auto; }
.modal.lg { max-width: 680px; }
.modal.sm { max-width: 420px; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 20px 24px 0; }
.modal-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -.01em; }
.modal-body { padding: 16px 24px 6px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 18px 24px 22px; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 200; display: flex; flex-direction: column; gap: 10px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: flex-start; gap: 10px; max-width: 380px; padding: 12px 16px; border-radius: 12px; background: var(--ink); color: #fff; box-shadow: var(--shadow-lg); animation: pop .2s ease; font-weight: 500; }
.toast.ok .ic { color: #34D399; }
.toast.err { background: #7F1D1D; }
.toast.err .ic { color: #FCA5A5; }
.skeleton { background: linear-gradient(90deg, #EEF0F5 25%, #F7F8FB 50%, #EEF0F5 75%); background-size: 200% 100%; animation: shimmer 1.2s infinite; border-radius: 10px; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ------------------------------------------------------------ connexion */
.login-body { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(1200px 600px at 50% -10%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 70%), var(--bg); }
.login-card { width: 100%; max-width: 400px; background: #fff; border: 1px solid var(--line); border-radius: 22px; padding: 34px 32px 30px; box-shadow: var(--shadow-lg); animation: pop .3s ease; }
.login-card .logo { display: flex; justify-content: center; margin-bottom: 22px; min-height: 46px; }
.login-card .logo img { max-height: 54px; max-width: 200px; object-fit: contain; }
.login-card h1 { font: 400 30px/1.1 var(--serif); text-align: center; letter-spacing: -.01em; }
.login-card .sub { text-align: center; color: var(--muted); margin: 8px 0 24px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.pw { position: relative; }
.pw button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: transparent; width: 32px; height: 32px; border-radius: 8px; color: var(--muted); display: grid; place-items: center; }
.pw button:hover { background: var(--gray-bg); }
.pw .inp { padding-right: 42px; }
.code-inp { text-align: center; letter-spacing: .5em; font-size: 18px; font-weight: 600; padding-left: 12px; }
.err-box { padding: 10px 12px; border-radius: 10px; background: var(--red-bg); color: #991B1B; font-size: 13px; font-weight: 500; }
.login-foot { text-align: center; margin-top: 20px; color: var(--faint); font-size: 12px; display: flex; gap: 6px; justify-content: center; align-items: center; }

/* ------------------------------------------------------------ responsive */
@media (max-width: 1100px) {
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .cols-2, .editor, .detail { grid-template-columns: 1fr; }
  .summary-card { position: static; }
}
@media (max-width: 860px) {
  .sidebar { display: none; }
  .main { margin-left: 0; }
  #view { padding: 22px 16px 104px; }
  .page-head h1 { font-size: 29px; }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(255, 255, 255, .94); backdrop-filter: blur(14px); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 6px 0; font-size: 11px; font-weight: 600; color: var(--muted); border-radius: 10px; }
  .tabbar a.active { color: var(--accent); }
  .tabbar a.fab span.ic { width: 42px; height: 42px; margin-top: -20px; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 45%, transparent); }
  .kpis { gap: 10px; }
  .kpi { padding: 14px; }
  .kpi .v { font-size: 21px; }
  .search input { width: 100%; }
  .search { flex: 1; min-width: 180px; }
  .fgrid > * { grid-column: span 12 !important; }
  .fgrid > .half { grid-column: span 6 !important; }
  .line, .line.vat { grid-template-columns: 1fr 1fr; }
  .line > :first-child { grid-column: 1 / -1; }
  .line .col-l { display: block; }
  .line .tot { padding-top: 0; text-align: left; grid-column: 1 / 2; }
  .line .del { grid-column: 2; justify-self: end; margin: 0; }
  .preview iframe { height: 60vh; min-height: 420px; }
  .tbl thead { display: none; }
  .tbl, .tbl tbody, .tbl tr, .tbl td { display: block; width: 100%; }
  .tbl tr { padding: 14px 16px; border-top: 1px solid var(--line-2); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; }
  .tbl tr:first-child { border-top: 0; }
  .tbl td { padding: 0; border: 0 !important; }
  .tbl td.hide-m { display: none; }
  .tbl td.r { text-align: right; }
  .modal-foot { flex-wrap: wrap; }
  .toasts { left: 16px; right: 16px; bottom: 84px; align-items: stretch; }
  .toast { max-width: none; }
}
@media print { .sidebar, .tabbar, .toasts { display: none; } .main { margin: 0; } }
