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

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: #eef1f5;
    min-height: 100vh;
    padding: 40px 20px;
    color: #1a1a2e;
}

.container {
    max-width: 920px;
    margin: 0 auto;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
    overflow: hidden;
}

/* Document Type Selector */
.doc-type-selector {
    display: flex;
    background: #1a1a2e;
}

.doc-type-btn {
    flex: 1;
    padding: 18px 24px;
    border: none;
    background: transparent;
    color: rgba(255,255,255,0.5);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    position: relative;
}

.doc-type-btn:hover {
    color: #fff;
    background: rgba(255,255,255,0.05);
}

.doc-type-btn.active {
    color: #fff;
    background: #4361ee;
}

.doc-type-btn.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 40px;
    height: 3px;
    background: #fff;
    border-radius: 3px 3px 0 0;
}

/* Sections */
.section {
    padding: 28px 32px;
    border-bottom: 1px solid #eef1f5;
}

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

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

.section-header h2 {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: #1a1a2e;
    position: relative;
    padding-left: 12px;
}

.section-header h2::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 14px;
    background: #4361ee;
    border-radius: 2px;
}

/* Form Grid */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
}

.form-grid.three-col {
    grid-template-columns: repeat(3, 1fr);
}

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

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

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

.form-group label {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    margin-bottom: 8px;
}

.form-group label .hint {
    font-weight: 400;
    color: #adb5bd;
    text-transform: none;
}

.form-group input,
.form-group select,
.form-group textarea {
    padding: 12px 14px;
    border: 1.5px solid #e9ecef;
    border-radius: 6px;
    font-size: 14px;
    font-family: inherit;
    transition: all 0.2s;
    background: #fff;
    color: #1a1a2e;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    outline: none;
    border-color: #4361ee;
    box-shadow: 0 0 0 4px rgba(67, 97, 238, 0.1);
}

.form-group input[readonly] {
    background: #f8f9fa;
    color: #6c757d;
}

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

/* Toggle Labels */
.toggle-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6c757d;
    cursor: pointer;
}

.toggle-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

/* Table */
.table-container {
    overflow-x: auto;
    margin-bottom: 20px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #f8f9fa;
}

th {
    padding: 14px 12px;
    text-align: left;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6c757d;
    border-bottom: 2px solid #e9ecef;
}

td {
    padding: 10px 8px;
    border-bottom: 1px solid #f1f3f4;
    vertical-align: middle;
}

.col-sno { width: 50px; }
.col-particulars { min-width: 200px; }
.col-unit { width: 80px; }
.col-qty { width: 80px; }
.col-rate { width: 100px; }
.col-amount { width: 120px; }
.col-action { width: 50px; }

.item-row input,
.item-row select {
    width: 100%;
    padding: 10px 12px;
    border: 1.5px solid #e9ecef;
    border-radius: 6px;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s;
}

.item-row input:focus,
.item-row select:focus {
    outline: none;
    border-color: #4361ee;
}

.item-row input[readonly] {
    background: #f8f9fa;
    color: #6c757d;
    border-color: #f1f3f4;
}

/* Totals Section */
.totals-section {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    padding-top: 16px;
    border-top: 2px solid #e9ecef;
}

.totals-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 300px;
    padding: 10px 0;
    border-bottom: 1px solid #f1f3f4;
}

.totals-row:last-child {
    border-bottom: none;
}

.totals-label {
    font-size: 13px;
    color: #6c757d;
    display: flex;
    align-items: center;
    gap: 8px;
}

.totals-value {
    font-size: 14px;
    font-weight: 600;
    color: #1a1a2e;
}

.total-final {
    background: #f8f9fa;
    margin-top: 8px;
    padding: 14px 16px;
    border-radius: 6px;
    border: none;
}

.total-final .totals-label {
    font-weight: 700;
    color: #1a1a2e;
}

.total-final .totals-value {
    font-size: 18px;
    color: #4361ee;
}

.inline-input {
    width: 50px !important;
    padding: 4px 8px !important;
    text-align: center;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
    font-size: 12px !important;
}

.inline-input-text {
    width: 100px !important;
    padding: 4px 8px !important;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
    font-size: 12px !important;
    margin-left: 8px;
}

.inline-input-amount {
    width: 80px !important;
    padding: 4px 8px !important;
    text-align: right;
    border: 1px solid #dee2e6 !important;
    border-radius: 4px !important;
    font-size: 12px !important;
}

.extra-charges-row {
    border-bottom: 1px dashed #dee2e6 !important;
}

/* Buttons */
.btn-add {
    padding: 10px 18px;
    background: #fff;
    border: 1.5px solid #4361ee;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: #4361ee;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-add:hover {
    background: #4361ee;
    color: #fff;
}

.btn-remove {
    width: 32px;
    height: 32px;
    background: #fff;
    border: 1.5px solid #e9ecef;
    border-radius: 6px;
    color: #adb5bd;
    font-size: 18px;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove:hover {
    background: #fff5f5;
    border-color: #ff6b6b;
    color: #ff6b6b;
}

/* Generate Button */
.btn-generate {
    width: 100%;
    padding: 20px 24px;
    background: #1a1a2e;
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.3s;
}

.btn-generate:hover {
    background: #4361ee;
}

/* Responsive - Tablet */
@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        border-radius: 0;
    }

    .section {
        padding: 20px 16px;
    }

    .form-grid,
    .form-grid.two-col,
    .form-grid.three-col {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .doc-type-btn {
        padding: 14px 8px;
        font-size: 11px;
        letter-spacing: 0.5px;
    }

    .doc-type-btn.active::after {
        width: 30px;
    }

    .totals-section {
        align-items: stretch;
    }

    .totals-row {
        width: 100%;
        flex-wrap: wrap;
        gap: 8px;
    }

    .totals-label {
        flex-wrap: wrap;
        font-size: 12px;
    }

    .inline-input-text {
        width: 80px !important;
        margin-left: 4px;
    }

    .inline-input-amount {
        width: 70px !important;
    }

    th, td {
        padding: 8px 4px;
    }

    .col-particulars {
        min-width: 120px;
    }

    .col-unit,
    .col-qty,
    .col-rate,
    .col-amount {
        width: auto;
        min-width: 60px;
    }

    .item-row input,
    .item-row select {
        padding: 8px 6px;
        font-size: 12px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px 12px;
        font-size: 14px;
    }

    .btn-generate {
        padding: 16px 20px;
        font-size: 13px;
    }
}

/* Responsive - Mobile */
@media (max-width: 480px) {
    body {
        padding: 0;
    }

    .section {
        padding: 16px 12px;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .section-header h2 {
        font-size: 10px;
    }

    .doc-type-btn {
        padding: 12px 6px;
        font-size: 10px;
        letter-spacing: 0;
    }

    /* Mobile-friendly table */
    .table-container {
        margin: 0 -12px;
        padding: 0 12px;
    }

    table {
        font-size: 11px;
    }

    th {
        font-size: 9px;
        padding: 8px 3px;
    }

    td {
        padding: 6px 3px;
    }

    .col-sno {
        width: 30px;
    }

    .col-particulars {
        min-width: 100px;
    }

    .col-unit {
        width: 50px;
    }

    .col-qty,
    .col-rate,
    .col-amount {
        width: 55px;
        min-width: 55px;
    }

    .col-action {
        width: 35px;
    }

    .item-row input,
    .item-row select {
        padding: 6px 4px;
        font-size: 11px;
        border-radius: 4px;
    }

    .btn-remove {
        width: 26px;
        height: 26px;
        font-size: 14px;
    }

    .btn-add {
        padding: 8px 12px;
        font-size: 12px;
        width: 100%;
        margin-top: 8px;
    }

    /* Totals mobile */
    .totals-section {
        margin-top: 12px;
    }

    .totals-row {
        padding: 8px 0;
    }

    .totals-label {
        font-size: 11px;
        gap: 4px;
    }

    .totals-value {
        font-size: 12px;
    }

    .total-final {
        padding: 10px 12px;
    }

    .total-final .totals-value {
        font-size: 16px;
    }

    .inline-input {
        width: 40px !important;
        padding: 3px 4px !important;
        font-size: 11px !important;
    }

    .inline-input-text {
        width: 70px !important;
        padding: 3px 4px !important;
        font-size: 11px !important;
        margin-left: 2px;
    }

    .inline-input-amount {
        width: 60px !important;
        padding: 3px 4px !important;
        font-size: 11px !important;
    }

    /* Toggle label mobile */
    .toggle-label {
        font-size: 11px;
    }

    .toggle-label input[type="checkbox"] {
        width: 14px;
        height: 14px;
    }

    /* Form inputs mobile */
    .form-group label {
        font-size: 10px;
        margin-bottom: 6px;
    }

    .form-group input,
    .form-group select,
    .form-group textarea {
        padding: 10px;
        font-size: 14px;
        border-radius: 4px;
    }

    /* Button mobile */
    .btn-generate {
        padding: 14px 16px;
        font-size: 12px;
        letter-spacing: 1px;
        position: sticky;
        bottom: 0;
    }
}

/* Extra small devices */
@media (max-width: 360px) {
    .doc-type-btn {
        padding: 10px 4px;
        font-size: 9px;
    }

    .col-particulars {
        min-width: 80px;
    }

    .col-qty,
    .col-rate,
    .col-amount {
        width: 45px;
        min-width: 45px;
    }

    .item-row input,
    .item-row select {
        font-size: 10px;
        padding: 5px 3px;
    }

    th {
        font-size: 8px;
    }
}
