/* ============================================================
   Softreis e-Invoice — design system
   ------------------------------------------------------------
   Aesthetic: refined Portuguese institutional. Humanist sans
   throughout (no serif), slate-teal + muted gold palette,
   warm off-white surfaces, ledger-like ruled lines. NOT generic
   Bootstrap, NOT Silicon Valley. Fiscal-document trustworthy.
   ============================================================ */

:root {
    /* —— Color tokens —— */
    --ink-900: #0e1b22;          /* near-black text */
    --ink-700: #213240;
    --ink-500: #4a5b69;          /* secondary text */
    --ink-300: #8a99a6;          /* muted/labels */
    --ink-200: #b8c2cc;          /* hairlines */
    --ink-100: #dfe5ea;          /* dividers */

    --paper-50:  #faf7f1;        /* warm off-white surface */
    --paper-100: #f3eee4;        /* secondary surface */
    --paper-200: #e8e0d0;        /* deep ledger */
    --paper-edge: #e4dccb;       /* margin lines */

    --brand-900: #0d2a33;
    --brand-700: #1c3d4a;        /* primary slate-teal */
    --brand-500: #2c5868;
    --brand-300: #5d8896;
    --brand-50:  #eef3f5;

    --accent-900: #6c4f1f;
    --accent-700: #8a6628;       /* muted gold */
    --accent-500: #b0883f;
    --accent-300: #d9b974;
    --accent-50:  #f6ecd6;

    /* —— Status palette (per doc 05 §) —— */
    --status-draft-bg:        #e8eaed;  --status-draft-fg:        #4a5b69;
    --status-uploaded-bg:     #e8eaed;  --status-uploaded-fg:     #4a5b69;
    --status-queued-bg:       #dbe7f3;  --status-queued-fg:       #1f4d7a;
    --status-processing-bg:   #dbe7f3;  --status-processing-fg:   #1f4d7a;
    --status-delivered-bg:    #d8ead7;  --status-delivered-fg:    #2a5e2c;
    --status-received-bg:     #d8ead7;  --status-received-fg:     #2a5e2c;
    --status-active-bg:       #d8ead7;  --status-active-fg:       #2a5e2c;
    --status-rejected-bg:     #f7e5c4;  --status-rejected-fg:     #7a4d10;
    --status-error-bg:        #f5d4cf;  --status-error-fg:        #7b1e1e;
    --status-suspended-bg:    #ddd0bf;  --status-suspended-fg:    #5a4014;
    --status-cancelled-bg:    #d3d6d9;  --status-cancelled-fg:    #2a3741;
    --status-pending-bg:      #f0e3c8;  --status-pending-fg:      #75551a;

    /* —— Typography —— (sans throughout; --font-display kept as a token so
       headings can carry a distinct weight/tracking without a serif face) */
    --font-display: 'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
    --font-body:    'IBM Plex Sans', 'Helvetica Neue', Arial, sans-serif;
    --font-mono:    'IBM Plex Mono', 'JetBrains Mono', Consolas, monospace;

    --fs-display:  clamp(2rem, 1.4rem + 2.4vw, 3.25rem);
    --fs-h1:       clamp(1.5rem, 1.2rem + 1vw, 2rem);
    --fs-h2:       1.375rem;
    --fs-h3:       1.125rem;
    --fs-body:     0.9375rem;
    --fs-small:    0.8125rem;
    --fs-micro:    0.6875rem;

    --lh-tight:    1.15;
    --lh-snug:     1.35;
    --lh-body:     1.55;

    /* —— Spacing & shape —— */
    --space-1: 0.25rem;
    --space-2: 0.5rem;
    --space-3: 0.75rem;
    --space-4: 1rem;
    --space-5: 1.5rem;
    --space-6: 2rem;
    --space-7: 3rem;
    --space-8: 4.5rem;

    --radius-sm: 2px;
    --radius:    4px;
    --radius-lg: 8px;

    --shadow-1: 0 1px 2px rgba(13, 42, 51, 0.05);
    --shadow-2: 0 6px 18px -8px rgba(13, 42, 51, 0.18), 0 1px 2px rgba(13, 42, 51, 0.05);
    --shadow-3: 0 18px 40px -18px rgba(13, 42, 51, 0.28);

    --motion-fast: 120ms cubic-bezier(0.2, 0.7, 0.3, 1);
    --motion:      220ms cubic-bezier(0.2, 0.7, 0.3, 1);

    /* —— Shell —— */
    --sidebar-w: 248px;
    --topbar-h:  60px;
    --max-content: 1240px;
}

/* ============================================================
   Base & resets layered on top of Bootstrap.
   ============================================================ */
html {
    box-sizing: border-box;
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}
*, *::before, *::after { box-sizing: inherit; }

body {
    font-family: var(--font-body);
    font-size: var(--fs-body);
    line-height: var(--lh-body);
    color: var(--ink-900);
    background: var(--paper-50);
    font-feature-settings: 'ss01', 'cv11';
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
    font-family: var(--font-display);
    font-weight: 500;
    color: var(--ink-900);
    line-height: var(--lh-tight);
    letter-spacing: -0.01em;
    margin: 0 0 var(--space-4);
}
h1 { font-size: var(--fs-h1); font-weight: 600; }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }

p { margin: 0 0 var(--space-4); }

code, kbd, .mono { font-family: var(--font-mono); font-size: 0.9em; }

a { color: var(--brand-700); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent-700); }

hr {
    border: 0;
    border-top: 1px solid var(--paper-edge);
    margin: var(--space-5) 0;
}

/* Reset some Bootstrap defaults so our shell isn't fighting them */
.container, .container-fluid { padding-left: var(--space-5); padding-right: var(--space-5); }

input.form-control, select.form-select, textarea.form-control {
    font-family: var(--font-body);
    font-size: var(--fs-body);
    border-radius: var(--radius);
    border: 1px solid var(--ink-200);
    background: #fff;
    padding: 0.55rem 0.7rem;
    transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
input.form-control:focus, select.form-select:focus, textarea.form-control:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(28, 61, 74, 0.12);
    outline: none;
}
.form-floating > label { color: var(--ink-500); font-size: var(--fs-small); }

/* ============================================================
   Layout shell — admin & pharmacy share the chrome, differ in
   sidebar tone. Each layout sets data-shell="admin|pharmacy".
   ============================================================ */
.app-shell {
    display: grid;
    grid-template-columns: var(--sidebar-w) 1fr;
    min-height: 100vh;
}
.app-shell__sidebar {
    background: var(--brand-900);
    color: var(--paper-100);
    padding: var(--space-5) var(--space-4);
    border-right: 1px solid var(--brand-900);
    position: relative;
}
.app-shell[data-shell="pharmacy"] .app-shell__sidebar {
    background: var(--paper-100);
    color: var(--ink-700);
    border-right: 1px solid var(--paper-edge);
}
.app-shell__sidebar::after {
    /* faint ledger margin line on the inner edge */
    content: "";
    position: absolute;
    inset: var(--space-5) 0 var(--space-5) auto;
    width: 1px;
    background: rgba(255, 255, 255, 0.07);
}
.app-shell[data-shell="pharmacy"] .app-shell__sidebar::after {
    background: var(--paper-edge);
}

.app-brand {
    display: block;
    color: inherit;
    text-decoration: none;
    padding: 0 var(--space-2) var(--space-5);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: var(--space-5);
}
.app-shell[data-shell="pharmacy"] .app-brand {
    border-bottom-color: var(--paper-edge);
}
.app-brand__mark {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.25rem;
    letter-spacing: -0.01em;
    line-height: 1.1;
    display: block;
}
.app-brand__role {
    font-family: var(--font-mono);
    font-size: var(--fs-micro);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--accent-300);
    margin-top: var(--space-2);
    display: block;
}
.app-shell[data-shell="pharmacy"] .app-brand__role { color: var(--accent-700); }

.app-nav { display: flex; flex-direction: column; gap: 2px; }
.app-nav__section {
    font-family: var(--font-mono);
    font-size: var(--fs-micro);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    color: var(--ink-300);
    padding: var(--space-4) var(--space-2) var(--space-2);
}
.app-shell[data-shell="admin"] .app-nav__section { color: rgba(255, 255, 255, 0.45); }

.app-nav__link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.55rem var(--space-3);
    color: inherit;
    text-decoration: none;
    border-radius: var(--radius);
    font-size: var(--fs-body);
    transition: background var(--motion-fast), color var(--motion-fast);
    border-left: 2px solid transparent;
}
.app-nav__link:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--paper-50);
}
.app-shell[data-shell="pharmacy"] .app-nav__link:hover {
    background: var(--paper-200);
    color: var(--ink-900);
}
.app-nav__link.active {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    border-left-color: var(--accent-500);
    font-weight: 500;
}
.app-shell[data-shell="pharmacy"] .app-nav__link.active {
    background: #fff;
    color: var(--brand-900);
    border-left-color: var(--brand-700);
    box-shadow: var(--shadow-1);
}

.app-shell__main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    background: var(--paper-50);
}
.app-topbar {
    height: var(--topbar-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 var(--space-6);
    border-bottom: 1px solid var(--paper-edge);
    background: rgba(250, 247, 241, 0.85);
    backdrop-filter: blur(8px);
    position: sticky;
    top: 0;
    z-index: 10;
}
.app-topbar__crumbs {
    font-family: var(--font-mono);
    font-size: var(--fs-small);
    color: var(--ink-500);
    letter-spacing: 0.02em;
}
.app-topbar__crumbs span + span::before {
    content: "›";
    margin: 0 var(--space-2);
    color: var(--ink-300);
}

.app-shell__content {
    padding: var(--space-6) var(--space-6) var(--space-8);
    max-width: var(--max-content);
    width: 100%;
    margin: 0 auto;
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-shell__sidebar {
        position: fixed;
        inset: 0 30% 0 0;
        z-index: 20;
        transform: translateX(-100%);
        transition: transform var(--motion);
    }
    .app-shell[data-open="true"] .app-shell__sidebar { transform: translateX(0); }
    .app-shell__content { padding: var(--space-5) var(--space-4) var(--space-7); }
}

/* ============================================================
   Component primitives
   ============================================================ */

/* PageHeader */
.ds-pageheader {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: var(--space-5);
    padding-bottom: var(--space-5);
    margin-bottom: var(--space-6);
    border-bottom: 1px solid var(--paper-edge);
    position: relative;
}
.ds-pageheader::before {
    content: "";
    position: absolute;
    left: 0;
    bottom: -1px;
    width: 56px;
    height: 2px;
    background: var(--accent-700);
}
.ds-pageheader__eyebrow {
    font-family: var(--font-mono);
    font-size: var(--fs-micro);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--ink-300);
    margin-bottom: var(--space-2);
}
.ds-pageheader__title {
    font-family: var(--font-display);
    font-size: var(--fs-h1);
    font-weight: 600;
    margin: 0;
    color: var(--ink-900);
}
.ds-pageheader__subtitle {
    margin: var(--space-2) 0 0;
    color: var(--ink-500);
    max-width: 60ch;
}
.ds-pageheader__actions { display: flex; gap: var(--space-3); }

/* Card */
.ds-card {
    background: #fff;
    border: 1px solid var(--paper-edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow-1);
}
.ds-card__head {
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--paper-edge);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-3);
}
.ds-card__title {
    font-family: var(--font-display);
    font-size: var(--fs-h3);
    font-weight: 500;
    margin: 0;
}
.ds-card__body { padding: var(--space-5); }
.ds-card__foot {
    padding: var(--space-3) var(--space-5);
    border-top: 1px solid var(--paper-edge);
    background: var(--paper-50);
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
}

/* StatusBadge */
.ds-badge {
    display: inline-flex;
    align-items: center;
    gap: var(--space-2);
    font-family: var(--font-mono);
    font-size: var(--fs-micro);
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius);
    background: var(--status-draft-bg);
    color: var(--status-draft-fg);
    white-space: nowrap;
    line-height: 1;
}
.ds-badge::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7;
}
.ds-badge--Draft        { background: var(--status-draft-bg);     color: var(--status-draft-fg); }
.ds-badge--Uploaded     { background: var(--status-uploaded-bg);  color: var(--status-uploaded-fg); }
.ds-badge--Queued       { background: var(--status-queued-bg);    color: var(--status-queued-fg); }
.ds-badge--Processing   { background: var(--status-processing-bg);color: var(--status-processing-fg); }
.ds-badge--Delivered    { background: var(--status-delivered-bg); color: var(--status-delivered-fg); }
.ds-badge--Received     { background: var(--status-received-bg);  color: var(--status-received-fg); }
.ds-badge--Active       { background: var(--status-active-bg);    color: var(--status-active-fg); }
.ds-badge--Rejected     { background: var(--status-rejected-bg);  color: var(--status-rejected-fg); }
.ds-badge--Error        { background: var(--status-error-bg);     color: var(--status-error-fg); }
.ds-badge--Suspended    { background: var(--status-suspended-bg); color: var(--status-suspended-fg); }
.ds-badge--Cancelled    { background: var(--status-cancelled-bg); color: var(--status-cancelled-fg); }
.ds-badge--PendingSierApproval     { background: var(--status-pending-bg); color: var(--status-pending-fg); }
.ds-badge--SierApproved            { background: var(--status-uploaded-bg); color: var(--status-uploaded-fg); }
.ds-badge--SierRejected            { background: var(--status-rejected-bg); color: var(--status-rejected-fg); }
.ds-badge--SaphetyClientCreated    { background: var(--status-processing-bg); color: var(--status-processing-fg); }
.ds-badge--PendingTermsAcceptance  { background: var(--status-pending-bg); color: var(--status-pending-fg); }

/* DataTable */
.ds-table-wrap {
    border: 1px solid var(--paper-edge);
    border-radius: var(--radius);
    background: #fff;
    overflow: hidden;
    box-shadow: var(--shadow-1);
}
.ds-table {
    width: 100%;
    border-collapse: collapse;
    font-size: var(--fs-body);
}
.ds-table thead th {
    background: var(--paper-100);
    color: var(--ink-500);
    font-weight: 500;
    text-align: left;
    padding: var(--space-3) var(--space-4);
    font-family: var(--font-mono);
    font-size: var(--fs-micro);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    border-bottom: 1px solid var(--paper-edge);
}
.ds-table tbody td {
    padding: var(--space-3) var(--space-4);
    border-bottom: 1px solid var(--paper-edge);
    color: var(--ink-700);
    vertical-align: middle;
}
.ds-table tbody tr:last-child td { border-bottom: 0; }
.ds-table tbody tr:hover { background: var(--paper-50); }
.ds-table .ds-table__id { font-family: var(--font-mono); color: var(--ink-500); font-size: var(--fs-small); }
.ds-table .ds-table__num { font-family: var(--font-mono); text-align: right; font-variant-numeric: tabular-nums; }
.ds-table caption { caption-side: top; text-align: left; padding: var(--space-2) var(--space-4); color: var(--ink-500); font-size: var(--fs-small); }

/* FormField */
.ds-field { display: flex; flex-direction: column; gap: var(--space-2); margin-bottom: var(--space-4); }
.ds-field__label {
    font-size: var(--fs-small);
    color: var(--ink-700);
    font-weight: 500;
    letter-spacing: 0.01em;
}
.ds-field__label .ds-field__required { color: var(--accent-700); margin-left: 2px; }
.ds-field__hint { font-size: var(--fs-small); color: var(--ink-500); }
.ds-field__error { font-size: var(--fs-small); color: var(--status-error-fg); }
.ds-field input,
.ds-field select,
.ds-field textarea { width: 100%; }

/* Design-system input — used where we render bare <input>/<select> (e.g. the
   cliente invoice filters) instead of a Bootstrap .form-control. */
.ds-input {
    width: 100%;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    color: var(--ink-900);
    border-radius: var(--radius);
    border: 1px solid var(--ink-200);
    background: #fff;
    padding: 0.5rem 0.65rem;
    transition: border-color var(--motion-fast), box-shadow var(--motion-fast);
}
.ds-input:focus {
    border-color: var(--brand-500);
    box-shadow: 0 0 0 3px rgba(28, 61, 74, 0.12);
    outline: none;
}

/* Button */
.ds-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-2);
    font-family: var(--font-body);
    font-size: var(--fs-body);
    font-weight: 500;
    line-height: 1;
    padding: 0.6rem 1rem;
    border-radius: var(--radius);
    border: 1px solid transparent;
    cursor: pointer;
    transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast), transform var(--motion-fast);
    text-decoration: none;
}
.ds-btn:active { transform: translateY(1px); }
.ds-btn:focus-visible { outline: 2px solid var(--brand-500); outline-offset: 2px; }
.ds-btn--primary { background: var(--brand-700); color: #fff; }
.ds-btn--primary:hover { background: var(--brand-900); color: #fff; }
.ds-btn--secondary { background: #fff; color: var(--brand-700); border-color: var(--ink-200); }
.ds-btn--secondary:hover { border-color: var(--brand-500); color: var(--brand-900); }
.ds-btn--accent { background: var(--accent-700); color: #fff; }
.ds-btn--accent:hover { background: var(--accent-900); }
.ds-btn--danger { background: var(--status-error-fg); color: #fff; }
.ds-btn--danger:hover { filter: brightness(1.08); }
.ds-btn--ghost { background: transparent; color: var(--brand-700); }
.ds-btn--ghost:hover { background: var(--brand-50); }
.ds-btn--sm { padding: 0.4rem 0.7rem; font-size: var(--fs-small); }
/* Inert button rendered as a <span> (e.g. a disabled pagination control). */
.ds-btn--disabled { opacity: 0.45; pointer-events: none; cursor: default; }

/* EmptyState */
.ds-empty {
    text-align: center;
    padding: var(--space-7) var(--space-5);
    border: 1px dashed var(--paper-edge);
    border-radius: var(--radius);
    background: #fff;
}
.ds-empty__title {
    font-family: var(--font-display);
    font-size: var(--fs-h3);
    margin: 0 0 var(--space-2);
}
.ds-empty__desc { color: var(--ink-500); margin: 0 auto var(--space-5); max-width: 48ch; }

/* UserMenu (CSS-only via <details>) */
.ds-usermenu { position: relative; }
.ds-usermenu summary {
    list-style: none;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: var(--space-3);
    padding: 0.4rem var(--space-3);
    border-radius: var(--radius);
    border: 1px solid transparent;
    transition: background var(--motion-fast), border-color var(--motion-fast);
}
.ds-usermenu summary::-webkit-details-marker { display: none; }
.ds-usermenu summary:hover { background: var(--paper-100); border-color: var(--paper-edge); }
.ds-usermenu[open] summary { background: var(--paper-100); border-color: var(--paper-edge); }
.ds-usermenu__avatar {
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--brand-700);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.85rem;
    letter-spacing: 0;
}
.ds-usermenu__meta { display: flex; flex-direction: column; line-height: 1.2; }
.ds-usermenu__name { font-size: var(--fs-small); color: var(--ink-900); font-weight: 500; }
.ds-usermenu__role { font-size: var(--fs-micro); color: var(--ink-500); font-family: var(--font-mono); text-transform: uppercase; letter-spacing: 0.1em; }
.ds-usermenu__panel {
    position: absolute;
    right: 0;
    top: calc(100% + 6px);
    min-width: 220px;
    background: #fff;
    border: 1px solid var(--paper-edge);
    border-radius: var(--radius);
    box-shadow: var(--shadow-3);
    padding: var(--space-2);
    z-index: 30;
}
.ds-usermenu__item {
    display: block;
    padding: 0.5rem var(--space-3);
    color: var(--ink-700);
    text-decoration: none;
    font-size: var(--fs-body);
    border-radius: var(--radius-sm);
}
.ds-usermenu__item:hover { background: var(--paper-100); color: var(--ink-900); }
.ds-usermenu__divider { height: 1px; background: var(--paper-edge); margin: var(--space-2) 0; border: 0; }

/* Page-level helpers */
.ds-grid-3 { display: grid; gap: var(--space-5); grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ds-stat {
    background: #fff;
    border: 1px solid var(--paper-edge);
    border-radius: var(--radius);
    padding: var(--space-5);
    position: relative;
    overflow: hidden;
}
.ds-stat::before {
    content: "";
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--brand-700);
}
.ds-stat__label {
    font-family: var(--font-mono);
    font-size: var(--fs-micro);
    text-transform: uppercase;
    letter-spacing: 0.12em;
    color: var(--ink-500);
    margin-bottom: var(--space-2);
}
.ds-stat__value {
    font-family: var(--font-display);
    font-size: 2rem;
    font-weight: 600;
    color: var(--ink-900);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.ds-stat__hint { color: var(--ink-500); font-size: var(--fs-small); margin-top: var(--space-2); }

/* Stagger page reveal */
@keyframes ds-rise {
    from { opacity: 0; transform: translateY(6px); }
    to   { opacity: 1; transform: none; }
}
.app-shell__content > * { animation: ds-rise 360ms var(--motion) both; }
.app-shell__content > *:nth-child(2) { animation-delay: 60ms; }
.app-shell__content > *:nth-child(3) { animation-delay: 120ms; }
.app-shell__content > *:nth-child(4) { animation-delay: 180ms; }

/* Auth pages — split lockup with brand panel */
.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(360px, 480px);
    background: var(--paper-50);
}
.auth-shell__brand {
    background: linear-gradient(135deg, var(--brand-900) 0%, var(--brand-700) 100%);
    color: var(--paper-100);
    padding: var(--space-8) var(--space-6);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    position: relative;
    overflow: hidden;
}
.auth-shell__brand::after {
    /* Decorative ledger lines */
    content: "";
    position: absolute;
    inset: 0;
    background-image: repeating-linear-gradient(
        to bottom,
        transparent 0,
        transparent 31px,
        rgba(255, 255, 255, 0.04) 31px,
        rgba(255, 255, 255, 0.04) 32px);
    pointer-events: none;
}
.auth-shell__brand-mark {
    font-family: var(--font-display);
    font-size: var(--fs-display);
    font-weight: 600;
    line-height: 1;
    letter-spacing: -0.02em;
    position: relative;
}
.auth-shell__brand-sub {
    font-family: var(--font-mono);
    font-size: var(--fs-small);
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--accent-300);
    margin-top: var(--space-3);
    position: relative;
}
.auth-shell__brand-pitch {
    font-family: var(--font-display);
    font-size: 1.5rem;
    font-weight: 400;
    line-height: 1.35;
    max-width: 28ch;
    color: var(--paper-50);
    position: relative;
}
.auth-shell__brand-foot {
    font-family: var(--font-mono);
    font-size: var(--fs-micro);
    color: rgba(255, 255, 255, 0.55);
    letter-spacing: 0.12em;
    text-transform: uppercase;
    position: relative;
}
.auth-shell__panel {
    padding: var(--space-7) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--paper-50);
}
.auth-form {
    width: 100%;
    max-width: 360px;
}
.auth-form h1 {
    font-family: var(--font-display);
    font-size: 1.75rem;
    font-weight: 600;
    margin: 0 0 var(--space-2);
}
.auth-form__sub { color: var(--ink-500); margin-bottom: var(--space-6); }
.auth-form__actions { margin-top: var(--space-5); }
.auth-form__links {
    font-size: var(--fs-small);
    color: var(--ink-500);
    margin-top: var(--space-5);
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

@media (max-width: 800px) {
    .auth-shell { grid-template-columns: 1fr; }
    .auth-shell__brand { padding: var(--space-6); }
    .auth-shell__brand-mark { font-size: 2.5rem; }
}

/* ============================================================
   Print — cliente surface. Ctrl+P should yield a clean document:
   no top nav / "Estado" link, no filter controls, no pagination
   buttons. A compact pharmacy header replaces the chrome bar so
   the printout is self-identifying. Scoped to .cliente-shell so
   the admin console is unaffected.
   ============================================================ */
@media print {
    body { background: #fff; }

    /* Drop the top chrome bar (brand, Estado/Faturas nav, Sair). */
    .cliente-shell__topbar { display: none !important; }

    /* Relevant print header: pharmacy identity instead of the nav strip. */
    .cliente-print-head {
        display: flex !important;
        align-items: baseline;
        gap: var(--space-3);
        padding: 0 0 var(--space-3);
        margin-bottom: var(--space-5);
        border-bottom: 2px solid var(--ink-900);
    }
    .cliente-print-head__name { font-weight: 700; font-size: 1.15rem; color: var(--ink-900); }
    .cliente-print-head__nif {
        font-family: var(--font-mono);
        font-size: var(--fs-small);
        color: var(--ink-700);
    }

    /* Interactive-only controls — never put them on paper. */
    .cliente-shell .invoice-filters,
    .cliente-shell .invoice-pagination { display: none !important; }

    /* Action buttons (Voltar, Abrir, downloads, Limpar) are useless printed. */
    .cliente-shell .ds-btn { display: none !important; }

    /* Flatten surfaces for ink economy; keep cards/rows intact across pages. */
    .cliente-shell__content { padding: 0; max-width: none; margin: 0; }
    .cliente-shell .ds-card { box-shadow: none; border-color: var(--ink-200); break-inside: avoid; }
    .cliente-shell .ds-table-wrap { box-shadow: none; }
    .cliente-shell .ds-table tbody tr { break-inside: avoid; }
    .app-shell__content > *,
    .cliente-shell__content > * { animation: none !important; }
}
