/* Panevio sąskaitos — UI styles. Single file, no build step. */
:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --ink: #16162a;
  --ink-2: #3c3c52;
  --muted: #74748a;
  --line: #e7e8f0;
  --line-2: #d6d8e3;
  --primary: #4f46e5;
  --primary-ink: #ffffff;
  --primary-soft: #eef0ff;
  --green: #0f9f6e;
  --green-soft: #e6f6ef;
  --amber: #b76e00;
  --amber-soft: #fff4e0;
  --red: #d92d3a;
  --red-soft: #fdecee;
  --sidebar: #12121f;
  --sidebar-ink: #c9c9dc;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 16, 40, .04), 0 4px 16px rgba(16, 16, 40, .04);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; font-feature-settings: "tnum" 1, "cv11" 1; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; letter-spacing: -.015em; }
h1 { font-size: 26px; font-weight: 700; line-height: 1.2; }
h2 { font-size: 15.5px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 13px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.i { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex: none; vertical-align: middle; }
.i-xs { width: 12px; height: 12px; stroke-width: 3; }
.i-lg { width: 28px; height: 28px; }
.i-xl { width: 36px; height: 36px; stroke-width: 1.5; color: var(--muted); }

/* --- Layout -------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 248px; background: var(--sidebar); color: var(--sidebar-ink); display: flex; flex-direction: column; padding: 20px 14px; z-index: 40; }
.main { flex: 1; margin-left: 248px; min-width: 0; }
.content { max-width: 1280px; margin: 0 auto; padding: 32px 36px 64px; }

.brand { display: flex; align-items: center; gap: 12px; color: #fff; padding: 4px 8px 22px; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; font-weight: 800; font-size: 18px; color: #fff; background: linear-gradient(135deg, #6366f1, #8b5cf6 60%, #ec4899); box-shadow: 0 6px 18px rgba(99, 102, 241, .35); }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong { font-size: 15px; }
.brand-text small { font-size: 12px; color: #8d8da8; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 9px; color: var(--sidebar-ink); font-weight: 500; }
.nav a:hover { background: rgba(255, 255, 255, .06); color: #fff; text-decoration: none; }
.nav a.active { background: rgba(255, 255, 255, .1); color: #fff; }
.nav a.active .i { color: #a5b4fc; }
.sidebar-cta { margin-top: 18px; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.sidebar-foot .btn-ghost { color: var(--sidebar-ink); }
.sidebar-foot .btn-ghost:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.me { display: flex; align-items: center; gap: 10px; padding: 8px 8px 0; border-top: 1px solid rgba(255, 255, 255, .08); padding-top: 14px; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: #2a2a44; color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.me-email { font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.env-badge { align-self: flex-start; margin-left: 8px; font-size: 11px; font-weight: 700; letter-spacing: .08em; padding: 3px 8px; border-radius: 6px; background: #f59e0b; color: #1a1300; }
.env-local { background: #38bdf8; color: #00131c; }

.topbar-mobile { display: none; }
.backdrop { display: none; }

/* --- Page head ------------------------------------------------------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.subtitle { margin: 6px 0 0; color: var(--muted); }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.head-actions form { margin: 0; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.with-badge { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* --- Buttons ---------------------------------------------------------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; height: 38px; padding: 0 15px; border-radius: var(--radius-sm); border: 1px solid transparent; font: inherit; font-weight: 600; font-size: 14px; cursor: pointer; white-space: nowrap; text-decoration: none !important; transition: background .15s, border-color .15s, box-shadow .15s; }
.btn .i { width: 17px; height: 17px; }
.btn-primary { background: var(--primary); color: var(--primary-ink); box-shadow: 0 1px 2px rgba(79, 70, 229, .3), inset 0 1px 0 rgba(255, 255, 255, .15); }
.btn-primary:hover { background: #4338ca; }
.btn-secondary { background: var(--surface); color: var(--ink); border-color: var(--line-2); box-shadow: 0 1px 2px rgba(16, 16, 40, .05); }
.btn-secondary:hover { background: #f8f8fc; border-color: #c4c6d4; }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: rgba(16, 16, 40, .05); }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 46px; font-size: 15px; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 36px; border-radius: 8px; border: 0; background: transparent; color: var(--muted); cursor: pointer; }
.icon-btn:hover { background: rgba(16, 16, 40, .06); color: var(--ink); }
.chip { border: 1px solid var(--line-2); background: var(--surface); border-radius: 999px; padding: 3px 10px; font: inherit; font-size: 12.5px; cursor: pointer; color: var(--ink-2); }
.chip:hover { border-color: var(--primary); color: var(--primary); }
.link { font-weight: 600; font-size: 13.5px; }
.link-muted { color: var(--muted); }

/* --- Cards ------------------------------------------------------------ */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; min-width: 0; }
.card-pad { padding: 22px 24px; }
.card-pad > h2 { margin-bottom: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 18px 22px 12px; }
.card-head-inline { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-sub { border-top: 1px solid var(--line); padding: 16px 22px 8px; }
.card-sub h3 { margin-bottom: 6px; }
.narrow { max-width: 560px; }
.form-narrow { max-width: 820px; }
.stack { display: flex; flex-direction: column; gap: 16px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 20px; }
.grid-2 > .card { margin-bottom: 0; }
.grid-2 + .grid-2 { margin-top: 20px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 650; color: var(--ink); }
.nowrap { white-space: nowrap; }
.text-red { color: var(--red); }
.text-green { color: var(--green); }
.text-amber { color: var(--amber); }
.note { background: #fafaf5; border: 1px solid #ecebdc; border-radius: 8px; padding: 12px 14px; margin-top: 14px; }
.note p { margin: 4px 0 0; }

/* --- Stats ------------------------------------------------------------ */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 20px; }
.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px 20px; color: var(--ink); display: block; min-width: 0; }
.stat-link:hover { text-decoration: none; border-color: var(--line-2); transform: translateY(-1px); transition: transform .15s; }
.stat-label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 550; font-size: 13px; }
.stat-label .i { width: 16px; height: 16px; }
.stat-value { font-size: 26px; font-weight: 750; letter-spacing: -.02em; margin-top: 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-small { margin-top: 8px; font-size: 13.5px; color: var(--ink-2); }
.stat-foot { color: var(--muted); font-size: 12.5px; margin-top: 4px; }
.stat-accent { background: linear-gradient(140deg, #4f46e5, #7c3aed); border: 0; color: #fff; box-shadow: 0 10px 30px rgba(79, 70, 229, .28); }
.stat-accent .stat-label, .stat-accent .stat-foot { color: rgba(255, 255, 255, .8); }
.stat-danger { border-color: #f6c5ca; background: linear-gradient(180deg, #fff, #fff6f7); }
.stat-danger .stat-value { color: var(--red); }

/* --- Chart ------------------------------------------------------------- */
.chart { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; padding: 6px 22px 20px; height: 250px; }
.bar-col { display: flex; flex-direction: column; align-items: center; min-width: 0; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar { width: 100%; max-width: 34px; min-height: 0; background: #dcdcf6; border-radius: 6px 6px 3px 3px; display: flex; align-items: flex-end; overflow: hidden; }
.bar-paid { width: 100%; background: var(--primary); }
.bar-col.current .bar { box-shadow: 0 0 0 2px #c7c9f9; }
.bar-label { margin-top: 8px; font-size: 11.5px; color: var(--muted); }
.bar-value { font-size: 10.5px; color: var(--ink-2); min-height: 15px; white-space: nowrap; }
.legend { font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.dot { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.dot-paid { background: var(--primary); }
.dot-open { background: #dcdcf6; margin-left: 8px; }

.rank { list-style: none; margin: 0; padding: 0 22px 16px; }
.rank li { display: flex; align-items: baseline; gap: 6px; padding: 9px 0; border-bottom: 1px dashed var(--line); }
.rank li:last-child { border-bottom: 0; }
.rank-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-meta { color: var(--muted); font-size: 12.5px; }
.rank.compact { padding: 0; }
.rank.compact li { padding: 6px 0; }

/* --- Tables ------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fafbfd; white-space: nowrap; }
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table-compact td { padding: 10px 22px; }
.num { text-align: right; white-space: nowrap; }
.row-link { cursor: pointer; }
.row-link:hover td { background: #fafaff; }
.row-muted td { opacity: .55; }
.row-actions { text-align: right; width: 1%; }
.row-actions form { margin: 0; }

/* --- Badges ------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; line-height: 1.6; vertical-align: middle; }
.badge-green { background: var(--green-soft); color: var(--green); }
.badge-amber { background: var(--amber-soft); color: var(--amber); }
.badge-red { background: var(--red); color: #fff; }
.badge-red-soft { background: var(--red-soft); color: var(--red); }
.badge-gray { background: #eeeef4; color: var(--ink-2); }
.badge-indigo { background: var(--primary-soft); color: var(--primary); }
.badge-outline { border: 1px solid var(--line-2); color: var(--muted); }
.src { display: inline-block; font-size: 11px; font-weight: 600; padding: 1px 7px; border-radius: 5px; background: #f1f1f6; color: var(--ink-2); margin-left: 4px; vertical-align: middle; }
.src-memilove { background: #fdeef3; color: #b4285a; }
.src-balsu { background: #e9f3ff; color: #1d5fbf; }

/* --- Tabs & filters ---------------------------------------------------- */
.tabs { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.tab { padding: 9px 14px; color: var(--muted); font-weight: 600; font-size: 13.5px; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tab:hover { color: var(--ink); text-decoration: none; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.filters { display: flex; gap: 10px; align-items: center; padding: 12px; flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .i { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 16px; height: 16px; }
.search input { padding-left: 34px; }
.check { display: inline-flex; align-items: center; gap: 7px; font-size: 13.5px; white-space: nowrap; cursor: pointer; }
.inline-form { margin: 0; }

/* --- Forms ------------------------------------------------------------- */
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], select, textarea {
  width: 100%; min-width: 0; height: 40px; padding: 0 12px; font: inherit; font-size: 14px; color: var(--ink); background: var(--surface); border: 1px solid var(--line-2); border-radius: var(--radius-sm); transition: border-color .15s, box-shadow .15s; appearance: none; -webkit-appearance: none;
}
textarea { height: auto; padding: 10px 12px; resize: vertical; min-height: 64px; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='none' stroke='%2374748a' stroke-width='2' viewBox='0 0 24 24'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px; }
.filters select { width: auto; }
input[type=color] { width: 64px; height: 40px; padding: 3px; border: 1px solid var(--line-2); border-radius: var(--radius-sm); background: var(--surface); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(79, 70, 229, .15); }
input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--primary); }
input[readonly], input:disabled, select:disabled { background: #f6f6fa; color: var(--muted); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field .req { color: var(--red); }
.field .help { color: var(--muted); font-size: 12px; }
.field .error, .error { color: var(--red); font-size: 12.5px; font-weight: 500; }
.field.has-error input, .field.has-error select, .field.has-error textarea { border-color: var(--red); }
.field-check label { display: flex; align-items: center; gap: 9px; font-weight: 500; cursor: pointer; padding-top: 4px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 18px; }
.span-2 { grid-column: span 2; }
.readonly { height: 40px; display: flex; align-items: center; padding: 0 12px; background: #f6f6fa; border-radius: var(--radius-sm); font-weight: 650; }
.actions { display: flex; gap: 10px; justify-content: flex-end; flex-wrap: wrap; }
.sticky-actions { position: sticky; bottom: 0; padding: 14px 0; background: linear-gradient(transparent, var(--bg) 35%); }
.code-input { font-size: 24px !important; letter-spacing: .4em; text-align: center; height: 56px !important; font-weight: 700; }
.logo-preview { max-height: 48px; max-width: 200px; object-fit: contain; align-self: flex-start; border: 1px solid var(--line); border-radius: 6px; padding: 4px; background: #fff; }

.form-layout { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.form-side .sticky { position: sticky; top: 20px; }
.due-shortcuts { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin-top: -6px; }

/* Invoice lines editor */
.lines-table { width: 100%; border-collapse: separate; border-spacing: 0; }
.lines-table th { font-size: 12px; font-weight: 600; color: var(--muted); text-align: left; padding: 0 6px 8px; text-transform: uppercase; letter-spacing: .04em; }
.lines-table td { padding: 5px 6px; vertical-align: top; }
.lines-table .col-desc { min-width: 240px; }
.lines-table .col-qty { width: 92px; }
.lines-table .col-unit { width: 84px; }
.lines-table .col-price { width: 120px; }
.lines-table .col-vat { width: 84px; }
.lines-table .col-amount { width: 112px; font-weight: 650; padding-top: 14px; }
.lines-table .col-del { width: 44px; }
.lines-table .is-hidden { display: none; }
.line-row.is-deleted { display: none; }
.add-line { margin-top: 8px; color: var(--primary); }
.totals { margin-left: auto; margin-top: 18px; max-width: 320px; display: flex; flex-direction: column; gap: 8px; }
.totals > div { display: flex; justify-content: space-between; gap: 12px; }
.totals .grand { border-top: 1px solid var(--line); padding-top: 10px; font-size: 18px; }
.totals .grand strong { color: var(--primary); }

/* --- Detail ------------------------------------------------------------ */
.detail-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.doc-frame { background: #e9ebf2; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); min-height: 400px; }
.doc-frame iframe { display: block; width: 100%; height: 1180px; border: 0; }
.doc-frame .empty { background: transparent; }
.dl { display: grid; grid-template-columns: auto 1fr; gap: 9px 14px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; text-align: right; }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.timeline li { display: flex; flex-direction: column; padding-left: 14px; border-left: 2px solid var(--line); font-size: 13.5px; }

.dropdown { position: relative; }
.dropdown > summary { list-style: none; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-panel { position: absolute; right: 0; top: calc(100% + 6px); z-index: 30; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(16, 16, 40, .14); padding: 14px; min-width: 250px; }
.menu { padding: 6px; display: flex; flex-direction: column; }
.menu a, .menu button { display: flex; align-items: center; gap: 9px; width: 100%; padding: 9px 10px; border: 0; background: none; border-radius: 7px; font: inherit; font-size: 14px; color: var(--ink); cursor: pointer; text-align: left; }
.menu a:hover, .menu button:hover { background: #f4f4f9; text-decoration: none; }
.menu form { margin: 0; }
.menu .danger { color: var(--red); }
.menu-form { border-top: 1px solid var(--line); margin-top: 6px !important; padding: 10px 6px 4px; display: flex; flex-direction: column; gap: 6px; }

/* --- Settings ---------------------------------------------------------- */
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.settings-layout .card { margin-bottom: 0; }
.series-list, .link-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.series-list a { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--line); color: var(--ink); }
.series-list a:hover { border-color: var(--primary); text-decoration: none; }
.series-list .muted { width: 100%; }
.link-list a { display: flex; align-items: center; gap: 10px; padding: 10px 8px; border-radius: 8px; color: var(--ink); }
.link-list a:hover { background: #f4f4f9; text-decoration: none; }
.steps { padding-left: 20px; margin: 0 0 16px; color: var(--ink-2); display: flex; flex-direction: column; gap: 6px; }
.qr { display: grid; place-items: center; padding: 12px; }
.qr svg { width: 200px; height: 200px; }
.secret { display: inline-block; padding: 6px 10px; background: #f4f4f9; border-radius: 6px; font-size: 13px; letter-spacing: .08em; word-break: break-all; }
.success-row { display: flex; gap: 16px; align-items: flex-start; }
.success-row p { margin: 4px 0 0; }

.dropzone { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 34px 20px; border: 2px dashed var(--line-2); border-radius: var(--radius); background: #fbfbfe; cursor: pointer; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.is-over { border-color: var(--primary); background: var(--primary-soft); }
.dropzone input[type=file] { max-width: 100%; font-size: 13px; }

/* --- Feedback ---------------------------------------------------------- */
.alert { padding: 12px 14px; border-radius: 9px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert-error { background: var(--red-soft); color: #8f1520; border-color: #f6c5ca; }
.alert-warning { background: var(--amber-soft); color: #7a4a00; border-color: #f5dcae; }
.alert-success { background: var(--green-soft); color: #0b6b4b; }
.alert-info { background: var(--primary-soft); color: #3730a3; }
.toasts { position: fixed; top: 18px; right: 18px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 36px)); }
.toast { display: flex; align-items: flex-start; gap: 12px; background: var(--ink); color: #fff; padding: 12px 14px 12px 16px; border-radius: 10px; box-shadow: 0 12px 30px rgba(16, 16, 40, .25); font-size: 14px; animation: toast-in .25s ease-out; }
.toast-success { background: #0d7a55; }
.toast-error { background: #b42330; }
.toast-warning { background: #9a5b00; }
.toast-close { margin-left: auto; background: none; border: 0; color: inherit; opacity: .7; font-size: 20px; line-height: 1; cursor: pointer; padding: 0 2px; }
@keyframes toast-in { from { transform: translateY(-8px); opacity: 0; } to { transform: none; opacity: 1; } }
.empty { padding: 48px 20px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 12px; }
.empty p { margin: 0; }
.empty-sm { padding: 6px 22px 22px; color: var(--muted); margin: 0; display: flex; align-items: center; gap: 6px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 14px; border-top: 1px solid var(--line); }

/* --- Auth -------------------------------------------------------------- */
body.auth { background: radial-gradient(1200px 600px at 10% -10%, #e4e2ff 0, transparent 60%), radial-gradient(900px 500px at 110% 110%, #fde4f1 0, transparent 55%), var(--bg); }
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 24px 60px rgba(30, 30, 80, .12); padding: 32px; }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 26px; }
.auth-brand div { display: flex; flex-direction: column; line-height: 1.2; }
.auth-brand small { color: var(--muted); }
.auth-title { font-size: 21px; margin-bottom: 18px; }
.auth-foot { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; margin-top: 18px; }
.auth-foot .i { width: 14px; height: 14px; }

/* --- Responsive -------------------------------------------------------- */
@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-2, .detail-layout, .settings-layout, .form-layout { grid-template-columns: minmax(0, 1fr); }
  .form-side .sticky { position: static; }
  .form-side { order: -1; }
}
@media (max-width: 860px) {
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
  body.nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(10, 10, 25, .45); z-index: 35; }
  .main { margin-left: 0; }
  .topbar-mobile { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
  .content { padding: 20px 16px 48px; }
  h1 { font-size: 22px; }
  .hide-sm { display: none; }
  .stat-value { font-size: 21px; }
  .chart { height: 200px; gap: 4px; padding: 6px 12px 16px; }
  .bar-value { display: none; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .span-2 { grid-column: auto; }
  .card-pad { padding: 18px 16px; }
  .doc-frame iframe { height: 760px; }
  .table td, .table th { padding: 11px 12px; }
  .table-compact td { padding: 10px 14px; }
  /* Line editor becomes stacked cards */
  .lines-table thead { display: none; }
  .lines-table, .lines-table tbody, .lines-table tr, .lines-table td { display: block; width: auto !important; }
  .lines-table tr { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line); }
  .lines-table td { padding: 0; }
  .lines-table td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
  .lines-table .col-desc { grid-column: 1 / -1; min-width: 0; }
  .lines-table .col-amount { padding-top: 10px; }
  .lines-table .col-del { text-align: right; }
  .head-actions { width: 100%; }
}
@media (max-width: 520px) {
  .stats, .stats-3 { grid-template-columns: minmax(0, 1fr); }
  .head-actions .btn { flex: 1; }
}
@media print {
  .sidebar, .topbar-mobile, .head-actions, .toasts { display: none !important; }
  .main { margin: 0; }
}
