/* ============================================
   AYAMTELUR PRO - Design System
   Modern Poultry Farm Management
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
  --primary: #10B981;
  --primary-dark: #059669;
  --primary-light: #34D399;
  --primary-bg: rgba(16,185,129,.08);
  --secondary: #1E293B;
  --secondary-light: #334155;
  --accent: #3B82F6;
  --accent-dark: #2563EB;
  --danger: #EF4444;
  --warning: #F59E0B;
  --info: #06B6D4;
  --success: #10B981;
  --bg-body: #F1F5F9;
  --bg-card: #FFFFFF;
  --bg-sidebar: #1E293B;
  --bg-sidebar-hover: #334155;
  --bg-navbar: #FFFFFF;
  --text-primary: #1E293B;
  --text-secondary: #64748B;
  --text-muted: #94A3B8;
  --text-sidebar: #CBD5E1;
  --text-sidebar-active: #FFFFFF;
  --border-color: #E2E8F0;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
  --shadow: 0 1px 3px rgba(0,0,0,.1),0 1px 2px rgba(0,0,0,.06);
  --shadow-md: 0 4px 6px -1px rgba(0,0,0,.1),0 2px 4px -2px rgba(0,0,0,.1);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);
  --radius: .5rem;
  --radius-lg: .75rem;
  --radius-xl: 1rem;
  --sidebar-width: 260px;
  --sidebar-collapsed: 70px;
  --navbar-height: 64px;
  --transition: all .3s cubic-bezier(.4,0,.2,1);
}

/* Dark Mode */
[data-theme="dark"] {
  --bg-body: #0F172A;
  --bg-card: #1E293B;
  --bg-sidebar: #0F172A;
  --bg-sidebar-hover: #1E293B;
  --bg-navbar: #1E293B;
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;
  --border-color: #334155;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.2);
  --shadow: 0 1px 3px rgba(0,0,0,.3);
  --shadow-md: 0 4px 6px rgba(0,0,0,.3);
  --shadow-lg: 0 10px 15px rgba(0,0,0,.3);
}

/* Reset & Base */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: .875rem;
  line-height: 1.6;
  overflow-x: hidden;
}
a { color: var(--primary); text-decoration: none; transition: var(--transition); }
a:hover { color: var(--primary-dark); }

/* Scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--text-muted); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); }

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  z-index: 1040;
  transition: var(--transition);
  display: flex; flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.05);
}
/* Protect sidebar links from Bootstrap global overrides */
.sidebar a, .sidebar a:hover, .sidebar a:focus, .sidebar a:visited {
  text-decoration: none !important;
}
.sidebar .collapse, .sidebar .collapsing {
  background-color: transparent !important;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }

.sidebar-brand {
  min-height: var(--navbar-height);
  display: flex; align-items: center;
  padding: 0.5rem 1.25rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  gap: .75rem;
}
.sidebar-brand .brand-icon {
  width: 38px; height: 38px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 1.1rem; font-weight: 700;
  flex-shrink: 0;
}
.sidebar-brand .brand-text {
  font-size: 1.1rem; font-weight: 700;
  color: #fff; white-space: normal;
  word-break: break-word;
  line-height: 1.2;
  transition: opacity .2s;
}
.sidebar.collapsed .brand-text,
.sidebar.collapsed .menu-label,
.sidebar.collapsed .menu-text,
.sidebar.collapsed .menu-badge { opacity: 0; width: 0; overflow: hidden; }

.sidebar-menu {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  padding: .75rem 0;
}
.menu-label {
  font-size: .65rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--text-muted); padding: 1rem 1.25rem .5rem;
  white-space: nowrap; transition: opacity .2s;
}
.menu-item {
  display: flex; align-items: center;
  padding: .6rem 1.25rem; margin: 2px .5rem;
  color: var(--text-sidebar) !important;
  background-color: transparent !important;
  border-radius: var(--radius);
  cursor: pointer; transition: var(--transition);
  gap: .75rem; white-space: nowrap;
  text-decoration: none !important;
  position: relative;
}
.menu-item:hover { background: var(--bg-sidebar-hover) !important; color: var(--text-sidebar-active) !important; }
.menu-item.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark)) !important;
  color: #fff !important; font-weight: 500;
  box-shadow: 0 2px 8px rgba(16,185,129,.3);
}
.menu-item i { width: 20px; text-align: center; font-size: 1rem; flex-shrink: 0; }
.menu-text { transition: opacity .2s; }
.menu-badge {
  margin-left: auto; background: var(--danger);
  color: #fff; font-size: .65rem; font-weight: 600;
  padding: 2px 6px; border-radius: 10px;
  transition: opacity .2s;
}
.menu-submenu { background-color: transparent !important; }
.menu-submenu .sub-item { padding-left: 2.75rem; font-size: 0.95em; margin-top: 2px; margin-bottom: 2px; }
.menu-item[aria-expanded="true"] .menu-arrow { transform: rotate(180deg); }
.sidebar.collapsed .menu-submenu { display: none !important; }
.sidebar.collapsed .menu-arrow { display: none; }
.sidebar.collapsed .menu-item { justify-content: center; padding: .6rem; margin: 2px .35rem; }

/* ===== NAVBAR ===== */
.navbar-main {
  position: fixed; top: 0; right: 0;
  left: var(--sidebar-width);
  height: var(--navbar-height);
  background: var(--bg-navbar);
  border-bottom: 1px solid var(--border-color);
  z-index: 1030;
  display: flex; align-items: center;
  padding: 0 1.5rem;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}
.sidebar.collapsed ~ .navbar-main { left: var(--sidebar-collapsed); }

.navbar-toggle {
  background: none; border: none; cursor: pointer;
  color: var(--text-secondary); font-size: 1.2rem;
  padding: .4rem; border-radius: var(--radius);
  transition: var(--transition);
}
.navbar-toggle:hover { background: var(--primary-bg); color: var(--primary); }

.navbar-search {
  flex: 1; max-width: 400px; margin: 0 1.5rem;
  position: relative;
}
.navbar-search input {
  width: 100%; padding: .5rem 1rem .5rem 2.5rem;
  border: 1px solid var(--border-color);
  border-radius: 50px; font-size: .85rem;
  background: var(--bg-body); color: var(--text-primary);
  transition: var(--transition); outline: none;
}
.navbar-search input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-bg); }
.navbar-search i { position: absolute; left: 1rem; top: 50%; transform: translateY(-50%); color: var(--text-muted); }

.navbar-actions {
  display: flex; align-items: center; gap: .5rem; margin-left: auto;
}
.navbar-action-btn {
  position: relative; background: none; border: none;
  color: var(--text-secondary); font-size: 1.1rem;
  padding: .5rem; border-radius: var(--radius);
  cursor: pointer; transition: var(--transition);
}
.navbar-action-btn:hover { background: var(--primary-bg); color: var(--primary); }
.navbar-action-btn .notif-badge {
  position: absolute; top: 2px; right: 2px;
  width: 16px; height: 16px; background: var(--danger);
  color: #fff; font-size: .6rem; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

.navbar-user {
  display: flex; align-items: center; gap: .6rem;
  padding: .35rem .75rem .35rem .35rem;
  border-radius: 50px; cursor: pointer;
  transition: var(--transition);
  border: 1px solid var(--border-color);
  margin-left: .5rem;
}
.navbar-user:hover { background: var(--primary-bg); border-color: var(--primary); }
.navbar-user img {
  width: 32px; height: 32px; border-radius: 50%;
  object-fit: cover; border: 2px solid var(--primary-light);
}
.navbar-user .user-info { line-height: 1.2; }
.navbar-user .user-name { font-size: .8rem; font-weight: 600; color: var(--text-primary); }
.navbar-user .user-role { font-size: .65rem; color: var(--text-muted); }

/* ===== MAIN CONTENT ===== */
.main-content {
  margin-left: var(--sidebar-width);
  margin-top: var(--navbar-height);
  padding: 1.5rem;
  min-height: calc(100vh - var(--navbar-height));
  transition: var(--transition);
}
.sidebar.collapsed ~ .main-wrapper .main-content { margin-left: var(--sidebar-collapsed); }

/* Breadcrumb */
.breadcrumb-wrapper {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1.5rem; flex-wrap: wrap; gap: .75rem;
}
.breadcrumb-wrapper h4 { font-size: 1.25rem; font-weight: 700; color: var(--text-primary); margin: 0; }
.breadcrumb { margin: 0; background: none; padding: 0; font-size: .8rem; }
.breadcrumb-item a { color: var(--text-muted); }
.breadcrumb-item.active { color: var(--primary); font-weight: 500; }

/* ===== CARDS ===== */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}
.card:hover { box-shadow: var(--shadow-md); }
.card-header {
  padding: 1rem 1.25rem;
  background: transparent;
  border-bottom: 1px solid var(--border-color);
  font-weight: 600; font-size: .9rem;
  display: flex; align-items: center; justify-content: space-between;
}
.card-body { padding: 1.25rem; }

/* Stat Cards */
.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex; align-items: center; gap: 1rem;
  transition: var(--transition);
  position: relative; overflow: hidden;
}
.stat-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; width: 4px; height: 100%;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.stat-card .stat-icon {
  width: 48px; height: 48px; border-radius: var(--radius);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
}
.stat-card .stat-info { flex: 1; min-width: 0; }
.stat-card .stat-label { font-size: .75rem; color: var(--text-muted); font-weight: 500; }
.stat-card .stat-value { font-size: 1.5rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.stat-card .stat-change { font-size: .7rem; font-weight: 500; margin-top: 2px; }
.stat-card .stat-change.up { color: var(--success); }
.stat-card .stat-change.down { color: var(--danger); }

.stat-card.emerald::before { background: var(--primary); }
.stat-card.emerald .stat-icon { background: var(--primary-bg); color: var(--primary); }
.stat-card.blue::before { background: var(--accent); }
.stat-card.blue .stat-icon { background: rgba(59,130,246,.1); color: var(--accent); }
.stat-card.orange::before { background: var(--warning); }
.stat-card.orange .stat-icon { background: rgba(245,158,11,.1); color: var(--warning); }
.stat-card.red::before { background: var(--danger); }
.stat-card.red .stat-icon { background: rgba(239,68,68,.1); color: var(--danger); }
.stat-card.cyan::before { background: var(--info); }
.stat-card.cyan .stat-icon { background: rgba(6,182,212,.1); color: var(--info); }
.stat-card.purple::before { background: #8B5CF6; }
.stat-card.purple .stat-icon { background: rgba(139,92,246,.1); color: #8B5CF6; }

/* ===== TABLES ===== */
.table-wrapper { overflow-x: auto; }
.table { color: var(--text-primary); font-size: .82rem; }
.table thead th {
  background: var(--bg-body); border-bottom: 2px solid var(--border-color);
  font-weight: 600; font-size: .75rem; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-secondary);
  padding: .75rem 1rem; white-space: nowrap;
}
.table tbody td {
  padding: .7rem 1rem; vertical-align: middle;
  border-bottom: 1px solid var(--border-color);
}
.table tbody tr:hover { background: var(--primary-bg); }

/* Dark mode tables override */
[data-theme="dark"] .table { 
  --bs-table-color: var(--text-primary);
  --bs-table-bg: transparent;
  --bs-table-border-color: var(--border-color);
  --bs-table-hover-color: var(--text-primary);
  --bs-table-striped-color: var(--text-primary);
  color: var(--text-primary); 
}
[data-theme="dark"] .table thead th { 
  background: rgba(255,255,255,.03); 
  color: var(--text-secondary);
}
[data-theme="dark"] .table-primary {
  --bs-table-bg: rgba(59, 130, 246, 0.15);
  --bs-table-color: var(--text-primary);
  --bs-table-border-color: rgba(59, 130, 246, 0.3);
}
[data-theme="dark"] .table-success {
  --bs-table-bg: rgba(16, 185, 129, 0.15);
  --bs-table-color: var(--text-primary);
  --bs-table-border-color: rgba(16, 185, 129, 0.3);
}
[data-theme="dark"] .table-warning {
  --bs-table-bg: rgba(245, 158, 11, 0.15);
  --bs-table-color: var(--text-primary);
  --bs-table-border-color: rgba(245, 158, 11, 0.3);
}
[data-theme="dark"] .table-danger {
  --bs-table-bg: rgba(239, 68, 68, 0.15);
  --bs-table-color: var(--text-primary);
  --bs-table-border-color: rgba(239, 68, 68, 0.3);
}
[data-theme="dark"] .table-secondary {
  --bs-table-bg: rgba(100, 116, 139, 0.15);
  --bs-table-color: var(--text-primary);
  --bs-table-border-color: rgba(100, 116, 139, 0.3);
}

/* ===== FORMS ===== */
.form-control, .form-select {
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  padding: .5rem .85rem;
  font-size: .85rem;
  color: var(--text-primary);
  background: var(--bg-card);
  transition: var(--transition);
}
.form-control:focus, .form-select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-bg);
}
.form-label { font-weight: 500; font-size: .8rem; color: var(--text-secondary); margin-bottom: .35rem; }

/* ===== BUTTONS ===== */
.btn { font-size: .82rem; font-weight: 500; padding: .45rem 1rem; border-radius: var(--radius); transition: var(--transition); }
.btn-primary { background: var(--primary); border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); border-color: var(--primary-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(16,185,129,.3); }
.btn-secondary { background: var(--secondary); border-color: var(--secondary); }
.btn-icon { width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--radius); }
.btn-action { font-size: .75rem; padding: .3rem .6rem; }

/* ===== BADGES ===== */
.badge { font-weight: 500; font-size: .7rem; padding: .3em .65em; border-radius: 6px; }

/* ===== LOGIN PAGE ===== */
.login-wrapper {
  min-height: 100vh;
  display: flex;
  background: linear-gradient(135deg, #0F172A 0%, #1E293B 50%, #064E3B 100%);
  position: relative; overflow: hidden;
}
.login-wrapper::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%2310B981' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.login-left {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 2rem; position: relative; z-index: 1;
  color: #fff;
}
.login-left h1 { font-size: 2.5rem; font-weight: 800; margin-bottom: .5rem; }
.login-left p { font-size: 1rem; color: rgba(255,255,255,.7); max-width: 400px; text-align: center; }
.login-right {
  width: 480px; display: flex; align-items: center;
  justify-content: center; padding: 2rem;
  position: relative; z-index: 1;
}
.login-card {
  width: 100%; max-width: 400px;
  background: var(--bg-card);
  border-radius: var(--radius-xl);
  padding: 2.5rem;
  box-shadow: var(--shadow-lg);
}
.login-card h3 { font-size: 1.5rem; font-weight: 700; margin-bottom: .25rem; color: var(--text-primary); }
.login-card .subtitle { color: var(--text-muted); font-size: .85rem; margin-bottom: 1.5rem; }
.login-card .form-control { padding: .65rem 1rem; font-size: .9rem; }
.login-card .btn-login {
  width: 100%; padding: .7rem; font-size: 1rem; font-weight: 600;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border: none; border-radius: var(--radius);
  color: #fff; cursor: pointer; transition: var(--transition);
}
.login-card .btn-login:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(16,185,129,.35); }
.input-group-text {
  background: var(--bg-body); border-color: var(--border-color);
  color: var(--text-muted);
}

/* ===== LOADING ===== */
.page-loader {
  position: fixed; inset: 0; background: var(--bg-body);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; transition: opacity .5s;
}
.page-loader.hide { opacity: 0; pointer-events: none; }
.spinner {
  width: 40px; height: 40px;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== POS/KASIR ===== */
.kasir-wrapper {
  display: flex; height: 100vh; background: var(--bg-body);
}
.kasir-left { flex: 1; display: flex; flex-direction: column; padding: 1rem; overflow-y: auto; }
.kasir-right {
  width: 380px; background: var(--bg-card);
  border-left: 1px solid var(--border-color);
  display: flex; flex-direction: column;
  box-shadow: -2px 0 10px rgba(0,0,0,.05);
}
.kasir-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1rem; border-bottom: 1px solid var(--border-color);
}
.kasir-items { flex: 1; overflow-y: auto; padding: 1rem; }
.kasir-item {
  display: flex; align-items: center; gap: .75rem;
  padding: .75rem; background: var(--bg-body);
  border-radius: var(--radius); margin-bottom: .5rem;
}
.kasir-footer { padding: 1rem; border-top: 1px solid var(--border-color); }
.kasir-total {
  font-size: 1.5rem; font-weight: 800;
  color: var(--primary); text-align: right;
  margin: .5rem 0;
}
.btn-kasir {
  width: 100%; padding: .85rem; font-size: 1.1rem;
  font-weight: 700; border-radius: var(--radius);
}

/* ===== MOBILE OVERLAY ===== */
.sidebar-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,.5); z-index: 1035;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 991.98px) {
  .sidebar {
    transform: translateX(-100%);
    width: var(--sidebar-width) !important;
  }
  .sidebar.mobile-open { transform: translateX(0); }
  .sidebar.mobile-open ~ .sidebar-overlay { display: block; }
  .navbar-main { left: 0 !important; }
  .main-content { margin-left: 0 !important; }
  .navbar-search { display: none; }
  .login-left { display: none; }
  .login-right { width: 100%; }
  .kasir-right { width: 320px; }
}
@media (max-width: 575.98px) {
  .main-content { padding: 1rem; }
  .stat-card .stat-value { font-size: 1.2rem; }
  .kasir-wrapper { flex-direction: column; }
  .kasir-right { width: 100%; height: 50vh; border-left: none; border-top: 1px solid var(--border-color); }
  .navbar-user .user-info { display: none; }
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.fade-in { animation: fadeIn .4s ease forwards; }
@keyframes slideInLeft { from { opacity:0; transform:translateX(-20px); } to { opacity:1; transform:translateX(0); } }
.slide-in { animation: slideInLeft .3s ease forwards; }

/* Toast */
.toast-container { position: fixed; top: 1rem; right: 1rem; z-index: 9999; }

/* DataTables overrides */
.dataTables_wrapper .dataTables_filter input {
  border: 1px solid var(--border-color); border-radius: var(--radius);
  padding: .4rem .75rem; font-size: .82rem;
}
.dataTables_wrapper .dataTables_length select {
  border: 1px solid var(--border-color); border-radius: var(--radius);
  padding: .3rem .5rem; font-size: .82rem;
}
div.dataTables_wrapper div.dataTables_info { font-size: .78rem; color: var(--text-muted); }

/* Print */
@media print {
  .sidebar, .navbar-main, .breadcrumb-wrapper, .btn, .no-print { display: none !important; }
  .main-content { margin: 0 !important; padding: 0 !important; }
  .card { box-shadow: none !important; border: 1px solid #ddd !important; }
}

/* Nota thermal */
.nota-thermal { width: 58mm; font-family: 'Courier New', monospace; font-size: 11px; padding: 5mm; }
.nota-thermal .nota-center { text-align: center; }
.nota-thermal .nota-line { border-top: 1px dashed #000; margin: 3mm 0; }
.nota-thermal table { width: 100%; }
.nota-thermal td { vertical-align: top; }

/* Nota A4 */
.nota-a4 { width: 210mm; padding: 15mm; font-family: 'Inter', sans-serif; font-size: 12px; }

/* ===== RASIO PRODUKSI WARNING ===== */
.rasio-produksi-card { border-top: 3px solid var(--primary); }

.rasio-legend {
  display: flex; flex-wrap: wrap; gap: .75rem;
  padding: .6rem 1rem;
  background: var(--bg-body);
  border-radius: var(--radius);
  font-size: .75rem; color: var(--text-secondary);
}
.rasio-legend-item { display: flex; align-items: center; gap: .35rem; }
.rasio-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
  display: inline-block;
}

.rasio-item {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: var(--transition);
  position: relative;
}
.rasio-item:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }
.rasio-item::before {
  content: ''; position: absolute; top: 0; left: 0; right: 0;
  height: 3px;
}
.rasio-item.rasio-bagus::before { background: linear-gradient(90deg, #10B981, #059669); }
.rasio-item.rasio-normal::before { background: linear-gradient(90deg, #10B981, #34D399); }
.rasio-item.rasio-wajar::before { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.rasio-item.rasio-evaluasi::before { background: linear-gradient(90deg, #EF4444, #F87171); }
.rasio-item.rasio-belum_input::before { background: linear-gradient(90deg, #06B6D4, #22D3EE); }
.rasio-item.rasio-kosong::before { background: linear-gradient(90deg, #94A3B8, #CBD5E1); }

.rasio-item.rasio-bagus { border-color: rgba(16,185,129,.3); }
.rasio-item.rasio-evaluasi { border-color: rgba(239,68,68,.3); }
.rasio-item.rasio-wajar { border-color: rgba(245,158,11,.3); }

.rasio-item-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: .85rem 1rem .5rem;
  gap: .5rem;
}
.rasio-kandang-name {
  font-weight: 600; font-size: .88rem; color: var(--text-primary);
  display: flex; align-items: center;
}
.rasio-kandang-name i { color: var(--primary); font-size: .8rem; }
.rasio-kandang-code {
  font-size: .7rem; color: var(--text-muted);
  font-weight: 500; margin-top: 1px;
}

.rasio-item-body { padding: .5rem 1rem 1rem; }

.rasio-stats {
  display: flex; gap: 1rem; margin-bottom: .75rem;
}
.rasio-stat {
  flex: 1; display: flex; flex-direction: column;
  padding: .5rem .65rem;
  background: var(--bg-body);
  border-radius: var(--radius);
}
.rasio-stat-label {
  font-size: .68rem; color: var(--text-muted);
  font-weight: 500; text-transform: uppercase;
  letter-spacing: .03em;
}
.rasio-stat-value {
  font-size: 1.1rem; font-weight: 700;
  color: var(--text-primary); line-height: 1.3;
}
.rasio-stat-value small {
  font-size: .65rem; font-weight: 400;
  color: var(--text-muted);
}

/* Progress bar */
.rasio-progress-wrapper { margin-bottom: .6rem; }
.rasio-progress-header {
  display: flex; justify-content: space-between;
  align-items: center; margin-bottom: .3rem;
}
.rasio-progress-label { font-size: .72rem; color: var(--text-muted); font-weight: 500; }
.rasio-progress-value { font-size: .82rem; }

.rasio-progress {
  height: 8px; background: var(--bg-body);
  border-radius: 4px; overflow: visible;
  position: relative;
}
.rasio-progress-bar {
  height: 100%; border-radius: 4px;
  transition: width 1s cubic-bezier(.4,0,.2,1);
  position: relative; z-index: 1;
}
.rasio-progress-bar.bg-primary { background: linear-gradient(90deg, #10B981, #059669) !important; }
.rasio-progress-bar.bg-success { background: linear-gradient(90deg, #10B981, #34D399) !important; }
.rasio-progress-bar.bg-warning { background: linear-gradient(90deg, #F59E0B, #FBBF24) !important; }
.rasio-progress-bar.bg-danger { background: linear-gradient(90deg, #EF4444, #F87171) !important; }

.rasio-threshold {
  position: absolute; top: -2px; bottom: -2px;
  width: 2px; background: var(--text-muted);
  opacity: .3; z-index: 2;
  border-radius: 1px;
}

/* Average & Trend */
.rasio-avg {
  font-size: .75rem; color: var(--text-secondary);
  padding: .4rem 0;
  border-top: 1px dashed var(--border-color);
}
.rasio-trend {
  display: inline-flex; align-items: center; gap: .2rem;
  font-size: .7rem; font-weight: 600;
  padding: .1rem .4rem; border-radius: 4px;
  margin-left: .35rem;
}
.rasio-trend.up { background: rgba(16,185,129,.1); color: #10B981; }
.rasio-trend.down { background: rgba(239,68,68,.1); color: #EF4444; }
.rasio-trend.stable { background: rgba(100,116,139,.1); color: #64748B; }

/* Alert messages */
.rasio-alert {
  margin-top: .6rem; padding: .5rem .75rem;
  background: rgba(239,68,68,.08);
  border: 1px solid rgba(239,68,68,.2);
  border-radius: var(--radius);
  font-size: .73rem; color: #DC2626;
  line-height: 1.4;
}
.rasio-alert-warning {
  background: rgba(245,158,11,.08);
  border-color: rgba(245,158,11,.2);
  color: #D97706;
}

/* Pulse animation for warning badge */
.pulse-badge {
  animation: pulse-glow 2s ease-in-out infinite;
}
@keyframes pulse-glow {
  0%, 100% { box-shadow: 0 0 0 0 rgba(239,68,68,.4); }
  50% { box-shadow: 0 0 0 8px rgba(239,68,68,0); }
}

/* Produksi table warning styles */
.produksi-warning-cell {
  display: flex; align-items: center; gap: .4rem;
}
.produksi-warning-icon {
  width: 22px; height: 22px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: .65rem; flex-shrink: 0;
}
.produksi-warning-icon.bg-primary { background: rgba(16,185,129,.15) !important; color: #059669; }
.produksi-warning-icon.bg-success { background: rgba(16,185,129,.15) !important; color: #10B981; }
.produksi-warning-icon.bg-warning { background: rgba(245,158,11,.15) !important; color: #F59E0B; }
.produksi-warning-icon.bg-danger { background: rgba(239,68,68,.15) !important; color: #EF4444; }
.produksi-warning-text {
  font-size: .72rem; font-weight: 500;
  line-height: 1.2;
}

/* Dark mode adjustments */
[data-theme="dark"] .rasio-item { background: rgba(30,41,59,.8); }
[data-theme="dark"] .rasio-stat { background: rgba(15,23,42,.5); }
[data-theme="dark"] .rasio-alert { background: rgba(239,68,68,.12); }
[data-theme="dark"] .rasio-alert-warning { background: rgba(245,158,11,.12); }

/* ===== PROPORSI PRODUKTIVITAS (Laporan) ===== */
.proporsi-card {
  display: flex; align-items: center; gap: .85rem;
  padding: 1rem 1.15rem;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  position: relative; overflow: hidden;
  transition: var(--transition);
}
.proporsi-card::before {
  content: ''; position: absolute;
  top: 0; left: 0; width: 4px; height: 100%;
}
.proporsi-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.proporsi-card.proporsi-bagus::before { background: linear-gradient(180deg, #3B82F6, #2563EB); }
.proporsi-card.proporsi-normal::before { background: linear-gradient(180deg, #10B981, #059669); }
.proporsi-card.proporsi-wajar::before { background: linear-gradient(180deg, #F59E0B, #D97706); }
.proporsi-card.proporsi-evaluasi::before { background: linear-gradient(180deg, #EF4444, #DC2626); }

.proporsi-icon {
  width: 42px; height: 42px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); font-size: 1.1rem; flex-shrink: 0;
}
.proporsi-bagus .proporsi-icon { background: rgba(59,130,246,.1); color: #3B82F6; }
.proporsi-normal .proporsi-icon { background: rgba(16,185,129,.1); color: #10B981; }
.proporsi-wajar .proporsi-icon { background: rgba(245,158,11,.1); color: #F59E0B; }
.proporsi-evaluasi .proporsi-icon { background: rgba(239,68,68,.1); color: #EF4444; }

.proporsi-info { flex: 1; min-width: 0; }
.proporsi-label { font-size: .72rem; color: var(--text-muted); font-weight: 500; line-height: 1.3; }
.proporsi-label small { font-size: .65rem; opacity: .7; }
.proporsi-value { font-size: 1.4rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; }
.proporsi-persen { font-size: .72rem; font-weight: 600; margin-top: 1px; }
.proporsi-bagus .proporsi-persen { color: #3B82F6; }
.proporsi-normal .proporsi-persen { color: #10B981; }
.proporsi-wajar .proporsi-persen { color: #F59E0B; }
.proporsi-evaluasi .proporsi-persen { color: #EF4444; }

/* Stacked Proportion Bar */
.proporsi-bar-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}
.proporsi-bar {
  display: flex; height: 14px;
  border-radius: 7px; overflow: hidden;
  background: var(--bg-body);
}
.proporsi-segment {
  height: 100%; transition: width .8s cubic-bezier(.4,0,.2,1);
  position: relative; cursor: pointer;
}
.proporsi-segment:hover { opacity: .85; }
.proporsi-seg-bagus { background: linear-gradient(90deg, #3B82F6, #60A5FA); }
.proporsi-seg-normal { background: linear-gradient(90deg, #10B981, #34D399); }
.proporsi-seg-wajar { background: linear-gradient(90deg, #F59E0B, #FBBF24); }
.proporsi-seg-evaluasi { background: linear-gradient(90deg, #EF4444, #F87171); }

.proporsi-bar-labels {
  display: flex; justify-content: center; gap: 1.25rem;
  margin-top: .6rem; font-size: .75rem; font-weight: 600;
}

/* Dark mode adjustments for proporsi */
[data-theme="dark"] .proporsi-card { background: rgba(30,41,59,.8); }

/* ===== 3-LEVEL SIDEBAR MENU (Per-Kandang) ===== */
.menu-submenu-deep {
  padding-left: .5rem;
  border-left: 2px solid rgba(16,185,129,.15);
  margin-left: 2.25rem;
  margin-top: 2px;
  margin-bottom: 4px;
}
.menu-submenu-deep .sub-item-deep {
  padding-left: 1rem !important;
  font-size: .82em;
  padding-top: .4rem;
  padding-bottom: .4rem;
  margin-top: 1px;
  margin-bottom: 1px;
  opacity: .85;
}
.menu-submenu-deep .sub-item-deep:hover { opacity: 1; }
.menu-submenu-deep .sub-item-deep.active { opacity: 1; }
.menu-submenu-deep .sub-item-deep i { font-size: .8rem; width: 16px; }

/* ===== LAPORAN PER-KANDANG PAGE ===== */
.stat-mini-card {
  border-radius: 12px;
  padding: 16px 20px;
  text-align: center;
  transition: transform .2s;
}
.stat-mini-card:hover { transform: translateY(-2px); }
.stat-mini-value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.stat-mini-label { font-size: .78rem; color: var(--text-secondary); margin-top: 4px; }

.nav-kandang-tabs { gap: 6px; padding-bottom: 4px; }
.nav-kandang-tabs .nav-link {
  border-radius: 10px;
  padding: 8px 16px;
  font-size: .85rem;
  white-space: nowrap;
  color: var(--text-primary);
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  transition: all .2s;
}
.nav-kandang-tabs .nav-link:hover { background: var(--primary-bg); color: var(--primary); }
.nav-kandang-tabs .nav-link.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(16,185,129,.3);
}
.kandang-header-card { border-left: 4px solid var(--primary); }
@media (max-width: 768px) {
  .tab-label { display: none; }
  .nav-kandang-tabs .nav-link { padding: 8px 12px; }
}

/* ===== FOOTER ===== */
.main-footer {
  margin-left: var(--sidebar-width);
  padding: 1rem 1.5rem;
  background: var(--bg-card);
  border-top: 1px solid var(--border-color);
  font-size: .78rem;
  color: var(--text-muted);
  transition: var(--transition);
}
.sidebar.collapsed ~ .main-wrapper .main-footer { margin-left: var(--sidebar-collapsed); }
@media (max-width: 991.98px) {
  .main-footer { margin-left: 0 !important; }
}
@media print {
  .main-footer { display: none !important; }
}

