/* ============ ERP Bonjour — zamonaviy UI ============ */
:root {
  --bg: #f3f5fa;
  --panel: #ffffff;
  --text: #101828;
  --muted: #667085;
  --primary: #6366f1;
  --primary-d: #4f46e5;
  --primary-grad: linear-gradient(135deg, #6366f1, #8b5cf6);
  --green: #12b76a; --red: #f04438; --amber: #f79009; --blue: #2e90fa;
  --border: #eaecf0;
  --sidebar: #0c111d;
  --radius: 16px;
  --shadow: 0 1px 2px rgba(16,24,40,.05), 0 4px 16px rgba(16,24,40,.06);
  --shadow-lg: 0 12px 32px rgba(16,24,40,.14);
  --surface-2: #eaecf0;
  --input-bg: #ffffff;
}

/* ============ KUN/TUN REJIMI ============ */
html[data-theme="dark"] {
  --bg: #12141c;
  --panel: #1e2230;
  --text: #f2f3f7;
  --muted: #9aa2b1;
  --border: #363c52;
  --sidebar: #0a0c12;
  --shadow: 0 1px 2px rgba(0,0,0,.35), 0 4px 16px rgba(0,0,0,.4);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.55);
  --surface-2: #232633;
  --input-bg: #232633;
}
html[data-theme="dark"] .btn { background: var(--input-bg); color: var(--text); }
html[data-theme="dark"] .btn:hover { background: #2a2e3b; color: #c7d2fe; border-color: #3a3f52; }
html[data-theme="dark"] input, html[data-theme="dark"] select, html[data-theme="dark"] textarea {
  background: var(--input-bg); color: var(--text);
}
html[data-theme="dark"] .kanban-col { background: var(--surface-2); }
html[data-theme="dark"] .view-toggle { background: var(--surface-2); }
html[data-theme="dark"] .tabs { background: var(--surface-2); }
html[data-theme="dark"] .tab.active { background: var(--panel); box-shadow: 0 1px 4px rgba(0,0,0,.3); }
html[data-theme="dark"] .table th { background: var(--surface-2); }
html[data-theme="dark"] .table tr:hover td { background: var(--surface-2); }
html[data-theme="dark"] .chat-messages { background: var(--bg); }
html[data-theme="dark"] .msg { background: var(--surface-2); }
html[data-theme="dark"] .chat-input { background: var(--panel); }
html[data-theme="dark"] .notif-item.unread { background: var(--surface-2); }
html[data-theme="dark"] .link-code { background: var(--surface-2); }
html[data-theme="dark"] .kpi-bar { background: var(--surface-2); }
html[data-theme="dark"] #nav a:hover { background: rgba(255,255,255,.06); }
html[data-theme="dark"] .search-field svg { color: var(--muted); }
html[data-theme="dark"] .btn.danger:hover { background: rgba(240,68,56,.12); }

/* ============ ORQA FON: PATTERN / RANG / RASM ============ */
.bg-tab.hidden { display: none; }
.bg-pattern-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; max-width: 340px; }
.bg-pattern-swatch {
  height: 56px; border-radius: 10px; border: 2px solid var(--border); cursor: pointer;
  background-color: var(--bg); position: relative; transition: border-color .15s;
}
.bg-pattern-swatch:hover { border-color: var(--primary); }
.bg-pattern-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(99,102,241,.18); }
.bg-pattern-swatch span {
  position: absolute; bottom: 4px; left: 0; right: 0; text-align: center; font-size: 10.5px;
  font-weight: 600; color: var(--muted);
}
#bg-image-preview img { max-width: 220px; border-radius: 10px; border: 1px solid var(--border); display: block; margin-top: 8px; }
#bg-image-preview .btn { margin-top: 8px; }

.bg-pattern-dots { background-image: radial-gradient(var(--pattern-color, rgba(99,102,241,.3)) 1.4px, transparent 1.4px); background-size: 16px 16px; }
.bg-pattern-grid { background-image: linear-gradient(var(--pattern-color, rgba(99,102,241,.28)) 1px, transparent 1px), linear-gradient(90deg, var(--pattern-color, rgba(99,102,241,.28)) 1px, transparent 1px); background-size: 20px 20px; }
.bg-pattern-diagonal { background-image: repeating-linear-gradient(45deg, var(--pattern-color, rgba(99,102,241,.26)) 0, var(--pattern-color, rgba(99,102,241,.26)) 1.5px, transparent 1.5px, transparent 11px); }
.bg-pattern-cross { background-image: linear-gradient(var(--pattern-color, rgba(99,102,241,.28)) 1px, transparent 1px), linear-gradient(90deg, var(--pattern-color, rgba(99,102,241,.28)) 1px, transparent 1px); background-size: 26px 26px; background-position: 0 0, 13px 13px; }
.bg-pattern-waves { background-image: radial-gradient(circle at 50% 100%, transparent 60%, var(--pattern-color, rgba(99,102,241,.3)) 61%, var(--pattern-color, rgba(99,102,241,.3)) 64%, transparent 65%); background-size: 24px 12px; }
.bg-pattern-triangles { background-image: conic-gradient(from 0deg at 50% 50%, var(--pattern-color, rgba(99,102,241,.28)) 0deg 90deg, transparent 90deg 180deg, var(--pattern-color, rgba(99,102,241,.28)) 180deg 270deg, transparent 270deg 360deg); background-size: 18px 18px; }
.bg-pattern-rectangles { background-image: linear-gradient(var(--pattern-color, rgba(99,102,241,.28)) 1px, transparent 1px), linear-gradient(90deg, var(--pattern-color, rgba(99,102,241,.28)) 1px, transparent 1px); background-size: 28px 16px; }
.bg-pattern-circles { background-image: radial-gradient(circle, transparent 5px, var(--pattern-color, rgba(99,102,241,.3)) 6px, var(--pattern-color, rgba(99,102,241,.3)) 7px, transparent 8px); background-size: 22px 22px; }
body.bg-pattern-dots, body.bg-pattern-grid, body.bg-pattern-diagonal, body.bg-pattern-cross { background-size: 20px 20px; }
body.bg-pattern-cross { background-size: 34px 34px; background-position: 0 0, 17px 17px; }
body.bg-pattern-waves { background-size: 40px 20px; }
body.bg-pattern-triangles { background-size: 26px 26px; }
body.bg-pattern-rectangles { background-size: 42px 24px; }
body.bg-pattern-circles { background-size: 32px 32px; }
body.bg-custom-image { background-size: cover; background-position: center; background-attachment: fixed; }
* { box-sizing: border-box; margin: 0; }
html { font-size: 15px; }
body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, "Helvetica Neue", sans-serif;
  background: var(--bg); color: var(--text); -webkit-font-smoothing: antialiased;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.sm-text { font-size: 12px; display: block; }
svg { width: 18px; height: 18px; flex-shrink: 0; }

/* ============ LOGIN ============ */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 800px at 20% 10%, #1e1b4b 0%, #0c111d 55%);
  position: relative; overflow: hidden; padding: 20px;
}
.login-orb { position: absolute; border-radius: 50%; filter: blur(90px); opacity: .45; animation: float 9s ease-in-out infinite; }
.orb1 { width: 420px; height: 420px; background: #6366f1; top: -120px; left: -80px; }
.orb2 { width: 360px; height: 360px; background: #8b5cf6; bottom: -100px; right: -60px; animation-delay: -3s; }
.orb3 { width: 220px; height: 220px; background: #2e90fa; top: 40%; left: 60%; animation-delay: -6s; }
@keyframes float { 0%,100% { transform: translateY(0) } 50% { transform: translateY(-36px) } }

.login-card {
  position: relative; z-index: 2; width: 400px; max-width: 100%;
  background: rgba(255,255,255,.92); backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,.4);
  padding: 44px 38px; border-radius: 24px; text-align: center;
  box-shadow: 0 32px 80px rgba(0,0,0,.45);
  animation: pop .5s cubic-bezier(.2,.9,.3,1.2);
}
@keyframes pop { from { transform: scale(.92) translateY(16px); opacity: 0 } }
.login-logo {
  width: 68px; height: 68px; margin: 0 auto 18px; border-radius: 20px;
  background: var(--primary-grad); color: #fff; display: flex; align-items: center; justify-content: center;
  box-shadow: 0 12px 28px rgba(99,102,241,.45);
}
.login-logo svg { width: 34px; height: 34px; }
.login-card h1 { font-size: 26px; letter-spacing: -.5px; }
.login-sub { color: var(--muted); font-size: 14px; margin-top: 6px; }
.login-card form { margin-top: 28px; display: flex; flex-direction: column; gap: 14px; }
.field { position: relative; }
.field svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: #98a2b3; }
.field input { width: 100%; padding: 13px 14px 13px 44px; }
.error { color: var(--red); margin-top: 14px; font-size: 14px; }

/* ============ LAYOUT ============ */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 264px; flex-shrink: 0; color: #94a3b8; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
  background: linear-gradient(180deg, #0c111d 0%, #111a2e 100%);
}
.brand { display: flex; gap: 12px; align-items: center; padding: 22px 20px; }
.brand-mark {
  width: 42px; height: 42px; border-radius: 12px; background: var(--primary-grad); color: #fff;
  display: flex; align-items: center; justify-content: center; box-shadow: 0 6px 16px rgba(99,102,241,.4);
}
.brand-mark svg { width: 22px; height: 22px; }
.brand b { color: #fff; font-size: 16px; display: block; letter-spacing: -.3px; }
.brand span { font-size: 11.5px; color: #64748b; }

#nav { flex: 1; padding: 10px 12px; overflow-y: auto; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #475569; padding: 16px 12px 6px; }
#nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; margin-bottom: 2px;
  border-radius: 10px; cursor: pointer; font-size: 14px; font-weight: 500;
  transition: all .18s; user-select: none; position: relative;
}
#nav a:hover { background: rgba(255,255,255,.06); color: #e2e8f0; }
#nav a.active { background: var(--primary-grad); color: #fff; box-shadow: 0 6px 18px rgba(99,102,241,.35); }

.sidebar-footer { padding: 14px; border-top: 1px solid rgba(255,255,255,.07); }
.me-card { display: flex; gap: 10px; align-items: center; padding: 8px; border-radius: 12px; margin-bottom: 8px; }
.me-card #me-info b { color: #fff; font-size: 13.5px; display: block; }
.me-card #me-info span { font-size: 12px; color: #64748b; }
.btn.logout {
  width: 100%; display: flex; align-items: center; justify-content: center; gap: 8px;
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.1); color: #94a3b8;
}
.btn.logout:hover { background: rgba(240,68,56,.15); color: #fda29b; border-color: transparent; }

.content { flex: 1; padding: 26px 32px 48px; max-width: 1240px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.topbar h2 { font-size: 24px; letter-spacing: -.5px; }
.topbar .muted { font-size: 13.5px; }

/* Avatar */
.avatar {
  width: 40px; height: 40px; border-radius: 50%; background: var(--primary-grad); color: #fff;
  display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px;
  flex-shrink: 0; letter-spacing: .5px;
}
.avatar.big { width: 44px; height: 44px; box-shadow: 0 6px 16px rgba(99,102,241,.35); }
.avatar.sm { width: 34px; height: 34px; font-size: 12px; }
.avatar.grp { background: linear-gradient(135deg, #2e90fa, #12b76a); font-size: 15px; }
.avatar.a2 { background: linear-gradient(135deg, #f79009, #f04438); }
.avatar.a3 { background: linear-gradient(135deg, #12b76a, #2e90fa); }
.avatar.a4 { background: linear-gradient(135deg, #ee46bc, #8b5cf6); }

/* ============ CARDS ============ */
.page { animation: fadeUp .35s ease; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(10px) } }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); gap: 16px; margin-bottom: 22px; }
.card {
  background: var(--panel); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow);
  display: flex; gap: 14px; align-items: center; transition: transform .2s, box-shadow .2s;
  border: 1px solid var(--border);
}
.card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.card .ico {
  width: 46px; height: 46px; border-radius: 12px; display: flex; align-items: center; justify-content: center;
  font-size: 20px; flex-shrink: 0;
}
.ico.i-blue { background: #eff4ff; } .ico.i-green { background: #ecfdf3; }
.ico.i-amber { background: #fffaeb; } .ico.i-red { background: #fef3f2; }
.ico.i-violet { background: #f4f3ff; }
.card .num { font-size: 24px; font-weight: 800; letter-spacing: -.5px; line-height: 1.1; }
.card .lbl { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.card.bad .num { color: var(--red); } .card.good .num { color: var(--green); } .card.warn .num { color: var(--amber); }

.panel {
  background: var(--panel); border-radius: var(--radius); padding: 22px;
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.panel h3 { margin-bottom: 16px; font-size: 16px; letter-spacing: -.3px; }
.table-panel { padding: 8px 0 0; overflow-x: auto; }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; align-items: start; }

/* Donut (Chart.js) */
.donut-wrap { display: flex; align-items: center; gap: 22px; flex-wrap: wrap; }
.donut-chart-box { position: relative; width: 180px; height: 180px; flex-shrink: 0; }
.donut-center {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; pointer-events: none;
}
.donut-center b { font-size: 30px; letter-spacing: -1px; }
.donut-center span { font-size: 12px; color: var(--muted); }
.donut-legend { display: flex; flex-direction: column; gap: 10px; font-size: 13.5px; }
.donut-legend .li { display: flex; align-items: center; gap: 9px; }
.donut-legend .sw { width: 11px; height: 11px; border-radius: 4px; }
.donut-legend b { margin-left: auto; padding-left: 18px; }

/* KPI */
.kpi-row { display: flex; align-items: center; gap: 12px; margin-bottom: 13px; font-size: 13.5px; }
.kpi-row .name { width: 160px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.kpi-bar { flex: 1; height: 8px; background: #eaecf0; border-radius: 99px; overflow: hidden; }
.kpi-bar > div { height: 100%; background: var(--primary-grad); border-radius: 99px; transition: width .6s ease; }
.kpi-row .val { width: 92px; text-align: right; color: var(--muted); font-size: 12.5px; }

/* ============ BUTTONS / INPUTS ============ */
.btn {
  padding: 10px 16px; border: 1px solid var(--border); border-radius: 10px; background: var(--input-bg);
  cursor: pointer; font-size: 14px; font-weight: 600; font-family: inherit; color: var(--text);
  transition: all .18s;
}
.btn:hover { border-color: #c7d2fe; color: var(--primary-d); background: #f5f6ff; }
.btn.primary { background: var(--primary-grad); color: #fff; border: none; box-shadow: 0 4px 14px rgba(99,102,241,.35); }
.btn.primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.btn.success { background: linear-gradient(135deg, #12b76a, #0e9f5f); color: #fff; border: none; box-shadow: 0 4px 14px rgba(18,183,106,.3); }
.btn.success:hover { filter: brightness(1.07); }
.btn.danger { color: var(--red); }
.btn.danger:hover { background: #fef3f2; border-color: #fda29b; color: var(--red); }
.btn.ghost { border: none; background: transparent; box-shadow: none; }
.btn.small { padding: 6px 11px; font-size: 12.5px; border-radius: 8px; }
.btn.full { width: 100%; }
.btn.big { padding: 13px; font-size: 15px; }
input, select, textarea {
  padding: 10px 14px; border: 1.5px solid var(--border); border-radius: 10px;
  font-size: 14px; font-family: inherit; background: var(--input-bg); color: var(--text); transition: border .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px rgba(99,102,241,.13);
}
.page-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; flex-wrap: wrap; gap: 10px; }
.filters { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.search-field { position: relative; }
.search-field svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: #98a2b3; width: 16px; height: 16px; }
.search-field input { padding-left: 38px; width: 230px; }

/* ============ TABLE ============ */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
  text-align: left; padding: 12px 18px; color: var(--muted); font-weight: 600;
  border-bottom: 1px solid var(--border); font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
  background: #f9fafb;
}
.table th:first-child { border-top-left-radius: var(--radius); }
.table th:last-child { border-top-right-radius: var(--radius); }
.table td { padding: 13px 18px; border-bottom: 1px solid var(--border); }
.table tr:last-child td { border-bottom: none; }
.table tbody tr, .table tr { transition: background .12s; }
.table tr:hover td { background: #f9fafb; }
.td-user { display: flex; align-items: center; gap: 10px; }

/* ============ TAGS ============ */
.tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 11px; border-radius: 99px;
  font-size: 12px; font-weight: 600;
}
.tag::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tag.yangi { background: #eff4ff; color: #2e90fa; }
.tag.jarayonda { background: #fffaeb; color: #dc8b09; }
.tag.bajarildi { background: #ecfdf3; color: #12b76a; }
.tag.bekor { background: #fef3f2; color: #f04438; }
.tag.past { background: #f2f4f7; color: #667085; }
.tag.orta { background: #fffaeb; color: #dc8b09; }
.tag.yuqori { background: #fef3f2; color: #f04438; }
.tag.kirim { background: #ecfdf3; color: #12b76a; }
.tag.chiqim { background: #fef3f2; color: #f04438; }
.tag.low { background: #fef3f2; color: #f04438; }

/* ============ TASKS ============ */
.task-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.task-card {
  background: var(--panel); border-radius: var(--radius); padding: 18px 20px; box-shadow: var(--shadow);
  border: 1px solid var(--border); border-top: 4px solid var(--border);
  transition: transform .2s, box-shadow .2s; animation: fadeUp .35s ease;
}
.task-card:hover { transform: translateY(-3px); box-shadow: var(--shadow-lg); }
.task-card.yuqori { border-top-color: var(--red); }
.task-card.orta { border-top-color: var(--amber); }
.task-card.past { border-top-color: #98a2b3; }
.task-card h4 { margin-bottom: 6px; font-size: 15.5px; letter-spacing: -.2px; }
.task-card .desc { font-size: 13px; color: var(--muted); margin-bottom: 12px; white-space: pre-wrap; line-height: 1.5; }
.task-meta { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; font-size: 12.5px; color: var(--muted); margin-bottom: 14px; }
.task-actions { display: flex; gap: 7px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 12px; }
.overdue { color: var(--red); font-weight: 700; }

/* ============ KANBAN (Vazifalar — Trello uslubi) ============ */
.kanban-board { display: flex; gap: 16px; overflow-x: auto; padding-bottom: 14px; align-items: flex-start; }
.kanban-col {
  background: #eef0f5; border-radius: 14px; padding: 12px; width: 300px; flex: 0 0 300px;
  display: flex; flex-direction: column; max-height: calc(100vh - 200px);
}
.kanban-col-head { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 14px; margin-bottom: 10px; padding: 2px 4px; }
.kanban-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.kanban-dot.yangi { background: #2e90fa; }
.kanban-dot.jarayonda { background: #f79009; }
.kanban-dot.bajarildi { background: #12b76a; }
.kanban-dot.bekor { background: #f04438; }
.kanban-count { margin-left: auto; background: rgba(16,24,40,.08); border-radius: 99px; padding: 1px 9px; font-size: 12px; font-weight: 700; color: var(--muted); }
.kanban-col-body { display: flex; flex-direction: column; gap: 10px; overflow-y: auto; min-height: 46px; padding: 3px; border-radius: 10px; transition: background .15s; }
.kanban-col-body.drag-over { background: rgba(99,102,241,.1); outline: 2px dashed var(--primary); outline-offset: -2px; }
.kanban-empty { text-align: center; color: var(--muted); font-size: 12.5px; padding: 16px 0; }
.kanban-add-card {
  margin-top: 8px; background: transparent; border: none; text-align: left; color: var(--muted);
  font-size: 13px; padding: 9px 8px; cursor: pointer; border-radius: 8px; font-family: inherit; font-weight: 600;
}
.kanban-add-card:hover { background: rgba(16,24,40,.06); color: var(--text); }
.kanban-col-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kanban-col-menu { display: flex; gap: 2px; flex-shrink: 0; }
.kanban-col-btn {
  border: none; background: transparent; cursor: pointer; border-radius: 6px; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center; font-size: 12px; color: var(--muted);
}
.kanban-col-btn:hover { background: rgba(16,24,40,.08); color: var(--text); }
.kanban-col-add { background: transparent; border: 2px dashed var(--border); align-items: center; justify-content: center; min-height: 60px; }
.kanban-add-col { background: transparent; border: none; cursor: pointer; font-weight: 700; font-size: 13.5px; color: var(--muted); padding: 12px 20px; font-family: inherit; }
.kanban-add-col:hover { color: var(--primary); }

.view-toggle { display: flex; background: #eaecf0; border-radius: 10px; padding: 3px; gap: 2px; }
.view-toggle-btn {
  border: none; background: transparent; padding: 7px 13px; border-radius: 8px; cursor: pointer;
  font-size: 12.5px; font-weight: 600; color: var(--muted); font-family: inherit; transition: all .15s;
}
.view-toggle-btn.active { background: var(--panel); color: var(--text); box-shadow: var(--shadow); }

.kanban-card {
  background: var(--panel); border-radius: 10px; padding: 12px 14px; box-shadow: var(--shadow);
  border-left: 4px solid var(--border); cursor: grab; animation: fadeUp .3s ease;
}
.kanban-card:active { cursor: grabbing; }
.kanban-card.yuqori { border-left-color: var(--red); }
.kanban-card.orta { border-left-color: var(--amber); }
.kanban-card.past { border-left-color: #98a2b3; }
.kanban-card.dragging { opacity: .35; }
.kanban-card h4 { font-size: 13.5px; margin-bottom: 6px; letter-spacing: -.1px; }
.kanban-card .desc {
  font-size: 12px; color: var(--muted); margin-bottom: 8px; line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.kanban-card .task-meta { margin-bottom: 8px; font-size: 11.5px; }
.kanban-card .task-actions { border-top: none; padding-top: 6px; margin-top: 2px; gap: 6px; }

@media (max-width: 900px) {
  .kanban-col { width: 250px; flex: 0 0 250px; max-height: none; }
}

/* ============ TABS ============ */
.tabs { display: flex; gap: 4px; background: #eaecf0; padding: 4px; border-radius: 11px; }
.tab {
  padding: 8px 16px; border: none; background: transparent; cursor: pointer; border-radius: 8px;
  font-size: 13.5px; font-weight: 600; color: var(--muted); font-family: inherit; transition: all .15s;
}
.tab.active { background: #fff; color: var(--text); box-shadow: 0 1px 4px rgba(16,24,40,.12); }

/* ============ CHAT ============ */
.chat-layout { display: grid; grid-template-columns: 280px 1fr; gap: 16px; height: calc(100vh - 150px); min-height: 420px; }
.chat-users { overflow-y: auto; padding: 12px; }
.chat-sep { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 14px 10px 6px; }
.chat-user {
  padding: 9px 10px; border-radius: 12px; cursor: pointer; font-size: 14px; margin-bottom: 3px;
  display: flex; align-items: center; gap: 11px; transition: background .15s;
}
.chat-user:hover { background: #f2f4f7; }
.chat-user.active { background: #eef0ff; }
.chat-user b { font-size: 13.5px; display: block; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: #d0d5dd; flex-shrink: 0; margin-left: auto; }
.dot.on { background: var(--green); box-shadow: 0 0 0 3px #d1fadf; }
.chat-box { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.chat-title { padding: 16px 22px; border-bottom: 1px solid var(--border); font-weight: 700; font-size: 15px; }
.chat-messages { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 4px; background: #fafbfc; }
.msg-row { display: flex; gap: 10px; align-items: flex-end; margin-top: 10px; animation: fadeUp .25s ease; }
.msg-row.mine { flex-direction: row-reverse; }
.msg {
  max-width: 65%; padding: 10px 15px; border-radius: 16px 16px 16px 4px; background: #fff;
  font-size: 14px; box-shadow: var(--shadow); border: 1px solid var(--border); line-height: 1.45;
}
.msg .who { font-size: 11.5px; color: var(--primary-d); margin-bottom: 3px; font-weight: 700; }
.msg .when { font-size: 10.5px; color: var(--muted); margin-top: 4px; text-align: right; }
.msg-row.mine .msg { background: var(--primary-grad); color: #fff; border: none; border-radius: 16px 16px 4px 16px; }
.msg-row.mine .when { color: rgba(255,255,255,.75); }
.chat-input { display: flex; gap: 10px; padding: 14px 16px; border-top: 1px solid var(--border); background: #fff; }
.chat-input input { flex: 1; border-radius: 12px; }
.btn.send { width: 46px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 12px; }
.badge { background: var(--red); color: #fff; border-radius: 99px; padding: 1px 8px; font-size: 11px; margin-left: auto; }

/* ============ MODAL ============ */
.modal-wrap {
  position: fixed; inset: 0; background: rgba(12,17,29,.55); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 18px;
}
.modal {
  background: var(--panel); border-radius: 20px; padding: 26px; width: 460px; max-width: 100%;
  max-height: 88vh; overflow-y: auto; box-shadow: var(--shadow-lg); animation: pop .3s cubic-bezier(.2,.9,.3,1.15);
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; }
.modal-head h3 { font-size: 18px; letter-spacing: -.3px; }
.modal form { display: flex; flex-direction: column; gap: 12px; }
.modal label { font-size: 12.5px; color: var(--muted); font-weight: 600; margin-bottom: -7px; }

/* ============ QISM-VAZIFALAR (subtasks) ============ */
.subtask-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 4px; border-bottom: 1px solid var(--border);
}
.subtask-row:last-child { border-bottom: none; }
.subtask-row.done .subtask-check span { text-decoration: line-through; color: var(--muted); }
.subtask-check { display: flex; align-items: center; gap: 9px; font-size: 14px; cursor: pointer; flex: 1; min-width: 0; }
.subtask-check input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--primary); flex-shrink: 0; }
.subtask-check span { overflow-wrap: anywhere; }
.subtask-meta { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* ============ TOAST / EMPTY ============ */
.toast {
  position: fixed; bottom: 26px; right: 26px; background: #0c111d; color: #fff;
  padding: 13px 22px; border-radius: 12px; z-index: 200; box-shadow: var(--shadow-lg);
  font-size: 14px; animation: slideIn .3s ease;
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0 } }
.toast.err { background: var(--red); }
.empty { text-align: center; padding: 48px 20px; color: var(--muted); }
.empty .e-ico { font-size: 40px; margin-bottom: 10px; }

/* ============ BELL / NOTIFICATIONS ============ */
.topbar-right { display: flex; align-items: center; gap: 14px; }
.my-status {
  position: relative; display: flex; align-items: center; gap: 8px; height: 44px;
  padding: 0 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--border);
  cursor: pointer; transition: .15s; box-shadow: var(--shadow); font-size: 13px; font-weight: 600;
}
.my-status:hover { border-color: var(--primary); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; background: #12b76a; flex-shrink: 0; }
.my-status-menu {
  position: absolute; top: 52px; right: 0; width: 170px; background: var(--panel);
  border-radius: 14px; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  z-index: 90; overflow: hidden; cursor: default; animation: pop .25s ease;
}
.my-status-opt { display: flex; align-items: center; gap: 8px; padding: 10px 14px; font-size: 13px; font-weight: 500; cursor: pointer; }
.my-status-opt:hover { background: var(--bg); }
.bell {
  position: relative; width: 44px; height: 44px; border-radius: 12px; background: var(--panel);
  border: 1px solid var(--border); display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: .15s; box-shadow: var(--shadow);
}
.bell:hover { border-color: var(--primary); color: var(--primary); }
.bell-badge {
  position: absolute; top: -5px; right: -5px; background: var(--red); color: #fff;
  border-radius: 99px; padding: 1px 6px; font-size: 11px; font-weight: 700; border: 2px solid var(--bg);
}
.notif-panel {
  position: absolute; top: 52px; right: 0; width: 360px; max-width: 88vw; background: var(--panel);
  border-radius: 16px; box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  z-index: 90; max-height: 460px; overflow-y: auto; cursor: default; animation: pop .25s ease;
}
.notif-head { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.notif-item { padding: 12px 18px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.notif-item:last-child { border-bottom: none; }
.notif-item.unread { background: #f5f6ff; }
.notif-item b { display: block; margin-bottom: 2px; }
.notif-item .n-body { color: var(--muted); white-space: pre-wrap; }
.notif-item .n-time { color: var(--muted); font-size: 11px; margin-top: 4px; }

.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 900px) { .settings-grid { grid-template-columns: 1fr; } }
.tg-linked { display: flex; align-items: center; gap: 10px; }
.link-code { font-size: 26px; font-weight: 800; letter-spacing: 6px; color: var(--primary-d);
  background: #f5f6ff; padding: 10px 18px; border-radius: 12px; display: inline-block; margin: 8px 0; }

/* ============ MAP ============ */
#map { height: calc(100vh - 240px); min-height: 380px; border-radius: var(--radius); overflow: hidden; z-index: 1; }
.maplibregl-map { font-family: inherit; }
/* MapLibre z-index'lari modal/toast ostida qolishi uchun */
.modal-wrap { z-index: 2000 !important; }
.map-legend {
  position: absolute; top: 12px; left: 12px; z-index: 5;
  background: rgba(20, 20, 28, .72); backdrop-filter: blur(6px);
  border-radius: 10px; padding: 8px 14px; display: flex; gap: 16px;
  font-size: 12px; color: #f2f2f5; pointer-events: none;
}
.map-legend span { display: flex; align-items: center; gap: 6px; }
.map-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; flex-shrink: 0; }
.map-line-sw { width: 22px; height: 4px; border-radius: 2px; display: inline-block; background: #ffd400; box-shadow: 0 0 0 1px rgba(0,0,0,.35); }
.maplibregl-ctrl-attrib { font-size: 10px; }
.map-status {
  position: absolute; top: 12px; right: 12px; z-index: 5; min-width: 210px;
  background: rgba(20, 20, 28, .72); backdrop-filter: blur(6px);
  border-radius: 10px; padding: 10px 14px; color: #f2f2f5;
}
.map-status-head { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.map-status-time { font-size: 11px; opacity: .7; margin-bottom: 6px; }
.map-status-row { display: flex; align-items: center; gap: 8px; margin-top: 5px; font-size: 11px; }
.map-status-row .lbl { width: 54px; flex-shrink: 0; opacity: .9; }
.map-status-bar { flex: 1; height: 6px; border-radius: 3px; background: rgba(255,255,255,.15); overflow: hidden; }
.map-status-bar i { display: block; height: 100%; border-radius: 3px; }
.map-status-row .val { flex-shrink: 0; opacity: .75; white-space: nowrap; }
.notif-panel { z-index: 1900 !important; }
.toast { z-index: 2100 !important; }

/* ============ PHOTO UPLOAD ============ */
.photo-btn { text-align: center; cursor: pointer; border-style: dashed; border-width: 2px; }
.photo-btn.has-file { border-color: var(--green); color: var(--green); border-style: solid; }
.photo-preview { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.photo-preview img { max-width: 100%; max-height: 220px; border-radius: 12px; box-shadow: var(--shadow); }
a.tag { text-decoration: none; cursor: pointer; }

/* ============ OYLIK / KPI ============ */
.pay-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
.pay-money { font-variant-numeric: tabular-nums; white-space: nowrap; }
.pay-total { font-weight: 800; color: var(--green); }
.pay-fine { color: var(--red); }
.pay-bar { height: 6px; border-radius: 99px; background: var(--surface-2); overflow: hidden; min-width: 60px; }
.pay-bar > div { height: 100%; border-radius: 99px; transition: width .5s ease; }
.pay-cell-sm { font-size: 12px; color: var(--muted); }
.sal-edit { cursor: pointer; border-bottom: 1px dashed var(--border); }
.sal-edit:hover { color: var(--primary); border-color: var(--primary); }

/* ============ LOYIHA ALMASHTIRGICH (superadmin) ============ */
.org-switch { position: relative; padding: 0 14px 12px; }
.org-switch-btn {
  width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.12);
  border-radius: 11px; cursor: pointer; color: #e2e8f0; font-family: inherit; text-align: left;
  transition: background .18s, border-color .18s;
}
.org-switch-btn:hover { background: rgba(255,255,255,.13); border-color: rgba(99,102,241,.6); }
.org-switch-btn svg { width: 15px; height: 15px; margin-left: auto; flex-shrink: 0; opacity: .7; }
.org-ico { font-size: 15px; flex-shrink: 0; }
.org-cur { min-width: 0; }
.org-cur small { display: block; font-size: 10px; color: #64748b; text-transform: uppercase; letter-spacing: .06em; }
.org-cur b { display: block; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-menu {
  position: absolute; left: 14px; right: 14px; top: calc(100% - 6px); z-index: 60;
  background: var(--panel); border: 1px solid var(--border); border-radius: 13px;
  box-shadow: var(--shadow-lg); max-height: 320px; overflow-y: auto; padding: 6px; animation: pop .2s ease;
}
.org-opt {
  display: flex; align-items: center; gap: 9px; padding: 9px 11px; border-radius: 9px;
  cursor: pointer; font-size: 13.5px; color: var(--text); transition: background .15s;
}
.org-opt:hover { background: var(--surface-2); }
.org-opt.active { background: var(--primary-grad); color: #fff; }
.org-opt .o-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-opt .o-plan { font-size: 10.5px; opacity: .75; flex-shrink: 0; }
.org-search { width: 100%; margin-bottom: 6px; font-size: 13px; padding: 8px 11px; }
.super-only { display: none; }

/* Boshqa loyihada ishlayotganini bildiruvchi lenta */
.impersonate-bar {
  background: linear-gradient(135deg, #f79009, #f04438); color: #fff; padding: 8px 18px;
  border-radius: 11px; margin-bottom: 16px; display: flex; align-items: center; gap: 12px;
  font-size: 13.5px; font-weight: 600; box-shadow: 0 6px 18px rgba(240,68,56,.3);
}
.impersonate-bar button {
  margin-left: auto; background: rgba(255,255,255,.22); border: 1px solid rgba(255,255,255,.35);
  color: #fff; padding: 5px 13px; border-radius: 8px; cursor: pointer; font-family: inherit;
  font-size: 12.5px; font-weight: 600;
}
.impersonate-bar button:hover { background: rgba(255,255,255,.35); }

/* Mijozlar jadvali */
.cl-name b { display: block; }
.cl-name span { font-size: 12px; color: var(--muted); }
.plan-tag { padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 700; }
.plan-bepul { background: rgba(102,112,133,.16); color: var(--muted); }
.plan-biznes { background: rgba(99,102,241,.16); color: #818cf8; }
.plan-korxona { background: rgba(18,183,106,.16); color: var(--green); }
.sub-warn { color: var(--amber); font-weight: 600; }
.sub-danger { color: var(--red); font-weight: 700; }

/* ============ RESPONSIVE ============ */
.mobile-menu-btn {
  display: none; margin-left: auto; background: transparent; border: 1px solid rgba(255,255,255,.15);
  color: #fff; width: 38px; height: 38px; border-radius: 10px; align-items: center; justify-content: center;
  cursor: pointer; flex-shrink: 0;
}
.mobile-menu-btn svg { width: 20px; height: 20px; }
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: static; }
  .mobile-menu-btn { display: flex; }
  #nav {
    display: none; flex-direction: column; padding: 8px 12px 14px; max-height: 70vh; overflow-y: auto;
  }
  .sidebar.nav-open #nav { display: flex; }
  .nav-label { display: none; }
  /* Chiqish/profil qatori endi asosiy ekranda emas — faqat hamburger menyu ochilganda ko'rinadi */
  .sidebar-footer { display: none; gap: 10px; align-items: center; }
  .sidebar.nav-open .sidebar-footer { display: flex; }
  .me-card { margin-bottom: 0; flex: 1; }
  .btn.logout { width: auto; }
  .content { padding: 18px; }
  .dash-grid { grid-template-columns: 1fr; }
  .chat-layout { grid-template-columns: 1fr; height: auto; }
  .chat-users { max-height: 200px; }
  .chat-box { height: 60vh; }
  .search-field input { width: 100%; }
}

/* ============ CAMERAS (Ezviz) ============ */
.cam-card { padding: 0; overflow: hidden; display: flex; flex-direction: column; }
.cam-thumb { width: 100%; aspect-ratio: 16/9; background: #12141c; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cam-thumb img { width: 100%; height: 100%; object-fit: cover; }
.cam-thumb-ph { font-size: 34px; opacity: .35; }
.cam-info { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px 6px; }
.cam-actions { display: flex; gap: 8px; padding: 10px 16px 16px; }
.cam-actions .btn { flex: 1; }
.cam-live-wrap { display: flex; flex-direction: column; gap: 16px; align-items: center; }
#cam-video { width: 100%; max-height: 60vh; border-radius: 10px; background: #000; }
.ptz-pad {
  display: grid; grid-template-columns: repeat(3, 48px); grid-template-rows: repeat(3, 48px);
  gap: 6px;
  grid-template-areas: "zi up zo" "le ce ri" "s1 dn s2";
}
.ptz-btn {
  border: 1px solid var(--border); background: var(--panel); border-radius: 10px; cursor: pointer;
  font-size: 16px; display: flex; align-items: center; justify-content: center; transition: .1s;
  user-select: none; touch-action: none;
}
.ptz-btn:hover { border-color: var(--primary); }
.ptz-btn:active { background: var(--primary); color: #fff; }
.cam-alarm-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.cam-alarm-item:last-child { border-bottom: none; }
.cam-alarm-pic { width: 56px; height: 40px; object-fit: cover; border-radius: 8px; flex-shrink: 0; }

/* Bir xil login bir necha loyihada — kompaniya tanlash */
.org-pick { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--border); text-align: left; }
.org-pick p { font-size: 13.5px; color: var(--muted); margin-bottom: 10px; }
.org-pick .btn { margin-bottom: 8px; justify-content: flex-start; text-align: left; }

/* ============ OYLIK: alohida bo'lim ============ */
.pay-hero {
  display: grid; grid-template-columns: 1fr 1fr; gap: 28px; align-items: center;
  margin-bottom: 16px; background: var(--primary-grad); color: #fff; border: none;
  box-shadow: 0 16px 40px rgba(99,102,241,.32);
}
.pay-hero-lbl { font-size: 13px; opacity: .85; display: block; }
.pay-hero-sum { font-size: clamp(30px, 5vw, 46px); letter-spacing: -1.5px; display: block; margin: 6px 0 4px; }
.pay-hero-sum small { font-size: 16px; font-weight: 600; opacity: .8; letter-spacing: 0; }
.pay-hero .muted { color: rgba(255,255,255,.75) !important; }
.pay-breakdown {
  background: rgba(255,255,255,.14); border: 1px solid rgba(255,255,255,.22);
  border-radius: 14px; padding: 16px 18px; backdrop-filter: blur(8px);
}
.pay-line { display: flex; justify-content: space-between; gap: 14px; padding: 6px 0; font-size: 14px; }
.pay-line b { font-variant-numeric: tabular-nums; }
.pay-line-total {
  border-top: 1px solid rgba(255,255,255,.28); margin-top: 6px; padding-top: 10px;
  font-size: 16px; font-weight: 800;
}
.pay-plus { color: #86efac; }
.pay-hero .pay-fine { color: #fca5a5; }
/* Modal ichidagi tafsilot (oq fonda) */
.modal .pay-breakdown { background: var(--surface-2); border-color: var(--border); backdrop-filter: none; }
.modal .pay-line-total { border-top-color: var(--border); }
.modal .pay-plus { color: var(--green); }

.pay-chart-box { height: 240px; margin-bottom: 18px; }
.bulk-list { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.bulk-row { display: flex; align-items: center; gap: 12px; }
.bulk-row span { flex: 1; font-size: 13.5px; }
.bulk-row input { width: 150px; margin-bottom: 0; }
@media (max-width: 760px) {
  .pay-hero { grid-template-columns: 1fr; gap: 18px; }
  .bulk-row input { width: 120px; }
}
.pay-preview {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  background: var(--surface-2); border-radius: 10px; padding: 11px 14px;
  margin: 4px 0 14px; font-size: 13.5px;
}

/* ============ TELEFON ILOVALARI STATISTIKASI ============ */
.au-summary { display: flex; gap: 20px; flex-wrap: wrap; margin-bottom: 14px; font-size: 13.5px; }
.au-social { color: var(--red); }
.au-cat { font-size: 11px; margin-left: 8px; font-weight: 600; }
.kpi-row .name { display: flex; align-items: center; }
