:root {
    --ink: #0e1b2c;
    --ink-2: #1b2b40;
    --muted: #6b7788;
    --line: #e5e7eb;
    --sand: #f5f2ec;
    --paper: #fffdf9;
    --white: #ffffff;
    --accent: #ff5c35;
    --accent-soft: #fff0ea;
    --green: #15803d;
    --green-soft: #e9f7ef;
    --amber: #b45309;
    --amber-soft: #fff7e6;
    --blue: #1d4ed8;
    --blue-soft: #eef3ff;
    --red: #b42318;
    --red-soft: #fff1f0;
    --sidebar: #0e1b2c;
    --radius: 16px;
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
    background: var(--sand);
    color: var(--ink);
    font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
h1, h2, h3, p { margin-top: 0; }
code { padding: 1px 5px; border-radius: 4px; background: #f1f5f9; font-size: 11px; }

.alert {
    margin-bottom: 18px;
    padding: 12px 15px;
    border: 1px solid transparent;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
}
.alert--success { background: var(--green-soft); border-color: #bbf7d0; color: var(--green); }
.alert--error { background: var(--red-soft); border-color: #fecaca; color: var(--red); }
.alert--warning { background: var(--amber-soft); border-color: #fde68a; color: var(--amber); }

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    min-height: 38px;
    padding: 9px 16px;
    border: 1px solid transparent;
    border-radius: 9px;
    font-size: 12px;
    font-weight: 700;
    line-height: 1;
    transition: background 0.2s ease, transform 0.2s ease;
}
.button:hover { transform: translateY(-1px); }
.button--accent { background: var(--accent); color: var(--white); }
.button--accent:hover { background: #e84b25; }
.button--dark { background: var(--ink); color: var(--white); }
.button--dark:hover { background: var(--ink-2); }
.button--ghost { border-color: var(--line); background: var(--white); color: var(--ink); }
.button--block { width: 100%; }

/* ---------------- Login ---------------- */
.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 30px 20px;
    background:
        radial-gradient(circle at 20% 10%, rgba(255, 92, 53, 0.12), transparent 35%),
        var(--ink);
}
.login-shell { width: min(100%, 420px); }
.login-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 22px;
    color: var(--white);
}
.login-brand__mark {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: var(--accent);
    font-size: 25px;
    font-weight: 800;
}
.login-brand strong { display: block; font-size: 23px; letter-spacing: -0.05em; }
.login-brand strong span { color: var(--accent); }
.login-brand small { display: block; color: #94a3b8; font-size: 10px; letter-spacing: 0.08em; text-transform: uppercase; }
.login-card {
    padding: 34px;
    background: var(--paper);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 22px;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}
.login-eyebrow { margin-bottom: 8px; color: var(--accent); font-size: 9px; font-weight: 800; letter-spacing: 0.15em; text-transform: uppercase; }
.login-card h1 { margin-bottom: 8px; font-size: 30px; line-height: 1.1; letter-spacing: -0.05em; }
.login-lead { margin-bottom: 23px; color: var(--muted); font-size: 12px; line-height: 1.6; }
.login-form label { display: block; margin-bottom: 6px; color: var(--ink-2); font-size: 10px; font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; }
.login-password { margin-bottom: 14px; }
.login-password input {
    width: 100%;
    min-height: 46px;
    padding: 10px 14px;
    border: 1px solid var(--line);
    border-radius: 9px;
    outline: 0;
    background: var(--white);
    font-size: 15px;
    letter-spacing: 0.1em;
}
.login-password input:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(14, 27, 44, 0.08); }
.login-back { display: block; margin-top: 18px; text-align: center; color: var(--muted); font-size: 11px; }
.login-back:hover { color: var(--ink); }
.login-footer { margin: 18px 0 0; text-align: center; color: #64748b; font-size: 10px; }

/* ---------------- Shell ---------------- */
.admin-shell { display: flex; min-height: 100vh; }
.sidebar {
    position: fixed;
    z-index: 50;
    top: 0;
    bottom: 0;
    left: 0;
    display: flex;
    flex-direction: column;
    width: 246px;
    padding: 24px 16px 18px;
    background: var(--sidebar);
    color: #cbd5e1;
    overflow-y: auto;
}
.sidebar__brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 26px; color: var(--white); }
.brand-mark {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 9px;
    background: var(--accent);
    font-size: 21px;
    font-weight: 800;
}
.sidebar__brand strong { display: block; font-size: 20px; letter-spacing: -0.05em; }
.sidebar__brand strong span { color: var(--accent); }
.sidebar__brand small { display: block; color: #64748b; font-size: 8px; font-weight: 700; letter-spacing: 0.13em; text-transform: uppercase; }
.sidebar__nav { display: flex; flex-direction: column; gap: 3px; }
.sidebar__label { margin: 16px 10px 6px; color: #526175; font-size: 8px; font-weight: 800; letter-spacing: 0.16em; text-transform: uppercase; }
.sidebar__nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 39px;
    padding: 8px 10px;
    border-radius: 8px;
    color: #aebacb;
    font-size: 12px;
    font-weight: 600;
    transition: background 0.15s ease, color 0.15s ease;
}
.sidebar__nav a > span { width: 18px; color: #64748b; font-size: 15px; text-align: center; }
.sidebar__nav a:hover { background: rgba(255, 255, 255, 0.05); color: var(--white); }
.sidebar__nav a.is-active { background: rgba(255, 92, 53, 0.13); color: var(--white); }
.sidebar__nav a.is-active > span { color: var(--accent); }
.sidebar__nav a b {
    margin-left: auto;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    color: #cbd5e1;
    font-size: 9px;
    font-weight: 700;
}
.sidebar__nav a b.b--alert { background: var(--accent); color: var(--white); }
.sidebar__status {
    margin: auto 4px 12px;
    padding: 13px;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
}
.status-line { display: flex; align-items: center; gap: 9px; }
.status-line strong { display: block; color: var(--white); font-size: 10px; }
.status-line small { display: block; margin-top: 1px; color: #64748b; font-size: 8px; }
.sidebar__status > a { display: inline-block; margin-top: 9px; color: #93c5fd; font-size: 9px; font-weight: 700; }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; }
.status-dot--ok { background: #22c55e; box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.15); }
.status-dot--wait { background: #f59e0b; box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15); }
.status-dot--off { background: #ef4444; box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.13); }
.sidebar__logout {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    color: #64748b;
    font-size: 10px;
    font-weight: 600;
}
.sidebar__logout:hover { color: var(--white); }

.admin-main { flex: 1; min-width: 0; margin-left: 246px; }
.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    min-height: 76px;
    padding: 14px 30px;
    background: var(--paper);
    border-bottom: 1px solid var(--line);
}
.topbar__left { display: flex; align-items: center; gap: 12px; }
.topbar h1 { margin: 0; font-size: 19px; line-height: 1.15; letter-spacing: -0.04em; }
.topbar p { margin: 3px 0 0; color: var(--muted); font-size: 9px; }
.menu-toggle { display: none; border: 0; background: none; color: var(--ink); font-size: 20px; }
.topbar__right { display: flex; align-items: center; gap: 15px; }
.live-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 10px;
    border-radius: 999px;
    background: var(--green-soft);
    color: var(--green);
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}
.live-badge i { width: 5px; height: 5px; border-radius: 50%; background: var(--green); }
.topbar__store { color: var(--muted); font-size: 10px; font-weight: 700; }
.topbar__store:hover { color: var(--ink); }
.avatar {
    display: grid;
    place-items: center;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--ink);
    color: var(--white);
    font-size: 9px;
    font-weight: 800;
}

.content { width: min(100%, 1500px); margin: 0 auto; padding: 25px 30px 40px; }
.admin-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    padding: 16px 30px 22px;
    color: #94a3b8;
    font-size: 9px;
}

/* ---------------- Common panels ---------------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 13px; margin-bottom: 16px; }
.kpi-card {
    position: relative;
    overflow: hidden;
    min-height: 123px;
    padding: 18px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.kpi-card__label { display: block; color: var(--muted); font-size: 8px; font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; }
.kpi-card strong { display: block; margin-top: 8px; font-size: 26px; line-height: 1; letter-spacing: -0.05em; }
.kpi-card small { display: block; margin-top: 9px; color: var(--muted); font-size: 9px; }
.kpi-card__icon {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 30px;
    height: 30px;
    border-radius: 8px;
    background: var(--sand);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
}
.kpi-card--accent { background: var(--ink); border-color: var(--ink); color: var(--white); }
.kpi-card--accent .kpi-card__label, .kpi-card--accent small { color: #94a3b8; }
.kpi-card--accent .kpi-card__icon { background: rgba(255, 255, 255, 0.1); color: #f7c8b9; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.7fr); gap: 16px; margin-bottom: 16px; }
.stack { display: grid; gap: 16px; align-content: start; }
.panel {
    min-width: 0;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.panel__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 17px 18px;
    border-bottom: 1px solid #f1f5f9;
}
.panel__head h2 { margin: 0; font-size: 13px; letter-spacing: -0.02em; }
.panel__head p { margin: 2px 0 0; color: var(--muted); font-size: 9px; }
.link-arrow { color: var(--accent); font-size: 9px; font-weight: 800; }
.panel__empty { margin: 0; padding: 20px 18px; color: var(--muted); font-size: 11px; }
.subtle { color: var(--muted); font-size: 9px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th {
    padding: 9px 13px;
    border-bottom: 1px solid #f1f5f9;
    color: #94a3b8;
    font-size: 8px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    white-space: nowrap;
}
td { padding: 11px 13px; border-bottom: 1px solid #f8fafc; color: var(--ink-2); font-size: 10px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfbf8; }
td strong { font-size: 11px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; font-weight: 700; }
.cell-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; }
.empty-cell { padding: 30px 18px; text-align: center; color: var(--muted); font-size: 11px; }
.icon-link {
    display: inline-grid;
    place-items: center;
    width: 25px;
    height: 25px;
    border: 1px solid var(--line);
    border-radius: 7px;
    font-size: 12px;
}
.icon-link:hover { border-color: var(--ink); background: var(--ink); color: var(--white); }
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 7px;
    border-radius: 999px;
    font-size: 7px;
    font-weight: 800;
    letter-spacing: 0.03em;
    white-space: nowrap;
}
.badge--green { background: var(--green-soft); color: var(--green); }
.badge--amber { background: var(--amber-soft); color: var(--amber); }
.badge--blue { background: var(--blue-soft); color: var(--blue); }
.badge--red { background: var(--red-soft); color: var(--red); }
.badge--slate { background: #f1f5f9; color: #475569; }
.text-green { color: var(--green) !important; }
.text-amber { color: var(--amber) !important; }
.text-muted { color: var(--muted) !important; }

.status-hero { padding: 17px 18px 18px; }
.status-hero strong { font-size: 21px; letter-spacing: -0.04em; }
.status-hero p { margin: 4px 0 15px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.simple-list { margin: 0; padding: 4px 18px 12px; list-style: none; }
.simple-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid #f8fafc; }
.simple-list li:last-child { border-bottom: 0; }
.simple-list strong { display: block; font-size: 10px; font-weight: 600; }
.simple-list small { display: block; margin-top: 1px; color: var(--muted); font-size: 8px; }
.count-pill { min-width: 24px; padding: 3px 7px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: 9px; font-weight: 800; text-align: center; }
.count-pill--red { background: var(--red-soft); color: var(--red); }
.quick-grid { display: grid; grid-template-columns: repeat(4, 1fr); }
.quick-card { display: flex; align-items: center; gap: 10px; padding: 16px; border-right: 1px solid #f1f5f9; transition: background 0.15s ease; }
.quick-card:last-child { border-right: 0; }
.quick-card:hover { background: #fcfbf8; }
.quick-card > span { display: grid; place-items: center; width: 31px; height: 31px; flex: 0 0 auto; border-radius: 8px; background: var(--sand); color: var(--accent); font-size: 15px; }
.quick-card strong { display: block; font-size: 10px; }
.quick-card small { display: block; color: var(--muted); font-size: 8px; }
.quick-card b { margin-left: auto; color: var(--muted); font-size: 12px; }

.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 18px; }
.page-intro h2 { margin: 0; font-size: 25px; line-height: 1.1; letter-spacing: -0.05em; }
.page-intro p { max-width: 720px; margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.6; }

/* ---------------- Providers / products ---------------- */
.add-provider { margin-bottom: 16px; }
.add-provider summary {
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 15px 18px;
    color: var(--ink);
    font-size: 11px;
    font-weight: 800;
    cursor: pointer;
    list-style: none;
}
.add-provider summary::-webkit-details-marker { display: none; }
.add-provider summary span { display: grid; place-items: center; width: 21px; height: 21px; border-radius: 6px; background: var(--accent-soft); color: var(--accent); font-size: 14px; }
.add-provider[open] summary { border-bottom: 1px solid #f1f5f9; }
.provider-create { grid-template-columns: 1fr 1fr; }
.provider-create > label, .provider-create .form-row { grid-column: span 1; }
.provider-create > label:nth-last-of-type(3), .provider-create > label:nth-last-of-type(2), .provider-create .check-row { grid-column: 1 / -1; }
.check-row { display: flex !important; align-items: center; gap: 8px; }
.check-row input { width: auto !important; min-height: 0 !important; margin: 0 !important; }
.provider-create .button { justify-self: start; }
.provider-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 14px; margin-bottom: 16px; }
.provider-card { padding: 18px; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.provider-card.is-muted { background: #fbfaf7; }
.provider-card__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; margin-bottom: 15px; }
.provider-card__head h3 { margin: 6px 0 2px; font-size: 15px; letter-spacing: -0.03em; }
.provider-card__head small { color: var(--muted); font-size: 8px; }
.provider-card__count { color: var(--ink); font-size: 24px; font-weight: 800; line-height: 1; letter-spacing: -0.05em; text-align: right; }
.provider-card__count small { display: block; margin-top: 3px; color: var(--muted); font-size: 7px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; }
.provider-form { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.provider-form label, .form-grid label { color: var(--muted); font-size: 8px; font-weight: 700; letter-spacing: 0.03em; }
.provider-form label { display: block; }
.provider-form input, .form-grid input, .form-grid textarea, .form-grid select {
    width: 100%;
    min-height: 36px;
    margin-top: 4px;
    padding: 7px 9px;
    border: 1px solid var(--line);
    border-radius: 7px;
    outline: 0;
    background: var(--white);
    color: var(--ink);
    font-size: 11px;
    font-weight: 600;
}
.provider-form input:focus, .form-grid input:focus, .form-grid textarea:focus { border-color: var(--ink); box-shadow: 0 0 0 3px rgba(14, 27, 44, 0.06); }
.provider-form .button { grid-column: 1 / -1; margin-top: 2px; }
.product-cell { display: flex; align-items: center; gap: 9px; min-width: 210px; }
.product-cell img { width: 38px; height: 38px; flex: 0 0 auto; border-radius: 7px; background: var(--sand); object-fit: cover; }
.product-cell strong { display: block; font-size: 10px; font-weight: 700; line-height: 1.35; }
.product-cell small { display: block; margin-top: 2px; color: var(--muted); font-size: 7px; }
.inline-form { display: inline-flex; align-items: center; gap: 7px; }
.switch { position: relative; display: inline-block; width: 32px; height: 18px; }
.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 999px; background: #cbd5e1; transition: background 0.2s ease; cursor: pointer; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: var(--white); transition: transform 0.2s ease; }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(14px); }
.select-small { min-height: 30px; max-width: 155px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 7px; background: var(--white); font-size: 9px; }
.mini-button { padding: 5px 9px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--ink); font-size: 8px; font-weight: 700; }
.mini-button:hover { border-color: var(--ink); }

/* ---------------- Pedidos: búsqueda y documentos ---------------- */
.orders-tools {
    display: flex;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 9px;
    margin-bottom: 16px;
    padding: 13px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
}
.orders-tools label { color: var(--muted); font-size: 8px; font-weight: 700; }
.orders-tools input, .orders-tools select {
    display: block;
    min-height: 34px;
    margin-top: 4px;
    padding: 6px 8px;
    border: 1px solid var(--line);
    border-radius: 7px;
    background: var(--white);
    color: var(--ink);
    font-size: 10px;
}
.orders-tools input:focus, .orders-tools select:focus { border-color: var(--ink); outline: 0; }
.orders-tools__search { flex: 1 1 250px; }
.orders-tools__search input { width: 100%; }
.orders-tools .button, .orders-tools .text-link { margin-bottom: 0; }
.order-code-link { color: var(--blue); text-decoration: underline; text-underline-offset: 3px; }
.order-detail { margin-bottom: 16px; }
.payment-trace { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 0 18px; padding: 12px 0; border-top: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9; }
.payment-trace > div { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.payment-trace strong { font-size: 16px; }
.payment-trace small { color: var(--muted); font-size: 9px; }
.payment-trace .detail-subtitle { margin: 0; }
.supplier-trace { background: #f8fafc; }
.supplier-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; }
.supplier-update .input-small { width: 100px; min-height: 30px; padding: 4px 7px; border: 1px solid var(--line); border-radius: 7px; font-size: 9px; }
.badge--blue { background: var(--blue-soft); color: var(--blue); }
.order-detail .panel__head h2 { font-size: 18px; }
.order-detail__grid { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; padding: 18px; }
.detail-list { display: grid; gap: 8px; margin: 0; }
.detail-list div { display: grid; grid-template-columns: 105px 1fr; gap: 10px; padding-bottom: 7px; border-bottom: 1px solid #f8fafc; }
.detail-list dt { color: var(--muted); font-size: 9px; font-weight: 700; }
.detail-list dd { margin: 0; color: var(--ink-2); font-size: 10px; }
.detail-list dd small { color: var(--muted); }
.order-detail__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 15px; }
.detail-subtitle { margin: 0 0 9px; font-size: 12px; }
.document-list { display: grid; gap: 7px; margin: 0 0 14px; padding: 0; list-style: none; }
.document-list li { display: flex; align-items: center; gap: 9px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: #fcfbf8; }
.document-list li > div:nth-child(2) { min-width: 0; flex: 1; }
.document-list strong { display: block; overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.document-list small { display: block; overflow: hidden; margin-top: 2px; color: var(--muted); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.document-icon { display: grid; place-items: center; width: 30px; height: 34px; flex: 0 0 auto; border-radius: 5px; background: var(--red-soft); color: var(--red); font-size: 8px; font-weight: 800; }
.document-actions { display: flex; gap: 4px; }
.document-form { padding: 0; margin-top: 12px; }
.payment-reconciliation { margin-bottom: 16px; }
.payment-head__device { display: flex; align-items: center; flex-wrap: wrap; gap: 7px; justify-content: flex-end; }
.payment-head__device small { color: var(--muted); font-size: 9px; }
.payment-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; padding: 14px 18px; border-top: 1px solid #f1f5f9; border-bottom: 1px solid #f1f5f9; background: #fcfbf8; }
.payment-kpi { padding: 11px 13px; border: 1px solid var(--line); border-radius: 9px; background: var(--white); }
.payment-kpi small { display: block; margin-bottom: 4px; color: var(--muted); font-size: 9px; }
.payment-kpi strong { display: block; font-size: 23px; line-height: 1.1; }
.payment-kpi--warn { border-color: #fde68a; background: #fffdf5; }
.payment-kpi--warn strong { color: #b45309; }
.payment-kpi--ok { border-color: #bbf7d0; background: #f8fff9; }
.payment-kpi--ok strong { color: #15803d; }
.payment-inbox { padding: 14px 18px 18px; }
.payment-inbox__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.payment-inbox__head h3 { margin: 0; font-size: 13px; }
.payment-inbox__head small { color: var(--muted); font-size: 9px; }
.payments-table { min-width: 920px; font-size: 10px; }
.payments-table th { padding: 9px 8px; background: #fcfbf8; color: var(--muted); font-size: 8px; letter-spacing: 0.04em; text-transform: uppercase; }
.payments-table td { padding: 10px 8px; vertical-align: middle; border-bottom: 1px solid #f1f5f9; }
.payments-table tr.is-pending td { background: #fffdf5; }
.payments-table tr:hover td { background: #fcfbf8; }
.payments-table td strong { display: block; font-size: 11px; }
.payments-table td small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; }
.payment-time { width: 150px; }
.payment-amount { width: 100px; }
.payment-amount .badge { display: inline-block; margin-top: 4px; }
.payment-sender { max-width: 310px; }
.payment-sender small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.payment-code { width: 105px; }
.payment-code__value { display: inline-grid; place-items: center; min-width: 34px; padding: 3px 6px; border-radius: 6px; background: var(--ink); color: var(--white); font-family: monospace; font-size: 12px; font-weight: 700; letter-spacing: 0.06em; }
.payment-actions-cell { width: 190px; }
.pay-actions summary { display: inline-block; padding: 5px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); cursor: pointer; font-size: 9px; font-weight: 700; color: var(--ink-2); list-style: none; }
.pay-actions summary::-webkit-details-marker { display: none; }
.pay-actions summary::after { content: " ▾"; }
.pay-actions[open] summary { border-color: var(--ink); background: var(--ink); color: var(--white); }
.pay-actions__menu { display: grid; gap: 7px; min-width: 310px; margin-top: 7px; padding: 9px; border: 1px solid var(--line); border-radius: 8px; background: var(--white); box-shadow: 0 8px 20px rgba(15, 23, 42, 0.12); }
.pay-action-form { display: grid; gap: 6px; }
.pay-action-form select { width: 100%; padding: 7px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--ink-2); font-size: 9px; }
.pay-action-form__row { display: flex; gap: 5px; }
.pay-action-form__row input { min-width: 0; flex: 1; padding: 7px; border: 1px solid var(--line); border-radius: 6px; font-size: 9px; }
.payment-intents { margin: 0 18px 18px; border-top: 1px solid #f1f5f9; }
.payment-intents summary { padding: 10px 0 7px; color: var(--muted); cursor: pointer; font-size: 9px; font-weight: 700; }
.payment-intents table { font-size: 9px; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 18px; border-top: 1px solid #f1f5f9; color: var(--muted); font-size: 9px; }
.pagination div { display: flex; gap: 6px; }

/* ---------------- Chat ---------------- */
.chat-layout { display: grid; grid-template-columns: 310px minmax(0, 1fr); height: calc(100vh - 166px); min-height: 540px; overflow: hidden; background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.conversation-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.conversation-list__head { display: flex; align-items: center; justify-content: space-between; padding: 15px 16px; border-bottom: 1px solid #f1f5f9; }
.conversation-list__head h2 { margin: 0; font-size: 13px; }
.conversation-list__head span { padding: 2px 6px; border-radius: 999px; background: var(--sand); color: var(--muted); font-size: 8px; font-weight: 800; }
.conversation-scroll { flex: 1; overflow-y: auto; }
.conversation { display: flex; align-items: center; gap: 9px; padding: 11px 14px; border-bottom: 1px solid #f8fafc; transition: background 0.15s ease; }
.conversation:hover { background: #fbfaf7; }
.conversation.is-active { background: var(--accent-soft); }
.conversation__avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: 0 0 auto; border-radius: 50%; background: var(--sand); color: var(--ink); font-size: 11px; font-weight: 800; }
.conversation.is-active .conversation__avatar { background: var(--white); }
.conversation__body { min-width: 0; flex: 1; }
.conversation__body > div { display: flex; justify-content: space-between; gap: 5px; }
.conversation__body strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.conversation__body small { flex: 0 0 auto; color: var(--muted); font-size: 7px; }
.conversation__body p { overflow: hidden; margin: 2px 0 0; color: var(--muted); font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.conversation__phone { display: block; overflow: hidden; margin-top: 1px; color: var(--blue); font-family: monospace; font-size: 8px; letter-spacing: 0.02em; text-overflow: ellipsis; white-space: nowrap; }
.unread { display: grid; place-items: center; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: var(--white); font-size: 7px; font-weight: 800; }
.chat-panel { display: flex; flex-direction: column; min-height: 0; background: #fbfaf7; }
.chat-panel__head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--white); border-bottom: 1px solid var(--line); }
.chat-panel__head div:nth-child(2) { flex: 1; }
.chat-panel__head h2 { margin: 0; font-size: 12px; }
.chat-panel__head p { margin: 1px 0 0; color: var(--muted); font-size: 8px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 18px; }
.bubble-wrap { display: flex; margin-bottom: 9px; }
.bubble-wrap--out { justify-content: flex-end; }
.bubble { max-width: min(75%, 530px); padding: 9px 12px 7px; border-radius: 12px; background: var(--white); border: 1px solid #ece7de; box-shadow: 0 2px 4px rgba(15, 23, 42, 0.03); }
.bubble-wrap--out .bubble { background: var(--ink); border-color: var(--ink); color: var(--white); }
.bubble p { margin: 0; font-size: 11px; line-height: 1.55; }
.bubble small { display: block; margin-top: 4px; color: var(--muted); font-size: 7px; text-align: right; }
.bubble-wrap--out small { color: #94a3b8; }
.chat-media-link { display: block; margin-bottom: 7px; }
.chat-media { max-width: 230px; max-height: 260px; border: 1px solid #e2e8f0; border-radius: 8px; object-fit: contain; background: var(--white); }
.chat-doc { display: inline-block; margin-bottom: 6px; color: var(--blue); font-size: 10px; font-weight: 700; text-decoration: underline; }
.order-actions { display: flex; align-items: center; gap: 5px; }
.chat-doc-send { display: flex; align-items: center; gap: 7px; padding: 8px 12px; background: #fffcf5; border-top: 1px solid var(--line); }
.chat-doc-send select { min-width: 0; flex: 1; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--white); color: var(--ink-2); font-size: 9px; }
.chat-reply { display: flex; gap: 8px; padding: 12px; background: var(--white); border-top: 1px solid var(--line); }
.chat-reply textarea { flex: 1; min-height: 42px; max-height: 100px; padding: 10px; resize: vertical; border: 1px solid var(--line); border-radius: 8px; outline: 0; font-size: 11px; }
.chat-reply textarea:focus { border-color: var(--ink); }
.chat-empty { display: grid; place-content: center; max-width: 350px; margin: auto; padding: 40px; text-align: center; }
.chat-empty > span { color: var(--accent); font-size: 38px; }
.chat-empty h2 { margin: 8px 0 6px; font-size: 17px; letter-spacing: -0.03em; }
.chat-empty p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.6; }

/* ---------------- WhatsApp / settings ---------------- */
.page-intro .text-link { color: var(--accent); font-weight: 700; text-decoration: underline; text-underline-offset: 3px; }
.wa-grid, .settings-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 16px; align-items: start; }
.bot-control { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; padding: 16px 18px; border-left: 4px solid var(--green); }
.bot-control.is-paused { border-left-color: var(--amber); background: #fffaf0; }
.bot-control__icon { display: grid; place-items: center; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 18px; font-weight: 800; }
.bot-control.is-paused .bot-control__icon { background: #fef3c7; color: #b45309; }
.bot-control__copy { flex: 1; min-width: 0; }
.bot-control__copy h2 { margin: 6px 0 3px; font-size: 14px; letter-spacing: -0.02em; }
.bot-control__copy p { margin: 0; color: var(--muted); font-size: 10px; line-height: 1.5; }
.bot-control__copy small { display: block; margin-top: 4px; color: var(--muted); font-size: 8px; }
.bot-control__action { flex: 0 0 auto; }
@media (max-width: 760px) {
    .bot-control { align-items: flex-start; flex-wrap: wrap; }
    .bot-control__action { width: 100%; }
    .bot-control__action .button { width: 100%; }
}
.pagos-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 16px; align-items: start; }
.payment-card { overflow: hidden; border-top: 4px solid var(--accent); }
.payment-card--purple { border-top-color: #7c3aed; }
.payment-card--teal { border-top-color: #0f766e; }
.payment-card .panel__head { align-items: flex-start; }
.payment-card .panel__head h2 { margin-top: 6px; font-size: 20px; letter-spacing: -0.04em; }
.payment-card__logo {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    flex: 0 0 auto;
    border-radius: 12px;
    background: var(--sand);
    color: var(--ink);
    font-size: 18px;
    font-weight: 800;
}
.payment-card--purple .payment-card__logo { background: #f3e8ff; color: #7c3aed; }
.payment-card--teal .payment-card__logo { background: #ccfbf1; color: #0f766e; }
.payment-card .qr-preview img { width: 92px; height: 92px; }
.pago-steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.pago-steps > div { padding: 18px; border-right: 1px solid #f1f5f9; }
.pago-steps > div:last-child { border-right: 0; }
.pago-steps span {
    display: grid;
    place-items: center;
    width: 24px;
    height: 24px;
    margin-bottom: 9px;
    border-radius: 50%;
    background: var(--accent-soft);
    color: var(--accent);
    font-size: 10px;
    font-weight: 800;
}
.pago-steps strong { display: block; font-size: 10px; }
.pago-steps p { margin: 4px 0 0; color: var(--muted); font-size: 9px; line-height: 1.6; }
.form-grid { display: grid; gap: 11px; padding: 17px 18px 18px; }
.form-grid > label { display: block; }
.form-grid input, .form-grid textarea, .form-grid select { margin-top: 5px; min-height: 39px; }
.form-grid textarea { resize: vertical; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.file-field small { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; font-weight: 500; }
.file-field input[type="file"] { padding: 7px; background: var(--sand); }
.file-field input[type="file"]::file-selector-button {
    margin-right: 10px;
    padding: 6px 10px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: var(--white);
    color: var(--ink);
    font-size: 10px;
    font-weight: 700;
    cursor: pointer;
}
.qr-preview { display: flex; align-items: center; gap: 11px; padding: 9px; border: 1px solid var(--line); border-radius: 9px; background: #fcfbf8; }
.qr-preview img { width: 62px; height: 62px; border-radius: 6px; background: var(--white); object-fit: contain; }
.qr-preview strong { display: block; font-size: 10px; }
.qr-preview small { display: block; margin-top: 2px; color: var(--muted); font-size: 8px; line-height: 1.4; }
.qr-preview--empty span { display: grid; place-items: center; width: 62px; height: 62px; border: 1px dashed var(--line); border-radius: 6px; color: var(--muted); font-size: 9px; font-weight: 800; }
.wa-connected { padding: 24px 20px 18px; text-align: center; }
.wa-connected__icon { display: grid; place-items: center; width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 25px; font-weight: 700; }
.wa-connected h3 { margin-bottom: 6px; font-size: 17px; letter-spacing: -0.03em; }
.wa-connected p { max-width: 330px; margin: 0 auto 16px; color: var(--muted); font-size: 10px; line-height: 1.6; }
.wa-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 14px; }
.wa-meta div { padding: 10px; border-radius: 8px; background: var(--sand); text-align: left; }
.wa-meta small { display: block; color: var(--muted); font-size: 7px; text-transform: uppercase; }
.wa-meta strong { display: block; margin-top: 2px; font-size: 10px; }
.wa-qr { padding: 18px; text-align: center; }
.wa-qr img { width: min(245px, 80%); margin: 0 auto 12px; border: 1px solid var(--line); border-radius: 10px; padding: 8px; background: var(--white); }
.wa-qr p { margin: 0 auto 6px; max-width: 330px; color: var(--ink-2); font-size: 10px; line-height: 1.55; }
.wa-qr > small { display: block; margin-bottom: 13px; color: var(--muted); font-size: 8px; }
.wa-qr__placeholder { padding: 25px 10px; }
.wa-qr__placeholder span { display: block; color: var(--muted); font-size: 42px; }
.wa-qr__placeholder p { font-weight: 700; }
.wa-qr__placeholder small { display: block; color: var(--muted); font-size: 8px; }
.hint-box { margin: 0 18px 18px; padding: 11px 12px; border: 1px solid #f1e5d2; border-radius: 8px; background: #fffcf5; }
.wa-reset { padding: 0 18px 18px; }
.hint-box strong { display: block; font-size: 9px; }
.hint-box span { display: block; margin-top: 3px; color: var(--muted); font-size: 8px; line-height: 1.55; }
.system-list { margin: 0; padding: 5px 18px 14px; list-style: none; }
.system-list li { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 10px 0; border-bottom: 1px solid #f8fafc; }
.system-list li:last-child { border-bottom: 0; }
.system-list span { color: var(--muted); font-size: 9px; }
.system-list strong { font-size: 9px; text-align: right; }

@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-grid { grid-template-columns: repeat(2, 1fr); }
    .quick-card:nth-child(2) { border-right: 0; }
    .quick-card:nth-child(n+3) { border-top: 1px solid #f1f5f9; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .wa-grid, .settings-grid { grid-template-columns: 1fr; }
    .provider-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); transition: transform 0.2s ease; box-shadow: 18px 0 40px rgba(0, 0, 0, 0.2); }
    .sidebar.is-open { transform: translateX(0); }
    .admin-main { margin-left: 0; }
    .menu-toggle { display: block; }
    .topbar { min-height: 66px; padding: 12px 16px; }
    .content { padding: 18px 16px 30px; }
    .admin-footer { padding-inline: 16px; }
    .chat-layout { grid-template-columns: 255px minmax(0, 1fr); }
    .topbar__store, .live-badge { display: none; }
    .pagos-grid { grid-template-columns: 1fr; }
    .order-detail__grid { grid-template-columns: 1fr; }
    .payment-columns { grid-template-columns: 1fr; }
}

@media (max-width: 700px) {
    .topbar h1 { font-size: 16px; }
    .page-intro { display: block; }
    .page-intro .button, .page-intro .subtle { margin-top: 10px; }
    .kpi-card strong { font-size: 23px; }
    .provider-form { grid-template-columns: 1fr 1fr; }
    .provider-form .button { grid-column: 1 / -1; }
    .provider-create { grid-template-columns: 1fr; }
    .provider-create > label, .provider-create .form-row { grid-column: 1 / -1; }
    .chat-layout { display: block; height: auto; min-height: 0; }
    .conversation-list { max-height: 245px; border-right: 0; border-bottom: 1px solid var(--line); }
    .chat-panel { min-height: 480px; }
    .chat-panel__head .mini-button { display: none; }
    .bubble { max-width: 88%; }
    .form-row { grid-template-columns: 1fr; }
    .quick-grid { grid-template-columns: 1fr; }
    .quick-card { border-right: 0; border-top: 1px solid #f1f5f9; }
    .quick-card:first-child { border-top: 0; }
    .pago-steps { grid-template-columns: 1fr; }
    .pago-steps > div { border-right: 0; border-bottom: 1px solid #f1f5f9; }
    .pago-steps > div:last-child { border-bottom: 0; }
    .orders-tools { display: grid; grid-template-columns: 1fr 1fr; }
    .orders-tools__search { grid-column: 1 / -1; }
    .orders-tools .button, .orders-tools .text-link { align-self: end; }
    .document-list li { align-items: flex-start; flex-wrap: wrap; }
    .document-actions { margin-left: 39px; }
    .payment-trace { align-items: flex-start; flex-direction: column; }
    .payment-kpis { grid-template-columns: 1fr; }
    .payment-device { align-items: flex-start; flex-direction: column; gap: 3px; }
    .unassigned-payment { grid-template-columns: 1fr; }
    .prepaid-form__row { flex-direction: column; }
    .prepaid-form__row input[type="tel"] { max-width: none; }
    .payment-head__device { justify-content: flex-start; }
    .payment-inbox__head { align-items: flex-start; flex-direction: column; gap: 4px; }
    .payment-inbox { padding: 12px; }
    .pay-actions__menu { min-width: 240px; }
    .admin-footer { display: block; }
    .admin-footer span + span { display: block; margin-top: 5px; }
}

@media (max-width: 460px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .login-card { padding: 26px 20px; }
    .provider-form { grid-template-columns: 1fr; }
    .topbar__right { gap: 8px; }
}
