* {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

body {
    margin: 0;
    font-family: Arial, Helvetica, sans-serif;
    background: #f4f5fb;
    color: #1f2937;
    overflow-x: hidden;
    min-height: 100vh;
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
    padding-bottom: env(safe-area-inset-bottom);
}

a {
    color: inherit;
    text-decoration: none;
}

.app-shell,
.page-wrap {
    width: min(1280px, calc(100% - 32px));
    margin: 24px auto;
}

.app-shell {
    display: grid;
    grid-template-columns: 360px 1fr;
    gap: 24px;
}

.sidebar,
.content,
.main-column,
.side-column {
    min-width: 0;
}

.card {
    background: #fff;
    border: 1px solid #ececf3;
    border-radius: 20px;
    box-shadow: 0 12px 30px rgba(96, 76, 175, 0.08);
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.eyebrow {
    margin: 0 0 8px;
    color: #7c3aed;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.brand-mark {
    width: 56px;
    height: 56px;
    border-radius: 18px;
    display: grid;
    place-items: center;
    margin-bottom: 14px;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
    font-size: 22px;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(109, 40, 217, 0.25);
}

.small-brand {
    width: 36px;
    height: 36px;
    margin-bottom: 0;
    border-radius: 12px;
    font-size: 14px;
}

h1, h2, h3 {
    margin: 0;
}

.muted {
    color: #6b7280;
}

.form-stack {
    padding: 20px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.section-title-row,
.page-header,
.contact-top,
.section-head,
.top-actions,
.actions-right,
.header-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-wrap: wrap;
}

.brand-inline {
    display: inline-flex;
    align-items: center;
    gap: 12px;
}

label,
.field-label {
    display: block;
    font-size: 14px;
    font-weight: 700;
    color: #374151;
}

input,
select,
textarea {
    width: 100%;
    margin-top: 8px;
    padding: 12px 14px;
    border: 1px solid #d9ddea;
    border-radius: 14px;
    font-size: 14px;
    background: #fff;
}

textarea {
    resize: vertical;
}

.grid-two,
.summary-grid,
.layout-grid,
.stats-row {
    display: grid;
    gap: 16px;
}

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

.stats-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    margin: 24px 0;
}

.layout-grid {
    grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr);
    align-items: start;
}

.btn {
    border: 0;
    border-radius: 14px;
    padding: 12px 18px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.btn-primary {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
}

.btn-secondary {
    background: #fff;
    color: #4b5563;
    border: 1px solid #ddd6fe;
}

.btn-danger {
    background: #fff1f2;
    color: #be123c;
    border: 1px solid #fecdd3;
}

.pill,
.badge {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 12px;
    font-weight: 700;
}

.pill {
    background: #f3e8ff;
    color: #7c3aed;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.cards-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 18px;
}

.contact-card,
.empty-state {
    padding: 20px;
}

.contact-card:hover {
    transform: translateY(-2px);
    transition: 0.2s ease;
}

.label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    color: #6b7280;
}

.credit,
.credit-text {
    color: #7c3aed;
}

.payment,
.payment-text {
    color: #16a34a;
}

.search-bar {
    display: flex;
    gap: 10px;
}

.search-bar input {
    margin-top: 0;
    min-width: 280px;
}

.profile-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 20px;
    flex-wrap: wrap;
}

.profile-main {
    display: flex;
    align-items: center;
    gap: 18px;
}

.profile-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.btn-whatsapp {
    background: #22c55e;
    color: #fff;
    border: 1px solid #16a34a;
}

.btn-whatsapp:hover {
    background: #16a34a;
}

.whatsapp-note {
    font-size: 13px;
    max-width: 220px;
    text-align: right;
}

.avatar-circle {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: #8b5cf6;
    color: #fff;
    font-weight: 700;
}

.summary-card {
    padding: 18px 20px;
}

.summary-card span {
    display: block;
    margin-bottom: 10px;
    color: #6b7280;
    font-size: 13px;
}

.summary-card strong {
    font-size: 28px;
}

.border-purple { border-left: 4px solid #8b5cf6; }
.border-green { border-left: 4px solid #22c55e; }
.border-red { border-left: 4px solid #ef4444; }
.border-blue { border-left: 4px solid #06b6d4; }

.radio-row {
    display: flex;
    flex-wrap: wrap;
    gap: 16px;
    margin-top: 10px;
}

.radio-option {
    font-weight: 700;
}

.table-card {
    margin-top: 18px;
    overflow: hidden;
}

.ledger-table-wrap {
    overflow: hidden;
}

.ledger-scroll-hint {
    display: none;
    margin: 0 0 10px;
    font-size: 12px;
}

.ledger-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

.ledger-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

.ledger-actions {
    white-space: nowrap;
    width: 72px;
    vertical-align: middle;
}

.ledger-del-btn {
    min-width: 56px;
}

.table-scroll {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

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

th,
td {
    padding: 16px;
    text-align: left;
    border-bottom: 1px solid #eef0f7;
    vertical-align: top;
}

th {
    font-size: 12px;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.badge-credit {
    background: #fee2e2;
    color: #dc2626;
}

.badge-payment {
    background: #dcfce7;
    color: #16a34a;
}

.actions-cell {
    width: 60px;
}

.icon-btn {
    width: 30px;
    height: 30px;
    border-radius: 10px;
    display: inline-grid;
    place-items: center;
    border: 1px solid #fecaca;
    color: #dc2626;
}

.info-card {
    padding: 20px;
    margin-bottom: 18px;
}

.info-list {
    margin: 18px 0 0;
}

.info-list div {
    display: grid;
    grid-template-columns: 90px 1fr;
    gap: 12px;
    padding: 8px 0;
}

.info-list dt {
    color: #6b7280;
}

.empty-table {
    text-align: center;
    color: #6b7280;
}

.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
}

.narrow-wrap {
    width: min(920px, calc(100% - 32px));
}

.bill-form {
    padding: 24px;
}

.bill-grid {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 140px 160px 180px;
    gap: 16px;
}

.bill-row {
    align-items: end;
    margin-bottom: 12px;
}

.row-remove-wrap {
    display: flex;
    align-items: end;
}

.formula-box {
    padding: 14px 16px;
    border-radius: 14px;
    background: #f5f3ff;
    color: #5b21b6;
    font-size: 14px;
}

.grand-total-text {
    margin-top: 10px;
}

.compact-form {
    padding: 0;
    margin-top: 18px;
}

.alert-error {
    margin-top: 18px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #fff1f2;
    color: #be123c;
    border: 1px solid #fecdd3;
    font-size: 14px;
    font-weight: 700;
}

.bill-body {
    background: #eef0f7;
}

.invoice-sheet {
    background: #fff;
    border-radius: 24px;
    padding: 32px;
    box-shadow: 0 18px 40px rgba(17, 24, 39, 0.08);
}

.invoice-header,
.invoice-customer,
.invoice-footer {
    display: flex;
    justify-content: space-between;
    gap: 20px;
}

.invoice-header {
    align-items: start;
    padding-bottom: 20px;
    border-bottom: 2px solid #ede9fe;
}

.invoice-company {
    margin-top: 0;
    font-size: 34px;
}

.company-phone {
    margin: 8px 0 0;
    color: #374151;
    font-size: 15px;
    font-weight: 700;
}

.invoice-meta {
    min-width: 240px;
    display: grid;
    gap: 12px;
}

.invoice-meta span,
.invoice-customer span,
.invoice-footer span {
    display: block;
    margin-bottom: 6px;
    color: #6b7280;
    font-size: 13px;
}

.invoice-customer {
    padding: 20px 0;
}

.invoice-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 8px;
}

.invoice-table th,
.invoice-table td,
.invoice-table tfoot td {
    border: 1px solid #d1d5db;
    padding: 14px;
}

.invoice-table tfoot td {
    font-weight: 700;
}

.invoice-formula {
    margin-top: 22px;
    padding: 16px;
    border-radius: 16px;
    background: #f9fafb;
}

.formula-line + .formula-line {
    margin-top: 8px;
}

.invoice-footer {
    margin-top: 48px;
    justify-content: flex-end;
}

.signature-block {
    text-align: right;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
}

.signature-line {
    width: 180px;
    border-bottom: 2px solid #111827;
    margin-top: 36px;
}

.btn-small {
    padding: 8px 12px;
    font-size: 12px;
}

.invoice-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}

.inline-delete-form {
    display: inline-flex;
    margin: 0;
}

@page {
    size: auto;
    margin: 12mm;
}

@media print {
    .no-print,
    .print-hint {
        display: none !important;
    }

    body,
    .bill-body,
    html {
        background: #fff;
        margin: 0;
        padding: 0;
    }

    .page-wrap {
        width: 100%;
        margin: 0;
        padding: 0;
    }

    .invoice-sheet {
        box-shadow: none;
        border-radius: 0;
        padding: 0;
    }

    .invoice-sheet.invoice-template-thermal {
        width: 80mm;
        max-width: 80mm;
        margin: 0 auto;
        padding: 2mm;
    }
}

.print-hint {
    margin: 10px 0 0;
    font-size: 13px;
    max-width: 420px;
    text-align: right;
}

.print-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
    display: grid;
    place-items: center;
    padding: 20px;
    z-index: 1000;
}

.print-modal[hidden] {
    display: none;
}

.print-modal-card {
    width: min(100%, 520px);
    padding: 24px;
}

.print-modal-card h2 {
    margin-bottom: 12px;
}

.print-steps {
    margin: 16px 0 20px;
    padding-left: 20px;
    line-height: 1.7;
}

.print-modal-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
}

.print-only-body {
    margin: 0;
    background: #fff;
}

.print-only-sheet {
    width: min(900px, calc(100% - 32px));
    margin: 24px auto;
    box-shadow: none;
    border-radius: 0;
}

@media (max-width: 980px) {
    .app-shell,
    .layout-grid,
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .search-bar,
    .page-header,
    .section-title-row,
    .header-actions,
    .invoice-header,
    .invoice-customer,
    .invoice-footer {
        flex-direction: column;
        align-items: stretch;
    }

    .search-bar input {
        min-width: 0;
    }

    .bill-grid {
        grid-template-columns: 1fr 1fr;
    }

    .header-actions .btn,
    .header-actions .search-bar,
    .header-actions form {
        width: 100%;
    }

    .search-bar {
        flex-direction: column;
    }

    .table-card {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .table-card table:not(.ledger-table) {
        min-width: 560px;
    }

    /* Keep ledger as a normal table; pin Delete on the left so it always shows */
    .ledger-table-wrap {
        overflow: hidden;
    }

    .ledger-scroll-hint {
        display: block;
    }

    .ledger-scroll {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }

    .ledger-table {
        min-width: 640px;
        width: 100%;
    }

    .ledger-table th.ledger-actions,
    .ledger-table td.ledger-actions {
        position: sticky;
        left: 0;
        z-index: 3;
        background: #fff;
        box-shadow: 4px 0 8px rgba(17, 24, 39, 0.08);
        padding-left: 8px;
        padding-right: 8px;
    }

    .ledger-table thead th.ledger-actions {
        z-index: 4;
        background: #fff;
    }

    .ledger-del-btn {
        min-height: 40px;
        min-width: 56px;
        padding: 8px 12px;
    }

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

@media (max-width: 640px) {
    .grid-two,
    .stats-row,
    .bill-grid {
        grid-template-columns: 1fr;
    }

    .app-shell,
    .page-wrap,
    .narrow-wrap {
        width: calc(100% - 16px);
        margin: 8px auto 16px;
    }

    input,
    select,
    textarea {
        font-size: 16px;
    }

    .btn {
        min-height: 44px;
    }

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

    .summary-card strong {
        font-size: 22px;
    }

    .profile-header,
    .profile-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .profile-actions .btn {
        width: 100%;
    }

    .whatsapp-note {
        max-width: none;
        text-align: left;
    }

    .top-actions {
        flex-direction: column;
        align-items: stretch;
    }

    .top-actions .btn {
        width: 100%;
        justify-content: center;
    }

    .invoice-company {
        font-size: 24px;
    }

    .invoice-sheet {
        padding: 16px;
        border-radius: 16px;
    }

    .invoice-meta {
        min-width: 0;
        width: 100%;
    }

    .cards-grid {
        grid-template-columns: 1fr;
    }

    .form-stack,
    .bill-form {
        padding: 14px;
    }

    .card {
        border-radius: 14px;
    }

    th,
    td {
        padding: 10px 8px;
        font-size: 13px;
    }

    .bill-row {
        padding: 12px;
        border: 1px solid #ececf3;
        border-radius: 14px;
        margin-bottom: 12px;
    }

    .row-remove-wrap {
        width: 100%;
    }

    .row-remove-wrap .btn {
        width: 100%;
    }

    h1 {
        font-size: 1.45rem;
    }

    h2 {
        font-size: 1.2rem;
    }

    th:nth-child(7),
    td:nth-child(7) {
        display: none;
    }
}

@media (max-width: 400px) {
    .summary-grid {
        grid-template-columns: 1fr;
    }

    .app-shell,
    .page-wrap,
    .narrow-wrap {
        width: calc(100% - 12px);
        margin: 6px auto 12px;
    }

    .login-shell {
        padding: 12px;
    }
}

.dashboard-body {
    background: #f4f5fb;
}

.dashboard-shell {
    width: min(720px, calc(100% - 24px));
    margin: 0 auto;
    padding: 20px 0 32px;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.clock-card {
    text-align: center;
    padding: 28px 20px;
}

.clock-time {
    font-size: clamp(2.4rem, 10vw, 3.5rem);
    font-weight: 700;
    letter-spacing: 0.04em;
    color: #0f766e;
    line-height: 1.1;
    font-variant-numeric: tabular-nums;
}

.clock-date {
    margin-top: 10px;
    color: #6b7280;
    font-size: 1rem;
}

.module-section {
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.module-label {
    margin: 0;
}

.module-page-title {
    margin: 0 0 4px;
    font-size: 1.35rem;
}

.module-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.module-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 24px 16px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.module-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(109, 40, 217, 0.14);
}

.module-card h2 {
    margin-top: 14px;
    font-size: 1.15rem;
}

.module-card p {
    margin: 8px 0 0;
    font-size: 0.9rem;
    line-height: 1.4;
}

.module-icon {
    width: 72px;
    height: 72px;
    border-radius: 22px;
    display: grid;
    place-items: center;
    color: #fff;
    font-size: 1.6rem;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(17, 24, 39, 0.12);
}

.module-icon-book {
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
}

.module-icon-bill {
    background: linear-gradient(135deg, #06b6d4, #0891b2);
}

.module-icon-invoices {
    background: linear-gradient(135deg, #22c55e, #16a34a);
    font-size: 1.35rem;
}

.module-icon-vendors {
    background: linear-gradient(135deg, #f59e0b, #d97706);
}

.module-grid-three {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.vendor-card {
    padding: 18px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.vendor-card-top,
.vendor-preview-top {
    display: flex;
    align-items: center;
    gap: 14px;
}

.vendor-logo-thumb {
    width: 56px;
    height: 56px;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid #ececf3;
    background: #fff;
}

.vendor-logo-placeholder {
    width: 56px;
    height: 56px;
    border-radius: 14px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
    font-weight: 700;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.vendor-address {
    font-size: 0.9rem;
    line-height: 1.5;
    margin: 0;
}

.vendor-card-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.vendor-bill-preview {
    padding: 16px;
    background: #fafaff;
}

.vendor-preview-logo {
    text-align: center;
}

.vendor-preview-logo img {
    max-width: 120px;
    max-height: 80px;
    object-fit: contain;
}

.invoice-logo {
    width: auto;
    max-width: 160px;
    max-height: 120px;
    object-fit: contain;
    flex-shrink: 0;
}

.invoice-brand-block {
    display: flex;
    align-items: center;
    gap: 20px;
}

.invoice-top-row {
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    gap: 28px;
    padding-bottom: 20px;
    margin-bottom: 8px;
    border-bottom: 2px solid #ede9fe;
    min-height: 0;
}

.invoice-brand-center {
    text-align: center;
    width: auto;
    max-width: 320px;
    padding: 0;
    flex-shrink: 0;
}

.invoice-logo-classic {
    display: block;
    margin: 0 auto 14px;
    max-width: 200px;
    max-height: 160px;
    width: auto;
    height: auto;
    object-fit: contain;
}

.invoice-company-classic {
    margin: 0;
    font-size: 32px;
    text-align: center;
}

.company-phone-classic,
.company-address-classic {
    text-align: center;
    margin-left: auto;
    margin-right: auto;
}

.invoice-meta-right {
    position: static;
    min-width: 160px;
    text-align: left;
    display: grid;
    gap: 10px;
    flex-shrink: 0;
    padding-top: 8px;
}

.invoice-meta-right span {
    display: block;
    margin-bottom: 4px;
    color: #6b7280;
    font-size: 13px;
}

.invoice-meta-right strong {
    display: block;
}

@media (max-width: 640px) {
    .invoice-top-row {
        flex-direction: column;
        align-items: center;
        gap: 16px;
    }

    .invoice-brand-center {
        max-width: 100%;
    }

    .invoice-meta-right {
        width: 100%;
        text-align: left;
        padding-top: 0;
    }
}

.company-address {
    margin: 8px 0 0;
    color: #4b5563;
    font-size: 14px;
    line-height: 1.5;
}

.invoice-template-modern .invoice-modern-top {
    text-align: center;
    padding-bottom: 16px;
    border-bottom: 2px solid #ede9fe;
}

.invoice-logo-center {
    margin: 0 auto 16px;
    display: block;
    max-width: 180px;
    max-height: 130px;
}

.invoice-company-center {
    font-size: 28px;
    text-align: center;
}

.company-phone-center,
.company-address-center {
    text-align: center;
}

.invoice-modern-banner {
    margin: 18px 0;
    padding: 10px;
    text-align: center;
    background: linear-gradient(135deg, #8b5cf6, #6d28d9);
    color: #fff;
    font-weight: 700;
    letter-spacing: 0.2em;
    border-radius: 10px;
}

.invoice-modern-meta-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.invoice-modern-meta-grid div {
    padding: 10px 12px;
    background: #f9fafb;
    border-radius: 12px;
}

.invoice-table-modern thead th {
    background: #7c3aed;
    color: #fff;
    border-color: #7c3aed;
}

.invoice-footer-modern {
    margin-top: 36px;
}

.invoice-template-retail .invoice-retail-header {
    display: flex;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
    padding-bottom: 16px;
    border-bottom: 2px solid #111827;
}

.invoice-retail-brand {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    flex: 1;
    min-width: 220px;
}

.invoice-logo-retail {
    margin-bottom: 0;
    max-width: 150px;
    max-height: 110px;
}

.invoice-retail-box {
    min-width: 220px;
    border: 2px solid #111827;
    border-radius: 8px;
    overflow: hidden;
}

.invoice-retail-title {
    background: #111827;
    color: #fff;
    text-align: center;
    padding: 8px;
    font-weight: 700;
    letter-spacing: 0.08em;
}

.invoice-retail-meta {
    padding: 12px;
    display: grid;
    gap: 8px;
}

.invoice-retail-meta span {
    display: block;
    font-size: 12px;
    color: #6b7280;
}

.invoice-retail-customer {
    margin: 16px 0;
    padding: 12px 14px;
    background: #f3f4f6;
    border-radius: 10px;
}

.invoice-retail-customer span {
    display: block;
    font-size: 12px;
    color: #6b7280;
    margin-bottom: 4px;
}

.invoice-table-retail thead th {
    background: #f3f4f6;
}

.invoice-retail-footer {
    margin-top: 28px;
    display: flex;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    align-items: flex-end;
}

/* Thermal receipt — 80mm POS printer */
.invoice-template-thermal {
    width: 80mm;
    max-width: 80mm;
    margin: 0 auto;
    padding: 8px 6px;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.08);
    font-family: "Courier New", Courier, monospace;
    color: #111827;
}

.thermal-receipt {
    width: 100%;
}

.thermal-header {
    text-align: center;
}

.thermal-logo {
    display: block;
    margin: 0 auto 8px;
    max-width: 48mm;
    max-height: 32mm;
    width: auto;
    height: auto;
    object-fit: contain;
}

.thermal-company {
    margin: 0;
    font-size: 20px;
    font-weight: 700;
    line-height: 1.25;
    letter-spacing: 0;
    transform: none;
    font-family: "Courier New", Courier, monospace;
}

.thermal-address,
.thermal-phone {
    margin: 4px 0 0;
    font-size: 13px;
    line-height: 1.4;
    color: #111827;
}

/* Always solid — never dashed character rules */
.thermal-receipt hr.thermal-divider,
.thermal-divider {
    display: block;
    border: 0 !important;
    border-top: 2px solid #111827 !important;
    border-style: solid !important;
    height: 0;
    margin: 8px 0;
    background: none;
}

.thermal-receipt hr.thermal-divider-double,
.thermal-divider-double {
    border: 0 !important;
    border-top: 3px solid #111827 !important;
    border-style: solid !important;
    height: 0;
    margin: 10px 0 8px;
}

.thermal-meta {
    display: grid;
    gap: 3px;
}

.thermal-meta-row {
    display: flex;
    justify-content: space-between;
    gap: 8px;
    font-size: 13px;
    line-height: 1.4;
    width: 100%;
}

.thermal-meta-row span {
    flex-shrink: 0;
    color: #111827;
}

.thermal-meta-row strong {
    text-align: right;
    word-break: break-word;
    font-weight: 700;
}

.thermal-meta-line {
    font-size: 12px;
    line-height: 1.4;
    text-align: left;
    word-break: break-word;
}

.thermal-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
    font-size: 13px;
    font-family: "Courier New", Courier, monospace;
    font-variant-numeric: tabular-nums;
    border: none;
}

.thermal-table th,
.thermal-table td {
    border: none !important;
    border-bottom: none !important;
    border-top: none !important;
    padding: 4px 4px !important;
    vertical-align: top;
    color: #111827;
    text-transform: none;
    letter-spacing: 0;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.35;
}

.thermal-table thead th {
    border-bottom: 2px solid #111827 !important;
    padding-bottom: 5px !important;
    font-size: 13px;
    font-weight: 700;
    color: #111827;
    text-align: left;
    background: transparent;
}

.thermal-table tbody tr + tr td {
    padding-top: 3px !important;
}

.thermal-col-item {
    text-align: left;
    width: 40%;
    word-break: break-word;
    padding-left: 2px !important;
}

/* Column lines only — no horizontal lines between item rows */
.thermal-table thead th.thermal-col-qty,
.thermal-table thead th.thermal-col-rate,
.thermal-table thead th.thermal-col-amt,
.thermal-table tbody td.thermal-col-qty,
.thermal-table tbody td.thermal-col-rate,
.thermal-table tbody td.thermal-col-amt {
    text-align: right;
    white-space: nowrap;
    border-left: 1px solid #111827 !important;
}

.thermal-col-qty {
    width: 15%;
}

.thermal-col-rate {
    width: 20%;
}

.thermal-col-amt {
    width: 25%;
    padding-right: 2px !important;
}

.thermal-total {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-family: "Courier New", Courier, monospace;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    letter-spacing: 0;
    transform: none;
    padding: 2px 0;
}

.thermal-total span,
.thermal-total strong {
    font-family: inherit;
    font-size: inherit;
    font-weight: 700;
    font-style: normal;
}

.thermal-thanks {
    margin: 8px 0 0;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: #111827;
}

.thermal-footer-note {
    margin: 4px 0 0;
    text-align: center;
    font-size: 12px;
    color: #111827;
    line-height: 1.35;
}

.thermal-items-grid {
    margin: 0;
    padding: 0;
    width: 100%;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: visible;
    font-family: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
    font-size: 12px;
    line-height: 1.4;
    letter-spacing: 0;
    transform: none;
    white-space: pre;
    color: #111827;
    background: transparent;
    border: none;
    box-sizing: border-box;
}



.thermal-print-body .invoice-template-thermal {
    margin: 12px auto;
    box-shadow: none;
    border-radius: 0;
}

@media print {
    .thermal-print-body table.thermal-table th,
    .thermal-print-body table.thermal-table td {
        border-bottom: none !important;
        border-top: none !important;
    }

    .thermal-print-body table.thermal-table thead th {
        border-bottom: 1px solid #111827 !important;
    }

    .thermal-print-body table.thermal-table td.thermal-col-qty,
    .thermal-print-body table.thermal-table td.thermal-col-rate,
    .thermal-print-body table.thermal-table td.thermal-col-amt,
    .thermal-print-body table.thermal-table th.thermal-col-qty,
    .thermal-print-body table.thermal-table th.thermal-col-rate,
    .thermal-print-body table.thermal-table th.thermal-col-amt {
        border-left: 1px solid #111827 !important;
    }

    .thermal-print-body {
        width: 80mm;
        margin: 0;
        padding: 0;
    }

    .thermal-print-body.is-paper-58 {
        width: 58mm;
    }

    .thermal-print-body .invoice-template-thermal,
    body.thermal-print-body .invoice-sheet.invoice-template-thermal {
        width: 100%;
        max-width: 100%;
        margin: 0;
        padding: 0;
        box-shadow: none;
        border-radius: 0;
    }

    .thermal-print-body.is-paper-58 .invoice-template-thermal,
    body.thermal-print-body.is-paper-58 .invoice-sheet.invoice-template-thermal {
        width: 58mm;
        max-width: 58mm;
    }
}

body.thermal-print-body {
    background: #fff;
}

@page thermal {
    size: 80mm auto;
    margin: 0;
}

@page thermal58 {
    size: 58mm auto;
    margin: 0;
}

body.thermal-print-body {
    page: thermal;
}

body.thermal-print-body.is-paper-58 {
    page: thermal58;
}

.thermal-print-toolbar {
    width: min(420px, calc(100% - 24px));
    margin: 12px auto 16px;
    padding: 14px;
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 16px;
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.06);
}

.thermal-print-toolbar-inner {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.thermal-print-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: #374151;
}

.thermal-settings-link {
    color: #6d28d9;
    font-weight: 600;
    text-decoration: none;
}

.thermal-print-actions {
    display: grid;
    gap: 8px;
    margin-top: 12px;
}

.thermal-print-status {
    margin: 10px 0 0;
    font-size: 13px;
    min-height: 1.2em;
}

.thermal-print-status.is-error {
    color: #be123c;
    font-weight: 600;
}

.printer-status-row {
    display: flex;
    gap: 12px;
    align-items: flex-start;
    padding: 12px 14px;
    border-radius: 14px;
    background: #f9fafb;
    margin-bottom: 8px;
}

.printer-status-dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-top: 5px;
    flex-shrink: 0;
    background: #9ca3af;
}

.printer-status-dot.is-online {
    background: #16a34a;
    box-shadow: 0 0 0 4px rgba(22, 163, 74, 0.15);
}

.printer-status-dot.is-offline {
    background: #f59e0b;
}

.checkbox-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center;
    gap: 10px;
}

.checkbox-row input {
    width: auto;
}

.agent-config-box {
    margin: 0;
    padding: 12px 14px;
    border-radius: 12px;
    background: #0f172a;
    color: #e2e8f0;
    font-size: 12px;
    overflow-x: auto;
    line-height: 1.5;
}



@media (max-width: 640px) {
    .module-grid {
        grid-template-columns: 1fr;
    }

    .module-grid-three {
        grid-template-columns: 1fr;
    }

    .module-grid-two-two {
        grid-template-columns: 1fr;
    }

    .dashboard-shell {
        width: calc(100% - 16px);
        padding: 12px 0 24px;
    }

    .clock-card {
        padding: 22px 16px;
    }

    .inline-edit-grid {
        grid-template-columns: 1fr;
    }

    .grid-three {
        grid-template-columns: 1fr;
    }

    .quotation-create-wrap {
        width: min(100%, calc(100% - 16px));
    }
}

.module-icon-quote {
    background: linear-gradient(135deg, #ec4899, #db2777);
}

.module-icon-ingredients {
    background: linear-gradient(135deg, #14b8a6, #0d9488);
}

.module-icon-products {
    background: linear-gradient(135deg, #6366f1, #4f46e5);
}

.module-icon-recipes {
    background: linear-gradient(135deg, #f97316, #ea580c);
}

.module-grid-two-two {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.inline-edit-grid {
    display: grid;
    grid-template-columns: 1.4fr 0.7fr 0.8fr auto;
    gap: 8px;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid #ececf3;
}

.inline-edit-actions {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.inline-qty-form {
    display: flex;
    gap: 6px;
    align-items: center;
}

.grid-three {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
}

.quote-lines {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.quote-line {
    padding: 12px;
    background: #f8f7ff;
    border-radius: 14px;
    border: 1px solid #ececf3;
}

.quote-line .line-cost-hint {
    grid-column: 1 / -1;
    margin: 0;
}

.qty-with-remove {
    display: flex;
    gap: 8px;
    align-items: center;
}

.quote-totals {
    padding: 16px;
    background: #faf9ff;
    border: 1px solid #ececf3;
    border-radius: 16px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.quote-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.quote-total-row em {
    font-style: normal;
    color: #6b7280;
    font-size: 0.85rem;
}

.quote-grand {
    margin-top: 6px;
    padding-top: 10px;
    border-top: 2px solid #ddd6fe;
    font-size: 1.05rem;
}

.quotation-create-wrap {
    width: min(760px, calc(100% - 32px));
}

.alert-error {
    color: #b91c1c;
    background: #fef2f2;
    border-color: #fecaca;
}

/* ========== Auth + Home dashboard (modern shell) ========== */
:root {
    --ink: #102a43;
    --ink-soft: #486581;
    --paper: #f5f7fb;
    --foam: #ffffff;
    --mint: #0f9f6e;
    --mint-soft: #d8f3e7;
    --coral: #e11d48;
    --coral-soft: #ffe4e8;
    --sky: #0284c7;
    --sky-soft: #e0f2fe;
    --slate: #475569;
    --slate-soft: #e2e8f0;
    --line: rgba(16, 42, 67, 0.12);
    --font-display: "Sora", "Segoe UI", sans-serif;
    --font-body: "Plus Jakarta Sans", "Segoe UI", sans-serif;
    --radius: 16px;
    --touch: 48px;
}

.auth-body,
.home-body,
.dash-body {
    font-family: var(--font-body);
    color: var(--ink);
    background: var(--paper);
    -webkit-font-smoothing: antialiased;
}

.auth-stage,
.home,
.dash-stage {
    position: relative;
    min-height: 100vh;
    min-height: 100dvh;
    isolation: isolate;
}

.auth-backdrop,
.home-bg,
.dash-backdrop {
    position: absolute;
    inset: 0;
    z-index: -1;
    background:
        radial-gradient(ellipse 70% 50% at 0% 0%, rgba(15, 159, 110, 0.16), transparent 55%),
        radial-gradient(ellipse 60% 45% at 100% 0%, rgba(2, 132, 199, 0.14), transparent 50%),
        radial-gradient(ellipse 50% 40% at 80% 100%, rgba(225, 29, 72, 0.08), transparent 55%),
        linear-gradient(180deg, #eef3f9 0%, #f5f7fb 45%, #edf2f7 100%);
}

.auth-panel {
    width: min(420px, calc(100% - 28px));
    margin: 0 auto;
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 18px;
    padding: max(28px, env(safe-area-inset-top)) 0 max(32px, env(safe-area-inset-bottom));
}

.auth-brand-name {
    margin: 0 0 6px;
    font-family: var(--font-display);
    font-size: clamp(1.7rem, 7vw, 2.4rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.auth-product {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--mint);
}

.auth-tagline {
    margin: 10px 0 0;
    color: var(--ink-soft);
    font-size: 0.95rem;
    line-height: 1.5;
    max-width: 32ch;
}

.auth-alert {
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid #fecdd3;
    background: #fff1f2;
    color: #9f1239;
    font-weight: 600;
    font-size: 0.9rem;
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 18px 16px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.82);
    backdrop-filter: blur(10px);
}

.auth-field span {
    display: block;
    margin-bottom: 7px;
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--ink-soft);
}

.auth-field input {
    width: 100%;
    margin: 0;
    min-height: var(--touch);
    padding: 12px 14px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
    color: var(--ink);
    font: inherit;
    font-size: 1rem;
}

.auth-field input:focus {
    outline: none;
    border-color: var(--mint);
    box-shadow: 0 0 0 3px rgba(15, 159, 110, 0.16);
}

.auth-submit {
    min-height: var(--touch);
    border: 0;
    border-radius: 12px;
    background: linear-gradient(135deg, #102a43, #243b53);
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.auth-submit:hover { background: linear-gradient(135deg, #0f9f6e, #0b7a55); }

/* ---- Home dashboard ---- */
.home {
    width: min(980px, calc(100% - 28px));
    margin: 0 auto;
    padding: max(20px, env(safe-area-inset-top)) 0 max(40px, env(safe-area-inset-bottom));
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.home-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
}

.home-brand {
    margin: 0;
    font-family: var(--font-display);
    font-size: clamp(1.55rem, 6.5vw, 2.2rem);
    font-weight: 800;
    letter-spacing: -0.04em;
    line-height: 1.05;
}

.home-title {
    margin: 4px 0 0;
    font-family: var(--font-display);
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--mint);
}

.home-hello {
    margin: 8px 0 0;
    color: var(--ink-soft);
    font-size: 0.95rem;
}

.home-out {
    min-height: 42px;
    padding: 10px 14px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.75);
    color: var(--ink-soft);
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.home-out:hover {
    background: var(--ink);
    color: #fff;
    border-color: var(--ink);
}

.home-stats {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.stat {
    position: relative;
    padding: 16px 14px;
    border-radius: var(--radius);
    border: 1px solid transparent;
    overflow: hidden;
    background: #fff;
}

.stat::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
}

.stat-lena { background: linear-gradient(180deg, #fff, var(--mint-soft)); border-color: rgba(15,159,110,.18); }
.stat-lena::before { background: var(--mint); }
.stat-dena { background: linear-gradient(180deg, #fff, var(--coral-soft)); border-color: rgba(225,29,72,.16); }
.stat-dena::before { background: var(--coral); }
.stat-pending { background: linear-gradient(180deg, #fff, var(--sky-soft)); border-color: rgba(2,132,199,.16); }
.stat-pending::before { background: var(--sky); }
.stat-closed { background: linear-gradient(180deg, #fff, var(--slate-soft)); border-color: rgba(71,85,105,.16); }
.stat-closed::before { background: var(--slate); }

.stat-label {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--ink-soft);
}

.stat-value {
    margin: 8px 0 0;
    font-family: var(--font-display);
    font-size: clamp(1.35rem, 5.5vw, 1.85rem);
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: var(--ink);
    font-variant-numeric: tabular-nums;
}

.stat-hint {
    margin: 6px 0 0;
    font-size: 0.78rem;
    color: var(--ink-soft);
    line-height: 1.35;
}

.home-section-head h2 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.15rem;
    font-weight: 700;
}

.home-section-head p {
    margin: 4px 0 0;
    color: var(--ink-soft);
    font-size: 0.9rem;
}

.home-grid {
    margin-top: 12px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
}

.mod {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-height: 132px;
    padding: 16px 14px;
    border-radius: var(--radius);
    border: 1px solid var(--line);
    background: rgba(255,255,255,0.88);
    transition: transform .18s ease, border-color .18s ease, background .18s ease;
}

.mod:hover,
.mod:active {
    transform: translateY(-2px);
    border-color: rgba(16,42,67,.22);
    background: #fff;
}

.mod-kicker {
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: .12em;
    text-transform: uppercase;
}

.mod-contacts .mod-kicker { color: #0369a1; }
.mod-credit .mod-kicker { color: var(--mint); }
.mod-bill .mod-kicker { color: #b45309; }
.mod-quote .mod-kicker { color: #0e7490; }
.mod-payroll .mod-kicker { color: #047857; }

.mod h3 {
    margin: 0;
    font-family: var(--font-display);
    font-size: 1.1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.mod p {
    margin: 0;
    color: var(--ink-soft);
    font-size: 0.86rem;
    line-height: 1.4;
}

.mod-meta {
    margin-top: auto;
    padding-top: 8px;
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--ink);
}

[data-reveal] {
    opacity: 0;
    transform: translateY(12px);
    transition: opacity .5s ease, transform .5s ease;
    transition-delay: var(--d, 0ms);
}
[data-reveal].is-in {
    opacity: 1;
    transform: none;
}

@media (min-width: 760px) {
    .home { gap: 26px; padding-top: 32px; }
    .home-stats { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
    .home-grid { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
    .stat-value { font-size: 1.7rem; }
    .mod { min-height: 150px; padding: 18px; }
}

@media (max-width: 380px) {
    .home-brand { font-size: 1.45rem; }
    .stat-value { font-size: 1.2rem; }
    .home-grid { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
    [data-reveal] { opacity: 1; transform: none; transition: none; }
}

/* ========== Employees Payroll ========== */
.alert-success {
    margin: 0 0 16px;
    padding: 12px 14px;
    border-radius: 14px;
    background: #ecfdf5;
    color: #047857;
    border: 1px solid #a7f3d0;
    font-size: 14px;
    font-weight: 700;
}

.top-actions-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.department-list {
    padding: 0 18px 18px;
    border-top: 1px solid #ececf3;
}

.department-list-title {
    margin: 14px 0 8px;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: #6b7280;
}

.department-list ul {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.department-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    background: #f8fafc;
    font-weight: 700;
}

.payroll-card {
    padding: 18px;
}

.payroll-card .section-head {
    margin-bottom: 14px;
    align-items: flex-start;
}

.payroll-card .section-head h2 {
    margin: 0 0 4px;
}

.payroll-toolbar {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.month-filter {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin: 0;
    font-size: 12px;
    font-weight: 700;
    color: #6b7280;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.month-filter input[type="month"] {
    margin-top: 0;
    min-width: 170px;
    padding: 10px 12px;
}

.payroll-save-status {
    min-height: 1.2em;
    margin: 0 0 10px;
    font-size: 13px;
    font-weight: 700;
    color: #6b7280;
}

.payroll-save-status.is-ok { color: #047857; }
.payroll-save-status.is-error { color: #be123c; }

a.btn.is-disabled {
    pointer-events: none;
    opacity: 0.55;
}

.payroll-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.payroll-table th,
.payroll-table td {
    padding: 12px 10px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
    vertical-align: middle;
}

.payroll-table th {
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #6b7280;
}

.payroll-table tfoot td {
    font-weight: 700;
    border-bottom: 0;
    background: #f8fafc;
}

.payroll-table .empty-row {
    text-align: center;
    color: #6b7280;
    padding: 28px 12px;
}

.working-days-input,
.money-input {
    width: 96px;
    margin-top: 0;
    padding: 10px 12px;
    text-align: center;
}

.money-input {
    width: 110px;
    text-align: right;
}

.btn-sm {
    padding: 8px 12px;
    font-size: 12px;
    border-radius: 10px;
}

.row-actions {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.department-row td {
    background: #eef2ff;
    border-bottom: 1px solid #c7d2fe;
    padding-top: 14px;
    padding-bottom: 14px;
}

.department-label {
    font-weight: 800;
    color: #312e81;
    font-size: 0.95rem;
    letter-spacing: 0.02em;
}

.department-count {
    margin-left: 10px;
    font-size: 12px;
    font-weight: 700;
    color: #6366f1;
}

.hidden-form {
    display: none;
}

.modal-backdrop {
    position: fixed;
    inset: 0;
    z-index: 80;
    display: grid;
    place-items: center;
    padding: 20px;
    background: rgba(16, 42, 67, 0.45);
}

.modal-backdrop[hidden] {
    display: none !important;
}

.modal-card {
    width: min(440px, 100%);
    padding: 0;
    overflow: hidden;
}

.modal-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid #ececf3;
}

.modal-head h2 {
    margin: 0;
    font-size: 1.15rem;
}

.modal-close {
    border: 0;
    background: transparent;
    font-size: 28px;
    line-height: 1;
    cursor: pointer;
    color: #6b7280;
}

.modal-form {
    padding: 18px;
}

.modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    flex-wrap: wrap;
}

.form-hint {
    margin: 0;
    font-size: 13px;
}

@media (max-width: 760px) {
    .payroll-table thead {
        display: none;
    }

    .payroll-table tr {
        display: grid;
        gap: 8px;
        padding: 14px 0;
        border-bottom: 1px solid #e5e7eb;
    }

    .payroll-table tr.department-row {
        display: block;
        padding: 12px 0;
    }

    .payroll-table tr.department-row td {
        display: block;
    }

    .payroll-table tr.department-row td::before {
        content: none;
    }

    .payroll-table td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        border: 0;
        padding: 0;
    }

    .payroll-table td::before {
        content: attr(data-label);
        font-weight: 700;
        color: #6b7280;
        font-size: 12px;
        text-transform: uppercase;
    }

    .payroll-table td:empty::before,
    .payroll-table .empty-row::before {
        content: none;
    }

    .payroll-table tfoot tr {
        display: grid;
        gap: 6px;
    }

    .row-actions {
        width: 100%;
        justify-content: flex-end;
    }
}

/* Searchable type-to-select (recipes, etc.) */
.searchable-select {
    position: relative;
    width: 100%;
}

.searchable-select-input {
    width: 100%;
}

.searchable-select-list {
    position: absolute;
    z-index: 40;
    left: 0;
    right: 0;
    top: calc(100% + 4px);
    margin: 0;
    padding: 6px;
    list-style: none;
    max-height: 220px;
    overflow: auto;
    background: #fff;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    box-shadow: 0 12px 28px rgba(17, 24, 39, 0.12);
}

.searchable-select.is-open .searchable-select-input {
    border-color: #6366f1;
}

.searchable-select-list li[data-value] {
    padding: 10px 12px;
    border-radius: 8px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.35;
}

.searchable-select-list li[data-value]:hover,
.searchable-select-list li[data-value]:focus {
    background: #eef2ff;
}

.searchable-select-empty {
    padding: 10px 12px;
    color: #6b7280;
    font-size: 13px;
}

