﻿/* Yugoreal Admin â€” estilo Excel sobrio (claro) */
:root {
    --xl-font: "Segoe UI", Calibri, Arial, sans-serif;
    --xl-bg: #e8e8e8;
    --xl-surface: #ffffff;
    --xl-grid: #d4d4d4;
    --xl-grid-light: #e2e2e2;
    --xl-header: #f3f3f3;
    --xl-header-border: #ababab;
    --xl-accent: #217346;
    --xl-accent-dark: #185c37;
    --xl-accent-soft: #e7f4ee;
    --xl-text: #333333;
    --xl-text-muted: #666666;
    --xl-focus: #1a73e8;
    --xl-danger: #c0392b;
    --xl-warning: #b8860b;
    --xl-success: #217346;
    --xl-radius: 2px;
    --xl-shadow: 0 1px 2px rgba(0, 0, 0, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body.admin-body {
    margin: 0;
    min-height: 100vh;
    background: var(--xl-bg);
    font-family: var(--xl-font);
    font-size: 13px;
    line-height: 1.45;
    color: var(--xl-text);
}

/* â”€â”€ Topbar admin â”€â”€ */
.admin-topbar {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 0 16px;
    min-height: 44px;
    background: var(--xl-accent);
    border-bottom: 1px solid var(--xl-accent-dark);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 100;
}

.admin-topbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 160px;
}

.admin-logo {
    width: 28px;
    height: 28px;
    border-radius: var(--xl-radius);
    background: #fff;
    color: var(--xl-accent);
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 14px;
}

.admin-topbar-brand strong {
    display: block;
    font-size: 13px;
}

.admin-topbar-brand span {
    font-size: 11px;
    opacity: 0.9;
}

.admin-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 2px;
    flex: 1 1 auto;
}

.admin-nav-link {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 6px 12px;
    border-radius: var(--xl-radius);
    text-decoration: none;
    color: rgba(255, 255, 255, 0.92);
    font-size: 12px;
    font-weight: 600;
    border: 1px solid transparent;
}

.admin-nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.admin-nav-link.is-active {
    background: #fff;
    color: var(--xl-accent);
    border-color: #fff;
}

.admin-topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
}

.admin-link-quiet {
    color: rgba(255, 255, 255, 0.95);
    text-decoration: none;
    font-size: 12px;
}

.admin-link-quiet:hover { text-decoration: underline; }

.admin-btn-ghost,
.admin-btn-primary {
    border: 1px solid rgba(255, 255, 255, 0.45);
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    font-size: 12px;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: var(--xl-radius);
    cursor: pointer;
    font-family: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.admin-btn-ghost:hover { background: rgba(255, 255, 255, 0.2); }

.admin-btn-primary {
    background: #fff;
    color: var(--xl-accent);
    border-color: #fff;
}

.admin-btn-primary:hover { background: #f5f5f5; }

.admin-btn-primary:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

.admin-btn-block { width: 100%; }

.admin-main { min-height: calc(100vh - 44px); }

.admin-page { padding: 16px 18px 24px; }

.admin-page--narrow { max-width: 960px; margin: 0 auto; }

.admin-page--fluid { max-width: none; }

.admin-sheet-title {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--xl-text);
}

.admin-sheet-sub {
    margin: 4px 0 0;
    font-size: 12px;
    color: var(--xl-text-muted);
}

.admin-sheet-sub a { color: var(--xl-accent); }

/* Callouts / compat office */
.admin-callout,
.callout {
    padding: 10px 12px;
    border-radius: var(--xl-radius);
    border: 1px solid var(--xl-grid);
    background: var(--xl-surface);
    font-size: 13px;
    margin-bottom: 12px;
}

.admin-callout--danger,
.callout-danger {
    border-color: #e6b8b8;
    background: #fdf3f3;
    color: #8b2e2e;
}

.callout-success {
    border-color: #b8dcc8;
    background: var(--xl-accent-soft);
    color: #185c37;
}

.callout-info {
    border-color: #b8d4f0;
    background: #f0f7fd;
    color: #1a4d7a;
}

.callout-warning {
    border-color: #e8d9a8;
    background: #fffbf0;
    color: #7a5c00;
}

.admin-callout a,
.callout a { color: var(--xl-accent); }

/* Stats */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.stat-card {
    background: var(--xl-surface);
    border: 1px solid var(--xl-grid);
    border-radius: var(--xl-radius);
    padding: 12px 14px;
    box-shadow: var(--xl-shadow);
}

.stat-card .stat-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--xl-text);
    line-height: 1.1;
}

.stat-card .stat-label {
    font-size: 11px;
    color: var(--xl-text-muted);
    margin-top: 4px;
}

.stat-card.success .stat-value { color: var(--xl-success); }
.stat-card.warning .stat-value { color: var(--xl-warning); }
.stat-card.danger .stat-value { color: var(--xl-danger); }

/* Tablas */
.admin-sheet-wrap,
.table-wrap {
    overflow: auto;
    border: 1px solid var(--xl-header-border);
    border-radius: var(--xl-radius);
    background: var(--xl-surface);
    box-shadow: var(--xl-shadow);
}

.word-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
    background: var(--xl-surface);
}

.word-table th,
.word-table td {
    padding: 8px 10px;
    border: 1px solid var(--xl-grid-light);
    text-align: left;
    vertical-align: middle;
}

.word-table th {
    background: var(--xl-header);
    font-weight: 700;
    border-bottom: 1px solid var(--xl-header-border);
}

.word-table tbody tr:nth-child(even) { background: #fafafa; }
.word-table tbody tr:hover { background: #f0f7f4; }

.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 2px;
    font-size: 11px;
    font-weight: 600;
    border: 1px solid var(--xl-grid);
    background: var(--xl-header);
}

.badge-ok { background: var(--xl-accent-soft); border-color: #b8dcc8; color: var(--xl-accent); }
.badge-pending { background: #fff8e6; border-color: #e8d9a8; color: #7a5c00; }

/* Forms */
.admin-form,
.document-page {
    background: var(--xl-surface);
    border: 1px solid var(--xl-grid);
    border-radius: var(--xl-radius);
    padding: 16px;
    box-shadow: var(--xl-shadow);
}

.admin-field,
.entrada-field {
    display: block;
    margin-bottom: 12px;
}

.admin-field span,
.entrada-field label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    color: var(--xl-text-muted);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.admin-field input,
.admin-field select,
.admin-field textarea,
.entrada-field input,
.entrada-field select,
.entrada-field textarea,
.document-page input,
.document-page select,
.document-page textarea {
    width: 100%;
    padding: 7px 10px;
    border: 1px solid var(--xl-grid);
    border-radius: var(--xl-radius);
    font: inherit;
    background: #fff;
    color: var(--xl-text);
}

.admin-field input:focus,
.document-page input:focus,
.document-page select:focus,
.document-page textarea:focus {
    outline: 2px solid var(--xl-focus);
    outline-offset: 0;
    border-color: var(--xl-focus);
}

.btn-entrada-secondary {
    display: inline-block;
    padding: 8px 14px;
    border-radius: var(--xl-radius);
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    border: 1px solid var(--xl-accent-dark);
    background: var(--xl-accent);
    color: #fff;
}

.btn-entrada-secondary {
    background: var(--xl-header);
    color: var(--xl-text);
    border-color: var(--xl-grid);
}

.section-heading,
.doc-title {
    font-size: 15px;
    font-weight: 700;
    margin: 18px 0 10px;
    color: var(--xl-text);
}

.doc-subtitle {
    font-size: 12px;
    color: var(--xl-text-muted);
    margin-bottom: 12px;
}

/* Login */
.admin-login-page {
    display: grid;
    place-items: center;
    min-height: 100vh;
    background: var(--xl-bg);
}

.admin-login-card {
    width: min(380px, calc(100% - 32px));
    background: var(--xl-surface);
    border: 1px solid var(--xl-header-border);
    border-radius: var(--xl-radius);
    padding: 24px;
    box-shadow: var(--xl-shadow);
}

.admin-login-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.admin-login-brand .admin-logo {
    background: var(--xl-accent);
    color: #fff;
}

.admin-login-desc {
    margin: 0 0 16px;
    font-size: 12px;
    color: var(--xl-text-muted);
}

.admin-login-foot {
    margin: 16px 0 0;
    font-size: 12px;
    text-align: center;
}

.admin-login-foot a { color: var(--xl-accent); }

/* Toolbar planilla */
.admin-sheet-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 10px;
}

.admin-sheet-toolbar-right {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.admin-topbar .admin-btn-ghost,
.admin-topbar .admin-btn-primary {
    border-color: rgba(255, 255, 255, 0.5);
}

.admin-sheet-toolbar .admin-btn-ghost {
    background: var(--xl-surface);
    color: var(--xl-text);
    border-color: var(--xl-grid);
}

.admin-sheet-toolbar .admin-btn-ghost:hover { background: var(--xl-header); }

.admin-sheet-toolbar .admin-btn-primary {
    background: var(--xl-accent);
    color: #fff;
    border-color: var(--xl-accent-dark);
}

.admin-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 2px;
    background: #fff3cd;
    color: #7a5c00;
    border: 1px solid #e8d9a8;
}

.admin-sheet-meta {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-bottom: 6px;
    font-size: 11px;
    color: var(--xl-text-muted);
}

.admin-save-status.is-ok { color: var(--xl-success); }
.admin-save-status.is-error { color: var(--xl-danger); }
.admin-save-status.is-loading { color: var(--xl-focus); }

.admin-sheet-hint {
    margin-top: 10px;
    font-size: 11px;
    color: var(--xl-text-muted);
}

/* Grilla Excel */
.admin-sheet-wrap {
    overflow: auto;
    max-height: calc(100vh - 180px);
    outline: none;
}

.admin-sheet-wrap:focus-visible {
    box-shadow: inset 0 0 0 2px var(--xl-focus);
}

.admin-sheet {
    border-collapse: separate;
    border-spacing: 0;
    min-width: 100%;
    font-size: 12px;
    table-layout: fixed;
    background: var(--xl-surface);
}

.admin-sheet thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--xl-header);
    color: var(--xl-text);
    font-weight: 700;
    text-align: left;
    padding: 6px 8px;
    border-bottom: 1px solid var(--xl-header-border);
    border-right: 1px solid var(--xl-grid-light);
    white-space: nowrap;
    user-select: none;
    box-shadow: inset 0 -1px 0 var(--xl-header-border);
}

.admin-sheet thead th.col-rownum,
.admin-sheet tbody td.col-rownum {
    width: 40px;
    min-width: 40px;
    text-align: center;
    background: #efefef;
    color: var(--xl-text-muted);
    font-weight: 600;
    position: sticky;
    left: 0;
    z-index: 3;
    border-right: 1px solid var(--xl-header-border);
}

.admin-sheet thead th.col-actions,
.admin-sheet tbody td.col-actions {
    width: 36px;
    min-width: 36px;
    text-align: center;
    position: sticky;
    right: 0;
    background: #efefef;
    z-index: 2;
    border-left: 1px solid var(--xl-grid);
}

.admin-sheet tbody td {
    padding: 0;
    border-right: 1px solid var(--xl-grid-light);
    border-bottom: 1px solid var(--xl-grid-light);
    background: var(--xl-surface);
    vertical-align: middle;
    height: 28px;
}

.admin-sheet tbody tr:nth-child(even) td:not(.col-rownum):not(.col-actions) {
    background: #fafafa;
}

.admin-sheet tbody tr:hover td:not(.col-rownum):not(.col-actions) {
    background: #f0f7f4;
}

.admin-sheet tbody tr.is-new td:not(.col-rownum):not(.col-actions) {
    background: #eef8f2;
}

.admin-sheet tbody tr.is-dirty td:not(.col-rownum):not(.col-actions) {
    box-shadow: inset 3px 0 0 #e8a317;
}

.admin-cell {
    display: block;
    width: 100%;
    min-height: 28px;
    padding: 4px 8px;
    border: none;
    background: transparent;
    color: var(--xl-text);
    font: inherit;
    line-height: 1.3;
    box-sizing: border-box;
}

.admin-cell:focus {
    outline: 2px solid var(--xl-focus);
    outline-offset: -2px;
    background: #fff;
    z-index: 1;
    position: relative;
}

.admin-cell--readonly {
    color: var(--xl-text-muted);
    cursor: default;
}

.admin-cell--number {
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.admin-cell--bool { text-align: center; }

select.admin-cell {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='5'%3E%3Cpath fill='%23666' d='M0 0l4 5 4-5z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 6px center;
    padding-right: 18px;
}

.admin-row-delete {
    border: none;
    background: transparent;
    color: var(--xl-danger);
    cursor: pointer;
    font-size: 15px;
    line-height: 1;
    padding: 2px;
}

.admin-row-delete:hover { background: #fdeaea; }

/* Modal columnas */
.admin-modal[hidden] { display: none; }

.admin-modal {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    padding: 16px;
}

.admin-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
}

.admin-modal-panel {
    position: relative;
    width: min(440px, 100%);
    max-height: 85vh;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    background: var(--xl-surface);
    border: 1px solid var(--xl-header-border);
    border-radius: var(--xl-radius);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
}

.admin-modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 14px;
    border-bottom: 1px solid var(--xl-grid);
    background: var(--xl-header);
}

.admin-modal-header h2 {
    margin: 0;
    font-size: 14px;
}

.admin-modal-close {
    border: none;
    background: transparent;
    color: var(--xl-text-muted);
    font-size: 20px;
    cursor: pointer;
}

.admin-modal-body {
    padding: 14px;
    overflow-y: auto;
}

.admin-modal-desc {
    margin: 0 0 12px;
    font-size: 12px;
    color: var(--xl-text-muted);
}

.admin-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 6px;
    padding: 10px 14px;
    border-top: 1px solid var(--xl-grid);
    background: var(--xl-header);
}

.admin-col-group { margin-bottom: 12px; }

.admin-col-group h3 {
    margin: 0 0 6px;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--xl-text-muted);
}

.admin-col-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 8px;
    border-radius: var(--xl-radius);
    cursor: pointer;
    font-size: 13px;
}

.admin-col-check:hover { background: var(--xl-header); }

.admin-col-check input {
    width: 14px;
    height: 14px;
    accent-color: var(--xl-accent);
}

.admin-section-label {
    margin: 18px 0 8px;
    font-size: 13px;
    font-weight: 700;
    color: var(--xl-text);
}

.admin-sheet-wrap--short {
    max-height: 280px;
}

.admin-sheet--selectable tbody tr {
    cursor: pointer;
}

.admin-sheet--selectable tbody tr.is-selected td:not(.col-rownum) {
    background: #e8f4ec;
    box-shadow: inset 3px 0 0 var(--xl-accent);
}

.admin-sheet-toolbar--sub {
    margin-top: 20px;
    margin-bottom: 8px;
}

.admin-inline-field {
    display: inline-flex;
    flex-direction: column;
    gap: 2px;
    font-size: 10px;
    color: var(--xl-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.admin-inline-select {
    min-width: 220px;
    padding: 6px 8px;
    border: 1px solid var(--xl-grid);
    border-radius: var(--xl-radius);
    font: inherit;
    font-size: 12px;
    background: #fff;
}

.admin-cart-detail {
    margin-top: 8px;
    padding-top: 4px;
    border-top: 1px solid var(--xl-grid);
}

.admin-cart-totals {
    margin-top: 10px;
    padding: 10px 12px;
    background: var(--xl-header);
    border: 1px solid var(--xl-grid);
    border-radius: var(--xl-radius);
    font-size: 13px;
}

.admin-filter-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 10px;
}

.admin-filter-tab {
    padding: 6px 12px;
    border: 1px solid var(--xl-grid);
    border-radius: var(--xl-radius);
    background: var(--xl-surface);
    color: var(--xl-text);
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
}

.admin-filter-tab.is-active {
    background: var(--xl-accent-soft);
    border-color: #b8dcc8;
    color: var(--xl-accent);
}

.admin-pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 700;
}

.admin-pill--ok { background: #e8f4ec; color: #185c37; }
.admin-pill--warn { background: #fff8e6; color: #7a5c00; }
.admin-pill--muted { background: #f3f3f3; color: #666; }

.admin-cell-note {
    font-size: 11px;
    color: var(--xl-text-muted);
}

.admin-vitrina-section {
    margin-top: 24px;
    padding-top: 8px;
    border-top: 1px solid var(--xl-grid);
}

.admin-vitrina-tipos {
    list-style: none;
    margin: 0 0 12px;
    padding: 0;
    display: grid;
    gap: 6px;
    max-width: 480px;
}

.admin-vitrina-tipo-item {
    display: flex;
    align-items: center;
    gap: 8px;
}

.admin-vitrina-tipo-input {
    flex: 1;
}

.admin-vitrina-tipo-remove {
    min-width: 36px;
    padding: 4px 10px !important;
    font-size: 18px;
    line-height: 1;
}

.admin-vitrina-tipos-add {
    display: flex;
    gap: 8px;
    max-width: 480px;
    margin-bottom: 8px;
}

.admin-vitrina-tipos-add .admin-cell {
    flex: 1;
}

.admin-vitrina-tipos-hint {
    max-width: 560px;
    margin-top: 4px;
}

.admin-vitrina-tipos-empty {
    color: var(--xl-text-muted);
    font-size: 13px;
}

.admin-vitrina-cols {
    list-style: none;
    margin: 0 0 16px;
    padding: 0;
    display: grid;
    gap: 6px;
    max-width: 480px;
}

.admin-vitrina-col-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 10px;
    border: 1px solid var(--xl-grid-light);
    border-radius: var(--xl-radius);
    background: var(--xl-surface);
}

.admin-vitrina-col-actions {
    display: flex;
    gap: 4px;
}

.admin-vitrina-move {
    min-width: 32px;
    padding: 4px 8px !important;
    font-size: 14px;
}

.admin-empty-row {
    padding: 16px !important;
    text-align: center;
    color: var(--xl-text-muted);
}

.admin-cart-totals-hint {
    margin-left: 8px;
    font-size: 11px;
    color: var(--xl-text-muted);
    font-weight: 400;
}

@media (max-width: 900px) {
    .admin-topbar { flex-direction: column; align-items: stretch; }
    .admin-nav { order: 3; }
    .admin-sheet-wrap { max-height: calc(100vh - 260px); }
    .admin-inline-select { min-width: 160px; }
}
