html,
body {
    height: 100%;
}

body {
    background-color: #f5f7fb;
    font-family: "Segoe UI", Tahoma, sans-serif;
}

a {
    text-decoration: none;
}

.content {
    flex: 1;
}

.card {
    border-radius: 12px;
}

.btn,
.form-control,
.form-select,
.alert {
    border-radius: 8px;
}

.table th {
    background-color: #f1f3f5;
}

.modal-content {
    border-radius: 14px;
}

.modal-header,
.modal-footer {
    border-color: #eef1f4;
}

/* =========================
   SIDEBAR
========================= */
.sidebar {
    width: 290px;
    min-height: 100vh;
    background: linear-gradient(180deg, #1748ba 0%, #00173b 100%);
    border-right: 1px solid rgba(255,255,255,0.06);
}

.sidebar-brand {
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(255,255,255,0.08);
}

.sidebar-logo-box {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    overflow: hidden;
    flex-shrink: 0;
    background: rgba(255,255,255,0.08);
    display: flex;
    align-items: center;
    justify-content: center;
}

.sidebar-logo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.sidebar-brand-icon {
    width: 54px;
    height: 54px;
    border-radius: 14px;
    background: rgba(255,255,255,0.12);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
}

.sidebar-brand-text h6 {
    line-height: 1.2;
}

.sidebar .nav-link {
    color: rgba(255,255,255,0.88);
    padding: 11px 14px;
    border-radius: 12px;
    transition: all 0.2s ease;
    font-size: 14px;
    margin-bottom: 5px;
}

.sidebar .nav-link:hover {
    background: rgba(255,255,255,0.08);
    color: #fff;
    transform: translateX(2px);
}

.sidebar .nav-link.active {
    background: rgba(255,255,255,0.14);
    color: #fff;
    font-weight: 600;
    box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
}

.sidebar .submenu {
    padding-left: 10px;
}

.sidebar .submenu .nav-link {
    padding: 9px 12px;
    font-size: 13px;
    color: rgba(255,255,255,0.78);
}

.sidebar .submenu .nav-link.active {
    background: rgba(255,255,255,0.10);
    color: #fff;
}

.sidebar .collapse .nav-link i,
.sidebar .nav-link i {
    width: 18px;
    text-align: center;
}

/* =========================
   TOPBAR / FOOTER
========================= */
.topbar-logo {
    width: 42px;
    height: 42px;
    object-fit: cover;
    border-radius: 10px;
    border: 1px solid #e9ecef;
    background: #fff;
    padding: 2px;
    display: block;
}

.app-topbar {
    min-height: 72px;
}

.app-footer {
    font-size: 13px;
}

/* =========================
   LOGIN
========================= */
.modern-login-page {
    min-height: 100vh;
    background: linear-gradient(
        135deg,
        #c1ece1 0%,
        #d0d0d1 35%,
        #A1C4FD 70%,
        #A1C4FD 100%
    );
}

.login-shell {
    min-height: 100vh;
    padding: 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.login-wrapper {
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
    background: #fff;
    border-radius: 20px;
    overflow: hidden;
    display: grid;
    grid-template-columns: 1fr 1fr;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}

.login-side-image {
    min-height: 520px;
    background:
        linear-gradient(rgba(233, 30, 99, 0.18), rgba(233, 30, 99, 0.18)),
        url("../images/login-cows.jpg") center center / cover no-repeat;
    position: relative;
}

.login-overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(12, 74, 110, 0.35), rgba(15, 23, 42, 0.25));
    display: flex;
    align-items: flex-end;
}

.login-side-content {
    padding: 36px;
    color: #fff;
    max-width: 520px;
}

.login-side-badge {
    display: inline-block;
    padding: 8px 14px;
    background: rgba(255,255,255,0.14);
    border: 1px solid rgba(255,255,255,0.18);
    border-radius: 999px;
    font-size: 13px;
    margin-bottom: 18px;
    backdrop-filter: blur(6px);
}

.login-side-title {
    font-size: 30px;
    font-weight: 700;
    line-height: 1.25;
    margin-bottom: 14px;
}

.login-side-text {
    font-size: 15px;
    line-height: 1.7;
    color: rgba(255,255,255,0.92);
    margin-bottom: 0;
}

.login-side-form {
    display: flex;
    align-items: center;
    justify-content: center;
    background: #ffffff;
}

.login-form-inner {
    width: 100%;
    max-width: 420px;
    padding: 42px 34px;
}

.login-logo {
    max-height: 78px;
    max-width: 78px;
    object-fit: contain;
    display: block;
    margin: 0 auto;
}

.login-logo-placeholder {
    width: 78px;
    height: 78px;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, #0d6efd, #6610f2);
    color: #fff;
    font-size: 28px;
}

.modern-input-group .input-group-text {
    background: #f8fafc;
    border-right: 0;
    color: #64748b;
}

.modern-input-group .form-control {
    border-left: 0;
    border-right: 0;
    box-shadow: none !important;
}

.password-toggle-btn {
    background: #f8fafc;
    border: 1px solid #ced4da;
    border-left: 0;
    color: #64748b;
}

.password-toggle-btn:hover {
    background: #eef2f7;
    color: #334155;
}

.login-submit-btn {
    min-height: 46px;
    border-radius: 12px;
    font-weight: 600;
}

.login-page-footer {
    margin-top: 18px;
}

@media (max-width: 991.98px) {
    .login-wrapper {
        grid-template-columns: 1fr;
    }

    .login-side-image {
        min-height: 260px;
    }

    .login-side-content {
        padding: 24px;
    }

    .login-side-title {
        font-size: 24px;
    }
}

/* =========================
   DASHBOARD CARDS
========================= */
.dashboard-card {
    border: none;
    border-radius: 16px;
    color: #fff;
    padding: 10px;
    transition: all 0.25s ease;
    box-shadow: 0 10px 25px rgba(0,0,0,0.08);
}

.dashboard-card h6 {
    font-size: 13px;
    opacity: 0.85;
    margin-bottom: 6px;
}

.dashboard-card h2 {
    font-size: 26px;
    font-weight: 700;
    margin: 0;
}

.dashboard-card i {
    font-size: 34px;
    opacity: 0.25;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 14px 35px rgba(0,0,0,0.12);
}

.bg-gradient-blue {
    background: linear-gradient(135deg, #3b82f6, #1e40af);
}

.bg-gradient-green {
    background: linear-gradient(135deg, #22c55e, #166534);
}

.bg-gradient-teal {
    background: linear-gradient(135deg, #14b8a6, #0f766e);
}

.bg-gradient-orange {
    background: linear-gradient(135deg, #f59e0b, #b45309);
}

.bg-gradient-purple {
    background: linear-gradient(135deg, #8b5cf6, #5b21b6);
}

.bg-gradient-red {
    background: linear-gradient(135deg, #ef4444, #7f1d1d);
}

.bg-gradient-dark {
    background: linear-gradient(135deg, #334155, #020617);
}

.bg-gradient-indigo {
    background: linear-gradient(135deg, #6366f1, #1e1b4b);
}

/* =========================
   FARMER MODULE
========================= */
.farmer-photo-card {
    background: #f8fafc;
}

.farmer-photo-preview {
    width: 220px;
    height: 220px;
    max-width: 100%;
    margin: 0 auto;
    border-radius: 18px;
    overflow: hidden;
    border: 1px dashed #cbd5e1;
    background: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
}

.farmer-photo-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.table-avatar {
    width: 44px;
    height: 44px;
    min-width: 44px;
    max-width: 44px;
    min-height: 44px;
    max-height: 44px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    border: 2px solid #e2e8f0;
    background: #fff;
}

.farmer-profile-photo {
    width: 120px;
    height: 120px;
    min-width: 120px;
    max-width: 120px;
    min-height: 120px;
    max-height: 120px;
    border-radius: 18px;
    object-fit: cover;
    display: block;
    margin: 0 auto;
    border: 3px solid #f1f5f9;
    box-shadow: 0 8px 20px rgba(0,0,0,0.08);
}

.detail-item {
    background: #f8fafc;
    border: 1px solid #eef2f7;
    border-radius: 14px;
    padding: 14px 16px;
    height: 100%;
}

.detail-item label {
    display: block;
    font-size: 12px;
    color: #64748b;
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: .4px;
}

.detail-item div {
    font-weight: 600;
    color: #0f172a;
}

.modern-table thead th {
    background: #f8fafc;
    color: #334155;
    font-size: 13px;
    border-bottom: 1px solid #e2e8f0;
}

.modern-table tbody tr:hover {
    background: #f8fbff;
}

/* =========================
   PAGINATION
========================= */
.modern-pagination .page-link {
    border: none;
    color: #334155;
    background: #f8fafc;
    margin: 0 4px;
    border-radius: 10px !important;
    min-width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: none;
    transition: all 0.2s ease;
}

.modern-pagination .page-link:hover {
    background: #e2e8f0;
    color: #0f172a;
}

.modern-pagination .page-item.active .page-link {
    background: linear-gradient(135deg, #2563eb, #1d4ed8);
    color: #fff;
    box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

.modern-pagination .page-item.disabled .page-link {
    background: #f1f5f9;
    color: #94a3b8;
}

/* =========================
   STATEMENT / RECEIPT
========================= */
.statement-company-logo {
    width: 70px;
    height: 70px;
    object-fit: contain;
    border-radius: 14px;
    border: 1px solid #e5e7eb;
    background: #fff;
    padding: 4px;
    display: block;
}

/* =========================
   IMAGE SAFETY
========================= */
img {
    max-width: 100%;
}

.table-avatar,
.farmer-profile-photo,
.sidebar-logo-img,
.topbar-logo,
.statement-company-logo,
.login-logo,
.farmer-photo-img {
    display: block;
}

table img.table-avatar {
    width: 44px !important;
    height: 44px !important;
    min-width: 44px !important;
    max-width: 44px !important;
    min-height: 44px !important;
    max-height: 44px !important;
    object-fit: cover !important;
    border-radius: 50% !important;
    display: block !important;
    overflow: hidden !important;
}

td img.table-avatar {
    width: 44px !important;
    height: 44px !important;
}

.table-avatar-wrap {
    width: 48px;
    height: 48px;
    border-radius: 50%;
    overflow: hidden;
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    display: flex;
    align-items: center;
    justify-content: center;
}

.table-avatar {
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    min-height: 48px !important;
    max-width: 48px !important;
    max-height: 48px !important;
    object-fit: cover !important;
    display: block !important;
    border-radius: 50% !important;
}

.milk-search-results {
    position: absolute;
    top: 100%;
    left: 12px;
    right: 12px;
    z-index: 1050;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
}

.farmer-result-item {
    text-align: left;
}

.milk-search-results {
    position: absolute;
    top: 100%;
    left: 12px;
    right: 12px;
    z-index: 1050;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
    background: #fff;
}

.farmer-result-item {
    text-align: left;
}

.milk-search-results {
    position: absolute;
    top: 100%;
    left: 12px;
    right: 12px;
    z-index: 1050;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
    background: #fff;
}

.farmer-result-item {
    text-align: left;
}

.billing-search-results {
    position: absolute;
    top: 100%;
    left: 12px;
    right: 12px;
    z-index: 1050;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
    background: #fff;
}

.billing-inputs-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.billing-input-box {
    background: #f8fafc;
    border: 1px solid #e9eef5;
    border-radius: 14px;
    padding: 14px;
}

.billing-input-box .form-label {
    font-weight: 600;
    margin-bottom: 8px;
    color: #334155;
}

.billing-summary-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.billing-summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e9eef5;
    border-radius: 12px;
}

.billing-summary-row span {
    color: #475569;
    font-weight: 500;
}

.billing-summary-row strong {
    color: #0f172a;
    font-size: 16px;
}

.billing-summary-row.total {
    background: #eef6ff;
    border-color: #cfe2ff;
}

@media (max-width: 767.98px) {
    .billing-inputs-grid {
        grid-template-columns: 1fr;
    }
}

.billing-search-results {
    position: absolute;
    top: 100%;
    left: 12px;
    right: 12px;
    z-index: 1050;
    max-height: 220px;
    overflow-y: auto;
    border: 1px solid #dee2e6;
    border-radius: 12px;
    box-shadow: 0 10px 24px rgba(0,0,0,0.08);
    background: #fff;
}