/*
 * AndorCore (Andorsoft): product interface on top of Bootstrap 5.3.
 * Dark slate side rail with icons (opens from the header "☰"), white header,
 * light page, white cards with a subtle radius; square, even-height form fields. Andorsoft orange marks the active place and the main action.
 * The client's brand (e.g. Gamma) only lives in its PDFs and e-mails.
 */

/* Inter (SIL OFL 1.1, assets/fonts/LICENSE-OFL.txt), served by the app itself. */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal-Nq2MFc6.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal-G_crC3O.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal-5rtOGK2.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal-sxlLprI.woff2") format("woff2"); }

:root {
    --fx-ink: #1f2937;
    --fx-ink-rgb: 31, 41, 55;
    --fx-ink-hover: #111827;
    --fx-ink-soft: #f1f3f6;
    --fx-ink-soft-2: #e5e8ee;
    --fx-nav: #1f2937;
    --fx-nav-deep: #161e2b;
    --fx-accent: #f97316;
    --fx-accent-rgb: 249, 115, 22;
    --fx-accent-strong: #ea580c;
    --fx-accent-deep: #c2410c;
    --fx-accent-soft: #fff1e6;
    --fx-bg: #f3f5f8;
    --fx-surface: #ffffff;
    --fx-border: #e8ebf0;
    --fx-border-strong: #d9dee6;
    --fx-text: #1f2937;
    --fx-muted: #6b7280;
    --fx-success: #15803d;
    --fx-warning: #9a6408;
    --fx-danger: #c0262d;
    --fx-radius-lg: 6px;   /* cards, panels */
    --fx-radius: 5px;      /* tiles, dropdowns */
    --fx-radius-sm: 4px;   /* small surfaces */
    --fx-radius-xs: 3px;   /* inputs, buttons, labels */
    --fx-control-h: 36px;  /* one height for every field and button */
    --fx-shadow: 0 1px 2px rgba(16, 24, 40, .04), 0 2px 10px rgba(16, 24, 40, .04);
    --fx-shadow-hover: 0 2px 4px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .08);
    --fx-topbar: 64px;
    --fx-rail: 84px;
    --fx-sidebar: 248px;

    /* Bootstrap tokens */
    --bs-primary: var(--fx-ink);
    --bs-primary-rgb: var(--fx-ink-rgb);
    --bs-body-color: var(--fx-text);
    --bs-body-font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    --bs-body-font-size: .875rem;
    --bs-border-color: var(--fx-border);
    --bs-link-color: var(--fx-ink);
    --bs-link-color-rgb: var(--fx-ink-rgb);
    --bs-link-hover-color: var(--fx-accent-deep);
    --bs-secondary-color: var(--fx-muted);
    --bs-border-radius: var(--fx-radius-xs);
    --bs-border-radius-sm: var(--fx-radius-xs);
    --bs-border-radius-lg: var(--fx-radius);
    --bs-border-radius-pill: 999px;
    --bs-focus-ring-color: rgba(var(--fx-accent-rgb), .2);
}

body {
    background: var(--fx-bg);
    color: var(--fx-text);
    -webkit-font-smoothing: antialiased;
    font-feature-settings: "cv11", "ss01";
}

h1, h2, h3, h4, h5, h6 { color: var(--fx-text); font-weight: 600; letter-spacing: -.015em; }
.text-muted, .text-secondary { color: var(--fx-muted) !important; }
.text-danger { color: var(--fx-danger) !important; }
.tabular { font-variant-numeric: tabular-nums; }
.small-caps { font-size: .75rem; font-weight: 500; color: var(--fx-muted); }
a { text-decoration: none; }
a:hover { text-decoration: none; color: var(--fx-accent-deep); }
:focus-visible { outline: 2px solid var(--fx-accent); outline-offset: 2px; }

/* ------------------------------------------------------------ buttons */
.btn {
    --bs-btn-font-weight: 500; --bs-btn-font-size: .875rem; --bs-btn-line-height: 1.4;
    --bs-btn-border-radius: var(--fx-radius-xs); --bs-btn-padding-y: .42rem; --bs-btn-padding-x: .95rem;
    min-height: var(--fx-control-h); display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
}
.btn-sm { --bs-btn-font-size: .8rem; --bs-btn-padding-y: .28rem; --bs-btn-padding-x: .7rem; min-height: 30px; }
.btn-lg { --bs-btn-font-size: .875rem; --bs-btn-padding-y: .42rem; --bs-btn-padding-x: .95rem; --bs-btn-border-radius: var(--fx-radius-xs); min-height: var(--fx-control-h); }
.btn-ghost-danger.px-0 { min-height: 0; }
.btn-primary {
    --bs-btn-bg: var(--fx-accent-strong); --bs-btn-border-color: var(--fx-accent-strong);
    --bs-btn-hover-bg: var(--fx-accent-deep); --bs-btn-hover-border-color: var(--fx-accent-deep);
    --bs-btn-active-bg: var(--fx-accent-deep); --bs-btn-active-border-color: var(--fx-accent-deep);
    --bs-btn-disabled-bg: var(--fx-accent-strong); --bs-btn-disabled-border-color: var(--fx-accent-strong);
    --bs-btn-focus-shadow-rgb: var(--fx-accent-rgb);
    box-shadow: 0 1px 2px rgba(194, 65, 12, .25);
}
.btn-outline-primary {
    --bs-btn-color: var(--fx-accent-deep); --bs-btn-border-color: var(--fx-accent-strong);
    --bs-btn-hover-bg: var(--fx-accent-strong); --bs-btn-hover-border-color: var(--fx-accent-strong);
    --bs-btn-active-bg: var(--fx-accent-deep); --bs-btn-active-border-color: var(--fx-accent-deep);
    --bs-btn-focus-shadow-rgb: var(--fx-accent-rgb);
}
.btn-light {
    --bs-btn-bg: #fff; --bs-btn-border-color: var(--fx-border-strong); --bs-btn-color: var(--fx-text);
    --bs-btn-hover-bg: var(--fx-ink-soft); --bs-btn-hover-border-color: var(--fx-border-strong);
    --bs-btn-active-bg: var(--fx-ink-soft-2);
    box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
}
.btn-link { --bs-btn-color: var(--fx-ink); text-decoration: none; }
.btn-ghost-danger { --bs-btn-color: var(--fx-danger); --bs-btn-hover-bg: #fdecec; --bs-btn-hover-color: var(--fx-danger); }

/* -------------------------------------------------------------- forms */
/* Data entry: square corners and one height for every field (no small/large variants). */
.form-control, .form-select,
.form-control-sm, .form-control-lg, .form-select-sm, .form-select-lg,
.input-group-sm > .form-control, .input-group-sm > .form-select, .input-group-lg > .form-control, .input-group-lg > .form-select {
    min-height: var(--fx-control-h); padding: .42rem .7rem; border-color: var(--fx-border-strong); border-radius: var(--fx-radius-xs);
    font-size: .875rem; line-height: 1.4; box-shadow: none;
}
.form-select, .form-select-sm, .form-select-lg { padding-right: 2.1rem; background-position: right .65rem center; }
textarea.form-control { min-height: calc(var(--fx-control-h) * 2); }
.form-control[type="file"] { padding: 0; line-height: calc(var(--fx-control-h) - 2px); }
.form-control::file-selector-button { height: calc(var(--fx-control-h) - 2px); margin: 0 .7rem 0 0; padding: 0 .9rem; border: 0; border-right: 1px solid var(--fx-border-strong); background: #f8f9fb; color: var(--fx-text); font-weight: 500; }
.input-group > .btn, .input-group-sm > .btn, .input-group-text { min-height: var(--fx-control-h); border-radius: var(--fx-radius-xs); font-size: .875rem; }
.input-group-sm > .btn { --bs-btn-padding-y: .42rem; --bs-btn-padding-x: .95rem; }
.form-check-input { border-color: var(--fx-border-strong); }
.form-check-input[type="checkbox"] { border-radius: 2px; }
.form-control:focus, .form-select:focus { border-color: var(--fx-accent); box-shadow: 0 0 0 .2rem rgba(var(--fx-accent-rgb), .15); }
.form-check-input:checked { background-color: var(--fx-accent-strong); border-color: var(--fx-accent-strong); }
.form-check-input:focus { border-color: var(--fx-accent); box-shadow: 0 0 0 .2rem rgba(var(--fx-accent-rgb), .15); }
.form-label { font-weight: 500; font-size: .8rem; color: #374151; margin-bottom: .3rem; }
.form-text { font-size: .75rem; color: var(--fx-muted); }
label.required::after { content: " *"; color: var(--fx-danger); }
.form-check-label.required::after { content: none; }
.form-section + .form-section { border-top: 1px solid var(--fx-border); margin-top: 1.25rem; padding-top: 1.25rem; }
.form-section-title { font-size: .95rem; margin-bottom: .9rem; }
input.num, .num input { text-align: right; font-variant-numeric: tabular-nums; }

/* ======================================================== layout: side rail */
.sidebar {
    --bs-offcanvas-width: 280px;
    --bs-offcanvas-bg: var(--fx-nav);
    background: linear-gradient(180deg, var(--fx-nav) 0%, var(--fx-nav-deep) 100%);
    color: rgba(255, 255, 255, .72);
}
.sidebar-brand {
    display: flex; align-items: center; justify-content: space-between; gap: .5rem;
    height: var(--fx-topbar); padding: 0 1.25rem; flex: 0 0 auto;
    border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.sidebar-brand a { color: #fff; }
/* The brand stays at the top while the menu scrolls */
.sidebar-brand { position: sticky; top: 0; z-index: 2; background: var(--fx-nav); }
.sidebar .offcanvas-body { display: flex; flex-direction: column; padding: .75rem 0 1rem; }
.nav-section { padding: 1rem 1.5rem .4rem; font-size: .75rem; font-weight: 500; color: rgba(255, 255, 255, .42); }
.nav-section:first-child { padding-top: .35rem; }
.side-link {
    position: relative; display: flex; align-items: center; gap: .85rem; width: 100%;
    min-height: 44px; padding: 0 1.5rem; border: 0; background: transparent;
    color: rgba(255, 255, 255, .72); text-decoration: none; font-size: .9rem; font-weight: 500;
    transition: background-color .15s ease, color .15s ease;
}
.side-link:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.side-link.active { background: var(--fx-accent-strong); color: #fff; }
.side-link.active:hover { background: var(--fx-accent-strong); }
.side-icon { flex: 0 0 20px; width: 20px; height: 20px; }
.side-icon :is(g, path, circle, rect, line, polyline) { stroke-width: 1.75; }
.side-label { flex: 1 1 auto; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.side-link .count {
    min-width: 20px; padding: 0 .4rem; border-radius: 10px; text-align: center;
    font-size: .7rem; font-weight: 600; line-height: 20px; font-variant-numeric: tabular-nums;
    background: var(--fx-accent); color: #fff;
}
.side-link.active .count { background: #fff; color: var(--fx-accent-deep); }
.side-dot { flex: 0 0 auto; width: 8px; height: 8px; border-radius: 50%; background: var(--fx-accent); }
.side-bottom { margin-top: auto; padding-top: .6rem; border-top: 1px solid rgba(255, 255, 255, .07); }
.sidebar-foot { margin: .75rem 0 0; padding: 0 1.5rem; font-size: .72rem; line-height: 1.5; color: rgba(255, 255, 255, .4); }
.sidebar-foot a { color: rgba(255, 255, 255, .62); text-decoration: underline; text-decoration-color: rgba(255, 255, 255, .25); text-underline-offset: 2px; }
.sidebar-foot a:hover { color: #fff; }
/* Scrollbar of the menu: invisible until the pointer is over it, then a faint thin line. */
.sidebar, .sidebar .offcanvas-body { scrollbar-width: thin; scrollbar-color: transparent transparent; }
.sidebar:hover, .sidebar:hover .offcanvas-body { scrollbar-color: rgba(255, 255, 255, .12) transparent; }
.sidebar::-webkit-scrollbar, .sidebar .offcanvas-body::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track, .sidebar .offcanvas-body::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb, .sidebar .offcanvas-body::-webkit-scrollbar-thumb { background: transparent; border-radius: 2px; }
.sidebar:hover::-webkit-scrollbar-thumb, .sidebar:hover .offcanvas-body::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, .12); }

@media (min-width: 992px) {
    /* Bootstrap forces "background-color: transparent !important" on .offcanvas-lg from lg up. */
    .sidebar.offcanvas-lg {
        position: fixed; inset: 0 auto 0 0; z-index: 1035; width: var(--fx-rail);
        display: flex; flex-direction: column; overflow-y: auto; overflow-x: hidden;
        background: linear-gradient(180deg, var(--fx-nav) 0%, var(--fx-nav-deep) 100%) !important;
        transition: width .2s ease;
    }
    .sidebar.offcanvas-lg .offcanvas-body { flex: 1 1 auto; overflow: visible; }

    /* Rail (default): icons only, centred, the active one as a full-width orange block */
    body:not(.sidebar-expanded) .sidebar-brand { justify-content: center; padding: 0; }
    body:not(.sidebar-expanded) .sidebar .brand-name { display: none; }
    body:not(.sidebar-expanded) .sidebar .brand-mark { width: 32px; height: 32px; }
    body:not(.sidebar-expanded) .nav-section { height: 1px; margin: .55rem 1.4rem; padding: 0; background: rgba(255, 255, 255, .08); }
    body:not(.sidebar-expanded) .nav-section:first-child { display: none; }
    body:not(.sidebar-expanded) .nav-section > span,
    body:not(.sidebar-expanded) .side-label {
        position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
    }
    body:not(.sidebar-expanded) .side-link { justify-content: center; min-height: 52px; padding: 0; }
    body:not(.sidebar-expanded) .side-icon { width: 22px; height: 22px; flex-basis: 22px; }
    body:not(.sidebar-expanded) .side-link .count { position: absolute; top: 7px; left: calc(50% + 4px); min-width: 18px; padding: 0 .3rem; line-height: 18px; font-size: .62rem; box-shadow: 0 0 0 2px var(--fx-nav); }
    body:not(.sidebar-expanded) .side-dot { position: absolute; top: 12px; left: calc(50% + 7px); box-shadow: 0 0 0 2px var(--fx-nav); }
    body:not(.sidebar-expanded) .sidebar-foot { display: none; }
    /* Name of each entry on hover / keyboard focus (needs the rail not to clip it) */
    body:not(.sidebar-expanded) .side-link::after {
        content: attr(data-tip); position: absolute; left: calc(100% + 10px); top: 50%; transform: translate(-4px, -50%);
        padding: .35rem .6rem; border-radius: var(--fx-radius-xs); background: #111827; color: #fff;
        font-size: .78rem; font-weight: 500; white-space: nowrap; pointer-events: none; opacity: 0; z-index: 1060;
        box-shadow: 0 6px 18px rgba(0, 0, 0, .18); transition: opacity .12s ease, transform .12s ease;
    }
    body:not(.sidebar-expanded) .side-link:hover::after, body:not(.sidebar-expanded) .side-link:focus-visible::after { opacity: 1; transform: translate(0, -50%); }

    /* Expanded: labels and section names */
    .sidebar-expanded .sidebar.offcanvas-lg { width: var(--fx-sidebar); }
}
@media (min-width: 992px) and (min-height: 780px) {
    body:not(.sidebar-expanded) .sidebar.offcanvas-lg { overflow: visible; }
}

/* ========================================================== layout: header */
.topbar {
    position: fixed; top: 0; right: 0; left: 0; z-index: 1030; height: var(--fx-topbar);
    display: flex; align-items: center; gap: .75rem; padding: 0 1rem;
    background: rgba(255, 255, 255, .96); border-bottom: 1px solid var(--fx-border);
    backdrop-filter: saturate(180%) blur(6px);
}
.topbar-brand { color: var(--fx-ink); }
.topbar-tenant { align-items: center; font-size: .95rem; font-weight: 600; color: var(--fx-text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 40ch; }
.topbar-tenant img { display: block; max-height: 30px; max-width: 180px; width: auto; }
.topbar-actions { display: flex; align-items: center; gap: .3rem; margin-left: auto; }
.topbar-icon {
    position: relative; display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--fx-radius);
    background: transparent; color: #4b5563; font-size: 1.25rem;
}
.topbar-icon:hover, .topbar-icon[aria-expanded="true"] { background: var(--fx-ink-soft); color: var(--fx-ink); }
.topbar-icon svg { display: block; }
.topbar-icon svg :is(g, path) { stroke-width: 1.75; }
.topbar-dot { position: absolute; top: 9px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--fx-accent); box-shadow: 0 0 0 2px #fff; }
.topbar-count {
    position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
    background: var(--fx-accent-strong); color: #fff; font-size: .65rem; font-weight: 600; line-height: 18px; text-align: center;
    box-shadow: 0 0 0 2px #fff; font-variant-numeric: tabular-nums;
}
.user-dropdown { margin-left: .4rem; }
.user-menu { display: flex; align-items: center; gap: .6rem; padding: .25rem .5rem .25rem .25rem; border-radius: var(--fx-radius); color: var(--fx-text); }
.user-menu:hover, .user-menu[aria-expanded="true"] { background: var(--fx-ink-soft); color: var(--fx-text); }
.avatar {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 36px; height: 36px; border-radius: 50%;
    background: var(--fx-ink); color: #fff; font-size: .75rem; font-weight: 600; letter-spacing: .02em;
}
.user-name { flex-direction: column; line-height: 1.2; }
.user-name > span { font-size: .85rem; font-weight: 600; }
.user-name > small { font-size: .72rem; color: var(--fx-muted); }

/* ============================================================ layout: page */
.main { min-height: 100vh; padding: calc(var(--fx-topbar) + 1.5rem) 1rem 3rem; }
.container-main { max-width: 1360px; margin: 0 auto; }
@media (min-width: 992px) {
    .topbar { left: var(--fx-rail); padding: 0 1.75rem 0 1rem; transition: left .2s ease; }
    .main { margin-left: var(--fx-rail); padding: calc(var(--fx-topbar) + 1.75rem) 2rem 3rem; transition: margin-left .2s ease; }
    .sidebar-expanded .topbar { left: var(--fx-sidebar); }
    .sidebar-expanded .main { margin-left: var(--fx-sidebar); }
}
@media (prefers-reduced-motion: reduce) { .sidebar.offcanvas-lg, .topbar, .main { transition: none !important; } }

.page-header { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-end; justify-content: space-between; margin-bottom: 1.5rem; }
.page-header h1 { font-size: 1.5rem; font-weight: 700; margin: 0; letter-spacing: -.025em; }
.page-header .subtitle { color: var(--fx-muted); margin: .25rem 0 0; }
.page-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.breadcrumb-back { font-size: .8rem; color: var(--fx-muted); text-decoration: none; display: inline-block; margin-bottom: .35rem; }
.breadcrumb-back:hover { color: var(--fx-accent-deep); }
.section-title { font-size: .95rem; font-weight: 600; margin: 0 0 .7rem; }

/* ---------------------------------------------------------- product brand */
.brand { display: inline-flex; align-items: center; gap: .6rem; line-height: 1; }
.brand-mark { width: 28px; height: 28px; flex: 0 0 auto; transition: width .2s ease, height .2s ease; }
.brand-name { font-size: 1.1rem; font-weight: 700; letter-spacing: -.02em; color: #fff; white-space: nowrap; }
.brand-accent { color: var(--fx-accent); }
.brand-light .brand-name { color: var(--fx-ink); }
.brand-light .brand-accent { color: var(--fx-accent-strong); }
.brand-lg { gap: .7rem; }
.brand-lg .brand-mark { width: 38px; height: 38px; }
.brand-lg .brand-name { font-size: 1.6rem; }

/* ---------------------------------------------------------------- cards */
.card { border: 1px solid var(--fx-border); border-radius: var(--fx-radius-lg); background: var(--fx-surface); box-shadow: var(--fx-shadow); }
.card-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; padding: 1.1rem 1.25rem .65rem; background: transparent; border-bottom: 0; }
.card-header:first-child { border-radius: var(--fx-radius-lg) var(--fx-radius-lg) 0 0; }
.card-header .card-title { margin: 0; font-size: 1rem; font-weight: 600; }
.card-header > a { font-size: .82rem; font-weight: 500; color: var(--fx-accent-deep); }
.card-header > a:hover { text-decoration: underline; text-underline-offset: 3px; }
.card-body { padding: 1.25rem; }
.card-footer { padding: .75rem 1.25rem; background: transparent; border-top: 1px solid var(--fx-border); }
.card-footer:last-child { border-radius: 0 0 var(--fx-radius-lg) var(--fx-radius-lg); }
.card > .table-responsive { border-radius: 0 0 var(--fx-radius-lg) var(--fx-radius-lg); }
.card > .table-responsive:first-child { border-radius: var(--fx-radius-lg); }
.attention-card { border-color: #f3cfcb; box-shadow: inset 3px 0 0 var(--fx-danger), var(--fx-shadow); }

/* Figures with an icon tile (dashboard) */
.stats { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; }
@media (min-width: 576px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1200px) { .stats { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.stat {
    display: flex; align-items: center; gap: 1rem; padding: 1.15rem 1.25rem;
    background: var(--fx-surface); border: 1px solid var(--fx-border); border-radius: var(--fx-radius-lg); box-shadow: var(--fx-shadow);
    color: var(--fx-text); transition: box-shadow .15s ease, transform .15s ease;
}
.stat:hover { color: var(--fx-text); box-shadow: var(--fx-shadow-hover); }
.stat-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 48px; height: 48px; border-radius: var(--fx-radius); font-size: 1.4rem; }
.stat-icon svg :is(g, path) { stroke-width: 1.75; }
.tone-ink { background: #eef1f5; color: var(--fx-ink); }
.tone-orange { background: var(--fx-accent-soft); color: var(--fx-accent-strong); }
.tone-green { background: #e7f6ee; color: var(--fx-success); }
.tone-red { background: #fdecec; color: var(--fx-danger); }
.stat-body { display: flex; flex-direction: column; min-width: 0; }
.stat-label { font-size: .8rem; color: var(--fx-muted); }
.stat-value { margin: .1rem 0 .05rem; font-size: 1.5rem; font-weight: 700; letter-spacing: -.025em; line-height: 1.25; white-space: nowrap; font-variant-numeric: tabular-nums; }
.stat-note { font-size: .75rem; line-height: 1.4; color: var(--fx-muted); }
.trend-up { color: var(--fx-success); font-weight: 500; }
.trend-down { color: var(--fx-danger); font-weight: 500; }

/* Figures row of the other screens (Cobraments, Planificació, client) */
.kpi-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
@media (min-width: 1200px) { .kpi-strip { grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); grid-template-columns: none; } }
.kpi-strip > * { width: auto; max-width: none; padding: 0; margin: 0; }
.kpi { height: 100%; padding: 1.1rem 1.25rem; }
a.kpi { transition: box-shadow .15s ease; }
a.kpi:hover { box-shadow: var(--fx-shadow-hover); }
.kpi .kpi-label { font-size: .8rem; color: var(--fx-muted); }
.kpi .kpi-value { margin-top: .2rem; font-size: 1.35rem; font-weight: 700; letter-spacing: -.02em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.kpi .kpi-foot { margin-top: .2rem; font-size: .75rem; color: var(--fx-muted); }
.kpi.kpi-danger .kpi-value { color: var(--fx-danger); }
@media (max-width: 575.98px) {
    .kpi { padding: .9rem 1rem; }
    .kpi .kpi-value, .stat-value { font-size: 1.15rem; }
    .page-header h1 { font-size: 1.25rem; }
}

/* Round avatars with initials (customers) */
.av {
    display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
    width: 36px; height: 36px; border-radius: 50%; color: #fff;
    font-size: .75rem; font-weight: 600; letter-spacing: .02em; line-height: 1;
}
.av-sm { width: 30px; height: 30px; font-size: .68rem; }
.av-0 { background: #3b82f6; }
.av-1 { background: #16a34a; }
.av-2 { background: #7c3aed; }
.av-3 { background: #f97316; }
.av-4 { background: #0d9488; }
.av-5 { background: #e11d48; }
.av-6 { background: #0284c7; }
.av-7 { background: #ca8a04; }
.who { display: inline-flex; align-items: center; gap: .65rem; min-width: 0; max-width: 100%; vertical-align: middle; }
.who > span:last-child { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }

/* Next billings: avatar, customer, when and amount */
.agenda-list { list-style: none; margin: 0; padding: 0 0 .25rem; }
.agenda-list a {
    display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: .8rem; align-items: center;
    padding: .65rem 1.25rem; color: var(--fx-text); text-decoration: none;
}
.agenda-list a:hover { background: #f8f9fb; color: var(--fx-text); }
.agenda-list-what { min-width: 0; }
.agenda-list-name { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; font-weight: 500; }
.agenda-list-kind { display: block; font-size: .75rem; color: var(--fx-muted); }
.agenda-list-kind time { color: var(--fx-text); font-weight: 500; }
.agenda-list-amount { font-weight: 600; font-size: .875rem; white-space: nowrap; font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------------- tables */
.table { --bs-table-bg: transparent; margin-bottom: 0; font-size: .85rem; }
.table > thead th {
    padding: .65rem .85rem; background: #f8f9fb; color: var(--fx-muted);
    font-size: .75rem; font-weight: 500; white-space: nowrap;
    border-top: 1px solid var(--fx-border); border-bottom: 1px solid var(--fx-border);
}
.card > .table-responsive:first-child .table > thead th { border-top: 0; }
.table > tbody td { padding: .7rem .85rem; vertical-align: middle; border-color: var(--fx-border); }
.table > tbody > tr:last-child > td { border-bottom: 0; }
.table > tfoot td { padding: .75rem .85rem; font-weight: 600; border-top: 1px solid var(--fx-border-strong); border-bottom: 0; }
.table-hover > tbody > tr:hover > * { --bs-table-hover-bg: #f8f9fb; }
.table a.row-link { color: inherit; text-decoration: none; font-weight: 500; white-space: nowrap; }
.table a.row-link:hover { color: var(--fx-accent-deep); }
.table a.row-link.who:hover > span:last-child { text-decoration: underline; text-underline-offset: 3px; }
.table .sort { color: inherit; text-decoration: none; }
.table .sort .arrow { opacity: .55; font-size: .65rem; margin-left: .2rem; }
.table td.text-nowrap { white-space: nowrap; }
tr.is-muted td { color: var(--fx-muted); }
.text-end.num, td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Invoice number takes the colour of its status label. */
.table a.row-link.num-success, .row-link.num-success { color: var(--fx-success); }
.table a.row-link.num-warning, .row-link.num-warning { color: var(--fx-warning); }
.table a.row-link.num-danger, .row-link.num-danger { color: var(--fx-danger); }
.table a.row-link.num-info, .row-link.num-info { color: #1d5fbf; }
.table a.row-link.num-secondary, .row-link.num-secondary { color: #6b7280; }
.table a.row-link.num-draft, .row-link.num-draft { color: var(--fx-ink); }

/* ------------------------------------------------------------ badges */
.status {
    display: inline-flex; align-items: center;
    padding: .22rem .55rem; border-radius: var(--fx-radius-xs);
    font-size: .75rem; font-weight: 500; line-height: 1.1; white-space: nowrap;
}
.status-success { background: #e7f6ee; color: var(--fx-success); }
.status-warning { background: #fdf3e1; color: var(--fx-warning); }
.status-danger { background: #fdecec; color: var(--fx-danger); }
.status-info { background: #e8f0fc; color: #1d5fbf; }
.status-secondary { background: #f1f3f6; color: #4b5563; }
.status-draft { background: #eef1f5; color: var(--fx-ink); }
.tag { padding: .12rem .45rem; border-radius: var(--fx-radius-xs); background: #f1f3f6; color: #4b5563; font-size: .7rem; font-weight: 500; }
.news-new { padding: .12rem .45rem; border-radius: var(--fx-radius-xs); background: var(--fx-accent-soft); color: var(--fx-accent-deep); font-size: .7rem; font-weight: 600; white-space: nowrap; }

/* --------------------------------------------------------- filters bar */
.filters { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.filters .form-control, .filters .form-select { width: auto; min-width: 140px; }
.filters .search { min-width: 220px; flex: 1 1 220px; max-width: 360px; }
.chip-filter { display: flex; flex-wrap: wrap; gap: 0 1.6rem; border-bottom: 1px solid var(--fx-border); }
.chip-filter a { margin-bottom: -1px; padding: .6rem 0; border-bottom: 2px solid transparent; color: var(--fx-muted); font-size: .875rem; font-weight: 500; }
.chip-filter a:hover { color: var(--fx-text); }
.chip-filter a.active { color: var(--fx-accent-deep); border-bottom-color: var(--fx-accent-strong); }
.bulk-bar { display: none; align-items: center; gap: .75rem; padding: .6rem 1rem; background: var(--fx-accent-soft); border-bottom: 1px solid var(--fx-border); font-size: .82rem; }
.bulk-bar.is-visible { display: flex; }
@media (max-width: 575.98px) {
    /* Status tabs scroll sideways instead of wrapping onto several lines. */
    .chip-filter { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; gap: 0 1.25rem; }
    .chip-filter::-webkit-scrollbar { display: none; }
    .chip-filter a { white-space: nowrap; flex: 0 0 auto; }
    /* Filters: full-width fields, dates side by side. */
    .filters > .form-control, .filters > .form-select, .filters .search { flex: 1 1 100%; max-width: none; min-width: 0; }
    .filters > input[type="date"] { flex: 1 1 calc(50% - .25rem); }
}

.empty { padding: 3rem 1rem; text-align: center; color: var(--fx-muted); }
.empty h3 { margin-bottom: .35rem; font-size: 1rem; color: var(--fx-text); }

/* ------------------------------------------------------- definition list */
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: .5rem 1.25rem; margin: 0; font-size: .85rem; }
.meta-list dt { color: var(--fx-muted); font-weight: 500; }
.meta-list dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---------------------------------------------------------- invoice view */
.doc-head { display: flex; flex-wrap: wrap; gap: .75rem; align-items: center; }
.doc-number { margin: 0; font-size: 1.5rem; font-weight: 700; }
.totals { width: 100%; max-width: 340px; margin-left: auto; font-size: .875rem; }
.totals td { padding: .3rem 0; }
.totals td:last-child { padding-left: 1rem; text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.totals td .text-muted { font-size: .78rem; }
.totals .grand td { padding-top: .6rem; border-top: 1px solid var(--fx-border-strong); font-size: 1.05rem; font-weight: 700; }
.totals tr.discount td { color: var(--fx-success); }
.timeline-steps { display: flex; flex-wrap: wrap; gap: 0; list-style: none; padding: 0; margin: 0; }
.timeline-steps li { position: relative; flex: 1 1 0; min-width: 0; padding: 1.1rem .25rem 0 0; font-size: .72rem; color: var(--fx-muted); }
.timeline-steps li::before { content: ""; position: absolute; top: 4px; left: 0; right: 0; height: 2px; background: var(--fx-border); }
.timeline-steps li::after { content: ""; position: absolute; top: 0; left: 0; width: 10px; height: 10px; border-radius: 50%; background: #fff; border: 2px solid var(--fx-border-strong); }
.timeline-steps li.done { color: var(--fx-text); }
.timeline-steps li.done::before { background: var(--fx-accent-strong); }
.timeline-steps li.done::after { background: var(--fx-accent-strong); border-color: var(--fx-accent-strong); }
.timeline-steps li strong { display: block; font-weight: 600; font-size: .75rem; }
@media (max-width: 575.98px) { .doc-number { font-size: 1.2rem; } }

/* -------------------------------------------------------- line editor */
.lines-table td { vertical-align: top; padding: .5rem .4rem; }
.lines-table td:first-child { padding-left: 1rem; }
.lines-table td:last-child { padding-right: 1rem; }
.lines-table .form-control, .lines-table .form-select { font-size: .82rem; }
.lines-table textarea { min-height: 38px; resize: vertical; field-sizing: content; max-height: 160px; }
.lines-table .line-total { padding-top: .95rem; font-weight: 600; text-align: right; white-space: nowrap; }
.lines-table .remove-line { color: #9ca3af; border: 0; background: none; font-size: 1.2rem; line-height: 1; padding: .45rem .25rem; }
.lines-table .remove-line:hover { color: var(--fx-danger); }
.lines-table .invalid-feedback { font-size: .72rem; }
@media (max-width: 991.98px) {
    .lines-table thead { display: none; }
    .lines-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem .6rem; padding: .9rem 1rem; border-bottom: 1px solid var(--fx-border); }
    .lines-table td { display: block; padding: 0 !important; border: 0; }
    .lines-table td[data-label]::before { content: attr(data-label); display: block; font-size: .7rem; color: var(--fx-muted); margin-bottom: .2rem; }
    .lines-table td.span-2 { grid-column: span 2; }
    .lines-table .line-total { padding-top: 1.3rem !important; }
}
.discounts-box { padding: .75rem .85rem .6rem; background: #f8f9fb; border: 1px solid var(--fx-border); border-radius: var(--fx-radius); }
.discounts-table td { padding: .3rem .3rem !important; border: 0; background: transparent; }
.discounts-table td:first-child { padding-left: 0 !important; }
.discounts-table .line-total { padding-top: .55rem !important; color: var(--fx-success); }

/* ------------------------------------------------- planned invoice */
.d-contents { display: contents; }
.d-contents[hidden] { display: none; }
.schedule-panel { padding: .85rem 1rem; background: #fffaf5; border: 1px solid #fde3cc; border-radius: var(--fx-radius); }
.schedule-panel-head { margin-bottom: .55rem; }
.schedule-panel .form-check { margin-bottom: .2rem; }

/* ------------------------------------------------------------ calendar */
.calendar { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--fx-border); border-left: 1px solid var(--fx-border); }
.calendar .dow { padding: .6rem .65rem; background: #f8f9fb; border-right: 1px solid var(--fx-border); border-bottom: 1px solid var(--fx-border); font-size: .75rem; font-weight: 600; color: var(--fx-muted); }
.calendar .day { display: flex; flex-direction: column; gap: 3px; min-width: 0; min-height: 118px; padding: .4rem .45rem .5rem; background: #fff; border-right: 1px solid var(--fx-border); border-bottom: 1px solid var(--fx-border); }
.calendar .day.out { background: #fafbfc; }
.calendar .day.out .day-num { color: #b7bcc8; }
.calendar .day.weekend:not(.out) { background: #fcfcfd; }
.calendar .day-head { display: flex; align-items: center; gap: .25rem; margin-bottom: 2px; }
.calendar .day-head .day-total { margin-left: auto; }
.calendar .day-num { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: var(--fx-radius-xs); font-size: .78rem; font-weight: 600; color: #374151; }
.calendar .day.today .day-num { background: var(--fx-accent-strong); color: #fff; }
.calendar .day-total { font-size: .66rem; color: var(--fx-muted); font-variant-numeric: tabular-nums; }
.calendar .day-add { display: inline-flex; align-items: center; justify-content: center; width: 22px; height: 22px; border-radius: var(--fx-radius-xs); color: var(--fx-muted); font-size: .95rem; line-height: 1; opacity: 0; transition: opacity .12s ease; }
.calendar .day:hover .day-add, .calendar .day-add:focus-visible { opacity: 1; }
.calendar .day-add:hover { background: var(--fx-accent-strong); color: #fff; }
@media (hover: none) { .calendar .day-add { opacity: .6; } }
.ev {
    display: block; padding: .24rem .45rem; border-radius: 2px; border-left: 3px solid transparent;
    font-size: .7rem; line-height: 1.25; text-decoration: none; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.ev .ev-amount { float: right; margin-left: .3rem; white-space: nowrap; font-variant-numeric: tabular-nums; opacity: .85; }
.ev-issued { background: #eef1f5; color: var(--fx-ink); border-left-color: var(--fx-ink); }
.ev-credit { background: #f3eefa; color: #5b3a8f; border-left-color: #7a55b3; }
.ev-scheduled { background: var(--fx-accent-soft); color: var(--fx-ink); border-left-color: var(--fx-accent); }
.ev-draft { background: #fff; color: #374151; border: 1px dashed var(--fx-accent); border-left: 3px solid var(--fx-accent); }
.ev-recurring { background: #fff; color: #4b5563; border: 1px dashed #b9bfd0; border-left: 3px solid #9ca3af; }
.ev-due { background: #fdf6e7; color: var(--fx-warning); border-left-color: #d8a23a; }
.ev-overdue { background: #fdecec; color: var(--fx-danger); border-left-color: var(--fx-danger); }
.ev:hover { filter: brightness(.97); }
.calendar.hide-issued .ev-issued, .calendar.hide-issued .ev-credit,
.calendar.hide-planned .ev-draft, .calendar.hide-planned .ev-scheduled, .calendar.hide-planned .ev-recurring,
.calendar.hide-due .ev-due, .calendar.hide-due .ev-overdue,
.agenda.hide-issued .ev-issued, .agenda.hide-issued .ev-credit,
.agenda.hide-planned .ev-draft, .agenda.hide-planned .ev-scheduled, .agenda.hide-planned .ev-recurring,
.agenda.hide-due .ev-due, .agenda.hide-due .ev-overdue { display: none; }
.legend { display: flex; flex-wrap: wrap; gap: .5rem; }
.legend label { display: inline-flex; align-items: center; gap: .4rem; padding: .32rem .7rem; border: 1px solid var(--fx-border-strong); border-radius: var(--fx-radius-sm); background: #fff; font-size: .78rem; cursor: pointer; user-select: none; }
.legend input { accent-color: var(--fx-accent-strong); }
.legend .sw { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sw-issued { background: var(--fx-ink); }
.sw-planned { border: 1.5px dashed var(--fx-accent); }
.sw-due { background: #d8a23a; }
.agenda-day { display: grid; grid-template-columns: 92px 1fr; gap: 1rem; padding: .85rem 1.25rem; border-bottom: 1px solid var(--fx-border); }
.agenda-day:last-child { border-bottom: 0; }
.agenda-date .d { font-size: 1.35rem; font-weight: 700; line-height: 1; }
.agenda-date .m { font-size: .75rem; color: var(--fx-muted); }
.agenda-date.today .d { color: var(--fx-accent-deep); }
.agenda-events { display: flex; flex-direction: column; gap: .4rem; min-width: 0; }
.agenda-events .ev { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem .65rem; font-size: .8rem; white-space: normal; }
.agenda-events .ev .ev-amount { float: none; font-weight: 600; }
@media (max-width: 767.98px) { .calendar-grid-wrap { display: none; } }

/* -------------------------------------------------------------- login
 * Andorsoft corporate card (as in Talent360): slate header + orange rule.
 */
.login-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 12vh 1rem 2rem; background: var(--fx-bg); }
.login-card { width: 100%; max-width: 420px; overflow: hidden; background: var(--fx-surface); border: 1px solid var(--fx-border); border-radius: var(--fx-radius-lg); box-shadow: 0 12px 32px rgba(16, 24, 40, .08); }
.login-card-header { position: relative; padding: 1.6rem 2rem 1.7rem; background: linear-gradient(180deg, var(--fx-nav) 0%, var(--fx-nav-deep) 100%); color: #fff; text-align: center; }
.login-card-header::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--fx-accent); }
.login-tagline { margin: .5rem 0 0; font-size: .8rem; color: rgba(255, 255, 255, .62); }
.login-card-body { padding: 1.75rem 2rem 2rem; }
.login-tenant { margin-bottom: .2rem; font-size: .85rem; font-weight: 500; color: var(--fx-muted); text-align: center; }
.login-logo { display: flex; align-items: center; justify-content: center; min-height: 64px; margin-bottom: 1.25rem; }
.login-logo img { display: block; max-height: 64px; max-width: 240px; width: auto; }
.login-logo .login-logo-default { width: 56px; height: 56px; }
.login-card-body h1 { text-align: center; }
.login-foot { margin-top: 1.25rem; font-size: .75rem; color: #9ca3af; text-align: center; }
@media (max-width: 575.98px) { .login-page { padding-top: 2rem; } .login-card-body { padding: 1.5rem 1.25rem; } }

/* --------------------------------------------------------------- misc */
.alert { border: 0; border-radius: var(--fx-radius); font-size: .85rem; }
.alert-success { background: #e7f6ee; color: #135c3d; }
.alert-danger { background: #fdecec; color: #8e1c13; }
.alert-warning { background: #fdf3e1; color: #7a4f07; }
.alert-info { background: #eef1f5; color: var(--fx-ink); }
.dropdown-menu {
    --bs-dropdown-font-size: .85rem; --bs-dropdown-link-active-bg: var(--fx-ink);
    --bs-dropdown-link-hover-bg: var(--fx-ink-soft); --bs-dropdown-link-hover-color: var(--fx-text);
    padding: .35rem; border-color: var(--fx-border); border-radius: var(--fx-radius); box-shadow: 0 12px 32px rgba(16, 24, 40, .12);
}
.dropdown-item { border-radius: var(--fx-radius-xs); padding: .45rem .7rem; }
.nav-tabs { --bs-nav-tabs-border-color: var(--fx-border); }
.nav-tabs .nav-link { margin-right: 1.6rem; padding: .6rem .1rem; border: 0; border-bottom: 2px solid transparent; color: var(--fx-muted); font-weight: 500; }
.nav-tabs .nav-link:hover { color: var(--fx-text); }
.nav-tabs .nav-link.active { color: var(--fx-accent-deep); border-bottom-color: var(--fx-accent-strong); background: transparent; }
.pagination { --bs-pagination-color: var(--fx-ink); --bs-pagination-active-bg: var(--fx-accent-strong); --bs-pagination-active-border-color: var(--fx-accent-strong); --bs-pagination-font-size: .8rem; --bs-pagination-border-color: var(--fx-border); --bs-pagination-border-radius: var(--fx-radius-xs); margin: 0; }
.modal-content { border: 0; border-radius: var(--fx-radius-lg); box-shadow: 0 24px 60px rgba(16, 24, 40, .2); }
.modal-header { border-bottom-color: var(--fx-border); }
.modal-footer { border-top-color: var(--fx-border); }
.list-group { --bs-list-group-border-color: var(--fx-border); }
.placeholder-list code { padding: .1rem .35rem; border-radius: var(--fx-radius-xs); background: #eef1f5; color: var(--fx-ink); font-size: .78rem; }
.email-preview { padding: 1rem; white-space: pre-wrap; background: #f8f9fb; border: 1px solid var(--fx-border); border-radius: var(--fx-radius); font-size: .85rem; }
.progress-thin { height: 6px; border-radius: 1px; background: #eef1f5; }
.progress-thin .progress-bar { background: var(--fx-accent-strong); border-radius: 1px; }

/* ------------------------------------------------- combobox (search select) */
.combobox-native { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; border: 0 !important; }
.combobox-input { cursor: text; text-overflow: ellipsis; }
.combobox-menu {
    position: fixed; z-index: 1080; overflow-y: auto; padding: .35rem;
    background: #fff; border: 1px solid var(--fx-border); border-radius: var(--fx-radius);
    box-shadow: 0 12px 32px rgba(16, 24, 40, .14); font-size: .84rem;
}
.combobox-group { padding: .55rem .6rem .2rem; font-size: .72rem; font-weight: 600; color: #9ca3af; }
.combobox-option { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; padding: .45rem .6rem; border-radius: var(--fx-radius-xs); cursor: pointer; color: var(--fx-text); }
.combobox-option .combobox-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.combobox-option .combobox-hint { color: var(--fx-muted); font-variant-numeric: tabular-nums; white-space: nowrap; font-size: .78rem; }
.combobox-option.is-active { background: var(--fx-ink-soft); }
.combobox-option[aria-selected="true"] .combobox-label { color: var(--fx-accent-deep); font-weight: 600; }
.combobox-option.is-empty { margin-bottom: .2rem; border-bottom: 1px solid var(--fx-border); color: var(--fx-muted); font-style: italic; }
.combobox-empty { padding: .6rem .8rem; color: var(--fx-muted); }

/* ------------------------------------------------- reminders ("Avisos") */
.reminders-menu { width: min(390px, calc(100vw - 1.5rem)); padding: 0; overflow: hidden; }
.reminders-menu-head { display: flex; justify-content: space-between; align-items: baseline; padding: .85rem 1rem .7rem; border-bottom: 1px solid var(--fx-border); font-size: .9rem; }
.reminders-menu-head a { font-size: .8rem; font-weight: 500; color: var(--fx-accent-deep); }
.reminders-menu-empty { margin: 0; padding: 1rem; color: var(--fx-muted); font-size: .85rem; }
.reminder { display: flex; align-items: flex-start; gap: .8rem; padding: .8rem 1rem; color: var(--fx-text); text-decoration: none; }
.reminder + .reminder { border-top: 1px solid var(--fx-border); }
.reminder:hover { background: #f8f9fb; color: var(--fx-text); }
.reminder-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 36px; height: 36px; border-radius: var(--fx-radius); font-size: 1.05rem; }
.reminder-icon svg :is(g, path) { stroke-width: 1.75; }
.reminder-danger .reminder-icon { background: #fdecec; color: var(--fx-danger); }
.reminder-warning .reminder-icon { background: #fdf3e1; color: var(--fx-warning); }
.reminder-info .reminder-icon { background: #eef1f5; color: var(--fx-ink); }
.reminder-text { min-width: 0; padding-top: .1rem; }
.reminder-title { display: block; font-size: .875rem; font-weight: 500; }
.reminder-detail { display: block; margin-top: .1rem; font-size: .78rem; line-height: 1.45; color: var(--fx-muted); }
.reminder-list .reminder { padding: 1rem 1.25rem; }

/* ------------------------------------------------- product news (Novetats) */
.rn-panel {
    display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.25rem 2rem; padding: 1.4rem 1.25rem;
    background: var(--fx-surface); border: 1px solid var(--fx-border); border-radius: var(--fx-radius-lg); box-shadow: var(--fx-shadow);
}
@media (min-width: 768px) { .rn-panel { grid-template-columns: 8rem minmax(0, 1fr); padding: 1.6rem 1.75rem; } }
@media (min-width: 1200px) { .rn-panel { grid-template-columns: 8rem minmax(0, 1fr) 16.5rem; } }
.rn-version { display: flex; align-items: baseline; gap: .75rem; }
@media (min-width: 768px) { .rn-version { flex-direction: column; align-items: flex-start; gap: .55rem; } }
.rn-number { display: inline-block; padding-top: .5rem; border-top: 3px solid var(--fx-accent); font-size: 2.75rem; font-weight: 600; line-height: 1; letter-spacing: -.04em; color: var(--fx-ink); font-variant-numeric: tabular-nums; }
.rn-date { font-size: .78rem; line-height: 1.4; color: var(--fx-muted); }
.rn-title { margin: .1rem 0 .35rem; font-size: 1.2rem; font-weight: 700; letter-spacing: -.02em; }
.rn-summary { max-width: 65ch; margin-bottom: .75rem; color: var(--fx-muted); }
.rn-points { max-width: 70ch; margin: 0 0 1.15rem; padding-left: 1.1rem; list-style-type: "–  "; }
.rn-points li::marker { color: var(--fx-accent-strong); }
.rn-points li + li { margin-top: .3rem; }
.rn-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; }
.rn-actions > a { font-weight: 500; color: var(--fx-accent-deep); }
.rn-next { padding-top: 1.1rem; border-top: 1px solid var(--fx-border); }
@media (min-width: 768px) and (max-width: 1199.98px) { .rn-next { grid-column: 2; } }
@media (min-width: 1200px) { .rn-next { padding: 0 0 0 1.75rem; border-top: 0; border-left: 1px solid var(--fx-border); } }
.rn-next-title { margin: .15rem 0 .7rem; font-size: .9rem; font-weight: 600; }
.rn-next ul { list-style: none; margin: 0; padding: 0; }
.rn-next li { font-size: .8rem; line-height: 1.45; color: var(--fx-muted); }
.rn-next li + li { margin-top: .75rem; }
.rn-next strong { display: block; font-size: .875rem; font-weight: 600; color: var(--fx-text); }
.rn-line {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: .25rem .6rem; padding: .7rem 1.1rem;
    background: var(--fx-surface); border: 1px solid var(--fx-border); border-radius: var(--fx-radius); box-shadow: var(--fx-shadow);
    font-size: .85rem; color: var(--fx-muted);
}
.rn-line::before { content: ""; align-self: center; width: 18px; height: 3px; border-radius: 2px; background: var(--fx-accent); }
.rn-line-version { font-weight: 600; color: var(--fx-ink); }
.rn-line-title { color: var(--fx-text); }
.rn-line-all { margin-left: auto; font-weight: 500; color: var(--fx-accent-deep); }

/* /novetats */
.release { display: grid; grid-template-columns: 1fr; gap: .35rem 1.5rem; padding: 1.25rem; scroll-margin-top: calc(var(--fx-topbar) + 1rem); }
.release + .release { border-top: 1px solid var(--fx-border); }
@media (min-width: 576px) { .release { grid-template-columns: 7.5rem 1fr; } }
.release-meta { display: flex; gap: .6rem; align-items: baseline; font-size: .78rem; color: var(--fx-muted); }
@media (min-width: 576px) { .release-meta { flex-direction: column; gap: .15rem; } }
.release-version { font-size: 1.05rem; font-weight: 700; color: var(--fx-ink); font-variant-numeric: tabular-nums; }
.release.is-new .release-version { color: var(--fx-accent-deep); }
.release-title { margin: .2rem 0 .25rem; font-size: 1rem; }
.release-summary { margin-bottom: .5rem; color: var(--fx-muted); }
.release-items { margin: 0; padding-left: 1.1rem; font-size: .85rem; }
.release-items li + li { margin-top: .25rem; }
.release-items li::marker { color: var(--fx-accent); }
.upcoming-list { list-style: none; margin: 0; padding: 0 0 .5rem; }
.upcoming-list li { padding: .55rem 1.25rem; }

/* Configuració › Empresa: logo preview */
.logo-preview {
    display: flex; align-items: center; justify-content: center; min-height: 96px; padding: 1rem;
    background: #f8f9fb; border: 1px dashed var(--fx-border-strong); border-radius: var(--fx-radius);
    font-size: .8rem; color: var(--fx-muted); text-align: center;
}
.logo-preview img { display: block; max-height: 72px; max-width: 100%; width: auto; }

/* ------------------------------------------------- planning: month navigation */
.month-nav { display: flex; align-items: center; gap: .25rem; }
.month-nav-step {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; padding: 0;
    border: 1px solid var(--fx-border-strong); border-radius: var(--fx-radius-xs); background: #fff; color: #4b5563; font-size: 1rem;
}
.month-nav-step:hover { background: var(--fx-ink-soft); color: var(--fx-ink); }
.month-picker-toggle {
    display: inline-flex; align-items: center; gap: .35rem; min-width: 170px; justify-content: center;
    padding: .3rem .6rem; border: 0; border-radius: var(--fx-radius-xs); background: transparent; color: var(--fx-text);
}
.month-picker-toggle:hover, .month-picker-toggle[aria-expanded="true"] { background: var(--fx-ink-soft); }
.month-picker-toggle .card-title { font-size: 1.05rem; }
.month-picker-caret { width: 16px; height: 16px; color: var(--fx-muted); transition: transform .15s ease; }
.month-picker-toggle[aria-expanded="true"] .month-picker-caret { transform: rotate(180deg); }
.month-picker-menu { width: 268px; padding: .75rem; }
.month-picker-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: .6rem; }
.month-picker-head strong { font-size: .95rem; font-variant-numeric: tabular-nums; }
.month-picker-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; }
.month-picker-month {
    display: flex; align-items: center; justify-content: center; height: 36px;
    border: 1px solid transparent; border-radius: var(--fx-radius-xs); color: var(--fx-text); font-size: .85rem; font-weight: 500;
}
.month-picker-month:hover { background: var(--fx-ink-soft); color: var(--fx-text); }
.month-picker-month.is-today { border-color: var(--fx-accent); }
.month-picker-month.is-current { background: var(--fx-accent-strong); border-color: var(--fx-accent-strong); color: #fff; }
.month-picker-foot { margin-top: .6rem; padding-top: .55rem; border-top: 1px solid var(--fx-border); text-align: center; font-size: .8rem; }
.month-picker-foot a { color: var(--fx-accent-deep); font-weight: 500; }

/* ------------------------------------------------- searchable multi-select */
.multiselect-toggle { min-width: 220px; max-width: 280px; text-align: left; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; background-color: #fff; }
.multiselect-toggle.has-value { border-color: var(--fx-accent); color: var(--fx-text); font-weight: 500; }
.multiselect-menu { width: 320px; padding: 0; overflow: hidden; }
.multiselect-search { position: relative; padding: .6rem; border-bottom: 1px solid var(--fx-border); }
.multiselect-search svg { position: absolute; top: 50%; left: 1.2rem; width: 16px; height: 16px; transform: translateY(-50%); color: var(--fx-muted); pointer-events: none; }
.multiselect-search .form-control { padding-left: 2rem; }
.multiselect-list { max-height: 280px; overflow-y: auto; padding: .3rem; scrollbar-width: thin; }
.multiselect-option { display: flex; align-items: center; gap: .6rem; margin: 0; padding: .4rem .5rem; border-radius: var(--fx-radius-xs); cursor: pointer; font-size: .85rem; }
.multiselect-option:hover { background: var(--fx-ink-soft); }
.multiselect-option[hidden] { display: none; }
.multiselect-option .form-check-input { margin: 0; flex: 0 0 auto; }
.multiselect-label { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.multiselect-empty { margin: 0; padding: .75rem; color: var(--fx-muted); font-size: .85rem; text-align: center; }
.multiselect-foot { display: flex; align-items: center; justify-content: space-between; padding: .5rem .6rem; border-top: 1px solid var(--fx-border); background: #fafbfc; }
.multiselect-foot .btn-link { color: var(--fx-muted); text-decoration: none; }
.av-xs { width: 22px; height: 22px; font-size: .55rem; }

/* ------------------------------------------------- contacts, purchases, DocuAI */
@media (min-width: 1200px) { .stats.stats-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.role-choice { display: flex; flex-wrap: wrap; gap: .75rem; }
.role-choice > div { flex: 1 1 220px; padding: .75rem .9rem .5rem; border: 1px solid var(--fx-border-strong); border-radius: var(--fx-radius-xs); background: #fafbfc; }
.role-choice .form-check { margin-bottom: .1rem; }
.role-choice .form-check-label { font-weight: 600; }
.tag-supplier { background: var(--fx-accent-soft); color: var(--fx-accent-deep); }
.chip-count { margin-left: .3rem; padding: 0 .4rem; border-radius: 9px; background: var(--fx-ink-soft-2); color: var(--fx-text); font-size: .7rem; font-weight: 600; font-variant-numeric: tabular-nums; }
.chip-filter a.active .chip-count { background: var(--fx-accent-soft); color: var(--fx-accent-deep); }

.upload-zone { display: flex; flex-wrap: wrap; align-items: center; gap: 1rem 1.25rem; padding: 1rem 1.1rem; border: 1px dashed var(--fx-border-strong); border-radius: var(--fx-radius); background: #fafbfc; }
.upload-zone-icon { display: inline-flex; align-items: center; justify-content: center; flex: 0 0 48px; height: 48px; border-radius: var(--fx-radius); background: var(--fx-accent-soft); color: var(--fx-accent-strong); font-size: 1.4rem; }
.upload-zone-body { flex: 1 1 320px; min-width: 0; }
.upload-zone-body .form-label { font-size: .9rem; font-weight: 600; color: var(--fx-text); }
.upload-zone-body .form-text { margin-bottom: 0; }

.doc-viewer { position: sticky; top: calc(var(--fx-topbar) + 1rem); overflow: hidden; }
.doc-viewer iframe { display: block; width: 100%; height: calc(100vh - var(--fx-topbar) - 3rem); min-height: 520px; border: 0; }
.doc-viewer img { display: block; width: 100%; height: auto; }
@media (max-width: 1199.98px) { .doc-viewer { position: static; } .doc-viewer iframe { height: 70vh; } }

.issue-list { list-style: none; margin: 0; padding: 0 0 .4rem; }
.issue-list li { position: relative; padding: .45rem 1.25rem .45rem 2.1rem; font-size: .85rem; }
.issue-list li::before { content: ""; position: absolute; left: 1.25rem; top: .85rem; width: 7px; height: 7px; border-radius: 50%; background: var(--fx-muted); }
.issue-list .issue-error::before, .issue-list .issue-mismatch::before { background: var(--fx-danger); }
.issue-list .issue-warning::before { background: #d8a23a; }
.issue-list .issue-info::before { background: var(--fx-ink); }
/* Fields DocuAI flagged: an orange rule on the left, like a marker on the paper */
.has-issue .form-control, .has-issue .form-select, .has-issue .combobox-input { border-color: var(--fx-accent); box-shadow: inset 3px 0 0 var(--fx-accent); }
.has-issue .form-label::after { content: " (revisar)"; color: var(--fx-accent-deep); font-weight: 500; }
.has-issue-block > .card { border-color: #fbd3b0; box-shadow: inset 3px 0 0 var(--fx-accent), var(--fx-shadow); }
.review-bar {
    position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem;
    margin: 0 0 1rem; padding: .75rem 1rem; background: rgba(255, 255, 255, .97); border: 1px solid var(--fx-border); border-radius: var(--fx-radius); box-shadow: 0 -4px 16px rgba(16, 24, 40, .06);
}
.extraction-log summary { cursor: pointer; list-style: none; }
.extraction-log summary::-webkit-details-marker { display: none; }
.extraction-log summary .card-title::after { content: " ›"; color: var(--fx-muted); }
.extraction-log[open] summary .card-title::after { content: " ⌄"; }

/* ------------------------------------------------- login: the product's modules
 * Two symmetric columns around the card, each module a white bubble that floats slowly.
 * Decorative (aria-hidden); still with reduced motion; replaced by one line on narrow screens.
 */
.login-stage { position: relative; width: 100%; max-width: 420px; }
.login-modules { display: none; }
.login-modules-caption { max-width: 420px; margin: 1rem 0 0; font-size: .8rem; color: var(--fx-muted); text-align: center; }
@media (min-width: 1140px) {
    .login-modules-caption { display: none; }
    .login-modules {
        position: absolute; top: 2rem; display: flex; flex-direction: column; gap: 2.6rem;
        margin: 0; padding: 0; list-style: none; pointer-events: none;
    }
    .login-modules-left { right: calc(100% + 4.5rem); align-items: center; }
    .login-modules-right { left: calc(100% + 4.5rem); align-items: center; }
    .login-modules li {
        display: flex; flex-direction: column; align-items: center; gap: .6rem; width: 108px;
        opacity: 0; animation: module-in .7s cubic-bezier(.2, .7, .2, 1) forwards, module-float 3s ease-in-out infinite;
        animation-delay: calc(var(--i) * 140ms + 250ms), calc(var(--i) * -2s);
    }
    .login-modules-right li { animation-delay: calc(var(--i) * 140ms + 320ms), calc(var(--i) * -2s - 1s); }
    /* The middle bubble sits further out: the columns draw an arc around the card */
    .login-modules-left li:nth-child(2) { transform: translateX(-3rem); }
    .login-modules-right li:nth-child(2) { transform: translateX(3rem); }
    .module-bubble {
        display: inline-flex; align-items: center; justify-content: center; width: 98px; height: 98px;
        border-radius: 50%; background: var(--fx-surface); border: 1px solid var(--fx-border);
        box-shadow: 0 0 0 5px rgba(var(--fx-accent-rgb), .06), 0 12px 28px rgba(16, 24, 40, .08);
        color: var(--fx-ink); font-size: 1.9rem;
    }
    .module-bubble svg :is(g, path) { stroke-width: 1.6; }
    .module-name { font-size: .8rem; font-weight: 500; color: var(--fx-muted); letter-spacing: .01em; }
}
@keyframes module-in { from { opacity: 0; scale: .9; } to { opacity: 1; scale: 1; } }
@keyframes module-float { 0%, 100% { translate: 0 0; } 50% { translate: 0 -12px; } }
@media (prefers-reduced-motion: reduce) {
    .login-modules li { animation: none !important; opacity: 1; }
}

/* DocuAI: progress of a document being read */
.docuai-progress { display: flex; flex-direction: column; gap: .4rem; }
.docuai-progress .progress { height: 8px; border-radius: 4px; background: var(--fx-ink-soft-2); overflow: hidden; }
.docuai-progress .progress-bar {
    border-radius: 4px; transition: width .6s ease;
    background-color: var(--fx-accent-strong);
    background-image: linear-gradient(90deg, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .35) 50%, rgba(255, 255, 255, 0) 100%);
    background-size: 200% 100%; animation: docuai-shimmer 1.6s linear infinite;
}
.docuai-progress-label { font-size: .8rem; color: var(--fx-muted); font-variant-numeric: tabular-nums; }
.docuai-progress.is-compact { min-width: 170px; gap: .25rem; }
.docuai-progress.is-compact .progress { height: 6px; }
.docuai-progress.is-compact .docuai-progress-label { font-size: .72rem; }
@keyframes docuai-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .docuai-progress .progress-bar { animation: none; transition: none; } }

/* DocuAI review: next to the document there is only half the width, so each line is a small card
   with its labels (same layout as on phones) instead of a cramped table row. */
.review-pane .lines-table thead { display: none; }
.review-pane .lines-table tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem .6rem; padding: .9rem 1rem; border-bottom: 1px solid var(--fx-border); }
.review-pane .lines-table td { display: block; padding: 0 !important; border: 0; }
.review-pane .lines-table td[data-label]::before { content: attr(data-label); display: block; font-size: .7rem; color: var(--fx-muted); margin-bottom: .2rem; }
.review-pane .lines-table td:first-child { grid-column: 1 / -1; }
.review-pane .lines-table td.span-2 { grid-column: span 2; }
.review-pane .lines-table .line-total { padding-top: 1.3rem !important; }
.review-pane .lines-table td:last-child { position: absolute; right: .5rem; top: .5rem; }
.review-pane .lines-table tr { position: relative; }
.review-pane .lines-table td { width: auto !important; min-width: 0 !important; }

/* DocuAI review: larger, easier to read fields and figures */
.review-side { font-size: .95rem; }
.review-side .card-title { font-size: 1.05rem; }
.review-side .form-label { font-size: .85rem; }
.review-side .form-control, .review-side .form-select, .review-side .combobox-input { min-height: 42px; font-size: .95rem; }
.review-pane .lines-table .form-control, .review-pane .lines-table .form-select { min-height: 42px; font-size: .95rem; }
.review-pane .lines-table td[data-label]::before { font-size: .78rem; font-weight: 500; color: #4b5563; }
.review-pane .lines-table .line-total { font-size: 1.05rem; }
.review-pane .lines-table tr { gap: .65rem .75rem; padding: 1rem 1.15rem; }
.review-pane .totals { max-width: 420px; font-size: 1rem; }
.review-pane .totals td { padding: .45rem 0; }
.review-pane .totals td .text-muted, .review-pane .totals .small { font-size: .85rem !important; }
.review-pane .totals .grand td { font-size: 1.3rem; }
.review-pane .meta-list { font-size: .95rem; gap: .55rem 1.5rem; }
.review-pane .table { font-size: .92rem; }
.review-side .issue-list li { font-size: .92rem; }
.review-pane .card-body > .row > [class*="col-lg-"] { flex: 0 0 100%; max-width: 100%; }
.review-pane .totals { margin-left: auto; }
.review-pane .totals td:first-child { white-space: nowrap; }
