:root {
    --blue: #0b5ed7;
    --blue-dark: #084298;
    --ink: #172033;
    --muted: #667085;
    --line: #d8e0ea;
    --panel: #ffffff;
    --page: #f3f6fb;
    --soft: #eef4ff;
    --danger: #c82333;
    --success: #198754;
    --warning: #fd7e14;
    --purple: #6f42c1;
    --teal: #0f9f8f;
    --dark: #344054;
    --radius: 8px;
    --shadow: 0 10px 28px rgba(16, 24, 40, 0.10);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
    margin: 0;
}

body {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    font-family: Arial, Helvetica, sans-serif;
    background: var(--page);
    color: var(--ink);
}

a {
    color: inherit;
}

button,
input,
select,
textarea {
    font: inherit;
}

.top-strip {
    height: 10px;
    background: linear-gradient(90deg, var(--blue-dark), var(--blue), #19a7ce);
    flex-shrink: 0;
}

.logo-area {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    padding: 12px 28px 14px;
    flex-shrink: 0;
}

.logo-container {
    display: grid;
    grid-template-columns: minmax(420px, 31vw) minmax(0, 1fr);
    align-items: center;
    gap: 44px;
    min-width: 0;
    max-width: 1780px;
    margin: 0 auto;
}

.logo-image {
    width: 100%;
    height: 92px;
    object-fit: contain;
    object-position: center;
    border: 0;
    border-radius: 0;
    flex-shrink: 0;
    background: #ffffff;
}

.company-details {
    min-width: 0;
}

.company-details h1 {
    margin: 0;
    color: #111827;
    font-size: clamp(24px, 1.55vw, 30px);
    line-height: 1.2;
    font-weight: 800;
}

.info-line {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin-top: 10px;
    color: #4b5563;
    font-size: 15px;
    font-weight: 800;
}

.title-bar {
    min-height: 48px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 30px;
    background: var(--blue);
    color: #ffffff;
    flex-shrink: 0;
    box-shadow: 0 6px 16px rgba(11, 94, 215, 0.18);
}

.title-left-section,
.title-right-section {
    display: flex;
    align-items: center;
    gap: 20px;
    min-width: 0;
}

.title-right-section {
    justify-content: flex-end;
}

.title-text {
    min-width: 0;
    font-size: 22px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.title-nav-toggle {
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 0;
    background: transparent;
    display: grid;
    grid-template-columns: repeat(3, 4px);
    grid-template-rows: repeat(3, 4px);
    gap: 6px;
    justify-content: center;
    align-content: center;
    cursor: pointer;
}

.title-nav-toggle:hover {
    background: transparent;
}

.title-nav-toggle span {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #ffffff;
}

.top-user-name {
    max-width: 360px;
    font-size: 18px;
    font-weight: 800;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.top-logout-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 34px;
    padding: 6px 14px;
    border: 1px solid rgba(255, 255, 255, 0.42);
    border-radius: 6px;
    color: #ffffff;
    text-decoration: none;
    font-size: 17px;
    font-weight: 800;
}

.top-logout-btn:hover {
    background: rgba(255, 255, 255, 0.16);
}

.page-container {
    flex: 1;
    min-height: 0;
    padding: 14px;
    background: var(--page);
    overflow: auto;
}

.main-layout.home-layout {
    display: grid;
    grid-template-columns: 236px minmax(0, 1fr);
    gap: 12px;
    min-height: calc(100vh - 155px);
}

.main-layout.inner-layout {
    position: relative;
    min-height: calc(100vh - 155px);
}

.content-area {
    min-width: 0;
    min-height: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.content-layout {
    display: grid;
    grid-template-columns: minmax(360px, 430px) minmax(0, 1fr);
    gap: 12px;
    min-width: 0;
    min-height: 0;
    flex: 1;
}

.dashboard-home-content {
    grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
}

.buyer-page-layout,
.supplier-page-layout {
    grid-template-columns: minmax(480px, 540px) minmax(0, 1fr);
}

.trip-page-layout {
    grid-template-columns: minmax(380px, 450px) minmax(0, 1fr);
}

.trip-expenditure-layout .content-layout {
    grid-template-columns: minmax(400px, 460px) minmax(0, 1fr);
}

.left-panel {
    min-width: 0;
    z-index: 1000;
}

.home-layout .left-panel {
    position: sticky;
    top: 12px;
    align-self: start;
}

.inner-layout .left-panel {
    position: absolute;
    top: 0;
    left: 0;
    width: 236px;
    max-height: calc(100vh - 168px);
    opacity: 0;
    pointer-events: none;
    transform: translateY(-8px);
    transition: opacity 0.18s ease, transform 0.18s ease;
    box-shadow: var(--shadow);
}

.inner-layout.nav-open .left-panel {
    opacity: 1;
    pointer-events: auto;
    transform: translateY(0);
}

.panel-box {
    min-width: 0;
    min-height: 0;
    overflow: auto;
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px;
    box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
}

.middle-panel,
.right-panel {
    min-width: 0;
}

.right-panel {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.section-title {
    margin: 0 0 12px;
    padding-bottom: 9px;
    border-bottom: 1px solid #e7edf5;
    color: var(--blue-dark);
    font-size: 17px;
    line-height: 1.2;
    font-weight: 800;
}

.side-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    min-height: 38px;
    margin-bottom: 7px;
    padding: 8px 10px;
    border-radius: 6px;
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
    border: 1px solid rgba(255, 255, 255, 0.18);
}

.side-btn:hover,
.side-btn.active {
    filter: saturate(1.05) brightness(0.96);
    box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.28);
}

.nav-icon {
    width: 20px;
    height: 20px;
    object-fit: contain;
    flex-shrink: 0;
}

.gray-btn { background: #667085; }
.blue-btn { background: var(--blue); }
.red-btn { background: var(--danger); }
.green-btn { background: var(--success); }
.orange-btn { background: var(--warning); }
.teal-btn { background: var(--teal); }
.purple-btn { background: var(--purple); }
.dark-btn { background: var(--dark); }

.form-grid,
.trip-form-grid,
.ledger-filter-form,
.followup-filter-form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
    width: 100%;
}

.form-row,
.followup-detail-row {
    display: grid;
    grid-template-columns: 112px minmax(0, 1fr);
    gap: 8px;
    align-items: center;
    min-width: 0;
}

.form-row label,
.followup-left label,
.followup-middle2 label,
.followup-detail-row span {
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.2;
}

input,
select,
textarea {
    width: 100%;
    min-width: 0;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #ffffff;
    color: var(--ink);
    outline: none;
}

input,
select {
    height: 34px;
    padding: 5px 8px;
}

textarea {
    min-height: 76px;
    padding: 8px;
    resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(11, 94, 215, 0.12);
}

input[type="number"],
.num {
    text-align: right;
}

input[readonly],
input:disabled,
select:disabled {
    background: #f1f5f9;
    color: #475467;
}

.buyer-entry-grid,
.supplier-entry-grid,
.trip-expenditure-grid {
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr) 76px minmax(0, 1fr);
    gap: 8px 7px;
    align-items: center;
}

.buyer-entry-grid label,
.supplier-entry-grid label,
.trip-expenditure-grid label {
    color: var(--ink);
    font-size: 13px;
    font-weight: 800;
    line-height: 1.15;
}

.buyer-entry-grid .span3,
.supplier-entry-grid .span3,
.trip-expenditure-grid .span3 {
    grid-column: span 3;
}

.buyer-entry-grid .full-row,
.supplier-entry-grid .full-row,
.trip-expenditure-grid .full-row {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 96px minmax(0, 1fr);
    gap: 7px;
    align-items: center;
}

.desktop-button-grid,
.buyer-three-btn-grid,
.supplier-three-btn-grid,
.trip-expenditure-btn-grid {
    display: grid;
    gap: 9px;
    margin-top: 14px;
}

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

.desktop-button-grid.second-row {
    margin-top: 9px;
}

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

.buyer-three-btn-grid,
.supplier-three-btn-grid,
.trip-expenditure-btn-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.desktop-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 36px;
    width: 100%;
    padding: 7px 10px;
    border: 0;
    border-radius: 6px;
    color: #ffffff;
    text-decoration: none;
    text-align: center;
    font-size: 13px;
    font-weight: 800;
    cursor: pointer;
}

.desktop-btn:hover {
    filter: brightness(0.96);
}

.full-btn-form {
    margin: 0;
    width: 100%;
}

.table-wrap {
    flex: 1;
    min-height: 260px;
    width: 100%;
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #f8fafc;
}

.data-table {
    width: max-content;
    min-width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    background: #ffffff;
}

.data-table th,
.data-table td {
    border-right: 1px solid #e4eaf2;
    border-bottom: 1px solid #e4eaf2;
    padding: 8px 9px;
    font-size: 12px;
    line-height: 1.25;
    vertical-align: middle;
}

.data-table th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #24364d;
    color: #ffffff;
    text-align: left;
    font-weight: 800;
    white-space: nowrap;
}

.data-table td {
    color: #1f2937;
    background: #ffffff;
}

.data-table tbody tr:nth-child(even) td {
    background: #f8fafc;
}

.data-table tbody tr:hover td {
    background: var(--soft);
}

.selected-row td {
    background: #dce8f6 !important;
}

.center {
    text-align: center;
}

.action-col,
.table-actions {
    text-align: center;
    white-space: nowrap;
}

.table-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 24px;
    padding: 3px 7px;
    border: 1px solid #cdd9ea;
    border-radius: 5px;
    background: #f3f7fc;
    color: var(--blue-dark);
    text-decoration: none;
    font-size: 12px;
    font-weight: 800;
}

.table-link:hover {
    background: #e8f0fb;
}

.buyer-purchase-table,
.supplier-purchase-table,
.ledger-table,
.trip-expenditure-table {
    table-layout: fixed;
}

.buyer-purchase-table,
.supplier-purchase-table {
    min-width: 1220px;
}

.buyer-purchase-table {
    min-width: 1220px;
}

.supplier-payment-box {
    width: 430px;
    max-width: calc(100vw - 24px);
}

/* =========================
   PAYMENT HISTORY
========================= */
.payment-history-layout {
    grid-template-columns: minmax(340px, 420px) minmax(0, 1fr);
}

.payment-history-table {
    min-width: 1260px;
}

.payment-history-table-wrap {
    min-height: 220px;
    margin-bottom: 14px;
}

.payment-inline-form {
    display: grid;
    grid-template-columns: 118px 92px 88px 130px auto;
    gap: 4px;
    min-width: 470px;
    margin-bottom: 4px;
}

.payment-inline-form input,
.payment-inline-form select {
    height: 26px;
    padding: 3px 5px;
    font-size: 12px;
}

.payment-restore-form {
    margin: 0;
}

.payment-copy-text {
    width: 100%;
    min-height: 90px;
    margin-top: 10px;
}

.balance-bill-paper {
    width: 760px;
    max-width: 100%;
    margin: 10px auto 0;
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    color: #111827;
}

.balance-bill-head {
    display: flex;
    align-items: center;
    gap: 18px;
    border-bottom: 4px solid var(--blue);
    padding-bottom: 12px;
    margin-bottom: 14px;
}

.balance-bill-head img {
    width: 210px;
    height: 70px;
    object-fit: contain;
}

.balance-bill-head h2 {
    margin: 0 0 6px;
    font-size: 26px;
    color: var(--blue-dark);
}

.balance-bill-head p {
    margin: 0;
    font-weight: 800;
    color: #475467;
}

.balance-bill-meta {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px 16px;
    margin-bottom: 12px;
    font-size: 14px;
}

.balance-bill-meta div:last-child {
    grid-column: 1 / -1;
}

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

.balance-bill-table th,
.balance-bill-table td {
    border: 1px solid #111827;
    padding: 7px;
    font-size: 12px;
}

.balance-bill-table th {
    background: #e8f0fb;
    color: #111827;
    text-align: left;
}

.balance-bill-table tfoot th {
    background: #dbeafe;
    font-size: 13px;
}

.balance-bill-footer {
    display: flex;
    justify-content: space-between;
    margin-top: 18px;
    color: var(--blue-dark);
    font-size: 22px;
    font-style: italic;
    font-weight: 900;
}

@media print {
    .no-print,
    .top-strip,
    .logo-area,
    .title-bar,
    .left-panel,
    .footer {
        display: none !important;
    }

    .page-container,
    .content-area,
    .content-layout,
    .right-panel,
    .panel-box {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        border: 0 !important;
        box-shadow: none !important;
        background: #ffffff !important;
        overflow: visible !important;
    }

    .balance-bill-paper {
        width: 100%;
        max-width: none;
        border: 0;
        margin: 0;
        padding: 8mm;
    }
}

.trip-expenditure-table {
    min-width: 1540px;
}

.ledger-table {
    min-width: 1200px;
}

.buyer-purchase-table th,
.buyer-purchase-table td,
.supplier-purchase-table th,
.supplier-purchase-table td,
.trip-expenditure-table th,
.trip-expenditure-table td {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.dashboard-box {
    min-height: 88px;
    margin-bottom: 10px;
    padding: 14px;
    border-radius: 8px;
    color: #ffffff;
    box-shadow: 0 8px 20px rgba(16, 24, 40, 0.10);
}

.red-box { background: linear-gradient(135deg, #c82333, #e55361); }
.blue-box { background: linear-gradient(135deg, #0b5ed7, #3988ff); }
.green-box { background: linear-gradient(135deg, #198754, #2dad72); }
.gray-box { background: linear-gradient(135deg, #667085, #8b96a8); }

.box-title {
    margin-bottom: 7px;
    font-size: 14px;
    font-weight: 800;
}

.box-value {
    font-size: 25px;
    line-height: 1.1;
    font-weight: 800;
}

.summary-line {
    margin-bottom: 11px;
    color: var(--success);
    font-size: 14px;
    font-weight: 800;
}

.ledger-summary,
.followup-detail-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
}

.ledger-filter-form {
    gap: 12px;
}

.ledger-filter-form .form-row {
    row-gap: 6px;
}

.ledger-filter-form .desktop-button-grid {
    margin-top: 16px;
    margin-bottom: 12px;
}

.ledger-summary {
    gap: 12px;
    margin-top: 12px;
}

.ledger-summary .dashboard-box {
    margin-bottom: 10px;
}

.followup-layout {
    display: grid;
    grid-template-columns: 240px 420px 320px minmax(0, 1fr);
    gap: 10px;
    min-height: 0;
}

.followup-left,
.followup-middle1,
.followup-middle2,
.followup-right {
    min-width: 0;
    overflow: auto;
}

.followup-right {
    display: flex;
    flex-direction: column;
}

.followup-message-box {
    width: 100%;
    min-height: 140px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px;
    background: #ffffff;
    font-size: 14px;
}

.followup-copy-text {
    width: 100%;
    min-height: 58px;
    margin-top: 6px;
    padding: 6px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #f8fafc;
    color: #1f2937;
    font-size: 12px;
    line-height: 1.3;
    resize: vertical;
}

.followup-reminder-box {
    margin-top: 12px;
    padding-top: 10px;
    border-top: 1px solid #e7edf5;
}

.followup-reminder-box h3 {
    margin: 0;
    color: var(--blue-dark);
    font-size: 15px;
    font-weight: 800;
}

.followup-reminder-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.followup-row {
    cursor: pointer;
}

.followup-copy-btn {
    height: 28px;
    min-height: 28px;
    margin-top: 4px;
    font-size: 12px;
}

.flash-message,
.warning-box,
.success-box,
.db-status-box {
    border-radius: 7px;
    padding: 11px 12px;
    margin-bottom: 12px;
    font-size: 13px;
    font-weight: 800;
}

.flash-message.success,
.success-box,
.db-status-box {
    border: 1px solid #a3cfbb;
    background: #d1e7dd;
    color: #0f5132;
}

.flash-message.error,
.warning-box {
    border: 1px solid #f1aeb5;
    background: #f8d7da;
    color: #842029;
}

.rate-advice-box {
    grid-column: 1 / -1 !important;
    display: block;
    width: 100% !important;
    max-width: none !important;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    background: #f8fafc;
    color: #475467;
    padding: 9px 10px;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

.buyer-entry-grid .rate-advice-box {
    grid-column: 1 / -1 !important;
    width: 100% !important;
}

.rate-advice-box.loss {
    border-color: #f1aeb5;
    background: #f8d7da;
    color: #842029;
}

.rate-advice-box.warning {
    border-color: #ffda6a;
    background: #fff3cd;
    color: #664d03;
}

.rate-advice-box.good {
    border-color: #a3cfbb;
    background: #d1e7dd;
    color: #0f5132;
}

.data-format-box,
.data-format-textarea {
    width: 100%;
    min-height: 350px;
    border: 1px solid #cbd5e1;
    border-radius: 6px;
    padding: 10px;
    font-family: Consolas, "Courier New", monospace;
    font-size: 14px;
    line-height: 1.6;
    resize: vertical;
}

/* =========================
   BUYER BILL PRINT
========================= */
.buyer-bill-layout {
    grid-template-columns: minmax(300px, 360px) minmax(0, 1fr);
}

.buyer-bill-preview {
    align-items: center;
    overflow: auto;
}

.bill-paper {
    position: relative;
    width: 559px;
    min-height: 0;
    height: 794px;
    padding: 18px 28px 16px;
    background: #ffffff;
    color: #000000;
    font-family: Arial, Helvetica, sans-serif;
    box-shadow: 0 8px 28px rgba(16, 24, 40, 0.14);
}

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

.bill-logo {
    width: 420px;
    height: 74px;
    object-fit: contain;
}

.bill-contact {
    display: flex;
    justify-content: center;
    gap: 10px;
    margin-top: 4px;
    font-size: 10px;
    font-weight: 800;
    white-space: nowrap;
}

.bill-title-row {
    display: grid;
    grid-template-columns: 145px minmax(0, 1fr);
    align-items: end;
    gap: 8px;
    margin-top: 8px;
}

.bill-title {
    font-size: 22px;
    font-weight: 900;
}

.bill-tag {
    background: #0b73c8;
    color: #ffffff;
    padding: 5px 12px;
    font-size: 14px;
    font-style: italic;
    font-weight: 900;
    text-align: right;
}

.bill-line {
    height: 4px;
    margin: 5px 0 8px;
    border-top: 2px solid #000000;
    border-bottom: 2px solid #000000;
}

.bill-meta {
    display: grid;
    grid-template-columns: 1fr 190px;
    gap: 10px;
    font-size: 12px;
    font-weight: 700;
}

.bill-party {
    margin-top: 8px;
    font-size: 13px;
    font-weight: 700;
}

.bill-party > div {
    margin-top: 5px;
}

.bill-dots {
    display: inline-block;
    min-width: 120px;
    border-bottom: 2px dotted #000000;
    padding: 0 6px 2px;
}

.bill-party .bill-dots {
    min-width: 330px;
}

.bill-table {
    position: relative;
    z-index: 2;
    width: 100%;
    margin-top: 10px;
    border-collapse: collapse;
    table-layout: fixed;
    background: transparent;
}

.bill-table th,
.bill-table td {
    border-left: 3px solid #000000;
    border-right: 3px solid #000000;
    padding: 3px 6px;
    color: #000000;
    font-size: 11px;
    line-height: 1.25;
}

.bill-table th {
    border-top: 3px solid #000000;
    border-bottom: 3px solid #000000;
    font-size: 18px;
    text-align: left;
}

.bill-table tbody tr {
    height: 23px;
    border-bottom: 2px dotted #000000;
}

.bill-table tbody tr:last-child {
    border-bottom: 3px solid #000000;
}

.bill-no {
    width: 58px;
    text-align: center !important;
}

.bill-rs {
    width: 88px;
}

.bill-cts {
    width: 52px;
}

.bill-total-row td {
    border-top: 3px solid #000000;
    border-bottom: 3px solid #000000;
    font-weight: 900;
}

.bill-watermark {
    position: absolute;
    z-index: 1;
    top: 305px;
    left: 135px;
    width: 300px;
    opacity: 0.12;
    pointer-events: none;
}

.bill-payment-summary {
    position: relative;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    margin-top: 8px;
    border: 2px solid #000000;
}

.bill-payment-summary div {
    padding: 5px 6px;
    border-right: 2px solid #000000;
}

.bill-payment-summary div:last-child {
    border-right: 0;
}

.bill-payment-summary span {
    display: block;
    font-size: 10px;
    font-weight: 800;
}

.bill-payment-summary strong {
    display: block;
    margin-top: 2px;
    font-size: 12px;
    font-weight: 900;
}

.bill-footer {
    display: flex;
    align-items: end;
    justify-content: space-between;
    margin-top: 10px;
}

.bill-thank {
    background: #0b73c8;
    color: #ffffff;
    padding: 6px 28px;
    margin-left: -28px;
    font-size: 24px;
    font-style: italic;
    font-weight: 900;
}

.bill-sign {
    min-width: 160px;
    text-align: center;
    font-size: 10px;
    font-weight: 800;
}

.bill-sign-image {
    display: block;
    width: 118px;
    height: 34px;
    object-fit: contain;
    margin: 0 auto 2px;
}

.bill-sign-line {
    border-top: 2px dotted #000000;
    margin-bottom: 8px;
}

.bill-help-text {
    margin: 10px 0 0;
    color: #667085;
    font-size: 13px;
    font-weight: 800;
    line-height: 1.35;
}

/* =========================
   DAILY SUMMARY
========================= */
.daily-summary-layout {
    grid-template-columns: minmax(320px, 380px) minmax(0, 1fr);
}

.daily-summary-cards {
    display: grid;
    gap: 10px;
    margin-top: 16px;
}

.daily-summary-report {
    overflow: auto;
}

.daily-summary-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 12px;
}

.daily-summary-section {
    min-width: 0;
    border: 1px solid #e0e7f0;
    border-radius: 8px;
    padding: 12px;
    background: #ffffff;
}

.daily-summary-section h3 {
    margin: 0 0 10px;
    color: var(--blue-dark);
    font-size: 17px;
    font-weight: 800;
}

.daily-kpi-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
}

.daily-kpi-grid div {
    border: 1px solid #d8e0ea;
    border-radius: 6px;
    padding: 8px;
    background: #f8fafc;
}

.daily-kpi-grid span {
    display: block;
    color: #667085;
    font-size: 12px;
    font-weight: 800;
}

.daily-kpi-grid strong {
    display: block;
    margin-top: 4px;
    color: #172033;
    font-size: 16px;
    font-weight: 900;
}

.daily-small-table {
    min-height: 160px;
    max-height: 320px;
}

.daily-small-table .data-table {
    width: 100%;
    min-width: 720px;
}

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

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

@media print {
    .daily-summary-layout,
    .daily-summary-grid {
        display: block !important;
    }

    .daily-summary-section {
        break-inside: avoid;
        margin-bottom: 10px;
    }

    .daily-small-table {
        max-height: none;
        overflow: visible;
    }
}

@media print {
    @page {
        size: A5 portrait;
        margin: 4mm;
    }

    html,
    body {
        width: 148mm;
        height: 210mm;
        margin: 0 !important;
        overflow: hidden !important;
    }

    body {
        background: #ffffff;
    }

    .top-strip,
    .logo-area,
    .title-bar,
    .left-panel,
    .footer,
    .no-print {
        display: none !important;
    }

    .page-container,
    .main-layout,
    .content-area,
    .content-layout,
    .buyer-bill-layout,
    .buyer-bill-preview {
        display: block !important;
        padding: 0 !important;
        margin: 0 !important;
        min-height: 0 !important;
        overflow: visible !important;
        background: #ffffff !important;
        border: 0 !important;
        box-shadow: none !important;
    }

    .buyer-bill-preview {
        padding: 0 !important;
    }

    .bill-paper {
        width: 140mm;
        height: 202mm;
        min-height: 0;
        padding: 0;
        box-shadow: none;
        overflow: hidden;
        page-break-after: avoid;
        page-break-inside: avoid;
        break-after: avoid;
        break-inside: avoid;
    }
}

.calc-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 5000;
    align-items: center;
    justify-content: center;
    padding: 18px;
    background: rgba(15, 23, 42, 0.35);
}

.calc-box {
    width: 320px;
    max-width: 100%;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    padding: 14px;
    box-shadow: var(--shadow);
}

.calc-box h3 {
    margin: 0 0 10px;
    color: var(--blue-dark);
    font-size: 18px;
}

#calcDisplay {
    height: 42px;
    margin-bottom: 10px;
    text-align: right;
    font-size: 18px;
    font-weight: 800;
}

.calc-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    margin-bottom: 10px;
}

.calc-grid button {
    height: 34px;
    border: 1px solid #cbd5e1;
    border-radius: 5px;
    background: #f8fafc;
    font-weight: 800;
    cursor: pointer;
}

.footer {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 8px 14px;
    border-top: 1px solid var(--line);
    background: #ffffff;
    color: var(--muted);
    font-size: 13px;
    flex-shrink: 0;
}

.login-body {
    min-height: 100vh;
    background: var(--page);
}

.login-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
}

.login-card {
    width: 340px;
    max-width: 100%;
    padding: 24px 22px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: #ffffff;
    text-align: center;
    box-shadow: var(--shadow);
}

.login-logo {
    width: 118px;
    height: auto;
    margin-bottom: 12px;
    border-radius: 8px;
}

.login-title {
    margin-bottom: 3px;
    color: var(--blue-dark);
    font-size: 22px;
    font-weight: 800;
}

.login-subtitle {
    margin-bottom: 18px;
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

.login-input-group {
    margin-bottom: 12px;
}

.login-input-group input {
    height: 40px;
    padding: 0 12px;
}

.login-btn {
    width: 100%;
    height: 40px;
    border: 0;
    border-radius: 6px;
    background: var(--blue);
    color: #ffffff;
    font-size: 14px;
    font-weight: 800;
    cursor: pointer;
}

.login-btn:hover {
    background: var(--blue-dark);
}

.login-links {
    margin-top: 14px;
    color: var(--muted);
    font-size: 13px;
}

.login-links a {
    color: var(--blue-dark);
    font-weight: 800;
    text-decoration: none;
}

@media (max-width: 1200px) {
    .logo-container {
        grid-template-columns: minmax(340px, 35vw) minmax(0, 1fr);
        gap: 28px;
    }

    .logo-image {
        height: 78px;
    }

    .company-details h1 {
        font-size: 25px;
    }

    .info-line {
        font-size: 14px;
        gap: 8px 18px;
    }

    .content-layout,
    .buyer-page-layout,
    .supplier-page-layout,
    .trip-page-layout,
    .trip-expenditure-layout .content-layout {
        grid-template-columns: minmax(360px, 480px) minmax(0, 1fr);
    }

    .followup-layout {
        grid-template-columns: 230px 380px minmax(280px, 1fr);
    }

    .followup-right {
        grid-column: 1 / -1;
    }
}

@media (max-width: 900px) {
    .logo-area {
        padding: 12px;
    }

    .logo-container {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .logo-image {
        width: min(100%, 520px);
        height: auto;
        max-height: 90px;
        justify-self: start;
    }

    .title-bar,
    .title-left-section,
    .title-right-section {
        flex-wrap: wrap;
    }

    .title-bar {
        padding: 8px 12px;
        min-height: 58px;
    }

    .title-text {
        font-size: 19px;
    }

    .title-right-section {
        width: 100%;
        justify-content: space-between;
    }

    .top-user-name {
        max-width: calc(100vw - 120px);
        font-size: 15px;
    }

    .top-logout-btn {
        min-height: 36px;
        font-size: 15px;
    }

    .page-container {
        padding: 10px;
    }

    .main-layout.home-layout,
    .main-layout.inner-layout,
    .content-layout,
    .dashboard-home-content,
    .buyer-page-layout,
    .supplier-page-layout,
    .trip-page-layout,
    .trip-expenditure-layout .content-layout,
    .followup-layout {
        display: grid;
        grid-template-columns: 1fr;
        gap: 10px;
        min-height: 0;
    }

    .home-layout .left-panel,
    .inner-layout .left-panel,
    .inner-layout.nav-open .left-panel {
        position: relative;
        top: auto;
        width: 100%;
        max-height: none;
        opacity: 1;
        pointer-events: auto;
        transform: none;
        box-shadow: none;
    }

    .panel-box {
        overflow: visible;
    }

    .right-panel {
        overflow: visible;
    }

    .table-wrap {
        min-height: 260px;
    }

    .buyer-entry-grid,
    .supplier-entry-grid,
    .trip-expenditure-grid,
    .buyer-entry-grid .full-row,
    .supplier-entry-grid .full-row,
    .trip-expenditure-grid .full-row,
    .form-row,
    .followup-detail-row {
        grid-template-columns: 1fr;
        gap: 5px;
    }

    .buyer-entry-grid .span3,
    .supplier-entry-grid .span3,
    .trip-expenditure-grid .span3 {
        grid-column: auto;
    }

    .desktop-button-grid,
    .buyer-three-btn-grid,
    .supplier-three-btn-grid,
    .trip-expenditure-btn-grid,
    .ledger-summary,
    .followup-detail-grid {
        grid-template-columns: 1fr;
    }

    .footer {
        justify-content: center;
        text-align: center;
        flex-wrap: wrap;
    }
}

@media (max-width: 560px) {
    .company-details h1 {
        font-size: 20px;
    }

    .logo-image {
        width: 100%;
        max-height: 70px;
    }

    .info-line {
        font-size: 13px;
    }

    .title-text {
        max-width: calc(100vw - 84px);
        font-size: 16px;
    }

    .box-value {
        font-size: 22px;
    }
}
