/* ============================================================
   Bejota · hoja de estilos principal
   Diseño: boutique cálida, editorial y mobile-first.
   ============================================================ */

:root {
    --bg: #f6f1ea;
    --bg-deep: #efe6da;
    --surface: #fffdfb;
    --surface-2: #fbf7f1;
    --surface-3: #f1e8dc;
    --ink: #241e1a;
    --ink-soft: #5f554d;
    --muted: #8b7e72;
    --line: #e7dccf;
    --line-strong: #d8c9b8;
    --brand: #b4532a;
    --brand-dark: #8f3f21;
    --brand-soft: #f7e4d8;
    --brand-wash: #fbf1eb;
    --sage: #5f7161;
    --sage-soft: #e8ede4;
    --gold: #a97b1f;
    --gold-soft: #f8edd4;
    --blue: #4d6d8a;
    --blue-soft: #e7eef5;
    --red: #a23f33;
    --red-soft: #f8e4e0;
    --sidebar: #211c18;
    --sidebar-2: #2b241e;
    --sidebar-text: #d8cec3;
    --sidebar-muted: #918579;
    --shadow-sm: 0 1px 2px rgba(46, 33, 21, .05), 0 8px 24px -18px rgba(46, 33, 21, .35);
    --shadow-md: 0 18px 48px -28px rgba(46, 33, 21, .4);
    --shadow-lg: 0 32px 80px -40px rgba(35, 24, 15, .5);
    --radius: 18px;
    --radius-sm: 12px;
    --radius-xs: 9px;
    --font-sans: "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
    --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, "Times New Roman", serif;
    --font-mono: ui-monospace, "Cascadia Mono", "Segoe UI Mono", Consolas, monospace;
    --nav-height: 66px;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

[hidden] {
    display: none !important;
}

html {
    -webkit-text-size-adjust: 100%;
    scroll-behavior: smooth;
}

body {
    margin: 0;
    min-height: 100vh;
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(900px 500px at 88% -10%, rgba(180, 83, 42, .07), transparent 60%),
        radial-gradient(700px 400px at -10% 100%, rgba(95, 113, 97, .06), transparent 60%);
    pointer-events: none;
}

h1, h2, h3, h4, p, dl, dd, figure {
    margin: 0;
}

a {
    color: var(--brand-dark);
    text-decoration: none;
}

a:hover {
    color: var(--brand);
}

img {
    max-width: 100%;
    display: block;
}

button {
    font: inherit;
    color: inherit;
}

input, select, textarea {
    font: inherit;
}

svg.icon {
    flex: 0 0 auto;
}

::selection {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

:focus-visible {
    outline: 2px solid var(--brand);
    outline-offset: 2px;
}

.skip-link {
    position: fixed;
    top: 12px;
    left: 12px;
    z-index: 200;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--ink);
    color: #fff;
    transform: translateY(-180%);
    transition: transform .2s;
}

.skip-link:focus {
    transform: none;
    color: #fff;
}

/* ---------------- Layout ---------------- */

.app-shell {
    display: grid;
    grid-template-columns: 264px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 22px;
    padding: 26px 18px 18px;
    background:
        radial-gradient(420px 280px at 20% 0%, rgba(180, 83, 42, .18), transparent 65%),
        linear-gradient(180deg, #241e19 0%, #1d1814 100%);
    color: var(--sidebar-text);
    z-index: 70;
    overflow-y: auto;
    scrollbar-width: thin;
}

.brand {
    display: inline-flex;
    align-items: center;
    gap: 11px;
    color: inherit;
    padding: 2px 4px;
}

.brand:hover {
    color: inherit;
}

.brand__mark {
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    display: grid;
    place-items: center;
    border-radius: 13px;
    background: linear-gradient(145deg, #cf784f, #a94a25);
    color: #fff9f3;
    font-family: var(--font-display);
    font-size: 25px;
    line-height: 1;
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, .25), 0 8px 20px -8px rgba(0, 0, 0, .6);
}

.brand__mark--sm {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    font-size: 18px;
}

.brand__text {
    display: flex;
    flex-direction: column;
    line-height: 1.15;
}

.brand__text strong {
    font-family: var(--font-display);
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -.01em;
    color: #fdf9f4;
}

.brand__text small {
    font-size: 10px;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: var(--sidebar-muted);
    margin-top: 3px;
}

.brand--light .brand__text strong {
    color: #fdf9f4;
}

.sidebar__close {
    display: none;
    position: absolute;
    top: 20px;
    right: 14px;
    width: 34px;
    height: 34px;
    padding: 0;
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: 9px;
    background: rgba(255, 255, 255, .06);
    color: #d8cec3;
    cursor: pointer;
}

.sidebar__close:hover {
    background: rgba(255, 255, 255, .12);
    color: #fff;
}

.nav {
    display: flex;
    flex-direction: column;
    gap: 3px;
}

.nav__label {
    margin: 16px 10px 7px;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: #7d7166;
}

.nav__label:first-child {
    margin-top: 0;
}

.nav__item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 10px 11px;
    border-radius: 10px;
    color: #c8bdb1;
    font-size: 13.5px;
    font-weight: 500;
    transition: background .16s, color .16s, transform .16s;
}

.nav__item .icon {
    color: #9c8f81;
    transition: color .16s;
}

.nav__item:hover {
    background: rgba(255, 255, 255, .055);
    color: #fffaf4;
}

.nav__item:hover .icon {
    color: #e6b397;
}

.nav__item.is-active {
    background: linear-gradient(100deg, rgba(180, 83, 42, .28), rgba(180, 83, 42, .1));
    color: #fffaf4;
    box-shadow: inset 0 0 0 1px rgba(214, 139, 103, .2);
}

.nav__item.is-active::before {
    content: "";
    position: absolute;
    left: -7px;
    top: 50%;
    width: 3px;
    height: 20px;
    transform: translateY(-50%);
    border-radius: 3px;
    background: #d98a63;
}

.nav__item.is-active .icon {
    color: #e6a07b;
}

.nav__count {
    margin-left: auto;
    min-width: 21px;
    height: 19px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, .12);
    color: #f1e7dc;
    font-size: 10.5px;
    font-weight: 700;
    display: grid;
    place-items: center;
}

.nav__item.is-active .nav__count {
    background: rgba(255, 255, 255, .2);
}

.sidebar__demo {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: auto;
    padding: 9px 11px;
    border-radius: 10px;
    border: 1px dashed rgba(217, 138, 99, .3);
    background: rgba(180, 83, 42, .1);
    color: #ddb49d;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .02em;
}

.sidebar__user {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 12px 10px;
    border-top: 1px solid rgba(255, 255, 255, .08);
}

.sidebar__user-info {
    min-width: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.sidebar__user-info strong {
    font-size: 12.5px;
    color: #f5eee6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.sidebar__user-info small {
    font-size: 10.5px;
    color: var(--sidebar-muted);
    margin-top: 2px;
}

.sidebar__user .icon-btn {
    width: 30px;
    height: 30px;
}

.app-main {
    display: flex;
    flex-direction: column;
    min-width: 0;
    min-height: 100vh;
}

.content {
    width: 100%;
    max-width: 1440px;
    margin: 0 auto;
    padding: 30px 34px 64px;
    flex: 1;
}

.topbar {
    display: none;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    height: var(--nav-height);
    padding: 0 16px;
    background: rgba(250, 246, 240, .88);
    backdrop-filter: blur(14px);
    border-bottom: 1px solid rgba(216, 201, 184, .55);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar__brand {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 600;
    color: var(--ink);
}

.topbar__brand:hover {
    color: var(--ink);
}

.topbar__actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.sidebar-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 65;
    background: rgba(25, 18, 12, .45);
    backdrop-filter: blur(2px);
    opacity: 0;
    transition: opacity .2s;
}

.app-footer {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 34px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 11.5px;
    letter-spacing: .02em;
}

.mobile-nav {
    display: none;
}

/* ---------------- Typography & headings ---------------- */

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .18em;
    text-transform: uppercase;
    color: var(--brand);
}

.eyebrow--light {
    color: #d99a77;
}

.page-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 26px;
}

.page-head__main {
    min-width: 0;
}

.page-head h1 {
    font-family: var(--font-display);
    font-size: clamp(28px, 3.2vw, 40px);
    font-weight: 500;
    letter-spacing: -.02em;
    line-height: 1.1;
    margin-top: 5px;
    color: var(--ink);
}

.page-head h1 em {
    font-style: italic;
    color: var(--brand);
}

.page-head__sub {
    margin-top: 7px;
    color: var(--ink-soft);
    font-size: 13.5px;
    max-width: 620px;
}

.page-head__actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
}

.section-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 14px;
}

.section-heading h2 {
    font-family: var(--font-display);
    font-size: 23px;
    font-weight: 600;
    letter-spacing: -.01em;
}

.section-heading p {
    color: var(--muted);
    font-size: 12.5px;
    margin-top: 3px;
}

.muted {
    color: var(--muted);
}

.ink-soft {
    color: var(--ink-soft);
}

.small {
    font-size: 12px;
}

.tiny {
    font-size: 11px;
}

.strong {
    font-weight: 700;
}

.num {
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.text-right {
    text-align: right;
}

.text-center {
    text-align: center;
}

.nowrap {
    white-space: nowrap;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ---------------- Buttons ---------------- */

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 40px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 11px;
    background: transparent;
    color: var(--ink);
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.2;
    cursor: pointer;
    transition: background .16s, color .16s, border-color .16s, transform .16s, box-shadow .16s;
    text-align: center;
    white-space: nowrap;
}

.btn:active {
    transform: translateY(1px);
}

.btn:disabled {
    opacity: .55;
    cursor: not-allowed;
}

.btn--primary {
    background: linear-gradient(140deg, var(--brand) 0%, #a64823 100%);
    color: #fffaf6;
    border-color: rgba(120, 50, 22, .3);
    box-shadow: 0 8px 20px -12px rgba(143, 63, 33, .8);
}

.btn--primary:hover {
    color: #fff;
    background: linear-gradient(140deg, #bd5b31 0%, #924020 100%);
    box-shadow: 0 12px 24px -12px rgba(143, 63, 33, .8);
}

.btn--ghost {
    background: var(--surface);
    border-color: var(--line-strong);
    color: var(--ink-soft);
}

.btn--ghost:hover {
    border-color: var(--brand);
    color: var(--brand-dark);
    background: var(--brand-wash);
}

.btn--soft {
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.btn--soft:hover {
    background: #f2d6c5;
    color: var(--brand-dark);
}

.btn--danger {
    background: var(--red-soft);
    color: var(--red);
    border-color: #efc9c2;
}

.btn--danger:hover {
    background: #f3d3cd;
    color: var(--red);
}

.btn--dark {
    background: var(--ink);
    color: #fff;
}

.btn--dark:hover {
    background: #352c25;
    color: #fff;
}

.btn--sm {
    min-height: 32px;
    padding: 6px 11px;
    font-size: 12px;
    border-radius: 8px;
    gap: 6px;
}

.btn--lg {
    min-height: 48px;
    padding: 12px 22px;
    font-size: 14.5px;
    border-radius: 12px;
}

.btn--block {
    width: 100%;
}

.btn--icon {
    width: 40px;
    padding: 0;
}

.icon-btn {
    display: inline-grid;
    place-items: center;
    width: 36px;
    height: 36px;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: rgba(255, 253, 251, .8);
    color: var(--ink-soft);
    cursor: pointer;
    transition: background .16s, color .16s, border-color .16s;
    flex: 0 0 auto;
}

.icon-btn:hover {
    background: var(--brand-wash);
    border-color: var(--brand-soft);
    color: var(--brand-dark);
}

.icon-btn--solid {
    background: var(--brand);
    border-color: var(--brand);
    color: #fff;
}

.icon-btn--solid:hover {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    color: #fff;
}

.icon-btn--dark {
    border-color: rgba(255, 255, 255, .1);
    background: rgba(255, 255, 255, .05);
    color: #c2b6a9;
}

.icon-btn--dark:hover {
    background: rgba(255, 255, 255, .11);
    color: #f6ede4;
}

.inline-form {
    display: inline-flex;
    margin: 0;
}

.link-more {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 12px;
    font-weight: 600;
    color: var(--brand-dark);
}

.link-more:hover {
    gap: 7px;
}

/* ---------------- Cards & grids ---------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.card__head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 19px 22px 0;
}

.card__head h2,
.card__head h3 {
    font-size: 15.5px;
    font-weight: 700;
    letter-spacing: -.01em;
}

.card__head p {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.card__body {
    padding: 20px 22px;
}

.card__body--flush {
    padding: 0;
}

.card__foot {
    padding: 15px 22px;
    border-top: 1px solid var(--line);
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    font-size: 12.5px;
    color: var(--muted);
}

.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));
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.cluster {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 9px;
}

.spread {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

/* ---------------- KPI ---------------- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 15px;
    margin-bottom: 20px;
}

.kpi {
    position: relative;
    overflow: hidden;
    padding: 19px 19px 17px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}

.kpi::after {
    content: "";
    position: absolute;
    width: 120px;
    height: 120px;
    right: -55px;
    top: -65px;
    border-radius: 50%;
    background: var(--brand-wash);
    opacity: .8;
}

.kpi--sage::after { background: var(--sage-soft); }
.kpi--gold::after { background: var(--gold-soft); }
.kpi--blue::after { background: var(--blue-soft); }

.kpi__top {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.kpi__label {
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .09em;
    text-transform: uppercase;
    color: var(--muted);
}

.kpi__icon {
    display: grid;
    place-items: center;
    width: 36px;
    height: 36px;
    border-radius: 11px;
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.kpi--sage .kpi__icon { background: var(--sage-soft); color: var(--sage); }
.kpi--gold .kpi__icon { background: var(--gold-soft); color: var(--gold); }
.kpi--blue .kpi__icon { background: var(--blue-soft); color: var(--blue); }

.kpi__value {
    position: relative;
    z-index: 1;
    margin-top: 12px;
    font-size: clamp(23px, 2.3vw, 31px);
    font-weight: 700;
    letter-spacing: -.035em;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.kpi__meta {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 7px;
    margin-top: 9px;
    font-size: 11.5px;
    color: var(--muted);
}

.trend {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 7px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    background: var(--sage-soft);
    color: #47604a;
}

.trend--down {
    background: var(--red-soft);
    color: var(--red);
}

.trend--flat {
    background: var(--surface-3);
    color: var(--muted);
}

/* ---------------- Badges ---------------- */

.badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 9px;
    border-radius: 999px;
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .015em;
    line-height: 1.35;
    white-space: nowrap;
    background: var(--surface-3);
    color: var(--ink-soft);
}

.badge--brand { background: var(--brand-soft); color: var(--brand-dark); }
.badge--green { background: var(--sage-soft); color: #456046; }
.badge--amber { background: var(--gold-soft); color: #855d13; }
.badge--blue { background: var(--blue-soft); color: #375b78; }
.badge--red { background: var(--red-soft); color: var(--red); }
.badge--neutral { background: #efe9e2; color: var(--muted); }
.badge--dot::before {
    content: "";
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
}

/* ---------------- Avatars ---------------- */

.avatar {
    display: inline-grid;
    place-items: center;
    width: 38px;
    height: 38px;
    flex: 0 0 auto;
    border-radius: 50%;
    background: linear-gradient(145deg, #f1dfd1, #e6cbb8);
    color: var(--brand-dark);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
    overflow: hidden;
}

.avatar--sm {
    width: 32px;
    height: 32px;
    font-size: 10.5px;
}

.avatar--xs {
    width: 30px;
    height: 30px;
    font-size: 10px;
    border: 1px solid rgba(255, 255, 255, .4);
}

.avatar--lg {
    width: 54px;
    height: 54px;
    font-size: 17px;
}

.avatar--sage { background: var(--sage-soft); color: var(--sage); }
.avatar--gold { background: var(--gold-soft); color: var(--gold); }
.avatar--blue { background: var(--blue-soft); color: var(--blue); }

/* ---------------- Segmented control ---------------- */

.segmented {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 4px;
    background: #ede4d8;
    border-radius: 999px;
    overflow-x: auto;
    max-width: 100%;
    scrollbar-width: none;
}

.segmented::-webkit-scrollbar {
    display: none;
}

.segmented a,
.segmented button {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 7px 13px;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 600;
    white-space: nowrap;
    cursor: pointer;
}

.segmented a:hover,
.segmented button:hover {
    color: var(--brand-dark);
}

.segmented .is-active {
    background: var(--surface);
    color: var(--ink);
    box-shadow: 0 2px 8px -3px rgba(70, 50, 30, .25);
}

/* ---------------- Flash messages ---------------- */

.flash-stack {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-bottom: 20px;
}

.flash {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 11px 13px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    font-size: 13px;
    box-shadow: var(--shadow-sm);
    animation: flash-in .25s ease both;
}

@keyframes flash-in {
    from { opacity: 0; transform: translateY(-6px); }
    to { opacity: 1; transform: none; }
}

.flash p {
    flex: 1;
    padding-top: 1px;
}

.flash__icon {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    flex: 0 0 auto;
}

.flash--success { background: #f4f8f2; border-color: #dbe7d6; }
.flash--success .flash__icon { background: var(--sage-soft); color: #4b684c; }
.flash--error { background: #fdf4f2; border-color: #efd3cd; }
.flash--error .flash__icon { background: var(--red-soft); color: var(--red); }
.flash--info .flash__icon { background: var(--blue-soft); color: var(--blue); }

.flash__close {
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    padding: 2px;
    line-height: 0;
}

.flash__close:hover {
    color: var(--ink);
}

.pos-toast {
    position: fixed;
    top: 18px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 300;
    width: min(420px, calc(100vw - 32px));
    box-shadow: var(--shadow-lg);
    animation: flash-in .2s ease both;
}

/* ---------------- Tables ---------------- */

.table-wrap {
    width: 100%;
    overflow-x: auto;
}

table.data {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}

table.data th {
    padding: 10px 16px;
    text-align: left;
    font-size: 9.5px;
    font-weight: 700;
    letter-spacing: .11em;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--surface-2);
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}

table.data td {
    padding: 13px 16px;
    border-bottom: 1px solid #f0e8de;
    vertical-align: middle;
}

table.data tbody tr:last-child td {
    border-bottom: 0;
}

table.data tbody tr:hover {
    background: #fcf8f3;
}

.cell-product {
    display: flex;
    align-items: center;
    gap: 11px;
    min-width: 180px;
}

.cell-product__info {
    min-width: 0;
}

.cell-product__info strong {
    display: block;
    font-size: 13px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 240px;
}

.cell-product__info small {
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: .03em;
}

.thumb {
    width: 44px;
    height: 48px;
    flex: 0 0 auto;
    border-radius: 9px;
    overflow: hidden;
    background: var(--surface-3);
    display: grid;
    place-items: center;
    color: var(--brand-dark);
    font-family: var(--font-display);
    font-size: 18px;
    border: 1px solid rgba(216, 201, 184, .55);
}

.thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.thumb--lg {
    width: 84px;
    height: 94px;
    border-radius: 13px;
    font-size: 30px;
}

.row-actions {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: flex-end;
}

.row-actions form {
    display: inline-flex;
    margin: 0;
}

.table-empty {
    padding: 34px 20px;
    text-align: center;
    color: var(--muted);
    font-size: 13px;
}

.table--compact td {
    padding: 10px 16px;
}

.table--compact th {
    padding: 8px 16px;
}

/* ---------------- Forms ---------------- */

.form-card {
    max-width: 940px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}

.form-grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.field--full {
    grid-column: 1 / -1;
}

.field label,
.field > .label {
    font-size: 12px;
    font-weight: 650;
    color: var(--ink-soft);
    letter-spacing: .01em;
}

.field .hint {
    font-size: 11px;
    color: var(--muted);
    line-height: 1.45;
}

.field .error {
    font-size: 11.5px;
    color: var(--red);
    font-weight: 600;
}

.input,
.select,
.textarea {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 10px;
    background: #fdfaf6;
    color: var(--ink);
    font-size: 13.5px;
    transition: border-color .16s, box-shadow .16s, background .16s;
    appearance: none;
}

.input::placeholder,
.textarea::placeholder {
    color: #b0a396;
}

.input:hover,
.select:hover,
.textarea:hover {
    border-color: #c8b6a2;
}

.input:focus,
.select:focus,
.textarea:focus {
    outline: none;
    border-color: var(--brand);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(180, 83, 42, .12);
}

.input:disabled,
.select:disabled {
    background: #f3ede5;
    color: var(--muted);
}

.textarea {
    min-height: 96px;
    resize: vertical;
}

.select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%238b7e72' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 11px center;
    padding-right: 34px;
}

.input-with-icon {
    position: relative;
    display: flex;
    align-items: center;
}

.input-with-icon > .icon {
    position: absolute;
    left: 12px;
    color: var(--muted);
    pointer-events: none;
}

.input-with-icon .input {
    padding-left: 39px;
}

.input-with-icon .input-reveal {
    position: absolute;
    right: 6px;
    width: 32px;
    height: 32px;
    display: grid;
    place-items: center;
    border: 0;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
    border-radius: 7px;
}

.input-with-icon .input-reveal:hover {
    background: var(--surface-3);
    color: var(--ink);
}

.input-prefix {
    position: relative;
    display: flex;
    align-items: center;
}

.input-prefix .prefix {
    position: absolute;
    left: 12px;
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
    pointer-events: none;
}

.input-prefix .input {
    padding-left: 29px;
}

.check-row {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    font-size: 13px;
    color: var(--ink-soft);
}

.check-row input[type="checkbox"],
.check-row input[type="radio"] {
    width: 17px;
    height: 17px;
    margin: 1px 0 0;
    accent-color: var(--brand);
    flex: 0 0 auto;
}

.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: 9px;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--line);
}

.form-actions--split {
    justify-content: space-between;
}

.form-section + .form-section {
    margin-top: 26px;
    padding-top: 24px;
    border-top: 1px solid var(--line);
}

.form-section__title {
    font-family: var(--font-display);
    font-size: 19px;
    font-weight: 600;
    margin-bottom: 4px;
}

.form-section__sub {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 16px;
}

.help-box {
    display: flex;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 11px;
    background: var(--brand-wash);
    border: 1px solid #efdbc9;
    color: #724a33;
    font-size: 12px;
    line-height: 1.5;
}

.help-box .icon {
    margin-top: 1px;
    color: var(--brand);
}

.image-field {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 14px;
}

.image-preview {
    width: 86px;
    height: 96px;
    border-radius: 12px;
    border: 1px dashed var(--line-strong);
    background: var(--surface-2);
    display: grid;
    place-items: center;
    overflow: hidden;
    color: var(--muted);
    font-size: 10px;
    text-align: center;
}

.image-preview img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.file-input {
    font-size: 12px;
    color: var(--ink-soft);
}

.file-input::file-selector-button {
    margin-right: 10px;
    padding: 8px 12px;
    border: 1px solid var(--line-strong);
    border-radius: 8px;
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

/* ---------------- Page-specific: filters ---------------- */

.filter-bar {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}

.filter-bar .field {
    gap: 4px;
    min-width: 140px;
    flex: 1 1 140px;
}

.filter-bar .input,
.filter-bar .select {
    min-height: 36px;
    padding: 7px 10px;
    font-size: 12.5px;
    background: var(--surface);
}

.filter-bar .btn {
    min-height: 36px;
}

.search-field {
    position: relative;
    flex: 2 1 220px;
}

.search-field .icon {
    position: absolute;
    left: 11px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
}

.search-field .input {
    padding-left: 35px;
}

.search-input {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.search-input .icon {
    position: absolute;
    left: 11px;
    color: var(--muted);
    pointer-events: none;
    z-index: 1;
}

.search-input .input {
    padding-left: 35px;
}

/* ---------------- Pagination ---------------- */

.pagination {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 18px;
    border-top: 1px solid var(--line);
    font-size: 12px;
    color: var(--muted);
}

.pagination__links {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-link {
    display: grid;
    place-items: center;
    min-width: 30px;
    height: 30px;
    padding: 0 8px;
    border-radius: 8px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 600;
}

.page-link:hover {
    border-color: var(--brand);
    color: var(--brand-dark);
}

.page-link.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.page-link.is-disabled {
    opacity: .4;
    pointer-events: none;
}

/* ---------------- Empty states ---------------- */

.empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 46px 22px;
    text-align: center;
}

.empty__icon {
    display: grid;
    place-items: center;
    width: 54px;
    height: 54px;
    border-radius: 16px;
    background: var(--surface-3);
    color: var(--brand);
    margin-bottom: 4px;
}

.empty h3 {
    font-family: var(--font-display);
    font-size: 20px;
    font-weight: 600;
}

.empty p {
    color: var(--muted);
    font-size: 12.5px;
    max-width: 340px;
}

.empty .btn {
    margin-top: 8px;
}

/* ---------------- Dashboard ---------------- */

.dash-grid {
    display: grid;
    grid-template-columns: repeat(12, minmax(0, 1fr));
    gap: 17px;
}

.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-12 { grid-column: span 12; }

.chart-card .card__body {
    padding: 14px 18px 16px;
}

.chart {
    width: 100%;
    height: 268px;
    position: relative;
}

.chart--sm {
    height: 210px;
}

.chart svg {
    display: block;
    width: 100%;
    height: 100%;
    overflow: visible;
}

.chart-legend {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 13px;
    font-size: 11px;
    color: var(--muted);
}

.chart-legend span {
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.legend-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--brand);
}

.legend-dot--sage { background: var(--sage); }
.legend-dot--gold { background: var(--gold); }
.legend-dot--blue { background: var(--blue); }

.chart-total {
    display: flex;
    align-items: baseline;
    gap: 8px;
    margin-top: 2px;
}

.chart-total strong {
    font-size: 22px;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.chart-total span {
    color: var(--muted);
    font-size: 11.5px;
}

.legend-list {
    display: flex;
    flex-direction: column;
    gap: 9px;
    margin-top: 14px;
}

.legend-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
}

.legend-row .legend-dot {
    flex: 0 0 auto;
}

.legend-row__label {
    flex: 1;
    min-width: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    color: var(--ink-soft);
}

.legend-row__value {
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.rank-list {
    display: flex;
    flex-direction: column;
    gap: 15px;
    padding: 18px 22px 20px;
}

.rank-item {
    display: grid;
    grid-template-columns: 22px 1fr auto;
    gap: 10px;
    align-items: center;
}

.rank-item__pos {
    font-family: var(--font-display);
    font-size: 17px;
    color: var(--line-strong);
    line-height: 1;
}

.rank-item__body {
    min-width: 0;
}

.rank-item__name {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px;
    font-size: 12.5px;
    font-weight: 600;
}

.rank-item__name span {
    font-weight: 500;
    color: var(--muted);
    font-size: 10.5px;
    white-space: nowrap;
}

.rank-bar {
    height: 5px;
    margin-top: 6px;
    border-radius: 99px;
    background: var(--surface-3);
    overflow: hidden;
}

.rank-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #d8906c, var(--brand));
}

.rank-item__total {
    font-size: 11.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.rank-item__total small {
    display: block;
    color: var(--muted);
    font-size: 9.5px;
    font-weight: 500;
}

.signal-list {
    display: flex;
    flex-direction: column;
}

.signal {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 12px 22px;
    border-bottom: 1px solid #f1e9e0;
    font-size: 12.5px;
}

.signal:last-child {
    border-bottom: 0;
}

.signal__icon {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    flex: 0 0 auto;
    border-radius: 9px;
    background: var(--surface-3);
    color: var(--ink-soft);
}

.signal--amber .signal__icon { background: var(--gold-soft); color: var(--gold); }
.signal--red .signal__icon { background: var(--red-soft); color: var(--red); }
.signal--sage .signal__icon { background: var(--sage-soft); color: var(--sage); }

.signal__body {
    flex: 1;
    min-width: 0;
}

.signal__body strong {
    display: block;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.signal__body small {
    color: var(--muted);
    font-size: 10.5px;
}

.signal__value {
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-soft);
    white-space: nowrap;
}

.dash-split {
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
    gap: 17px;
}

.recent-list {
    display: flex;
    flex-direction: column;
}

.recent-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 11px 18px;
    border-bottom: 1px solid #f2ebe2;
    font-size: 12px;
}

.recent-row:last-child {
    border-bottom: 0;
}

.recent-row__body {
    flex: 1;
    min-width: 0;
}

.recent-row__body strong {
    display: block;
    font-size: 12px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.recent-row__body small {
    color: var(--muted);
    font-size: 10.5px;
}

.recent-row__amount {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.mini-stat-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 11px;
    padding: 18px 22px;
}

.mini-stat {
    padding: 12px;
    border-radius: 11px;
    background: var(--surface-2);
    border: 1px solid #f0e7dc;
}

.mini-stat__label {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 650;
    letter-spacing: .03em;
    text-transform: uppercase;
    color: var(--muted);
}

.mini-stat__value {
    margin-top: 4px;
    font-size: 17px;
    font-weight: 700;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.mini-stat__value--sm {
    font-size: 13px;
    letter-spacing: 0;
}

/* ---------------- POS ---------------- */

.pos-head {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    gap: 14px;
    margin-bottom: 18px;
}

.pos-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 382px;
    gap: 18px;
    align-items: start;
}

.pos-browser {
    min-width: 0;
}

.pos-searchbar {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

.pos-searchbar .search-field {
    flex: 1;
}

.pos-searchbar .input {
    height: 44px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.pos-open-btn {
    display: none;
}

.chip-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 10px;
    scrollbar-width: none;
}

.chip-row::-webkit-scrollbar {
    display: none;
}

.chip {
    flex: 0 0 auto;
    padding: 6px 11px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}

.chip:hover {
    border-color: var(--brand);
    color: var(--brand-dark);
}

.chip.is-active {
    background: var(--ink);
    border-color: var(--ink);
    color: #fff;
}

.product-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 11px;
}

.product-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    overflow: hidden;
    text-align: left;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: transform .15s, box-shadow .15s, border-color .15s;
}

.product-card:hover {
    transform: translateY(-2px);
    border-color: #d6bda9;
    box-shadow: var(--shadow-md);
}

.product-card:active {
    transform: translateY(0);
}

.product-card[disabled] {
    opacity: .5;
    cursor: not-allowed;
    transform: none;
}

.product-card__media {
    position: relative;
    aspect-ratio: 1 / 1.04;
    background:
        radial-gradient(120px 90px at 70% 20%, rgba(255, 255, 255, .8), transparent 70%),
        linear-gradient(150deg, #f3e9dd, #eadccb);
    display: grid;
    place-items: center;
    color: var(--brand-dark);
    font-family: var(--font-display);
    font-size: 31px;
    overflow: hidden;
}

.product-card__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-card__stock {
    position: absolute;
    top: 7px;
    right: 7px;
    padding: 3px 7px;
    border-radius: 999px;
    background: rgba(255, 253, 249, .9);
    backdrop-filter: blur(5px);
    color: var(--ink-soft);
    font-family: var(--font-sans);
    font-size: 9px;
    font-weight: 700;
    letter-spacing: .02em;
}

.product-card__stock--low {
    background: rgba(248, 228, 224, .95);
    color: var(--red);
}

.product-card__body {
    padding: 9px 11px 11px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.product-card__cat {
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--brand);
}

.product-card__name {
    font-size: 12px;
    font-weight: 650;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 31px;
}

.product-card__meta {
    font-size: 10px;
    color: var(--muted);
}

.product-card__foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 6px;
    margin-top: 5px;
}

.product-card__price {
    font-size: 13px;
    font-weight: 750;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.product-card__add {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    border-radius: 7px;
    background: var(--brand-soft);
    color: var(--brand-dark);
}

.pos-cart {
    position: static;
    top: auto;
    display: flex;
    flex-direction: column;
    border-radius: var(--radius);
    background: var(--surface);
    border: 1px solid var(--line);
    box-shadow: var(--shadow-md);
    overflow: visible;
    max-height: none;
}

.pos-cart__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 16px 18px;
    border-bottom: 1px solid var(--line);
    background: var(--surface-2);
}

.pos-cart__head h2 {
    font-family: var(--font-display);
    font-size: 21px;
    font-weight: 600;
}

.pos-cart__count {
    display: inline-grid;
    place-items: center;
    min-width: 22px;
    height: 22px;
    padding: 0 6px;
    border-radius: 999px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 10.5px;
    font-weight: 800;
}

.cart-lines {
    flex: 1;
    overflow-y: auto;
    min-height: 100px;
    max-height: 44vh;
    padding: 4px 0;
}

.cart-line {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 9px;
    align-items: center;
    padding: 10px 15px;
    border-bottom: 1px solid #f3ece3;
}

.cart-line:last-child {
    border-bottom: 0;
}

.cart-line__thumb {
    width: 38px;
    height: 42px;
    border-radius: 8px;
    background: var(--surface-3);
    display: grid;
    place-items: center;
    overflow: hidden;
    font-family: var(--font-display);
    font-size: 15px;
    color: var(--brand-dark);
}

.cart-line__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cart-line__body {
    min-width: 0;
}

.cart-line__name {
    font-size: 11.5px;
    font-weight: 650;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cart-line__meta {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-top: 4px;
    font-size: 9.5px;
    color: var(--muted);
}

.cart-line__price {
    text-align: right;
    font-size: 11px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.cart-line__remove {
    display: inline-grid;
    place-items: center;
    width: 20px;
    height: 20px;
    margin-top: 3px;
    padding: 0;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--muted);
    cursor: pointer;
}

.cart-line__remove:hover {
    background: var(--red-soft);
    color: var(--red);
}

.qty {
    display: inline-flex;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 7px;
    overflow: hidden;
    background: var(--surface);
    height: 24px;
}

.qty button {
    width: 23px;
    height: 100%;
    border: 0;
    background: transparent;
    color: var(--ink-soft);
    cursor: pointer;
    display: grid;
    place-items: center;
    font-size: 13px;
    padding: 0;
}

.qty button:hover {
    background: var(--brand-wash);
    color: var(--brand-dark);
}

.qty span {
    min-width: 19px;
    text-align: center;
    font-size: 10.5px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.cart-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 38px 20px;
    text-align: center;
    color: var(--muted);
}

.cart-empty__icon {
    display: grid;
    place-items: center;
    width: 46px;
    height: 46px;
    border-radius: 14px;
    background: var(--surface-3);
    color: var(--brand);
    margin-bottom: 3px;
}

.cart-empty strong {
    color: var(--ink-soft);
    font-size: 12.5px;
}

.cart-empty span {
    font-size: 11px;
}

.cart-summary {
    padding: 14px 17px;
    background: var(--surface-2);
    border-top: 1px solid var(--line);
}

.summary-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    font-size: 12px;
    color: var(--ink-soft);
    padding: 3px 0;
}

.summary-row strong {
    font-variant-numeric: tabular-nums;
}

.summary-row--total {
    margin-top: 8px;
    padding-top: 10px;
    border-top: 1px dashed var(--line-strong);
    font-size: 13px;
}

.summary-row--total strong {
    font-size: 22px;
    letter-spacing: -.03em;
    color: var(--ink);
}

.cart-discount {
    display: flex;
    align-items: center;
    gap: 7px;
    margin: 8px 0 2px;
}

.cart-discount .input {
    min-height: 34px;
    padding: 6px 9px 6px 29px;
    font-size: 12px;
    background: var(--surface);
}

.cart-discount .btn {
    min-height: 34px;
}

.cart-options {
    display: grid;
    gap: 8px;
    padding: 11px 17px;
    border-top: 1px solid var(--line);
}

.cart-options .input,
.cart-options .select {
    min-height: 36px;
    font-size: 12px;
    padding: 7px 10px;
    background: var(--surface);
}

.cart-submit {
    padding: 0 17px 16px;
}

.pos-note {
    font-size: 10px;
    color: var(--muted);
    text-align: center;
    margin-top: 7px;
}

.promo-banner {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 13px;
    margin-bottom: 12px;
    border-radius: 11px;
    border: 1px dashed #dfb89f;
    background: linear-gradient(100deg, #fdf1e9, #fbf7f1);
    color: #72462e;
    font-size: 11.5px;
}

.promo-banner .icon {
    color: var(--brand);
}

.pos-mobile-bar {
    display: none;
}

.pos-cart-close {
    display: none;
}

/* ---------------- Tickets ---------------- */

.ticket-wrap {
    max-width: 460px;
    margin: 0 auto;
}

.ticket {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.ticket__head {
    padding: 26px 24px 18px;
    text-align: center;
    border-bottom: 1px dashed var(--line-strong);
}

.ticket__brand {
    font-family: var(--font-display);
    font-size: 28px;
    font-weight: 600;
    letter-spacing: .02em;
}

.ticket__tagline {
    color: var(--muted);
    font-size: 10.5px;
    letter-spacing: .14em;
    text-transform: uppercase;
    margin-top: 2px;
}

.ticket__meta {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 3px 12px;
    margin-top: 16px;
    text-align: left;
    font-size: 11.5px;
    color: var(--ink-soft);
}

.ticket__meta span:nth-child(even) {
    text-align: right;
    font-weight: 600;
}

.ticket__body {
    padding: 18px 24px;
}

.ticket-items {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding-bottom: 14px;
    border-bottom: 1px dashed var(--line-strong);
}

.ticket-item {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 10px;
    font-size: 12px;
}

.ticket-item__name {
    font-weight: 600;
}

.ticket-item__meta {
    grid-column: 1;
    color: var(--muted);
    font-size: 10.5px;
}

.ticket-item__amount {
    grid-column: 2;
    grid-row: 1 / span 2;
    align-self: center;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.ticket-totals {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding-top: 14px;
    font-size: 12px;
}

.ticket-totals .summary-row--total strong {
    font-size: 21px;
}

.ticket__foot {
    padding: 18px 24px 24px;
    text-align: center;
    border-top: 1px dashed var(--line-strong);
    color: var(--muted);
    font-size: 11px;
}

.ticket__code {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 10px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--ink-soft);
    background: var(--surface-2);
    padding: 5px 9px;
    border-radius: 7px;
}

.ticket-coupons {
    margin-top: 18px;
    padding: 14px;
    border: 1px dashed #d9ad91;
    border-radius: 12px;
    background: var(--brand-wash);
}

.ticket-coupons h3 {
    font-size: 12px;
    font-weight: 700;
    color: var(--brand-dark);
    display: flex;
    align-items: center;
    gap: 6px;
}

.coupon-code {
    display: inline-block;
    margin-top: 6px;
    padding: 6px 10px;
    border-radius: 7px;
    background: var(--surface);
    border: 1px dashed var(--brand);
    font-family: var(--font-mono);
    font-size: 13px;
    font-weight: 700;
    letter-spacing: .06em;
    color: var(--brand-dark);
}

/* ---------------- Details ---------------- */

.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.detail-list {
    display: grid;
    grid-template-columns: auto 1fr;
    gap: 9px 18px;
    font-size: 12.5px;
}

.detail-list dt {
    color: var(--muted);
}

.detail-list dd {
    font-weight: 600;
    color: var(--ink-soft);
    text-align: right;
}

.product-hero {
    display: flex;
    gap: 18px;
    padding: 20px;
    align-items: flex-start;
}

.product-hero__media {
    width: 120px;
    height: 136px;
    flex: 0 0 auto;
    border-radius: 14px;
    overflow: hidden;
    background: var(--surface-3);
    display: grid;
    place-items: center;
    font-family: var(--font-display);
    font-size: 42px;
    color: var(--brand-dark);
}

.product-hero__media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.product-hero__info {
    min-width: 0;
    flex: 1;
}

.product-hero__info h2 {
    font-family: var(--font-display);
    font-size: 26px;
    line-height: 1.15;
    font-weight: 600;
}

.product-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

.product-hero__price {
    margin-top: 10px;
    font-size: 23px;
    font-weight: 750;
    letter-spacing: -.03em;
}

/* ---------------- Socios ---------------- */

.capital-hero {
    position: relative;
    overflow: hidden;
    padding: 26px 28px;
    border-radius: var(--radius);
    background:
        radial-gradient(600px 300px at 95% -20%, rgba(201, 138, 99, .35), transparent 60%),
        linear-gradient(135deg, #2a221c, #1e1814);
    color: #f8f1e8;
    box-shadow: var(--shadow-md);
    margin-bottom: 18px;
}

.capital-hero::after {
    content: "B";
    position: absolute;
    right: 24px;
    bottom: -52px;
    font-family: var(--font-display);
    font-size: 190px;
    line-height: 1;
    color: rgba(255, 255, 255, .05);
    pointer-events: none;
}

.capital-hero__label {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: .16em;
    text-transform: uppercase;
    color: #cda58b;
}

.capital-hero__amount {
    margin-top: 6px;
    font-family: var(--font-display);
    font-size: clamp(34px, 4vw, 46px);
    font-weight: 500;
    letter-spacing: -.02em;
    font-variant-numeric: tabular-nums;
}

.capital-hero__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 26px;
    margin-top: 18px;
    position: relative;
    z-index: 1;
}

.capital-hero__meta div {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.capital-hero__meta span {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: #a99584;
}

.capital-hero__meta strong {
    font-size: 15px;
    font-weight: 650;
    font-variant-numeric: tabular-nums;
}

.partner-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 14px;
}

.partner-card {
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.partner-card__head {
    display: flex;
    align-items: center;
    gap: 10px;
}

.partner-card__name {
    font-size: 13px;
    font-weight: 700;
    line-height: 1.25;
}

.partner-card__role {
    color: var(--muted);
    font-size: 10.5px;
}

.partner-card__amount {
    margin-top: 14px;
    font-size: 21px;
    font-weight: 750;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
}

.partner-card__share {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    font-size: 10.5px;
    color: var(--muted);
}

.share-bar {
    height: 5px;
    border-radius: 99px;
    background: var(--surface-3);
    overflow: hidden;
    margin-top: 7px;
}

.share-bar span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, #d9a07e, var(--brand));
}

.capital-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    font-size: 11px;
    color: var(--muted);
}

/* ---------------- Promociones & cupones ---------------- */

.promo-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
}

.promo-card {
    position: relative;
    padding: 19px 20px;
    border: 1px solid var(--line);
    border-radius: 15px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
}

.promo-card::before {
    content: "";
    position: absolute;
    right: -18px;
    top: -24px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: var(--brand-wash);
}

.promo-card--off {
    opacity: .68;
}

.promo-card__top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
    position: relative;
    z-index: 1;
}

.promo-card__pct {
    font-family: var(--font-display);
    font-size: 38px;
    font-weight: 500;
    line-height: 1;
    color: var(--brand);
    letter-spacing: -.03em;
}

.promo-card__pct small {
    font-size: 15px;
    letter-spacing: 0;
}

.promo-card h3 {
    margin-top: 6px;
    font-size: 14px;
    font-weight: 700;
    line-height: 1.3;
}

.promo-card__desc {
    margin-top: 7px;
    color: var(--muted);
    font-size: 11.5px;
    line-height: 1.45;
}

.promo-card__meta {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 12px;
    font-size: 10.5px;
    color: var(--muted);
}

.promo-card__product {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 13px;
    padding-top: 12px;
    border-top: 1px dashed var(--line);
    font-size: 11.5px;
    color: var(--ink-soft);
}

.coupon-table .coupon-code {
    margin: 0;
    font-size: 11px;
    padding: 4px 7px;
}

.status-toggle {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
    font-size: 10.5px;
    font-weight: 700;
    color: var(--muted);
}

.status-toggle:hover {
    color: var(--brand);
}

/* ---------------- Arreglos ---------------- */

.status-strip {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.status-pill {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: var(--surface);
    color: var(--ink-soft);
    font-size: 11.5px;
    font-weight: 600;
}

.status-pill strong {
    font-size: 17px;
    font-weight: 750;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.status-pill.is-active {
    border-color: var(--brand);
    background: var(--brand-wash);
    color: var(--brand-dark);
}

.status-pill.is-active strong {
    color: var(--brand-dark);
}

.alteration-card {
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 13px;
    background: var(--surface);
    box-shadow: var(--shadow-sm);
}

.alteration-card__head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 10px;
}

.alteration-card__code {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--muted);
    letter-spacing: .04em;
}

.alteration-card h3 {
    margin-top: 2px;
    font-size: 13px;
    font-weight: 700;
}

.alteration-card__garment {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11.5px;
}

.alteration-card__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 12px;
    padding-top: 11px;
    border-top: 1px solid #f2ebe2;
    font-size: 11px;
    color: var(--muted);
}

.overdue {
    color: var(--red);
    font-weight: 600;
}

/* ---------------- Login ---------------- */

.auth-body {
    background: var(--bg);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 1.08fr .92fr;
}

.auth-brand {
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    padding: 38px 48px;
    background:
        radial-gradient(800px 500px at 20% 100%, rgba(180, 83, 42, .3), transparent 65%),
        linear-gradient(155deg, #2a221c 0%, #1b1511 100%);
    color: #f7efe6;
}

.auth-brand__top {
    position: relative;
    z-index: 2;
}

.auth-brand__content {
    position: relative;
    z-index: 2;
    margin: auto 0;
    max-width: 540px;
}

.auth-brand__content h1 {
    margin-top: 14px;
    font-family: var(--font-display);
    font-size: clamp(38px, 4.4vw, 62px);
    font-weight: 500;
    line-height: 1.04;
    letter-spacing: -.02em;
    color: #fbf5ed;
}

.auth-brand__content h1 em {
    font-style: italic;
    color: #df9a72;
}

.auth-brand__lead {
    margin-top: 20px;
    max-width: 420px;
    color: #b9aa9b;
    font-size: 13.5px;
    line-height: 1.65;
}

.auth-features {
    list-style: none;
    margin: 28px 0 0;
    padding: 0;
    display: grid;
    gap: 11px;
}

.auth-features li {
    display: flex;
    align-items: center;
    gap: 10px;
    color: #d4c6b8;
    font-size: 12.5px;
}

.auth-features .icon {
    color: #d99a77;
}

.auth-brand__foot {
    position: relative;
    z-index: 2;
    display: flex;
    align-items: center;
    gap: 10px;
    color: #8f8174;
    font-size: 10.5px;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.auth-brand__line {
    width: 36px;
    height: 1px;
    background: #6f6154;
}

.auth-brand__deco {
    position: absolute;
    inset: 0;
    color: #f2d7c1;
    pointer-events: none;
}

.auth-brand__deco svg {
    width: 100%;
    height: 100%;
}

.auth-panel {
    display: grid;
    place-items: center;
    padding: 44px 28px;
    background:
        radial-gradient(600px 400px at 100% 0%, rgba(180, 83, 42, .06), transparent 60%),
        var(--bg);
}

.auth-panel__inner {
    width: min(420px, 100%);
}

.auth-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 24px;
    padding: 32px;
    box-shadow: var(--shadow-lg);
}

.auth-card h2 {
    margin-top: 7px;
    font-family: var(--font-display);
    font-size: 33px;
    font-weight: 600;
    letter-spacing: -.02em;
}

.auth-card__lead {
    margin-top: 5px;
    color: var(--muted);
    font-size: 12.5px;
}

.auth-form {
    display: grid;
    gap: 15px;
    margin-top: 24px;
}

.auth-form .btn {
    margin-top: 4px;
}

.demo-hint {
    margin-top: 20px;
    padding: 13px 14px;
    border: 1px dashed #dbbea8;
    border-radius: 12px;
    background: #fdf6f0;
}

.demo-hint__head {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--brand-dark);
    font-size: 11px;
    margin-bottom: 7px;
}

.demo-hint dl {
    display: grid;
    gap: 3px;
    font-size: 10.5px;
}

.demo-hint dl div {
    display: flex;
    justify-content: space-between;
    gap: 8px;
}

.demo-hint dt {
    color: var(--muted);
}

.demo-hint dd {
    font-family: var(--font-mono);
    font-size: 9.5px;
    color: var(--ink-soft);
    text-align: right;
}

.auth-card__foot {
    display: flex;
    align-items: flex-start;
    gap: 5px;
    margin-top: 18px;
    padding-top: 15px;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.auth-mobile-brand {
    display: none;
    align-items: center;
    gap: 8px;
    margin-bottom: 18px;
    font-family: var(--font-display);
    font-size: 23px;
    font-weight: 600;
}

/* ---------------- Error page ---------------- */

.error-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.error-card {
    width: min(440px, 100%);
    padding: 34px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 22px;
    box-shadow: var(--shadow-md);
    text-align: center;
}

.error-card__mark {
    display: inline-grid;
    place-items: center;
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: var(--brand);
    color: #fff;
    font-family: var(--font-display);
    font-size: 28px;
    margin-bottom: 18px;
}

.error-card h1 {
    margin-top: 6px;
    font-family: var(--font-display);
    font-size: 30px;
    font-weight: 600;
}

.error-card > p:not(.eyebrow) {
    margin-top: 8px;
    color: var(--muted);
    font-size: 13px;
}

.error-card__actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
    margin-top: 22px;
}

/* ---------------- Profile ---------------- */

.profile-grid {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.profile-card {
    text-align: center;
    padding: 26px 20px;
}

.profile-card .avatar {
    width: 72px;
    height: 72px;
    font-size: 23px;
    margin: 0 auto 12px;
}

.profile-card h2 {
    font-family: var(--font-display);
    font-size: 23px;
    font-weight: 600;
}

.profile-card p {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.profile-meta {
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid var(--line);
    display: grid;
    gap: 8px;
    font-size: 11.5px;
    text-align: left;
}

.profile-meta div {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    color: var(--muted);
}

.profile-meta strong {
    color: var(--ink-soft);
}

/* ---------------- Utilities & animations ---------------- */

.mt-0 { margin-top: 0 !important; }
.mt-1 { margin-top: 6px; }
.mt-2 { margin-top: 12px; }
.mt-3 { margin-top: 18px; }
.mb-0 { margin-bottom: 0 !important; }
.mb-1 { margin-bottom: 6px; }
.mb-2 { margin-bottom: 12px; }
.mb-3 { margin-bottom: 18px; }

.divider {
    height: 1px;
    background: var(--line);
    border: 0;
    margin: 18px 0;
}

.fade-in {
    animation: fade-in .3s ease both;
}

@keyframes fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
        scroll-behavior: auto !important;
    }
}

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1240px) {
    .kpi-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .partner-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .span-4, .span-5 {
        grid-column: span 6;
    }
}

@media (max-width: 1100px) {
    .content {
        padding: 26px 24px 56px;
    }

    .pos-layout {
        grid-template-columns: minmax(0, 1fr) 340px;
    }

    .dash-split {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 1023px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        width: min(86vw, 316px);
        transform: translateX(-104%);
        transition: transform .25s cubic-bezier(.4, 0, .2, 1);
        box-shadow: 0 0 80px rgba(0, 0, 0, .4);
    }

    .sidebar__close {
        display: grid;
        place-items: center;
    }

    body.sidebar-open .sidebar {
        transform: none;
    }

    body.sidebar-open .sidebar-backdrop {
        display: block;
        opacity: 1;
    }

    .topbar {
        display: flex;
    }

    .mobile-nav {
        display: flex;
        position: fixed;
        left: 10px;
        right: 10px;
        bottom: calc(10px + env(safe-area-inset-bottom));
        z-index: 55;
        padding: 6px;
        border-radius: 18px;
        background: rgba(33, 28, 24, .96);
        box-shadow: 0 18px 40px -10px rgba(20, 14, 9, .55);
        backdrop-filter: blur(16px);
    }

    .mobile-nav__item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 2px;
        padding: 7px 2px 5px;
        border: 0;
        border-radius: 12px;
        background: transparent;
        color: #9d9083;
        font-size: 9px;
        font-weight: 650;
        letter-spacing: .02em;
        cursor: pointer;
    }

    .mobile-nav__item:hover {
        color: #f1e7dc;
    }

    .mobile-nav__item.is-active {
        color: #efb08e;
        background: rgba(180, 83, 42, .16);
    }

    .content {
        padding: 20px 20px 108px;
    }

    .app-footer {
        display: none;
    }

    .page-head {
        margin-bottom: 20px;
    }

    .page-head h1 {
        font-size: clamp(26px, 5vw, 34px);
    }

    .partner-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .pos-layout {
        grid-template-columns: 1fr;
    }

    .pos-cart {
        position: fixed;
        inset: 0;
        z-index: 90;
        max-height: none;
        border-radius: 0;
        transform: translateY(104%);
        transition: transform .28s cubic-bezier(.4, 0, .2, 1);
        display: flex;
        overflow-y: auto;
        overflow-x: hidden;
    }

    body.pos-cart-open {
        overflow: hidden;
    }

    body.pos-cart-open .pos-cart {
        transform: none;
    }

    .pos-cart__head {
        padding: 16px 18px;
    }

    .pos-cart-close {
        display: grid;
    }

    .cart-lines {
        max-height: none;
    }

    .pos-mobile-bar {
        display: flex;
        align-items: center;
        gap: 12px;
        position: fixed;
        left: 12px;
        right: 12px;
        bottom: calc(84px + env(safe-area-inset-bottom));
        z-index: 54;
        padding: 9px 10px 9px 16px;
        border-radius: 15px;
        background: var(--surface);
        border: 1px solid var(--line);
        box-shadow: 0 18px 44px -12px rgba(40, 27, 16, .45);
    }

    .pos-mobile-bar__info {
        flex: 1;
        display: flex;
        flex-direction: column;
        line-height: 1.2;
    }

    .pos-mobile-bar__info span {
        color: var(--muted);
        font-size: 9.5px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: .06em;
    }

    .pos-mobile-bar__info strong {
        font-size: 17px;
        font-weight: 750;
        letter-spacing: -.02em;
    }

    .pos-mobile-bar .btn {
        min-height: 38px;
    }

    .pos-layout {
        padding-bottom: 110px;
    }

    .product-grid {
        grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    }
}

@media (max-width: 900px) {
    .auth-shell {
        grid-template-columns: 1fr;
    }

    .auth-brand {
        display: none;
    }

    .auth-panel {
        padding: 30px 20px;
        align-content: start;
    }

    .auth-mobile-brand {
        display: flex;
    }

    .auth-card {
        padding: 26px 22px;
        border-radius: 20px;
    }

    .grid--2, .grid--3, .grid--4 {
        grid-template-columns: 1fr;
    }

    .dash-grid {
        grid-template-columns: 1fr;
    }

    .span-4, .span-5, .span-6, .span-7, .span-8, .span-12 {
        grid-column: 1 / -1;
    }

    .detail-grid {
        grid-template-columns: 1fr;
    }

    .profile-grid {
        grid-template-columns: 1fr;
    }

    .status-strip {
        grid-template-columns: repeat(2, 1fr);
    }

    .promo-grid {
        grid-template-columns: 1fr;
    }

    .form-grid,
    .form-grid--3 {
        grid-template-columns: 1fr;
    }

    .form-card {
        max-width: none;
    }

    .page-head__actions .btn {
        flex: 1 1 auto;
    }
}

@media (max-width: 720px) {
    body {
        font-size: 14px;
    }

    .content {
        padding: 16px 14px 104px;
    }

    .kpi-grid {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .kpi {
        padding: 14px 14px 13px;
        border-radius: 13px;
    }

    .kpi__value {
        font-size: 22px;
    }

    .kpi__icon {
        width: 30px;
        height: 30px;
        border-radius: 9px;
    }

    .kpi__label {
        font-size: 9.5px;
        letter-spacing: .06em;
    }

    .kpi__meta {
        font-size: 10px;
        gap: 4px;
    }

    .page-head {
        gap: 12px;
        margin-bottom: 16px;
    }

    .page-head h1 {
        font-size: 28px;
    }

    .page-head__sub {
        font-size: 12px;
    }

    .page-head__actions {
        width: 100%;
    }

    .page-head__actions .btn {
        flex: 1 1 auto;
    }

    .segmented {
        width: 100%;
        justify-content: flex-start;
    }

    .segmented a,
    .segmented button {
        flex: 0 0 auto;
        padding: 7px 11px;
    }

    .card {
        border-radius: 14px;
    }

    .card__head {
        padding: 15px 16px 0;
    }

    .card__body {
        padding: 15px 16px;
    }

    .card__foot {
        padding: 12px 16px;
    }

    .partner-grid {
        grid-template-columns: 1fr;
    }

    .capital-hero {
        padding: 20px;
    }

    .capital-hero__meta {
        gap: 16px;
    }

    .capital-hero__amount {
        font-size: 31px;
    }

    .chart {
        height: 220px;
    }

    .rank-list {
        padding: 14px 16px 16px;
    }

    .signal {
        padding: 10px 16px;
    }

    .recent-row {
        padding: 10px 16px;
    }

    .mini-stat-grid {
        padding: 14px 16px;
    }

    .table-wrap--cards {
        overflow: visible;
    }

    table.table--cards {
        display: block;
    }

    table.table--cards thead {
        display: none;
    }

    table.table--cards tbody,
    table.table--cards tr,
    table.table--cards td {
        display: block;
        width: 100%;
    }

    table.table--cards tr {
        padding: 12px 14px;
        border-bottom: 1px solid var(--line);
    }

    table.table--cards tr:last-child {
        border-bottom: 0;
    }

    table.table--cards td {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 14px;
        padding: 3px 0;
        border: 0;
        text-align: right;
    }

    table.table--cards td::before {
        content: attr(data-label);
        flex: 0 0 auto;
        color: var(--muted);
        font-size: 9.5px;
        font-weight: 700;
        letter-spacing: .08em;
        text-transform: uppercase;
        text-align: left;
    }

    table.table--cards td:first-child {
        display: block;
        padding: 0 0 8px;
        text-align: left;
    }

    table.table--cards td:first-child::before {
        display: none;
    }

    table.table--cards td:last-child {
        padding-top: 7px;
    }

    table.table--cards .row-actions {
        justify-content: flex-end;
    }

    .filter-bar {
        padding: 12px 14px;
    }

    .filter-bar .field {
        flex: 1 1 calc(50% - 5px);
        min-width: 0;
    }

    .filter-bar .field.search-field {
        flex-basis: 100%;
    }

    .filter-bar .btn {
        flex: 1 1 auto;
    }

    .search-field {
        flex-basis: 100%;
    }

    .form-actions {
        flex-direction: column-reverse;
        align-items: stretch;
    }

    .form-actions .btn {
        width: 100%;
    }

    .form-actions--split {
        align-items: stretch;
    }

    .product-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 9px;
    }

    .pos-head .page-head__actions {
        display: none;
    }

    .pos-searchbar {
        position: sticky;
        top: calc(var(--nav-height) + 6px);
        z-index: 20;
        padding: 4px 0;
        background: var(--bg);
    }

    .pos-open-btn {
        display: inline-flex;
    }

    .pos-cart__head h2 {
        font-size: 23px;
    }

    .ticket-wrap {
        max-width: none;
    }

    .ticket__head,
    .ticket__body,
    .ticket__foot {
        padding-left: 18px;
        padding-right: 18px;
    }

    .product-hero {
        flex-direction: column;
    }

    .product-hero__media {
        width: 100%;
        height: 180px;
    }

    .status-strip {
        gap: 7px;
    }

    .status-pill {
        padding: 9px 11px;
        font-size: 10.5px;
    }

    .status-pill strong {
        font-size: 15px;
    }

    .pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .pagination__links {
        justify-content: center;
    }

    .auth-card {
        padding: 22px 18px;
    }

    .auth-card h2 {
        font-size: 29px;
    }

    .demo-hint dl div {
        flex-direction: column;
        gap: 0;
    }

    .demo-hint dd {
        text-align: left;
    }

    .product-card__media {
        font-size: 27px;
    }
}

@media (max-width: 360px) {
    .kpi-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 430px) {
    .mobile-nav {
        left: 8px;
        right: 8px;
    }

    .mobile-nav__item {
        font-size: 8.5px;
    }

    .page-head h1 {
        font-size: 26px;
    }

    .capital-hero__meta {
        gap: 12px;
    }

    .capital-hero__meta strong {
        font-size: 13px;
    }
}

/* ---------------- Facturación y devoluciones ---------------- */

.sale-detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 500px) minmax(320px, 1fr);
    gap: 18px;
    align-items: start;
}

.sale-detail-grid > div:first-child {
    min-width: 0;
}

.envio-list {
    display: flex;
    flex-direction: column;
}

.envio-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 10px 18px;
    border-bottom: 1px solid #f2ebe2;
    font-size: 11.5px;
}

.envio-row:last-child {
    border-bottom: 0;
}

.envio-row__body {
    flex: 1;
    min-width: 0;
}

.envio-row__body strong {
    display: block;
    font-size: 11.5px;
    font-weight: 650;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.envio-row__body small {
    color: var(--muted);
    font-size: 10px;
}

.message-preview {
    margin: 0;
    padding: 16px;
    border-radius: 10px;
    background: var(--surface-2);
    border: 1px solid var(--line);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.6;
    white-space: pre-wrap;
    word-break: break-word;
}

.invoice-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 380px;
    gap: 18px;
    align-items: start;
}

.invoice {
    position: relative;
    overflow: hidden;
    padding: 30px 34px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.invoice__head {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 24px;
    padding-bottom: 20px;
    border-bottom: 2px solid var(--ink);
}

.invoice__brand {
    font-family: var(--font-display);
    font-size: 34px;
    font-weight: 600;
    line-height: 1;
}

.invoice__tagline {
    margin-top: 3px;
    color: var(--brand);
    font-size: 9px;
    letter-spacing: .18em;
    text-transform: uppercase;
}

.invoice__store {
    margin-top: 14px;
    color: var(--muted);
    font-size: 10.5px;
    line-height: 1.6;
}

.invoice__doc {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 3px;
    text-align: right;
    font-size: 10.5px;
    color: var(--muted);
}

.invoice__doc strong {
    font-family: var(--font-mono);
    font-size: 15px;
    color: var(--ink);
}

.invoice__label {
    display: block;
    font-size: 8.5px;
    font-weight: 700;
    letter-spacing: .13em;
    text-transform: uppercase;
    color: var(--brand);
}

.invoice__client {
    display: grid;
    grid-template-columns: 1.5fr 1fr 1fr;
    gap: 18px;
    padding: 18px 0;
    border-bottom: 1px solid var(--line);
    font-size: 11px;
}

.invoice__client strong {
    display: block;
    margin-top: 3px;
    font-size: 13px;
}

.invoice__client p {
    margin-top: 2px;
    color: var(--ink-soft);
}

.invoice__table {
    width: 100%;
    border-collapse: collapse;
    font-size: 11px;
}

.invoice__table th {
    padding: 13px 8px 8px;
    text-align: left;
    font-size: 8px;
    letter-spacing: .1em;
    text-transform: uppercase;
    color: var(--muted);
    border-bottom: 1px solid var(--ink);
}

.invoice__table td {
    padding: 10px 8px;
    border-bottom: 1px solid #f0e8de;
    vertical-align: top;
}

.invoice__table td strong {
    display: block;
    font-size: 11.5px;
}

.invoice__table td span {
    display: block;
    margin-top: 2px;
    font-size: 9px;
    color: var(--muted);
}

.invoice__totals {
    display: grid;
    grid-template-columns: 1fr 290px;
    gap: 24px;
    padding-top: 16px;
}

.invoice__payment {
    font-size: 11px;
    color: var(--ink-soft);
}

.invoice__payment strong {
    display: block;
    margin-top: 4px;
    font-size: 13px;
}

.invoice__payment p {
    margin-top: 6px;
    color: var(--muted);
    font-size: 10px;
}

.invoice__note {
    margin-top: 16px;
    padding: 9px 12px;
    border-radius: 8px;
    background: var(--brand-wash);
    color: #72462e;
    font-size: 10.5px;
}

.invoice__foot {
    margin-top: 22px;
    padding-top: 14px;
    border-top: 1px dashed var(--line-strong);
    text-align: center;
    color: var(--muted);
    font-size: 10px;
}

.invoice__watermark {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    z-index: 2;
    transform: rotate(-22deg);
    font-family: var(--font-display);
    font-size: 92px;
    font-weight: 700;
    letter-spacing: .08em;
    color: rgba(162, 63, 51, .12);
    pointer-events: none;
}

/* ---------------- Compras ---------------- */

.purchase-add {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 10px;
    padding: 12px;
    border: 1px dashed var(--line-strong);
    border-radius: 11px;
    background: var(--surface-2);
}

.purchase-add .input,
.purchase-add .select {
    min-height: 38px;
    background: var(--surface);
}

.purchase-summary {
    position: sticky;
    top: 22px;
    align-self: start;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
    overflow: hidden;
}

.purchase-lines td {
    vertical-align: middle;
}

.purchase-qty,
.purchase-cost {
    min-height: 34px;
    padding: 5px 8px;
    font-size: 12px;
}

@media (max-width: 1100px) {
    .invoice-layout {
        grid-template-columns: 1fr;
    }

    .sale-detail-grid {
        grid-template-columns: 1fr;
    }

    .sale-detail-grid > div:first-child {
        max-width: 520px;
        width: 100%;
        margin: 0 auto;
    }

    .invoice__totals {
        grid-template-columns: 1fr 240px;
    }
}

@media (max-width: 720px) {
    .invoice {
        padding: 20px 16px;
    }

    .invoice__head {
        gap: 12px;
    }

    .invoice__doc {
        align-items: flex-start;
        text-align: left;
    }

    .invoice__client {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .invoice__totals {
        grid-template-columns: 1fr;
    }

    .invoice__watermark {
        font-size: 54px;
    }

    .purchase-summary {
        position: static;
    }

    .purchase-add .field {
        flex: 1 1 100% !important;
        max-width: none !important;
    }
}

/* ============================================================
   Impresión del comprobante
   ============================================================ */

@media print {
    @page {
        margin: 10mm;
        size: auto;
    }

    body {
        background: #fff !important;
        color: #000;
        font-size: 11px;
    }

    body::before {
        display: none;
    }

    .sidebar,
    .topbar,
    .mobile-nav,
    .app-footer,
    .flash-stack,
    .no-print,
    .sidebar-backdrop,
    .pos-mobile-bar {
        display: none !important;
    }

    .app-shell {
        display: block;
    }

    .content {
        max-width: none;
        padding: 0;
    }

    .ticket-wrap {
        max-width: 80mm;
        margin: 0 auto;
    }

    .ticket {
        border: 0;
        box-shadow: none;
        border-radius: 0;
        max-width: 80mm;
        margin: 0 auto;
    }

    .invoice-layout,
    .sale-detail-grid {
        display: block;
    }

    .invoice {
        border: 0;
        box-shadow: none;
        border-radius: 0;
        padding: 0;
        max-width: none;
    }

    .invoice__watermark {
        color: rgba(162, 63, 51, .16);
    }

    .invoice__table th,
    .invoice__table td {
        padding-left: 4px;
        padding-right: 4px;
    }

    .ticket__head,
    .ticket__body,
    .ticket__foot {
        padding-left: 0;
        padding-right: 0;
    }

    .card,
    .kpi,
    .pos-cart {
        box-shadow: none;
    }

    a {
        color: #000;
    }
}

/* ============================================================
   Clientes, fidelidad y separados (v3)
   ============================================================ */
.badge--gold { background: var(--gold-soft); color: #855d13; }
.text-danger { color: var(--red); }
.client-cell { display: inline-flex; align-items: center; gap: 10px; color: inherit; }
.client-cell:hover strong { color: var(--brand-dark); }
.client-cell small { display: block; }

.customer-picker { position: relative; }
.customer-results {
    position: absolute;
    z-index: 40;
    top: calc(100% - 2px);
    left: 0;
    right: 0;
    max-height: 280px;
    overflow-y: auto;
    padding: 6px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 18px 42px rgba(51, 35, 23, .16);
}
.customer-result {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    width: 100%;
    padding: 9px 10px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ink);
    text-align: left;
    cursor: pointer;
}
.customer-result:hover, .customer-result:focus-visible { background: var(--brand-soft); }
.customer-result strong { display: block; font-size: 13px; }
.customer-result small { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; }
.customer-result__benefit {
    flex: none;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--sage-soft);
    color: #456046;
    font-size: 10.5px;
    font-weight: 700;
    white-space: nowrap;
}
.customer-result__benefit--muted { background: #efe9e2; color: var(--muted); }
.customer-results__empty { padding: 12px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.customer-selected {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin-top: 8px;
    padding: 9px 11px;
    border: 1px solid #d8dfd2;
    border-radius: 10px;
    background: var(--sage-soft);
}
.customer-selected strong { display: block; font-size: 13px; }
.customer-selected .tiny { display: block; margin-top: 2px; }
.customer-level {
    margin: 8px 0 0;
    padding: 7px 10px;
    border-radius: 9px;
    background: var(--gold-soft);
    color: #6f4a0f;
    font-size: 11.5px;
    font-weight: 600;
    line-height: 1.45;
}
.summary-row--benefit { color: #456046; }
.summary-row--benefit small { font-weight: 600; }
.summary-row--benefit strong { color: #456046; }

.loyalty-card {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
    padding: 14px;
    border: 1px solid #e5d3b1;
    border-radius: 12px;
    background: linear-gradient(135deg, #fdf6e8, #fbf1e6);
}
.loyalty-card__icon {
    display: grid;
    place-items: center;
    width: 38px;
    height: 38px;
    border-radius: 50%;
    background: var(--gold-soft);
    color: #855d13;
}
.loyalty-card strong { display: block; font-family: var(--font-display); font-size: 17px; }
.loyalty-card p { margin: 2px 0 0; font-size: 12px; }
.progress { height: 8px; overflow: hidden; margin: 4px 0 8px; border-radius: 999px; background: #eee5da; }
.progress__bar { height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--brand), #c88455); }

.note--soft { margin: 12px 0 0; padding: 10px 12px; border-radius: 9px; background: var(--surface-soft); color: var(--muted); font-size: 12px; line-height: 1.5; }
.note--warning { margin: 12px 0 0; padding: 10px 12px; border-radius: 9px; background: var(--red-soft); color: var(--red); font-size: 12px; line-height: 1.5; }
.empty--sm { padding: 26px 16px; }
.empty--sm h3 { font-size: 16px; }
.form-card--inline { border-top: 1px solid var(--line); border-radius: 0; box-shadow: none; }
.kpi__value--sm { font-size: 20px !important; }
.link-strong { color: var(--brand-dark); font-weight: 700; }

.field__hint { margin: 5px 0 0; color: var(--muted); font-size: 11.5px; line-height: 1.45; }
.field__error { margin: 5px 0 0; color: var(--red); font-size: 11.5px; font-weight: 600; }
.cart-customer { padding: 14px 16px 0; }
.cart-customer .customer-results { top: calc(100% - 2px); }
/* El buscador de clientes necesita mostrar su lista sobre el carrito. */
.cart-customer { position: relative; z-index: 5; }
/* La barra lateral ahora tiene más módulos: permite desplazarse sin romper el pie. */
.sidebar { overflow-y: auto; overscroll-behavior: contain; }
.sidebar__demo, .sidebar__user { flex: none; }
/* Navegación desplazable, con el pie del usuario siempre visible. */
.sidebar { overflow: hidden; }
.nav { flex: 1 1 auto; min-height: 0; overflow-y: auto; padding-right: 2px; scrollbar-width: thin; }

/* Promociones con selección múltiple */
.section-heading--form { align-items: flex-start; gap: 14px; margin-bottom: 14px; }
.section-heading--form h2, .section-heading--form p { margin-bottom: 0; }
.check-toolbar { display: flex; flex-wrap: wrap; gap: 6px; }
.product-check-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    max-height: 380px;
    overflow-y: auto;
    padding: 2px;
}
.product-check {
    display: flex;
    align-items: flex-start;
    gap: 9px;
    padding: 10px 11px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
    cursor: pointer;
    transition: border-color .15s, background .15s;
}
.product-check:hover { border-color: var(--brand); background: var(--brand-soft); }
.product-check input { margin-top: 3px; accent-color: var(--brand); }
.product-check__body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.product-check__body strong { font-size: 12.5px; line-height: 1.3; }
.product-check__body small { color: var(--muted); font-size: 11px; }
@media (max-width: 720px) {
    .product-check-grid { grid-template-columns: 1fr; max-height: none; }
    .section-heading--form { flex-direction: column; }
}
.customer-anonymous { margin-top: 9px; }
.customer-anonymous span { font-size: 11.5px; }
.customer-picker.is-anonymous .search-input { opacity: .5; }
.customer-picker.is-anonymous .customer-selected,
.customer-picker.is-anonymous .customer-level { display: none !important; }
.customer-picker input:disabled { background: #f3eee8; color: #9b8d80; cursor: not-allowed; }

/* Foto de perfil opcional */
.avatar { overflow: hidden; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
