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

body {
    font-family: 'Nunito', 'Quicksand', 'Rounded Mplus 1c', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif !important;
    background: #ffffff;
    min-height: 100vh;
    color: #1d1d1f;
    line-height: 1.65;
    font-size: 19px !important;
    font-weight: 600 !important;
    letter-spacing: 0.3px;
    transition: background-color 0.3s ease, color 0.3s ease;
}

/* Dark Theme */
body.dark-theme {
    background: #1a1a1a;
    color: #e0e0e0;
}

body.dark-theme .container {
    background: #1a1a1a;
}

body.dark-theme .card {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-theme .header {
    background: #1a1a1a;
    border-bottom-color: #404040;
}

body.dark-theme .user-info {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-theme input,
body.dark-theme select {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-theme input:focus,
body.dark-theme select:focus {
    border-color: #007bff;
    background: #333;
}

body.dark-theme .modal-content {
    background: #2d2d2d;
    color: #e0e0e0;
}

body.dark-theme .section-title {
    background: linear-gradient(135deg, #ff6b9d 0%, #e94560 100%);
}

body.dark-theme .imposition-preview-top {
    background: #252525;
}

body.dark-theme .processing-grid {
    background: #252525;
}

body.dark-theme .processing-grid label {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-theme .calculate-compact {
    background: #252525;
}

body.dark-theme .cost-row {
    background: #252525;
    border-left-color: #007bff;
}

body.dark-theme .cost-summary-bar {
    background: linear-gradient(135deg, #252525 0%, #2d2d2d 100%);
}

body.dark-theme .summary-bar-item {
    background: #2d2d2d;
}

body.dark-theme .sub-tab {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-theme .sub-tab.active {
    background: #e94560;
    color: white;
}

body.dark-theme .table-wrapper {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-theme table {
    color: #e0e0e0;
}

body.dark-theme table th {
    background: #252525;
    color: #e0e0e0;
}

body.dark-theme table td {
    border-color: #404040;
}

body.dark-theme .btn-quick-size {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-theme .btn-quick-size:hover {
    background: #3d3d3d;
}

body.dark-theme .summary-card {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-theme .summary-card.summary-yellow {
    background: linear-gradient(135deg, #4a4a2a 0%, #5a5a3a 100%);
}

body.dark-theme .summary-card.summary-green {
    background: linear-gradient(135deg, #2a4a2a 0%, #3a5a3a 100%);
}

body.dark-theme .summary-card.summary-blue {
    background: linear-gradient(135deg, #2a2a4a 0%, #3a3a5a 100%);
}

body.dark-theme .extra-costs-compact {
    background: #252525;
    border-color: #404040;
}

body.dark-theme .extra-cost-item {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

body.dark-theme .imposition-settings-horizontal {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-theme .setting-card {
    background: #2d2d2d;
    border-color: #404040;
}

body.dark-theme .setting-card-header {
    border-bottom-color: #404040;
}

body.dark-theme .history-controls input {
    background: #2d2d2d;
    border-color: #404040;
    color: #e0e0e0;
}

.container {
    max-width: 1000px;
    margin: 0 auto;
    padding: 40px 40px;
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(5px);
}

.modal-content {
    background: #ffffff;
    padding: 35px;
    border-radius: 20px;
    width: 100%;
    max-width: 380px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.15);
    text-align: center;
}

.modal-logo {
    height: 55px;
    margin-bottom: 20px;
    object-fit: contain;
}

.modal-content h2 {
    color: #e94560;
    margin-bottom: 25px;
    font-size: 1.5rem;
    font-weight: 700;
}

.modal-content .form-group {
    text-align: left;
    margin-bottom: 15px;
}

.modal-link {
    margin-top: 20px;
    font-size: 0.9rem;
    color: #888;
}

.modal-link a {
    color: #e94560;
    text-decoration: none;
    font-weight: 600;
}

.modal-link a:hover {
    text-decoration: underline;
}

/* Header */
.header {
    text-align: center;
    padding: 30px 0;
    background: transparent;
    margin-bottom: 40px;
    border-bottom: 1px solid #e5e5e5;
}

.header-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    background: transparent;
}

.logo {
    height: 80px;
    width: auto;
    object-fit: contain;
    background: transparent;
    mix-blend-mode: multiply;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.logo:hover {
    transform: scale(1.05);
}

.user-info {
    display: flex;
    align-items: center;
    gap: 12px;
    background: #fff;
    padding: 8px 16px;
    border-radius: 25px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    font-size: 0.85rem;
}

.btn-manage-users {
    padding: 6px 14px;
    background: #e8f5e9;
    border: 1px solid #a5d6a7;
    border-radius: 20px;
    color: #2e7d32;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s;
    margin-right: 8px;
}

.btn-manage-users:hover {
    background: #2e7d32;
    color: #fff;
}

.btn-theme-toggle {
    padding: 6px 14px;
    background: #fff8e1;
    border: 1px solid #ffd54f;
    border-radius: 20px;
    color: #f57c00;
    cursor: pointer;
    font-size: 0.9rem;
    font-weight: 600;
    transition: all 0.3s;
    margin-right: 8px;
    display: inline-block !important;
    visibility: visible !important;
}

.btn-theme-toggle:hover {
    background: #ffd54f;
    color: #e65100;
    transform: scale(1.05);
}

body.dark-theme .btn-theme-toggle {
    background: #424242;
    border-color: #616161;
    color: #ffd54f;
}

body.dark-theme .btn-theme-toggle:hover {
    background: #616161;
    color: #ffd54f;
}

.btn-mobile-view {
    padding: 6px 14px;
    background: #e3f2fd;
    border: 1px solid #90caf9;
    border-radius: 20px;
    color: #1976d2;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s;
    margin-right: 8px;
    display: inline-block !important;
    visibility: visible !important;
}

.btn-mobile-view:hover {
    background: #1976d2;
    color: #fff;
    transform: scale(1.05);
}

.btn-logout {
    padding: 6px 14px;
    background: #fff0f0;
    border: 1px solid #ffcdd2;
    border-radius: 20px;
    color: #e94560;
    cursor: pointer;
    font-size: 0.8rem;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-logout:hover {
    background: #e94560;
    color: #fff;
}

.header h1 {
    font-size: 1.8rem;
    font-weight: 800;
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin: 10px 0;
    transition: transform 0.2s ease;
    cursor: pointer;
}

.header h1:hover {
    transform: scale(1.02);
}

/* Tabs */
.tabs {
    display: flex;
    gap: 8px;
    margin-bottom: 32px;
    justify-content: center;
    flex-wrap: wrap;
}

.main-tabs {
    background: #f5f5f7;
    padding: 4px;
    border-radius: 10px;
}

.admin-tabs {
    background: #f0f0f0;
    padding: 6px;
    border-radius: 12px;
}

.tab {
    padding: 10px 20px;
    border: none;
    background: transparent;
    color: #1d1d1f;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    font-weight: 500;
    transition: all 0.2s ease;
    font-family: 'Nunito', sans-serif;
}

.tab:hover {
    color: #0071e3;
}

.tab.active {
    background: #ffffff;
    color: #0071e3;
    font-weight: 600;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    box-shadow: 0 4px 15px rgba(233, 69, 96, 0.3);
}

.tab.hidden {
    display: none;
}

/* Tab Content */
.tab-content {
    display: none;
    max-width: 100%;
    overflow-x: hidden;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
    max-width: 100%;
    overflow-x: hidden;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Card */
.card {
    background: #ffffff;
    border-radius: 12px;
    padding: 40px 60px;
    margin-bottom: 24px;
    border: 1px solid #e5e5e5;
    transition: box-shadow 0.2s ease;
    max-width: 100%;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

.card h2 {
    font-size: 1.5rem;
    margin-bottom: 24px;
    color: #1d1d1f;
    font-weight: 700;
    letter-spacing: -0.5px;
}

.hint {
    color: #888;
    font-size: 0.85rem;
    margin-bottom: 15px;
}

/* ===== COMPACT FORM LAYOUT ===== */
.compact-card {
    padding: 40px 60px !important;
}

/* Section Title */
.section-title {
    font-size: 1.25rem;
    font-weight: 900;
    color: #e94560;
    margin: 0 0 12px 0;
    padding: 12px 16px;
    background: linear-gradient(135deg, #fff5f7, #ffe4e9);
    border-radius: 10px;
    border-left: 4px solid #e94560;
}

.compact-form {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.compact-form .form-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
}

.compact-form .form-row.single {
    grid-template-columns: 1fr;
}

.compact-form .form-row.two-cols {
    grid-template-columns: repeat(2, 1fr);
}

.compact-form .form-group {
    margin: 0;
}

.compact-form .form-group.full {
    max-width: 200px;
}

.compact-form .form-group.full-width {
    grid-column: 1 / -1;
}

/* Checkbox Group cho Gia công */
.checkbox-group {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.checkbox-group label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: linear-gradient(135deg, #f8f9fa, #f0f1f3);
    border: 2px solid #e5e5e5;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: all 0.2s ease;
    margin: 0;
}

.checkbox-group label:hover {
    border-color: #e94560;
    background: linear-gradient(135deg, #fff5f7, #ffe8ec);
}

.checkbox-group input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #e94560;
    cursor: pointer;
}

.checkbox-group input[type="checkbox"]:checked + span {
    color: #e94560;
    font-weight: 600;
}

.checkbox-group label:has(input:checked) {
    border-color: #e94560;
    background: #fff0f3;
}

.compact-form .form-group label {
    font-size: 0.9rem;
    margin-bottom: 4px;
    color: #333;
    font-weight: 800;
}

.compact-form .form-group input,
.compact-form .form-group select {
    padding: 12px 15px;
    font-size: 1.05rem;
    border-radius: 8px;
    background: linear-gradient(135deg, #f8f9fa, #f0f1f3);
    border: 2px solid #e5e5e5;
}

.compact-form .form-group input:focus,
.compact-form .form-group select:focus {
    background: #fff;
    border-color: #e94560;
}

/* Imposition Preview - Phía trên - KHỔ NGANG KHÔNG BỊ TRÀN */
.imposition-preview-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 15px;
    padding: 15px;
    background: linear-gradient(135deg, #fff 0%, #f8f9fa 100%);
    border: 2px solid #667eea;
    border-radius: 12px;
    margin-bottom: 15px;
    box-shadow: 0 3px 10px rgba(102, 126, 234, 0.15);
    overflow: hidden;
    max-width: 100%;
}

.imposition-preview-top .imposition-sheet {
    width: 140px;
    height: 170px;
    background: linear-gradient(135deg, #fff 0%, #f0f7ff 100%);
    padding: 12px;
    border-radius: 10px;
    border: 2px solid #667eea;
    position: relative;
    flex-shrink: 0;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.2);
}

.imposition-preview-top .imposition-info {
    display: flex;
    flex-direction: row;
    gap: 12px;
    flex-shrink: 1;
    min-width: 0;
}

.imposition-preview-top .imposition-info .info-item {
    text-align: center;
    color: #2d3748;
    background: #ffffff;
    padding: 12px 14px;
    border-radius: 10px;
    border: 2px solid #e2e8f0;
    flex: 1;
    min-width: 0;
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.imposition-preview-top .imposition-info .info-value {
    display: block;
    font-size: 2rem;
    font-weight: 900;
    line-height: 1.1;
    color: #2d3748;
    text-shadow: none;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.imposition-preview-top .imposition-info .info-label {
    font-size: 0.85rem;
    color: #2d3748;
    font-weight: 800;
    margin-top: 4px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Settings ngang */
.imposition-settings-horizontal {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    flex: 1;
    justify-content: flex-end;
}

.imposition-settings-horizontal .imp-setting {
    display: flex;
    align-items: center;
    gap: 6px;
    background: #f8f9fa;
    padding: 8px 12px;
    border-radius: 8px;
    border: 1px solid #e0e0e0;
}

.imposition-settings-horizontal .imp-setting label {
    color: #333;
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap;
}

.imposition-settings-horizontal .imp-setting input {
    width: 50px;
    padding: 5px 8px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    color: #333;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    font-family: 'Nunito', sans-serif;
}

.imposition-settings-horizontal .imp-setting input:focus {
    outline: none;
    border-color: #e94560;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.1);
}

.imposition-settings-horizontal .imp-setting span {
    color: #888;
    font-size: 0.75rem;
    font-weight: 600;
}

/* Form Sections (giữ lại cho các tab khác) */
.form-sections-container {
    display: none !important;
}

.form-section {
    display: none !important;
}

.form-section h3 {
    font-size: 0.9rem;
    font-weight: 700;
    margin-bottom: 15px;
    letter-spacing: 0.3px;
}

.form-grid-inner {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

/* Section Colors - Light Theme */
/* Disabled colored sections - using compact form instead */
.section-blue,
.section-pink,
.section-green {
    display: none !important;
}

.grid-span-2 {
    grid-column: span 2;
}

/* Responsive cho compact form */
@media (max-width: 768px) {
    .imposition-preview-top {
        flex-direction: column;
        gap: 12px;
        padding: 12px;
    }
    
    .imposition-preview-top .imposition-sheet {
        width: 110px;
        height: 140px;
        padding: 8px;
    }
    
    .sheet-grid {
        gap: 1px;
        padding: 12px 4px 4px;
    }
    
    .sheet-grid .grid-item {
        min-height: 6px;
        min-width: 6px;
        max-width: 8px;
        max-height: 8px;
    }
    
    .imposition-preview-top .imposition-info {
        flex-direction: row;
        gap: 10px;
        width: 100%;
    }
    
    .imposition-preview-top .imposition-info .info-value {
        font-size: 1.8rem;
        font-weight: 900;
        color: #2d3748;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .imposition-preview-top .imposition-info .info-label {
        font-size: 0.8rem;
        color: #2d3748;
        font-weight: 800;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}

@media (max-width: 600px) {
    .compact-form .form-row {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .compact-form .form-row.single {
        grid-template-columns: 1fr;
    }
    
    .compact-form .form-group.full {
        max-width: none;
    }
    
    .imposition-settings-horizontal {
        flex-direction: column;
        width: 100%;
    }
    
    .imposition-settings-horizontal .imp-setting {
        width: 100%;
    }
}

/* Form Elements */
.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    margin-bottom: 7px;
    font-weight: 800 !important;
    color: #1d1d1f;
    font-size: 1.1rem !important;
    font-family: 'Nunito', 'Quicksand', sans-serif !important;
}

.form-group input,
.form-group select {
    width: 100%;
    padding: 14px 18px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    background: #ffffff;
    color: #1d1d1f;
    font-size: 1.15rem !important;
    font-weight: 600 !important;
    transition: all 0.2s ease;
    font-family: 'Nunito', 'Quicksand', sans-serif !important;
}

.form-group input:hover,
.form-group select:hover {
    border-color: #86868b;
}

.form-group input:focus,
.form-group select:focus {
    outline: none;
    border-color: #0071e3;
    box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.1);
}

/* Custom Size Inputs */
.custom-size-inputs {
    display: flex;
    align-items: center;
    gap: 10px;
    background: #fff;
    padding: 10px 15px;
    border-radius: 10px;
    border: 2px solid #e0e0e0;
}

.custom-input-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
}

.custom-input-wrapper .input-label {
    font-size: 0.7rem;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
}

.custom-input-wrapper input {
    width: 70px;
    padding: 8px;
    border: 2px solid #e94560;
    border-radius: 8px;
    text-align: center;
    font-size: 1rem;
    font-weight: 700;
    color: #e94560;
    background: #fff5f7;
}

.custom-input-wrapper input:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(233, 69, 96, 0.2);
}

.size-separator {
    font-size: 1.2rem;
    font-weight: 700;
    color: #999;
}

.unit-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
    background: #f0f0f0;
    padding: 6px 10px;
    border-radius: 6px;
}

/* Buttons */
.btn-primary {
    width: 100%;
    padding: 20px 28px;
    background: #e74c3c;
    border: none;
    border-radius: 10px;
    color: #fff;
    font-size: 1.3rem;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 24px;
    font-family: 'Nunito', sans-serif;
}

.btn-primary:hover {
    background: #c0392b;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3);
}

.btn-primary:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(231, 76, 60, 0.3);
}

.btn-danger {
    width: 100%;
    padding: 14px 25px;
    background: #fff;
    border: 2px solid #ff4444;
    border-radius: 12px;
    color: #ff4444;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: 'Nunito', sans-serif;
}

.btn-danger:hover {
    background: #ff4444;
    color: #fff;
}

.btn-group-full {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 15px;
}

/* Results */
.results h2 {
    color: #e94560;
}

.result-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 10px;
}

.result-item {
    background: #f8f9fa;
    padding: 14px;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    gap: 4px;
    border: 1px solid #eee;
    transition: all 0.3s ease;
}

.result-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
}

.result-item .label {
    color: #666;
    font-size: 0.75rem;
    font-weight: 800;
    text-transform: uppercase;
}

.result-item .value {
    font-weight: 800;
    font-size: 1.15rem;
    color: #333;
}

.result-item.highlight-red {
    background: linear-gradient(135deg, #ffebee, #ffcdd2);
    border-color: #ef5350;
}

.result-item.highlight-red .value {
    color: #c62828;
}

.result-item.highlight-green {
    background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
    border-color: #66bb6a;
}

.result-item.highlight-green .value {
    color: #2e7d32;
}

.result-item.highlight-yellow {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    border-color: #ffca28;
}

.result-item.highlight-yellow .value {
    color: #f57c00;
}

.result-item.hidden {
    display: none;
}

/* Pulse Animation */
@keyframes pulse-feedback {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.01);
        box-shadow: 0 5px 25px rgba(0, 200, 83, 0.2);
    }
    100% {
        transform: scale(1);
    }
}

.pulse-feedback {
    animation: pulse-feedback 0.4s ease-out;
}

/* Table */
.table-wrapper {
    overflow-x: auto;
}

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

th, td {
    padding: 12px;
    text-align: left;
    border-bottom: 1px solid #eee;
}

th {
    background: #f8f9fa;
    color: #666;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
}

tr:hover {
    background: #f8f9fa;
}

/* Role Badge */
.role-badge {
    padding: 4px 10px;
    border-radius: 12px;
    font-size: 0.75rem;
    font-weight: 600;
}

.role-badge.admin {
    background: #ffebee;
    color: #e94560;
}

.role-badge.staff {
    background: #e8f5e9;
    color: #4caf50;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 50px;
    height: 26px;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #ccc;
    transition: 0.3s;
    border-radius: 26px;
}

.toggle-slider:before {
    position: absolute;
    content: "";
    height: 20px;
    width: 20px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: 0.3s;
    border-radius: 50%;
}

.toggle-switch input:checked + .toggle-slider {
    background-color: #4caf50;
}

.toggle-switch input:checked + .toggle-slider:before {
    transform: translateX(24px);
}

/* Settings Card */
.setting-card {
    border-left: 4px solid #e94560;
}

.setting-card h2 {
    margin-bottom: 5px;
}

/* ===== NEW SIMPLE SETTINGS ===== */
.setting-card-simple {
    max-width: 500px;
    margin: 0 auto;
    padding: 20px;
    background: #fff;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.setting-card-simple h2 {
    font-size: 18px;
    font-weight: 700;
    color: #333;
    margin-bottom: 20px;
    text-align: center;
}

.setting-box {
    margin-bottom: 16px;
    background: #f8f9fa;
    border-radius: 10px;
    padding: 12px;
    border: 1px solid #e9ecef;
}

.setting-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.setting-title {
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

.btn-add-small {
    padding: 5px 12px;
    background: #28a745;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-small:hover {
    background: #218838;
}

.setting-list-simple {
    max-height: 200px;
    overflow-y: auto;
}

.setting-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 10px;
    background: #fff;
    border-radius: 6px;
    margin-bottom: 6px;
    border: 1px solid #dee2e6;
}

.setting-item input {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 6px 10px;
    font-size: 14px;
    font-weight: 500;
}

.setting-item input[type="text"] {
    flex: 1;
    min-width: 100px;
}

.setting-item input[type="number"] {
    width: 70px;
    text-align: center;
}

.setting-item .unit {
    font-size: 13px;
    color: #666;
    font-weight: 600;
}

.setting-item .btn-del {
    width: 28px;
    height: 28px;
    background: #fee;
    border: none;
    border-radius: 4px;
    color: #dc3545;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.setting-item .btn-del:hover {
    background: #dc3545;
    color: #fff;
}

.btn-save-main {
    width: 100%;
    padding: 12px;
    background: linear-gradient(135deg, #e94560, #d63850);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    margin-top: 10px;
    transition: all 0.2s;
}

.btn-save-main:hover {
    background: linear-gradient(135deg, #d63850, #c52d42);
    transform: translateY(-1px);
}

.setting-header .hint {
    margin-bottom: 0;
    font-size: 0.8rem;
}

/* Settings List */
.settings-list {
    margin-bottom: 15px;
}

.settings-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 14px;
    background: linear-gradient(135deg, #fafafa, #f5f5f5);
    border-radius: 12px;
    margin-bottom: 10px;
    border: 1px solid #e8e8e8;
    transition: all 0.2s;
}

.settings-item:hover {
    border-color: #e94560;
    box-shadow: 0 2px 8px rgba(233, 69, 96, 0.1);
}

.settings-item input {
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    font-family: 'Nunito', sans-serif;
    transition: border-color 0.2s;
}

.settings-item input:focus {
    outline: none;
    border-color: #e94560;
}

.settings-item .item-name {
    flex: 2;
    min-width: 80px;
}

.settings-item .item-price {
    width: 90px;
    text-align: right;
    color: #e94560;
}

.settings-item .item-size {
    width: 65px;
    text-align: center;
}

.settings-item .unit {
    color: #888;
    font-size: 0.85rem;
    font-weight: 600;
}

/* Add New Row */
.add-new-row {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    padding: 12px;
    background: #f0f8ff;
    border-radius: 12px;
    border: 2px dashed #90caf9;
}

.add-new-row input {
    flex: 1;
    min-width: 80px;
    padding: 10px 12px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    font-size: 0.9rem;
    font-family: 'Nunito', sans-serif;
}

.add-new-row input:focus {
    outline: none;
    border-color: #2196f3;
}

.add-new-row .unit {
    color: #666;
    font-size: 0.85rem;
    font-weight: 600;
}

.btn-add {
    padding: 10px 18px;
    background: #34c759;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.btn-add:hover {
    background: #28a745;
    transform: translateY(-1px);
}

/* Button thêm chi phí */
.btn-add-extra {
    width: 100%;
    padding: 12px;
    background: #f5f5f7;
    border: 2px dashed #d2d2d7;
    border-radius: 8px;
    color: #0071e3;
    font-size: 0.9rem;
    font-weight: 600;
    margin-top: 0;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 6px;
}

.btn-add-extra:hover {
    background: #e8e8ed;
    border-color: #0071e3;
}

/* Note row spacing */
.note-row {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid #f5f5f7;
}

.note-row .form-group {
    margin-bottom: 0;
}

.note-row label {
    margin-bottom: 10px;
    display: block;
}

/* Button lưu note */
.btn-save-note {
    padding: 12px 24px;
    background: #34c759;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
    min-width: 100px;
}

.btn-save-note:hover {
    background: #28a745;
    transform: translateY(-1px);
}

/* Extra costs section spacing */
.extra-costs-section {
    margin-top: 24px !important;
    padding-top: 20px;
    border-top: 1px solid #f5f5f7;
}

.extra-costs-section .form-group.full-width label {
    display: block;
    margin-bottom: 8px;
}

/* Extra costs container */
#paperExtraCosts,
#offsetExtraCosts {
    margin-top: 0;
    margin-bottom: 8px;
    min-height: 0;
}

/* Extra cost item */
.extra-cost-item {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
    align-items: center;
    padding: 4px 0;
}

.extra-cost-item input {
    flex: 1;
    padding: 12px 16px;
    border: 1px solid #d2d2d7;
    border-radius: 8px;
    font-size: 0.9rem;
}

.extra-cost-item .btn-remove {
    padding: 10px 14px;
    background: #ff6b6b;
    border: none;
    border-radius: 8px;
    color: #fff;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    min-width: 44px;
}

.extra-cost-item .btn-remove:hover {
    background: #ff5252;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(255, 107, 107, 0.3);
}

/* Notification */
.calc-notification {
    margin-top: 12px;
    padding: 12px 20px;
    background: #d4edda;
    border: 1px solid #c3e6cb;
    border-radius: 8px;
    color: #155724;
    font-size: 0.9rem;
    font-weight: 600;
    text-align: center;
    animation: slideDown 0.3s ease;
    font-family: 'Nunito', sans-serif;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.3);
}

.btn-add:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.delete-btn {
    width: 32px;
    height: 32px;
    background: #ffebee;
    border: none;
    border-radius: 8px;
    color: #e94560;
    cursor: pointer;
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

/* Action buttons in user management */
.btn-change-password {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    transition: all 0.2s;
    margin-right: 5px;
}

.btn-change-password:hover {
    background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%);
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.delete-btn:hover {
    background: #e94560;
    color: #fff;
}

/* Tiered Pricing Item */
.tier-item {
    background: linear-gradient(135deg, #fff, #fafafa);
    border-radius: 14px;
    margin-bottom: 12px;
    border: 1px solid #e8e8e8;
    overflow: hidden;
}

.tier-item.auto-double {
    background: linear-gradient(135deg, #e8f5e9, #f1f8f2);
    border-color: #4caf50;
}

.tier-item.auto-double .tier-item-header {
    background: transparent;
    border: none;
}

.auto-label {
    color: #2e7d32;
    font-size: 0.85rem;
    font-weight: 600;
    font-style: italic;
    padding: 8px 12px;
    background: rgba(76, 175, 80, 0.1);
    border-radius: 8px;
}

.tier-item-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px;
    background: linear-gradient(135deg, #f5f5f5, #eeeeee);
    border-bottom: 1px solid #e0e0e0;
}

.tier-item-header input {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    font-size: 0.95rem;
    font-weight: 700;
    font-family: 'Nunito', sans-serif;
}

.tier-item-header input:focus {
    outline: none;
    border-color: #e94560;
}

.tier-rows {
    padding: 12px;
}

.tier-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    margin-bottom: 8px;
    background: #fff;
    border-radius: 10px;
    border: 1px solid #f0f0f0;
    font-size: 0.85rem;
    max-width: 100%;
    overflow: hidden;
    flex-wrap: wrap;
}

.tier-row:last-child {
    margin-bottom: 0;
}

.tier-row .tier-label {
    color: #666;
    font-weight: 500;
    white-space: nowrap;
}

.tier-row input {
    width: 80px;
    padding: 8px 10px;
    border: 2px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
    font-size: 0.9rem;
    font-weight: 700;
    text-align: center;
    font-family: 'Nunito', sans-serif;
}

.tier-row input.tier-qty {
    color: #2196f3;
    border-color: #bbdefb;
    background: #e3f2fd;
}

.tier-row input.tier-price {
    color: #e94560;
    border-color: #ffcdd2;
    background: #ffebee;
}

.tier-row input:focus {
    outline: none;
    border-color: #e94560;
}

.tier-row .tier-unit {
    color: #888;
    font-size: 0.8rem;
    font-weight: 600;
}

.add-tier-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    padding: 10px;
    margin-top: 8px;
    background: #e8f5e9;
    border: 2px dashed #4caf50;
    border-radius: 8px;
    color: #4caf50;
    font-size: 0.85rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Nunito', sans-serif;
}

.add-tier-btn:hover {
    background: #4caf50;
    color: #fff;
    border-style: solid;
}

/* Save Button */
.btn-save {
    font-size: 1.1rem;
    padding: 16px;
}

/* Legacy support */
.processing-item {
    background: #f8f9fa;
    padding: 12px;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 1px solid #eee;
}

.processing-item-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.processing-item-header input {
    flex: 2;
    padding: 8px 10px;
    border: 1px solid #ddd;
    border-radius: 8px;
    background: #fff;
    font-family: 'Nunito', sans-serif;
}

.processing-tiers {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* Toast */
.toast {
    position: fixed;
    top: 20px;
    right: 20px;
    padding: 12px 20px;
    background: linear-gradient(135deg, #4caf50, #66bb6a);
    color: #fff;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.9rem;
    box-shadow: 0 5px 20px rgba(76, 175, 80, 0.4);
    z-index: 9999;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
}

.toast.error {
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    box-shadow: 0 5px 20px rgba(233, 69, 96, 0.4);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(100px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

@keyframes toastOut {
    from {
        opacity: 1;
    }
    to {
        opacity: 0;
    }
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
        transform: translateX(100px);
    }
}

/* Hidden class */
.hidden {
    display: none !important;
}

/* ===== SUB TABS ===== */
.sub-tabs {
    display: flex;
    gap: 5px;
    margin-bottom: 15px;
    background: #f0f0f0;
    padding: 5px;
    border-radius: 12px;
    width: fit-content;
}

.sub-tab {
    padding: 8px 16px;
    border: none;
    background: transparent;
    color: #666;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 600;
    transition: all 0.2s;
    font-family: 'Nunito', sans-serif;
}

.sub-tab:hover {
    background: #e0e0e0;
}

.sub-tab.active {
    background: #fff;
    color: #e94560;
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.sub-content {
    display: none;
    max-width: 100%;
    overflow-x: hidden;
}

.sub-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
    max-width: 100%;
    overflow-x: hidden;
}

/* ===== IMPOSITION PREVIEW ===== */
.imposition-preview {
    display: flex;
    align-items: center;
    gap: 15px;
    padding: 12px;
    background: linear-gradient(135deg, #1a1a2e, #16213e);
    border-radius: 12px;
    margin-bottom: 12px;
}

.imposition-sheet {
    background: #fff;
    padding: 8px;
    border-radius: 6px;
    min-width: 100px;
    min-height: 80px;
    position: relative;
}

.sheet-label {
    position: absolute;
    top: -12px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    padding: 6px 12px;
    font-size: 0.8rem;
    font-weight: 800;
    color: #fff;
    border-radius: 12px;
    white-space: nowrap;
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.3);
    letter-spacing: 0.3px;
}

.sheet-grid {
    display: grid;
    gap: 2px;
    padding: 15px 6px 6px;
    min-height: 100px;
    max-width: 100%;
    overflow: hidden;
}

.sheet-grid .grid-item {
    background: linear-gradient(135deg, #667eea, #764ba2);
    border-radius: 2px;
    min-height: 8px;
    min-width: 8px;
    max-width: 12px;
    max-height: 12px;
    box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}

.sheet-grid .grid-item.rotated {
    background: linear-gradient(135deg, #ff6b6b, #ffa726);
    box-shadow: 0 1px 3px rgba(255,107,107,0.3);
}

.sheet-grid .grid-more {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 0.7rem;
    color: #999;
    padding: 5px;
}

.imposition-info {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.imposition-info .info-item {
    text-align: center;
    color: #fff;
}

.imposition-info .info-value {
    display: block;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1;
    background: linear-gradient(135deg, #00c853, #69f0ae);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.imposition-info .info-label {
    font-size: 0.7rem;
    opacity: 0.8;
}

/* Imposition Settings inline */
.imposition-settings {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px;
    background: rgba(255,255,255,0.1);
    border-radius: 10px;
    margin-left: auto;
}

.imp-setting {
    display: flex;
    align-items: center;
    gap: 6px;
}

.imp-setting label {
    color: rgba(255,255,255,0.95);
    font-size: 0.75rem;
    font-weight: 800;
    white-space: nowrap;
}

.imp-setting input {
    width: 50px;
    padding: 6px 8px;
    border: none;
    border-radius: 6px;
    background: rgba(255,255,255,0.9);
    color: #333;
    font-size: 0.85rem;
    font-weight: 700;
    text-align: center;
    font-family: 'Nunito', sans-serif;
}

.imp-setting input:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 2px #69f0ae;
}

.imp-setting span {
    color: rgba(255,255,255,0.6);
    font-size: 0.7rem;
}

/* ===== SETTING SECTIONS ===== */
.setting-section {
    margin-bottom: 25px;
    padding-bottom: 20px;
    border-bottom: 1px dashed #e0e0e0;
}

.setting-section:last-of-type {
    border-bottom: none;
}

.setting-section h3 {
    font-size: 1rem;
    color: #333;
    margin-bottom: 10px;
}

/* ===== QUICK SIZE BUTTONS ===== */
.quick-sizes {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    padding: 12px;
    background: #f8f9fa;
    border-radius: 12px;
}

.quick-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #666;
}

.quick-btn {
    padding: 8px 14px;
    border: 2px solid #e0e0e0;
    background: #fff;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    color: #555;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'Nunito', sans-serif;
}

.quick-btn:hover {
    border-color: #e94560;
    color: #e94560;
}

.quick-btn.active {
    background: linear-gradient(135deg, #e94560, #ff6b6b);
    border-color: transparent;
    color: #fff;
}

/* Label Preview */
.label-preview {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 30px;
    padding: 20px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    margin: 20px 0;
}

.preview-label {
    width: 120px;
    height: 80px;
    background: #fff;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    position: relative;
}

.preview-label::before {
    content: '';
    position: absolute;
    top: 5px;
    left: 5px;
    right: 5px;
    bottom: 5px;
    border: 2px dashed #ddd;
    border-radius: 4px;
}

.preview-size {
    font-size: 0.85rem;
    font-weight: 700;
    color: #333;
    z-index: 1;
}

.preview-info {
    display: flex;
    gap: 20px;
}

.preview-stat {
    text-align: center;
    color: #fff;
}

.preview-stat .stat-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
}

.preview-stat .stat-label {
    font-size: 0.75rem;
    opacity: 0.9;
}

/* Calculate Button Enhanced */
.btn-calculate {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.btn-icon {
    font-size: 1.3rem;
}

.btn-text {
    font-size: 1rem;
}

/* Summary Row */
.summary-row {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-bottom: 12px;
}

.summary-card {
    padding: 12px;
    border-radius: 12px;
    text-align: center;
}

.summary-card .summary-label {
    display: block;
    font-size: 0.95rem;
    font-weight: 800;
    margin-bottom: 5px;
    opacity: 0.9;
}

.summary-card .summary-value {
    display: block;
    font-size: 1.8rem;
    font-weight: 900;
}

.summary-green {
    background: #f0f9f4;
    border: 2px solid #34c759;
    color: #1d8348;
}

.summary-blue {
    background: #f0f7ff;
    border: 2px solid #007aff;
    color: #0051a8;
}

.summary-yellow {
    background: #fffbf0;
    border: 2px solid #ffcc00;
    color: #b8860b;
}

/* Result Detail Section */
.result-detail-section {
    background: #f8f9fa;
    padding: 20px;
    border-radius: 14px;
    margin-top: 15px;
}

.result-detail-section h4 {
    font-size: 0.9rem;
    color: #666;
    margin-bottom: 15px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.result-grid.compact {
    gap: 8px;
}

.result-grid.compact .result-item {
    padding: 10px 12px;
    background: #fff;
}

.result-total-row {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px dashed #ddd;
}

.total-item {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.9rem;
    color: #555;
}

.total-item .total-value {
    font-weight: 800;
    color: #333;
}

.total-item.profit {
    background: linear-gradient(135deg, #fff8e1, #ffecb3);
    padding: 8px 14px;
    border-radius: 8px;
}

.total-item.profit .total-value {
    color: #f57c00;
}

/* Responsive */
@media (max-width: 600px) {
    .container {
        padding: 20px;
    }

    .header-top {
        flex-direction: column;
        gap: 10px;
    }

    .logo {
        height: 60px;
    }

    .header h1 {
        font-size: 1.4rem;
    }

    .tabs {
        gap: 5px;
    }

    .tab {
        padding: 8px 12px;
        font-size: 0.8rem;
    }

    .card {
        padding: 30px 40px;
    }

    .form-section {
        padding: 14px;
    }

    .form-grid-inner {
        grid-template-columns: 1fr;
    }

    .grid-span-2 {
        grid-column: span 1;
    }

    .result-grid {
        grid-template-columns: repeat(2, 1fr);
    }

    .custom-size-inputs {
        flex-wrap: wrap;
        justify-content: center;
    }

    .custom-input-wrapper input {
        width: 60px;
    }

    .add-new-row {
        flex-direction: column;
    }

    .add-new-row input {
        width: 100%;
    }

    .settings-item {
        flex-wrap: wrap;
        gap: 6px;
    }

    .settings-item .item-name {
        flex: 1 1 100%;
    }

    .settings-item .item-size,
    .settings-item .item-price {
        flex: 1;
    }

    .tier-row {
        flex-wrap: wrap;
        gap: 6px;
    }

    .tier-row input {
        width: 60px;
    }

    .tier-item-header {
        flex-wrap: wrap;
    }

    .tier-item-header input {
        flex: 1 1 calc(100% - 50px);
    }

    .btn-group-full {
        flex-direction: column;
    }

    /* Label Calculator Mobile */
    .quick-sizes {
        justify-content: center;
    }

    .quick-btn {
        padding: 6px 10px;
        font-size: 0.75rem;
    }

    .label-preview {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .preview-info {
        flex-direction: row;
        gap: 30px;
    }

    .preview-stat .stat-value {
        font-size: 1.4rem;
    }

    .summary-row {
        grid-template-columns: 1fr;
    }

    .summary-card .summary-value {
        font-size: 1.5rem;
    }

    .result-total-row {
        flex-direction: column;
        gap: 10px;
    }

    /* Imposition Preview Mobile */
    .imposition-preview {
        flex-direction: column;
        gap: 15px;
        padding: 15px;
    }

    .imposition-sheet {
        min-width: 120px;
        min-height: 100px;
    }

    .imposition-info {
        flex-direction: row;
        gap: 30px;
    }

    .imposition-info .info-value {
        font-size: 1.8rem;
    }

    .imposition-settings {
        width: 100%;
        justify-content: center;
        margin-left: 0;
    }

    .imp-setting {
        flex: 1 1 calc(50% - 10px);
    }

    .imp-setting label {
        font-size: 0.7rem;
    }

    .imp-setting input {
        width: 45px;
        padding: 5px 6px;
        font-size: 0.8rem;
    }

    .sub-tabs {
        width: 100%;
        justify-content: center;
    }

    .sub-tab {
        padding: 6px 12px;
        font-size: 0.8rem;
    }
}

/* History Item Styles */
.history-item {
    background: white;
    padding: 15px;
    border-radius: 10px;
    margin-bottom: 10px;
    border: 2px solid #e8e8e8;
    transition: all 0.3s ease;
    max-width: 100%;
    overflow: hidden;
    word-wrap: break-word;
}

.history-item:hover {
    border-color: #e74c3c;
    box-shadow: 0 4px 12px rgba(231, 76, 60, 0.1);
}

.btn-convert-quote {
    background: linear-gradient(135deg, #f39c12, #e67e22) !important;
    color: white !important;
}

.btn-convert-quote:hover {
    background: linear-gradient(135deg, #e67e22, #d35400) !important;
}

/* Calculate Row - Nút tính giá + Loại khách hàng */
/* ===== NÚT TÍNH GIÁ GỘP VỚI LOẠI KHÁCH ===== */
.calculate-box {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: 25px;
    padding: 20px;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 2px solid #a5d6a7;
    border-radius: 16px;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.2);
}

.btn-calculate-main {
    width: 100%;
    padding: 18px 30px;
    font-size: 20px;
    font-weight: 900;
    background: linear-gradient(135deg, #4caf50 0%, #43a047 100%);
    border: none;
    border-radius: 12px;
    color: #fff;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(76, 175, 80, 0.4);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn-calculate-main:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(76, 175, 80, 0.5);
    background: linear-gradient(135deg, #43a047 0%, #388e3c 100%);
}

.btn-calculate-main:active {
    transform: translateY(0);
}

.customer-select-inline {
    width: 100%;
    padding: 12px 16px;
    font-size: 16px;
    font-weight: 700;
    border: 2px solid #a5d6a7;
    border-radius: 10px;
    background: #fff;
    color: #2e7d32;
    cursor: pointer;
    transition: all 0.3s ease;
    text-align: center;
}

.customer-select-inline:hover {
    border-color: #81c784;
    box-shadow: 0 2px 8px rgba(76, 175, 80, 0.2);
}

.customer-select-inline:focus {
    outline: none;
    border-color: #4caf50;
    box-shadow: 0 0 0 3px rgba(76, 175, 80, 0.2);
}

/* Giữ lại cho tương thích */
.calculate-row {
    display: flex;
    align-items: stretch;
    gap: 15px;
    margin-top: 25px;
    flex-wrap: wrap;
}

.customer-type-compact {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px;
    min-width: 200px;
    padding: 15px 18px;
    background: linear-gradient(135deg, #fff9e6 0%, #fff4d6 100%);
    border: 2px solid #f5e6d3;
    border-radius: 12px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    transition: all 0.3s ease;
}

.customer-type-compact:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
    border-color: #f0d9b5;
}

.customer-type-label {
    font-size: 15px;
    font-weight: 800;
    color: #8b7355;
    display: flex;
    align-items: center;
    gap: 6px;
}

.customer-type-select {
    padding: 10px 14px;
    font-size: 16px;
    font-weight: 700;
    border: 2px solid #e8dcc8;
    border-radius: 10px;
    background: #ffffff;
    color: #1d1d1f;
    cursor: pointer;
    transition: all 0.3s ease;
}

.customer-type-select:hover {
    border-color: #d4c4a8;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.customer-type-select:focus {
    outline: none;
    border-color: #c9b896;
    box-shadow: 0 0 0 3px rgba(201, 184, 150, 0.15);
}

.btn-calculate {
    flex: 1;
    min-width: 200px;
    padding: 15px 30px;
    font-size: 18px;
    font-weight: 900;
    background: linear-gradient(135deg, #e8f5e9 0%, #c8e6c9 100%);
    border: 2px solid #b2dfb2;
    border-radius: 12px;
    color: #2e7d32;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.btn-calculate:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #c8e6c9 0%, #a5d6a7 100%);
    border-color: #81c784;
}

.btn-calculate:active {
    transform: translateY(0);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Responsive */
@media (max-width: 768px) {
    .calculate-row {
        flex-direction: column;
        align-items: stretch;
    }
    
    .customer-type-compact {
        width: 100%;
    }
    
    .btn-calculate {
        width: 100%;
        min-width: unset;
    }
}

/* ===== SETTINGS PAGE - BEAUTIFUL DESIGN ===== */
.settings-container {
    max-width: 900px;
    margin: 0 auto;
    padding: 30px;
}

.settings-title {
    text-align: center;
    font-size: 24px;
    font-weight: 800;
    color: #1d1d1f;
    margin-bottom: 30px;
}

.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 20px;
    margin-bottom: 30px;
}

.setting-card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 12px rgba(0,0,0,0.06);
    border: 1px solid #f0f0f0;
}

.setting-card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 15px;
    padding-bottom: 12px;
    border-bottom: 2px solid #f5f5f5;
}

.setting-card-header span {
    font-size: 15px;
    font-weight: 700;
    color: #333;
}

.btn-add-sm {
    padding: 6px 14px;
    font-size: 13px;
    font-weight: 600;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-sm:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.setting-list {
    max-height: 300px;
    overflow-y: auto;
    padding-right: 5px;
}

.setting-list::-webkit-scrollbar {
    width: 6px;
}

.setting-list::-webkit-scrollbar-track {
    background: #f5f5f5;
    border-radius: 3px;
}

.setting-list::-webkit-scrollbar-thumb {
    background: #ddd;
    border-radius: 3px;
}

.setting-list::-webkit-scrollbar-thumb:hover {
    background: #ccc;
}

/* Setting Item - Loại giấy + khổ */
.setting-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #fafafa;
    border-radius: 10px;
    margin-bottom: 8px;
    transition: all 0.2s ease;
}

.setting-item:hover {
    background: #f5f5f5;
}

.setting-item input[type="text"] {
    flex: 1;
    min-width: 80px;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
}

.setting-item input[type="number"] {
    width: 65px;
    padding: 8px 6px;
    font-size: 14px;
    font-weight: 600;
    text-align: right;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
}

.setting-item .unit {
    font-size: 13px;
    font-weight: 600;
    color: #888;
    min-width: 25px;
}

.setting-item .btn-del {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff0f0;
    color: #e74c3c;
    border: 1px solid #ffd0d0;
    border-radius: 6px;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.2s ease;
}

.setting-item .btn-del:hover {
    background: #ffe0e0;
    border-color: #ffb0b0;
}

/* Tiered Pricing Item */
.setting-item-tiered {
    background: #fafafa;
    border-radius: 12px;
    margin-bottom: 10px;
    overflow: hidden;
}

.setting-item-tiered-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: #f0f0f0;
}

.setting-item-tiered-header input[type="text"] {
    flex: 1;
    padding: 8px 10px;
    font-size: 14px;
    font-weight: 600;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
}

.setting-item-tiered-header .btn-del {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff0f0;
    color: #e74c3c;
    border: 1px solid #ffd0d0;
    border-radius: 6px;
    cursor: pointer;
}

.setting-tiers {
    padding: 10px 12px;
}

.tier-row {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
    font-size: 13px;
}

.tier-row:last-child {
    margin-bottom: 0;
}

.tier-row span {
    color: #666;
    font-weight: 500;
}

.tier-row input {
    width: 70px;
    padding: 6px 8px;
    font-size: 13px;
    font-weight: 600;
    text-align: right;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
}

.tier-row .tier-label {
    min-width: 45px;
    color: #888;
}

.btn-add-tier {
    width: 100%;
    padding: 6px;
    margin-top: 8px;
    font-size: 12px;
    font-weight: 600;
    color: #667eea;
    background: #f0f4ff;
    border: 1px dashed #667eea;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-add-tier:hover {
    background: #e8edff;
}

.setting-hint {
    font-size: 12px;
    color: #888;
    margin-top: 10px;
    padding: 8px 12px;
    background: #fff8e1;
    border-radius: 8px;
    border-left: 3px solid #ffc107;
}

.btn-save-settings {
    width: 100%;
    padding: 16px 30px;
    font-size: 18px;
    font-weight: 800;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #fff;
    border: none;
    border-radius: 12px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
}

.btn-save-settings:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.5);
}

/* Processing Checkboxes */
.processing-checkboxes {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.processing-checkboxes label {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 12px;
    background: #f8f8f8;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.processing-checkboxes label:hover {
    background: #f0f0f0;
    border-color: #ccc;
}

.processing-checkboxes input[type="checkbox"]:checked + span {
    color: #667eea;
}

.processing-checkboxes label:has(input:checked) {
    background: #f0f4ff;
    border-color: #667eea;
}

@media (max-width: 768px) {
    .settings-container {
        padding: 15px;
    }
    
    .settings-grid {
        grid-template-columns: 1fr;
    }
    
    .setting-item {
        flex-wrap: wrap;
    }
    
    .setting-item input[type="text"] {
        min-width: 100%;
        margin-bottom: 8px;
    }
}

/* ===== NEW COMPACT FORM LAYOUT ===== */
.form-row.three-cols {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin-bottom: 12px;
}

/* Nút chọn nhanh khổ giấy */
.quick-size-buttons {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}

.btn-quick-size {
    flex: 1;
    min-width: 80px;
    padding: 10px 16px;
    background: #F0F8FF;
    color: #0056b3;
    border: 1px solid #007bff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.15);
}

.btn-quick-size:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0, 123, 255, 0.25);
    background: #E6F3FF;
    border-color: #0056b3;
}

.btn-quick-size:active {
    transform: translateY(0);
    box-shadow: 0 2px 4px rgba(0, 123, 255, 0.15);
}

/* Gia công thành phẩm - 6 ô grid */
.processing-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
    background: linear-gradient(135deg, #f8f9fa 0%, #f0f1f3 100%);
    border-radius: 10px;
    border: 1px solid #e5e5e5;
}

.processing-grid label {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 8px;
    background: #fff;
    border: 1px solid #ddd;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin: 0;
    text-align: center;
}

.processing-grid label:hover {
    border-color: #667eea;
    background: #f8f9ff;
    transform: translateY(-1px);
    box-shadow: 0 2px 6px rgba(102, 126, 234, 0.2);
}

.processing-grid input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: #667eea;
    cursor: pointer;
}

.processing-grid label:has(input:checked) {
    background: #eef2ff;
    border-color: #667eea;
    color: #667eea;
    font-weight: 700;
}

/* Chi phí khác - gọn */
.extra-costs-compact {
    margin-top: 15px;
    padding: 12px 15px;
    background: #fafafa;
    border-radius: 10px;
    border: 1px solid #eee;
}

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

.extra-costs-header span {
    font-size: 14px;
    font-weight: 700;
    color: #555;
}

.extra-costs-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

.delivery-select {
    padding: 6px 10px;
    font-size: 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    background: #fff;
    color: #333;
    cursor: pointer;
    min-width: 200px;
}

.delivery-select:focus {
    outline: none;
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.2);
}

.btn-add-extra-sm {
    padding: 4px 12px;
    font-size: 12px;
    font-weight: 600;
    background: #f0f4ff;
    color: #667eea;
    border: 1px solid #667eea;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add-extra-sm:hover {
    background: #667eea;
    color: #fff;
}

.extra-costs-list {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.extra-costs-list .extra-cost-item {
    display: flex;
    gap: 8px;
    margin-bottom: 0;
}

.extra-costs-list .extra-cost-item input {
    padding: 8px 10px;
    font-size: 13px;
    border-radius: 6px;
}

.extra-costs-list .extra-cost-item .btn-remove {
    padding: 6px 10px;
    font-size: 12px;
    min-width: 32px;
}

/* Nút tính giá gọn */
.calculate-compact {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 15px;
    padding: 12px 15px;
    background: linear-gradient(135deg, #e8f5e9 0%, #f1f8e9 100%);
    border: 1px solid #c8e6c9;
    border-radius: 10px;
    max-width: 350px;
}

.calculate-compact.center {
    margin-left: auto;
    margin-right: auto;
}

.customer-select-sm {
    flex: 1;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    border: 1px solid #a5d6a7;
    border-radius: 8px;
    background: #fff;
    color: #2e7d32;
    cursor: pointer;
}

.customer-select-sm:focus {
    outline: none;
    border-color: #66bb6a;
    box-shadow: 0 0 0 2px rgba(102, 187, 106, 0.2);
}

.btn-calc-sm {
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 700;
    background: linear-gradient(135deg, #66bb6a 0%, #4caf50 100%);
    color: #fff;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.btn-calc-sm:hover {
    background: linear-gradient(135deg, #4caf50 0%, #43a047 100%);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(76, 175, 80, 0.3);
}

/* Tên tính giá - nhỏ gọn cuối cùng */
.note-compact {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    padding: 8px 12px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px dashed #ddd;
}

.note-compact input {
    flex: 1;
    padding: 8px 12px;
    font-size: 12px;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    background: #fff;
}

.note-compact input::placeholder {
    color: #999;
}

.btn-save-sm {
    padding: 8px 12px;
    font-size: 14px;
    background: #f5f5f5;
    color: #666;
    border: 1px solid #ddd;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-save-sm:hover {
    background: #4caf50;
    color: #fff;
    border-color: #4caf50;
}

/* ===== NÚT TOGGLE CHI TIẾT ===== */
.cost-detail-toggle {
    margin-top: 15px;
    text-align: right;
}

.btn-toggle-cost {
    padding: 6px 12px;
    font-size: 12px;
    font-weight: 600;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 6px;
    color: #666;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-toggle-cost:hover {
    background: #e8e8e8;
    border-color: #ccc;
}

/* ===== KẾT QUẢ CHI TIẾT GỌN - 2 CỘT ===== */
.cost-detail-compact {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 15px;
    margin-top: 15px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 12px;
}

.cost-col {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cost-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #fff;
    border-radius: 8px;
    font-size: 13px;
    border: 1px solid #eee;
}

.cost-row span:first-child {
    font-weight: 600;
    color: #555;
}

.cost-val {
    font-weight: 700;
    color: #e94560;
}

.cost-sub-items {
    padding-left: 12px;
    font-size: 12px;
    color: #888;
}

.cost-sub-items .cost-sub-item {
    display: flex;
    justify-content: space-between;
    padding: 3px 8px;
    background: #f5f5f5;
    border-radius: 4px;
    margin-bottom: 3px;
}

/* Tổng kết gọn ngang */
.cost-total-bar {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 15px;
    background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
    border-radius: 10px;
}

.cost-total-bar .total-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.cost-total-bar .total-item span:first-child {
    font-size: 11px;
    font-weight: 600;
    color: rgba(255,255,255,0.7);
}

.cost-total-bar .total-item span:last-child {
    font-size: 15px;
    font-weight: 800;
    color: #ff6b6b;
}

.cost-total-bar .total-item.profit span:last-child {
    color: #ffc107;
}

/* Tổng vốn và Lợi nhuận - HIỆN CHO TẤT CẢ */
.cost-summary-bar {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-top: 15px;
    padding: 12px 15px;
    background: #fff;
    border-radius: 12px;
    border: 1px solid #eee;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.summary-bar-item {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 12px;
    background: #fafafa;
    border-radius: 8px;
    border: 1px solid #eee;
}

.summary-bar-label {
    font-size: 13px;
    font-weight: 600;
    color: #555;
}

.summary-bar-value {
    font-size: 13px;
    font-weight: 700;
    color: #e94560;
}

.summary-bar-item.profit-bar {
    background: #fff8e1;
    border: 1px solid #ffc107;
}

.profit-text {
    color: #f57c00 !important;
    font-size: 13px !important;
}

/* Responsive */
@media (max-width: 500px) {
    .cost-detail-compact {
        grid-template-columns: 1fr;
    }
    
    .cost-total-bar {
        flex-wrap: wrap;
        justify-content: center;
    }
    
    .cost-summary-bar {
        flex-direction: column;
        gap: 10px;
    }
    
    .summary-bar-item {
        width: 100%;
    }
}

/* Responsive */
@media (max-width: 600px) {
    .form-row.three-cols {
        grid-template-columns: 1fr 1fr;
    }
    
    .form-row.three-cols .form-group:nth-child(3) {
        grid-column: span 2;
    }
    
    .processing-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .calculate-compact {
        max-width: 100%;
    }
}

/* ===== MOBILE OPTIMIZATION - Giao diện điện thoại tối ưu, dễ nhìn, dễ dùng ===== */
@media (max-width: 480px) {
    /* Container & Spacing - Tối ưu tối đa cho nhập liệu */
    .container {
        padding: 6px;
        max-width: 100%;
    }
    
    body {
        font-size: 15px !important;
        line-height: 1.5;
        background: #f8f9fa;
    }
    
    /* Header - Gọn tối đa */
    .header {
        padding: 8px 0;
        margin-bottom: 10px;
        border-bottom: 1px solid #f0f0f0;
        position: sticky;
        top: 0;
        background: #fff;
        z-index: 100;
        box-shadow: 0 2px 4px rgba(0,0,0,0.05);
    }
    
    .header-top {
        flex-direction: column;
        gap: 8px;
        align-items: stretch;
    }
    
    .logo {
        height: 35px;
        margin: 0 auto;
    }
    
    .header h1 {
        font-size: 1.1rem;
        margin-top: 4px;
        text-align: center;
        padding: 0 8px;
    }
    
    .user-info {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
        width: 100%;
        justify-content: center;
        padding: 8px;
        background: #f8f9fa;
        border-radius: 8px;
    }
    
    .user-info span {
        width: 100%;
        text-align: center;
        font-weight: 600;
        color: #333;
        font-size: 13px;
        margin-bottom: 2px;
    }
    
    .btn-logout, .btn-manage-users, .btn-mobile-view, .btn-theme-toggle {
        flex: 1;
        min-width: 0;
        padding: 8px 6px;
        font-size: 12px;
        white-space: nowrap;
        text-overflow: ellipsis;
        overflow: hidden;
    }
    
    .btn-theme-toggle {
        font-size: 14px;
    }
    
    /* Tabs - Gọn hơn */
    .sub-tabs {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 6px;
        margin-bottom: 10px;
    }
    
    .sub-tab {
        width: 100%;
        padding: 10px 8px;
        font-size: 13px;
        font-weight: 600;
        border-radius: 8px;
        text-align: center;
        transition: all 0.2s;
    }
    
    /* Cards - Giảm padding */
    .card {
        padding: 12px;
        border-radius: 12px;
        margin-bottom: 12px;
        box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
        border: 1px solid #f0f0f0;
    }
    
    /* Imposition Preview - Thu gọn, có thể ẩn */
    .imposition-preview-top {
        padding: 10px;
        gap: 10px;
        background: #fafafa;
        border-radius: 10px;
        margin-bottom: 12px;
    }
    
    .imposition-sheet {
        min-width: auto;
        flex: 1;
    }
    
    .sheet-label {
        font-size: 12px;
        padding: 6px;
        font-weight: 600;
    }
    
    .imposition-info {
        gap: 15px;
        justify-content: center;
    }
    
    .info-value {
        font-size: 22px;
        font-weight: 900;
        color: #2d3748;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    .info-label {
        font-size: 13px;
        color: #2d3748;
        font-weight: 800;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
    
    /* Imposition Settings - Gọn hơn, grid 3 cột */
    .imposition-settings-horizontal {
        display: grid;
        grid-template-columns: repeat(3, 1fr);
        gap: 8px;
        background: #fff;
        padding: 10px;
        border-radius: 8px;
        border: 1px solid #e5e5e5;
    }
    
    .imp-setting {
        width: 100%;
        gap: 4px;
        display: flex;
        flex-direction: column;
    }
    
    .imp-setting label {
        font-size: 11px;
        font-weight: 600;
        color: #333;
        margin-bottom: 2px;
    }
    
    .imp-setting input {
        padding: 8px;
        font-size: 14px;
        min-height: 40px;
        border: 1.5px solid #e0e0e0;
        border-radius: 6px;
        background: #fff;
        transition: border-color 0.2s;
    }
    
    .imp-setting input:focus {
        border-color: #007bff;
        outline: none;
    }
    
    .imp-setting span {
        font-size: 11px;
        color: #666;
        margin-top: 2px;
    }
    
    /* Form Elements - Tối ưu tối đa cho nhập liệu */
    .compact-form {
        padding: 0;
        background: #fff;
        border-radius: 12px;
        margin-bottom: 8px;
        box-shadow: 0 2px 8px rgba(0,0,0,0.08);
    }
    
    .section-title {
        font-size: 1.1rem;
        margin-bottom: 12px;
        padding: 12px 15px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        color: white;
        border-radius: 12px;
        font-weight: 700;
        text-align: center;
        box-shadow: 0 3px 10px rgba(102, 126, 234, 0.3);
        letter-spacing: 0.5px;
    }
    
    .form-row {
        gap: 8px;
        margin-bottom: 10px;
        padding: 0 6px;
    }
    
    .form-row.two-cols {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .form-row.three-cols {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .form-row.three-cols .form-group:nth-child(3) {
        grid-column: span 2;
    }
    
    .form-group {
        margin-bottom: 0;
        background: #fff;
        padding: 10px;
        border-radius: 8px;
        border: 1px solid #e8e9ea;
        box-shadow: 0 1px 3px rgba(0,0,0,0.05);
    }
    
    .form-group label {
        font-size: 13px !important;
        margin-bottom: 5px;
        font-weight: 700;
        color: #333;
        display: block;
    }
    
    .form-group input,
    .form-group select {
        width: 100%;
        padding: 12px 14px;
        font-size: 16px !important; /* Tránh zoom trên iOS */
        min-height: 44px; /* Kích thước tối thiểu cho touch */
        border-radius: 8px;
        border: 1.5px solid #e0e0e0;
        background: #fafbfc;
        transition: all 0.3s ease;
        box-sizing: border-box;
        box-shadow: inset 0 1px 3px rgba(0,0,0,0.05);
        -webkit-appearance: none;
        appearance: none;
    }
    
    .form-group input:focus,
    .form-group select:focus {
        border-color: #667eea;
        background: #fff;
        outline: none;
        box-shadow: 0 0 0 4px rgba(102, 126, 234, 0.15);
        transform: translateY(-2px);
    }
    
    /* Quick Size Buttons - Dàn ngang 2x2 để vừa màn hình */
    .quick-size-buttons {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        margin-bottom: 12px;
        padding: 8px;
        background: #f8f9fa;
        border-radius: 10px;
    }
    
    .btn-quick-size {
        padding: 12px 8px;
        font-size: 14px;
        font-weight: 700;
        min-height: 40px;
        color: #fff;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border: 2px solid transparent;
        border-radius: 10px;
        cursor: pointer;
        transition: all 0.3s ease;
        text-align: center;
        box-shadow: 0 2px 6px rgba(102, 126, 234, 0.25);
        letter-spacing: 0.3px;
    }
    
    .btn-quick-size:hover,
    .btn-quick-size:active {
        background: linear-gradient(135deg, #5a67d8 0%, #667eea 100%);
        transform: translateY(-2px);
        box-shadow: 0 4px 12px rgba(102, 126, 234, 0.35);
    }
    
    /* Processing Grid - 1 cột trên mobile để dễ đọc */
    .processing-grid {
        grid-template-columns: 1fr;
        gap: 10px;
        padding: 12px;
        background: #f8f9fa;
        border-radius: 12px;
        margin-bottom: 15px;
    }
    
    .processing-grid label {
        padding: 10px 8px;
        font-size: 13px;
        font-weight: 600;
        min-height: 44px;
        justify-content: flex-start;
        border-radius: 8px;
        background: #fff;
        border: 1.5px solid #e5e5e5;
        transition: all 0.2s;
    }
    
    .processing-grid label:active {
        transform: scale(0.98);
    }
    
    /* Extra Costs - Gọn hơn */
    .extra-costs-compact {
        margin: 12px 0;
    }
    
    .extra-costs-header {
        padding: 10px;
        font-size: 13px;
        font-weight: 600;
    }
    
    .btn-add-extra-sm {
        padding: 8px 10px;
        font-size: 12px;
        min-height: 36px;
        border-radius: 6px;
    }
    
    /* Calculate Button - Gọn nhưng vẫn nổi bật */
    .calculate-compact {
        flex-direction: column;
        gap: 10px;
        margin-top: 12px;
        padding: 12px;
        background: #f8f9fa;
        border-radius: 10px;
    }
    
    .customer-select-sm {
        width: 100%;
        padding: 12px;
        font-size: 16px;
        min-height: 46px;
        border-radius: 8px;
        border: 1.5px solid #e0e0e0;
        background: #fff;
        font-weight: 600;
    }
    
    .btn-calc-sm {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        font-weight: 700;
        min-height: 50px;
        border-radius: 10px;
        background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
        color: white;
        border: none;
        box-shadow: 0 3px 10px rgba(40, 167, 69, 0.3);
        transition: all 0.2s;
    }
    
    .btn-calc-sm:active {
        transform: scale(0.98);
        box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
    }
    
    /* Results - Dễ đọc và đẹp mắt */
    .results {
        margin-top: 20px;
    }
    
    .results h2 {
        font-size: 1.3rem;
        margin-bottom: 18px;
        text-align: center;
        color: #333;
        font-weight: 700;
    }
    
    .summary-row {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .summary-card {
        width: 100%;
        padding: 18px;
        border-radius: 12px;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
        border: 2px solid transparent;
        transition: transform 0.2s;
    }
    
    .summary-card:active {
        transform: scale(0.98);
    }
    
    .summary-value {
        font-size: 28px;
        font-weight: 700;
    }
    
    .summary-label {
        font-size: 13px;
        font-weight: 600;
        opacity: 0.8;
    }
    
    /* Kết quả chi tiết - Đẹp hơn, dễ đọc hơn */
    .cost-detail-compact {
        grid-template-columns: 1fr;
        gap: 12px;
        margin: 20px 0;
        padding: 15px;
        background: #fff;
        border-radius: 15px;
        box-shadow: 0 4px 12px rgba(0,0,0,0.08);
    }
    
    .cost-row {
        padding: 16px 18px;
        font-size: 16px;
        background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
        border-radius: 12px;
        border-left: 5px solid #667eea;
        font-weight: 600;
        box-shadow: 0 2px 6px rgba(0,0,0,0.05);
    }
    
    .cost-val {
        font-weight: 800;
        color: #e94560;
        font-size: 17px;
    }
    
    /* Tổng kết - Nổi bật hơn */
    .cost-summary-bar {
        flex-direction: column;
        gap: 15px;
        padding: 20px;
        background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        border-radius: 15px;
        margin-top: 20px;
        box-shadow: 0 6px 20px rgba(102, 126, 234, 0.3);
    }
    
    .summary-bar-item {
        width: 100%;
        padding: 16px 18px;
        background: rgba(255,255,255,0.95);
        border-radius: 12px;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    }
    
    .summary-bar-label {
        font-size: 14px;
        font-weight: 600;
    }
    
    .summary-bar-value {
        font-size: 20px;
        font-weight: 700;
    }
    
    .profit-text {
        color: #28a745;
        font-size: 22px;
    }
    
    /* Modal - Tối ưu cho mobile */
    .modal {
        padding: 10px;
    }
    
    .modal-content {
        padding: 24px 20px;
        margin: 0;
        max-width: 100%;
        border-radius: 16px;
        max-height: 90vh;
        overflow-y: auto;
    }
    
    .modal-content h2 {
        font-size: 1.4rem;
        margin-bottom: 20px;
        font-weight: 700;
    }
    
    .modal-content input,
    .modal-content select {
        padding: 14px;
        font-size: 16px;
        min-height: 48px;
        border-radius: 10px;
        border: 2px solid #e0e0e0;
    }
    
    .btn-primary {
        padding: 16px;
        font-size: 17px;
        font-weight: 600;
        min-height: 52px;
        width: 100%;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(233, 69, 96, 0.3);
    }
    
    .btn-primary:active {
        transform: scale(0.98);
    }
    
    /* History - Tối ưu cho mobile */
    .history-controls {
        flex-direction: column;
        gap: 12px;
        margin-bottom: 16px;
    }
    
    .history-controls input {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        min-height: 48px;
        border-radius: 10px;
        border: 2px solid #e0e0e0;
    }
    
    .btn-danger {
        width: 100%;
        padding: 14px;
        font-size: 16px;
        font-weight: 600;
        min-height: 48px;
        border-radius: 10px;
    }
    
    /* Settings - Dễ dùng hơn */
    .settings-grid {
        grid-template-columns: 1fr;
        gap: 16px;
    }
    
    .setting-card {
        margin-bottom: 16px;
        padding: 16px;
        border-radius: 12px;
        background: #fff;
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    }
    
    .setting-card-header {
        padding: 12px 0;
        margin-bottom: 12px;
        border-bottom: 2px solid #f0f0f0;
    }
    
    .btn-add-sm {
        padding: 10px 14px;
        font-size: 14px;
        font-weight: 600;
        min-height: 44px;
        border-radius: 8px;
    }
    
    .btn-save-settings {
        width: 100%;
        padding: 16px;
        font-size: 17px;
        font-weight: 700;
        min-height: 52px;
        border-radius: 12px;
        box-shadow: 0 4px 12px rgba(0, 123, 255, 0.3);
    }
    
    .btn-save-settings:active {
        transform: scale(0.98);
    }
    
    /* Table - Scrollable trên mobile */
    .table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        border-radius: 12px;
        border: 1px solid #e5e5e5;
    }
    
    table {
        font-size: 14px;
        min-width: 600px;
    }
    
    table th {
        padding: 12px 8px;
        font-size: 13px;
        font-weight: 700;
    }
    
    table td {
        padding: 12px 8px;
    }
    
    /* Buttons chung - Tối ưu touch */
    button {
        min-height: 44px; /* Kích thước tối thiểu cho touch */
        touch-action: manipulation; /* Tối ưu cho touch */
        -webkit-tap-highlight-color: rgba(0, 0, 0, 0.1); /* Tắt highlight mặc định */
    }
    
    /* Input number - tắt spinner trên mobile */
    input[type="number"]::-webkit-inner-spin-button,
    input[type="number"]::-webkit-outer-spin-button {
        -webkit-appearance: none;
        margin: 0;
    }
    
    input[type="number"] {
        -moz-appearance: textfield;
        appearance: textfield;
    }
    
    .btn-mobile-view {
        flex: 1;
        min-width: 0;
        padding: 10px 8px;
        font-size: 13px;
    }
    
    /* Smooth scrolling */
    html {
        scroll-behavior: smooth;
    }
    
    /* Tối ưu scrollbar trên mobile */
    ::-webkit-scrollbar {
        width: 6px;
        height: 6px;
    }
    
    ::-webkit-scrollbar-track {
        background: #f1f1f1;
        border-radius: 10px;
    }
    
    ::-webkit-scrollbar-thumb {
        background: #888;
        border-radius: 10px;
    }
    
    ::-webkit-scrollbar-thumb:hover {
        background: #555;
    }
    
    /* Extra Costs - Cải thiện */
    .extra-costs-list {
        gap: 10px;
    }
    
    .extra-cost-item {
        padding: 12px;
        border-radius: 10px;
        background: #f8f9fa;
        border: 1px solid #e5e5e5;
    }
    
    /* Notification */
    .calc-notification {
        padding: 14px;
        border-radius: 10px;
        font-size: 15px;
        font-weight: 600;
        margin: 16px 0;
    }
    
    /* Cost detail toggle */
    .cost-detail-toggle {
        margin: 16px 0;
    }
    
    .btn-toggle-cost {
        width: 100%;
        padding: 12px;
        font-size: 15px;
        font-weight: 600;
        border-radius: 10px;
        min-height: 48px;
    }
}

/* Mobile View Modal Styles */
.mobile-view-content {
    text-align: left;
    margin: 20px 0;
}

.mobile-step {
    margin-bottom: 20px;
    padding: 15px;
    background: #f8f9fa;
    border-radius: 8px;
    border-left: 4px solid #007bff;
}

.mobile-step h3 {
    margin: 0 0 10px 0;
    color: #007bff;
    font-size: 1.1rem;
}

.mobile-step p {
    margin: 5px 0;
    color: #333;
    line-height: 1.6;
}

.mobile-step code {
    background: #e9ecef;
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Courier New', monospace;
    color: #e94560;
    font-weight: 600;
}

.ip-display, .url-display {
    margin: 10px 0;
    padding: 10px;
    background: #fff;
    border-radius: 6px;
    border: 1px solid #dee2e6;
}

.mobile-note {
    margin-top: 10px;
    padding: 10px;
    background: #fff3cd;
    border-left: 4px solid #ffc107;
    border-radius: 4px;
    color: #856404;
    font-size: 0.9rem;
}

.mobile-step ol {
    margin: 10px 0;
    padding-left: 20px;
}

.mobile-step ol li {
    margin: 8px 0;
    line-height: 1.6;
}

