/* Sincronizador ERP <-> POSBerry - estilo Partners Hub */

:root {
    --bg: #f6f6f9;
    --surface: #ffffff;
    --border: #e5e7eb;
    --border-strong: #d1d5db;
    --text: #1f2330;
    --text-2: #4b5563;
    --muted: #6b7280;
    --primary: #6d67b8;
    --primary-hover: #5c56a8;
    --primary-soft: #eeedf8;
    --primary-soft-2: #f6f5fb;
    --primary-text: #5b55a8;
    --danger: #e4345b;
    --danger-hover: #c92a4d;
    --danger-soft: #fdecf0;
    --success: #16a34a;
    --success-soft: #e6f7ec;
    --warning: #b45309;
    --warning-soft: #fff4dd;
    --info: #2563eb;
    --info-soft: #e8f0fe;
    --teal: #0f766e;
    --teal-soft: #e0f2f1;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
    --sidebar-w: 280px;
    --font: Inter, "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: Consolas, "SFMono-Regular", Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.5;
}
a { color: var(--primary-text); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4, h5 { margin: 0; font-weight: 700; line-height: 1.25; color: var(--text); }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; }
p { margin: 0 0 0.75rem; }
small, .muted { color: var(--muted); }
small { font-size: 0.875em; }
code { font-family: var(--mono); font-size: 0.9em; background: #f1f2f6; padding: 1px 6px; border-radius: 5px; }
pre { font-family: var(--mono); font-size: 0.8rem; white-space: pre-wrap; word-break: break-word;
      background: #f8f9fb; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; margin: 6px 0; }
hr { border: 0; border-top: 1px solid var(--border); margin: 1rem 0; }
svg.icon { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
svg.icon.sm { width: 16px; height: 16px; }

/* ---------- Layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
    width: var(--sidebar-w); flex: none;
    background: var(--surface); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh;
}
.content { flex: 1; min-width: 0; }
.page { max-width: 1240px; margin: 0 auto; padding: 32px 40px 56px; }

.brand { display: flex; align-items: center; gap: 12px; padding: 20px 20px 16px; border-bottom: 1px solid var(--border); }
.brand .logo { width: 44px; height: 44px; border-radius: 50%; background: var(--primary-soft); color: var(--primary);
               display: flex; align-items: center; justify-content: center; flex: none; }
.brand .logo svg.icon { width: 22px; height: 22px; }
.brand .name { font-weight: 700; font-size: 1rem; line-height: 1.2; }
.brand .handle { color: var(--muted); font-size: 0.85rem; }

.nav { flex: 1; overflow-y: auto; padding: 14px 14px 8px; }
.nav-section { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted);
               padding: 12px 10px 8px; }
.nav-item + .nav-section { margin-top: 10px; border-top: 1px solid var(--border); padding-top: 18px; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 12px; margin-bottom: 2px; border-radius: 10px;
    color: var(--text); font-size: 1.02rem; text-decoration: none;
}
.nav-item:hover { background: #f3f4f8; text-decoration: none; }
.nav-item.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 500; }
.nav-item .icon { color: var(--text-2); }
.nav-item.active .icon { color: var(--primary); }
.nav-item .count { margin-left: auto; }

.sidebar-user { border-top: 1px solid var(--border); padding: 16px 20px 18px; }
.sidebar-user .who { font-weight: 600; font-size: 1rem; }
.sidebar-user .meta { color: var(--muted); font-size: 0.85rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .nav-item { padding: 9px 4px; margin-top: 6px; }
.sidebar-user .nav-item.danger { color: var(--danger); }
.sidebar-user .nav-item.danger .icon { color: var(--danger); }
.sidebar-user form { margin: 0; }
.sidebar-user button.nav-item { width: 100%; background: none; border: 0; cursor: pointer; font: inherit; text-align: left; justify-content: flex-start; }

.topbar { display: none; }
.backdrop { display: none; }

/* ---------- Page header ---------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-header .subtitle { color: var(--text-2); margin: 6px 0 0; font-size: 1.02rem; }
.page-header .actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-header .title-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }

/* ---------- Guide banner ---------- */
.guide { position: relative; background: var(--primary-soft-2); border: 1px solid #e4e2f3; border-radius: var(--radius);
         padding: 18px 48px 16px 20px; margin-bottom: 22px; }
.guide .guide-title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 1.05rem; margin-bottom: 8px; }
.guide .guide-title .icon { color: var(--primary); }
.guide ul { margin: 0; padding-left: 26px; color: var(--text-2); }
.guide li { margin: 4px 0; }
.guide .close { position: absolute; top: 14px; right: 14px; background: none; border: 0; color: var(--muted); cursor: pointer;
                padding: 4px; border-radius: 6px; line-height: 0; }
.guide .close:hover { background: #e9e7f5; color: var(--text); }
.guide[hidden] { display: none; }

/* ---------- Alerts ---------- */
.alert { display: flex; align-items: center; gap: 12px; border-radius: var(--radius); padding: 14px 18px; margin-bottom: 20px; font-weight: 500; }
.alert .icon { flex: none; }
.alert .spacer { flex: 1; }
.alert-danger { background: var(--danger); color: #fff; }
.alert-danger a { color: #fff; text-decoration: underline; font-weight: 600; }
.alert-success { background: var(--success-soft); color: #166534; border: 1px solid #bfe8cc; }
.alert-warning { background: var(--warning-soft); color: #92400e; border: 1px solid #fbe3b2; }
.alert-info { background: var(--info-soft); color: #1e40af; border: 1px solid #c7d7fb; }

/* ---------- Cards ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
               padding: 16px 20px; border-bottom: 1px solid var(--border); }
.card-header h3 { font-size: 1.05rem; }
.card-header .hint { color: var(--muted); font-size: 0.9rem; margin: 2px 0 0; }
.card-body { padding: 18px 20px; }
.card-body.tight { padding: 0; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(380px, 1fr)); gap: 18px; }
.card-grid .card { margin-bottom: 0; display: flex; flex-direction: column; }
.card-grid .card .card-body { flex: 1; }

/* ---------- Stat chips ---------- */
.stats { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.stat { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border);
        border-radius: 10px; padding: 8px 14px; font-size: 0.95rem; color: var(--text-2); }
.stat strong { color: var(--text); font-size: 1.05rem; }
.stat .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--muted); }
.stat .dot.success { background: var(--success); }
.stat .dot.danger { background: var(--danger); }
.stat .dot.primary { background: var(--primary); }
.stat .dot.info { background: var(--info); }
.stat .dot.warning { background: #f59e0b; }

.kpis { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
.kpi { background: #fafafc; border: 1px solid var(--border); border-radius: 10px; padding: 12px 14px; }
.kpi .kpi-label { color: var(--muted); font-size: 0.85rem; }
.kpi .kpi-value { font-size: 1.3rem; font-weight: 700; margin-top: 2px; word-break: break-word; }

/* ---------- Pills / badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; font-size: 0.8rem;
        font-weight: 500; white-space: nowrap; line-height: 1.6; border: 1px solid transparent; }
.pill-primary { background: var(--primary-soft); color: var(--primary-text); border-color: #dcd9f0; }
.pill-success { background: var(--success-soft); color: #15803d; border-color: #bfe8cc; }
.pill-danger  { background: var(--danger-soft); color: #be123c; border-color: #f9c9d4; }
.pill-warning { background: var(--warning-soft); color: var(--warning); border-color: #fbe3b2; }
.pill-info    { background: var(--info-soft); color: #1d4ed8; border-color: #c7d7fb; }
.pill-teal    { background: var(--teal-soft); color: var(--teal); border-color: #b2dfdb; }
.pill-gray    { background: #f1f2f6; color: var(--text-2); border-color: #e2e4ea; }
.pill-outline { background: var(--surface); color: var(--text-2); border-color: var(--border-strong); }
.pill .icon { width: 13px; height: 13px; }
a.pill:hover { text-decoration: none; filter: brightness(0.96); }

.count { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 22px; padding: 0 7px;
         border-radius: 999px; background: var(--danger); color: #fff; font-size: 0.78rem; font-weight: 600; line-height: 1; }
.count.primary { background: var(--primary); }
.count.gray { background: #e5e7eb; color: var(--text-2); }

.field-badge { display: inline-block; font-size: 0.7rem; font-weight: 600; padding: 1px 7px; border-radius: 999px;
               margin-left: 5px; vertical-align: middle; line-height: 1.5; }
.field-required { background: var(--danger-soft); color: #be123c; }
.field-optional { background: #f1f2f6; color: var(--text-2); font-weight: 500; }
.field-task { background: var(--primary-soft); color: var(--primary-text); font-weight: 500; font-family: var(--mono); }

.avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--primary-soft); color: var(--primary-text);
          display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.95rem; flex: none;
          text-transform: uppercase; }

/* ---------- Buttons ---------- */
.btn, button, input[type="submit"] {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    padding: 9px 16px; border-radius: 10px; border: 1px solid var(--border-strong);
    background: var(--surface); color: var(--text); font: inherit; font-weight: 500; font-size: 0.95rem;
    cursor: pointer; line-height: 1.25; text-decoration: none; white-space: nowrap;
    transition: background 0.12s, border-color 0.12s;
}
.btn:hover, button:hover { background: #f5f5f8; text-decoration: none; }
.btn-primary, button.primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover, button.primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--surface); border-color: #f3c4cf; color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-danger-solid { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger-solid:hover { background: var(--danger-hover); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--primary-text); }
.btn-ghost:hover { background: var(--primary-soft); }
.btn-sm { padding: 6px 12px; font-size: 0.85rem; border-radius: 8px; }
.btn-xs { padding: 3px 9px; font-size: 0.8rem; border-radius: 7px; }
.btn-block { width: 100%; }
.btn[disabled], button[disabled] { opacity: 0.55; cursor: not-allowed; }

/* ---------- Forms ---------- */
form { margin: 0; }
label { display: block; font-weight: 500; font-size: 0.92rem; margin-bottom: 12px; color: var(--text); }
label > input, label > select, label > textarea { margin-top: 5px; }
label small { display: block; font-weight: 400; color: var(--muted); margin-top: 4px; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; cursor: pointer; }
input, select, textarea {
    display: block; width: 100%; padding: 9px 12px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm);
    background: var(--surface); color: var(--text); font: inherit; font-size: 0.95rem;
}
input:focus, select:focus, textarea:focus { outline: 2px solid #c9c6ea; outline-offset: 0; border-color: var(--primary); }
input::placeholder, textarea::placeholder { color: #a1a5b3; }
input[disabled] { background: #f6f6f9; color: var(--muted); }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: 16px; height: 16px; padding: 0; accent-color: var(--primary);
                                             margin: 0; vertical-align: middle; border: 0; }
textarea { resize: vertical; }
input.inline, select.inline { display: inline-block; width: auto; }
.form-narrow { max-width: 560px; }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row label { margin-bottom: 0; flex: 1 1 160px; }
.form-row .btn, .form-row button { flex: none; }
.form-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }
.input-icon { position: relative; }
.input-icon .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #9ca3af; pointer-events: none; width: 18px; height: 18px; }
.input-icon input { padding-left: 40px; margin-top: 0; }
.input-icon input.has-toggle { padding-right: 42px; }
.input-icon .toggle { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0;
                      padding: 4px; color: #6b7280; line-height: 0; border-radius: 6px; }
.input-icon .toggle:hover { background: #f1f2f6; }
label .input-icon { margin-top: 6px; }
.search { position: relative; flex: 1 1 280px; max-width: 520px; }
.search .icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #9ca3af; pointer-events: none; width: 18px; height: 18px; }
.search input { padding-left: 42px; padding-right: 36px; border-radius: 10px; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; appearance: none; }
.search .clear { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); background: none; border: 0; padding: 0;
                 width: 26px; height: 26px; display: inline-flex; align-items: center; justify-content: center;
                 color: var(--muted); line-height: 0; border-radius: 6px; }
.search .clear:hover { background: #f1f2f6; color: var(--text); }
.search .clear[hidden] { display: none; }

fieldset { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 20px 6px; margin: 0 0 18px; min-width: 0; }
legend { padding: 0 8px; font-weight: 600; }
fieldset[hidden] { display: none; }

details { border: 1px solid var(--border); border-radius: var(--radius); margin-bottom: 12px; background: var(--surface); }
details > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; display: flex; align-items: center; gap: 8px; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; width: 7px; height: 7px; border-right: 2px solid var(--muted); border-bottom: 2px solid var(--muted);
                            transform: rotate(-45deg); transition: transform 0.15s; margin-right: 4px; flex: none; }
details[open] > summary::before { transform: rotate(45deg); }
details .details-body { padding: 14px 16px 4px; border-top: 1px solid var(--border); }
details.plain { border: 0; background: transparent; margin: 0; }
details.plain > summary { padding: 4px 0; font-weight: 500; color: var(--primary-text); font-size: 0.85rem; }
details.plain .details-body { border-top: 0; padding: 6px 0 0; }

.config-help { font-size: 0.88rem; color: var(--text-2); margin-bottom: 12px; }
.config-help p { margin-bottom: 0.4rem; }
.config-help ul { margin: 0 0 0.4rem; padding-left: 20px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
thead th { text-align: left; font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted);
           padding: 10px 14px; border-bottom: 1px solid var(--border); background: #fafafc; white-space: nowrap; }
tbody td, tfoot td { padding: 11px 14px; border-bottom: 1px solid var(--border); vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tfoot td { background: #fafafc; border-top: 1px solid var(--border); border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.empty { text-align: center; color: var(--muted); padding: 28px 14px; }
table .btn-xs, table .btn-sm { vertical-align: middle; }
table form { display: inline; }
table input:not([type="checkbox"]), table select { padding: 6px 10px; font-size: 0.88rem; }
.card-body.tight table thead th:first-child, .card-body.tight table td:first-child { padding-left: 20px; }
.card-body.tight table thead th:last-child, .card-body.tight table td:last-child { padding-right: 20px; }
.card-body.tight .table-wrap { border-radius: 0 0 var(--radius) var(--radius); }
.card-body.tight:first-child table thead th { border-radius: var(--radius) var(--radius) 0 0; }

/* ---------- Segmented / tabs ---------- */
.segmented { display: inline-flex; background: #f1f2f6; border-radius: 10px; padding: 4px; gap: 2px; flex-wrap: wrap; }
.segmented a, .segmented button { padding: 6px 14px; border-radius: 8px; color: var(--text-2); font-weight: 500; font-size: 0.92rem;
                                  border: 0; background: transparent; }
.segmented a.active, .segmented button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(16,24,40,0.08); }
.segmented a:hover { text-decoration: none; color: var(--text); }
.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.toolbar .grow { flex: 1; }

.pagination { display: flex; gap: 8px; align-items: center; margin-top: 14px; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty-state .icon { width: 40px; height: 40px; margin: 0 auto 10px; color: #c7c9d3; display: block; }
.empty-state strong { display: block; color: var(--text); font-size: 1.05rem; margin-bottom: 4px; }

.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .grow { flex: 1; min-width: 0; }
.run-list li { padding: 9px 0; }
.run-list .task { font-weight: 500; }
.run-list time { color: var(--muted); font-size: 0.85rem; }
.check-list { display: flex; gap: 14px; flex-wrap: wrap; }
.check-list label { margin: 0; }
.test-results { list-style: none; margin: 10px 0 0; padding: 0; }
.test-results li { display: flex; gap: 10px; align-items: flex-start; padding: 8px 12px; border-radius: 8px; margin-bottom: 6px; }
.test-results li.ok { background: var(--success-soft); color: #166534; }
.test-results li.fail { background: var(--danger-soft); color: #be123c; }
.test-results li .icon { margin-top: 2px; }

/* ---------- Login ---------- */
body.login-body { background: var(--surface); }
.login { display: flex; min-height: 100vh; }
.login-hero { flex: 1; background: linear-gradient(160deg, #5f5aa8 0%, #7a74c1 55%, #9a94d1 100%); color: #fff;
              padding: 56px 60px; display: flex; flex-direction: column; justify-content: space-between; }
.login-hero .product { font-weight: 600; font-size: 1.1rem; }
.login-hero h1 { color: #fff; font-size: 2.3rem; max-width: 560px; margin-bottom: 36px; }
.login-hero .feature { display: flex; gap: 16px; align-items: flex-start; max-width: 560px; margin-bottom: 26px; }
.login-hero .feature .box { width: 48px; height: 48px; border-radius: 10px; background: rgba(255,255,255,0.14); flex: none;
                            display: flex; align-items: center; justify-content: center; }
.login-hero .feature strong { display: block; font-size: 1.05rem; margin-bottom: 2px; }
.login-hero .feature span { color: rgba(255,255,255,0.88); }
.login-hero .foot { color: rgba(255,255,255,0.8); }
.login-panel { flex: 1; display: flex; align-items: center; justify-content: center; padding: 48px 32px; }
.login-box { width: 100%; max-width: 480px; }
.wordmark { display: inline-flex; align-items: flex-start; gap: 8px; margin-bottom: 40px; }
.wordmark .word { font-weight: 600; letter-spacing: 0.18em; color: #6b7280; font-size: 1.25rem; line-height: 1; }
.wordmark .sub { display: block; letter-spacing: 0; color: #9ca3af; font-size: 0.72rem; margin-top: 3px; text-align: right; font-weight: 500; }
.wordmark .berry { width: 22px; height: 22px; border-radius: 50%; background: radial-gradient(circle at 35% 35%, #ff8a5c, #e8542e); position: relative; margin-top: 2px; }
.wordmark .berry::after { content: ""; position: absolute; width: 6px; height: 10px; background: #5aa35a; border-radius: 3px 3px 0 0;
                          top: -6px; left: 9px; transform: rotate(20deg); }
.login-box h2 { font-size: 1.7rem; margin-bottom: 6px; }
.login-box .lead { color: var(--text-2); margin-bottom: 28px; }
.login-box label { font-weight: 600; margin-bottom: 18px; }
.login-box .btn { margin-top: 6px; padding: 12px 16px; font-size: 1rem; }
.login-box .copy { margin-top: 48px; color: var(--muted); font-size: 0.85rem; }

/* ---------- Responsive ---------- */
@media (max-width: 960px) {
    .app { display: block; }
    .sidebar { position: fixed; left: 0; top: 0; z-index: 40; transform: translateX(-100%); transition: transform 0.2s; width: min(300px, 86vw); }
    .sidebar.open { transform: none; box-shadow: 0 10px 40px rgba(0,0,0,0.25); }
    .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--surface); border-bottom: 1px solid var(--border);
              position: sticky; top: 0; z-index: 30; }
    .topbar .menu { border: 1px solid var(--border); background: var(--surface); border-radius: 8px; padding: 6px; line-height: 0; }
    .topbar strong { font-size: 1rem; }
    .backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 35; }
    .backdrop.show { display: block; }
    .page { padding: 20px 16px 48px; }
    .card-grid { grid-template-columns: 1fr; }
    .login { flex-direction: column; }
    .login-hero { padding: 32px 24px; }
    .login-hero h1 { font-size: 1.6rem; margin-bottom: 20px; }
    .login-hero .feature { margin-bottom: 16px; }
    .login-hero .foot { margin-top: 20px; }
    .login-panel { padding: 32px 20px; }
    .wordmark { margin-bottom: 24px; }
    h1 { font-size: 1.6rem; }
}

/* ---- Uso de API: gráficos (torta por API y barras por día) ---- */
:root {
    --chart-1: #2a78d6;
    --chart-2: #eb6834;
    --chart-3: #1baf7a;
    --chart-4: #eda100;
    --chart-5: #e87ba4;
    --chart-6: #008300;
    --chart-ok: #2a78d6;
    --chart-err: #d03b3b;
}
.usage-charts { display: grid; grid-template-columns: minmax(280px, 2fr) minmax(0, 3fr); gap: 20px 32px; border-bottom: 1px solid var(--border); }
.usage-charts .chart { margin: 0; min-width: 0; }
.usage-charts figcaption { font-size: 0.85rem; font-weight: 600; color: var(--text-2); margin-bottom: 10px; }
.chart-pie-body { display: flex; align-items: center; gap: 18px; }
.chart-pie-body svg.pie { width: 150px; height: 150px; flex: none; }
svg.pie .slice { stroke: var(--surface); stroke-width: 2; transition: opacity 0.15s; cursor: default; }
svg.pie .slice.dim { opacity: 0.35; }
svg.pie .pie-total { font-size: 24px; font-weight: 600; fill: var(--text); }
svg.pie .pie-sub { font-size: 11px; fill: var(--muted); }
.chart-legend { list-style: none; margin: 0; padding: 0; font-size: 0.85rem; color: var(--text-2); min-width: 0; flex: 1; }
.chart-legend li { display: flex; align-items: center; gap: 8px; padding: 3px 6px; border-radius: 6px; min-width: 0; }
.chart-legend li.active { background: var(--bg); }
.chart-legend .name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-family: var(--mono); font-size: 0.8rem; }
.chart-legend .name b { font-family: var(--font); font-weight: 600; color: var(--text); }
.chart-legend .val { font-variant-numeric: tabular-nums; color: var(--text); white-space: nowrap; }
.chart-legend .val small { color: var(--muted); }
.chart-legend .swatch, .chart-legend-row .swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.chart-legend-row { display: flex; gap: 16px; margin-bottom: 4px; }
.chart-legend-row span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend-row .swatch.ok { background: var(--chart-ok); }
.chart-legend-row .swatch.err { background: var(--chart-err); }
svg.bars { display: block; max-width: 100%; }
svg.bars .grid { stroke: var(--border); stroke-width: 1; }
svg.bars .baseline { stroke: var(--border-strong); stroke-width: 1; }
svg.bars .tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
svg.bars .value { font-size: 11px; font-weight: 600; fill: var(--text); }
svg.bars .ok { fill: var(--chart-ok); }
svg.bars .err { fill: var(--chart-err); }
svg.bars .hit { fill: transparent; }
svg.bars .day.hover .ok, svg.bars .day.hover .err { filter: brightness(0.85); }
.chart-tip { position: absolute; z-index: 50; pointer-events: none; background: var(--text); color: #fff; font-size: 0.82rem;
             line-height: 1.4; padding: 8px 10px; border-radius: 8px; box-shadow: 0 4px 14px rgba(16,24,40,0.2); max-width: 320px; word-break: break-all; }
.chart-tip .muted { color: #cfd2dc; }
@media (max-width: 900px) {
    .usage-charts { grid-template-columns: 1fr; }
}
