:root {
    /* --- MIDNIGHT SLATE PALETTE --- */
    --brand-primary: #06df06;
    /* Neon Green - CediGrafic Brand */
    --brand-primary-dark: #05b905;
    --brand-accent: #3b82f6;
    /* Blue 500 */
    --brand-danger: #ef4444;

    /* BACKGROUND LAYERS (Deep Blue-Grey) */
    --bg-app: #0f172a;
    /* Midnight Slate */
    --bg-surface: #1e293b;
    /* Lighter Slate Panel */
    --bg-surface-hover: #334155;
    --bg-input: #020617;
    /* Deepest Slate */

    /* TEXT HIERARCHY */
    --text-main: #f8fafc;
    /* Slate 50 */
    --text-muted: #94a3b8;
    /* Slate 400 */
    --border-subtle: #334155;
    /* Slate 700 */

    /* --- MOTION & DEPTH --- */
    --ease-bounce: cubic-bezier(0.34, 1.56, 0.64, 1);
    --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(16, 185, 129, 0.4);
    /* Emerald Glow */
}

/* --- GLOBAL RESET & ANIMATIONS --- */
body {
    font-family: 'Inter', 'Segoe UI', system-ui, sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--bg-app);
    color: var(--text-main);
    height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes scaleIn {
    from {
        opacity: 0;
        transform: scale(0.9);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- TACTILE COMPONENTS --- */
button,
a {
    -webkit-tap-highlight-color: transparent;
}

.btn {
    padding: 12px 20px;
    border-radius: 12px;
    /* Modern Rounded */
    border: 1px solid transparent;
    cursor: pointer;
    font-weight: 600;
    letter-spacing: 0.5px;
    transition: all 0.2s var(--ease-smooth);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    position: relative;
    overflow: hidden;
}

/* Tactile Feedback */
.btn:active {
    transform: scale(0.95);
}

/* Primary Action (Neon) */
.btn-primary {
    background: var(--brand-primary);
    color: #000;
    /* Black text on neon green for max contrast */
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 15px rgba(0, 230, 118, 0.3);
    border: none;
}

.btn-primary:hover {
    background: #00ff80;
    /* Even brighter */
    box-shadow: 0 0 25px rgba(0, 230, 118, 0.5);
    transform: translateY(-2px);
}

.btn-primary:active {
    transform: translateY(0) scale(0.98);
}

/* Secondary/Ghost */
.btn-secondary {
    background: transparent;
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
}

.btn-secondary:hover {
    background: rgba(255, 255, 255, 0.05);
    color: white;
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- UTILITIES --- */
.hidden {
    display: none !important;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.justify-between {
    justify-content: space-between;
}

.gap-2 {
    gap: 0.5rem;
}

.gap-4 {
    gap: 1rem;
}

.mt-4 {
    margin-top: 1rem;
}

.w-full {
    width: 100%;
}

.text-center {
    text-align: center;
}

/* --- LOGIN PAGE --- */
body.login-body {
    background-color: var(--dash-bg);
    align-items: center;
    justify-content: center;
}

.login-card {
    background: var(--dash-card);
    width: 100%;
    max-width: 400px;
    padding: 40px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
    text-align: center;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.login-logo {
    font-size: 2rem;
    font-weight: bold;
    color: white;
    margin-bottom: 2rem;
}

.login-logo span {
    color: var(--brand-green);
}

.login-form input {
    width: 100%;
    padding: 12px 15px;
    margin-bottom: 15px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    color: white;
    font-size: 1rem;
    box-sizing: border-box;
}

.login-form input:focus {
    outline: none;
    border-color: var(--brand-green);
    background: rgba(255, 255, 255, 0.1);
}

/* --- DASHBOARD (HOME) --- */
body.dashboard-body {
    background-color: var(--dash-bg);
    color: var(--dash-text);
}

.dash-nav {
    display: flex;
    justify-content: space-between;
    padding: 20px 40px;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar {
    width: 45px;
    height: 45px;
    background: linear-gradient(135deg, #10b981, #3b82f6);
    border-radius: 14px;
    /* Squircle-ish */
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: white;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.1);
}

/* --- DASHBOARD COMPONENTS --- */
.dash-container {
    padding: 40px;
    max-width: 1400px;
    /* Generous width */
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
    animation: fadeInUp 0.6s var(--ease-smooth);
}

.dash-banner {
    background: linear-gradient(120deg, var(--bg-surface), #1e293b);
    border-radius: 20px;
    padding: 40px;
    border: 1px solid var(--border-subtle);
    box-shadow: 0 20px 40px -10px rgba(0, 0, 0, 0.3);
    margin-bottom: 40px;
    position: relative;
    overflow: hidden;
}

/* Subtle Shine Effect */
.dash-banner::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
}

/* App Cards Compact */
.apps-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    /* Slightly smaller cards */
    gap: 20px;
}

.app-card {
    background: var(--bg-surface);
    border: 1px solid var(--border-subtle);
    padding: 20px;
    border-radius: 12px;
    text-decoration: none;
    transition: all 0.3s var(--ease-bounce);
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    position: relative;
    overflow: hidden;
}

/* Staggered Entrance */
.app-card:nth-child(1) {
    animation-delay: 0.1s;
}

.app-card:nth-child(2) {
    animation-delay: 0.2s;
}

.app-card:nth-child(3) {
    animation-delay: 0.3s;
}

.app-card:nth-child(4) {
    animation-delay: 0.4s;
}

.app-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--shadow-glow);
    border-color: var(--brand-primary);
    background: var(--bg-surface-hover);
}

.app-icon {
    width: 45px;
    height: 45px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.05);
    /* Quick placeholder bg */
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    /* Smaller icons */
    color: var(--brand-primary);
    margin-bottom: 15px;
    transition: transform 0.3s;
}

.app-card:hover .app-icon {
    background: var(--brand-primary);
    color: #fff;
    transform: scale(1.1) rotate(-5deg);
}

.app-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 5px;
}

.app-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.5;
}

/* --- COTIZADOR LAYOUT (Original Styles Refactored) --- */
header.app-header {
    background-color: var(--brand-dark);
    color: white;
    padding: 0 20px;
    height: 60px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    z-index: 10;
}

.main-container {
    display: flex;
    flex: 1;
    overflow: hidden;
}

.left-panel {
    flex: 3;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
    padding: 20px;
    background: white;
    overflow-y: auto;
}

.top-forms {
    display: flex;
    gap: 20px;
    margin-bottom: 20px;
    background: var(--bg-color);
    padding: 15px;
    border-radius: 8px;
    border: 1px solid var(--border-color);
}

.client-form {
    flex: 2;
}

.conditions-form {
    flex: 1;
    border-left: 1px solid var(--border-color);
    padding-left: 20px;
}

.form-group {
    margin-bottom: 10px;
}

.form-group label {
    display: block;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 2px;
    font-weight: 600;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 8px;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    background: white;
    font-size: 0.9rem;
    box-sizing: border-box;
}

.product-table-container {
    flex: 1;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.product-header {
    display: grid;
    grid-template-columns: 3fr 1fr 1.5fr 1.5fr 40px;
    background: var(--brand-dark);
    color: white;
    padding: 10px;
    font-weight: 600;
    font-size: 0.9rem;
}

.product-rows {
    flex: 1;
    overflow-y: auto;
    background: white;
}

.p-row {
    display: grid;
    grid-template-columns: 3fr 1fr 1.5fr 1.5fr 40px;
    border-bottom: 1px solid var(--border-color);
    padding: 0;
    align-items: center;
}

.p-row:hover {
    background-color: #f9fafb;
}

.p-row.selected {
    background-color: var(--highlight);
    border-left: 4px solid var(--brand-green);
}

.p-row input {
    width: 100%;
    border: none;
    padding: 12px 10px;
    background: transparent;
    font-size: 0.95rem;
    outline: none;
    box-sizing: border-box;
}

.btn-add {
    background: var(--brand-green);
    color: white;
    border: none;
    padding: 10px;
    width: 100%;
    font-weight: bold;
    cursor: pointer;
}

.btn-add:hover {
    background: #2db32d;
}

.total-bar {
    text-align: right;
    padding: 15px;
    font-size: 1.2rem;
    font-weight: bold;
    color: var(--brand-green);
    border-top: 1px solid var(--border-color);
    background: #fdfdfd;
}

.right-panel {
    flex: 2;
    background: #f8fafc;
    padding: 20px;
    border-left: 1px solid var(--border-color);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
}

.panel-title {
    font-size: 1.1rem;
    font-weight: bold;
    margin-bottom: 20px;
    color: var(--brand-dark);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--brand-green);
    padding-bottom: 10px;
}

.detail-group {
    margin-bottom: 15px;
    background: white;
    padding: 15px;
    border-radius: 8px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
    border: 1px solid var(--border-color);
}

.detail-group label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: bold;
    color: var(--text-muted);
    margin-bottom: 5px;
}

.detail-group textarea {
    width: 100%;
    border: 1px solid #e5e7eb;
    border-radius: 4px;
    padding: 8px;
    font-size: 0.9rem;
    resize: vertical;
    min-height: 70px;
    box-sizing: border-box;
    font-family: inherit;
}

.detail-group textarea:focus {
    outline: none;
    border-color: var(--brand-green);
}

/* --- PRINT STYLES --- */
@media print {
    body {
        background: white;
        height: auto;
        overflow: visible;
        display: block;
    }

    .main-container,
    header,
    .login-body,
    .dashboard-body {
        display: none;
    }

    #quotation-sheet {
        display: block !important;
    }

    @page {
        margin: 0.5cm;
    }
}

#quotation-sheet {
    display: none;
    font-family: 'Arial', sans-serif;
    padding: 30px;
    max-width: 900px;
    margin: 0 auto;
    color: #333;
}

/* (Print styles abbreviated for brevity - they are mostly specific to structure) */
.q-header-top {
    display: flex;
    justify-content: space-between;
    margin-bottom: 5px;
}

.q-logo {
    font-size: 28px;
    font-weight: bold;
}

.q-logo span {
    color: var(--brand-green);
}

.q-slogan {
    font-style: italic;
    color: #666;
    font-size: 11px;
    margin-bottom: 8px;
}

.q-address {
    font-size: 10px;
    color: #444;
    line-height: 1.4;
}

.q-meta {
    text-align: right;
}

.q-meta-title {
    font-weight: bold;
    text-transform: uppercase;
    font-size: 14px;
}

.q-folio-val {
    color: #d32f2f;
    font-weight: bold;
}

.q-green-bar {
    height: 4px;
    background-color: var(--brand-green);
    width: 100%;
    margin: 15px 0;
}

.q-client-box {
    background-color: #f5f5f5;
    padding: 15px;
    border-left: 5px solid var(--brand-green);
    margin-bottom: 30px;
}

.q-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 30px;
}

.q-table th {
    background-color: #1a1a1a;
    color: white;
    padding: 12px;
    font-size: 11px;
    text-align: left;
}

.q-table td {
    border-bottom: 1px solid #eee;
    padding: 15px;
    vertical-align: top;
}

.q-footer-layout {
    display: flex;
    justify-content: space-between;
    margin-top: 20px;
    border-top: 1px solid #ccc;
    padding-top: 20px;
}

.q-terms {
    width: 55%;
    font-size: 9px;
}

.q-totals {
    width: 35%;
}

.q-grand-total {
    background-color: var(--brand-green);
    color: white;
    padding: 10px;
    font-weight: bold;
    display: flex;
    justify-content: space-between;
    border-radius: 4px;
}