body {
    font-family: Arial, sans-serif;
    background: #f4f6f8;
    margin: 0;
    padding: 30px;
    color: #1f2937;
}

button,
.btn-primary,
.btn-secondary,
.btn-view,
.btn-edit,
.btn-public-view,
.btn-delete,
.auth-link a,
.nav-links a,
.status-dropdown {
    cursor: pointer !important;
}

/* Header */
.dashboard-header {
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    padding: 16px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-shadow: 0 4px 18px rgba(0,0,0,0.05);
}

.dashboard-logo {
    display: flex;
    align-items: center;
    gap: 14px;
}

.dashboard-logo img {
    width: 100px;
    height: auto;
}

.dashboard-logo h2 {
    margin: 0;
    color: #111827;
    font-size: 21px;
}

.dashboard-logo span {
    color: #6b7280;
    font-size: 13px;
}

.dashboard-nav {
    display: flex;
    align-items: center;
    gap: 12px;
}

.dashboard-nav a {
    background: #f3f4f6;
    color: #111827;
    padding: 9px 14px;
    border-radius: 8px;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
}

.dashboard-nav a:hover {
    background: #2563eb;
    color: #fff;
}

.welcome-user {
    color: #374151;
    font-weight: 600;
    font-size: 14px;
    margin-left: 8px;
}

.logout-btn {
    background: #dc2626 !important;
    color: #fff !important;
}

.logout-btn:hover {
    background: #991b1b !important;
}

/* Layout */
.container {
    max-width: 1200px;
    margin: 30px auto;
    background: #fff;
    padding: 25px;
    border-radius: 12px;
    box-shadow: 0 5px 20px rgba(0,0,0,0.08);
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 25px;
}

.page-header h1 {
    margin: 0;
    color: #1f2937;
}

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-view,
.btn-edit,
.btn-public-view,
.btn-delete {
    border: none;
    cursor: pointer;
    text-decoration: none;
    font-weight: 600;
    border-radius: 8px;
    color: #fff;
    min-width: 120px;
    height: 42px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 18px;
    box-sizing: border-box;
    font-size: 14px;
}

.btn-primary {
    background: #2563eb;
}

.btn-secondary {
    background: #6b7280;
}

.btn-view {
    background: #0ea5e9;
    margin-bottom: 10px;
}

.btn-edit {
    background: #f59e0b;
}

.btn-delete {
    background: #dc2626;
}
.btn-public-view {
    background: #0f3b5f;
}

table .btn-view,
table .btn-edit,
table .btn-delete {
    min-width: 78px;
    height: 34px;
    padding: 0 12px;
    font-size: 13px;
}

/* Tables */
table {
    width: 100%;
    border-collapse: collapse;
}

thead {
    background: #111827;
    color: #fff;
}

th,
td {
    padding: 14px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
}

tbody tr:hover {
    background: #f9fafb;
}

.empty {
    text-align: center;
    color: #6b7280;
}

/* Status */
.status,
.status-dropdown,
.invoice-status {
    font-weight: bold;
}

.status {
    padding: 6px 12px;
    border-radius: 20px;
    font-size: 13px;
}

.status-dropdown {
    padding: 8px 12px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
}

.status.pending,
.status-dropdown.pending,
.invoice-status.pending {
    background: #fef3c7;
    color: #92400e;
}

.status.advance-paid,
.status-dropdown.advance-paid,
.invoice-status.advance-paid {
    background: #dbeafe;
    color: #1e40af;
}

.status.paid,
.status-dropdown.paid,
.invoice-status.paid,
.status.active {
    background: #dcfce7;
    color: #166534;
}

.status.cancelled,
.status-dropdown.cancelled,
.invoice-status.cancelled,
.status.inactive {
    background: #fee2e2;
    color: #991b1b;
}

/* Forms */
.invoice-form {
    margin-top: 20px;
}

.form-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    padding: 22px;
    border-radius: 14px;
    margin-bottom: 22px;
}

.form-section h3 {
    margin: 0 0 18px;
    color: #111827;
    font-size: 18px;
    border-left: 4px solid #2563eb;
    padding-left: 10px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
}

.form-group label {
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 7px;
}

input,
select,
textarea,
.items-table input {
    width: 100%;
    padding: 12px 13px;
    border: 1px solid #d1d5db;
    border-radius: 9px;
    font-size: 14px;
    background: #fff;
    box-sizing: border-box;
}

input:focus,
select:focus,
textarea:focus,
.items-table input:focus {
    outline: none;
    border-color: #2563eb;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}

input[readonly] {
    background: #f3f4f6;
    color: #374151;
    font-weight: 600;
}

textarea {
    min-height: 110px;
    resize: vertical;
}

.full-width {
    margin-top: 18px;
}

.section-header,
.form-actions,
.invoice-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.form-actions,
.invoice-actions {
    justify-content: flex-end;
    gap: 12px;
    margin-top: 25px;
}

/* Select2 */
.select2-container {
    width: 100% !important;
}

.select2-selection--single {
    height: 46px !important;
    border: 1px solid #d1d5db !important;
    border-radius: 9px !important;
    padding: 8px;
}

.select2-selection__rendered {
    line-height: 28px !important;
}

/* Invoice View */
.invoice-document {
    background: #fff;
    padding: 35px;
    border-radius: 14px;
    font-size: 14px;
}

.invoice-header-pro {
    display: flex;
    justify-content: space-between;
    gap: 30px;
    border-bottom: 1px solid #e5e7eb;
    padding-bottom: 24px;
    margin-bottom: 28px;
}

.company-vertical {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
}

.invoice-logo-pro {
    max-width: 150px;
    height: auto;
}

.company-details-below h2 {
    margin: 0 0 6px;
    font-size: 15px;
    color: #111827;
}

.company-details-below p,
.invoice-meta p,
.bill-box p {
    margin: 4px 0;
    font-size: 13px;
    color: #4b5563;
    line-height: 1.5;
}

.invoice-meta {
    text-align: right;
}

.invoice-meta h1 {
    margin: 0 0 12px;
    font-size: 28px;
    letter-spacing: 1.5px;
    color: #111827;
}

.invoice-meta span {
    color: #6b7280;
    font-weight: 600;
}

.invoice-details-row,
.invoice-bottom-row {
    display: grid;
    grid-template-columns: 1.2fr 1fr;
    gap: 22px;
    margin-bottom: 28px;
}

.bill-box,
.summary-box,
.notes-box,
.totals-card {
    border: 1px solid #e5e7eb;
    background: #f9fafb;
    border-radius: 12px;
    padding: 18px;
}

.bill-box h3,
.summary-box h3,
.notes-box h3 {
    margin: 0 0 12px;
    font-size: 15px;
    color: #111827;
}

.client-name {
    font-weight: 700;
    color: #111827 !important;
    font-size: 15px !important;
}

.summary-line,
.totals-card div {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid #e5e7eb;
    padding: 9px 0;
    gap: 20px;
}

.summary-line span,
.totals-card span {
    color: #6b7280;
}

.summary-line strong,
.totals-card strong {
    color: #111827;
    text-align: right;
}

.invoice-status {
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 12px;
}

.invoice-items-pro {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 28px;
}

.invoice-items-pro th {
    background: #111827;
    color: #fff;
    font-size: 13px;
    padding: 12px;
}

.invoice-items-pro td {
    padding: 12px;
    border-bottom: 1px solid #e5e7eb;
    font-size: 13.5px;
}

.invoice-items-pro th:nth-child(2),
.invoice-items-pro th:nth-child(3),
.invoice-items-pro th:nth-child(4),
.invoice-items-pro td:nth-child(2),
.invoice-items-pro td:nth-child(3),
.invoice-items-pro td:nth-child(4) {
    text-align: right;
}

.notes-box p {
    margin: 0;
    color: #4b5563;
    line-height: 1.6;
}

.totals-card {
    background: #fff;
}

.totals-card .grand-total {
    margin-top: 6px;
    padding-top: 13px;
    font-size: 15px;
    font-weight: 700;
    border-top: 2px solid #111827;
}

.amount-paid strong {
    color: #166534;
}

.amount-due {
    background: #fffbeb;
    margin: 8px -10px -2px;
    padding: 12px 10px !important;
    border-radius: 8px;
    border-bottom: none !important;
}

.amount-due strong {
    color: #b45309;
    font-size: 16px;
}

/* Print Footer */
.print-footer {
    display: block;
    margin-top: 30px;
    padding-top: 12px;
    border-top: 1px solid #d1d5db;
    text-align: center;
    font-size: 10.5px;
    color: #6b7280;
}

/* Auth Pages */
.auth-page {
    min-height: 100vh;
    background: #f3f6fb;
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    padding: 0;
}

.auth-left {
    background: linear-gradient(135deg, #071827, #0f3b5f);
    color: #fff;
    padding: 70px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-left img {
    width: 250px;
    margin-bottom: 30px;
    border-radius: 14px;
    background: white;
    padding: 14px;
}

.auth-left h1 {
    font-size: 38px;
    margin: 0 0 15px;
}

.auth-left p {
    font-size: 16px;
    line-height: 1.7;
    color: #dbeafe;
    max-width: 520px;
}

.auth-right {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 45px;
}

.auth-box {
    width: 100%;
    max-width: 430px;
    background: #fff;
    padding: 38px;
    border-radius: 18px;
    box-shadow: 0 15px 45px rgba(15, 23, 42, 0.12);
}

.auth-box h2 {
    margin: 0 0 8px;
    color: #111827;
    font-size: 26px;
}

.auth-box .subtitle {
    color: #6b7280;
    margin-bottom: 28px;
}

.auth-box label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 7px;
}

.auth-box input {
    margin-bottom: 18px;
}

.auth-box button {
    width: 100%;
    background: #0f3b5f;
    color: #fff;
    padding: 13px;
    border-radius: 9px;
    font-weight: bold;
}

.auth-error,
.auth-success {
    padding: 11px;
    border-radius: 9px;
    margin-bottom: 18px;
    text-align: center;
    font-size: 14px;
}

.auth-error {
    background: #fee2e2;
    color: #991b1b;
}

.auth-success {
    background: #dcfce7;
    color: #166534;
}

.auth-link {
    margin-top: 22px;
    text-align: center;
    font-size: 14px;
    color: #6b7280;
}

.auth-link a {
    color: #0f3b5f;
    font-weight: bold;
    text-decoration: none;
}

/* Change Log */
.change-log-box {
    margin-top: 28px;
    background: #f9fafb;
    border: 1px solid #e5e7eb;
    border-radius: 14px;
    padding: 18px;
}

.change-log-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px;
}

.change-log-header h3 {
    margin: 0;
    font-size: 15px;
    color: #111827;
}

.change-log-header span {
    font-size: 12px;
    color: #6b7280;
    background: #eef2ff;
    padding: 5px 10px;
    border-radius: 20px;
    white-space: nowrap;
}

.change-log-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.change-log-item {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    padding: 12px;
}

.change-log-dot {
    width: 10px;
    height: 10px;
    background: #2563eb;
    border-radius: 50%;
    margin-top: 6px;
    flex-shrink: 0;
}

.change-log-content {
    width: 100%;
    min-width: 0;
}

.change-log-content p {
    margin: 0 0 8px;
    color: #111827;
    font-size: 13px;
    line-height: 1.65;
    word-break: break-word;
}

.change-log-content small {
    display: block;
    color: #6b7280;
    font-size: 12px;
    line-height: 1.5;
}

.password-wrapper {
    position: relative;
    width: 100%;
    margin-bottom: 18px;
}

.password-wrapper input {
    width: 100%;
    margin-bottom: 0 !important;
    padding-right: 52px !important;
}

.toggle-password {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    height: 20px;
    line-height: 20px;
    display: block;
    cursor: pointer;
    color: #6b7280;
    font-size: 18px;
}

.copy-toast {
    position: fixed;
    right: 30px;
    bottom: 30px;
    background: #111827;
    color: #fff;
    padding: 14px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 600;
    box-shadow: 0 12px 35px rgba(0,0,0,0.22);
    opacity: 0;
    transform: translateY(15px);
    pointer-events: none;
    transition: 0.3s ease;
    z-index: 9999;
}

.copy-toast.show {
    opacity: 1;
    transform: translateY(0);
}

.delete-modal {
    position: fixed;
    inset: 0;
    background: rgba(17, 24, 39, 0.65);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}

.delete-modal.show {
    display: flex;
}

.delete-modal-box {
    background: #fff;
    width: 100%;
    max-width: 430px;
    padding: 28px;
    border-radius: 16px;
    box-shadow: 0 25px 80px rgba(0,0,0,0.25);
}

.delete-modal-box h3 {
    margin: 0 0 10px;
    color: #111827;
}

.delete-modal-box p {
    color: #6b7280;
    line-height: 1.5;
    margin-bottom: 18px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 20px;
}

/* Responsive */
@media (max-width: 1024px) {
    body {
        padding: 18px;
    }

    .container {
        width: auto;
        margin: 20px;
        padding: 18px;
    }

    .invoice-document {
        padding: 24px;
    }

    .invoice-details-row,
    .invoice-bottom-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 900px) {
    .auth-page {
        grid-template-columns: 1fr;
    }

    .auth-left {
        padding: 35px;
    }

    .auth-left h1 {
        font-size: 28px;
    }
}

@media (max-width: 768px) {
    body {
        padding: 10px;
    }

    .container {
        margin: 0;
        padding: 12px;
        border-radius: 10px;
    }

    .dashboard-header {
        flex-direction: column;
        gap: 18px;
        align-items: flex-start;
    }

    .dashboard-nav {
        flex-wrap: wrap;
    }

    .form-grid,
    .invoice-details-row,
    .invoice-bottom-row {
        grid-template-columns: 1fr;
    }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
    }

    .invoice-document {
        padding: 16px;
        border-radius: 10px;
    }

    .invoice-header-pro {
        flex-direction: column;
        align-items: flex-start;
        gap: 18px;
    }

    .invoice-meta {
        text-align: left;
        width: 100%;
    }

    .invoice-meta h1 {
        font-size: 22px;
    }

    .invoice-logo-pro {
        max-width: 120px;
    }

    .bill-box,
    .summary-box,
    .notes-box,
    .totals-card {
        padding: 14px;
    }

    .invoice-items-wrapper {
        width: 100%;
        max-width: 100%;
        overflow-x: scroll;
        overflow-y: hidden;
        -webkit-overflow-scrolling: touch;
        display: block;
        margin-bottom: 15px;
    }

    .invoice-items-pro {
        width: max-content;
        min-width: 760px;
        table-layout: auto;
        white-space: nowrap;
        border-collapse: collapse;
    }

    .invoice-items-pro th,
    .invoice-items-pro td {
        white-space: nowrap;
        min-width: 120px;
    }

    .invoice-items-pro th:first-child,
    .invoice-items-pro td:first-child {
        min-width: 280px;
    }

    .invoice-actions.public-print {
        justify-content: center;
    }

    .invoice-actions.public-print button {
        width: 100%;
    }

    .print-footer {
        font-size: 10px;
        line-height: 1.5;
        padding: 10px;
    }

    .change-log-box {
        padding: 14px;
        margin-top: 22px;
    }

    .change-log-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .change-log-header span {
        font-size: 11.5px;
    }

    .change-log-item {
        padding: 11px;
        gap: 10px;
    }

    .change-log-content p {
        font-size: 12.5px;
        line-height: 1.6;
    }

    .change-log-content small {
        font-size: 11.5px;
    }

    .copy-toast {
        left: 15px;
        right: 15px;
        bottom: 20px;
        text-align: center;
    }
}

@media (max-width: 480px) {
    .invoice-document {
        padding: 12px;
    }

    .company-details-below h2 {
        font-size: 14px;
    }

    .company-details-below p,
    .invoice-meta p,
    .bill-box p {
        font-size: 12.5px;
    }

    .invoice-meta h1 {
        font-size: 20px;
    }

    .summary-line,
    .totals-card div {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .summary-line strong,
    .totals-card strong {
        text-align: left;
    }

    .invoice-items-pro th,
    .invoice-items-pro td {
        padding: 10px;
        font-size: 12.5px;
    }

    .invoice-status {
        display: inline-block;
        margin-top: 4px;
    }

    .change-log-dot {
        width: 8px;
        height: 8px;
        margin-top: 6px;
    }

    .change-log-content p {
        font-size: 12px;
    }
}

/* Print */
@media print {
    @page {
        size: A4;
        margin: 12mm;
    }

    .dashboard-header,
    .topbar,
    .invoice-actions,
    .form-actions,
    .btn-primary,
    .btn-secondary {
        display: none !important;
    }

    body {
        background: #fff !important;
        padding: 0 !important;
    }

    .container {
        box-shadow: none !important;
        margin: 0 !important;
        max-width: 100% !important;
        padding: 0 !important;
    }

    .invoice-document {
        padding: 0 !important;
        border-radius: 0 !important;
    }

    .print-footer {
        display: block !important;
        position: static !important;
        margin-top: 30px;
        padding-top: 10px;
        border-top: 1px solid #d1d5db;
        text-align: center;
        font-size: 10.5px;
        color: #6b7280;
        page-break-inside: avoid;
    }
}
