/* ==========================================================================
   Área privada · Peñarroya Abogados
   ========================================================================== */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 100 900; font-display: swap; src: url("fonts/inter.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("fonts/newsreader.woff2") format("woff2"); }
@font-face { font-family: "Newsreader"; font-style: italic; font-weight: 200 800; font-display: swap; src: url("fonts/newsreader-italic.woff2") format("woff2"); }

:root {
	--bg: #F5F3EE;
	--surface: #FFFFFF;
	--surface-2: #FAF8F4;
	--ink: #1B2326;
	--ink-2: #475255;
	--muted: #7B8487;
	--line: #E4DFD5;
	--line-2: #EEEAE3;
	--brand: #264650;
	--brand-2: #1F3B44;
	--brand-ink: #17292F;
	--brand-soft: #E6EEEF;
	--gold: #B5853F;
	--gold-2: #D4B07A;
	--gold-soft: #F5EDE0;
	--danger: #B0402D;
	--danger-soft: #F8E7E2;
	--warn: #A86D12;
	--warn-soft: #FBF0DA;
	--ok: #2D7550;
	--ok-soft: #E3F1E8;
	--info: #2C6584;
	--info-soft: #E2EEF5;
	--radius: 10px;
	--radius-sm: 7px;
	--shadow: 0 1px 2px rgba(23,41,47,.05), 0 8px 24px -12px rgba(23,41,47,.18);
	--shadow-lg: 0 24px 60px -24px rgba(23,41,47,.35);
	--f-ui: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
	--f-display: "Newsreader", "Iowan Old Style", Georgia, serif;
	--sidebar: 252px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
	margin: 0; background: var(--bg); color: var(--ink);
	font-family: var(--f-ui); font-size: 14.5px; line-height: 1.55;
	font-feature-settings: "cv11", "ss01"; -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--gold); }
img, svg { display: block; }
h1, h2, h3, h4 { margin: 0; color: var(--ink); line-height: 1.2; }
h1 { font-family: var(--f-display); font-weight: 500; font-size: 30px; letter-spacing: -.01em; }
h2 { font-family: var(--f-display); font-weight: 500; font-size: 21px; }
h3 { font-size: 13px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-2); }
p { margin: 0 0 .8em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
small, .small { font-size: 12.5px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }

/* ---------- Estructura ---------- */
.app { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; background: linear-gradient(to right, var(--brand-ink) var(--sidebar), transparent var(--sidebar)); }
.sidebar {
	position: sticky; top: 0; height: 100vh; overflow-y: auto;
	background: var(--brand-ink); color: #C9D5D7;
	display: flex; flex-direction: column; padding: 22px 14px 18px;
	background-image: radial-gradient(120% 60% at 0% 0%, rgba(181,133,63,.16), transparent 60%);
}
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 22px; color: #fff; }
.brand__mark { width: 44px; height: 44px; border-radius: 12px; background: #FBF7F0; display: grid; place-items: center; box-shadow: inset 0 0 0 1px rgba(181,133,63,.35); }
.brand__mark img { width: 32px; height: auto; }
.brand__name { font-family: var(--f-display); font-size: 17px; line-height: 1.15; color: #fff; }
.brand__name small { display: block; font-family: var(--f-ui); font-size: 10.5px; letter-spacing: .22em; text-transform: uppercase; color: var(--gold-2); margin-top: 3px; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav__label { font-size: 10.5px; letter-spacing: .2em; text-transform: uppercase; color: rgba(201,213,215,.5); padding: 16px 12px 6px; }
.nav a {
	display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px;
	color: #C9D5D7; font-weight: 500; font-size: 14px; transition: background .15s, color .15s;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.is-active { background: rgba(255,255,255,.1); color: #fff; box-shadow: inset 2px 0 0 var(--gold-2); }
.nav a .badge { margin-left: auto; }
.sidebar__foot { margin-top: auto; padding: 14px 8px 0; border-top: 1px solid rgba(255,255,255,.08); display: flex; align-items: center; gap: 10px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--gold); color: #fff; display: grid; place-items: center; font-weight: 600; font-size: 13px; flex: none; }
.sidebar__user { font-size: 13px; line-height: 1.3; color: #fff; min-width: 0; }
.sidebar__user small { display: block; color: rgba(201,213,215,.65); font-size: 11.5px; }
.sidebar__foot form { margin-left: auto; }
.icon-btn { background: none; border: 0; color: inherit; padding: 7px; border-radius: 8px; cursor: pointer; display: inline-grid; place-items: center; }
.icon-btn:hover { background: rgba(255,255,255,.08); color: #fff; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
	position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
	padding: 12px 32px; background: rgba(245,243,238,.88); backdrop-filter: blur(10px);
	border-bottom: 1px solid var(--line-2);
}
.search { flex: 1; max-width: 520px; position: relative; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.search input[type=search] { width: 100%; padding: 9px 12px 9px 38px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font: inherit; color: var(--ink); }
.search input[type=search]:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(38,70,80,.12); }
.topbar__spacer { flex: 1; }
.menu-toggle { display: none; }

.content { padding: 28px 32px 64px; max-width: 1320px; width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head__title { min-width: 0; }
.page-head .eyebrow { margin-bottom: 6px; }
.page-head__actions { display: flex; gap: 8px; flex-wrap: wrap; }
.eyebrow { font-size: 11px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); font-weight: 600; }
.crumbs { font-size: 12.5px; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }
.crumbs a:hover { color: var(--brand); }

/* ---------- Botones ---------- */
.btn {
	display: inline-flex; align-items: center; gap: 8px; justify-content: center;
	padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface);
	color: var(--ink); font: 500 13.5px/1.2 var(--f-ui); cursor: pointer; white-space: nowrap;
	transition: background .15s, border-color .15s, color .15s, box-shadow .15s;
}
.btn:hover { border-color: #CFC8BB; color: var(--ink); background: var(--surface-2); }
.btn--primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn--primary:hover { background: var(--brand-2); border-color: var(--brand-2); color: #fff; }
.btn--gold { background: var(--gold); border-color: var(--gold); color: #fff; }
.btn--gold:hover { background: #9E7234; border-color: #9E7234; color: #fff; }
.btn--danger { color: var(--danger); }
.btn--danger:hover { background: var(--danger-soft); border-color: #E9C2B8; color: var(--danger); }
.btn--ghost { background: transparent; border-color: transparent; }
.btn--ghost:hover { background: rgba(23,41,47,.05); border-color: transparent; }
.btn--sm { padding: 5px 10px; font-size: 12.5px; border-radius: 7px; }
.btn--block { width: 100%; }
.btn[disabled] { opacity: .5; pointer-events: none; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand); font: inherit; cursor: pointer; }
.link-btn:hover { color: var(--gold); }
.link-btn--danger { color: var(--danger); }
.inline { display: inline; }

/* ---------- Tarjetas ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card + .card { margin-top: 18px; }
.grid > .card + .card, .split > .card + .card, .split > * + .card { margin-top: 0; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--line-2); }
.card__head h2 { font-size: 18px; }
.card__body { padding: 18px 20px; }
.card__body--flush { padding: 0; }
.card__foot { padding: 12px 20px; border-top: 1px solid var(--line-2); background: var(--surface-2); border-radius: 0 0 var(--radius) var(--radius); }

.grid { display: grid; gap: 18px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.stack > * + * { margin-top: 18px; }

/* KPI */
.kpi { padding: 18px 20px; position: relative; overflow: hidden; }
.kpi__label { font-size: 12px; color: var(--muted); font-weight: 500; display: flex; align-items: center; gap: 8px; }
.kpi__value { font-family: var(--f-display); font-size: 32px; font-weight: 500; margin-top: 6px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi__sub { font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.kpi--alert .kpi__value { color: var(--danger); }
.kpi::after { content: ""; position: absolute; right: -30px; top: -30px; width: 90px; height: 90px; border-radius: 50%; background: var(--gold-soft); opacity: .7; }

/* ---------- Tablas ---------- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); padding: 10px 16px; border-bottom: 1px solid var(--line); background: var(--surface-2); white-space: nowrap; }
.table td { padding: 12px 16px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr { transition: background .1s; }
.table tbody tr:hover { background: #FBFAF6; }
.table .row-link { color: var(--ink); font-weight: 500; }
.table .row-link:hover { color: var(--brand); }
.table .sub { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.table tfoot td { font-weight: 600; background: var(--surface-2); border-top: 1px solid var(--line); }
.empty { padding: 42px 20px; text-align: center; color: var(--muted); }
.empty .icon { width: 34px; height: 34px; margin: 0 auto 10px; color: var(--gold-2); stroke-width: 1.4; }
.empty strong { display: block; color: var(--ink); font-weight: 600; margin-bottom: 4px; }

/* ---------- Etiquetas ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--line-2); color: var(--ink-2); white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge--plain::before { display: none; }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--warn { background: var(--warn-soft); color: var(--warn); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--brand { background: var(--brand-soft); color: var(--brand); }
.badge--gold { background: var(--gold-soft); color: #8C6427; }
.nav .badge { background: var(--gold); color: #fff; padding: 1px 7px; }
.nav .badge::before { display: none; }

/* ---------- Formularios ---------- */
.form-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px 16px; }
.field { grid-column: span 12; display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.span-2 { grid-column: span 2; } .span-3 { grid-column: span 3; } .span-4 { grid-column: span 4; } .span-5 { grid-column: span 5; } .span-6 { grid-column: span 6; } .span-7 { grid-column: span 7; } .span-8 { grid-column: span 8; } .span-9 { grid-column: span 9; }
label, .label { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.hint { font-size: 12px; color: var(--muted); font-weight: 400; }
input:not([type]), input[type=text], input[type=email], input[type=password], input[type=tel], input[type=date], input[type=time], input[type=number], input[type=search], input[type=url], select, textarea {
	width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: var(--radius-sm);
	background: #fff; font: inherit; color: var(--ink); transition: border-color .15s, box-shadow .15s;
}
textarea { min-height: 90px; resize: vertical; line-height: 1.5; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237B8487' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 11px center; padding-right: 32px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(38,70,80,.12); }
input.is-invalid { border-color: var(--danger); }
.check { display: flex; align-items: flex-start; gap: 9px; font-weight: 500; font-size: 13.5px; color: var(--ink); cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--brand); width: 16px; height: 16px; }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; align-items: center; padding-top: 6px; }
.fieldset { border: 0; padding: 0; margin: 0 0 22px; }
.fieldset legend { font-family: var(--f-display); font-size: 18px; font-weight: 500; margin-bottom: 12px; padding: 0; }
.input-money { position: relative; }
.input-money input { padding-right: 28px; text-align: right; font-variant-numeric: tabular-nums; }
.input-money::after { content: "€"; position: absolute; right: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); font-size: 13px; }
.filters { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; padding: 14px 16px; border-bottom: 1px solid var(--line-2); }
.filters input, .filters select { width: auto; min-width: 160px; padding: 7px 10px; }
.filters input[type=search] { min-width: 240px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; overflow-x: auto; }
.tabs a { padding: 10px 14px; color: var(--muted); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; display: inline-flex; gap: 7px; align-items: center; }
.tabs a:hover { color: var(--ink); }
.tabs a.is-active { color: var(--brand); border-color: var(--gold); }
.tabs .count { font-size: 11px; background: var(--line-2); padding: 1px 7px; border-radius: 999px; color: var(--ink-2); }

/* ---------- Avisos ---------- */
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); border: 1px solid; margin-bottom: 16px; font-size: 13.5px; }
.alert .icon { margin-top: 1px; }
.alert--ok { background: var(--ok-soft); border-color: #BFDDCB; color: #1F5A3D; }
.alert--error { background: var(--danger-soft); border-color: #EBC4BA; color: #8A2F20; }
.alert--info { background: var(--info-soft); border-color: #C1D9E7; color: #234F68; }
.alert--warn { background: var(--warn-soft); border-color: #EBD5A8; color: #7A5010; }
.alert p:last-child { margin: 0; }
.toasts { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toasts .alert { box-shadow: var(--shadow-lg); margin: 0; animation: toast-in .25s ease; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Definiciones ---------- */
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 9px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.dl--wide { grid-template-columns: 190px 1fr; }

/* ---------- Ficha de expediente ---------- */
.case-hero { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; box-shadow: var(--shadow); margin-bottom: 18px; position: relative; overflow: hidden; }
.case-hero::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: linear-gradient(var(--gold), var(--gold-2)); }
.case-hero__top { display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; align-items: flex-start; }
.case-hero__num { font-family: ui-monospace, Menlo, monospace; font-size: 12.5px; color: var(--gold); letter-spacing: .06em; }
.case-hero h1 { font-size: 27px; margin: 4px 0 6px; }
.case-meta { display: flex; flex-wrap: wrap; gap: 6px 22px; margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--line); }
.case-meta div { font-size: 13px; }
.case-meta span { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .1em; font-weight: 600; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 18px 28px; }
.timeline li::before { content: ""; position: absolute; left: 7px; top: 8px; bottom: -4px; width: 1px; background: var(--line); }
.timeline li:last-child::before { display: none; }
.timeline li::after { content: ""; position: absolute; left: 2px; top: 5px; width: 11px; height: 11px; border-radius: 50%; background: #fff; border: 2px solid var(--gold-2); }
.timeline .t-head { display: flex; gap: 8px; align-items: center; font-size: 12.5px; color: var(--muted); }
.timeline .t-body { white-space: pre-line; margin-top: 3px; }

.doc { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-bottom: 1px solid var(--line-2); }
.doc:last-child { border-bottom: 0; }
.doc__icon { width: 36px; height: 36px; border-radius: 8px; background: var(--brand-soft); color: var(--brand); display: grid; place-items: center; flex: none; font-size: 10px; font-weight: 700; letter-spacing: .04em; }
.doc__main { min-width: 0; flex: 1; }
.doc__name { font-weight: 500; color: var(--ink); overflow-wrap: anywhere; }
.doc__meta { font-size: 12px; color: var(--muted); }
.folder-title { padding: 10px 16px; font-size: 11.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--gold); font-weight: 600; background: var(--surface-2); border-bottom: 1px solid var(--line-2); }

.dropzone { border: 1.5px dashed #CFC6B6; border-radius: var(--radius); padding: 18px; text-align: center; background: var(--surface-2); color: var(--muted); transition: background .15s, border-color .15s; }
.dropzone.is-over { background: var(--gold-soft); border-color: var(--gold); }

/* ---------- Plazos ---------- */
.due { display: flex; gap: 14px; align-items: center; padding: 12px 18px; border-bottom: 1px solid var(--line-2); }
.due:last-child { border-bottom: 0; }
.due__date { width: 52px; flex: none; text-align: center; border-radius: 9px; border: 1px solid var(--line); overflow: hidden; background: #fff; }
.due__date b { display: block; font-family: var(--f-display); font-size: 21px; font-weight: 500; line-height: 1.15; padding: 3px 0 1px; }
.due__date span { display: block; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; background: var(--surface-2); border-top: 1px solid var(--line-2); padding: 2px 0; color: var(--muted); }
.due--today .due__date { border-color: var(--danger); }
.due--today .due__date span { background: var(--danger); color: #fff; border-color: var(--danger); }
.due--soon .due__date span { background: var(--warn-soft); color: var(--warn); }
.due--late .due__date { border-color: var(--danger); background: var(--danger-soft); }
.due__main { flex: 1; min-width: 0; }
.due__title { font-weight: 500; }
.due__sub { font-size: 12.5px; color: var(--muted); }
.due.is-done .due__title { text-decoration: line-through; color: var(--muted); }

.cal { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.cal th { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; padding: 8px; text-align: left; border-bottom: 1px solid var(--line); }
.cal td { height: 118px; vertical-align: top; border-right: 1px solid var(--line-2); border-bottom: 1px solid var(--line-2); padding: 6px; }
.cal td:last-child { border-right: 0; }
.cal .d { font-size: 12.5px; color: var(--ink-2); font-weight: 600; display: inline-grid; place-items: center; min-width: 24px; height: 24px; border-radius: 50%; }
.cal .is-other { background: var(--surface-2); }
.cal .is-other .d { color: #B9BDBE; }
.cal .is-today .d { background: var(--brand); color: #fff; }
.cal .is-inhabil { background: repeating-linear-gradient(-45deg, #FBF9F5, #FBF9F5 6px, #F6F2EA 6px, #F6F2EA 12px); }
.cal .fest { display: block; font-size: 10.5px; color: var(--gold); margin: 2px 0; line-height: 1.2; }
.cal .ev { display: block; font-size: 11.5px; padding: 3px 6px; border-radius: 5px; margin-top: 3px; background: var(--brand-soft); color: var(--brand); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid var(--brand); }
.cal .ev--plazo { background: var(--danger-soft); color: #8A2F20; border-color: var(--danger); }
.cal .ev--senalamiento { background: var(--gold-soft); color: #7C5822; border-color: var(--gold); }
.cal .ev.is-done { opacity: .5; text-decoration: line-through; }
.legend { display: flex; gap: 16px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }

.calc-result { background: var(--brand-ink); color: #fff; border-radius: var(--radius); padding: 22px 24px; position: relative; overflow: hidden; }
.calc-result::after { content: ""; position: absolute; right: -40px; bottom: -60px; width: 200px; height: 200px; border-radius: 50%; background: radial-gradient(circle, rgba(181,133,63,.35), transparent 70%); }
.calc-result .eyebrow { color: var(--gold-2); }
.calc-result__date { font-family: var(--f-display); font-size: 34px; line-height: 1.1; margin: 8px 0 4px; }
.calc-result p { color: #C9D5D7; margin: 0; }
.calc-steps { font-size: 13px; margin: 0; padding-left: 18px; color: var(--ink-2); }
.calc-steps li { margin-bottom: 4px; }

/* ---------- Facturas ---------- */
.lines { width: 100%; border-collapse: collapse; }
.lines th { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); font-weight: 600; }
.lines td { padding: 6px; border-bottom: 1px solid var(--line-2); vertical-align: top; }
.lines textarea { min-height: 40px; height: 40px; }
.lines .c-tipo { width: 140px; } .lines .c-cant { width: 90px; } .lines .c-precio { width: 130px; } .lines .c-iva { width: 110px; } .lines .c-total { width: 120px; text-align: right; padding-top: 15px; } .lines .c-del { width: 40px; }
.lines input { text-align: right; }
.totals { margin-left: auto; width: 100%; max-width: 360px; border-collapse: collapse; }
.totals td { padding: 7px 0; border-bottom: 1px solid var(--line-2); }
.totals td:last-child { text-align: right; font-variant-numeric: tabular-nums; }
.totals .grand td { border-bottom: 0; border-top: 2px solid var(--ink); font-family: var(--f-display); font-size: 22px; padding-top: 12px; }

.invoice-paper { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 40px 44px; }
.invoice-paper__head { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; margin-bottom: 30px; }
.invoice-paper__title { font-family: var(--f-display); font-size: 30px; }
.invoice-paper__code { font-family: ui-monospace, Menlo, monospace; color: var(--gold); letter-spacing: .05em; }
.parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 26px; }
.parties h3 { margin-bottom: 6px; }
.stamp { display: inline-block; border: 2px solid currentColor; padding: 3px 12px; border-radius: 6px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; font-size: 12px; transform: rotate(-4deg); }
.stamp--draft { color: var(--warn); }
.stamp--paid { color: var(--ok); }
.stamp--void { color: var(--danger); }
.hash { font-family: ui-monospace, Menlo, monospace; font-size: 11px; color: var(--muted); overflow-wrap: anywhere; }

/* ---------- Modal ---------- */
dialog { border: 0; border-radius: 14px; padding: 0; width: min(560px, calc(100vw - 32px)); box-shadow: var(--shadow-lg); color: var(--ink); }
dialog::backdrop { background: rgba(23,41,47,.45); backdrop-filter: blur(2px); }
.modal__head { padding: 18px 22px; border-bottom: 1px solid var(--line-2); display: flex; justify-content: space-between; align-items: center; }
.modal__body { padding: 18px 22px; }
.modal__foot { padding: 14px 22px; border-top: 1px solid var(--line-2); display: flex; justify-content: flex-end; gap: 10px; background: var(--surface-2); }

/* ---------- Acceso ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); }
.auth__art {
	background: var(--brand-ink); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden;
	background-image: radial-gradient(70% 50% at 100% 100%, rgba(181,133,63,.28), transparent 70%), radial-gradient(60% 40% at 0% 0%, rgba(255,255,255,.06), transparent 70%);
}
.auth__art::after { content: ""; position: absolute; inset: 24px; border: 1px solid rgba(212,176,122,.22); border-radius: 18px; pointer-events: none; }
.auth__quote { font-family: var(--f-display); font-size: clamp(28px, 3.2vw, 42px); line-height: 1.15; font-weight: 400; max-width: 16ch; }
.auth__quote em { color: var(--gold-2); }
.auth__foot { font-size: 12.5px; color: rgba(255,255,255,.55); display: flex; align-items: center; gap: 8px; }
.auth__panel { display: grid; place-items: center; padding: 40px 24px; }
.auth__box { width: 100%; max-width: 380px; }
.auth__box h1 { font-size: 32px; margin: 18px 0 6px; }
.auth__box .lead { color: var(--muted); margin-bottom: 26px; }
.auth__logo { width: 210px; height: auto; }
.auth__box .field { margin-bottom: 14px; }
.otp { letter-spacing: .5em; font-size: 22px !important; text-align: center; font-variant-numeric: tabular-nums; }
.qr { width: 190px; height: 190px; margin: 6px auto 12px; padding: 8px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.qr svg { width: 100%; height: 100%; }
.codes { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 18px; font-family: ui-monospace, Menlo, monospace; font-size: 14px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 14px 18px; margin: 12px 0; }

/* ---------- Varios ---------- */
.kv-inline { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13px; color: var(--ink-2); }
.kv-inline b { color: var(--ink); font-weight: 600; }
.quick { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.quick a { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); font-weight: 500; transition: border-color .15s, transform .15s, box-shadow .15s; }
.quick a:hover { border-color: var(--gold-2); transform: translateY(-1px); box-shadow: var(--shadow); color: var(--ink); }
.quick .icon { color: var(--gold); }
.progress { height: 6px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--ok); }
.pager { display: flex; gap: 6px; justify-content: flex-end; padding: 12px 16px; border-top: 1px solid var(--line-2); align-items: center; font-size: 13px; }
.pager a, .pager span { padding: 5px 10px; border-radius: 7px; border: 1px solid var(--line); background: #fff; }
.pager .is-current { background: var(--brand); color: #fff; border-color: var(--brand); }
.conflict-hit { border-left: 3px solid var(--danger); }
mark { background: var(--gold-soft); color: inherit; padding: 0 2px; border-radius: 3px; }
.chart-bars { display: flex; align-items: flex-end; gap: 8px; height: 160px; padding: 10px 0 0; }
.chart-bars .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.chart-bars .bar i { display: block; width: 100%; max-width: 36px; background: linear-gradient(var(--brand), var(--brand-2)); border-radius: 5px 5px 2px 2px; min-height: 2px; }
.chart-bars .bar span { font-size: 11px; color: var(--muted); }
.chart-bars .bar b { font-size: 10.5px; color: var(--ink-2); font-weight: 500; font-variant-numeric: tabular-nums; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
	.split { grid-template-columns: 1fr; }
	.grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.quick { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
	.app { grid-template-columns: 1fr; background: none; }
	.sidebar { position: fixed; z-index: 50; left: 0; top: 0; width: 270px; transform: translateX(-100%); transition: transform .25s; box-shadow: var(--shadow-lg); }
	.nav-open .sidebar { transform: none; }
	.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(23,41,47,.4); z-index: 40; }
	.menu-toggle { display: inline-grid; color: var(--ink); }
	.topbar__spacer { display: none; }
	.search { max-width: none; min-width: 0; }
	.topbar { gap: 8px; }
	.topbar { padding: 10px 16px; }
	.content { padding: 20px 16px 48px; }
	.grid-2, .grid-3 { grid-template-columns: 1fr; }
	.form-grid > [class*="span-"] { grid-column: span 12; }
	.dl, .dl--wide { grid-template-columns: 1fr; gap: 2px; }
	.dl dd { margin-bottom: 10px; }
	.auth { grid-template-columns: 1fr; }
	.auth__art { display: none; }
	.parties { grid-template-columns: 1fr; }
	.invoice-paper { padding: 24px 20px; }
	.cal td { height: 76px; padding: 3px; }
	.cal .ev { font-size: 10px; padding: 1px 3px; }
	.cal .fest { display: none; }
	.lines thead { display: none; }
	.lines tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; padding: 10px 0; border-bottom: 1px solid var(--line); }
	.lines td { border: 0; padding: 0; width: auto !important; }
	.lines td.c-concepto { grid-column: span 2; }
	h1 { font-size: 25px; }
}
@media (max-width: 520px) {
	.grid-4, .quick { grid-template-columns: 1fr; }
	.page-head__actions { width: 100%; }
	.filters input, .filters select { min-width: 0; width: 100%; }
}

@media print {
	.sidebar, .topbar, .page-head__actions, .no-print, .toasts { display: none !important; }
	.app { display: block; }
	.content { padding: 0; }
	.card, .invoice-paper { box-shadow: none; }
	body { background: #fff; }
}

/* Menú «Nuevo» */
.new-menu { position: relative; }
.new-menu summary { list-style: none; }
.new-menu summary::-webkit-details-marker { display: none; }
.new-menu__list { position: absolute; right: 0; top: calc(100% + 8px); min-width: 200px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; z-index: 30; }
.new-menu__list a { display: flex; gap: 10px; align-items: center; padding: 8px 10px; border-radius: 7px; color: var(--ink); font-weight: 500; }
.new-menu__list a:hover { background: var(--surface-2); color: var(--brand); }
.new-menu__list .icon { color: var(--gold); }

/* Concepto de línea: vista previa + ventana de edición */
.concept { position: relative; }
.lines textarea[data-concept] { height: auto; min-height: 44px; max-height: 92px; cursor: pointer; resize: none; padding-right: 34px; background: var(--surface-2); line-height: 1.45; overflow: hidden; }
.lines textarea[data-concept]:hover { border-color: var(--gold-2); background: #fff; }
.concept__btn { position: absolute; right: 4px; top: 4px; color: var(--muted); padding: 5px; }
.concept__btn:hover { color: var(--brand); background: var(--brand-soft); }
.dlg-concepto { width: min(760px, calc(100vw - 24px)); }
.dlg-concepto textarea { min-height: 220px; font-size: 15px; line-height: 1.6; }
.concept-tools { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.concept-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--surface-2); border-radius: 999px; padding: 5px 12px; font: 500 12.5px/1.3 var(--f-ui); color: var(--ink-2); cursor: pointer; text-align: left; }
.chip:hover { border-color: var(--gold); color: var(--brand); background: #fff; }
