/* ChorvaPro — asosiy uslublar (kunduzgi va tungi rejim) */
:root, [data-theme="light"] {
  --bg: #eef5f0;
  --bg-grad: linear-gradient(160deg, #eaf5ee 0%, #f6f3ea 100%);
  --card: #ffffff;
  --card-b: rgba(20, 60, 35, .07);
  --soft: #f4f8f5;
  --soft2: #eaf2ec;
  --text: #14231a;
  --muted: #65756b;
  --line: #e3ebe5;
  --input: #ffffff;
  --input-b: #d3ddd5;
  --primary: #15803d;
  --primary-d: #166534;
  --primary-l: #dcfce7;
  --primary-t: #166534;
  --on-primary: #ffffff;
  --grad: linear-gradient(135deg, #16a34a 0%, #0f766e 100%);
  --accent: #f59e0b;
  --danger: #dc2626;
  --danger-l: #fde8e8;
  --warn: #b45309;
  --warn-l: #fef3c7;
  --info: #2563eb;
  --info-l: #e0ebfd;
  --side-bg: linear-gradient(180deg, #0f3d22 0%, #14532d 55%, #166534 100%);
  --side-t: #cfe6d6;
  --side-grp: #7fb391;
  --side-hover: rgba(255, 255, 255, .08);
  --side-on: rgba(255, 255, 255, .15);
  --top-bg: rgba(238, 245, 240, .82);
  --shadow: 0 1px 2px rgba(20, 50, 30, .05), 0 8px 24px -14px rgba(20, 60, 35, .28);
  --shadow-h: 0 2px 4px rgba(20, 50, 30, .06), 0 14px 30px -14px rgba(20, 60, 35, .35);
  --pri-sh: 0 8px 18px -8px rgba(15, 118, 110, .65);
  --modal-f: #f6f9f7;
  --row-h: #f5faf6;
  --th: #f3f7f4;
  --c1: #fff; --c1b: linear-gradient(135deg, #22c55e, #15803d);
  --c2: #fff; --c2b: linear-gradient(135deg, #60a5fa, #2563eb);
  --c3: #fff; --c3b: linear-gradient(135deg, #fbbf24, #ea580c);
  --c4: #fff; --c4b: linear-gradient(135deg, #fb7185, #dc2626);
  --bar: rgba(22, 163, 74, .2);
  --bar-on: linear-gradient(180deg, #22c55e, #0f766e);
  --radius: 16px;
  --r-sm: 11px;
  --side: 248px;
  color-scheme: light;
}
[data-theme="dark"] {
  --bg: #0d1310;
  --bg-grad: #0d1310;
  --card: #151d19;
  --card-b: #222d27;
  --soft: #111915;
  --soft2: #1a241f;
  --text: #e4eee7;
  --muted: #8c9d92;
  --line: #243029;
  --input: #0f1713;
  --input-b: #2c3a32;
  --primary: #22c55e;
  --primary-d: #16a34a;
  --primary-l: #123222;
  --primary-t: #4ade80;
  --on-primary: #052e14;
  --grad: linear-gradient(135deg, #22c55e 0%, #10b981 100%);
  --accent: #fbbf24;
  --danger: #f87171;
  --danger-l: #3a1717;
  --warn: #fbbf24;
  --warn-l: #33280f;
  --info: #60a5fa;
  --info-l: #132338;
  --side-bg: #0a0f0c;
  --side-t: #a8b8ad;
  --side-grp: #56675c;
  --side-hover: #131c17;
  --side-on: #17291e;
  --top-bg: rgba(13, 19, 16, .85);
  --shadow: none;
  --shadow-h: 0 0 0 1px #2e3d34;
  --pri-sh: 0 0 0 1px rgba(74, 222, 128, .25), 0 8px 20px -8px rgba(34, 197, 94, .5);
  --modal-f: #121a16;
  --row-h: #18221d;
  --th: #121a16;
  --c1: #4ade80; --c1b: #123222;
  --c2: #60a5fa; --c2b: #132338;
  --c3: #fbbf24; --c3b: #33280f;
  --c4: #f87171; --c4b: #3a1717;
  --bar: #1e3a2a;
  --bar-on: #4ade80;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: "Manrope", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px; line-height: 1.45; color: var(--text); background: var(--bg); background-image: var(--bg-grad); background-attachment: fixed;
  -webkit-text-size-adjust: 100%; -webkit-tap-highlight-color: transparent;
}
a { color: var(--primary-t); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 21px; margin: 0; letter-spacing: -.01em; }
h2 { font-size: 17px; margin: 0 0 12px; letter-spacing: -.01em; }
h3 { font-size: 15px; margin: 0 0 8px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
svg.i { width: 18px; height: 18px; flex: none; vertical-align: middle; }
[data-theme="light"] .only-dark, [data-theme="dark"] .only-light { display: none; }
::selection { background: var(--primary-l); }

/* ---------- Chap menyu ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: var(--side); background: var(--side-bg); color: var(--side-t);
  display: flex; flex-direction: column; z-index: 40; transition: transform .25s ease;
}
[data-theme="dark"] .sidebar { border-right: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 11px; padding: 18px 18px 12px; font-weight: 800; font-size: 16.5px; color: #fff; text-decoration: none !important; line-height: 1.2; }
.brand img { width: 36px; height: 36px; border-radius: 11px; flex: none; box-shadow: 0 4px 12px rgba(0,0,0,.25); }
.nav { flex: 1; overflow-y: auto; padding: 4px 12px 16px; scrollbar-width: thin; }
.nav-grp { font-size: 10.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--side-grp); padding: 14px 12px 5px; }
.nav a {
  display: flex; align-items: center; gap: 11px; padding: 9px 12px; margin: 1px 0; border-radius: 11px;
  color: var(--side-t); font-size: 14.5px; font-weight: 600; transition: background .15s, color .15s;
}
.nav a svg.i { opacity: .85; }
.nav a:hover { background: var(--side-hover); text-decoration: none; color: #fff; }
.nav a.active { background: var(--side-on); color: #fff; box-shadow: inset 3px 0 0 var(--accent); }
[data-theme="dark"] .nav a.active { color: var(--primary-t); box-shadow: inset 3px 0 0 var(--primary); }
.nav a.active svg.i { opacity: 1; }
.badge { margin-left: auto; background: var(--danger); color: #fff; border-radius: 99px; font-size: 11px; font-weight: 800; padding: 1px 7px; line-height: 1.5; }
.badge.info { background: var(--accent); color: #3b2a00; }
.side-user { display: flex; align-items: center; gap: 6px; padding: 10px 12px 14px; }
.me { flex: 1; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 13px; background: rgba(255,255,255,.07); color: #fff; min-width: 0; text-decoration: none !important; }
.me:hover { background: rgba(255,255,255,.12); }
.me-t { min-width: 0; line-height: 1.25; }
.me-t b { display: block; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.me-t small { display: block; font-size: 11.5px; color: var(--side-t); opacity: .8; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--accent); color: #3b2a00; display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
[data-theme="dark"] .avatar { background: var(--primary); color: var(--on-primary); }
.side-user .icon-btn { color: var(--side-t); background: transparent; border-color: transparent; }
.side-user .icon-btn:hover { background: var(--side-hover); color: #fff; }

/* ---------- Tepa panel ---------- */
.main { margin-left: var(--side); min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 30; background: var(--top-bg); backdrop-filter: saturate(1.3) blur(10px); -webkit-backdrop-filter: saturate(1.3) blur(10px);
  display: flex; align-items: center; gap: 10px; padding: 12px 26px; border-bottom: 1px solid var(--line);
}
.topbar .spacer { flex: 1; }
.icon-btn {
  position: relative; width: 40px; height: 40px; flex: none; display: inline-grid; place-items: center; border-radius: 12px;
  border: 1px solid var(--line); background: var(--card); color: var(--text); cursor: pointer; text-decoration: none !important; transition: .15s;
}
.icon-btn:hover { border-color: var(--primary); color: var(--primary-t); }
.icon-btn .dot, .tabbar .dot {
  position: absolute; top: -5px; right: -5px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff;
  font-size: 10.5px; font-weight: 800; font-style: normal; display: grid; place-items: center; border: 2px solid var(--bg);
}
.menu-btn { display: none; }
.top-search { position: relative; width: 270px; margin: 0; }
.top-search svg.i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--muted); width: 17px; height: 17px; pointer-events: none; }
.top-search input { padding-left: 38px; border-radius: 12px; height: 40px; background: var(--card); border-color: var(--line); }
.content { padding: 22px 26px 60px; max-width: 1440px; }
.overlay { display: none; }

/* ---------- Kartalar ---------- */
.card { background: var(--card); border: 1px solid var(--card-b); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 16px; }
.card.p0 { padding: 0; overflow: hidden; }
.card h2 { display: flex; align-items: center; gap: 8px; }
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); margin-bottom: 16px; }
.stat {
  position: relative; background: var(--card); border: 1px solid var(--card-b); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 15px 16px; display: flex; align-items: center; gap: 13px; transition: transform .15s, box-shadow .15s; min-width: 0;
}
a.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow-h); text-decoration: none; }
.stat .ic { width: 44px; height: 44px; border-radius: 13px; }
.stat .ic svg.i { width: 22px; height: 22px; }
.stat .tx { min-width: 0; }
.stat .n { font-size: 23px; max-width: 100%; font-weight: 800; line-height: 1.1; letter-spacing: -.02em; white-space: nowrap; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat.hero { background: var(--grad); color: #fff; border-color: transparent; }
.stat.hero .l { color: rgba(255,255,255,.85); }
.stat.hero .ic { background: rgba(255,255,255,.2) !important; color: #fff !important; }
[data-theme="dark"] .stat.hero { color: var(--on-primary); }
[data-theme="dark"] .stat.hero .l { color: rgba(5,46,20,.75); }
[data-theme="dark"] .stat.hero .ic { background: rgba(5,46,20,.14) !important; color: var(--on-primary) !important; }
.stat.green .n { color: var(--primary-t); }
.stat.red .n { color: var(--danger); }
.stat.blue .n { color: var(--info); }
.stat.orange .n { color: var(--warn); }
.stat.hero .n { color: inherit; }
.ic { display: grid; place-items: center; flex: none; border-radius: 11px; }
.ic.c1 { background: var(--c1b); color: var(--c1); }
.ic.c2 { background: var(--c2b); color: var(--c2); }
.ic.c3 { background: var(--c3b); color: var(--c3); }
.ic.c4 { background: var(--c4b); color: var(--c4); }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

/* ---------- Bosh sahifa banneri ---------- */
.hello { position: relative; overflow: hidden; border-radius: 20px; min-height: 128px; padding: 22px 26px; margin-bottom: 16px; color: #fff; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); }
.hello svg.land { position: absolute; inset: 0; width: 100%; height: 100%; }
.hello .tx { position: relative; }
.hello h2 { margin: 0; font-size: 23px; color: #fff; text-shadow: 0 1px 10px rgba(0,0,0,.25); letter-spacing: -.02em; }
.hello p { margin: 4px 0 0; font-size: 14px; opacity: .95; text-shadow: 0 1px 6px rgba(0,0,0,.25); }
.hello .chip-glass { position: relative; margin-left: auto; align-self: flex-start; display: inline-flex; align-items: center; gap: 7px; font-weight: 700; font-size: 13px;
  padding: 7px 12px; border-radius: 12px; background: rgba(255,255,255,.18); border: 1px solid rgba(255,255,255,.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.ls-sky { fill: url(#lsDay); }
.ls-night { display: none; }
.ls-h1 { fill: #7cc47f; } .ls-h2 { fill: #4fa35a; } .ls-h3 { fill: #3b8a47; }
.ls-sheep { fill: #f8f6f0; } .ls-sheep .h { fill: #3a3a3a; } .ls-sheep .l { stroke: #3a3a3a; stroke-width: 2; fill: none; }
.ls-fence { stroke: #8a6a45; stroke-width: 3; opacity: .9; }
[data-theme="dark"] .ls-sky { fill: url(#lsNight); }
[data-theme="dark"] .ls-day { display: none; }
[data-theme="dark"] .ls-night { display: inline; }
[data-theme="dark"] .ls-h1 { fill: #1d3d2c; } [data-theme="dark"] .ls-h2 { fill: #16311f; } [data-theme="dark"] .ls-h3 { fill: #10261a; }
[data-theme="dark"] .ls-sheep { opacity: .55; }
[data-theme="dark"] .ls-fence { stroke: #3b4d40; }

/* ---------- Grafik ---------- */
.bars { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 18px; }
.bars .b { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 5px; font-size: 11px; color: var(--muted); min-width: 0; }
.bars .b i { display: block; width: 100%; max-width: 46px; min-height: 3px; border-radius: 8px 8px 3px 3px; background: var(--bar); position: relative; transition: height .5s; }
.bars .b.on i { background: var(--bar-on); }
.bars .b i em { position: absolute; top: -17px; left: 50%; transform: translateX(-50%); font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--text); white-space: nowrap; }
.seg { display: inline-flex; background: var(--soft2); border-radius: 10px; padding: 3px; margin-left: auto; }
.seg button { border: 0; background: none; font: inherit; font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 8px; color: var(--muted); cursor: pointer; }
.seg button.on { background: var(--card); color: var(--primary-t); box-shadow: 0 1px 3px rgba(0,0,0,.08); }

/* ---------- Tugmalar ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); border-radius: var(--r-sm); padding: 9px 15px; font-size: 14px; font-weight: 600; cursor: pointer;
  font-family: inherit; line-height: 1.2; white-space: nowrap; text-decoration: none !important; transition: transform .12s, box-shadow .15s, background .15s, border-color .15s;
}
.btn svg.i { width: 17px; height: 17px; }
.btn:hover { border-color: var(--primary); color: var(--primary-t); }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--grad); border-color: transparent; color: var(--on-primary); box-shadow: var(--pri-sh); }
.btn.primary:hover { color: var(--on-primary); filter: brightness(1.06); transform: translateY(-1px); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
[data-theme="dark"] .btn.danger { color: #2a0909; }
.btn.danger:hover { color: #fff; filter: brightness(1.07); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 10px; }
.btn.xs { padding: 3px 9px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .55; cursor: default; transform: none; }
.btn-group { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.quick { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }

/* ---------- Toolbar / filtrlar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; min-width: 180px; }
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin-bottom: 12px; }
.search { position: relative; }
.search input { padding-left: 38px; }
.search::before {
  content: ""; position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; opacity: .55;
  background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center/contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E") center/contain no-repeat;
}

/* ---------- Formalar ---------- */
input, select, textarea {
  width: 100%; font: inherit; font-size: 15px; color: var(--text); background: var(--input); border: 1px solid var(--input-b);
  border-radius: var(--r-sm); padding: 9px 12px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-l); }
input[type=checkbox], input[type=radio] { width: auto; accent-color: var(--primary); transform: scale(1.15); }
input[type=search]::-webkit-search-cancel-button { filter: grayscale(1); }
textarea { min-height: 70px; resize: vertical; }
label.f { display: block; font-size: 13px; color: var(--muted); margin-bottom: 5px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px 14px; }
.form-grid .full { grid-column: 1 / -1; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; }
.req::after { content: " *"; color: var(--danger); }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }
.err-text { color: var(--danger); font-size: 13px; margin-top: 3px; }

/* ---------- Jadval ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th, table.t td { padding: 11px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
table.t th { background: var(--th); font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; position: sticky; top: 0; }
table.t th.sortable { cursor: pointer; user-select: none; }
table.t th.sortable:hover { color: var(--primary-t); }
table.t th .arr { opacity: .5; font-size: 11px; }
table.t tbody tr:hover, table.t tr:hover td { background: var(--row-h); }
table.t tr.selected td { background: var(--primary-l) !important; }
table.t tr.overdue td { background: var(--danger-l); }
table.t tr.soon td { background: var(--warn-l); }
table.t td.chk, table.t th.chk { width: 34px; }
table.t td.actions { white-space: nowrap; text-align: right; }
.thumb { width: 40px; height: 40px; border-radius: 10px; object-fit: cover; cursor: zoom-in; display: block; background: var(--soft2); }
.thumb.ph { display: flex; align-items: center; justify-content: center; font-size: 18px; cursor: default; }
.empty { padding: 34px; text-align: center; color: var(--muted); }
.tfoot { padding: 10px 14px; font-size: 13px; color: var(--muted); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ---------- Yorliqlar ---------- */
.pill { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: 12px; font-weight: 700; background: var(--soft2); color: var(--muted); white-space: nowrap; }
.pill.green { background: var(--primary-l); color: var(--primary-t); }
.pill.red { background: var(--danger-l); color: var(--danger); }
.pill.orange { background: var(--warn-l); color: var(--warn); }
.pill.blue { background: var(--info-l); color: var(--info); }
.pill.gray { background: var(--soft2); color: var(--muted); }
button.pill { border: 0; cursor: pointer; font-family: inherit; }
button.pill::after { content: " ▾"; font-size: 10px; opacity: .7; }

/* ---------- Oyna (modal) ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(8, 18, 12, .5); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); z-index: 100; display: flex; align-items: flex-start;
  justify-content: center; padding: 40px 12px; overflow-y: auto; animation: fade .15s;
}
.modal { background: var(--card); border: 1px solid var(--card-b); border-radius: 18px; width: 100%; max-width: 560px; box-shadow: 0 24px 60px rgba(0,0,0,.3); animation: pop .18s; }
.modal.wide { max-width: 840px; }
.modal-h { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-h h3 { margin: 0; flex: 1; font-size: 17px; }
.modal-x { background: var(--soft2); border: 0; width: 32px; height: 32px; border-radius: 10px; font-size: 20px; cursor: pointer; color: var(--muted); line-height: 1; }
.modal-x:hover { color: var(--text); }
.modal-b { padding: 18px 20px; }
.modal-f { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; border-top: 1px solid var(--line); background: var(--modal-f); border-radius: 0 0 18px 18px; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: translateY(12px) scale(.98); opacity: 0; } }

/* ---------- Avtomatik to'ldirish ---------- */
.ac { position: relative; }
.ac-list {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--card); border: 1px solid var(--input-b); border-radius: 12px;
  box-shadow: 0 12px 30px rgba(0,0,0,.18); z-index: 200; max-height: 200px; overflow-y: auto; display: none;
}
.ac-list.show { display: block; }
.ac-item { padding: 8px 12px; cursor: pointer; font-size: 14px; border-bottom: 1px solid var(--line); height: 40px; display: flex; align-items: center; gap: 8px; overflow: hidden; white-space: nowrap; }
.ac-item:last-child { border-bottom: 0; }
.ac-item .sub { color: var(--muted); font-size: 12px; margin-left: auto; }
.ac-item.act, .ac-item:hover { background: var(--primary-l); }
.ac-new { color: var(--primary-t); font-style: italic; }

/* ---------- Kichik menyu ---------- */
.popmenu { position: absolute; z-index: 300; background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 12px 30px rgba(0,0,0,.2); padding: 5px; min-width: 180px; }
.popmenu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 9px 11px; border-radius: 8px; font: inherit; font-size: 14px; cursor: pointer; color: var(--text); }
.popmenu button:hover { background: var(--primary-l); }
.popmenu button.cur { font-weight: 700; color: var(--primary-t); }

/* ---------- Tanlovlar ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { background: var(--primary-l); color: var(--primary-t); border-radius: 99px; padding: 3px 6px 3px 11px; font-size: 13px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.chip button { border: 0; background: none; cursor: pointer; color: inherit; font-size: 15px; line-height: 1; padding: 0 2px; }
.pick-list { max-height: 240px; overflow-y: auto; border: 1px solid var(--line); border-radius: 12px; }
.pick-list label { display: flex; align-items: center; gap: 8px; padding: 8px 11px; border-bottom: 1px solid var(--line); cursor: pointer; font-size: 14px; }
.pick-list label:hover { background: var(--row-h); }

/* ---------- Xabarcha ---------- */
#toasts { position: fixed; right: 18px; bottom: 18px; z-index: 500; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #173524; color: #fff; padding: 11px 16px; border-radius: 12px; box-shadow: 0 10px 30px rgba(0,0,0,.25); font-size: 14px; font-weight: 600; max-width: 380px; animation: pop .2s; }
[data-theme="dark"] .toast { background: #22c55e; color: #052e14; }
.toast.err { background: #dc2626; color: #fff; }

/* ---------- Rasm kattalashtirish ---------- */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 600; display: flex; align-items: center; justify-content: center; cursor: zoom-out; }
.lightbox img { max-width: 96vw; max-height: 94vh; border-radius: 10px; }

/* ---------- Batafsil ---------- */
.detail-head { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.detail-photo { width: 190px; height: 190px; border-radius: 18px; object-fit: cover; cursor: zoom-in; background: var(--soft2); box-shadow: var(--shadow); }
.detail-photo.ph { display: flex; align-items: center; justify-content: center; font-size: 64px; cursor: default; background: var(--primary-l); }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px 20px; flex: 1; min-width: 260px; }
.kv div b { display: block; font-size: 11.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 1px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 8px 0 8px 20px; border-left: 2px solid var(--line); position: relative; font-size: 14px; }
.timeline li::before { content: ""; position: absolute; left: -7px; top: 12px; width: 12px; height: 12px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--card); }

/* ---------- Bildirishnomalar ---------- */
.notif { display: flex; gap: 12px; align-items: center; padding: 11px 16px; border-bottom: 1px solid var(--line); color: var(--text); transition: background .15s; }
.notif:last-child { border-bottom: 0; }
.notif:hover { background: var(--row-h); text-decoration: none; }
.notif .ico { font-size: 20px; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; flex: none; }
.notif .ico:not(.ic) { background: var(--soft2); }
.notif .ico.ic svg.i { width: 18px; height: 18px; }
.notif .when { margin-left: auto; white-space: nowrap; }
.notif b { font-weight: 700; }
.card-h { display: flex; align-items: center; gap: 8px; padding: 15px 16px 8px; }
.card-h h2 { margin: 0; flex: 1; }
.card-h a { font-size: 13px; font-weight: 700; }

/* ---------- Kirish sahifasi ---------- */
.login-wrap { position: relative; min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; overflow: hidden; background: #0f3d22; }
.login-wrap svg.land { position: absolute; inset: 0; width: 100%; height: 100%; }
.login-card { position: relative; background: var(--card); border-radius: 22px; padding: 30px 28px; width: 100%; max-width: 390px; box-shadow: 0 30px 70px rgba(0,0,0,.35); }
[data-theme="light"] .login-card { background: rgba(255,255,255,.93); backdrop-filter: blur(10px); }
.login-card .logo { text-align: center; margin-bottom: 14px; }
.login-card .logo img { width: 68px; height: 68px; border-radius: 18px; box-shadow: 0 10px 24px -8px rgba(0,0,0,.4); }
.login-card h1 { text-align: center; margin: 8px 0 2px; }
.alert { padding: 11px 13px; border-radius: 12px; margin-bottom: 12px; font-size: 14px; background: var(--soft2); }
.alert.err { background: var(--danger-l); color: var(--danger); }
.alert.ok { background: var(--primary-l); color: var(--primary-t); }
.alert.warn { background: var(--warn-l); color: var(--warn); }

/* ---------- Tablar ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 16px; overflow-x: auto; scrollbar-width: none; }
.tabs button { background: none; border: 0; padding: 10px 14px; font: inherit; font-size: 14px; font-weight: 600; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button:hover { color: var(--text); }
.tabs button.active { color: var(--primary-t); border-bottom-color: var(--primary); }

.offspring-row { display: grid; grid-template-columns: 30px 1fr 130px auto; gap: 8px; align-items: center; margin-bottom: 8px; }
.two-col.wide-left { grid-template-columns: 2.2fr 1fr; align-items: start; }

/* ---------- Topshiriqlar ---------- */
.task { background: var(--card); border: 1px solid var(--card-b); border-radius: var(--radius); box-shadow: var(--shadow); padding: 15px 17px; margin-bottom: 10px; border-left: 4px solid var(--input-b); }
.task.high { border-left-color: var(--danger); }
.task.low { border-left-color: var(--muted); }
.task.normal { border-left-color: var(--primary); }
.task.closed { opacity: .7; }
.task.hl { outline: 2px solid var(--accent); }
.task-h { display: flex; gap: 10px; align-items: flex-start; flex-wrap: wrap; }
.task-h h3 { flex: 1; margin: 0; font-size: 16px; min-width: 200px; }
.task-d { color: var(--text); opacity: .85; font-size: 14px; margin: 6px 0 0; white-space: pre-wrap; }
.task-m { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 8px; align-items: center; }
.task-a { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.task-note { background: var(--soft); border-radius: 10px; padding: 7px 11px; font-size: 13px; margin-top: 8px; }
.chip-btn { border: 1px solid var(--line); background: var(--card); color: var(--text); border-radius: 99px; padding: 5px 13px; font-size: 13px; font-weight: 600; cursor: pointer; font-family: inherit; }
.chip-btn:hover, .chip-btn.on { background: var(--primary-l); border-color: var(--primary); color: var(--primary-t); }

/* ---------- Ruxsatlar muharriri ---------- */
.perm-box { margin-top: 14px; border: 1px solid var(--line); border-radius: 14px; padding: 12px; background: var(--soft); }
.perm-top { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.perm-top select { max-width: 240px; }
.perm-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.perm-g { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 9px 11px; }
.perm-gh { display: flex; align-items: center; gap: 6px; font-weight: 700; padding-bottom: 6px; margin-bottom: 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.perm-i { display: flex; align-items: flex-start; gap: 6px; font-size: 13.5px; padding: 3px 0; cursor: pointer; line-height: 1.35; }
.perm-i input, .perm-gh input { margin-top: 2px; flex: none; width: 16px; height: 16px; }

/* ---------- Telefon: pastki panel ---------- */
.tabbar { display: none; }
.sheet { position: fixed; inset: 0; z-index: 90; background: rgba(8,18,12,.45); display: flex; align-items: flex-end; animation: fade .15s; }
.sheet[hidden] { display: none; }
.sheet-box { width: 100%; background: var(--card); border-radius: 22px 22px 0 0; padding: 10px 14px calc(96px + env(safe-area-inset-bottom)); animation: up .22s ease; }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
.sheet-h { font-weight: 800; font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; padding: 8px 6px 10px; }
.sheet-i { display: flex; align-items: center; gap: 12px; padding: 11px 8px; border-radius: 14px; color: var(--text); font-weight: 700; font-size: 15.5px; text-decoration: none !important; }
.sheet-i:active, .sheet-i:hover { background: var(--row-h); }
.sheet-i .ic { width: 42px; height: 42px; border-radius: 13px; }
.sheet-i .ic svg.i { width: 21px; height: 21px; }
.sheet-i svg.go { margin-left: auto; color: var(--muted); }

/* ---------- Moslashuvchan ---------- */
@media (max-width: 1100px) { .top-search { width: 210px; } }
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: 10px 0 40px rgba(0,0,0,.3); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open .overlay { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .main { margin-left: 0; }
  .menu-btn { display: inline-grid; }
  .topbar { padding: 10px 12px; gap: 8px; }
  .content { padding: 14px 12px calc(100px + env(safe-area-inset-bottom)); }
  h1 { font-size: 18px; }
  .two-col, .two-col.wide-left { grid-template-columns: 1fr; }
  .tabbar {
    display: flex; position: fixed; left: 10px; right: 10px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 95; height: 64px;
    background: var(--card); border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 34px -10px rgba(0,0,0,.35);
    align-items: center; justify-content: space-around; padding: 0 6px;
  }
  [data-theme="light"] .tabbar { background: rgba(255,255,255,.94); backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px); }
  .tabbar a, .tabbar .tab-menu { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 10.5px; font-weight: 700; color: var(--muted); text-decoration: none !important; background: none; border: 0; font-family: inherit; cursor: pointer; padding: 6px 0; }
  .tabbar svg.i { width: 22px; height: 22px; }
  .tabbar a.on { color: var(--primary-t); }
  .tabbar .dot { top: 0; right: calc(50% - 22px); }
  .tab-plus { width: 54px; height: 54px; flex: none; border: 0; border-radius: 18px; background: var(--grad); color: var(--on-primary); display: grid; place-items: center; margin-top: -30px; box-shadow: var(--pri-sh); cursor: pointer; transition: transform .2s; }
  .tab-plus svg.i { width: 27px; height: 27px; }
  body.sheet-open .tab-plus { transform: rotate(45deg); }
  #toasts { bottom: calc(86px + env(safe-area-inset-bottom)); }
}
@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .top-search { display: none; }
  .form-grid { grid-template-columns: 1fr; }
  .modal-bg { padding: 10px 6px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 12px; gap: 10px; }
  .stat .ic { width: 36px; height: 36px; border-radius: 11px; }
  .stat .ic svg.i { width: 18px; height: 18px; }
  .stat .n { font-size: 19px; }
  .hello { padding: 16px 18px; min-height: 108px; }
  .hello h2 { font-size: 19px; }
  .hello .chip-glass { display: none; }
  .quick { display: none; }
  .card { padding: 15px; }
  #toasts { left: 12px; right: 12px; } .toast { max-width: none; }
  .offspring-row { grid-template-columns: 24px 1fr 110px; } .offspring-row .check { grid-column: 2 / -1; }
}

@media print {
  .sidebar, .topbar, .toolbar, .filters, .btn, .tabbar { display: none !important; }
  .main { margin: 0; }
  body { background: #fff; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
body.nav-open .tabbar, body.nav-open .sheet { display: none !important; }

/* Chiziqli grafik */
.lchart .lc-g { stroke: var(--line); stroke-width: 1; }
.lchart .lc-t { fill: var(--muted); font-size: 11px; font-family: inherit; }
.lchart .lc-l { fill: none; stroke: var(--primary); stroke-width: 2.5; stroke-linejoin: round; vector-effect: non-scaling-stroke; }
.lchart .lc-a { fill: var(--primary); opacity: .1; }
.lchart .lc-d { fill: var(--card); stroke: var(--primary); stroke-width: 2.5; vector-effect: non-scaling-stroke; }

/* Yem ombori */
.feed-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; margin-bottom: 14px; }
.feed-grid .card { margin: 0; }
.feed-card.low { border-color: var(--warn); }
.fc-h { display: flex; align-items: center; gap: 11px; }
.fc-n { font-size: 30px; font-weight: 800; letter-spacing: -.02em; margin: 12px 0 6px; }
.fc-n small { font-size: 15px; font-weight: 700; color: var(--muted); }
.fc-bar { height: 8px; border-radius: 99px; background: var(--soft2); overflow: hidden; }
.fc-bar i { display: block; height: 100%; border-radius: 99px; transition: width .5s; }

/* Bo'limlarni yoqish/o'chirish */
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 10px; margin-bottom: 12px; }
.mod-i { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--card); cursor: pointer; transition: .15s; }
.mod-i:hover { border-color: var(--primary); }
.mod-i .ic { width: 40px; height: 40px; }
.mod-i:has(input:not(:checked)) .ic { background: var(--soft2) !important; color: var(--muted) !important; }
.mod-i:has(input:not(:checked)) .mod-t { opacity: .6; }
.mod-t { flex: 1; min-width: 0; line-height: 1.3; }
.mod-t b { display: block; }
.mod-t small { color: var(--muted); font-size: 12.5px; }
.switch { position: relative; width: 44px; height: 26px; flex: none; }
.switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; transform: none; }
.switch i { position: absolute; inset: 0; border-radius: 99px; background: var(--input-b); transition: .2s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: .2s; }
.switch input:checked + i { background: var(--primary); }
.switch input:checked + i::after { transform: translateX(18px); }

/* Til almashtirgich */
.lang-sw { display: inline-flex; background: var(--soft2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; height: 40px; align-items: center; }
.lang-sw button, .lang-sw a { border: 0; background: none; font: inherit; font-size: 12.5px; font-weight: 800; color: var(--muted); padding: 6px 9px; border-radius: 9px; cursor: pointer; text-decoration: none !important; }
.lang-sw .on { background: var(--card); color: var(--primary-t); box-shadow: 0 1px 3px rgba(0,0,0,.1); }
.login-lang { position: absolute; top: 14px; right: 14px; height: auto; }
@media (max-width: 600px) { .lang-sw { height: 36px; } .lang-sw button { padding: 5px 7px; } }

/* ---- 3.0: obuna / demo banneri, yordam, import ---- */
.sub-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 11px 14px; border-radius: 14px; margin-bottom: 14px;
  background: var(--primary-l); color: var(--primary-t); font-size: 14px; border: 1px solid color-mix(in srgb, var(--primary) 25%, transparent); }
.sub-banner > svg { width: 20px; height: 20px; flex: none; }
.sub-banner > span { flex: 1 1 240px; }
.sub-banner.warn { background: var(--warn-l); color: var(--warn); border-color: color-mix(in srgb, var(--warn) 30%, transparent); }
.sub-banner.demo { background: linear-gradient(90deg, var(--primary-l), var(--warn-l)); }
.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 14px; margin-bottom: 16px; }
.contact-list a { display: flex; align-items: center; gap: 10px; padding: 10px 0; color: inherit; text-decoration: none; border-bottom: 1px solid var(--line); }
.contact-list a:last-child { border-bottom: 0; }
.contact-list svg { width: 20px; height: 20px; color: var(--primary); }
.faq details { border-bottom: 1px solid var(--line); padding: 10px 0; }
.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 10px; }
.faq summary::after { content: '+'; color: var(--muted); font-weight: 700; }
.faq details[open] summary::after { content: '−'; }
.faq details p { margin: 8px 0 2px; color: var(--muted); line-height: 1.55; }
.plan-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.plan-card { border: 1px solid var(--line); border-radius: 14px; padding: 14px; background: var(--card); }
.plan-card.cur { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.plan-card h4 { margin: 0 0 4px; }
.plan-card .price { font-size: 20px; font-weight: 800; margin: 6px 0; }
.plan-card ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.ticket { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; }
.ticket .reply { margin-top: 8px; padding: 8px 10px; border-radius: 10px; background: var(--primary-l); color: var(--primary-t); }
.imp-table { max-height: 50vh; overflow: auto; border: 1px solid var(--line); border-radius: 10px; }
.imp-table table { font-size: 13px; }
.imp-table tr.bad td { background: var(--danger-l); }
.imp-table td.err { color: var(--danger); font-size: 12px; }
.dropzone { display: block; border: 2px dashed var(--line); border-radius: 14px; padding: 22px; text-align: center; cursor: pointer; }
.dropzone svg.i { width: 30px; height: 30px; color: var(--primary); margin-bottom: 6px; }
.dropzone:hover, .dropzone.over { border-color: var(--primary); background: var(--primary-l); }
.legal-links { font-size: 12px; color: var(--muted); text-align: center; margin-top: 14px; }
.legal-links a { color: inherit; }

/* Emoji o'rnidagi vektor belgilar */
svg.i.emo { width: 1.1em; height: 1.1em; vertical-align: -0.18em; margin: 0 .12em; stroke-width: 2; }
.emo-ok { color: var(--ok, #1f9d55); } .emo-bad { color: var(--bad, #d64545); } .emo-warn { color: #e29a15; } .emo-info { color: #3b82f6; }
.tabs svg.i.emo, .tab svg.i.emo { width: 1em; height: 1em; }
