/* Poultry Munshi design system. Mobile-first, big touch targets, readable in sunlight, RTL-safe (logical properties). */

/* ---------- 1. tokens ---------- */
:root, [data-bs-theme="light"] {
  --c-bg: #fbf6ee; --c-surface: #ffffff; --c-surface-2: #f6efe4; --c-border: #eadfce; --c-ink: #2a2118; --c-muted: #77685a;
  --c-primary: #c2570c; --c-primary-600: #a34609; --c-primary-soft: #fdebd8; --c-on-primary: #ffffff;
  --c-yolk: #f2b200; --c-yolk-soft: #fff3c4;
  --c-green: #15803d; --c-green-soft: #dcf5e3; --c-red: #b91c1c; --c-red-soft: #fde4e1;
  --c-blue: #1d6fb8; --c-blue-soft: #dcecfa; --c-purple: #7b3fb0; --c-purple-soft: #efe2fa; --c-teal: #0f766e; --c-teal-soft: #d5f2ee;
  --c-warn: #a15c07; --c-warn-soft: #fff0cf;
  --shadow-sm: 0 1px 2px rgba(60, 40, 15, .08);
  --shadow: 0 2px 6px rgba(60, 40, 15, .06), 0 12px 28px rgba(60, 40, 15, .08);
  --radius: 18px; --radius-sm: 12px;
  --topbar-h: 56px; --bottomnav-h: 66px; --sidebar-w: 264px; --safe-b: env(safe-area-inset-bottom, 0px);
  --bs-body-bg: var(--c-bg); --bs-body-color: var(--c-ink); --bs-tertiary-bg: var(--c-surface-2); --bs-secondary-bg: var(--c-surface-2);
  --bs-border-color: var(--c-border); --bs-border-color-translucent: var(--c-border); --bs-secondary-color: var(--c-muted);
  --bs-primary: var(--c-primary); --bs-primary-rgb: 194, 87, 12; --bs-link-color: var(--c-primary-600); --bs-link-hover-color: var(--c-primary);
  --bs-success: var(--c-green); --bs-danger: var(--c-red); --bs-warning: var(--c-yolk);
}
[data-bs-theme="dark"] {
  --c-bg: #15110c; --c-surface: #211a13; --c-surface-2: #1b150f; --c-border: #3a2f23; --c-ink: #f3ebe0; --c-muted: #b2a392;
  --c-primary: #f59e4b; --c-primary-600: #ffb26b; --c-primary-soft: #3b2615; --c-on-primary: #2a1505;
  --c-yolk: #f5c43a; --c-yolk-soft: #3a3010;
  --c-green: #4ade80; --c-green-soft: #14301f; --c-red: #f87171; --c-red-soft: #3b1a18;
  --c-blue: #60a5fa; --c-blue-soft: #14283d; --c-purple: #c4a1ee; --c-purple-soft: #2a1d3a; --c-teal: #2dd4bf; --c-teal-soft: #11302d;
  --c-warn: #f5c43a; --c-warn-soft: #3a3010;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5); --shadow: 0 2px 6px rgba(0, 0, 0, .4), 0 12px 28px rgba(0, 0, 0, .45);
  --bs-primary-rgb: 245, 158, 75;
}

/* ---------- 2. base ---------- */
html, body { height: 100%; }
body {
  background: var(--c-bg); color: var(--c-ink); -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; font-size: 1rem; line-height: 1.5;
}
button, .btn, a { touch-action: manipulation; }
a { color: var(--c-primary-600); text-underline-offset: 3px; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--c-primary) 55%, transparent); outline-offset: 2px; }
h1, h2, h3, h4, h5, h6 { letter-spacing: 0; }
.money, .num, .stat-v { font-variant-numeric: tabular-nums; }
[dir="rtl"] .money, [dir="rtl"] .num, [dir="rtl"] .stat-v, [dir="rtl"] input[inputmode], [dir="rtl"] input[type="date"], [dir="rtl"] input[type="tel"] { direction: ltr; unicode-bidi: plaintext; }
.text-pos { color: var(--c-green) !important; } .text-neg { color: var(--c-red) !important; } .text-muted-2 { color: var(--c-muted) !important; }
[dir="rtl"] .bi-arrow-left, [dir="rtl"] .bi-arrow-right, [dir="rtl"] .bi-chevron-left, [dir="rtl"] .bi-chevron-right, [dir="rtl"] .bi-box-arrow-right,
[dir="rtl"] .bi-arrow-return-left { display: inline-block; transform: scaleX(-1); }
i.bi, i[class*="bi-"] { line-height: 1; }
#splash { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; z-index: 3000;
  background: radial-gradient(90% 70% at 50% 30%, #e0731f 0, #c2570c 60%, #8f3d05 100%); color: #fff; }
#splash .brand { font-size: 1.5rem; font-weight: 800; margin-top: 14px; }
#splash .tag { opacity: .8; font-size: .85rem; letter-spacing: .1em; text-transform: uppercase; }
#splash-error { color: #fff; }
#loading-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .3); z-index: 2500; display: flex; align-items: center; justify-content: center; }
#loading-overlay.d-none { display: none !important; }
.toast-container { z-index: 3600; }
.toast { border-radius: 14px; font-size: 1rem; box-shadow: var(--shadow); }
#route-bar { position: fixed; top: 0; inset-inline-start: 0; height: 3px; width: 0; z-index: 3500; background: linear-gradient(90deg, var(--c-yolk), var(--c-primary)); opacity: 0; pointer-events: none; }
#route-bar.run { animation: routebar .6s ease; }
@keyframes routebar { 0% { width: 0; opacity: 1; } 70% { width: 85%; opacity: 1; } 100% { width: 100%; opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
#content > * { animation: rise .3s ease backwards; }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; } }

/* ---------- 3. shell ---------- */
#view-app { min-height: 100vh; }
.app-topbar { position: sticky; top: 0; z-index: 1010; height: var(--topbar-h); display: flex; align-items: center; gap: 4px; padding-inline: 12px 8px;
  background: color-mix(in srgb, var(--c-surface) 92%, transparent); backdrop-filter: blur(12px); border-bottom: 1px solid var(--c-border); }
#topbar-title { font-size: 1.12rem; font-weight: 800; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tb-btn { border: 0; background: none; color: var(--c-ink); min-width: 44px; height: 44px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; font-weight: 700; font-size: .95rem; padding-inline: 8px; }
.tb-btn:hover { background: var(--c-primary-soft); }
.tb-btn i { font-size: 1.25rem; }
.farm-chip { display: inline-flex; align-items: center; gap: 6px; max-width: 150px; padding: 6px 12px; border-radius: 999px; background: var(--c-primary-soft); color: var(--c-primary-600); font-weight: 800; font-size: .85rem; border: 0; }
.farm-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.conn-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--c-green); flex-shrink: 0; }
.conn-dot.off { background: var(--c-muted); }

#sidebar { position: fixed; inset-block: 0; inset-inline-start: 0; width: var(--sidebar-w); z-index: 1020; overflow-y: auto; overflow-x: hidden;
  background: linear-gradient(185deg, #5a2305 0%, #8f3d05 55%, #b4510a 100%); color: #fff; }
.sidebar-brand { height: var(--topbar-h); display: flex; align-items: center; gap: 10px; padding-inline: 18px; font-weight: 800; font-size: 1.1rem; }
.sidebar-brand img { width: 34px; height: 34px; border-radius: 10px; }
.nav-menu { margin: 0; padding: 6px 0 16px; flex-wrap: nowrap; flex-direction: column; }
.nav-menu .nav-section { font-size: .72rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; padding: 14px 22px 4px; color: rgba(255, 255, 255, .6); }
.nav-menu .nav-link { display: flex; align-items: center; gap: 12px; min-height: 48px; margin: 2px 10px; padding: 10px 14px; border-radius: 14px; font-weight: 700; color: rgba(255, 255, 255, .92); border: 0; }
.nav-menu .nav-link i { font-size: 1.25rem; width: 26px; text-align: center; }
.nav-menu .nav-link:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.nav-menu .nav-link.active { background: #fff; color: #7a3304; box-shadow: 0 4px 14px rgba(0, 0, 0, .2); }
.offcanvas { background: var(--c-surface); color: var(--c-ink); }
.offcanvas .nav-menu .nav-section { color: var(--c-muted); }
.offcanvas .nav-menu .nav-link { color: var(--c-ink); }
.offcanvas .nav-menu .nav-link:hover { background: var(--c-primary-soft); }
.offcanvas .nav-menu .nav-link.active { background: var(--c-primary-soft); color: var(--c-primary-600); box-shadow: none; }
@media (min-width: 992px) { .app-main { margin-inline-start: var(--sidebar-w); } }
#content { padding: 14px 14px calc(var(--bottomnav-h) + var(--safe-b) + 24px); max-width: 1180px; margin-inline: auto; outline: none; }
@media (min-width: 992px) { #content { padding: 22px 28px 40px; } }

#bottom-nav { position: fixed; inset-inline: 0; bottom: 0; z-index: 1030; height: calc(var(--bottomnav-h) + var(--safe-b)); padding-bottom: var(--safe-b); display: flex;
  background: var(--c-surface); border-top: 1px solid var(--c-border); box-shadow: 0 -4px 18px rgba(60, 40, 15, .08); }
#bottom-nav a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; text-decoration: none; color: var(--c-muted); font-size: .76rem; font-weight: 800; position: relative; }
#bottom-nav a i { font-size: 1.45rem; }
#bottom-nav a.active { color: var(--c-primary); }
#bottom-nav a.active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--c-primary); }
#bottom-nav a.nav-add i { width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(145deg, #e8761f, #c2570c); color: #fff; display: inline-flex; align-items: center; justify-content: center; margin-top: -30px; font-size: 1.8rem; box-shadow: 0 8px 20px rgba(194, 87, 12, .45); border: 4px solid var(--c-surface); }
#bottom-nav a.nav-add::before { display: none; }
#bottom-nav a.nav-add span { margin-top: -2px; color: var(--c-primary); }
#bottom-nav .nav-badge { position: absolute; top: 6px; inset-inline-start: calc(50% + 8px); min-width: 18px; height: 18px; border-radius: 9px; background: var(--c-red); color: #fff; font-size: .68rem; display: flex; align-items: center; justify-content: center; padding: 0 5px; }
@media (min-width: 992px) { #bottom-nav { display: none; } #content { padding-bottom: 40px; } }

/* ---------- 4. controls ---------- */
.page-header { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; position: relative; z-index: 5; }
.ph-title { flex: 1; min-width: 0; }
.page-header h1 { font-size: 1.35rem; font-weight: 800; margin: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ph-sub { font-size: .85rem; color: var(--c-muted); }
.ph-actions { display: flex; gap: 8px; flex-shrink: 0; }
.btn { border-radius: 14px; min-height: 46px; padding: 8px 18px; font-weight: 800; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; box-shadow: none; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn-sm { min-height: 40px; padding: 6px 14px; font-size: .92rem; border-radius: 12px; }
.btn-lg { min-height: 56px; font-size: 1.12rem; border-radius: 16px; }
.btn-icon { width: 44px; min-height: 44px; padding: 0; }
.btn-primary { --bs-btn-bg: var(--c-primary); --bs-btn-border-color: var(--c-primary); --bs-btn-hover-bg: var(--c-primary-600); --bs-btn-hover-border-color: var(--c-primary-600);
  --bs-btn-active-bg: var(--c-primary-600); --bs-btn-active-border-color: var(--c-primary-600); --bs-btn-color: var(--c-on-primary); --bs-btn-hover-color: var(--c-on-primary); --bs-btn-active-color: var(--c-on-primary);
  --bs-btn-disabled-bg: var(--c-primary); --bs-btn-disabled-border-color: var(--c-primary); --bs-btn-disabled-color: var(--c-on-primary); }
.btn-success { --bs-btn-bg: var(--c-green); --bs-btn-border-color: var(--c-green); --bs-btn-hover-bg: color-mix(in srgb, var(--c-green) 85%, #000); --bs-btn-hover-border-color: var(--c-green); --bs-btn-color: #fff; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .btn-success { --bs-btn-color: #052e16; --bs-btn-hover-color: #052e16; }
.btn-danger { --bs-btn-bg: var(--c-red); --bs-btn-border-color: var(--c-red); --bs-btn-hover-bg: color-mix(in srgb, var(--c-red) 85%, #000); --bs-btn-hover-border-color: var(--c-red); --bs-btn-color: #fff; --bs-btn-hover-color: #fff; }
[data-bs-theme="dark"] .btn-danger { --bs-btn-color: #2a0505; --bs-btn-hover-color: #2a0505; }
.btn-light, .btn-outline-secondary { --bs-btn-bg: var(--c-surface); --bs-btn-border-color: var(--c-border); --bs-btn-color: var(--c-ink); --bs-btn-hover-bg: var(--c-primary-soft); --bs-btn-hover-border-color: var(--c-primary); --bs-btn-hover-color: var(--c-ink); --bs-btn-active-bg: var(--c-primary-soft); --bs-btn-active-color: var(--c-ink); --bs-btn-active-border-color: var(--c-primary); --bs-btn-border-width: 2px; border-width: 2px; }
.btn-outline-primary { --bs-btn-color: var(--c-primary-600); --bs-btn-border-color: var(--c-primary); --bs-btn-hover-bg: var(--c-primary); --bs-btn-hover-border-color: var(--c-primary); --bs-btn-hover-color: var(--c-on-primary); --bs-btn-active-bg: var(--c-primary); --bs-btn-active-color: var(--c-on-primary); --bs-btn-border-width: 2px; }
.btn-outline-danger { --bs-btn-color: var(--c-red); --bs-btn-border-color: var(--c-red); --bs-btn-hover-bg: var(--c-red); --bs-btn-hover-border-color: var(--c-red); --bs-btn-border-width: 2px; }
.btn-wa { --bs-btn-bg: #1faa59; --bs-btn-border-color: #1faa59; --bs-btn-color: #fff; --bs-btn-hover-bg: #178a47; --bs-btn-hover-border-color: #178a47; --bs-btn-hover-color: #fff; }

.form-label { font-size: .95rem; font-weight: 800; color: var(--c-ink); margin-bottom: 6px; }
.form-text { color: var(--c-muted); font-size: .82rem; }
.form-control, .form-select { min-height: 50px; border: 2px solid var(--c-border); border-radius: 14px; background-color: var(--c-surface); color: var(--c-ink); font-size: 1.05rem; padding: 10px 14px; box-shadow: none; }
.form-control-sm, .form-select-sm { min-height: 42px; font-size: .95rem; }
.form-control:focus, .form-select:focus { border-color: var(--c-primary); background-color: var(--c-surface); box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-primary) 18%, transparent); color: var(--c-ink); }
.form-control::placeholder { color: color-mix(in srgb, var(--c-muted) 70%, transparent); }
.form-control:disabled, .form-control[readonly] { background: var(--c-surface-2); }
textarea.form-control { min-height: 80px; }
.form-check-input { width: 1.4em; height: 1.4em; border-width: 2px; border-color: var(--c-border); }
.form-check-input:checked { background-color: var(--c-primary); border-color: var(--c-primary); }
.form-switch .form-check-input { width: 2.8em; }
.form-check-label { font-weight: 700; }
.input-group-text { background: var(--c-surface-2); border: 2px solid var(--c-border); color: var(--c-muted); font-weight: 700; }
.num-in { font-weight: 700; font-size: 1.15rem; text-align: center; }
.form-select { background-position: right 14px center; }
[dir="rtl"] .form-select { background-position: left 14px center; padding-inline: 14px 40px; }
.lock-total { background: var(--c-primary-soft); border-radius: var(--radius-sm); padding: 12px 14px; display: flex; justify-content: space-between; align-items: baseline; gap: 10px; }
.lock-total b { font-size: 1.5rem; color: var(--c-primary-600); }
.lock-total small { color: var(--c-muted); font-weight: 700; }

/* stepper: big − / + counters for numbers typed with thumbs */
.stepper { background: var(--c-surface); border: 2px solid var(--c-border); border-radius: 16px; padding: 8px 10px 10px; text-align: center; }
.stepper-label { font-size: .85rem; font-weight: 800; color: var(--c-muted); margin-bottom: 4px; }
.stepper-row { display: flex; align-items: center; gap: 6px; }
.stepper button { flex: 0 0 46px; width: 46px; height: 46px; border-radius: 14px; border: 0; background: var(--c-primary-soft); color: var(--c-primary-600); font-size: 1.2rem; display: flex; align-items: center; justify-content: center; }
.stepper button:active { transform: scale(.92); background: var(--c-primary); color: var(--c-on-primary); }
.stepper .st-input { flex: 1; min-width: 0; width: 100%; border: 0; background: transparent; text-align: center; font-size: 1.55rem; font-weight: 800; color: var(--c-ink); padding: 0; height: 46px; font-variant-numeric: tabular-nums; }
.stepper .st-input:focus { outline: none; }
.stepper:focus-within { border-color: var(--c-primary); }
.stepper-unit { font-size: .78rem; color: var(--c-muted); margin-top: 2px; }

/* segmented choice */
.seg { display: flex; flex-wrap: wrap; gap: 8px; }
.seg-item { flex: 1 1 auto; margin: 0; cursor: pointer; }
.seg-item input { position: absolute; opacity: 0; pointer-events: none; }
.seg-item span { display: flex; align-items: center; justify-content: center; gap: 6px; min-height: 46px; padding: 8px 14px; border-radius: 14px; border: 2px solid var(--c-border); background: var(--c-surface); font-weight: 800; text-align: center; transition: background .15s, border-color .15s; }
.seg-item input:checked + span { background: var(--c-primary-soft); border-color: var(--c-primary); color: var(--c-primary-600); }
.seg-item input:focus-visible + span { outline: 3px solid color-mix(in srgb, var(--c-primary) 55%, transparent); }
.seg.seg-sm .seg-item span { min-height: 38px; padding: 4px 10px; font-size: .9rem; border-radius: 12px; }

.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 800; background: var(--c-surface-2); color: var(--c-muted); white-space: nowrap; }
.pill-ok { background: var(--c-green-soft); color: var(--c-green); } .pill-warn { background: var(--c-warn-soft); color: var(--c-warn); }
.pill-bad { background: var(--c-red-soft); color: var(--c-red); } .pill-info { background: var(--c-blue-soft); color: var(--c-blue); } .pill-main { background: var(--c-primary-soft); color: var(--c-primary-600); }
.badge { border-radius: 999px; padding: .4em .75em; font-weight: 800; }

.alert { border-radius: var(--radius-sm); border-width: 1px; }
.alert-warning { background: var(--c-warn-soft); border-color: color-mix(in srgb, var(--c-warn) 35%, transparent); color: var(--c-ink); }
.alert-danger { background: var(--c-red-soft); border-color: color-mix(in srgb, var(--c-red) 35%, transparent); color: var(--c-ink); }
.alert-info { background: var(--c-blue-soft); border-color: color-mix(in srgb, var(--c-blue) 35%, transparent); color: var(--c-ink); }
.alert-success { background: var(--c-green-soft); border-color: color-mix(in srgb, var(--c-green) 35%, transparent); color: var(--c-ink); }
.alert-secondary { background: var(--c-surface-2); color: var(--c-ink); border-color: var(--c-border); }

.modal-content { border: 0; border-radius: 22px; background: var(--c-surface); color: var(--c-ink); box-shadow: 0 24px 60px rgba(0, 0, 0, .3); overflow: hidden; }
.modal-header { border-bottom: 1px solid var(--c-border); padding: 14px 18px; }
.modal-title { font-weight: 800; font-size: 1.15rem; }
.modal-body { padding: 18px; }
.modal-footer { border-top: 1px solid var(--c-border); padding: 12px 18px calc(12px + var(--safe-b)); gap: 8px; flex-wrap: nowrap; }
.modal-footer > * { margin: 0; }
.modal-backdrop { --bs-backdrop-opacity: .55; }
@media (max-width: 575.98px) { .modal-fullscreen-sm-down .modal-content { border-radius: 0; } }
.sheet-list { display: flex; flex-direction: column; gap: 4px; }
.sheet-item { display: flex; align-items: center; gap: 14px; text-align: start; border: 0; background: none; padding: 12px 10px; border-radius: 14px; min-height: 56px; color: inherit; }
.sheet-item:hover, .sheet-item:active { background: var(--c-primary-soft); }
.sheet-item i { font-size: 1.5rem; width: 34px; text-align: center; color: var(--c-primary); }
.sheet-item.text-danger i { color: var(--c-red); }
.sheet-item span { display: flex; flex-direction: column; line-height: 1.25; }
.sheet-item small { color: var(--c-muted); font-weight: 600; }

/* ---------- 5. cards, tiles, lists ---------- */
.p-card, .card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow-sm); color: var(--c-ink); }
.p-card { padding: 16px; margin-bottom: 14px; }
.p-card > h2, .sec-title { font-size: .95rem; font-weight: 800; color: var(--c-muted); margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
.sec-title { margin: 20px 0 10px; }
.sec-title .link { margin-inline-start: auto; font-size: .85rem; font-weight: 800; }
.sec-title i { color: var(--c-primary); }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-bottom: 14px; }
@media (min-width: 768px) { .tiles { grid-template-columns: repeat(4, 1fr); } .tiles.t3 { grid-template-columns: repeat(3, 1fr); } }
.tile { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); padding: 12px 14px; box-shadow: var(--shadow-sm); text-decoration: none; color: var(--c-ink); display: block; position: relative; overflow: hidden; }
a.tile:hover { border-color: var(--c-primary); color: var(--c-ink); }
.tile .stat-l { font-size: .8rem; font-weight: 800; color: var(--c-muted); display: flex; align-items: center; gap: 6px; }
.tile .stat-l i { font-size: 1rem; color: var(--c-primary); }
.tile .stat-v { font-size: 1.5rem; font-weight: 800; line-height: 1.2; margin-top: 2px; }
.tile .stat-s { font-size: .78rem; color: var(--c-muted); margin-top: 2px; }
.tile.good .stat-v { color: var(--c-green); } .tile.bad .stat-v { color: var(--c-red); } .tile.warn .stat-v { color: var(--c-warn); }
.tile::before { content: ""; position: absolute; inset-block: 10px; inset-inline-start: 0; width: 4px; border-radius: 0 4px 4px 0; background: var(--tile-c, var(--c-primary)); }
[dir="rtl"] .tile::before { border-radius: 4px 0 0 4px; }
.tile.good { --tile-c: var(--c-green); } .tile.bad { --tile-c: var(--c-red); } .tile.warn { --tile-c: var(--c-yolk); } .tile.blue { --tile-c: var(--c-blue); }

.list-card { background: var(--c-surface); border: 1px solid var(--c-border); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; margin-bottom: 14px; }
.list-row { display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 62px; border: 0; border-bottom: 1px solid var(--c-border); color: inherit; text-decoration: none; background: none; width: 100%; text-align: start; }
.list-row:last-child { border-bottom: 0; }
a.list-row:hover, button.list-row:hover { background: var(--c-primary-soft); color: inherit; }
.list-row .main { flex: 1; min-width: 0; }
.list-row .title { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .sub { font-size: .85rem; color: var(--c-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-row .end { text-align: end; white-space: nowrap; font-weight: 800; }
.list-row .end small { display: block; font-weight: 600; color: var(--c-muted); }
.list-row > .bi:first-child { font-size: 1.2rem; color: var(--c-muted); }
.ico { width: 44px; height: 44px; border-radius: 14px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.3rem; flex-shrink: 0; background: var(--c-primary-soft); color: var(--c-primary); }
.ico.g { background: var(--c-green-soft); color: var(--c-green); } .ico.r { background: var(--c-red-soft); color: var(--c-red); } .ico.b { background: var(--c-blue-soft); color: var(--c-blue); }
.ico.y { background: var(--c-yolk-soft); color: var(--c-warn); } .ico.p { background: var(--c-purple-soft); color: var(--c-purple); } .ico.t { background: var(--c-teal-soft); color: var(--c-teal); }
.pager-more { justify-content: center; color: var(--c-primary-600); font-weight: 800; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.filters > * { flex: 1 1 140px; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; margin-bottom: 8px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 9px 16px; border-radius: 999px; border: 2px solid var(--c-border); background: var(--c-surface); font-weight: 800; font-size: .92rem; white-space: nowrap; color: var(--c-ink); text-decoration: none; flex-shrink: 0; }
.chip.active { background: var(--c-primary); border-color: var(--c-primary); color: var(--c-on-primary); }
.empty-state { text-align: center; padding: 36px 16px; color: var(--c-muted); }
.empty-state i { font-size: 2.6rem; display: block; margin-bottom: 8px; opacity: .6; }
.empty-state .btn { margin-top: 14px; }

.table { --bs-table-bg: transparent; --bs-table-color: var(--c-ink); --bs-table-border-color: var(--c-border); font-size: .95rem; }
.table > :not(caption) > * > * { padding: .65rem .6rem; }
.table thead th { background: var(--c-primary-soft); color: var(--c-primary-600); font-weight: 800; border-bottom: 2px solid var(--c-primary); white-space: nowrap; }
.table-report td.num, .table-report th.num { text-align: end; white-space: nowrap; }
.table tfoot td { font-weight: 800; border-top: 2px solid var(--c-border); }
.table-responsive { border-radius: var(--radius-sm); }
.bar { height: 8px; border-radius: 6px; background: var(--c-surface-2); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 6px; background: var(--c-primary); }
.bar.good > i { background: var(--c-green); } .bar.bad > i { background: var(--c-red); } .bar.warn > i { background: var(--c-yolk); }

/* ---------- 6. home / flocks ---------- */
.hero { position: relative; overflow: hidden; border-radius: 24px; padding: 18px 18px 20px; margin-bottom: 16px; color: #fff;
  background: radial-gradient(120% 140% at 100% 0, #f6a042 0, transparent 55%), linear-gradient(135deg, #8f3d05 0%, #c2570c 55%, #e07a1f 100%); box-shadow: 0 14px 34px rgba(143, 61, 5, .3); }
.hero .hero-hi { font-size: .85rem; opacity: .9; }
.hero h1 { font-weight: 800; font-size: 1.4rem; margin: 2px 0 10px; }
.hero .hero-big { font-size: 2.1rem; font-weight: 800; line-height: 1.1; }
.hero .hero-sub { font-size: .85rem; opacity: .92; }
.hero .hero-art { position: absolute; inset-inline-end: 8px; inset-block-start: 8px; width: 84px; height: 84px; opacity: .95; pointer-events: none; }
.hero .hero-hi, .hero h1 { padding-inline-end: 80px; }
.hero-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; position: relative; z-index: 2; }
.hero-pill { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 999px; background: rgba(255, 255, 255, .2); font-size: .85rem; font-weight: 800; color: #fff; text-decoration: none; }
a.hero-pill:hover { background: rgba(255, 255, 255, .32); color: #fff; }
.hero-pill.bad { background: rgba(185, 28, 28, .65); }

.qa-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 16px; }
@media (min-width: 768px) { .qa-grid { grid-template-columns: repeat(8, 1fr); } }
.qa { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 4px 10px; border-radius: 18px; background: var(--c-surface); border: 1px solid var(--c-border); box-shadow: var(--shadow-sm); text-decoration: none; color: var(--c-ink); font-size: .82rem; font-weight: 800; text-align: center; line-height: 1.2; min-height: 96px; border-inline: 1px solid var(--c-border); cursor: pointer; }
.qa:hover { border-color: var(--c-primary); color: var(--c-ink); }
.qa .ico { width: 48px; height: 48px; font-size: 1.5rem; border-radius: 16px; }
.qa:active { transform: scale(.96); }

.attn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 16px; border: 1px solid var(--c-border); background: var(--c-surface); margin-bottom: 8px; text-decoration: none; color: var(--c-ink); font-weight: 700; }
.attn i.lead { width: 38px; height: 38px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.2rem; flex-shrink: 0; }
.attn.bad { background: var(--c-red-soft); border-color: transparent; } .attn.bad i.lead { background: var(--c-red); color: #fff; }
.attn.warn { background: var(--c-warn-soft); border-color: transparent; } .attn.warn i.lead { background: var(--c-yolk); color: #3a2a00; }
.attn.info i.lead { background: var(--c-blue-soft); color: var(--c-blue); }
.attn:hover { color: var(--c-ink); filter: brightness(.98); }
.attn .go { margin-inline-start: auto; color: var(--c-muted); }

.flock-card { display: block; background: var(--c-surface); border: 1px solid var(--c-border); border-radius: 22px; padding: 14px; box-shadow: var(--shadow-sm); margin-bottom: 12px; color: var(--c-ink); text-decoration: none; }
a.flock-card:hover { border-color: var(--c-primary); color: var(--c-ink); }
.fc-top { display: flex; align-items: center; gap: 12px; }
.fc-name { font-weight: 800; font-size: 1.1rem; line-height: 1.2; }
.fc-sub { font-size: .82rem; color: var(--c-muted); }
.fc-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-top: 12px; }
.fc-stat { background: var(--c-surface-2); border-radius: 12px; padding: 8px 6px; text-align: center; }
.fc-stat b { display: block; font-size: 1.05rem; font-variant-numeric: tabular-nums; line-height: 1.2; }
.fc-stat small { font-size: .7rem; font-weight: 800; color: var(--c-muted); }
.fc-foot { margin-top: 10px; display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: .85rem; }
.ring { position: relative; width: 62px; height: 62px; flex-shrink: 0; }
.ring svg { width: 100%; height: 100%; }
.ring-bg { fill: none; stroke: var(--c-surface-2); stroke-width: 7; } .ring-fg { fill: none; stroke-width: 7; stroke-linecap: round; }
.ring-text { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1; }
.ring-text b { font-size: 1.05rem; } .ring-text small { font-size: .6rem; color: var(--c-muted); font-weight: 800; margin-top: 1px; }
.seg-tabs { display: flex; gap: 4px; background: var(--c-surface-2); padding: 4px; border-radius: 16px; margin-bottom: 14px; overflow-x: auto; scrollbar-width: none; }
.seg-tabs::-webkit-scrollbar { display: none; }
.seg-tabs a, .seg-tabs button { flex: 1 0 auto; text-align: center; padding: 9px 14px; border-radius: 12px; font-weight: 800; font-size: .92rem; color: var(--c-muted); text-decoration: none; border: 0; background: none; white-space: nowrap; }
.seg-tabs .active { background: var(--c-surface); color: var(--c-primary-600); box-shadow: var(--shadow-sm); }

/* charts */
.chart svg { width: 100%; height: auto; display: block; }
.ch-grid { stroke: var(--c-border); stroke-width: 1; } .ch-tick { fill: var(--c-muted); font-size: 9px; font-weight: 700; }
.ch-legend { display: flex; gap: 14px; justify-content: center; font-size: .78rem; font-weight: 700; color: var(--c-muted); margin-top: 4px; }
.ch-legend i, .share-bars i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-inline-end: 5px; }
.chart-empty { text-align: center; color: var(--c-muted); padding: 28px 8px; font-size: .9rem; }
:root { --c-primary-var: var(--c-primary); }
.share-bars .sb-row { margin-bottom: 11px; } .sb-head { display: flex; justify-content: space-between; gap: 8px; font-weight: 800; font-size: .92rem; margin-bottom: 4px; }
.sb-val small { color: var(--c-muted); font-weight: 700; } .sb-track { height: 9px; background: var(--c-surface-2); border-radius: 6px; overflow: hidden; } .sb-fill { height: 100%; border-radius: 6px; }

/* calendar of logged / missed days */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.cal .dow { text-align: center; font-size: .72rem; font-weight: 800; color: var(--c-muted); }
.cal .day { aspect-ratio: 1; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: .92rem; background: var(--c-surface-2); color: var(--c-muted); border: 2px solid transparent; text-decoration: none; position: relative; }
.cal .day.ok { background: var(--c-green-soft); color: var(--c-green); }
.cal .day.miss { background: var(--c-red-soft); color: var(--c-red); }
.cal .day.today { border-color: var(--c-primary); }
.cal .day.sel { background: var(--c-primary); color: var(--c-on-primary); }
.cal .day.off { opacity: .35; }
.date-strip { display: flex; align-items: center; gap: 8px; margin-bottom: 14px; }
.date-strip .ds-mid { flex: 1; text-align: center; font-weight: 800; background: var(--c-surface); border: 2px solid var(--c-border); border-radius: 14px; padding: 8px 10px; line-height: 1.25; position: relative; }
.date-strip .ds-mid input { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; }
.date-strip small { display: block; color: var(--c-muted); font-weight: 700; }

.log-card { background: var(--c-surface); border: 2px solid var(--c-border); border-radius: 22px; padding: 14px; margin-bottom: 14px; }
.log-card.saved { border-color: color-mix(in srgb, var(--c-green) 55%, var(--c-border)); }
.log-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.log-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.log-grid .wide { grid-column: 1 / -1; }
@media (min-width: 768px) { .log-grid { grid-template-columns: repeat(4, 1fr); } }
.sticky-save { position: sticky; bottom: calc(var(--bottomnav-h) + var(--safe-b) + 10px); z-index: 20; padding-top: 6px; }
@media (min-width: 992px) { .sticky-save { bottom: 14px; } }
.sticky-save .btn { box-shadow: 0 10px 26px rgba(194, 87, 12, .4); }
.kv { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px dashed var(--c-border); font-size: .95rem; }
.kv:last-child { border-bottom: 0; } .kv span:first-child { color: var(--c-muted); font-weight: 700; } .kv span:last-child { font-weight: 800; text-align: end; }
.kv.total { border-top: 2px solid var(--c-ink); border-bottom: 0; margin-top: 4px; font-size: 1.05rem; }

/* ---------- 7. welcome / sign in ---------- */
#view-auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 18px;
  background: radial-gradient(100% 60% at 50% 0, #f8c27a 0, transparent 60%), linear-gradient(180deg, #fde7c8 0%, #fbf6ee 55%); }
[data-bs-theme="dark"] #view-auth { background: radial-gradient(100% 60% at 50% 0, #5a2f0c 0, transparent 60%), linear-gradient(180deg, #2a1a0c 0%, #15110c 60%); }
.auth-card { width: 100%; max-width: 440px; background: var(--c-surface); border-radius: 28px; padding: 26px 22px; box-shadow: 0 24px 60px rgba(120, 60, 10, .22); border: 1px solid var(--c-border); }
.auth-logo { width: 84px; height: 84px; border-radius: 24px; display: block; margin: 0 auto 10px; box-shadow: 0 12px 28px rgba(194, 87, 12, .35); }
.auth-card h1 { font-size: 1.6rem; font-weight: 800; text-align: center; margin: 0; }
.auth-card .lead { text-align: center; color: var(--c-muted); font-size: .95rem; margin: 4px 0 18px; }
.lang-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 14px; }
.lang-choice button { border: 2px solid var(--c-border); background: var(--c-surface); border-radius: 18px; padding: 16px 8px; font-weight: 800; font-size: 1.3rem; color: var(--c-ink); }
.lang-choice button:hover { border-color: var(--c-primary); background: var(--c-primary-soft); }
.user-pick { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.user-pick button { display: flex; align-items: center; gap: 12px; text-align: start; border: 2px solid var(--c-border); background: var(--c-surface); border-radius: 16px; padding: 12px 14px; font-weight: 800; color: var(--c-ink); }
.user-pick button.sel { border-color: var(--c-primary); background: var(--c-primary-soft); }
.user-pick small { display: block; color: var(--c-muted); font-weight: 600; }
.pin-input { text-align: center; font-size: 2rem; letter-spacing: .6em; font-weight: 800; }
.steps { display: flex; justify-content: center; gap: 6px; margin-bottom: 16px; }
.steps i { width: 26px; height: 6px; border-radius: 4px; background: var(--c-border); } .steps i.on { background: var(--c-primary); }

/* ---------- 8. print ---------- */
#print-area { display: none; }
@media print {
  body > *:not(#print-area) { display: none !important; }
  body { background: #fff !important; }
  #print-area { display: block !important; color: #000; }
  @page { margin: 12mm; }
}
.print-report { color: #000; font-size: 12px; font-family: system-ui, "Segoe UI", Arial, sans-serif; }
.print-report .pr-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 2px solid #000; padding-bottom: 6px; margin-bottom: 10px; }
.print-report .pr-biz { font-size: 18px; font-weight: 800; } .print-report .pr-sub { font-size: 11px; color: #444; } .print-report .pr-title { font-size: 15px; font-weight: 800; text-align: end; }
.print-report h3 { font-size: 13px; margin: 14px 0 4px; }
.print-report table { width: 100%; border-collapse: collapse; margin-bottom: 8px; }
.print-report th, .print-report td { border: 1px solid #999; padding: 3px 6px; text-align: start; }
.print-report th { background: #eee; } .print-report td.num, .print-report th.num { text-align: end; }
.print-report .pr-foot { margin-top: 14px; font-size: 10px; color: #666; text-align: center; }
.print-report .pr-kv { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.print-report .pr-kv div { border: 1px solid #999; padding: 4px 6px; } .print-report .pr-kv b { display: block; font-size: 14px; }

/* ---------- 9. RTL + Urdu typography ---------- */
html[lang="ur"] body, html[lang="ur"] .btn, html[lang="ur"] .form-control, html[lang="ur"] .form-select, html[lang="ur"] .dropdown-item, html[lang="ur"] button, html[lang="ur"] input {
  font-family: "Noto Nastaliq Urdu", "Jameel Noori Nastaleeq", "Noto Naskh Arabic", "Segoe UI", Tahoma, serif;
}
html[lang="ur"] body { font-size: .98rem; line-height: 1.95; }
html[lang="ur"] h1, html[lang="ur"] h2, html[lang="ur"] h3, html[lang="ur"] h4, html[lang="ur"] h5, html[lang="ur"] h6 { line-height: 1.9; }
html[lang="ur"] .btn { padding-block: 4px 10px; line-height: 1.8; }
html[lang="ur"] .form-label, html[lang="ur"] .list-row .title, html[lang="ur"] .list-row .sub { line-height: 1.9; }
html[lang="ur"] .list-row .title, html[lang="ur"] .list-row .sub { white-space: normal; }
html[lang="ur"] .form-control, html[lang="ur"] .form-select { padding-top: 8px; padding-bottom: 12px; }
html[lang="ur"] .num-in, html[lang="ur"] .st-input, html[lang="ur"] .pin-input { font-family: system-ui, "Segoe UI", Arial, sans-serif; padding-block: 0; }
html[lang="ur"] { --bottomnav-h: 78px; }
html[lang="ur"] #bottom-nav a { justify-content: flex-start; padding-top: 8px; line-height: 1.7; }
html[lang="ur"] #bottom-nav a.nav-add { justify-content: flex-start; }
html[lang="ur"] .stat-l, html[lang="ur"] .fc-stat small, html[lang="ur"] .nav-section, html[lang="ur"] .table thead th { letter-spacing: 0 !important; text-transform: none !important; line-height: 1.8; }
html[lang="ur"] .pill { line-height: 1.9; padding-block: 1px 5px; }
html[lang="ur"] .nav-menu .nav-link { line-height: 1.8; }
html[lang="ur"] .seg-item span { line-height: 1.8; padding-block: 4px 10px; }
html[lang="ur"] .hero .hero-big, html[lang="ur"] .stat-v { font-family: system-ui, "Segoe UI", Arial, sans-serif; }
html[lang="ur"] .chip { line-height: 1.8; padding-block: 4px 10px; }
