:root {
    --brand-green: #1e6e4f;
    --brand-green-dark: #144d38;
    --brand-cream: #f6f4ee;
    --brand-gold: #c8912a;
    --sidebar-width: 260px;
    --topbar-height: 64px;
    --text-dark: #22302b;
    --border-soft: #e4e2da;
}

body {
    background: var(--brand-cream);
    color: var(--text-dark);
    font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* ---------- LOGIN ---------- */
.login-body {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--brand-green-dark), var(--brand-green) 60%, #2f8f68);
}
.login-card {
    background: #fff;
    border-radius: 16px;
    padding: 40px 36px;
    width: 100%;
    max-width: 400px;
}
.login-brand i { color: var(--brand-green); }

/* ---------- LAYOUT ---------- */
.app-sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-width);
    background: var(--brand-green-dark);
    color: #eafaf1;
    overflow-y: auto;
    z-index: 1030;
    transition: transform .25s ease;
}
.app-sidebar .brand {
    height: var(--topbar-height);
    display: flex; align-items: center; gap: 10px;
    padding: 0 20px;
    font-weight: 700;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-sidebar .nav-section-title {
    font-size: .7rem;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: rgba(255,255,255,.45);
    padding: 16px 20px 6px;
}
.app-sidebar .nav-link {
    color: rgba(255,255,255,.85);
    padding: 9px 20px;
    font-size: .92rem;
    border-left: 3px solid transparent;
    display: flex; align-items: center; gap: 10px;
}
.app-sidebar .nav-link i { width: 18px; text-align: center; opacity: .85; }
.app-sidebar .nav-link:hover, .app-sidebar .nav-link.active {
    background: rgba(255,255,255,.08);
    color: #fff;
    border-left-color: var(--brand-gold);
}

.app-topbar {
    position: fixed;
    top: 0; right: 0;
    left: var(--sidebar-width);
    height: var(--topbar-height);
    background: #fff;
    border-bottom: 1px solid var(--border-soft);
    display: flex; align-items: center; justify-content: space-between;
    padding: 0 20px;
    z-index: 1020;
}

.app-content {
    margin-left: var(--sidebar-width);
    padding-top: calc(var(--topbar-height) + 20px);
    padding-left: 24px; padding-right: 24px; padding-bottom: 40px;
    min-height: 100vh;
}

@media (max-width: 991.98px) {
    .app-sidebar { transform: translateX(-100%); }
    .app-sidebar.show { transform: translateX(0); }
    .app-topbar, .app-content { left: 0; margin-left: 0; }
}

/* ---------- CARDS / WIDGETS ---------- */
.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 18px 20px;
    border: 1px solid var(--border-soft);
    height: 100%;
}
.stat-card .stat-icon {
    width: 44px; height: 44px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    color: #fff;
    background: var(--brand-green);
}
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; }
.stat-card .stat-label { font-size: .8rem; color: #7a8580; }

.card-panel {
    background: #fff;
    border-radius: 14px;
    border: 1px solid var(--border-soft);
    padding: 20px;
}

.page-header {
    display: flex; align-items: center; justify-content: space-between;
    margin-bottom: 20px; flex-wrap: wrap; gap: 10px;
}
.page-header h4 { margin: 0; font-weight: 700; }

.btn-brand {
    background: var(--brand-green); border-color: var(--brand-green); color: #fff;
}
.btn-brand:hover { background: var(--brand-green-dark); border-color: var(--brand-green-dark); color: #fff; }

.badge-status-active { background: #1e6e4f; }
.badge-status-sold { background: #6c757d; }
.badge-status-dead { background: #b02a37; }
.badge-status-sick { background: #d97706; }

table.dataTable thead th { background: #f1f5f2; }

.avatar-sm {
    width: 40px; height: 40px; border-radius: 10px; object-fit: cover; background: #eee;
}
.avatar-lg {
    width: 96px; height: 96px; border-radius: 14px; object-fit: cover; background: #eee;
}

.quick-action-btn {
    border: 1px dashed var(--border-soft);
    border-radius: 12px;
    padding: 14px 10px;
    text-align: center;
    background: #fff;
    display: block;
    color: var(--text-dark);
    transition: all .15s;
}
.quick-action-btn:hover {
    border-color: var(--brand-green);
    background: #f0f8f4;
    color: var(--brand-green-dark);
}
.quick-action-btn i { font-size: 1.4rem; color: var(--brand-green); display: block; margin-bottom: 6px; }

/* ---------- MODAL SCROLL SAFETY NET ---------- */
/* Ensures every modal (even ones missing modal-dialog-scrollable) stays
   fully usable on small screens instead of overflowing off-screen. */
.modal-dialog {
    max-height: calc(100vh - 1rem);
    margin-top: .5rem;
    margin-bottom: .5rem;
}
.modal-content {
    max-height: calc(100vh - 1rem);
    display: flex;
    flex-direction: column;
}
.modal-body {
    overflow-y: auto;
}
@media (max-width: 575.98px) {
    .modal-dialog { max-width: 96%; margin-left: auto; margin-right: auto; }
}

/* ---------- RECORD DETAIL POPUP (view record) ---------- */
.record-detail-table th {
    width: 40%;
    color: #7a8580;
    font-weight: 600;
    font-size: .82rem;
    vertical-align: top;
}
.record-detail-table td { font-size: .88rem; }
.clickable-row { cursor: pointer; }
.clickable-row:hover { background: #f0f8f4; }

.quick-filter-bar {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center;
    margin-bottom: 12px;
}
.quick-filter-bar .btn { font-size: .78rem; padding: 4px 12px; }
