:root {
    /* Equivalencias digitales provisionales. Los valores viven en tokens para poder ajustarlos sin reescribir componentes. */
    --brand-red: #d62832;
    --brand-red-hover: #e33a43;
    --background-base: #0e1114;
    --surface-1: #15191d;
    --surface-2: #1b2025;
    --surface-3: #22282e;
    --border-subtle: #30373e;
    --text-primary: #f2f4f5;
    --text-secondary: #b7bec4;
    --text-muted: #7f8992;
    --status-success: #48b982;
    --status-warning: #d6aa45;
    --status-danger: #e05b64;
    --status-info: #5798d6;

    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 24px;
    --space-6: 32px;
    --space-7: 48px;

    --radius-control: 8px;
    --radius-panel: 10px;
}

* {
    box-sizing: border-box;
}

html {
    color-scheme: dark;
}

body {
    margin: 0;
    min-width: 320px;
    min-height: 100vh;
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--background-base);
    color: var(--text-primary);
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

button,
a {
    -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: var(--space-3);
    font-size: clamp(1.75rem, 4vw, 2.5rem);
    line-height: 1.15;
}

h2 {
    margin-bottom: var(--space-2);
    font-size: clamp(1.15rem, 2vw, 1.4rem);
}

.eyebrow {
    margin-bottom: var(--space-2);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.button {
    min-height: 44px;
    padding: 0 var(--space-4);
    border: 1px solid transparent;
    border-radius: var(--radius-control);
    cursor: pointer;
    font-weight: 700;
    transition: background-color 120ms ease, border-color 120ms ease, color 120ms ease;
}

.button--primary {
    background: var(--brand-red);
    color: #fff;
}

.button--primary:hover {
    background: var(--brand-red-hover);
}

.button--secondary {
    border-color: var(--border-subtle);
    background: var(--surface-2);
    color: var(--text-primary);
}

.button--secondary:hover {
    background: var(--surface-3);
}

.alert {
    margin-bottom: var(--space-4);
    padding: var(--space-3) var(--space-4);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-control);
}

.alert--danger {
    border-color: color-mix(in srgb, var(--status-danger) 45%, var(--border-subtle));
    background: color-mix(in srgb, var(--status-danger) 12%, var(--surface-2));
}

.field {
    display: grid;
    gap: var(--space-2);
}

.field label {
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 650;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    min-height: 46px;
    padding: 0 var(--space-3);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-control);
    background-color: var(--surface-1);
    color: var(--text-primary);
}

.field textarea {
    min-height: 104px;
    padding-block: var(--space-3);
    resize: vertical;
}

.field select {
    appearance: none;
    -webkit-appearance: none;
    padding-right: 42px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 16 16'%3E%3Cpath d='M4 6l4 4 4-4' fill='none' stroke='%23b7bec4' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 13px center;
    background-size: 16px 16px;
    cursor: pointer;
}

.field select option {
    background: var(--surface-1);
    color: var(--text-primary);
}

.field input:hover,
.field select:hover,
.field textarea:hover {
    border-color: #46515a;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    border-color: var(--brand-red);
}

.form-stack {
    display: grid;
    gap: var(--space-4);
}

.auth-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: var(--space-5);
    background:
        radial-gradient(circle at 20% 0%, rgba(214, 40, 50, 0.08), transparent 32rem),
        var(--background-base);
}

.auth-card {
    width: min(100%, 430px);
    padding: clamp(24px, 5vw, 36px);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-panel);
    background: var(--surface-2);
}

.auth-card__header p:not(.eyebrow) {
    color: var(--text-secondary);
}

.auth-card__footer {
    margin: var(--space-5) 0 0;
    color: var(--text-muted);
    font-size: 0.8rem;
    letter-spacing: 0.04em;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
    min-height: 100vh;
    padding: var(--space-5) var(--space-4);
    border-right: 1px solid var(--border-subtle);
    background: var(--surface-1);
}

.product-mark {
    display: flex;
    align-items: baseline;
    gap: var(--space-2);
    min-height: 44px;
    padding: 0 var(--space-3);
    margin-bottom: var(--space-6);
}

.product-mark__name {
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
}

.product-mark__suffix {
    color: var(--brand-red);
    font-size: 0.78rem;
    font-weight: 800;
    text-transform: uppercase;
}

.nav-list {
    display: grid;
    gap: var(--space-2);
}

.nav-item {
    min-height: 44px;
    display: flex;
    align-items: center;
    padding: 0 var(--space-3);
    border-radius: var(--radius-control);
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 0.92rem;
    font-weight: 650;
}

.nav-item--active {
    background: color-mix(in srgb, var(--brand-red) 15%, var(--surface-2));
    color: var(--text-primary);
    box-shadow: inset 3px 0 0 var(--brand-red);
}

.nav-item--disabled {
    color: var(--text-muted);
    cursor: default;
}

.workspace {
    min-width: 0;
}

.topbar {
    min-height: 76px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
    padding: var(--space-3) clamp(20px, 3vw, 36px);
    border-bottom: 1px solid var(--border-subtle);
    background: var(--surface-1);
}

.topbar .eyebrow {
    margin-bottom: 2px;
}

.topbar__user {
    margin: 0;
    font-weight: 700;
}

.content {
    width: min(100%, 1500px);
    padding: clamp(20px, 3vw, 36px);
}

.welcome-panel,
.info-card,
.placeholder-panel {
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-panel);
    background: var(--surface-2);
}

.welcome-panel {
    padding: clamp(24px, 4vw, 40px);
    margin-bottom: var(--space-5);
}

.welcome-panel > p:last-child,
.placeholder-panel p:last-child {
    margin-bottom: 0;
    color: var(--text-secondary);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: var(--space-4);
    margin-bottom: var(--space-5);
}

.info-card {
    display: grid;
    gap: var(--space-2);
    min-height: 118px;
    padding: var(--space-5);
}

.info-card__label {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.info-card strong {
    align-self: end;
    font-size: clamp(1rem, 2vw, 1.25rem);
}

.placeholder-panel {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-5);
    padding: var(--space-5);
}

.status-chip {
    display: inline-flex;
    align-items: center;
    min-height: 30px;
    padding: 0 var(--space-3);
    border-radius: 999px;
    white-space: nowrap;
    font-size: 0.8rem;
    font-weight: 750;
}

.status-chip--success {
    border: 1px solid color-mix(in srgb, var(--status-success) 42%, var(--border-subtle));
    background: color-mix(in srgb, var(--status-success) 12%, var(--surface-2));
    color: #a9e3c6;
}

.status-chip--warning {
    border: 1px solid color-mix(in srgb, var(--status-warning) 42%, var(--border-subtle));
    background: color-mix(in srgb, var(--status-warning) 12%, var(--surface-2));
    color: color-mix(in srgb, var(--status-warning) 78%, white);
}

.status-chip--danger {
    border: 1px solid color-mix(in srgb, var(--status-danger) 42%, var(--border-subtle));
    background: color-mix(in srgb, var(--status-danger) 12%, var(--surface-2));
    color: color-mix(in srgb, var(--status-danger) 78%, white);
}

@media (max-width: 1199px) {
    .app-shell {
        grid-template-columns: 200px minmax(0, 1fr);
    }

    .sidebar {
        padding-inline: var(--space-3);
    }
}

@media (max-width: 767px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        min-height: auto;
        padding: var(--space-3) var(--space-4);
        border-right: 0;
        border-bottom: 1px solid var(--border-subtle);
    }

    .product-mark {
        margin-bottom: var(--space-3);
        padding-inline: 0;
    }

    .nav-list {
        display: flex;
        gap: var(--space-2);
        overflow-x: auto;
        padding-bottom: var(--space-1);
        scrollbar-width: thin;
    }

    .nav-item {
        flex: 0 0 auto;
        padding-inline: var(--space-3);
    }

    .nav-item--active {
        box-shadow: inset 0 -3px 0 var(--brand-red);
    }

    .topbar {
        min-height: auto;
        align-items: flex-start;
        padding: var(--space-4);
    }

    .content {
        padding: var(--space-4);
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .info-card {
        min-height: 96px;
    }

    .placeholder-panel {
        align-items: flex-start;
        flex-direction: column;
    }
}

@media (max-width: 420px) {
    .auth-page {
        padding: var(--space-4);
    }

    .auth-card {
        padding: var(--space-5);
    }

    .topbar {
        flex-direction: column;
    }

    .topbar form,
    .topbar .button {
        width: 100%;
    }
}
