:root {
    --ink: #14201d;
    --muted: #69736f;
    --canvas: #f4f2eb;
    --surface: #fffef9;
    --line: #e3e0d7;
    --forest: #10231e;
    --forest-soft: #1b332c;
    --green: #2f765c;
    --green-bright: #72b38d;
    --sage: #dce9df;
    --amber: #c98335;
    --red: #a9473f;
    --shadow: 0 18px 55px rgba(27, 39, 35, .08);
    --radius: 18px;
    font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    color: var(--ink);
    background: var(--canvas);
    font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { min-height: 100vh; margin: 0; background: var(--canvas); color: var(--ink); }
button, input, select { font: inherit; }
button { color: inherit; }
button, [role="button"] { -webkit-tap-highlight-color: transparent; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid rgba(47, 118, 92, .28); outline-offset: 2px; }

.eyebrow {
    margin: 0 0 7px;
    color: var(--green);
    font-size: 10px;
    font-weight: 800;
    letter-spacing: .17em;
}
.eyebrow.light { color: #9bc6b2; }

/* Login */
.login-view { min-height: 100vh; display: grid; grid-template-columns: minmax(420px, 1.1fr) minmax(430px, .9fr); }
.login-brand {
    position: relative;
    isolation: isolate;
    min-height: 100vh;
    padding: 54px clamp(42px, 7vw, 112px);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
    color: white;
    background:
        radial-gradient(circle at 80% 18%, rgba(111, 182, 142, .15), transparent 28%),
        radial-gradient(circle at 17% 82%, rgba(206, 161, 92, .12), transparent 32%),
        var(--forest);
}
.login-brand::before,
.login-brand::after {
    content: "";
    position: absolute;
    z-index: -1;
    border: 1px solid rgba(255, 255, 255, .07);
    border-radius: 50%;
}
.login-brand::before { width: 510px; height: 510px; right: -250px; top: 20%; }
.login-brand::after { width: 360px; height: 360px; right: -178px; top: calc(20% + 75px); }
.brand-mark {
    width: 54px;
    height: 54px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 16px 16px 16px 5px;
    background: rgba(255, 255, 255, .08);
    box-shadow: inset 0 0 0 5px rgba(255, 255, 255, .035);
    color: #f4d99e;
    font-family: Georgia, serif;
    font-size: 27px;
    font-weight: 700;
}
.brand-mark.small { width: 39px; height: 39px; border-radius: 12px 12px 12px 4px; font-size: 21px; }
.login-brand-copy { max-width: 650px; margin: auto 0; padding: 80px 0; }
.login-brand h1 {
    max-width: 680px;
    margin: 0;
    font-family: Georgia, "Times New Roman", serif;
    font-size: clamp(44px, 5.4vw, 77px);
    font-weight: 400;
    line-height: 1.03;
    letter-spacing: -.045em;
}
.login-brand h1 em { color: #9bc6b2; font-weight: 400; }
.login-brand-copy > p:last-child { max-width: 530px; margin: 27px 0 0; color: #b8c8c2; font-size: 16px; line-height: 1.75; }
.login-proof { display: flex; align-items: center; gap: 10px; color: #adbbb6; font-size: 12px; }
.live-dot { width: 8px; height: 8px; display: inline-block; flex: 0 0 auto; border-radius: 50%; background: #79c795; box-shadow: 0 0 0 4px rgba(121, 199, 149, .12); }
.login-panel { display: grid; place-items: center; min-height: 100vh; padding: 50px clamp(30px, 6vw, 90px); background: #faf9f4; }
.login-card { width: min(100%, 430px); }
.mobile-brand { display: none; }
.login-card h2 { margin: 0; font-family: Georgia, serif; font-size: 39px; font-weight: 500; letter-spacing: -.035em; }
.login-intro { margin: 12px 0 36px; color: var(--muted); line-height: 1.6; }
.field { display: block; margin-bottom: 20px; }
.field > span:first-child { display: block; margin-bottom: 8px; color: #42504b; font-size: 12px; font-weight: 700; }
.field input,
.table-filters input,
.table-filters select,
.date-range input {
    width: 100%;
    height: 49px;
    padding: 0 14px;
    border: 1px solid #d7d7cf;
    border-radius: 10px;
    outline: 0;
    background: #fff;
    color: var(--ink);
    transition: border-color .15s, box-shadow .15s;
}
.field input:focus,
.table-filters input:focus,
.table-filters select:focus,
.date-range input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 118, 92, .1); }
.password-control { position: relative; display: block; }
.password-control input { padding-right: 58px; }
.show-password { position: absolute; top: 8px; right: 7px; height: 34px; padding: 0 10px; border: 0; border-radius: 7px; background: transparent; color: var(--green); font-size: 12px; font-weight: 700; cursor: pointer; }
.primary-button, .secondary-button {
    min-height: 44px;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 750;
    transition: transform .15s, opacity .15s, box-shadow .15s;
}
.primary-button { background: var(--forest); color: white; box-shadow: 0 10px 22px rgba(16, 35, 30, .15); }
.primary-button:hover { transform: translateY(-1px); box-shadow: 0 13px 26px rgba(16, 35, 30, .2); }
.primary-button:disabled { opacity: .6; cursor: wait; }
.login-button { width: 100%; margin-top: 7px; padding: 0 17px; display: flex; align-items: center; justify-content: space-between; }
.access-note { display: flex; justify-content: center; align-items: center; gap: 7px; margin: 24px 0 0; color: #929a96; font-size: 11px; }
.access-note span { color: var(--green); font-size: 8px; }
.form-error { margin: -2px 0 14px; padding: 11px 13px; border: 1px solid #edcbc7; border-radius: 9px; background: #fff4f2; color: #923c35; font-size: 12px; line-height: 1.45; }

/* Application shell */
.app-shell { min-height: 100vh; display: flex; }
.sidebar {
    position: fixed;
    z-index: 20;
    inset: 0 auto 0 0;
    width: 244px;
    display: flex;
    flex-direction: column;
    background: var(--forest);
    color: white;
}
.sidebar-brand { height: 92px; padding: 0 24px; display: flex; align-items: center; gap: 13px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.sidebar-brand strong { display: block; font-family: Georgia, serif; font-size: 18px; letter-spacing: .12em; }
.sidebar-brand small { display: block; margin-top: 2px; color: #8fa099; font-size: 8px; letter-spacing: .2em; }
.sidebar-nav { flex: 1; padding: 25px 13px; overflow-y: auto; }
.nav-label { margin: 13px 12px 9px; color: #6f827a; font-size: 9px; font-weight: 800; letter-spacing: .16em; }
.nav-item { width: 100%; min-height: 45px; margin-bottom: 5px; padding: 0 13px; display: flex; align-items: center; gap: 12px; border: 0; border-radius: 10px; background: transparent; color: #9fb0a9; font-size: 13px; font-weight: 650; text-align: left; cursor: pointer; }
.nav-item:hover { background: rgba(255, 255, 255, .05); color: white; }
.nav-item.active { background: #f4f2eb; color: var(--forest); }
.nav-icon { width: 25px; height: 25px; display: grid; place-items: center; border-radius: 7px; background: rgba(255,255,255,.06); font-size: 16px; font-family: Georgia, serif; }
.nav-item.active .nav-icon { background: var(--sage); color: var(--green); }
.sidebar-footer { padding: 17px 18px 20px; border-top: 1px solid rgba(255, 255, 255, .08); }
.user-chip { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: #d8b76c; color: #3a301b; font-family: Georgia, serif; font-weight: 700; }
.user-chip div { min-width: 0; }
.user-chip strong, .user-chip small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip strong { font-size: 12px; }
.user-chip small { margin-top: 2px; color: #83958d; font-size: 10px; }
.logout-button { width: 100%; margin-top: 14px; padding: 9px 0 0; display: flex; justify-content: space-between; border: 0; border-top: 1px solid rgba(255,255,255,.07); background: transparent; color: #85978f; font-size: 10px; cursor: pointer; }
.logout-button:hover { color: #d9e2de; }
.app-main { width: calc(100% - 244px); min-height: 100vh; margin-left: 244px; display: flex; flex-direction: column; }
.topbar { min-height: 92px; padding: 19px 34px; display: flex; align-items: center; gap: 16px; background: var(--surface); border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-family: Georgia, serif; font-size: 25px; font-weight: 500; letter-spacing: -.025em; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 15px; }
.sync-state { display: flex; align-items: center; gap: 10px; padding-right: 15px; border-right: 1px solid var(--line); }
.sync-state strong, .sync-state small { display: block; }
.sync-state strong { font-size: 11px; }
.sync-state small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.icon-button, .menu-button { border: 1px solid var(--line); background: #fff; cursor: pointer; }
.icon-button { width: 39px; height: 39px; border-radius: 10px; color: var(--green); font-size: 21px; }
.icon-button.is-loading { animation: spin .75s linear infinite; }
.menu-button { width: 42px; height: 42px; padding: 10px; display: none; border-radius: 10px; }
.menu-button span { width: 18px; height: 2px; margin: 3px auto; display: block; background: var(--ink); }
.filterbar { min-height: 70px; padding: 12px 34px; display: flex; align-items: center; justify-content: space-between; gap: 18px; background: rgba(255, 254, 249, .75); border-bottom: 1px solid var(--line); }
.quick-periods { padding: 4px; display: flex; gap: 2px; border: 1px solid var(--line); border-radius: 11px; background: #eceae3; }
.quick-periods button { min-width: 62px; height: 33px; padding: 0 10px; border: 0; border-radius: 8px; background: transparent; color: var(--muted); font-size: 11px; font-weight: 700; cursor: pointer; }
.quick-periods button.active { background: var(--surface); color: var(--forest); box-shadow: 0 2px 7px rgba(20,32,29,.08); }
.date-range { display: flex; align-items: center; gap: 8px; }
.date-range label span { display: none; }
.date-range input { width: 132px; height: 35px; padding: 0 9px; border-radius: 8px; font-size: 11px; }
.date-arrow { color: #9ca39f; font-size: 12px; }
.secondary-button { min-height: 35px; padding: 0 14px; border: 1px solid var(--line); background: #fff; color: var(--ink); font-size: 11px; }
.secondary-button:hover { border-color: #aeb8b3; }
.content { width: 100%; max-width: 1640px; min-height: 500px; margin: 0 auto; padding: 27px 34px 44px; flex: 1; }
.app-footer { padding: 17px 34px; display: flex; justify-content: space-between; border-top: 1px solid var(--line); color: #969d99; font-size: 9px; letter-spacing: .03em; }
.sidebar-scrim { display: none; }

/* Data surfaces */
.section-intro { margin-bottom: 19px; display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; }
.section-intro h2 { margin: 0; font-family: Georgia, serif; font-size: 26px; font-weight: 500; letter-spacing: -.025em; }
.section-intro p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.section-tag { padding: 7px 10px; border: 1px solid #d6ded9; border-radius: 999px; background: #edf5f0; color: #376a56; font-size: 10px; font-weight: 750; }
.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 13px; }
.kpi-card { position: relative; min-height: 139px; padding: 19px; overflow: hidden; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 20px rgba(20,32,29,.025); }
.kpi-card.primary { color: white; border-color: var(--forest); background: var(--forest); }
.kpi-card.primary::after { content: ""; position: absolute; width: 125px; height: 125px; right: -55px; bottom: -68px; border: 1px solid rgba(255,255,255,.14); border-radius: 50%; box-shadow: 0 0 0 23px rgba(255,255,255,.025); }
.kpi-label { display: flex; justify-content: space-between; color: var(--muted); font-size: 10px; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; }
.primary .kpi-label { color: #a9bbb4; }
.kpi-icon { color: var(--green); font-size: 16px; }
.primary .kpi-icon { color: #9bc6b2; }
.kpi-value { margin-top: 21px; display: block; font-family: Georgia, serif; font-size: clamp(24px, 2.2vw, 34px); font-weight: 500; letter-spacing: -.035em; white-space: nowrap; }
.kpi-meta { margin-top: 7px; display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 9px; }
.primary .kpi-meta { color: #9fb1aa; }
.trend-up { color: #52966f; font-weight: 800; }
.trend-down { color: #bd6159; font-weight: 800; }
.dashboard-grid { margin-top: 13px; display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(285px, .72fr); gap: 13px; }
.card { min-width: 0; padding: 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); box-shadow: 0 5px 20px rgba(20,32,29,.025); }
.card-header { margin-bottom: 18px; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.card-header h3 { margin: 0; font-family: Georgia, serif; font-size: 18px; font-weight: 500; }
.card-header p { margin: 4px 0 0; color: var(--muted); font-size: 10px; }
.card-note { color: var(--muted); font-size: 9px; }
.sales-chart { height: 245px; display: flex; flex-direction: column; }
.chart-plot { min-height: 0; flex: 1; display: flex; align-items: stretch; gap: 5px; border-bottom: 1px solid var(--line); background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(25% - 1px), #eceae3 25%); }
.chart-column { min-width: 5px; flex: 1; display: flex; align-items: flex-end; justify-content: center; position: relative; }
.chart-column i { width: min(18px, 65%); min-height: 2px; display: block; border-radius: 5px 5px 0 0; background: linear-gradient(to top, #2b6d55, #79b693); transition: height .35s ease; }
.chart-column:hover i { background: var(--amber); }
.chart-labels { height: 25px; display: flex; align-items: flex-end; color: #8b938f; font-size: 8px; }
.chart-labels span { min-width: 5px; flex: 1; text-align: center; }
.chart-labels span:not(:first-child):not(:last-child) { color: transparent; }
.payment-layout { display: grid; place-items: center; gap: 18px; }
.donut { position: relative; width: 134px; height: 134px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--green) 0 50%, #d7ad63 50% 75%, #98a7bb 75%); }
.donut::before { content: ""; position: absolute; width: 86px; height: 86px; border-radius: 50%; background: var(--surface); }
.donut strong, .donut span { position: relative; z-index: 1; display: block; text-align: center; }
.donut strong { font-family: Georgia, serif; font-size: 19px; }
.donut span { margin-top: 2px; color: var(--muted); font-size: 8px; }
.legend { width: 100%; display: grid; gap: 9px; }
.legend-row { display: grid; grid-template-columns: 9px 1fr auto; align-items: center; gap: 8px; font-size: 10px; }
.legend-dot { width: 7px; height: 7px; border-radius: 50%; }
.legend-row span:nth-child(2) { color: var(--muted); }
.legend-row strong { font-size: 10px; }
.secondary-grid { margin-top: 13px; display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 13px; }
.data-list { display: grid; }
.data-row { min-width: 0; min-height: 51px; padding: 9px 0; display: grid; grid-template-columns: minmax(170px, 1fr) 85px 105px 95px; align-items: center; gap: 12px; border-top: 1px solid #efede7; font-size: 10px; }
.data-row:first-child { border-top: 0; }
.data-row.header { min-height: 30px; padding-top: 0; color: #8c9490; font-size: 8px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.product-name { min-width: 0; display: flex; align-items: center; gap: 10px; }
.rank { width: 25px; height: 25px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 8px; background: #edf1ed; color: var(--green); font-family: Georgia, serif; }
.product-name strong, .product-name small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-name strong { font-size: 11px; }
.product-name small { margin-top: 2px; color: #929a96; font-size: 8px; }
.money-positive { color: var(--green); font-weight: 800; }
.money-negative { color: var(--red); font-weight: 800; }
.activity-list { display: grid; }
.activity-item { padding: 11px 0; display: grid; grid-template-columns: 8px 1fr auto; gap: 10px; align-items: center; border-top: 1px solid #efede7; }
.activity-item:first-child { border-top: 0; padding-top: 2px; }
.activity-item .status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--green-bright); }
.activity-item.cancelled .status-dot { background: var(--red); }
.activity-item strong, .activity-item small { display: block; }
.activity-item strong { font-size: 10px; }
.activity-item small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.activity-item > strong { font-family: Georgia, serif; font-size: 12px; }
.operations-strip { margin-top: 13px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.operation-stat { min-height: 82px; padding: 16px 20px; display: flex; align-items: center; gap: 13px; border-left: 1px solid var(--line); }
.operation-stat:first-child { border-left: 0; }
.operation-symbol { width: 35px; height: 35px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 11px; background: var(--sage); color: var(--green); font-family: Georgia, serif; font-size: 17px; }
.operation-stat strong, .operation-stat small { display: block; }
.operation-stat strong { font-family: Georgia, serif; font-size: 18px; }
.operation-stat small { margin-top: 3px; color: var(--muted); font-size: 9px; }

/* Tables and detail views */
.table-card { padding: 0; overflow: hidden; }
.table-toolbar { padding: 17px 19px; display: flex; align-items: flex-end; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); }
.table-filters { display: flex; flex-wrap: wrap; gap: 9px; }
.table-filters label > span { display: block; margin-bottom: 5px; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; }
.table-filters input, .table-filters select { width: 150px; height: 36px; border-radius: 8px; font-size: 10px; }
.table-filters .search-input { width: 190px; }
.table-wrap { width: 100%; overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.data-table th { padding: 11px 14px; background: #f3f1eb; color: #7d8681; font-size: 8px; font-weight: 800; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
.data-table td { padding: 13px 14px; border-top: 1px solid #efede7; color: #38443f; font-size: 10px; }
.data-table td strong { color: var(--ink); }
.data-table tbody tr:hover { background: #fbfaf6; }
.align-right { text-align: right !important; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; background: #e9f3ed; color: #347057; font-size: 8px; font-weight: 800; text-transform: capitalize; }
.status-pill::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-pill.cancelada, .status-pill.cancelado, .status-pill.rechazado { background: #fae9e7; color: #a74e47; }
.status-pill.pendiente { background: #fff1da; color: #a76924; }
.status-pill.abierto { background: #e8f0f8; color: #476f98; }
.pagination { padding: 14px 18px; display: flex; align-items: center; justify-content: flex-end; gap: 13px; border-top: 1px solid var(--line); color: var(--muted); font-size: 10px; }
.pagination button { min-width: 78px; height: 32px; border: 1px solid var(--line); border-radius: 8px; background: #fff; font-size: 10px; cursor: pointer; }
.pagination button:disabled { opacity: .4; cursor: default; }
.summary-grid { margin-bottom: 13px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 13px; }
.summary-card { padding: 18px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); }
.summary-card span, .summary-card small { display: block; color: var(--muted); font-size: 9px; }
.summary-card strong { display: block; margin: 12px 0 5px; font-family: Georgia, serif; font-size: 24px; font-weight: 500; }
.split-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.section-spacer { margin-top: 13px; }
.flush-card-header { margin: 0; }
.catalog-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.catalog-item { position: relative; min-height: 90px; padding: 16px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.catalog-item::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--catalog-color, var(--green)); }
.catalog-item strong, .catalog-item small { display: block; }
.catalog-item strong { font-family: Georgia, serif; font-size: 16px; }
.catalog-item small { margin-top: 6px; color: var(--muted); font-size: 9px; }
.margin-bar { width: 88px; height: 5px; border-radius: 5px; overflow: hidden; background: #e9e8e2; }
.margin-bar i { height: 100%; display: block; border-radius: inherit; background: var(--green); }
.empty-state { min-height: 170px; padding: 35px; display: grid; place-items: center; color: var(--muted); font-size: 11px; text-align: center; }
.loading-state { min-height: 420px; display: grid; place-content: center; justify-items: center; color: var(--muted); font-size: 11px; }
.loader { width: 26px; height: 26px; border: 2px solid #d7dbd8; border-top-color: var(--green); border-radius: 50%; animation: spin .7s linear infinite; }
.error-state { min-height: 380px; padding: 30px; display: grid; place-content: center; justify-items: center; text-align: center; }
.error-state strong { font-family: Georgia, serif; font-size: 24px; }
.error-state p { max-width: 420px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.toast-region { position: fixed; z-index: 100; top: 18px; right: 18px; display: grid; gap: 8px; }
.toast { max-width: 340px; padding: 12px 15px; border-radius: 10px; background: var(--forest); color: white; box-shadow: var(--shadow); font-size: 11px; animation: toast-in .2s ease-out; }
.toast.error { background: #8e3d37; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

@media (max-width: 1180px) {
    .kpi-grid { grid-template-columns: repeat(3, 1fr); }
    .kpi-card:nth-child(4), .kpi-card:nth-child(5) { grid-column: span 1; }
    .dashboard-grid, .secondary-grid { grid-template-columns: 1fr; }
    .payment-layout { grid-template-columns: auto 1fr; }
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 880px) {
    .login-view { grid-template-columns: 1fr; }
    .login-brand { display: none; }
    .login-panel { padding: 32px 22px; }
    .mobile-brand { margin-bottom: 46px; display: flex; align-items: center; gap: 10px; color: var(--forest); font-family: Georgia, serif; font-weight: 700; letter-spacing: .12em; }
    .mobile-brand span { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 10px; background: var(--forest); color: #ebcf92; }
    .sidebar { transform: translateX(-100%); transition: transform .2s ease; box-shadow: 20px 0 60px rgba(11, 24, 20, .22); }
    .app-shell.sidebar-open .sidebar { transform: translateX(0); }
    .sidebar-scrim { position: fixed; z-index: 15; inset: 0; border: 0; background: rgba(8, 18, 15, .45); }
    .app-shell.sidebar-open .sidebar-scrim { display: block; }
    .app-main { width: 100%; margin-left: 0; }
    .menu-button { display: block; }
    .topbar, .filterbar, .content { padding-left: 20px; padding-right: 20px; }
    .filterbar { align-items: flex-start; flex-direction: column; }
    .date-range { width: 100%; }
    .date-range label { flex: 1; }
    .date-range input { width: 100%; }
    .split-grid { grid-template-columns: 1fr; }
    .catalog-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 620px) {
    .topbar { min-height: 77px; padding-top: 13px; padding-bottom: 13px; }
    .topbar h1 { font-size: 20px; }
    .topbar .eyebrow { margin-bottom: 4px; font-size: 8px; }
    .sync-state { display: none; }
    .quick-periods { width: 100%; }
    .quick-periods button { min-width: 0; flex: 1; }
    .date-range { flex-wrap: wrap; }
    .date-arrow { display: none; }
    .date-range label { min-width: calc(50% - 5px); }
    .date-range label span { margin-bottom: 4px; display: block; color: var(--muted); font-size: 8px; }
    .date-range .secondary-button { width: 100%; }
    .content { padding-top: 20px; }
    .section-intro { align-items: flex-start; flex-direction: column; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .kpi-card { min-height: 125px; padding: 16px; }
    .kpi-card.primary { grid-column: 1 / -1; }
    .kpi-value { font-size: 25px; }
    .payment-layout { grid-template-columns: 1fr; }
    .data-row { grid-template-columns: minmax(150px, 1fr) 80px 90px; }
    .data-row > *:nth-child(2) { display: none; }
    .operations-strip { grid-template-columns: 1fr 1fr; }
    .operation-stat { border-top: 1px solid var(--line); }
    .operation-stat:nth-child(odd) { border-left: 0; }
    .operation-stat:nth-child(-n+2) { border-top: 0; }
    .summary-grid { grid-template-columns: 1fr 1fr; }
    .table-toolbar { align-items: stretch; flex-direction: column; }
    .table-filters { display: grid; grid-template-columns: 1fr 1fr; }
    .table-filters label, .table-filters input, .table-filters select, .table-filters .search-input { width: 100%; }
    .catalog-grid { grid-template-columns: 1fr; }
    .app-footer { align-items: flex-start; flex-direction: column; gap: 6px; }
}

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

/* --------------------------------------------------------------------------
   Alineación visual con la terminal RIMO POS
   -------------------------------------------------------------------------- */
:root {
    --ink: #1a2028;
    --muted: #5b6472;
    --canvas: #f5f6f8;
    --surface: #ffffff;
    --line: #e3e6ea;
    --forest: #12181f;
    --forest-soft: #232b36;
    --green: #2f6fed;
    --green-bright: #2f6fed;
    --sage: #edf2fd;
    --amber: #c8872b;
    --red: #c0362c;
    --shadow: 0 8px 24px rgba(26, 32, 40, .06);
    --radius: 8px;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

body { font-size: .925rem; }
.eyebrow { color: var(--green); font-size: .68rem; letter-spacing: .09em; }

/* Acceso */
.login-view {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    background: var(--canvas);
}
.login-panel {
    min-height: 0;
    width: auto;
    display: block;
    padding: 0;
    background: transparent;
}
.login-card {
    width: 21rem;
    max-width: calc(100vw - 2rem);
    padding: 2.25rem 2rem;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--surface);
    box-shadow: none;
}
.login-logo {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 4.75rem;
}
.login-logo img {
    display: block;
    width: min(100%, 12.5rem);
    height: auto;
    object-fit: contain;
}
.login-subtitle {
    margin-top: .5rem;
    color: var(--muted);
    font-size: .75rem;
    text-align: center;
}
.login-intro {
    margin: .35rem 0 1.75rem;
    color: var(--muted);
    font-size: .75rem;
    line-height: 1.45;
    text-align: center;
}
.field { margin-bottom: 1rem; }
.field > span:first-child {
    margin-bottom: .3rem;
    color: var(--muted);
    font-size: .75rem;
    font-weight: 500;
}
.field input,
.table-filters input,
.table-filters select,
.date-range input {
    height: 40px;
    padding: .5rem .7rem;
    border-color: var(--line);
    border-radius: 4px;
    font-size: .875rem;
}
.field input:focus,
.table-filters input:focus,
.table-filters select:focus,
.date-range input:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px rgba(47, 111, 237, .12);
}
.show-password {
    top: 3px;
    right: 4px;
    height: 34px;
    border-radius: 4px;
    color: var(--green);
}
.primary-button {
    min-height: 42px;
    border-radius: 4px;
    background: var(--green);
    box-shadow: none;
    font-size: .875rem;
    font-weight: 500;
}
.primary-button:hover { background: #2559c7; box-shadow: none; transform: none; }
.login-button { justify-content: center; margin-top: .25rem; }
.form-error {
    margin-bottom: 1rem;
    padding: .5rem .7rem;
    border-color: #f6cfcb;
    border-radius: 4px;
    background: #fdefee;
    color: #c0362c;
    font-size: .8rem;
}

/* Navegación y encabezado */
.sidebar { width: 260px; background: #12181f; border-right: 1px solid #232b36; }
.app-main { width: calc(100% - 260px); margin-left: 260px; }
.sidebar-brand {
    height: auto;
    min-height: 92px;
    padding: 1.5rem;
    border-bottom: 1px solid #232b36;
}
.sidebar-brand strong {
    color: #fff;
    font-family: inherit;
    font-size: 1rem;
    font-weight: 600;
    letter-spacing: .02em;
}
.sidebar-brand small {
    margin-top: .3rem;
    color: #a9b1bd;
    font-size: .7rem;
    letter-spacing: 0;
}
.sidebar-nav { padding: .75rem .5rem; }
.nav-label { margin: 1rem 1rem .35rem; color: #6f7884; font-size: .62rem; }
.nav-item {
    min-height: 48px;
    margin: 0 0 .25rem;
    padding: .75rem 1rem;
    gap: 0;
    border-left: 3px solid transparent;
    border-radius: 6px;
    color: #a9b1bd;
    font-size: .9rem;
    font-weight: 400;
}
.nav-item:hover { background: rgba(255, 255, 255, .04); color: #fff; }
.nav-item.active {
    border-left-color: var(--green);
    background: rgba(47, 111, 237, .1);
    color: #fff;
}
.nav-icon { display: none; }
.sidebar-footer { padding: .75rem; border-top-color: #232b36; }
.user-chip { padding: .4rem .25rem .65rem; }
.avatar { border-radius: 6px; background: rgba(47, 111, 237, .2); color: #b8caf5; font-family: inherit; }
.user-chip strong { font-size: .8rem; font-weight: 500; }
.user-chip small { color: #a9b1bd; }
.logout-button {
    min-height: 44px;
    margin: 0;
    padding: .6rem .75rem;
    align-items: center;
    border: 1px solid #232b36;
    border-radius: 6px;
    color: #a9b1bd;
    font-size: .8rem;
}
.topbar {
    min-height: 72px;
    padding: 1rem 2rem;
    background: var(--surface);
    border-bottom-color: var(--line);
}
.topbar .eyebrow { display: none; }
.topbar h1 {
    font-family: inherit;
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: .01em;
}
.sync-state strong { font-size: .75rem; font-weight: 600; }
.sync-state small { font-size: .68rem; }
.live-dot { background: #3aa76d; box-shadow: none; }
.icon-button, .menu-button { border-radius: 6px; color: var(--muted); }
.filterbar { min-height: 64px; padding: .75rem 2rem; background: var(--surface); }
.quick-periods { border-color: var(--line); border-radius: 6px; background: var(--canvas); }
.quick-periods button { height: 32px; border-radius: 4px; color: var(--muted); font-size: .75rem; }
.quick-periods button.active { color: var(--green); }
.date-range input { height: 36px; border-radius: 4px; font-size: .75rem; }
.secondary-button {
    min-height: 36px;
    border-color: var(--line);
    border-radius: 6px;
    color: var(--ink);
    font-size: .75rem;
}
.content { padding: 2rem; }

/* Indicadores y paneles */
.section-intro h2,
.card-header h3,
.kpi-value,
.operation-stat strong,
.summary-card strong,
.catalog-item strong,
.activity-item > strong,
.error-state strong {
    font-family: inherit;
}
.section-intro h2 { font-size: 1.1rem; font-weight: 600; letter-spacing: 0; }
.section-intro p { font-size: .8rem; }
.section-tag { border-radius: 999px; background: #edf2fd; color: var(--green); font-size: .7rem; }
.kpi-grid { gap: .7rem; }
.kpi-card {
    min-height: 105px;
    padding: .9rem;
    border-radius: 8px;
    box-shadow: none;
}
.kpi-card.primary {
    border-color: var(--line);
    background: var(--surface);
    color: var(--ink);
}
.kpi-card.primary::after { display: none; }
.kpi-label, .primary .kpi-label { color: var(--muted); font-size: .68rem; text-transform: none; }
.kpi-icon, .primary .kpi-icon { color: var(--green); }
.kpi-value { margin-top: .65rem; font-size: 1.2rem; font-weight: 700; letter-spacing: 0; }
.kpi-meta, .primary .kpi-meta { margin-top: auto; color: var(--muted); font-size: .67rem; }
.dashboard-grid, .secondary-grid, .operations-strip, .split-grid { gap: .8rem; }
.card {
    padding: 1rem;
    border-radius: 8px;
    box-shadow: none;
}
.card-header { margin-bottom: .8rem; }
.card-header h3 { font-size: .9rem; font-weight: 600; }
.card-header p, .card-note { font-size: .68rem; }
.chart-column i { background: var(--green); border-radius: 3px 3px 0 0; }
.chart-column:hover i { background: #2559c7; }
.donut { background: conic-gradient(var(--green) 0 50%, #7b91c2 50% 75%, #b6beca 75%); }
.donut strong { font-family: inherit; font-size: 1rem; }
.rank { border-radius: 4px; background: #edf2fd; color: var(--green); font-family: inherit; }
.operation-stat { min-height: 78px; }
.operation-symbol { border-radius: 6px; background: #edf2fd; color: var(--green); font-family: inherit; }
.operation-stat strong { font-size: 1rem; }
.summary-card { border-radius: 8px; }
.summary-card strong { font-size: 1.2rem; font-weight: 700; }
.table-card, .catalog-item { border-radius: 8px; }
.table-filters input, .table-filters select { border-radius: 4px; }
.status-pill { background: #edf8f1; color: #247044; }
.status-pill.cancelada, .status-pill.cancelado, .status-pill.rechazado { background: #fdefee; color: #c0362c; }
.status-pill.pendiente { background: #fff4dd; color: #94631d; }
.status-pill.abierto { background: #edf2fd; color: var(--green); }
.catalog-item::before { background: var(--catalog-color, var(--green)); }
.margin-bar i { background: var(--green); }
.loader { border-top-color: var(--green); }

@media (max-width: 880px) {
    .login-panel { min-height: 0; padding: 0; }
    .sidebar { width: 260px; }
    .app-main { width: 100%; margin-left: 0; }
    .topbar, .filterbar, .content { padding-left: 1.25rem; padding-right: 1.25rem; }
}

@media (max-width: 620px) {
    .login-view { padding: 1rem; }
    .login-card { max-width: calc(100vw - 2rem); }
    .topbar { min-height: 64px; }
}
