/* ============================================
   VIDRIOS - Optimizador de Cortes v2 PRO
   Industrial Square UI - High-End Presentation
   ============================================ */

   :root {
    --bg: #ecf2f8;
    --surface: #ffffff;
    --surface-alt: #f7fafc;
    --border: #bfd0e0;
    --border-light: #dde7f0;
    --text: #0f172a;
    --text-muted: #44556b;
    --text-light: #7f93a9;

    /* Industrial Theme Accents */
    --accent: #0f6bff;
    --accent-hover: #0a57d1;
    --accent-dark: #0a1f44;

    --danger: #d72638;
    --danger-bg: #fff2f4;
    --header-bg: #08101e;
    --header-border: #1f3f78;

    --row-hover: #f4f8fd;
    --row-alt: #ffffff;

    --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.08);
    --shadow-md: 0 10px 24px rgba(15, 23, 42, 0.08);
    --shadow-lg: 0 18px 40px rgba(15, 23, 42, 0.14);

    /* Keep the industrial geometry */
    --radius: 0px;
}

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

body {
    font-family: 'Inter', 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background:
        radial-gradient(circle at 10% -10%, rgba(15, 107, 255, 0.14), transparent 34%),
        radial-gradient(circle at 90% 110%, rgba(10, 31, 68, 0.12), transparent 28%),
        var(--bg);
    color: var(--text);
    min-height: 100vh;
    overflow-x: hidden;
    font-size: 14px;
}

/* Scrollbar */
::-webkit-scrollbar { width:6px; height:6px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 0; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ═══════════ HEADER ═══════════ */
.app-header {
    background: var(--header-bg);
    color: #fff;
    padding: 12px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 1000;
    border-bottom: 1px solid var(--header-border);
    box-shadow: 0 6px 20px rgba(2, 6, 23, 0.35);
    background-image: linear-gradient(90deg, rgba(15, 107, 255, 0.12), transparent 42%);
}

.app-header h1 {
    font-size: 1.3rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    gap: 12px;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.header-context {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    padding: 3px 8px;
    border: 1px solid rgba(255, 255, 255, 0.25);
    color: #dbe7ff;
    background: rgba(15, 107, 255, 0.18);
}

.logo-icon {
    color: var(--accent);
    font-size: 1.2rem;
}

.license-badge {
    font-size: 0.65rem;
    padding: 2px 8px;
    border: 1px solid currentColor;
    border-radius: var(--radius);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}
.license-badge.free { color: #f59e0b; border-color: #f59e0b; background: rgba(245,158,11,0.1); }
.license-badge.pro { color: #10b981; border-color: #10b981; background: rgba(16,185,129,0.1); box-shadow: 0 0 10px rgba(16,185,129,0.3); }

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.project-input {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1px solid rgba(255,255,255,0.2);
    padding: 6px 12px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    transition: all 0.2s;
}
.project-input:focus { border-color: var(--accent); outline: none; background: rgba(255,255,255,0.15); }
.project-input::placeholder { color: rgba(255,255,255,0.5); }

.btn-header, .btn-save, .btn-reset {
    background: transparent;
    color: #fff;
    border: 1px solid var(--border-light);
    padding: 6px 14px;
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    text-transform: uppercase;
    letter-spacing: 0.02em;
}
.btn-header:hover, .btn-save:hover { background: rgba(255,255,255,0.1); border-color: #fff; }
.btn-reset { border-color: rgba(239,68,68,0.5); color: #fca5a5; }
.btn-reset:hover { background: rgba(239,68,68,0.1); border-color: var(--danger); color: #fff; }

.btn-optimize-header {
    background: var(--accent);
    color: #fff;
    border: none;
    padding: 8px 24px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    cursor: pointer;
    transition: all 0.2s;
    box-shadow: 0 4px 0 var(--accent-hover);
}
.btn-optimize-header:hover {
    transform: translateY(2px);
    box-shadow: 0 2px 0 var(--accent-hover);
}
.btn-optimize-header:active {
    transform: translateY(4px);
    box-shadow: none;
}

/* ═══════════ LAYOUT ═══════════ */
.app-layout {
    display: flex;
    min-height: calc(100vh - 60px);
    gap: 18px;
    padding: 18px;
}

/* ═══════════ PANEL IZQUIERDO ═══════════ */
.panel-left {
    width: 440px;
    min-width: 440px;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow-y: auto;
    height: calc(100vh - 96px);
    position: sticky;
    top: 78px;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-md);
    z-index: 90;
}

/* ═══════════ SECCIONES DE DATOS ═══════════ */
.data-section {
    border-bottom: 2px solid var(--border-light);
}

.section-title {
    background: linear-gradient(90deg, rgba(15, 107, 255, 0.06), transparent 40%), var(--surface);
    padding: 14px 20px;
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    gap: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    border-left: 4px solid var(--accent);
}

.section-icon { font-size: 1.1rem; }

.section-count {
    margin-left: auto;
    background: var(--border-light);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--radius);
}

.paste-hint {
    background: #e0f2fe;
    border-bottom: 1px solid #bae6fd;
    padding: 8px 20px;
    font-size: 0.75rem;
    color: #0369a1;
    font-weight: 500;
}

/* ═══════════ TABLA TIPO HOJA DE CALCULO ═══════════ */
.sheet-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.sheet-table thead th {
    background: var(--bg);
    padding: 10px 12px;
    text-align: left;
    font-weight: 600;
    font-size: 0.75rem;
    color: var(--text-muted);
    border-top: 1px solid var(--border-light);
    border-bottom: 1px solid var(--border);
    text-transform: uppercase;
    letter-spacing: 0.02em;
}

.sheet-table tbody tr {
    border-bottom: 1px solid var(--border-light);
}
.sheet-table tbody tr:hover {
    background: var(--row-hover);
}
.sheet-table tbody tr.is-hover-sync {
    background: #e9f2ff;
    box-shadow: inset 3px 0 0 var(--accent);
}

.sheet-table td {
    padding: 10px 12px;
    vertical-align: middle;
    font-family: inherit;
    color: var(--text);
    font-weight: 500;
}

.sheet-table .col-actions {
    width: 80px;
    text-align: right;
    padding-right: 16px;
}

.inline-edit {
    width: 100%;
    max-width: 65px;
    padding: 4px 6px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.85rem;
    font-family: inherit;
    box-sizing: border-box;
}

.inline-edit:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 1px var(--accent);
}

.row-btn {
    background: transparent;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: var(--radius);
    font-size: 0.9rem;
    transition: all 0.2s;
}
.row-btn-edit { color: var(--accent); }
.row-btn-edit:hover { background: #eff6ff; border-color: #bfdbfe; }
.row-btn-del { color: var(--danger); }
.row-btn-del:hover { background: #fef2f2; border-color: #fca5a5; }

/* Ingress Form */
.sheet-table tfoot tr.input-row td {
    padding: 12px 10px;
    background: var(--bg);
    border-top: 1px solid var(--border);
}

.sheet-table tfoot input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    font-weight: 600;
}
.sheet-table tfoot input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(15, 107, 255, 0.15);
    background: #fff;
}

.btn-add {
    width: 100%;
    padding: 8px;
    background: var(--accent-dark);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
}
.btn-add:hover { background: var(--accent); }

.empty-msg {
    text-align: center;
    color: var(--text-light);
    padding: 24px;
    font-size: 0.85rem;
    background: var(--surface);
}

/* ═══════════ OPCIONES ═══════════ */
.option-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface);
}
.option-row label {
    font-size: 0.85rem;
    color: var(--text);
    font-weight: 500;
}
.option-input {
    width: 90px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.9rem;
    text-align: right;
    font-family: inherit;
    font-weight: 600;
    transition: all 0.2s;
}
.option-input:focus { outline: none; border-color: var(--accent); }

/* ═══════════ PROYECTO ═══════════ */
.project-list { padding: 0; background: var(--surface); }
.project-row {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border-light);
    background: var(--surface);
}

.project-row .project-input {
    flex: 1;
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
}

.project-row .project-input::placeholder {
    color: var(--text-light);
}

.project-row .project-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 1px rgba(15, 107, 255, 0.2);
    background: #fff;
}

.project-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 20px;
    border-bottom: 1px solid var(--border-light);
    font-size: 0.85rem;
}
.project-item:hover { background: var(--row-hover); }
.project-name { font-weight: 600; cursor: pointer; color: var(--accent-dark); }
.project-name:hover { color: var(--accent); text-decoration: underline; }
.project-date { color: var(--text-light); font-size: 0.75rem; }

/* ═══════════ PANEL CENTRAL ═══════════ */
.panel-center {
    flex: 1;
    padding: 6px 8px;
    display: flex;
    flex-direction: column;
    gap: 24px;
    overflow-y: auto;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-top: 3px solid var(--accent-dark);
    border-radius: var(--radius);
    padding: 16px 20px;
    box-shadow: var(--shadow-sm);
    background-image: linear-gradient(180deg, rgba(15, 107, 255, 0.03), transparent 55%);
}

.stat-card.stat-eff { border-top-color: var(--accent); }
.stat-card.stat-waste { border-top-color: #f59e0b; }

.stat-label {
    font-size: 0.75rem;
    text-transform: uppercase;
    color: var(--text-muted);
    font-weight: 700;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}

.stat-value {
    font-size: 1.8rem;
    font-weight: 800;
    color: var(--text);
    letter-spacing: -0.02em;
}

/* Diagrams */
.diagrams-container {
    display: flex;
    flex-direction: column;
    gap: 32px;
}

.no-results {
    text-align: center;
    padding: 80px 40px;
    color: var(--text-muted);
    background: var(--surface);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.no-results-icon { font-size: 3.5rem; color: var(--border); margin-bottom: 16px; }
.no-results p { font-size: 1.1rem; font-weight: 600; color: var(--text); }
.no-results-sub { font-size: 0.85rem; color: var(--text-muted); margin-top: 8px; }

/* ═══════════ SHEET CARD (per lamina) ═══════════ */
.sheet-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-md);
}

.sheet-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    background: linear-gradient(90deg, rgba(15, 107, 255, 0.07), transparent 42%), var(--surface-alt);
    border-bottom: 1px solid var(--border);
}

.sheet-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    gap: 12px;
}

.sheet-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--accent-dark);
    color: #fff;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 800;
}

.sheet-dims {
    font-weight: 500;
    color: var(--text-muted);
    font-size: 0.9rem;
    background: var(--surface);
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.sheet-card-stats {
    display: flex;
    gap: 20px;
    font-size: 0.85rem;
    color: var(--text-muted);
}
.sheet-stat {
    background: var(--surface);
    padding: 6px 12px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
}
.sheet-stat strong { font-weight: 800; color: var(--text); }

.sheet-card-body {
    display: flex;
    gap: 0;
}

.sheet-canvas-wrap {
    flex: 1;
    padding: 24px;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow-x: auto;
    background: #f9fcff;
}
.sheet-canvas-wrap canvas {
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

/* ═══════════ GLOBAL REPORT HEADER ═══════════ */
.report-header {
    background: #ffffff;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 20px 24px;
    margin-bottom: 24px;
    box-shadow: var(--shadow-sm);
    color: var(--text);
    position: relative;
    overflow: hidden;
}
.report-header::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 4px;
    background: linear-gradient(90deg, var(--accent), var(--accent-light));
}
.report-header-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 20px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-light);
}
.report-brand {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--accent-dark);
    display: flex;
    align-items: center;
    gap: 10px;
}
.report-brand-icon {
    color: var(--accent);
}
.report-date {
    font-size: 0.9rem;
    color: var(--text-muted);
    font-weight: 500;
}
.report-summary-bar {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 16px;
}
.report-kpi {
    background: var(--bg);
    padding: 12px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--border-light);
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.report-kpi-wide {
    grid-column: span 2;
}
.report-kpi-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    font-weight: 700;
    letter-spacing: 0.05em;
}
.report-kpi-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--text);
    font-family: 'JetBrains Mono', monospace, sans-serif;
}
.report-kpi-small {
    font-size: 1rem;
    color: var(--accent-dark);
}
.kpi-good { color: #10b981; }
.kpi-warn { color: #f59e0b; }
.kpi-waste { color: #ef4444; }

@media (max-width: 1280px) {
    .app-layout {
        gap: 14px;
        padding: 14px;
    }
    .panel-left {
        width: 390px;
        min-width: 390px;
    }
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 980px) {
    .app-header {
        padding: 10px 14px;
    }
    .app-header h1 {
        font-size: 1rem;
        gap: 8px;
    }
    .header-actions {
        gap: 6px;
    }
    .app-layout {
        display: block;
        padding: 10px;
    }
    .panel-left,
    .panel-center {
        width: 100%;
        min-width: 0;
        position: static;
        top: auto;
        height: auto;
    }
    .panel-left {
        margin-bottom: 10px;
        max-height: 54vh;
    }
    .panel-center {
        padding: 2px;
    }
    .stats-bar {
        grid-template-columns: 1fr;
        gap: 10px;
    }
}

/* ═══════════ SIDE PANEL (cut list) ═══════════ */
.sheet-side-panel {
    width: 300px;
    min-width: 300px;
    border-left: 1px solid var(--border);
    background: var(--surface);
    display: flex;
    flex-direction: column;
}

.side-section {
    border-bottom: 1px solid var(--border-light);
    padding: 16px;
}

.side-section-title {
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    font-weight: 800;
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.side-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}
.side-table th {
    padding: 6px 8px;
    text-align: left;
    font-weight: 700;
    color: var(--text-light);
    text-transform: uppercase;
    border-bottom: 2px solid var(--border-light);
}
.side-table td {
    padding: 8px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
}
.pieces-summary tr.is-highlight {
    background: #eef5ff;
}

.color-dot {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 0; /* Square */
    border: 1px solid rgba(0,0,0,0.2);
    vertical-align: middle;
}

.dim-cell { font-family: 'JetBrains Mono', monospace; font-weight: 600; color: var(--text); }
.qty-cell { text-align: center; font-weight: 800; color: var(--accent-dark); }
.cut-num { text-align: center; font-weight: 700; color: var(--text-light); font-size: 0.75rem; }
.cut-pos { font-family: 'JetBrains Mono', monospace; font-size: 0.75rem; color: var(--text-muted); }

.side-area-info {
    font-family: 'JetBrains Mono', monospace;
    background: var(--bg);
}
.area-row {
    display: flex;
    justify-content: space-between;
    padding: 4px 0;
    font-size: 0.8rem;
}
.area-row strong { color: var(--text); }

/* Report Header */
.report-header {
    border: 1px solid var(--border);
    background: linear-gradient(120deg, #ffffff, #f5f9ff 55%, #eef5ff);
    box-shadow: var(--shadow-sm);
    margin-bottom: 8px;
}

.report-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px 12px;
    border-bottom: 1px solid var(--border-light);
}

.report-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--accent-dark);
}

.report-brand-icon {
    color: var(--accent);
    font-size: 1rem;
}

.report-date {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 600;
}

.report-summary-bar {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 8px;
    padding: 12px;
}

.report-kpi {
    background: #fff;
    border: 1px solid var(--border-light);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.report-kpi-wide {
    grid-column: span 2;
}

.report-kpi-value {
    color: var(--accent-dark);
    font-size: 1.15rem;
    line-height: 1.1;
    font-weight: 800;
    letter-spacing: -0.01em;
}

.report-kpi-small {
    font-size: 0.9rem;
    font-weight: 700;
    letter-spacing: 0;
}

.report-kpi-label {
    color: var(--text-light);
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    font-weight: 700;
}

.kpi-good { color: #0f9f6e; }
.kpi-warn { color: #e08000; }
.kpi-waste { color: #cf334f; }

/* Warning */
.unplaced-warning {
    background: linear-gradient(90deg, rgba(215, 38, 56, 0.07), rgba(215, 38, 56, 0.03));
    border: 1px solid rgba(215, 38, 56, 0.35);
    border-left: 4px solid var(--danger);
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 14px;
    color: #8f1730;
    box-shadow: var(--shadow-sm);
}
.unplaced-warning h3 {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    color: #b11f39;
    letter-spacing: 0.01em;
}
.unplaced-warning ul {
    margin: 0;
    padding-left: 20px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 6px 18px;
    font-weight: 600;
    font-family: 'JetBrains Mono', monospace;
    font-size: 0.84rem;
}
.unplaced-warning li {
    background: rgba(255, 255, 255, 0.6);
    border: 1px solid rgba(215, 38, 56, 0.25);
    padding: 5px 8px;
}

/* Color Legend */
#color-legend {
    display: flex;
    gap: 8px;
    margin-bottom: 14px;
    flex-wrap: wrap;
    font-size: 0.82rem;
    align-items: center;
    font-weight: 600;
    border: 1px solid var(--border-light);
    background: #fff;
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
}

#color-legend strong {
    color: var(--accent-dark);
    margin-right: 2px;
}

.legend-item {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 8px;
    border: 1px solid var(--border-light);
    background: #f9fbff;
    color: #1e2f4a;
    font-weight: 700;
}
.legend-item.is-active {
    border-color: var(--accent);
    background: #e9f2ff;
    color: var(--accent-dark);
    box-shadow: inset 0 0 0 1px rgba(15, 107, 255, 0.25);
}

.legend-color {
    width: 10px;
    height: 18px;
    display: inline-block;
}

.usage-pill {
    font-size: 0.72rem;
    font-weight: 700;
    color: #dbeafe;
    border: 1px solid rgba(148, 163, 184, 0.45);
    padding: 5px 8px;
    background: rgba(15, 23, 42, 0.35);
    min-width: 150px;
    text-align: center;
}

.auth-modal {
    position: fixed;
    inset: 0;
    background: rgba(2, 6, 23, 0.62);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.auth-card {
    width: 100%;
    max-width: 440px;
    background: #fff;
    box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1), 0 8px 10px -6px rgb(0 0 0 / 0.1);
    padding: 32px;
    border: 1px solid var(--border);
    position: relative;
}

.auth-card h3 {
    margin-bottom: 8px;
    color: var(--accent-dark);
    font-size: 1.5rem;
    font-weight: 800;
}

.auth-card p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-size: 0.95rem;
    line-height: 1.5;
}

.auth-actions {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-divider {
    margin: 24px 0;
    display: flex;
    align-items: center;
    text-align: center;
    color: var(--text-light);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    border-bottom: 1px solid var(--border-light);
}

.auth-divider::before { margin-right: 12px; }
.auth-divider::after { margin-left: 12px; }

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

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

.auth-input-label {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.auth-input {
    background: #f8fafc;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 12px 16px;
    font-size: 1rem;
    transition: all 0.2s ease;
    width: 100%;
}

.auth-input:focus {
    background: #fff;
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 4px rgba(15, 107, 255, 0.1);
}

.auth-btn-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 8px;
}

.btn-primary {
    background: var(--accent-dark);
    color: #fff;
    border: none;
    padding: 14px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
}

.btn-primary:hover {
    background: var(--text);
    transform: translateY(-1px);
}

.btn-secondary {
    background: #fff;
    color: var(--text-muted);
    border: 1px solid var(--border);
    padding: 14px;
    font-weight: 700;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    transition: all 0.2s;
}

.btn-secondary:hover {
    background: #f8fafc;
    border-color: var(--text-light);
}

.auth-hint {
    margin-top: 16px;
    min-height: 20px;
    font-size: 0.85rem;
    font-weight: 500;
    text-align: center;
}

.auth-hint.error { color: var(--danger); }
.auth-hint.success { color: #059669; }

.auth-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: none;
    border: none;
    font-size: 1.5rem;
    color: var(--text-light);
    cursor: pointer;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s;
}

.auth-close-btn:hover {
    color: var(--danger);
}

.auth-input {
    background: #fff;
    color: var(--text);
    border: 1px solid var(--border);
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: 0.95rem;
    transition: all 0.2s;
    width: 100%;
}
.auth-input:focus {
    border-color: var(--accent);
    outline: none;
    box-shadow: 0 0 0 3px rgba(15, 107, 255, 0.1);
}

.auth-hint {
    min-height: 18px;
    font-size: 0.78rem;
}

.auth-google {
    background: #ffffff;
    color: #3c4043;
    border: 1px solid #dadce0;
    font-weight: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    width: 100%;
}
.auth-google:hover {
    background: #f8f9fa;
    box-shadow: 0 1px 2px rgba(60,64,67,0.3);
    border-color: #d2e3fc;
}
.google-icon {
    width: 18px;
    height: 18px;
}

.auth-close {
    margin-top: 10px;
}

.plan-box {
    border: 1px solid var(--border);
    background: #f8fbff;
    padding: 12px;
    margin-bottom: 8px;
}

.plan-price {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--accent-dark);
}

.plan-price-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
}

/* PDF View */
.print-view { display: none; }
@media print {
    body { background: #fff; padding: 0; }
    .app-header, .panel-left, #paywall-overlay { display: none !important; }
    .panel-center { padding: 0; overflow: visible; }
    .diagrams-container { gap: 40px; }
    .sheet-card { page-break-inside: avoid; border: 1px solid #000; box-shadow: none; margin-bottom: 20px; }
    .sheet-card-header { background: #f0f0f0; border-bottom: 1px solid #000; }
    .sheet-canvas-wrap { background: #fff; }
    .sheet-side-panel { border-left: 1px solid #000; }
}

@media (max-width: 980px) {
    .report-header-top {
        flex-direction: column;
        align-items: flex-start;
    }
    .report-summary-bar {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .report-kpi-wide {
        grid-column: span 2;
    }
}
