/* ============================================================
   TOOLS24 GLOBAL + TOPBAR DESIGN
   ============================================================ */

:root {
    --topbar-blue: #0b67c9;
    --accent-green: #00d166;
    --topbar-height: 64px;
}

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

/* space for fixed topbar */
body {
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: #f5f7fb;
    color: #222;
    line-height: 1.5;
    padding-top: calc(var(--topbar-height) + 6px);
}

/* ---------------- TOPBAR ---------------- */

.topbar {
    position: fixed;
    left: 0;
    right: 0;
    top: 0;
    height: var(--topbar-height);
    background: var(--topbar-blue);
    color: #fff;
    z-index: 1100;
    display: flex;
    flex-direction: column;
    box-shadow: 0 2px 4px rgba(0,0,0,0.08);
}

.topbar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: calc(var(--topbar-height) - 6px);
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
}

.back-btn {
    background: transparent;
    border: none;
    color: #fff;
    font-size: 20px;
    cursor: pointer;
}

.topbar-title {
    text-align: center;
    font-weight: 700;
    font-size: 18px;
    flex: 1;
}

.topbar-space {
    width: 44px;
}

.topbar-accent {
    height: 6px;
    background: var(--accent-green);
}

/* ============================================================
   PAGE WRAPPER
   ============================================================ */

.page-container {
    max-width: 1100px;
    margin: 24px auto;
    padding: 0 16px 40px;
}

/* ============================================================
   HEADER FORM SECTION
   ============================================================ */

.header {
    display: grid;
    grid-template-columns: 220px 1.5fr 1fr;
    gap: 16px;
    margin-bottom: 20px;
}

.logo-upload {
    display: flex;
    gap: 10px;
}

.upload-box {
    border: 1px dashed #cfd4e4;
    border-radius: 12px;
    padding: 16px;
    cursor: pointer;
    width: 150px;
    background: #fff;
    text-align: center;
}

.upload-content {
    font-size: 12px;
}

.upload-icon {
    font-size: 20px;
    margin-bottom: 4px;
}

.upload-text {
    font-weight: 600;
    margin-bottom: 2px;
}

.upload-sub {
    color: #777;
    font-size: 11px;
}

.logo-preview,
.preview-logo {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background: #e5e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.preview-logo {
    width: 100px;
    height: 100px;
}

.logo-preview img,
.preview-logo img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.company-details .input {
    margin-bottom: 6px;
}

.payslip-month {
    text-align: right;
}

.payslip-label {
    font-size: 12px;
    color: #777;
}

.month-input {
    margin-top: 8px;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #d4d8e3;
    width: 100%;
}

/* ============================================================
   FORM CARD + INPUTS
   ============================================================ */

.card {
    background: #fff;
    border-radius: 16px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.08);
}

.input {
    width: 100%;
    padding: 8px 10px;
    border-radius: 8px;
    border: 1px solid #d4d8e3;
    font-size: 13px;
}

.input:focus {
    border-color: #2563eb;
}

.section-title {
    font-size: 16px;
    margin-bottom: 10px;
    font-weight: 600;
}

/* ============================================================
   GRID SECTION
   ============================================================ */

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px 16px;
}

.field label {
    display: block;
    margin-bottom: 4px;
    color: #555;
    font-size: 13px;
}

/* ============================================================
   TABLES
   ============================================================ */

.tables-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 18px;
}

.table-card {
    background: #f9fafb;
    border-radius: 12px;
    padding: 10px;
}

.table-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 6px;
    font-weight: 600;
}

.link-btn {
    border: none;
    background: none;
    color: #2563eb;
    cursor: pointer;
}

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

.data-table th {
    background: #e5e7eb;
    padding: 6px;
    font-size: 13px;
}

.data-table td {
    border-bottom: 1px solid #e5e7eb;
    padding: 6px;
    font-size: 13px;
}

.total-label {
    text-align: right;
    font-weight: 600;
}

.total-value {
    font-weight: 600;
}

/* ============================================================
   NET CARD
   ============================================================ */

.net-card {
    margin-top: 18px;
    background: #f9fafb;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    display: flex;
    justify-content: space-between;
}

.net-title {
    font-size: 15px;
    font-weight: 600;
}

.net-sub {
    font-size: 13px;
    color: #6b7280;
}

.net-amount {
    font-size: 20px;
    font-weight: 700;
}

/* ============================================================
   PREVIEW AREA (BORDER ADDED ON ALL SIDES)
   ============================================================ */

.payslip-preview {
    margin-top: 24px;
}

/* FINAL BORDER DESIGN – मोटा border सभी तरफ */
.preview-page {
    border: 6px solid var(--topbar-blue);
    border-radius: 14px;
    background: #ffffff;
    padding: 24px;
    box-shadow: 0 10px 32px rgba(0,0,0,0.07);
}

.preview-inner {
    padding: 10px;
}

.preview-header {
    display: grid;
    grid-template-columns: 120px 1.5fr 1fr;
    gap: 16px;
}

.preview-company h2 {
    font-size: 18px;
    font-weight: 700;
}

.preview-meta {
    text-align: right;
}

.preview-section {
    margin-top: 12px;
}

.preview-footer {
    margin-top: 24px;
    display: flex;
    justify-content: space-between;
    font-size: 12px;
}

.preview-footer div {
    padding-top: 40px;
    width: 140px;
    border-top: 1px solid #ccc;
    text-align: center;
}

.preview-actions {
    margin-top: 20px;
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ============================================================
   PRINT — SAME BORDER IN FINAL RECEIPT
   ============================================================ */

@media print {

    body {
        background: #ffffff !important;
        padding: 0 !important;
    }

    .topbar,
    .header,
    #slipForm,
    .no-print,
    .actions,
    .preview-actions {
        display: none !important;
    }

    #payslipPreview {
        display: block !important;
        margin: 0 !important;
    }

    .preview-page {
        border: 6px solid var(--topbar-blue) !important;
        border-radius: 10px !important;
        padding: 14mm !important;
        box-shadow: none !important;
    }

    @page {
        size: A4;
        margin: 10mm;
    }

    .preview-page * {
        font-size: 12px !important;
    }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

@media (max-width: 768px) {

    .header,
    .preview-header {
        grid-template-columns: 1fr;
    }

    .payslip-month {
        text-align: left;
    }

    .topbar-title {
        font-size: 16px;
    }
}
