/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #0d6e6e;
    --primary-dark: #094f4f;
    --primary-light: #e6f4f4;
    --accent: #19b394;
    --clinica: #1a6fa8;
    --clinica-light: #e8f2fa;
    --laboratorio: #0d6e6e;
    --laboratorio-light: #e6f4f4;
    --comercial: #6b3fa0;
    --comercial-light: #f0ebf8;
    --text: #1a1a2e;
    --text-muted: #5a6272;
    --bg: #f7f9fc;
    --white: #ffffff;
    --border: #e2e8f0;
    --shadow: 0 4px 24px rgba(0,0,0,0.07);
    --radius: 16px;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* ── Header / Nav ── */
header {
    background: var(--white);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

nav {
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 24px;
    height: 64px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.logo {
    text-decoration: none;
    display: flex;
    align-items: baseline;
    gap: 4px;
}

.logo-text {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--primary);
    letter-spacing: -0.5px;
}

.logo-sub {
    font-size: 0.75rem;
    font-weight: 500;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.nav-links {
    list-style: none;
    display: flex;
    gap: 8px;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-muted);
    font-size: 0.9rem;
    font-weight: 500;
    padding: 6px 14px;
    border-radius: 8px;
    transition: all 0.2s;
}

.nav-links a:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* ── Main ── */
main { flex: 1; }

/* ── Hero ── */
.hero {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--accent) 100%);
    padding: 80px 24px 72px;
    text-align: center;
    color: var(--white);
}

.hero h1 {
    font-size: 2.8rem;
    font-weight: 800;
    letter-spacing: -1px;
    margin-bottom: 12px;
}

.highlight { color: #7fffd4; }

.hero-sub {
    font-size: 1.15rem;
    opacity: 0.85;
}

/* ── Cards ── */
.cards {
    max-width: 1100px;
    margin: -40px auto 60px;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 24px;
}

.card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 36px 28px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    gap: 12px;
    position: relative;
    overflow: hidden;
}

.card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
}

.card--clinica::before    { background: var(--clinica); }
.card--laboratorio::before { background: var(--laboratorio); }
.card--comercial::before  { background: var(--comercial); }

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 40px rgba(0,0,0,0.12);
}

.card-icon { font-size: 2.4rem; }

.card h2 {
    font-size: 1.35rem;
    font-weight: 700;
}

.card--clinica h2    { color: var(--clinica); }
.card--laboratorio h2 { color: var(--laboratorio); }
.card--comercial h2  { color: var(--comercial); }

.card p {
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    flex: 1;
}

.card-arrow {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-muted);
    align-self: flex-end;
    transition: transform 0.2s;
}

.card:hover .card-arrow { transform: translateX(4px); }

/* ── Sección interior ── */
.seccion-hero {
    background: linear-gradient(135deg, var(--primary-dark), var(--primary));
    padding: 56px 24px 48px;
    color: var(--white);
}

.seccion-hero-content {
    max-width: 800px;
    margin: 0 auto;
}

.back-link {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    font-size: 0.9rem;
    display: inline-block;
    margin-bottom: 16px;
    transition: color 0.2s;
}

.back-link:hover { color: var(--white); }

.seccion-hero h1 {
    font-size: 2.2rem;
    font-weight: 800;
    margin-bottom: 8px;
}

.seccion-hero p {
    opacity: 0.85;
    font-size: 1rem;
}

/* ── Ensayos grid ── */
.ensayos-grid {
    max-width: 1100px;
    margin: 40px auto 60px;
    padding: 0 24px;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 20px;
}

.ensayo-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 28px 24px;
    text-decoration: none;
    color: var(--text);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    transition: transform 0.2s, box-shadow 0.2s;
}

.ensayo-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 10px 32px rgba(0,0,0,0.1);
}

.ensayo-icon { font-size: 2rem; margin-bottom: 12px; }
.ensayo-card h3 { font-size: 1.1rem; margin-bottom: 8px; }
.ensayo-card p  { color: var(--text-muted); font-size: 0.9rem; line-height: 1.5; }

/* ── Empty state ── */
.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    padding: 80px 24px;
    color: var(--text-muted);
}

.empty-icon { font-size: 3rem; margin-bottom: 16px; }
.empty-state h3 { font-size: 1.2rem; margin-bottom: 8px; color: var(--text); }
.empty-state p  { font-size: 0.95rem; }

/* ── Footer ── */
footer {
    background: var(--white);
    border-top: 1px solid var(--border);
    text-align: center;
    padding: 20px 24px;
    font-size: 0.85rem;
    color: var(--text-muted);
}

footer a { color: var(--primary); text-decoration: none; }

/* ── Logout button ── */
.nav-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.nav-user span {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.logout-btn {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-muted);
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 5px 12px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.logout-btn:hover {
    background: #fee2e2;
    color: #dc2626;
    border-color: #fca5a5;
}

/* ── Login page ── */
.login-body {
    background: linear-gradient(135deg, var(--primary-dark) 0%, var(--primary) 60%, var(--accent) 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 24px;
}

.login-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 48px 40px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}

.login-logo {
    display: flex;
    align-items: baseline;
    gap: 6px;
    margin-bottom: 24px;
}

.login-title {
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 28px;
}

.login-error {
    background: #fee2e2;
    color: #dc2626;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.login-form { display: flex; flex-direction: column; gap: 18px; }

.form-group { display: flex; flex-direction: column; gap: 6px; }

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}

.form-group input {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.95rem;
    color: var(--text);
    outline: none;
    transition: border-color 0.2s;
}

.form-group input:focus { border-color: var(--primary); }

.login-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 8px;
    padding: 12px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    margin-top: 8px;
}

.login-btn:hover { background: var(--primary-dark); }

/* ── MTT Analysis ── */
.mtt-wrap {
    max-width: 900px;
    margin: 40px auto 60px;
    padding: 0 24px;
}

.mtt-card {
    background: var(--white);
    border-radius: var(--radius);
    padding: 36px 40px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.mtt-format-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.mtt-dl-example {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--primary);
    text-decoration: none;
    background: var(--primary-light);
    border: 1px solid var(--border);
    border-radius: 6px;
    padding: 4px 10px;
    transition: all 0.2s;
    white-space: nowrap;
}

.mtt-dl-example:hover {
    background: var(--primary);
    color: var(--white);
}

.mtt-format h3 {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 8px;
    color: var(--text);
}

.mtt-format p {
    font-size: 0.9rem;
    color: var(--text-muted);
    margin-bottom: 16px;
    line-height: 1.5;
}

.mtt-example-table {
    background: var(--bg);
    border-radius: 10px;
    padding: 16px;
    margin-bottom: 28px;
    overflow-x: auto;
}

.mtt-example-table table {
    border-collapse: collapse;
    font-size: 0.85rem;
    width: 100%;
}

.mtt-example-table th {
    background: var(--primary-light);
    color: var(--primary);
    font-weight: 700;
    padding: 8px 16px;
    text-align: center;
    border: 1px solid var(--border);
}

.mtt-example-table td {
    padding: 6px 16px;
    text-align: center;
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-family: monospace;
}

.mtt-error {
    background: #fee2e2;
    color: #dc2626;
    border-radius: 8px;
    padding: 12px 16px;
    font-size: 0.9rem;
    margin-bottom: 20px;
}

.mtt-form { display: flex; flex-direction: column; gap: 16px; }

.mtt-dropzone {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 40px 24px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.mtt-dropzone:hover {
    border-color: var(--primary);
    background: var(--primary-light);
}

.mtt-dropzone input[type="file"] { display: none; }

.mtt-dz-icon { font-size: 2.4rem; }

.mtt-dz-text {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.mtt-dz-hint {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.mtt-btn {
    background: var(--primary);
    color: var(--white);
    border: none;
    border-radius: 10px;
    padding: 13px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
}

.mtt-btn:hover { background: var(--primary-dark); }
.mtt-btn:disabled { opacity: 0.6; cursor: not-allowed; }

/* Results */
.mtt-results-wrap {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.mtt-results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 12px;
}

.mtt-results-title {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text);
    margin-bottom: 4px;
}

.mtt-filename {
    font-size: 0.85rem;
    color: var(--text-muted);
}

.mtt-new-btn {
    background: var(--primary-light);
    color: var(--primary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    font-size: 0.9rem;
    font-weight: 600;
    text-decoration: none;
    transition: all 0.2s;
    white-space: nowrap;
}

.mtt-new-btn:hover { background: var(--primary); color: var(--white); }

.mtt-controls-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px 20px;
    box-shadow: var(--shadow);
}

.mtt-control-group { display: flex; align-items: center; gap: 10px; }

.mtt-anova-badge {
    margin-left: auto;
    font-size: 0.85rem;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}
.mtt-anova-label { font-weight: 600; color: var(--text); }
.mtt-sig-pill {
    display: inline-block;
    border-radius: 6px;
    padding: 2px 8px;
    font-size: 0.8rem;
    font-weight: 700;
}
.mtt-anova-sig { background: #dcfce7; color: #15803d; }
.mtt-anova-ns  { background: #f1f5f9; color: #64748b; }

.mtt-colors-section {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 20px;
    box-shadow: var(--shadow);
}
.mtt-colors-row { display: flex; flex-wrap: wrap; gap: 12px; }
.mtt-color-item {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
}
.mtt-color-item input[type="color"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
    width: 0; height: 0;
}
.mtt-color-swatch {
    display: block;
    width: 20px; height: 20px;
    border-radius: 50%;
    cursor: pointer;
    border: 2px solid rgba(0,0,0,0.12);
    transition: transform 0.15s;
}
.mtt-color-swatch:hover { transform: scale(1.25); }
.mtt-color-label {
    font-size: 0.82rem;
    color: var(--text-muted);
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.mtt-color-dot {
    display: inline-block;
    width: 10px; height: 10px;
    border-radius: 50%;
    margin-right: 7px;
    vertical-align: middle;
    flex-shrink: 0;
}

.mtt-sig-3 { color: #15803d; font-weight: 700; }
.mtt-sig-2 { color: #0369a1; font-weight: 700; }
.mtt-sig-1 { color: #b45309; font-weight: 700; }
.mtt-sig-ns { color: #94a3b8; }
.mtt-p-note {
    display: block;
    font-size: 0.75rem;
    color: #94a3b8;
    font-weight: 400;
    margin-top: 2px;
}
.mtt-outlier-note {
    font-size: 0.78rem;
    color: #f59e0b;
    font-weight: 500;
}
.mtt-stat-note {
    font-size: 0.78rem;
    color: #94a3b8;
    text-align: center;
    margin: -4px 0 8px;
}

.mtt-report-box {
    background: #fafafa;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 22px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.mtt-report-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}
.mtt-report-summary {
    font-size: 0.9rem;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 14px;
}
.mtt-report-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 2px;
}
.mtt-report-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.mtt-report-table th {
    background: #f0f0f0;
    padding: 7px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.8rem;
    color: var(--text-muted);
    border-bottom: 1px solid #e0e0e0;
}
.mtt-report-table td {
    padding: 7px 12px;
    border-top: 1px solid #f0f0f0;
    color: var(--text);
}
.mtt-report-table tr:hover td { background: #f5f5f5; }
.mtt-outlier-row td { background: #fffbeb !important; }

.mtt-controls-label {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
}

.mtt-select {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 7px 12px;
    font-size: 0.95rem;
    color: var(--text);
    background: var(--bg);
    cursor: pointer;
    outline: none;
    transition: border-color 0.2s;
    min-width: 160px;
}

.mtt-select:focus { border-color: var(--primary); }

.mtt-chart-box {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 20px;
}

#mtt-chart { height: 380px; }

.mtt-table-wrap {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    overflow-x: auto;
}

.mtt-table {
    border-collapse: collapse;
    width: 100%;
    font-size: 0.9rem;
}

.mtt-table th {
    background: var(--bg);
    padding: 12px 16px;
    text-align: left;
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.mtt-table td {
    padding: 11px 16px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    font-family: monospace;
    font-size: 0.88rem;
}

.mtt-table tr:last-child td { border-bottom: none; }

.mtt-table td:first-child { font-family: inherit; font-weight: 500; }

.mtt-norm-row td { background: var(--primary-light); }

.mtt-badge {
    display: inline-block;
    background: var(--primary);
    color: var(--white);
    border-radius: 4px;
    padding: 1px 6px;
    font-size: 0.7rem;
    font-weight: 700;
    vertical-align: middle;
    margin-left: 4px;
    font-family: inherit;
}

.mtt-actions { display: flex; justify-content: flex-end; }

.mtt-dl-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 18px;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.mtt-dl-btn:hover {
    background: var(--primary-light);
    color: var(--primary);
    border-color: var(--primary);
}

/* ── HairMetrix ── */
.hm-dropzone { cursor: pointer; flex-direction: column; gap: 6px; min-height: 130px; justify-content: center; }
.hm-drag-over { border-color: var(--primary) !important; background: #f0f4ff !important; }
.hm-drop-icon { font-size: 2.2rem; margin-bottom: 6px; }
.hm-drop-ok { filter: none; }
.hm-drop-sub { font-size: 0.82rem; color: #aaa; margin-top: 4px; }

.hm-error {
    background: #fff0f0;
    border: 1px solid #f5c6c6;
    color: #b00;
    border-radius: 10px;
    padding: 14px 18px;
    margin-bottom: 18px;
}

.hm-hint {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 14px;
}

.hm-days-row {
    display: flex;
    align-items: center;
    gap: 20px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.hm-days-row label {
    font-size: 0.9rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 8px;
}

.hm-days-input {
    width: 70px;
    padding: 5px 8px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 0.95rem;
}

.hm-days-hint {
    font-size: 0.8rem;
    color: #aaa;
    font-style: italic;
}

.hm-step { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.hm-step-num { background: var(--primary); color: #fff; border-radius: 50%; width: 24px; height: 24px; display: flex; align-items: center; justify-content: center; font-size: 0.8rem; font-weight: 700; flex-shrink: 0; }
.hm-step-title { font-weight: 600; font-size: 1rem; color: var(--text-primary); }
.hm-divider { border: none; border-top: 1px solid #f0f0f0; margin: 20px 0; }
.hm-config-row { display: flex; gap: 24px; flex-wrap: wrap; align-items: flex-start; margin-bottom: 4px; }
.hm-config-block { display: flex; flex-direction: column; gap: 8px; }
.hm-config-label { font-size: 0.85rem; font-weight: 600; color: var(--text-secondary); }
.hm-locked { background: #aaa !important; cursor: not-allowed !important; opacity: 0.7; }
.hm-locked:hover { background: #999 !important; }
.hm-lock-hint { font-size: 0.82rem; color: #aaa; margin: 8px 0 0; font-style: italic; }

.hm-mode-row {
    display: flex;
    align-items: center;
    gap: 18px;
    margin: 18px 0 6px;
    flex-wrap: wrap;
}
.hm-mode-label { font-size: 0.9rem; color: var(--text-secondary); font-weight: 600; }
.hm-mode-opt { font-size: 0.9rem; color: var(--text-secondary); display: flex; align-items: center; gap: 5px; cursor: pointer; }

.hm-actions {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    margin-top: 8px;
}

.hm-btn-validate { background: var(--primary); }
.hm-btn-root { background: #27ae60; }
.hm-btn-root:hover { background: #219150; }
.hm-btn-rap { background: #8e44ad; }
.hm-btn-rap:hover { background: #7d3c98; }

.hm-loading {
    margin-top: 14px;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.hm-guide { background: #fafbfc; }
.hm-guide-case { font-size: 0.9rem; margin: 0 0 10px; color: var(--text-primary); }
.hm-guide h3 { margin-bottom: 14px; }

.hm-guide-cols {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    margin-bottom: 14px;
}

.hm-pre {
    background: #f4f4f4;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 0.82rem;
    margin: 8px 0 0;
    white-space: pre;
    overflow-x: auto;
    line-height: 1.5;
}

.hm-output {
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    padding: 16px 18px;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
    max-height: 420px;
    overflow-y: auto;
    line-height: 1.6;
}

/* ── VISIA ── */
.visia-select-wrap { margin-bottom: 4px; }
.visia-select {
    padding: 9px 14px;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 0.95rem;
    background: #fff;
    cursor: pointer;
    min-width: 260px;
}
.visia-select:focus { outline: none; border-color: var(--primary); }

.visia-info-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.visia-info-table th { background: #f4f4f4; padding: 8px 12px; text-align: left; font-weight: 600; }
.visia-info-table td { padding: 7px 12px; border-top: 1px solid #f0f0f0; color: var(--text-secondary); }
.visia-info-table tr:hover td { background: #fafafa; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .cards { grid-template-columns: 1fr; margin-top: -24px; }
    .hero h1 { font-size: 2rem; }
    .nav-links { display: none; }
    .hm-guide-cols { grid-template-columns: 1fr; }
    .hm-actions { flex-direction: column; }
}

/* ══════════════════════════════════════
   Comercial — Email sender
══════════════════════════════════════ */
.com-wrap {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 60px;
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.com-page-header { text-align: center; }
.com-title { font-size: 1.9rem; font-weight: 700; color: var(--text); margin-bottom: 8px; }
.com-subtitle { color: var(--text-muted); font-size: 0.95rem; }
.com-subtitle code {
    background: var(--comercial-light);
    color: var(--comercial);
    padding: 1px 6px;
    border-radius: 4px;
    font-size: 0.88rem;
}

.com-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.com-card {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 28px;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.com-card-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.com-card-icon { font-size: 1.5rem; }
.com-card-header h2 { font-size: 1.15rem; font-weight: 600; color: var(--text); }

.com-hint { font-size: 0.88rem; color: var(--text-muted); }

/* Comercial hero override */
.seccion-hero--comercial {
    background: linear-gradient(135deg, #4a2880 0%, var(--comercial) 60%, #9b59b6 100%);
}

/* Format info box */
.com-format-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.com-format-title {
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--comercial);
}
.com-format-tags { display: flex; gap: 8px; flex-wrap: wrap; }
.com-tag {
    background: var(--comercial-light);
    color: var(--comercial);
    border: 1px solid #d0b8f0;
    border-radius: 6px;
    padding: 3px 10px;
    font-size: 0.82rem;
    font-weight: 600;
    font-family: monospace;
}
.com-format-desc { font-size: 0.85rem; color: var(--text-muted); }
.com-format-table {
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    font-size: 0.83rem;
}
.com-format-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border);
}
.com-format-row:last-child { border-bottom: none; }
.com-format-head {
    background: var(--comercial-light);
    font-weight: 700;
    color: var(--comercial);
    font-family: monospace;
}
.com-format-note {
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}
.com-format-note code {
    background: var(--comercial-light);
    color: var(--comercial);
    padding: 1px 5px;
    border-radius: 4px;
    font-size: 0.78rem;
}

/* Template download row */
.com-template-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}
.com-template-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--comercial-light);
    color: var(--comercial);
    border: 1px solid var(--comercial);
    border-radius: 8px;
    padding: 5px 14px;
    font-size: 0.82rem;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s;
}
.com-template-btn:hover { background: #e0d5f5; }

/* Dropzone */
.com-dropzone {
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 36px 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}
.com-dropzone:hover, .com-dz-over { border-color: var(--comercial); background: var(--comercial-light); }
.com-dz-loading { opacity: 0.6; pointer-events: none; }
.com-dz-icon { font-size: 2rem; }
.com-dz-text { font-size: 0.95rem; color: var(--text-muted); }
.com-dz-link { color: var(--comercial); font-weight: 600; text-decoration: underline; }
.com-dz-hint { font-size: 0.8rem; color: #aaa; }

/* Contacts table */
.com-contacts-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.com-badge {
    display: inline-block;
    background: var(--comercial-light);
    color: var(--comercial);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 4px 12px;
    border-radius: 20px;
}
.com-badge-ok   { background: #e6f4ee; color: #1a7a45; }
.com-badge-warn { background: #fff3e0; color: #b35900; }

.com-clear-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 4px 12px;
    font-size: 0.82rem;
    color: var(--text-muted);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s;
}
.com-clear-btn:hover { border-color: #e55; color: #e55; }

.com-table-wrap { overflow-x: auto; }
.com-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.88rem;
}
.com-table th {
    background: var(--comercial-light);
    color: var(--comercial);
    font-weight: 600;
    padding: 8px 12px;
    text-align: left;
    border-bottom: 2px solid var(--border);
}
.com-table td {
    padding: 7px 12px;
    border-bottom: 1px solid var(--border);
    color: var(--text);
    word-break: break-all;
}
.com-table tr:last-child td { border-bottom: none; }
.com-table tr:hover td { background: var(--comercial-light); }

.com-error {
    background: #fff0f0;
    border: 1px solid #fcc;
    color: #c00;
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 0.88rem;
}

/* Attachment zone */
.com-attach-zone {
    border: 2px dashed var(--border);
    border-radius: 10px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
}
.com-attach-zone:hover, .com-attach-zone.com-dz-over {
    border-color: var(--comercial);
    background: var(--comercial-light);
}
.com-attach-icon { font-size: 1.5rem; }
.com-attach-text { font-size: 0.88rem; color: var(--text-muted); }

.com-attach-list { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }
.com-attach-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 6px 12px;
    font-size: 0.85rem;
}
.com-attach-name { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.com-attach-remove {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.8rem;
    padding: 0 4px;
    flex-shrink: 0;
}
.com-attach-remove:hover { color: #e55; }

/* Form */
.com-form { display: flex; flex-direction: column; gap: 16px; }
.com-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.com-field { display: flex; flex-direction: column; gap: 6px; }
.com-field label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text);
}
.com-var-hint { font-weight: 400; color: var(--text-muted); font-size: 0.8rem; }
.com-field input, .com-field textarea {
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 9px 12px;
    font-size: 0.92rem;
    font-family: inherit;
    color: var(--text);
    background: var(--white);
    transition: border-color 0.15s;
    resize: vertical;
}
.com-field input:focus, .com-field textarea:focus {
    outline: none;
    border-color: var(--comercial);
}

/* Preview */
.com-preview-toggle { display: flex; align-items: center; gap: 12px; }
.com-btn-outline {
    border: 1px solid var(--comercial);
    color: var(--comercial);
    background: none;
    border-radius: 8px;
    padding: 7px 16px;
    font-size: 0.88rem;
    cursor: pointer;
    transition: background 0.15s;
}
.com-btn-outline:hover { background: var(--comercial-light); }
.com-preview-hint { font-size: 0.82rem; color: var(--text-muted); }

.com-preview-box {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 16px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.com-preview-label { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; }
.com-preview-subject { font-weight: 600; color: var(--text); font-size: 0.95rem; }
.com-preview-body {
    font-family: inherit;
    font-size: 0.88rem;
    color: var(--text);
    white-space: pre-wrap;
    word-break: break-word;
    line-height: 1.6;
    margin: 0;
}

/* Send bar */
.com-send-bar { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding-top: 4px; }
.com-send-btn {
    background: var(--comercial);
    color: #fff;
    border: none;
    border-radius: 10px;
    padding: 12px 28px;
    font-size: 0.97rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s, opacity 0.15s;
}
.com-send-btn:hover:not(:disabled) { background: #5a3290; }
.com-send-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.com-send-hint { font-size: 0.82rem; color: var(--text-muted); }

/* Results */
.com-results {
    background: var(--white);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    padding: 28px;
}
.com-results-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
}
.com-results-header h2 { font-size: 1.1rem; font-weight: 600; }
.com-status-ok  { color: #1a7a45; font-weight: 600; }
.com-status-fail { color: #c00; font-weight: 600; }

@media (max-width: 820px) {
    .com-grid { grid-template-columns: 1fr; }
    .com-field-row { grid-template-columns: 1fr; }
}
