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

:root {
    --primary: #6B3A2A;
    --primary-light: #8B4513;
    --accent: #D4855C;
    --accent-light: #F0A878;
    --bg: #FFF8F2;
    --surface: #FFFFFF;
    --surface-alt: #FFF3EA;
    --border: #E8D5C4;
    --text: #2C1810;
    --text-muted: #7A5C50;
    --shadow: 0 2px 12px rgba(107, 58, 42, 0.1);
    --radius: 14px;
    --radius-sm: 8px;
}

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

/* ── HEADER ── */
header {
    background: var(--primary);
    color: white;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 12px rgba(0,0,0,0.25);
}

.header-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 28px;
}

.logo-icon { font-size: 30px; }

.site-title {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.3px;
    flex: 1;
}

.year-badge {
    background: rgba(255,255,255,0.18);
    padding: 5px 14px;
    border-radius: 20px;
    font-size: 14px;
    font-weight: 600;
}

.breadcrumb {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 28px;
    background: rgba(0,0,0,0.18);
    font-size: 13px;
    min-height: 36px;
}

.bc-link {
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    transition: color 0.15s;
}
.bc-link:hover { color: white; text-decoration: underline; }
.bc-sep { color: rgba(255,255,255,0.35); }
.bc-current { color: white; font-weight: 600; }

/* ── MAIN ── */
main {
    max-width: 1200px;
    margin: 0 auto;
    padding: 36px 28px;
}

/* ── HOME ── */
.home-screen { text-align: center; padding: 16px 0; }

.home-hero { margin-bottom: 52px; }
.hero-icon { font-size: 80px; display: block; margin-bottom: 18px; }
.home-hero h2 { font-size: 34px; font-weight: 700; color: var(--primary); margin-bottom: 10px; }
.home-hero p { font-size: 16px; color: var(--text-muted); }

.branch-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 28px;
    max-width: 880px;
    margin: 0 auto;
}

.branch-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 44px 24px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.branch-card:hover {
    border-color: var(--accent);
    box-shadow: 0 10px 28px rgba(107, 58, 42, 0.18);
    transform: translateY(-3px);
}

.branch-icon { font-size: 52px; display: block; margin-bottom: 14px; }
.branch-card h3 { font-size: 26px; font-weight: 700; color: var(--primary); margin-bottom: 6px; }
.branch-card p { font-size: 14px; color: var(--text-muted); }

/* ── ETIQUETAS HOME CARD ── */
.branch-card-print { border-color: #1565C0; }
.branch-card-print:hover {
    border-color: #1565C0;
    box-shadow: 0 10px 28px rgba(21, 101, 192, 0.18);
}

/* ── BRANCH MENU ── */
.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    flex-wrap: wrap;
}

.section-header h2 {
    flex: 1;
    font-size: 26px;
    font-weight: 700;
    color: var(--primary);
}

.section-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 20px;
}

.section-card {
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    padding: 36px 20px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.section-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}

.section-icon { font-size: 44px; display: block; margin-bottom: 12px; }
.section-card h3 { font-size: 15px; font-weight: 700; color: var(--primary); }

/* ── BUTTONS ── */
.btn-back {
    background: none;
    border: 2px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    cursor: pointer;
    font-size: 14px;
    color: var(--text-muted);
    transition: all 0.15s;
    white-space: nowrap;
    font-weight: 600;
}
.btn-back:hover { border-color: var(--primary); color: var(--primary); }

.btn-submit {
    background: var(--primary);
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 12px 30px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
    letter-spacing: 0.2px;
}
.btn-submit:hover { background: var(--primary-light); }

.btn-export {
    background: none;
    border: 2px solid var(--primary);
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    cursor: pointer;
    font-size: 13px;
    color: var(--primary);
    font-weight: 700;
    transition: all 0.15s;
    margin-left: auto;
    white-space: nowrap;
}
.btn-export:hover { background: var(--primary); color: white; }

.btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    opacity: 0.5;
    transition: opacity 0.15s;
    padding: 4px 8px;
    border-radius: 4px;
}
.btn-delete:hover { opacity: 1; background: #FDECEA; }

/* ── FORM CARDS ── */
.form-card, .data-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 28px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
}

.form-card h3, .data-card h3 {
    font-size: 17px;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: 22px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.form-row {
    display: flex;
    gap: 16px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}

.form-group {
    flex: 1;
    min-width: 180px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group-wide { flex: 2; min-width: 280px; }

.form-group label {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.form-group input,
.form-group select,
.form-group textarea {
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px 12px;
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color 0.15s, box-shadow 0.15s;
    font-family: inherit;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(212, 133, 92, 0.18);
}

.form-group textarea { min-height: 82px; resize: vertical; }

.freeze-row { align-items: flex-end; }

.checkbox-group { flex: none; }

.checkbox-label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
    padding: 10px 0;
    user-select: none;
}

.checkbox-label input[type="checkbox"] {
    width: 20px;
    height: 20px;
    accent-color: var(--primary);
    cursor: pointer;
    flex-shrink: 0;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    padding-top: 10px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}

/* ── TABLES ── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

table { width: 100%; border-collapse: collapse; font-size: 14px; }

thead { background: var(--surface-alt); }

thead th {
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}

tbody tr { border-bottom: 1px solid var(--border); transition: background 0.1s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-alt); }
tbody td { padding: 12px 14px; vertical-align: middle; }

.temp {
    font-weight: 700;
    color: #1565C0;
    font-family: 'Courier New', monospace;
}

.empty-msg {
    text-align: center;
    color: var(--text-muted);
    padding: 40px;
    font-size: 15px;
    font-style: italic;
}

/* ── BADGES ── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
}
.badge-salado  { background: #E8F5E9; color: #2E7D32; }
.badge-dulce   { background: #FFF3E0; color: #E65100; }
.badge-otros   { background: #E3F2FD; color: #1565C0; }
.badge-si      { background: #EDE7F6; color: #512DA8; }

/* ── CONGELADORES GRID ── */
.congeladores-info {
    background: linear-gradient(135deg, #E3F2FD, #BBDEFB);
    border: 1px solid #90CAF9;
    border-radius: var(--radius-sm);
    padding: 14px 18px;
    margin-bottom: 20px;
    font-size: 14px;
    color: #1565C0;
    font-weight: 600;
}

/* ── IMPRIMIR ETIQUETAS ── */
.btn-print {
    background: none;
    border: 2px solid #1565C0;
    border-radius: var(--radius-sm);
    padding: 9px 18px;
    cursor: pointer;
    font-size: 13px;
    color: #1565C0;
    font-weight: 700;
    transition: all 0.15s;
    margin-left: auto;
    white-space: nowrap;
}
.btn-print:hover { background: #1565C0; color: white; }

.etiquetas-lista {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.etiqueta-preview-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--surface-alt);
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
}

.etiqueta-preview-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 3px;
    min-width: 0;
}

.etiqueta-preview-content strong {
    font-size: 15px;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.etiqueta-preview-content span {
    font-size: 12px;
    color: var(--text-muted);
}

.etiqueta-copias {
    background: var(--primary);
    color: white;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 700;
    white-space: nowrap;
    flex-shrink: 0;
}

.etiquetas-actions {
    display: flex;
    gap: 12px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}

.btn-print-big {
    background: #1565C0;
    color: white;
    border: none;
    border-radius: var(--radius-sm);
    padding: 13px 30px;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-print-big:hover { background: #1976D2; }

.btn-clear {
    background: none;
    border: 2px solid #C62828;
    border-radius: var(--radius-sm);
    padding: 11px 22px;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    color: #C62828;
    transition: all 0.15s;
}
.btn-clear:hover { background: #C62828; color: white; }

/* ── TOAST ── */
.toast {
    position: fixed;
    bottom: 28px;
    right: 28px;
    background: #2E7D32;
    color: white;
    padding: 14px 24px;
    border-radius: var(--radius-sm);
    font-size: 15px;
    font-weight: 600;
    box-shadow: 0 4px 20px rgba(0,0,0,0.25);
    transform: translateY(90px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(.4,0,.2,1);
    z-index: 9999;
    display: flex;
    align-items: center;
    gap: 8px;
}
.toast-show { transform: translateY(0); opacity: 1; }

/* ── RESPONSIVE ── */
@media (max-width: 640px) {
    main { padding: 20px 16px; }
    .branch-grid { grid-template-columns: 1fr; max-width: 340px; }
    .section-grid { grid-template-columns: repeat(2, 1fr); }
    .form-row { flex-direction: column; }
    .form-group { min-width: unset; }
    .btn-export { margin-left: 0; width: 100%; justify-content: center; }
    .section-header { gap: 10px; }
    .header-inner { padding: 12px 16px; }
    .breadcrumb { padding: 8px 16px; }
}
