:root {
    --bg: #f3f6fb;
    --bg-soft: #f8fafc;
    --surface: #ffffff;
    --surface-2: #f8fafc;
    --border: #e2e8f0;
    --border-strong: #cbd5e1;
    --text: #0f172a;
    --text-soft: #475569;
    --text-muted: #64748b;
    --primary: #1d4ed8;
    --primary-soft: #dbeafe;
    --success: #15803d;
    --success-soft: #dcfce7;
    --danger: #b91c1c;
    --danger-soft: #fee2e2;
    --shadow-sm: 0 6px 18px rgba(15, 23, 42, 0.06);
    --shadow-md: 0 12px 30px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 20px 50px rgba(15, 23, 42, 0.10);
    --radius-sm: 14px;
    --radius-md: 20px;
    --radius-lg: 28px;
    --radius-xl: 34px;
    --container: 1320px;
}

* {
    box-sizing: border-box;
}

html, body {
    margin: 0;
    min-height: 100%;
    font-family: "Segoe UI", Arial, Helvetica, sans-serif;
    color: var(--text);
    background: radial-gradient(circle at top left, rgba(29, 78, 216, 0.05), transparent 25%), radial-gradient(circle at bottom right, rgba(15, 23, 42, 0.04), transparent 28%), var(--bg);
}

body {
    overflow-x: hidden;
}

a {
    color: inherit;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
}

button,
input {
    font: inherit;
}

input {
    width: 100%;
    padding: 14px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color .15s ease, box-shadow .15s ease;
}

    input:focus {
        border-color: #93c5fd;
        box-shadow: 0 0 0 4px rgba(59, 130, 246, .12);
    }

.app-root {
    min-height: 100vh;
}

/* ---------- BOTONES ---------- */

.btn {
    border: none;
    border-radius: 14px;
    padding: 12px 16px;
    font-weight: 700;
    cursor: pointer;
    transition: transform .12s ease, opacity .12s ease, box-shadow .12s ease;
    box-shadow: var(--shadow-sm);
}

    .btn:hover {
        opacity: .96;
    }

    .btn:active {
        transform: scale(.98);
    }

.btn-primary {
    background: var(--primary);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: none;
}

.btn-ghost-dark {
    background: #0f172a;
    color: #fff;
}

.btn-success {
    background: var(--success);
    color: #fff;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.btn-full {
    width: 100%;
}

/* ---------- MENSAJES ---------- */

.message-box {
    width: min(var(--container), calc(100% - 32px));
    margin: 0 auto 14px;
    border-radius: 16px;
    padding: 14px 16px;
    font-weight: 700;
    border: 1px solid transparent;
}

.message-success {
    background: var(--success-soft);
    color: #14532d;
    border-color: #bbf7d0;
}

.message-error {
    background: var(--danger-soft);
    color: #991b1b;
    border-color: #fecaca;
}

/* ---------- LOGIN ---------- */

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.login-panel {
    width: min(980px, 100%);
    display: grid;
    grid-template-columns: 1.1fr .9fr;
    gap: 28px;
    align-items: stretch;
}

.login-brand {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 34px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

.login-brand-logo {
    width: 86px;
    height: 86px;
    border-radius: 24px;
    border: 1px solid var(--border);
    background: #fff;
    display: grid;
    place-items: center;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

    .login-brand-logo img {
        max-width: 66px;
        max-height: 66px;
        object-fit: contain;
    }

    .login-brand-logo span {
        font-size: 22px;
        font-weight: 800;
    }

.login-brand-copy h1 {
    margin: 28px 0 8px;
    font-size: 42px;
    line-height: 1.02;
    letter-spacing: -.04em;
}

.login-brand-copy p {
    margin: 0;
    color: var(--text-muted);
    font-size: 18px;
}

.login-card-clean {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 30px;
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-card-head h2 {
    margin: 0 0 6px;
    font-size: 28px;
    letter-spacing: -.02em;
}

.login-card-head p {
    margin: 0 0 24px;
    color: var(--text-muted);
}

.login-form-clean {
    display: grid;
    gap: 16px;
}

.field-group {
    display: grid;
    gap: 8px;
}

    .field-group label {
        font-size: 14px;
        font-weight: 700;
        color: var(--text-soft);
    }

/* ---------- DASHBOARD ---------- */

.dashboard-shell {
    width: min(var(--container), 100%);
    margin: 0 auto;
    padding: 22px;
}

.topbar-card,
.toolbar-clean,
.brand-section-card,
.content-card,
.sidebar-card {
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-md);
    backdrop-filter: blur(10px);
}

.topbar-card {
    border-radius: 30px;
    padding: 22px 24px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 18px;
    align-items: center;
    margin-bottom: 16px;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
}

.brand-mark {
    width: 74px;
    height: 74px;
    border-radius: 22px;
    background: #fff;
    border: 1px solid var(--border);
    display: grid;
    place-items: center;
    overflow: hidden;
}

    .brand-mark img {
        max-width: 56px;
        max-height: 56px;
        object-fit: contain;
    }

    .brand-mark span {
        font-size: 20px;
        font-weight: 800;
    }

.topbar-copy h1 {
    margin: 0;
    font-size: 32px;
    letter-spacing: -.04em;
    line-height: 1.02;
}

.topbar-copy p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 15px;
}

.topbar-right {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.stat-pill {
    min-width: 160px;
    padding: 14px 16px;
    border-radius: 18px;
    background: var(--surface-2);
    border: 1px solid var(--border);
}

.stat-pill-dark {
    background: #0f172a;
    border-color: #0f172a;
    color: #fff;
}

.stat-label {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 6px;
    font-weight: 700;
}

.stat-pill-dark .stat-label {
    color: rgba(255,255,255,.65);
}

.stat-pill strong {
    display: block;
    font-size: 20px;
    letter-spacing: -.02em;
}

.toolbar-clean {
    border-radius: 24px;
    padding: 16px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    align-items: center;
    margin-bottom: 16px;
}

.search-clean {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 10px;
}

.toolbar-actions-clean {
    display: flex;
    align-items: center;
    gap: 10px;
}

    .toolbar-actions-clean form {
        margin: 0;
    }

.brand-section-card {
    border-radius: 24px;
    padding: 18px;
    margin-bottom: 16px;
}

.section-heading-inline h2,
.section-heading h2 {
    margin: 0 0 6px;
    font-size: 22px;
    letter-spacing: -.03em;
}

.section-heading-inline p,
.section-heading p {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

.brand-selector {
    margin-top: 16px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.brand-tile {
    border-radius: 20px;
    padding: 20px;
    background: #fff;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
    gap: 6px;
    transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}

    .brand-tile:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

.brand-name {
    font-size: 20px;
    font-weight: 800;
    letter-spacing: -.02em;
}

.brand-caption {
    font-size: 13px;
    color: var(--text-muted);
}

.brand-tcl {
    border-left: 4px solid #b45309;
}

.brand-samsung {
    border-left: 4px solid #1d4ed8;
}

.brand-hisense {
    border-left: 4px solid #0f766e;
}

.breadcrumb-clean {
    width: min(var(--container), 100%);
    margin: 0 auto 16px;
    padding: 12px 16px;
    border-radius: 16px;
    background: rgba(255,255,255,.7);
    border: 1px solid var(--border);
    color: var(--text-soft);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    font-weight: 600;
}

    .breadcrumb-clean a {
        color: var(--primary);
    }

.dashboard-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    gap: 16px;
}

.content-card,
.sidebar-card {
    border-radius: 28px;
    padding: 20px;
    min-width: 0;
}

.section-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 18px;
}

.section-badge {
    background: #eff6ff;
    color: #1d4ed8;
    border: 1px solid #bfdbfe;
    padding: 10px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.empty-state-clean {
    border-radius: 22px;
    padding: 22px;
    background: #fff;
    border: 1px dashed var(--border-strong);
}

    .empty-state-clean h3 {
        margin: 0 0 6px;
        font-size: 20px;
    }

    .empty-state-clean p {
        margin: 0;
        color: var(--text-muted);
    }

/* ---------- MODEL CARDS ---------- */

.model-grid-clean {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(255px, 1fr));
    gap: 16px;
}

.model-card-clean {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    transition: transform .12s ease, box-shadow .12s ease;
    display: flex;
    flex-direction: column;
}

    .model-card-clean:hover {
        transform: translateY(-2px);
        box-shadow: var(--shadow-md);
    }

.model-image-clean {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--border);
    padding: 14px;
    height: 210px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .model-image-clean img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

.model-card-body {
    padding: 16px;
    display: grid;
    gap: 10px;
}

.model-card-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 10px;
}

    .model-card-head strong {
        font-size: 16px;
        line-height: 1.2;
        letter-spacing: -.01em;
        word-break: break-word;
    }

.stock-chip {
    padding: 7px 10px;
    border-radius: 999px;
    background: #f1f5f9;
    color: var(--text);
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
}

.model-color {
    margin: 0;
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.35;
}

.meta-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

    .meta-tags span {
        padding: 7px 10px;
        border-radius: 999px;
        background: var(--surface-2);
        border: 1px solid var(--border);
        font-size: 12px;
        color: var(--text-soft);
        font-weight: 600;
    }

/* ---------- PRODUCT CARDS ---------- */

.product-grid-clean {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
    gap: 16px;
}

.product-card-clean {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 24px;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    display: flex;
    flex-direction: column;
}

.product-image-clean {
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border-bottom: 1px solid var(--border);
    padding: 12px;
    height: 190px;
    display: flex;
    align-items: center;
    justify-content: center;
}

    .product-image-clean img {
        max-width: 100%;
        max-height: 100%;
        object-fit: contain;
    }

.product-card-body {
    padding: 16px;
    display: grid;
    gap: 12px;
}

.product-card-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: flex-start;
}

.sku-text {
    font-size: 16px;
    font-weight: 800;
    line-height: 1.2;
    word-break: break-word;
    letter-spacing: -.01em;
}

.gtin-text {
    display: inline-block;
    margin-top: 6px;
    color: var(--text-muted);
    font-size: 12px;
}

.stock-mini-card {
    min-width: 78px;
    text-align: center;
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 10px 12px;
}

    .stock-mini-card span {
        display: block;
        color: var(--text-muted);
        font-size: 11px;
        margin-bottom: 4px;
    }

    .stock-mini-card strong {
        display: block;
        font-size: 22px;
    }

.product-name-clean {
    padding: 12px;
    border-radius: 14px;
    background: var(--surface-2);
    color: var(--text-soft);
    font-size: 13px;
    line-height: 1.4;
}

.meta-tags-product {
    margin-top: -2px;
}

.movement-form-clean {
    display: grid;
    grid-template-columns: 80px 1fr 1fr;
    gap: 10px;
    margin-top: 2px;
}

    .movement-form-clean input {
        text-align: center;
    }

/* ---------- SIDEBAR / ACTIVITY ---------- */

.activity-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
    padding: 6px;
    border-radius: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    margin-bottom: 14px;
}

.activity-tab {
    border: none;
    border-radius: 12px;
    background: transparent;
    color: var(--text-soft);
    padding: 10px 12px;
    font-weight: 700;
    cursor: pointer;
}

    .activity-tab.active {
        background: #fff;
        color: var(--text);
        box-shadow: var(--shadow-sm);
    }

.activity-panel {
    display: none;
}

    .activity-panel.active {
        display: block;
    }

.activity-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.activity-row {
    padding: 14px;
    border-radius: 16px;
    background: var(--surface-2);
    border: 1px solid var(--border);
    display: grid;
    gap: 10px;
}

.activity-row-main strong,
.activity-row-side strong {
    display: block;
    font-size: 14px;
}

.activity-row-main span,
.activity-row-side small {
    display: block;
    margin-top: 5px;
    color: var(--text-muted);
    font-size: 12px;
}

.activity-empty {
    margin: 0;
    color: var(--text-muted);
    font-size: 14px;
}

/* ---------- MODAL ---------- */

.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, .42);
    backdrop-filter: blur(8px);
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
}

    .modal-overlay.active {
        display: flex;
    }

.modal-card-clean {
    width: min(440px, 100%);
    background: #fff;
    border-radius: 28px;
    padding: 24px;
    border: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
}

    .modal-card-clean h2 {
        margin: 0 0 10px;
        font-size: 24px;
    }

    .modal-card-clean p {
        margin: 0 0 14px;
        color: var(--text-muted);
    }

    .modal-card-clean ol {
        margin: 0 0 18px;
        padding-left: 20px;
        color: var(--text-soft);
        line-height: 1.6;
    }

/* ---------- RESPONSIVE ---------- */

@media (max-width: 1100px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }

    .sidebar-card {
        order: 2;
    }

    .content-card {
        order: 1;
    }
}

@media (max-width: 920px) {
    .login-panel {
        grid-template-columns: 1fr;
    }

    .topbar-card {
        grid-template-columns: 1fr;
    }

    .topbar-right {
        justify-content: flex-start;
    }

    .toolbar-clean {
        grid-template-columns: 1fr;
    }

    .toolbar-actions-clean {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

        .toolbar-actions-clean form,
        .toolbar-actions-clean form button,
        .toolbar-actions-clean > button {
            width: 100%;
        }

    .brand-selector {
        grid-template-columns: 1fr;
    }

    .section-heading {
        flex-direction: column;
    }

    .section-badge {
        white-space: normal;
    }
}

@media (max-width: 720px) {
    .dashboard-shell {
        padding: 14px;
    }

    .topbar-card,
    .toolbar-clean,
    .brand-section-card,
    .content-card,
    .sidebar-card {
        border-radius: 22px;
    }

    .topbar-left {
        align-items: flex-start;
    }

    .brand-mark {
        width: 62px;
        height: 62px;
        border-radius: 18px;
    }

        .brand-mark img {
            max-width: 46px;
            max-height: 46px;
        }

    .topbar-copy h1 {
        font-size: 25px;
    }

    .stat-pill {
        min-width: 0;
        width: 100%;
    }

    .topbar-right {
        display: grid;
        grid-template-columns: 1fr;
    }

    .search-clean {
        grid-template-columns: 1fr;
    }

    .toolbar-actions-clean {
        grid-template-columns: 1fr;
    }

    .model-grid-clean,
    .product-grid-clean {
        grid-template-columns: 1fr;
    }

    .model-image-clean {
        height: 190px;
    }

    .product-image-clean {
        height: 180px;
    }

    .movement-form-clean {
        grid-template-columns: 1fr;
    }
}
.hidden {
    display: none !important;
}

.brand-tile,
.model-card-clean,
.breadcrumb-link {
    font-family: inherit;
}

.brand-tile,
.model-card-clean {
    cursor: pointer;
    text-align: left;
}

.model-card-clean {
    border: 1px solid var(--border);
    padding: 0;
}

.breadcrumb-link {
    background: transparent;
    border: none;
    padding: 0;
    color: var(--primary);
    font-weight: 700;
    cursor: pointer;
}

.loading-state {
    min-height: 260px;
    border-radius: 22px;
    background: #fff;
    border: 1px dashed var(--border-strong);
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    color: var(--text-muted);
}

    .loading-state p {
        margin: 0;
        font-weight: 700;
    }

.loading-spinner {
    width: 34px;
    height: 34px;
    border: 3px solid #dbeafe;
    border-top-color: var(--primary);
    border-radius: 999px;
    animation: spin .8s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

.movement-form-clean button:disabled {
    opacity: .7;
    cursor: wait;
}
/* =========================
   MEJORAS APP EXPERIENCE
========================= */

.human-card-title {
    min-width: 0;
}

    .human-card-title strong {
        display: block;
        font-size: 18px;
        line-height: 1.12;
        letter-spacing: -0.03em;
        color: var(--text);
    }

    .human-card-title span {
        display: block;
        margin-top: 4px;
        color: var(--text-muted);
        font-size: 13px;
        font-weight: 600;
    }

    .human-card-title small {
        display: block;
        margin-top: 6px;
        color: var(--text-soft);
        font-size: 12px;
        font-weight: 700;
        word-break: break-word;
    }

.model-code-small {
    margin: 0;
    color: var(--text-soft);
    font-size: 12px;
    font-weight: 700;
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 8px 10px;
    border-radius: 12px;
    word-break: break-word;
}

.back-to-models-btn {
    margin: 0 0 14px;
    border: 1px solid var(--border);
    background: #fff;
    color: var(--text);
    border-radius: 14px;
    padding: 11px 14px;
    font-weight: 800;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

    .back-to-models-btn span {
        font-size: 17px;
        line-height: 1;
    }

    .back-to-models-btn:hover {
        border-color: var(--border-strong);
    }

.model-summary-card {
    margin-bottom: 14px;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 18px;
    box-shadow: var(--shadow-sm);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
}

.summary-eyebrow {
    display: block;
    margin-bottom: 6px;
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .02em;
}

.model-summary-card h3 {
    margin: 0;
    font-size: 24px;
    letter-spacing: -0.04em;
}

.model-summary-card p {
    margin: 6px 0 0;
    color: var(--text-muted);
    font-size: 13px;
    font-weight: 700;
}

.summary-stats {
    display: flex;
    gap: 10px;
}

    .summary-stats div {
        min-width: 78px;
        background: #fff;
        border: 1px solid var(--border);
        border-radius: 16px;
        padding: 10px 12px;
        text-align: center;
    }

    .summary-stats span {
        display: block;
        color: var(--text-muted);
        font-size: 11px;
        font-weight: 700;
        margin-bottom: 4px;
    }

    .summary-stats strong {
        display: block;
        font-size: 22px;
        letter-spacing: -0.03em;
    }

.summary-sizes {
    grid-column: 1 / -1;
    color: var(--text-soft);
    font-size: 13px;
    font-weight: 700;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 10px 12px;
}

.search-clean input {
    transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

    .search-clean input:not(:placeholder-shown) {
        background: #ffffff;
    }

@media (max-width: 720px) {
    .model-summary-card {
        grid-template-columns: 1fr;
    }

    .summary-stats {
        display: grid;
        grid-template-columns: 1fr 1fr;
    }

    .back-to-models-btn {
        width: 100%;
        justify-content: center;
    }
}