/* ════════════════════════════════════════════════
   ANUBIS — tema oscuro v2
   ════════════════════════════════════════════════ */

:root {
    --bg: #0a0a10;
    --bg-soft: #0e0e16;
    --bg-card: #14141d;
    --bg-card-hover: #191924;
    --bg-input: #0f0f17;
    --border: #23233a;
    --border-strong: #32324c;
    --text: #eceaf6;
    --text-muted: #8b8ba3;
    --accent: #6c5ce7;
    --accent-hover: #7d6ff0;
    --accent-soft: rgba(108, 92, 231, 0.12);
    --accent-glow: rgba(108, 92, 231, 0.28);
    --success: #00cec9;
    --success-soft: rgba(0, 206, 201, 0.12);
    --warning: #fdcb6e;
    --warning-soft: rgba(253, 203, 110, 0.12);
    --danger: #ff7675;
    --danger-soft: rgba(255, 118, 117, 0.12);
    --info: #74b9ff;
    --info-soft: rgba(116, 185, 255, 0.12);
    --radius: 14px;
    --radius-sm: 9px;
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
    --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.3);
    --transition: all 0.18s ease;
    --font-mono: 'Cascadia Code', 'Consolas', 'SFMono-Regular', 'Courier New', monospace;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html { color-scheme: dark; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

::selection { background: var(--accent); color: #fff; }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: #2b2b42;
    border-radius: 8px;
    border: 2px solid var(--bg);
}
::-webkit-scrollbar-thumb:hover { background: #3a3a58; }

/* ── Login Page ── */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(ellipse 600px 400px at 20% 10%, rgba(108,92,231,0.14) 0%, transparent 60%),
        radial-gradient(ellipse 500px 400px at 85% 90%, rgba(0,206,201,0.07) 0%, transparent 60%),
        var(--bg);
}

.login-box {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 48px 40px;
    width: 410px;
    max-width: 90vw;
    box-shadow: var(--shadow);
    animation: loginIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
}

.login-box::before {
    content: '';
    position: absolute;
    inset: 0 0 auto 0;
    height: 2px;
    border-radius: 20px 20px 0 0;
    background: linear-gradient(90deg, transparent, var(--accent), transparent);
    opacity: 0.7;
}

@keyframes loginIn {
    from { opacity: 0; transform: translateY(14px) scale(0.98); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.login-box h1 {
    font-size: 34px;
    font-weight: 700;
    text-align: center;
    margin-bottom: 6px;
    background: linear-gradient(135deg, var(--accent) 0%, #a29bfe 60%, #74b9ff 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: 3px;
}

.login-box .subtitle {
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    letter-spacing: 0.5px;
    margin-bottom: 34px;
}

.login-box .btn-primary { width: 100%; }

.login-logo {
    display: block;
    width: 62px;
    height: 62px;
    margin: 0 auto 14px;
    filter: drop-shadow(0 6px 22px rgba(108, 92, 231, 0.45));
}

/* ── Formularios ── */
.form-group { margin-bottom: 20px; }

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    margin-bottom: 8px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.form-group input,
.search-input-row input,
.textarea {
    width: 100%;
    padding: 12px 16px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14.5px;
    font-family: inherit;
    transition: var(--transition);
    outline: none;
}

.form-group input::placeholder,
.search-input-row input::placeholder,
.textarea::placeholder { color: #565672; }

.form-group input:hover,
.search-input-row input:hover,
.textarea:hover { border-color: var(--border-strong); }

.form-group input:focus,
.search-input-row input:focus,
.textarea:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-glow);
}

.textarea {
    font-family: var(--font-mono);
    font-size: 12.5px;
    resize: vertical;
    line-height: 1.6;
}

.form-hint {
    color: var(--text-muted);
    font-size: 13px;
    line-height: 1.55;
    margin-bottom: 8px;
}

/* Select unificado */
.select {
    width: 100%;
    appearance: none;
    -webkit-appearance: none;
    padding: 12px 42px 12px 14px;
    background-color: var(--bg-input);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%238b8ba3' stroke-width='2' fill='none' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 14px;
    font-family: inherit;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    outline: none;
    text-overflow: ellipsis;
}

.select:hover { border-color: var(--border-strong); }
.select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-glow); }
.select option { background: var(--bg-card); color: var(--text); }

.page-header .actions .select { width: auto; min-width: 210px; }

.inline-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    user-select: none;
}

.inline-check:hover { border-color: var(--border-strong); color: var(--text); }
.inline-check input { width: 16px; height: 16px; accent-color: var(--accent); }

/* ── Botones ── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 11px 22px;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 14px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
    white-space: nowrap;
}

.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #7f6ff0 100%);
    color: white;
    box-shadow: 0 2px 10px rgba(108, 92, 231, 0.25);
}
.btn-primary:hover {
    background: linear-gradient(135deg, var(--accent-hover) 0%, #8f7ffA 100%);
    box-shadow: 0 4px 18px rgba(108, 92, 231, 0.4);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-sm { padding: 7px 14px; font-size: 13px; border-radius: 8px; }

.btn-success { background: var(--success); color: #06211f; }
.btn-success:hover { filter: brightness(1.1); transform: translateY(-1px); box-shadow: 0 4px 16px rgba(0, 206, 201, 0.3); }
.btn-warning { background: var(--warning); color: #2b2005; }
.btn-danger { background: var(--danger); color: white; }
.btn-danger:hover { filter: brightness(1.08); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border-strong);
    color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.btn-outline:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-outline.btn-del:hover {
    border-color: var(--danger);
    color: var(--danger);
    background: var(--danger-soft);
}

.error-msg {
    color: var(--danger);
    font-size: 13px;
    text-align: center;
    margin-top: 12px;
    min-height: 20px;
}

/* ── App Layout ── */
.app-layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 240px;
    background: linear-gradient(180deg, var(--bg-soft) 0%, var(--bg-card) 100%);
    border-right: 1px solid var(--border);
    padding: 24px 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    bottom: 0;
    z-index: 10;
}

.sidebar-brand { padding: 0 24px 22px; border-bottom: 1px solid var(--border); }

.brand-row { display: flex; align-items: center; gap: 10px; }

.brand-logo {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    filter: drop-shadow(0 2px 10px rgba(108, 92, 231, 0.4));
}

.sidebar-brand h2 {
    font-size: 21px;
    font-weight: 700;
    letter-spacing: 3px;
    background: linear-gradient(135deg, var(--accent) 0%, #a29bfe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.sidebar-brand small {
    display: inline-block;
    margin-top: 4px;
    color: var(--text-muted);
    font-size: 10.5px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    padding: 1px 8px;
    border-radius: 20px;
    letter-spacing: 0.5px;
}

.amazon-session-indicator {
    display: flex;
    align-items: center;
    gap: 10px;
    width: calc(100% - 24px);
    margin: 12px 12px 0;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: rgba(15, 15, 23, 0.62);
    color: var(--text-muted);
    cursor: pointer;
    font: inherit;
    text-align: left;
    transition: var(--transition);
}

.amazon-session-indicator:hover {
    border-color: var(--border-strong);
    background: var(--bg-card-hover);
    color: var(--text);
}

.amazon-session-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    flex: 0 0 auto;
    background: var(--text-muted);
    box-shadow: 0 0 0 3px rgba(139, 139, 163, 0.1);
}

.amazon-session-copy {
    display: flex;
    flex-direction: column;
    min-width: 0;
    gap: 1px;
}

.amazon-session-label {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.amazon-session-text {
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 12px;
    font-weight: 600;
    color: var(--text);
}

.amazon-session-indicator[data-state="ok"] {
    border-color: rgba(0, 206, 201, 0.24);
    background: var(--success-soft);
}

.amazon-session-indicator[data-state="ok"] .amazon-session-dot {
    background: var(--success);
    box-shadow: 0 0 0 3px rgba(0, 206, 201, 0.13);
}

.amazon-session-indicator[data-state="warn"] {
    border-color: rgba(253, 203, 110, 0.26);
    background: var(--warning-soft);
}

.amazon-session-indicator[data-state="warn"] .amazon-session-dot {
    background: var(--warning);
    box-shadow: 0 0 0 3px rgba(253, 203, 110, 0.14);
}

.amazon-session-indicator[data-state="bad"] {
    border-color: rgba(255, 118, 117, 0.25);
    background: var(--danger-soft);
}

.amazon-session-indicator[data-state="bad"] .amazon-session-dot {
    background: var(--danger);
    box-shadow: 0 0 0 3px rgba(255, 118, 117, 0.13);
}

.amazon-session-indicator[data-state="checking"] .amazon-session-dot {
    animation: pulse 1.4s ease infinite;
}

.sidebar-nav {
    flex: 1;
    padding: 16px 12px;
    display: flex;
    flex-direction: column;
    gap: 3px;
    overflow-y: auto;
}

.nav-item {
    position: relative;
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 16px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    cursor: pointer;
    transition: var(--transition);
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    border: none;
    background: none;
    width: 100%;
    text-align: left;
}

.nav-item:hover { background: var(--bg-card-hover); color: var(--text); }
.nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

.nav-item.active::before {
    content: '';
    position: absolute;
    left: -12px;
    top: 22%;
    bottom: 22%;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent);
}

.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }

.nav-item.nav-danger { color: var(--danger); }
.nav-item.nav-danger:hover { background: var(--danger-soft); color: var(--danger); }

.sidebar-footer { padding: 14px 12px 0; border-top: 1px solid var(--border); }

.user-info { display: flex; align-items: center; gap: 10px; padding: 8px 12px; }

.user-avatar {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--accent), #a29bfe);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    color: white;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.3);
}

.user-details { flex: 1; min-width: 0; }
.user-details .name { font-size: 13px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-details .role { font-size: 10.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }

.main-content {
    flex: 1;
    margin-left: 240px;
    padding: 32px 36px;
    overflow-y: auto;
    min-width: 0;
}

/* ── Header ── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    margin-bottom: 26px;
    gap: 12px 16px;
}

.page-header h1 { font-size: 23px; font-weight: 700; letter-spacing: -0.3px; }

.page-header .actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

/* ── Cards ── */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    margin-bottom: 18px;
    transition: border-color 0.18s ease;
}

.card:hover { border-color: var(--border-strong); }

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    gap: 12px;
}

.card-header h3 { font-size: 15.5px; font-weight: 600; }

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

.refund-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(260px, 0.8fr);
    gap: 18px;
    align-items: start;
}

.offer-account-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.offer-account-pill {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-input);
    font-size: 13px;
}

.offer-account-pill span { color: var(--text-muted); }
.offer-list { display: flex; flex-direction: column; gap: 12px; }

.offer-card {
    border: 1px solid var(--border);
    border-left-width: 4px;
    border-radius: var(--radius-sm);
    padding: 14px;
    background: var(--bg-input);
}

.offer-card.offer-accepted { border-left-color: var(--danger); }
.offer-card.offer-rejected { border-left-color: var(--warning); }
.refund-card.refund-auto_not_shipped,
.refund-card.refund-seller_cancelled,
.refund-card.refund-manual_cancelled { border-left-color: var(--danger); }
.refund-card.refund-buyer_cancelled,
.refund-card.refund-returned_after_shipment,
.refund-card.refund-item_unavailable { border-left-color: var(--warning); }
.refund-card.refund-unclassified { border-left-color: var(--info); }

.offer-head,
.offer-meta,
.offer-actions {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.offer-head { margin-bottom: 8px; }
.offer-date { margin-left: auto; color: var(--text-muted); font-size: 12px; }
.offer-title { font-weight: 700; color: var(--text); margin-bottom: 6px; line-height: 1.35; }
.offer-meta { color: var(--text-muted); font-size: 12px; margin-bottom: 10px; }
.offer-amazon-orders {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
    margin: 0 0 10px;
    color: var(--text-muted);
    font-size: 12px;
}
.offer-amazon-orders.muted { opacity: 0.78; }
.offer-order-link {
    display: inline-flex;
    align-items: center;
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: 7px;
    background: var(--bg-card);
    color: var(--accent);
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 12px;
    text-decoration: none;
}
.offer-order-link:hover { border-color: var(--accent); }
.offer-message {
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    color: var(--text);
    font-size: 13px;
    line-height: 1.45;
    margin-bottom: 12px;
}
.processed-offers summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    cursor: pointer;
    font-weight: 700;
}
.processed-offers summary small {
    min-width: 28px;
    text-align: center;
    padding: 3px 8px;
    border-radius: 999px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 12px;
}
.processed-offers .offer-list { margin-top: 16px; }

/* ── Stats Grid ── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    position: relative;
    overflow: hidden;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    transition: var(--transition);
}

.stat-card:hover { border-color: var(--border-strong); transform: translateY(-1px); }

.stat-card::before {
    content: '';
    position: absolute;
    inset: 0 auto 0 0;
    width: 3px;
    background: var(--border-strong);
    opacity: 0.7;
}
.stat-card:has(.value.accent)::before { background: var(--accent); }
.stat-card:has(.value.success)::before { background: var(--success); }
.stat-card:has(.value.warning)::before { background: var(--warning); }
.stat-card:has(.value.danger)::before { background: var(--danger); }
.stat-card:has(.value.info)::before { background: var(--info); }

.stat-card .label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 8px;
}

.stat-card .value {
    font-size: 27px;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.stat-card .value.accent { color: var(--accent); }
.stat-card .value.success { color: var(--success); }
.stat-card .value.warning { color: var(--warning); }
.stat-card .value.danger { color: var(--danger); }
.stat-card .value.info { color: var(--info); }

/* ── Dashboard ── */
.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.9fr);
    gap: 18px;
    align-items: start;
}

.dashboard-lists {
    display: grid;
    gap: 18px;
}

.dashboard-lists h4 {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.6px;
    text-transform: uppercase;
    margin-bottom: 8px;
}

.mini-list {
    display: grid;
    gap: 7px;
}

.mini-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 8px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
}

.mini-row span {
    color: var(--text);
    font-size: 13px;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mini-row strong {
    color: var(--success);
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

.mini-empty {
    color: var(--text-muted);
    font-size: 13px;
    padding: 9px 10px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 8px;
}

/* ── Panel de decisiones ── */
.decision-layout {
    display: grid;
    grid-template-columns: minmax(0, 1.25fr) minmax(360px, 0.75fr);
    gap: 18px;
    align-items: start;
}

.decision-card {
    display: grid;
    gap: 10px;
}

.decision-item {
    display: grid;
    gap: 7px;
    padding: 12px 14px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-left: 3px solid var(--info);
    border-radius: 8px;
}

.decision-item.compact {
    padding: 10px 12px;
}

.decision-item.risk-high { border-left-color: var(--danger); }
.decision-item.risk-medium { border-left-color: var(--warning); }
.decision-item.risk-low { border-left-color: var(--success); }

.decision-item-head {
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0;
}

.decision-source,
.decision-date {
    color: var(--text-muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.decision-date {
    margin-left: auto;
    text-transform: none;
    letter-spacing: 0;
}

.decision-main {
    color: var(--text);
    font-size: 14px;
    font-weight: 650;
    min-width: 0;
    overflow-wrap: anywhere;
}

.decision-reason,
.decision-action {
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.45;
}

.decision-action {
    color: var(--text);
}

.decision-inline-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
}

.decision-inline-stats span {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 10px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    border-radius: 8px;
    color: var(--text-muted);
    font-size: 12px;
}

.decision-inline-queue {
    display: grid;
    gap: 8px;
    margin-top: 16px;
}

.decision-inline-queue h4 {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    color: var(--text);
    font-size: 13px;
    margin-bottom: 2px;
}

.decision-inline-queue h4 span {
    color: var(--accent);
}

/* ── Tablas ── */
.table-wrapper { overflow: auto; border-radius: var(--radius-sm); }

table { width: 100%; border-collapse: collapse; }

th, td {
    text-align: left;
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
}

th {
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    font-size: 10.5px;
    letter-spacing: 0.6px;
    position: sticky;
    top: 0;
    background: var(--bg-card);
    z-index: 1;
}

tbody tr { transition: background 0.12s ease; }
tbody tr:hover td { background: rgba(108, 92, 231, 0.05); }
tbody tr:last-child td { border-bottom: none; }

td { font-variant-numeric: tabular-nums; }

code {
    font-family: var(--font-mono);
    font-size: 12px;
    background: var(--bg-input);
    padding: 2px 7px;
    border-radius: 5px;
    border: 1px solid var(--border);
}

/* ── Badges ── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    white-space: nowrap;
}

.badge-success { background: var(--success-soft); color: var(--success); border: 1px solid rgba(0, 206, 201, 0.25); }
.badge-warning { background: var(--warning-soft); color: var(--warning); border: 1px solid rgba(253, 203, 110, 0.25); }
.badge-danger { background: var(--danger-soft); color: var(--danger); border: 1px solid rgba(255, 118, 117, 0.25); }
.badge-info { background: var(--info-soft); color: var(--info); border: 1px solid rgba(116, 185, 255, 0.25); }
.badge-neutral { background: rgba(139, 139, 163, 0.1); color: var(--text-muted); border: 1px solid var(--border); }

.auto-countdown,
.auto-countdown-static {
    min-width: 96px;
    justify-content: center;
}

.account-health-error {
    color: var(--danger);
    margin-top: 3px;
    max-width: 720px;
}

.pulse-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: currentColor;
    flex-shrink: 0;
}
.badge-success .pulse-dot { animation: pulse 2s ease infinite; }

@keyframes pulse {
    0%, 100% { opacity: 1; box-shadow: 0 0 0 0 rgba(0, 206, 201, 0.4); }
    50% { opacity: 0.7; box-shadow: 0 0 0 4px rgba(0, 206, 201, 0); }
}

/* ── Loading ── */
.spinner {
    width: 20px;
    height: 20px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
    display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

.loading-overlay {
    position: fixed;
    inset: 0;
    background: rgba(10, 10, 16, 0.75);
    backdrop-filter: blur(5px);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 18px;
    z-index: 1000;
    animation: fadeIn 0.15s ease;
}

.loading-overlay .spinner {
    width: 42px;
    height: 42px;
    border-width: 3px;
    box-shadow: 0 0 30px rgba(108, 92, 231, 0.2);
}
.loading-overlay .text { color: var(--text); font-size: 14px; font-weight: 500; max-width: 420px; text-align: center; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

/* ── Estados vacíos ── */
.empty-state {
    text-align: center;
    padding: 56px 24px;
    background: var(--bg-card);
    border: 1px dashed var(--border-strong);
    border-radius: var(--radius);
    margin-bottom: 18px;
}

.empty-state .icon { font-size: 30px; margin-bottom: 12px; opacity: 0.45; }
.empty-state .title { font-size: 15px; font-weight: 600; color: var(--text); margin-bottom: 5px; }
.empty-state p { font-size: 13px; color: var(--text-muted); }
.empty-state.error-state { border-color: rgba(255, 118, 117, 0.4); }
.empty-state.error-state .title { color: var(--danger); }

/* ── Secciones acordeón ── */
.section-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 15px 20px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    cursor: pointer;
    font-size: 14.5px;
    font-weight: 600;
    font-family: inherit;
    margin-bottom: 8px;
    transition: var(--transition);
}
.section-toggle:hover { border-color: var(--accent); background: var(--bg-card-hover); }

.section-toggle .count {
    color: var(--accent);
    background: var(--accent-soft);
    padding: 2px 10px;
    border-radius: 20px;
    font-size: 12.5px;
    margin-left: auto;
    margin-right: 12px;
}

.section-toggle::after {
    content: '❯';
    font-size: 12px;
    color: var(--text-muted);
    transition: transform 0.2s ease;
}
.section-toggle.open::after { transform: rotate(90deg); color: var(--accent); }

.section-content { display: none; padding: 0 2px 14px; }
.section-content.open { display: block; animation: fadeIn 0.2s ease; }

/* ── Toasts ── */
.toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.toast {
    padding: 14px 18px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid var(--info);
    box-shadow: var(--shadow);
    animation: slideIn 0.28s cubic-bezier(0.16, 1, 0.3, 1);
    max-width: 380px;
    line-height: 1.45;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.info { border-left-color: var(--info); }

@keyframes slideIn {
    from { transform: translateX(110%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

/* ── Modales ── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(5, 5, 10, 0.65);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5000;
    animation: fadeIn 0.15s ease;
}

.modal {
    background: var(--bg-card);
    border: 1px solid var(--border-strong);
    border-radius: 16px;
    padding: 30px;
    width: 500px;
    max-width: 90vw;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: var(--shadow);
    animation: modalIn 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalIn {
    from { opacity: 0; transform: translateY(10px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal h2 { font-size: 19px; margin-bottom: 20px; letter-spacing: -0.2px; }

.modal-actions { display: flex; gap: 12px; margin-top: 22px; }
.modal-actions .btn-primary { flex: 1; }

/* Tabs segmentadas (modal cuentas) */
.tab-switch {
    display: flex;
    gap: 4px;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 4px;
    margin-bottom: 22px;
}

.tab-btn {
    flex: 1;
    padding: 9px 14px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    border-radius: 7px;
    cursor: pointer;
    transition: var(--transition);
}

.tab-btn:hover { color: var(--text); }
.tab-btn.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.35);
}

/* ── Tarjetas de cuenta ── */
.account-card {
    display: flex;
    align-items: center;
    gap: 16px;
}

.account-avatar {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--accent), #a29bfe);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 17px;
    color: #fff;
    text-transform: uppercase;
    flex-shrink: 0;
    box-shadow: 0 2px 10px rgba(108, 92, 231, 0.25);
}

.account-card.inactive .account-avatar {
    background: linear-gradient(135deg, #3a3a52, #4a4a66);
    box-shadow: none;
}

.account-meta { min-width: 0; flex: 1 1 auto; }
.account-meta .name {
    font-weight: 600; font-size: 15px;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-meta .sub { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; overflow-wrap: anywhere; }

.account-actions {
    margin-left: auto;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    justify-content: flex-end;
}

/* ── Skeletons (carga optimista) ── */
.skeleton-card { pointer-events: none; }
.skeleton-avatar {
    width: 44px; height: 44px; border-radius: 12px; flex-shrink: 0;
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease infinite;
}
.skeleton-line {
    height: 12px; border-radius: 4px;
    background: linear-gradient(90deg, var(--bg-input) 25%, var(--border) 50%, var(--bg-input) 75%);
    background-size: 200% 100%;
    animation: shimmer 1.4s ease infinite;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ── Buscador de pedidos ── */
.search-input-row {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    align-items: stretch;
}

.search-input-row input { padding: 13px 16px; font-size: 15px; }
.search-input-row .btn { padding: 0 30px; }

.result-info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 18px 22px;
}

.result-info-grid .item-label {
    color: var(--text-muted);
    font-size: 10.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    margin-bottom: 5px;
}

.result-info-grid .item-value {
    color: var(--text);
    font-size: 14px;
    font-weight: 500;
    word-break: break-word;
}

.result-card-found { border-color: rgba(0, 206, 201, 0.35) !important; }
.result-card-warn { border-color: rgba(253, 203, 110, 0.35) !important; }

/* ── Terminal ── */
.terminal-modal { width: 740px; max-width: 92vw; padding: 0; overflow: hidden; }

.terminal-titlebar {
    display: flex;
    align-items: center;
    gap: 7px;
    padding: 13px 18px;
    background: var(--bg-soft);
    border-bottom: 1px solid var(--border);
}

.terminal-titlebar .tdot { width: 11px; height: 11px; border-radius: 50%; }
.terminal-titlebar .tdot.red { background: #ff5f57; }
.terminal-titlebar .tdot.yellow { background: #febc2e; }
.terminal-titlebar .tdot.green { background: #28c840; }

.terminal-titlebar .terminal-title {
    margin-left: 8px;
    color: var(--text-muted);
    font-size: 12.5px;
    font-family: var(--font-mono);
    letter-spacing: 0.3px;
}

.terminal-box {
    background: #07070c;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 16px;
    height: min(380px, 55vh);
    overflow-y: auto;
    font-family: var(--font-mono);
    font-size: 12.5px;
    color: #7CFC9A;
    line-height: 1.7;
}

.terminal-modal .terminal-box {
    border: none;
    border-radius: 0;
    height: min(430px, 60vh);
}

.terminal-box .line { display: block; white-space: pre-wrap; word-break: break-word; }
.terminal-box .line.err { color: var(--danger); }
.terminal-box .line.ok { color: var(--success); font-weight: 600; }

.terminal-close-btn {
    margin-left: auto;
    padding: 5px 10px;
}

.amazon-tracking-card {
    border-color: rgba(0, 206, 201, 0.28);
    margin-bottom: 16px;
}

.amazon-tracking-card .form-hint {
    margin: 3px 0 0;
}

.amazon-tracking-card td:last-child,
.amazon-tracking-card th:last-child {
    text-align: right;
}

.amazon-terminal-modal .terminal-box {
    border-bottom: 1px solid var(--border);
}

.amazon-credentials-panel {
    padding: 18px;
    background: var(--bg-card);
}

.amazon-auto-session-card {
    border: 1px solid rgba(124, 92, 255, 0.24);
    background: rgba(124, 92, 255, 0.08);
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 12px;
}

.amazon-auto-session-card strong {
    display: block;
    color: var(--text);
    margin-bottom: 4px;
}

.amazon-auto-session-card p {
    color: var(--muted);
    margin: 0;
    line-height: 1.45;
}

.amazon-credentials-panel .modal-actions {
    margin-top: 12px;
}

.vinted-session-modal {
    width: min(760px, calc(100vw - 32px));
}

.vinted-session-list {
    display: grid;
    gap: 12px;
    margin: 18px 0;
}

.vinted-session-item {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    padding: 14px;
    background: var(--bg-input);
    border: 1px solid rgba(255, 118, 117, 0.35);
    border-left: 3px solid var(--danger);
    border-radius: 8px;
}

.vinted-session-main {
    display: grid;
    gap: 5px;
    min-width: 0;
}

.vinted-session-main strong {
    color: var(--text);
    font-size: 15px;
}

.vinted-session-main span,
.vinted-session-main p {
    color: var(--text-muted);
    font-size: 12.5px;
    line-height: 1.45;
    margin: 0;
    overflow-wrap: anywhere;
}

.vinted-session-actions {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 8px;
    flex: 0 0 auto;
}

/* ── Vinted Country (módulo externo — no tocar) ── */
.country-fields { border: 0; padding: 0; min-width: 0; }
.country-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 24px; }
.country-grid input, .country-grid select { width: 100%; min-width: 0; }
.country-grid select, .country-template select { width: 100%; padding: 12px 16px; background: var(--bg-input); color: var(--text); border: 1px solid var(--border); border-radius: 8px; font: inherit; }
#page-country .btn-primary, .country-dialog .btn-primary { width: auto; }
#page-country .form-group label { letter-spacing: 0; }
.country-section-title { font-size: 17px; margin: 20px 0 16px; }
.country-notice { padding: 12px 0; margin-bottom: 16px; color: var(--text-muted); overflow-wrap: anywhere; }
.country-notice[data-status="success"] { color: var(--success); }
.country-notice[data-status="partial"], .country-notice[data-status="failed"] { color: var(--danger); }
.country-history-heading { display: flex; gap: 16px; justify-content: space-between; align-items: center; margin-top: 24px; border-top: 1px solid var(--border); }
.country-dialog { margin: auto; width: 740px; max-width: calc(100vw - 32px); max-height: 90vh; overflow-y: auto; background: var(--bg-card); color: var(--text); padding: 24px; border: 1px solid var(--border); border-radius: 8px; }
.country-dialog::backdrop { background: rgba(0, 0, 0, .7); }
.country-dialog h2 { font-size: 20px; margin: 0; }
.country-dialog-header, .country-dialog-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.country-dialog-header { margin-bottom: 16px; }
.country-dialog-actions { margin-top: 20px; }
.country-dialog [hidden] { display: none !important; }
.country-dialog .terminal-box { white-space: pre-wrap; overflow-wrap: anywhere; height: 280px; margin: 12px 0; }
.country-dialog progress { width: 100%; height: 5px; accent-color: var(--success); }
.country-confirm { width: 560px; }
.country-summary { white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.6; margin: 20px 0; }
.country-warning { color: var(--warning); line-height: 1.6; margin-bottom: 20px; }
.country-ack { display: flex; gap: 10px; align-items: flex-start; line-height: 1.5; }
.country-ack input { margin-top: 4px; flex: 0 0 auto; }
#countryConfirmError { color: var(--danger); margin-top: 12px; }
.country-nav-icon { display: inline-block !important; font-size: 24px; width: 20px; text-align: center; flex-shrink: 0; }
.country-selectors { gap: 24px; padding: 12px 0 0; }
.country-selectors .form-group { margin-bottom: 12px; min-width: 0; }
.country-selectors label { text-transform: none; font-size: 14px; color: var(--text); margin-bottom: 10px; }
.country-select-wrap { position: relative; display: flex; align-items: center; min-width: 0; background: #181c22; border: 1px solid #3b444f; border-radius: 8px; }
.country-select-wrap:focus-within { border-color: #47c7b1; box-shadow: 0 0 0 3px rgba(71,199,177,.12); }
.country-select-wrap::after { content: ''; position: absolute; right: 20px; width: 7px; height: 7px; border-right: 2px solid #abb5be; border-bottom: 2px solid #abb5be; transform: rotate(45deg); pointer-events: none; top: 24px; }
.country-select-mark { position: absolute; left: 14px; display: grid; place-items: center; width: 32px; height: 32px; font-size: 12px; font-weight: 700; color: #73dcc8; background: #263936; border-radius: 6px; pointer-events: none; }
.country-select-wrap select { appearance: none; -webkit-appearance: none; height: 58px; padding: 0 42px 0 58px; background: transparent; border: 0; border-radius: 8px; font-size: 15px; font-weight: 500; outline: none; text-overflow: ellipsis; }
.country-select-wrap option { background: #181c22; color: #eef1f4; font-weight: 400; }
.country-selectors small { display: block; margin: 8px 0 0; color: #a3adb9; font-size: 12px; }
.country-start-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 12px 0 28px; }
.country-auto-label { color: #a3adb9; font-size: 13px; }
#countryReview, #countryConfirmButton { background: #258b7c; }
#countryReview:hover, #countryConfirmButton:hover { background: #2b9e8d; }
.country-live { border-top: 1px solid var(--border); padding-top: 20px; }
.country-live-heading { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.country-live-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
#page-country [hidden] { display: none !important; }
.country-live h2 { font-size: 17px; }
.country-steps { list-style: none; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 20px 0 0; }
.country-steps li { border-top: 3px solid #3c434c; padding: 10px 0 0; color: #a3adb9; font-size: 12px; overflow-wrap: anywhere; }
.country-steps li[data-state="done"] { border-color: #47c7b1; color: #73dcc8; }
.country-steps li[data-state="error"] { border-color: #e6aa62; }
#countryInlineLogs { height: 220px; white-space: pre-wrap; overflow-wrap: anywhere; color: #b8d9cb; background: #111617; }
#countryInlineStatus { margin-bottom: 4px; font-size: 13px; }
@media (max-width: 768px) {
    .dashboard-grid { grid-template-columns: minmax(0, 1fr); }
    .decision-layout,
    .refund-layout { grid-template-columns: minmax(0, 1fr); }
    .amazon-session-indicator {
        justify-content: center;
        width: 42px;
        height: 38px;
        margin: 10px auto 0;
        padding: 0;
    }
    .amazon-session-copy { display: none; }
    .country-grid { grid-template-columns: minmax(0, 1fr); }
    #page-country .page-header { flex-wrap: wrap; gap: 12px; }
    #page-country h1 { font-size: 24px; }
    .country-dialog { padding: 18px; }
    .country-dialog-actions .btn { flex: 1 1 auto; white-space: normal; }
    .country-start-row { align-items: stretch; flex-direction: column; }
    .country-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ── Responsive ──
   Tres niveles: escritorio estrecho/tablet (≤1024px), sidebar a solo-icono (≤768px)
   y móvil muy estrecho (≤480px). Cada nivel hereda los ajustes del anterior. */

/* Escritorio estrecho / tablet: la sidebar se mantiene completa, solo se ajustan
   márgenes y densidades para que nada se apriete antes de tiempo. */
@media (max-width: 1024px) {
    .main-content { padding: 24px 20px; }
    .stats-grid { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    .result-info-grid { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
    .offers-layout { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 768px) {
    .sidebar { width: 60px; padding: 12px 0; }
    .sidebar-brand { padding: 0 6px 12px; }
    .brand-row { justify-content: center; }
    .brand-logo { width: 28px; height: 28px; }
    .sidebar-brand h2, .sidebar-brand small, .nav-item span:not(.country-nav-icon), .user-details { display: none; }
    .nav-item { justify-content: center; padding: 12px; }
    .nav-item.active::before { left: -8px; }
    .main-content { margin-left: 60px; padding: 16px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
    .page-header .actions .select { min-width: 0; flex: 1 1 auto; }
    .search-input-row { grid-template-columns: 1fr; }
    .account-card { flex-wrap: wrap; }
    .account-actions { margin-left: 0; width: 100%; }
    .decision-layout,
    .refund-layout { grid-template-columns: minmax(0, 1fr); }
    .decision-item-head { flex-wrap: wrap; }
    .decision-date { margin-left: 0; width: 100%; }
    .offer-date { margin-left: 0; width: 100%; }
    .offer-actions .btn { flex: 1 1 auto; }
    .vinted-session-item { flex-direction: column; }
    .vinted-session-actions { width: 100%; justify-content: stretch; }
    .vinted-session-actions .btn { flex: 1 1 auto; }
    .card, .empty-state { padding: 18px; }
    .modal { padding: 22px; }
    .stat-card { padding: 15px 16px; }
    .stat-card .value { font-size: 23px; }
}

/* Móvil muy estrecho: todo a una columna, tipografía y espaciados mínimos. */
@media (max-width: 480px) {
    .main-content { padding: 12px; }
    .stats-grid { grid-template-columns: 1fr; }
    .result-info-grid { grid-template-columns: 1fr; }
    .page-header h1 { font-size: 19px; }
    .card, .empty-state { padding: 14px; }
    .modal { padding: 16px; border-radius: 12px; }
    .modal h2 { font-size: 16.5px; }
    .terminal-titlebar { padding: 10px 12px; }
    .tab-switch { flex-direction: column; }
    .toast-container { left: 12px; right: 12px; top: 12px; }
    .toast { max-width: none; }
    .login-box { padding: 32px 22px; }
    .login-box h1 { font-size: 26px; letter-spacing: 1.5px; }
    .page-header .actions { width: 100%; }
    .page-header .actions .btn { flex: 1 1 auto; }
    /* Botones de acciones de modal: apilados a ancho completo para que un texto
       largo (p.ej. "Abrir navegador y autenticar") nunca se salga del modal. */
    .modal-actions { flex-direction: column; }
    .modal-actions .btn { flex: initial; white-space: normal; }
}
