@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@500;600&display=swap');

:root {
  --color-bg: #F5F5FA;
  --color-surface: #FFFFFF;
  --color-ink: #1B1F2E;
  --color-ink-light: #2A2F45;
  --color-brick: #7C3AED;
  --color-brick-light: #A78BFA;
  --color-brick-dark: #6D28D9;
  --color-success: #16A34A;
  --color-warning: #F59E0B;
  --color-info: #3B82F6;
  --color-muted: #6B7280;
  --font-display: 'Space Grotesk', sans-serif;
  --font-body: 'Inter', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-ink);
}

a { text-decoration: none; color: inherit; }

.font-display { font-family: var(--font-display); }
.font-mono { font-family: var(--font-mono); }

/* ---------- Layout ---------- */
.app-layout {
  display: flex;
  min-height: 100vh;
}

.main-content-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow-y: auto;
}

.sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--color-ink);
  color: #fff;
  display: flex;
  flex-direction: column;
  position: relative;
  overflow: hidden;
  transition: width 0.22s ease, min-width 0.22s ease;
}

.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 24px 24px;
  pointer-events: none;
}

.sidebar-header {
  position: relative;
  z-index: 1;
  padding: 22px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  background: linear-gradient(135deg, var(--color-brick-light), var(--color-brick));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  box-shadow: 0 4px 10px rgba(124,58,237,0.35);
  flex-shrink: 0;
}

.sidebar-header .brand {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.sidebar-header .version {
  font-family: var(--font-mono);
  font-size: 11px;
  color: rgba(255,255,255,0.5);
  margin-top: 2px;
}

.sidebar-nav {
  position: relative;
  z-index: 1;
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.nav-section-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(255,255,255,0.35);
  padding: 14px 12px 6px;
  margin: 0;
}

.nav-icon {
  display: flex;
  align-items: center;
  opacity: 0.9;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.7);
  transition: background 0.15s, color 0.15s;
}

.sidebar-nav a:hover {
  background: rgba(255,255,255,0.1);
  color: #fff;
}

.sidebar-nav a.active {
  background: var(--color-brick);
  color: #fff;
}

.sidebar-footer {
  position: relative;
  z-index: 1;
  padding: 14px;
  border-top: 1px solid rgba(255,255,255,0.1);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.sidebar-user-info { min-width: 0; }
.sidebar-user-info .user-name {
  color: #fff;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}
.sidebar-user-info .user-role {
  color: rgba(255,255,255,0.5);
}

.logout-btn {
  background: rgba(255,255,255,0.08);
  border: none;
  color: rgba(255,255,255,0.7);
  width: 34px;
  height: 34px;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.15s, color 0.15s;
}
.logout-btn:hover {
  background: var(--color-brick);
  color: #fff;
}

/* ---------- Topbar ---------- */
.topbar {
  height: 68px;
  flex-shrink: 0;
  background: var(--color-surface);
  border-bottom: 1px solid rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 32px;
}

.topbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--color-bg);
  border-radius: 8px;
  padding: 8px 10px 8px 14px;
  width: 320px;
}
.kbd-hint {
  font-size: 10.5px;
  font-weight: 600;
  color: var(--color-muted);
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 5px;
  padding: 2px 7px;
  white-space: nowrap;
}
.topbar-search input {
  border: none;
  background: none;
  outline: none;
  font-size: 13px;
  font-family: var(--font-body);
  flex: 1;
  min-width: 0;
  color: var(--color-ink);
}
.search-icon { display: flex; align-items: center; opacity: 0.45; }

.breadcrumb {
  font-size: 13px;
  color: var(--color-muted);
  margin: 0;
}
.breadcrumb span {
  color: var(--color-ink);
  font-weight: 600;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.icon-btn {
  background: var(--color-bg);
  border: none;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-muted);
  transition: background 0.15s, color 0.15s;
}
.icon-btn:hover { background: var(--color-brick); color: #fff; }

.topbar-user {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--color-brick);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-family: var(--font-display);
  flex-shrink: 0;
}

.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: var(--color-muted); }

.main-content {
  flex: 1;
  padding: 28px 32px;
  max-width: 1360px;
  width: 100%;
  margin: 0 auto;
}

/* ---------- Dashboard hero ---------- */
.dash-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 22px;
}
.dash-hero-date {
  font-size: 12.5px;
  color: var(--color-muted);
  text-transform: capitalize;
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.06);
  padding: 8px 14px;
  border-radius: 999px;
}

/* ---------- Colored icon stat cards ---------- */
.icon-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.icon-stat-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px 20px;
}

.icon-stat-card.premium {
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  border: 1px solid rgba(0,0,0,0.04);
}
.icon-stat-card.premium:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(27,36,48,0.08);
}

.icon-circle {
  width: 46px;
  height: 46px;
  border-radius: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.4);
}
.icon-circle.blue { background: linear-gradient(135deg, #DCEBFC, #B7D6F7); color: #2563EB; }
.icon-circle.green { background: linear-gradient(135deg, #DDF3E4, #B9E8C8); color: #16A34A; }
.icon-circle.purple { background: linear-gradient(135deg, #EAE1FB, #D5C4F7); color: #7C3AED; }
.icon-circle.orange { background: linear-gradient(135deg, #FCEBD0, #F8D9A6); color: #C99A2E; }
.icon-circle.red { background: linear-gradient(135deg, #FBE0DE, #F6C2BE); color: #DC2626; }

.icon-stat-card .stat-label { margin: 0 0 4px; }
.icon-stat-card .stat-value { font-size: 22px; }
.stat-trend {
  font-size: 11px;
  font-weight: 600;
  margin: 4px 0 0;
}
.stat-trend.trend-up { color: var(--color-success); }
.stat-trend.trend-down { color: #DC2626; }
.stat-trend.trend-flat { color: var(--color-muted); }

.header-pill {
  font-size: 11.5px;
  font-weight: 500;
  color: var(--color-muted);
  background: var(--color-bg);
  border: 1px solid rgba(0,0,0,0.06);
  padding: 5px 12px;
  border-radius: 999px;
  white-space: nowrap;
}

/* ---------- Sotuv voronkasi (haqiqiy huni shakli) ---------- */
.funnel-layout {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.funnel-svg-container {
  flex: 0 0 260px;
  max-width: 260px;
}
.funnel-list {
  flex: 1;
  min-width: 180px;
  display: flex;
  flex-direction: column;
}
.funnel-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 11px 0;
  border-bottom: 1px solid rgba(0,0,0,0.05);
  font-size: 13px;
}
.funnel-list-row:last-child { border-bottom: none; }
.funnel-list-row .dot-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-ink);
}
.funnel-list-row .value { font-weight: 700; }

/* ---------- Xonadon rasmlari galereyasi ---------- */
.image-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}
.image-gallery-item {
  position: relative;
  border-radius: 10px;
  overflow: hidden;
  aspect-ratio: 4/3;
  background: var(--color-bg);
}
.image-gallery-item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.image-gallery-delete {
  position: absolute;
  top: 6px;
  right: 6px;
}
.image-gallery-delete button {
  background: rgba(27,36,48,0.65);
  color: #fff;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  cursor: pointer;
  font-size: 13px;
}
.image-gallery-delete button:hover { background: #DC2626; }

/* ---------- Fayl tanlash maydoni (brauzer standart matnini yashirib, o'zbekcha ko'rsatadi) ---------- */
.file-input-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 7px;
  padding: 7px 10px;
  background: var(--color-surface);
  width: 100%;
  box-sizing: border-box;
  cursor: pointer;
}
.file-input-wrap input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  width: 100%;
}
.file-input-button {
  flex-shrink: 0;
  background: var(--color-bg);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 500;
  color: var(--color-ink);
  white-space: nowrap;
}
.file-input-filename {
  font-size: 12.5px;
  color: var(--color-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-input-wrap:hover { border-color: var(--color-brick); }

/* ---------- Dashboard grid ---------- */
.dashboard-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}
.dashboard-grid-2 {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 20px;
}

@media (max-width: 1100px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .dashboard-grid-2 { grid-template-columns: 1fr; }
}

.chart-card.premium {
  transition: box-shadow 0.2s ease;
}
.chart-card.premium:hover {
  box-shadow: 0 8px 22px rgba(27,36,48,0.07);
}

.chart-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.chart-card-header h3 { margin: 0; font-family: var(--font-display); font-size: 15px; }

.trend-badge {
  font-size: 11.5px;
  font-weight: 700;
  padding: 4px 9px;
  border-radius: 999px;
  font-family: var(--font-mono);
}
.trend-up { background: rgba(47,125,91,0.12); color: var(--color-success); }
.trend-down { background: rgba(220,38,38,0.1); color: #DC2626; }

.donut-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.donut-center-label {
  position: absolute;
  text-align: center;
  pointer-events: none;
}
.donut-center-label .num {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  display: block;
}
.donut-center-label .lbl {
  font-size: 11px;
  color: var(--color-muted);
}

.legend-list {
  margin-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.legend-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
}
.legend-row .dot-label {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--color-muted);
}
.legend-dot {
  width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0;
}
.legend-row .value { font-family: var(--font-mono); font-weight: 600; }

/* ---------- Bottom grid: activity + managers ---------- */
.bottom-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 900px) {
  .bottom-grid { grid-template-columns: 1fr; }
}

.activity-list, .manager-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.activity-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
  font-size: 13px;
}
.activity-row:last-child { border-bottom: none; }
.activity-icon {
  width: 32px; height: 32px; border-radius: 8px;
  background: var(--color-bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
}
.activity-time {
  margin-left: auto;
  color: var(--color-muted);
  font-size: 11px;
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ---------- Timeline (so'nggi harakatlar, premium) ---------- */
.timeline-list {
  position: relative;
  padding-left: 6px;
}
.timeline-row {
  display: flex;
  gap: 14px;
  position: relative;
  padding-bottom: 18px;
}
.timeline-row:last-child { padding-bottom: 0; }
.timeline-row:not(:last-child)::before {
  content: "";
  position: absolute;
  left: 15px;
  top: 32px;
  bottom: 0;
  width: 1.5px;
  background: rgba(0,0,0,0.07);
}
.timeline-dot {
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--color-bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; font-size: 14px;
  border: 2px solid #fff;
  box-shadow: 0 0 0 1px rgba(0,0,0,0.05);
  z-index: 1;
}
.timeline-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex: 1;
  font-size: 13px;
  padding-top: 5px;
  gap: 10px;
  flex-wrap: wrap;
}

.manager-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.manager-row:last-child { border-bottom: none; }
.manager-rank {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--color-bg);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: var(--color-muted);
  flex-shrink: 0;
}
.manager-rank.rank-1 { background: linear-gradient(135deg, #FCD34D, #F59E0B); color: #fff; }
.manager-rank.rank-2 { background: linear-gradient(135deg, #CBD5E1, #94A3B8); color: #fff; }
.manager-rank.rank-3 { background: linear-gradient(135deg, #D9A574, #B8804A); color: #fff; }
.manager-info { flex: 1; min-width: 0; }
.manager-info .name { font-size: 13px; font-weight: 500; margin-bottom: 5px; }
.manager-info .count { font-size: 11px; color: var(--color-muted); margin-top: 4px; }
.manager-bar-track {
  background: var(--color-bg);
  border-radius: 5px;
  height: 6px;
  overflow: hidden;
}
.manager-bar-fill {
  height: 100%;
  border-radius: 5px;
  background: linear-gradient(90deg, var(--color-brick-light), var(--color-brick));
  transition: width 0.6s ease;
}
.manager-total {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--color-success);
  white-space: nowrap;
}


.page-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  margin: 0 0 4px;
}

.page-subtitle {
  color: var(--color-muted);
  font-size: 14px;
  margin: 0 0 28px;
}

/* ---------- Cards ---------- */
.card {
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 12px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  transition: box-shadow 0.2s, transform 0.2s;
}

.avatar-sm { width: 32px; height: 32px; font-size: 13px; }

.avatar-table {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--color-brick-light), var(--color-brick));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 12.5px;
  flex-shrink: 0;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* ---------- Mini stat row (top of list pages) ---------- */
.mini-stat-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}
.mini-stat {
  padding: 14px 18px;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}
.mini-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 18px rgba(27,36,48,0.08);
}
.mini-stat .num { font-family: var(--font-mono); font-size: 22px; font-weight: 700; }
.mini-stat .lbl { font-size: 12px; color: var(--color-muted); margin-top: 2px; }

/* ---------- Progress bar ---------- */
.progress-track {
  background: var(--color-bg);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
  width: 100%;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-brick-light), var(--color-brick));
  border-radius: 6px;
  transition: width 0.4s ease;
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  font-size: 13px;
  color: var(--color-muted);
}
.pagination-controls {
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-btn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  border: 1px solid rgba(0,0,0,0.08);
  background: var(--color-surface);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-ink);
  cursor: pointer;
  transition: background 0.15s;
}
.page-btn:hover { background: var(--color-bg); }
.page-btn.disabled {
  opacity: 0.35;
  pointer-events: none;
}
.page-btn.current {
  background: var(--color-ink);
  color: #fff;
  border-color: var(--color-ink);
  font-family: var(--font-mono);
  font-weight: 600;
}

/* ---------- Section header w/ action button ---------- */
.section-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 20px;
}
.section-header .page-title,
.section-header .page-subtitle { margin-bottom: 0; }

.badge-dot {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.badge-dot::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

/* ---------- Buttons (extra variants) ---------- */
.btn-secondary {
  background: var(--color-bg);
  color: var(--color-ink);
  border: 1px solid rgba(0,0,0,0.08);
}
.btn-secondary:hover { background: #e9eaec; }

.btn-danger {
  background: #DC2626;
  color: #fff;
}
.btn-danger:hover { background: #B91C1C; }

.btn-danger-outline {
  background: none;
  border: 1px solid rgba(220,38,38,0.3);
  color: #DC2626;
}
.btn-danger-outline:hover { background: rgba(220,38,38,0.06); }

.btn-mini {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  color: var(--color-brick);
  background: rgba(168,87,54,0.08);
  padding: 3px 9px;
  border-radius: 6px;
  margin-left: auto;
}
.btn-mini:hover { background: rgba(168,87,54,0.16); }

.action-icon-btn {
  color: var(--color-muted);
  padding: 4px;
  border-radius: 5px;
  font-size: 13px;
}
.action-icon-btn:hover { background: var(--color-bg); }

/* ---------- Django messages ---------- */
.messages-wrap {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.alert {
  padding: 11px 16px;
  border-radius: 8px;
  font-size: 13.5px;
}
.alert-success { background: rgba(47,125,91,0.1); color: var(--color-success); }
.alert-error { background: rgba(220,38,38,0.1); color: #DC2626; }
.alert-warning { background: rgba(201,154,46,0.12); color: var(--color-warning); }
.alert-info { background: rgba(59,110,165,0.1); color: var(--color-info); }

/* ---------- Forms (create/edit) ---------- */
.form-card { padding: 18px 20px; max-width: 720px; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 16px;
}
.form-field { display: flex; flex-direction: column; }
.form-field-checkbox { flex-direction: row; align-items: center; gap: 8px; }
.form-field-checkbox label { order: 2; margin: 0; }

.form-field label {
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 4px;
  color: var(--color-ink);
}

.form-input, .form-select, .form-textarea {
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 7px;
  padding: 7px 10px;
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--color-surface);
  width: 100%;
}
.form-input:focus, .form-select:focus, .form-textarea:focus {
  outline: none;
  border-color: var(--color-brick);
  box-shadow: 0 0 0 3px rgba(168,87,54,0.12);
}
.form-checkbox { width: 16px; height: 16px; }

.field-help { font-size: 11px; color: var(--color-muted); margin: 3px 0 0; }
.field-error { font-size: 11px; color: #DC2626; margin: 3px 0 0; }
.form-alert {
  background: rgba(220,38,38,0.08);
  color: #DC2626;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12.5px;
  margin-bottom: 12px;
}

.form-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
}

.payment-fields {
  display: none;
  padding-top: 4px;
  border-top: 1px dashed rgba(0,0,0,0.08);
}

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
}

/* ---------- Project structure tree ---------- */
.structure-card { padding: 16px 18px; margin-bottom: 14px; }
.structure-sub {
  margin: 10px 0 0 16px;
  padding: 12px 14px;
  background: var(--color-bg);
  border-radius: 8px;
}
.structure-sub2 {
  margin: 8px 0 0 16px;
  padding: 10px 12px;
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.05);
  border-radius: 8px;
}
.structure-head {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
}

.apt-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.apt-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11.5px;
  font-family: var(--font-mono);
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 6px;
}
.apt-chip a { opacity: 0.7; text-decoration: none; }
.apt-chip a:hover { opacity: 1; }

/* ---------- Visual ko'rinish (interaktiv rasm + pinlar) ---------- */
.visual-pin {
  position: absolute;
  width: 18px;
  height: 18px;
  margin-left: -9px;
  margin-top: -9px;
  border-radius: 50%;
  background: rgba(59,110,165,0.85);
  border: 3px solid #fff;
  box-shadow: 0 0 0 3px rgba(59,110,165,0.3), 0 2px 6px rgba(0,0,0,0.25);
  cursor: pointer;
  padding: 0;
  transition: transform 0.15s;
  z-index: 2;
}
.visual-pin:hover { transform: scale(1.25); }

.visual-popup {
  position: absolute;
  width: 260px;
  background: var(--color-surface);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.18);
  padding: 14px;
  display: none;
  z-index: 3;
  transform: translate(14px, -20%);
}
.visual-popup.visible { display: block; }

.visual-popup-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  font-size: 13.5px;
}

.visual-popup-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-top: 1px solid rgba(0,0,0,0.05);
  font-size: 12.5px;
  color: var(--color-ink);
}
.visual-popup-row:hover { color: var(--color-brick); }

/* ---------- Checkbox list (marker forma - bloklarni tanlash) ---------- */
.checkbox-list {
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  padding: 10px 14px;
  max-height: 180px;
  overflow-y: auto;
  font-size: 13px;
}
.checkbox-list ul { list-style: none; margin: 0; padding: 0; }
.checkbox-list li { padding: 4px 0; }
.checkbox-list input { margin-right: 8px; }

/* ---------- Xonadonlar xaritasi (floor plan) ---------- */
.map-layout {
  display: grid;
  grid-template-columns: 220px 1fr 300px;
  gap: 18px;
  align-items: start;
}
@media (max-width: 1100px) {
  .map-layout { grid-template-columns: 1fr; }
}

.map-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.map-side-card { padding: 16px; }
.map-side-card h4 {
  font-family: var(--font-display);
  font-size: 13px;
  margin: 0 0 10px;
}

.map-block-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1.5px solid rgba(0,0,0,0.06);
  margin-bottom: 8px;
  color: var(--color-ink);
  font-size: 13px;
}
.map-block-card:hover { background: var(--color-bg); }
.map-block-card.active {
  border-color: var(--color-success);
  background: rgba(47,125,91,0.06);
}

.map-floor-list { display: flex; flex-direction: column; gap: 4px; }
.map-floor-item {
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--color-ink);
}
.map-floor-item:hover { background: var(--color-bg); }
.map-floor-item.active {
  background: rgba(47,125,91,0.08);
  color: var(--color-success);
  font-weight: 600;
  border: 1.5px solid var(--color-success);
}

.map-plan-card { padding: 20px; }
.map-plan-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 14px;
}
.compass { font-size: 20px; opacity: 0.6; }

.floor-plan-grid {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.floor-plan-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
}

.floor-plan-corridor {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 24px;
  background: var(--color-bg);
  border-radius: 8px;
  padding: 14px;
  margin: 6px 0;
  font-size: 18px;
  opacity: 0.7;
}

.apt-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 12px 8px;
  border-radius: 10px;
  border: 2px solid transparent;
  color: var(--color-ink);
  transition: transform 0.15s, box-shadow 0.15s;
}
.apt-tile:hover { transform: translateY(-2px); box-shadow: 0 4px 10px rgba(0,0,0,0.08); }
.apt-tile.selected { border-color: var(--color-ink); box-shadow: 0 0 0 3px rgba(27,36,48,0.12); }

.apt-tile.badge-free { background: rgba(59,110,165,0.12); }
.apt-tile.badge-booked { background: rgba(201,154,46,0.16); }
.apt-tile.badge-sold { background: rgba(47,125,91,0.14); }
.apt-tile.badge-cancelled, .apt-tile.badge-resale { background: rgba(107,114,128,0.12); }

.apt-tile-number { font-family: var(--font-mono); font-weight: 700; font-size: 15px; }
.apt-tile-meta { font-size: 11px; color: var(--color-muted); }
.apt-tile-price { font-family: var(--font-mono); font-size: 11px; font-weight: 600; margin-top: 2px; }

.floor-plan-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
  font-size: 12.5px;
  color: var(--color-muted);
}
.floor-plan-legend span { display: flex; align-items: center; gap: 6px; }

.map-detail-card { padding: 18px; }
.map-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  font-size: 14px;
}
.map-detail-image {
  width: 100%;
  height: 160px;
  object-fit: cover;
  border-radius: 10px;
  margin-bottom: 14px;
}
.map-detail-image-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--color-bg);
  font-size: 40px;
  color: var(--color-muted);
}
.map-detail-rows { display: flex; flex-direction: column; gap: 9px; }
.map-detail-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12.5px;
  color: var(--color-muted);
  padding-bottom: 9px;
  border-bottom: 1px solid rgba(0,0,0,0.05);
}
.map-detail-row strong { color: var(--color-ink); font-size: 13px; }

/* ---------- Chizma ustidagi to'rtburchaklar (position tool + xarita) ---------- */
.plan-rect {
  position: absolute;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 11px;
  pointer-events: none;
}
.plan-rect-other {
  border: 2px dashed rgba(107,114,128,0.5);
  background: rgba(107,114,128,0.08);
  color: var(--color-muted);
}
.plan-rect-drawing {
  border: 2px solid var(--color-brick);
  background: rgba(168,87,54,0.18);
  color: var(--color-brick-dark);
}

.plan-apt-overlay {
  position: absolute;
  border-radius: 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  border: 2px solid rgba(255,255,255,0.8);
  transition: filter 0.15s, transform 0.15s;
  font-size: 10.5px;
  line-height: 1.3;
  padding: 2px;
  overflow: hidden;
}
.plan-apt-overlay:hover { filter: brightness(0.95); transform: scale(1.02); z-index: 2; }
.plan-apt-overlay.selected { border-color: var(--color-ink); box-shadow: 0 0 0 2px rgba(27,36,48,0.3); z-index: 3; }
.plan-apt-overlay .num { font-family: var(--font-mono); font-weight: 700; }

.plan-apt-overlay.badge-free { background: rgba(59,110,165,0.55); color: #fff; }
.plan-apt-overlay.badge-booked { background: rgba(201,154,46,0.65); color: #fff; }
.plan-apt-overlay.badge-sold { background: rgba(47,125,91,0.6); color: #fff; }
.plan-apt-overlay.badge-cancelled, .plan-apt-overlay.badge-resale { background: rgba(107,114,128,0.55); color: #fff; }

/* ---------- Qidiriladigan mijoz tanlash vidjeti ---------- */
.client-search-widget { position: relative; }
.client-search-results {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  background: var(--color-surface);
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 8px;
  box-shadow: 0 6px 18px rgba(0,0,0,0.12);
  max-height: 220px;
  overflow-y: auto;
  z-index: 20;
}
.client-search-item {
  padding: 9px 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  cursor: pointer;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}
.client-search-item:last-child { border-bottom: none; }
.client-search-item:hover { background: var(--color-bg); }
.client-search-item span { font-family: var(--font-mono); font-size: 12px; color: var(--color-muted); }
.client-search-empty { padding: 10px 12px; font-size: 12.5px; color: var(--color-muted); }

/* ---------- Pul kiritish vidjeti (minglik ajratgich + so'm) ---------- */
.money-input-wrap {
  position: relative;
}
.money-input-wrap .money-display {
  padding-right: 46px;
  font-family: var(--font-mono);
}
.money-suffix {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: var(--color-muted);
  pointer-events: none;
}

/* ---------- Sotuv formasi + to'lov jadvali (yon panel) ---------- */
.sale-form-layout {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.sale-form-layout .form-card { max-width: none; }

.schedule-preview-card {
  padding: 16px 18px;
}





.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  padding: 18px 20px;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-muted);
  margin: 0 0 8px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 30px;
  font-weight: 600;
  margin: 0;
}

.text-success { color: var(--color-success); }
.text-warning { color: var(--color-warning); }
.text-info { color: var(--color-info); }
.text-brick { color: var(--color-brick); }
.text-muted { color: var(--color-muted); }

.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.chart-card {
  padding: 24px;
}

.chart-card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0 0 18px;
}

.bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  font-size: 13px;
}

.bar-row .bar-label {
  width: 110px;
  flex-shrink: 0;
  color: var(--color-muted);
}

.bar-track {
  flex: 1;
  background: var(--color-bg);
  border-radius: 6px;
  height: 10px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 6px;
}

.bar-fill.success { background: var(--color-success); }
.bar-fill.warning { background: var(--color-warning); }
.bar-fill.info { background: var(--color-info); }

.bar-count {
  font-family: var(--font-mono);
  width: 40px;
  text-align: right;
  flex-shrink: 0;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 8px 6px;
  color: var(--color-muted);
  font-weight: 500;
  border-bottom: 1px solid rgba(0,0,0,0.06);
}
.data-table td {
  padding: 8px 6px;
  border-bottom: 1px solid rgba(0,0,0,0.04);
}

/* ---------- Forms / filters ---------- */
.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.filter-bar input[type="text"],
.filter-bar select {
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: var(--font-body);
  background: var(--color-surface);
}

.filter-bar input[type="text"] {
  flex: 1;
  min-width: 200px;
}

.btn {
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font-body);
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary {
  background: var(--color-ink);
  color: #fff;
}
.btn-primary:hover { background: var(--color-ink-light); }

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

/* ---------- Tables (list pages) ---------- */
.table-wrap {
  overflow-x: auto;
}

.list-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.list-table thead {
  background: var(--color-bg);
}

.list-table th {
  text-align: left;
  padding: 12px 20px;
  font-size: 11px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-muted);
}

.list-table td {
  padding: 12px 20px;
  border-top: 1px solid rgba(0,0,0,0.05);
}

.list-table tbody tr:hover {
  background: rgba(0,0,0,0.015);
}

.project-card:hover, .kanban-card:hover {
  box-shadow: 0 10px 26px rgba(27,36,48,0.1);
  transform: translateY(-3px);
}

.progress-pct { color: var(--color-brick); font-weight: 700; }

.project-card-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--color-brick);
}
.project-card-cta:hover { color: var(--color-brick-dark); }

.badge {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
}
.badge-free { background: rgba(59,110,165,0.1); color: var(--color-info); }
.badge-booked { background: rgba(201,154,46,0.1); color: var(--color-warning); }
.badge-sold { background: rgba(47,125,91,0.1); color: var(--color-success); }
.badge-cancelled { background: rgba(107,114,128,0.1); color: var(--color-muted); }
.badge-resale { background: rgba(168,87,54,0.1); color: var(--color-brick); }
.badge-planned { background: rgba(107,114,128,0.1); color: var(--color-muted); }
.badge-construction { background: rgba(201,154,46,0.1); color: var(--color-warning); }
.badge-delivered { background: rgba(47,125,91,0.1); color: var(--color-success); }
.badge-active { background: rgba(59,110,165,0.1); color: var(--color-info); }
.badge-expired { background: rgba(107,114,128,0.1); color: var(--color-muted); }
.badge-converted { background: rgba(47,125,91,0.1); color: var(--color-success); }

/* ---------- Project cards ---------- */
.project-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}

.project-card { padding: 20px; }

.project-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 10px;
  gap: 8px;
}

.project-card h3 {
  font-family: var(--font-display);
  font-size: 16px;
  margin: 0;
}

.project-meta {
  font-size: 13px;
  color: var(--color-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
}

.project-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid rgba(0,0,0,0.06);
  text-align: center;
}

.project-stats .num {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
}
.project-stats .lbl {
  font-size: 11px;
  color: var(--color-muted);
}

/* ---------- Kanban (leads) ---------- */
.kanban {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding-bottom: 16px;
}

.kanban-column {
  width: 280px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
}

.kanban-column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  padding: 0 2px;
  font-size: 13px;
  font-weight: 500;
}

.kanban-count {
  font-family: var(--font-mono);
  font-size: 11px;
  background: var(--color-bg);
  padding: 2px 8px;
  border-radius: 999px;
  color: var(--color-muted);
}

.kanban-card {
  padding: 14px;
  margin-bottom: 10px;
  cursor: grab;
  transition: box-shadow 0.15s, transform 0.15s, opacity 0.15s;
}

.kanban-card:active {
  cursor: grabbing;
}

.kanban-card.dragging {
  opacity: 0.4;
  transform: scale(0.97);
}

.kanban-drop-zone {
  flex: 1 1 auto;
  min-height: 300px;
  border-radius: 8px;
  transition: background 0.15s, box-shadow 0.15s;
}

.kanban-drop-zone.drag-over {
  background: rgba(168,87,54,0.06);
  box-shadow: inset 0 0 0 2px rgba(168,87,54,0.35);
}

.kanban-card .name {
  font-weight: 500;
  font-size: 14px;
}

.kanban-card .phone {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 2px;
}

.kanban-card .manager {
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 8px;
}

.kanban-card .move-btn {
  width: 100%;
  margin-top: 10px;
  background: none;
  border: none;
  color: var(--color-brick);
  font-size: 12px;
  font-weight: 500;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  font-family: var(--font-body);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.kanban-card .move-btn:hover {
  background: rgba(168,87,54,0.06);
}

/* ---------- Login ---------- */
.login-layout {
  display: flex;
  min-height: 100vh;
}

.login-hero {
  flex: 1;
  background: var(--color-ink);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.login-hero::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255,255,255,0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,0.035) 1px, transparent 1px);
  background-size: 24px 24px;
}

.login-hero-content {
  position: relative;
  z-index: 1;
  max-width: 420px;
  padding: 0 48px;
}

.login-hero-content h1 {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 600;
  line-height: 1.2;
  margin: 20px 0 12px;
}

.login-hero-content p {
  color: rgba(255,255,255,0.6);
}

.login-form-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-form {
  width: 100%;
  max-width: 360px;
}

.login-form h2 {
  font-family: var(--font-display);
  font-size: 22px;
  margin: 0 0 4px;
}

.login-form .subtitle {
  color: var(--color-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

.login-form label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 6px;
}

.login-form input {
  width: 100%;
  border: 1px solid rgba(0,0,0,0.1);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--font-body);
  margin-bottom: 16px;
}

.login-form input:focus {
  outline: none;
  border-color: var(--color-brick);
  box-shadow: 0 0 0 3px rgba(168,87,54,0.15);
}

.login-form button {
  width: 100%;
  background: var(--color-brick);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 11px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  font-family: var(--font-body);
}
.login-form button:hover { background: var(--color-brick-dark); }

.login-error {
  color: #DC2626;
  font-size: 13px;
  margin: -8px 0 12px;
}

#ajax-results {
  transition: opacity 0.15s ease;
}

.empty-state {
  color: var(--color-muted);
  font-size: 14px;
  padding: 24px 0;
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { padding: 20px; }
}

/* ---------- Sidebar yopilgan holat (icon-only) ---------- */
.app-layout.sidebar-collapsed .sidebar {
  width: 72px;
  min-width: 72px;
}

.app-layout.sidebar-collapsed .brand-text-wrap,
.app-layout.sidebar-collapsed .nav-section-label,
.app-layout.sidebar-collapsed .nav-label,
.app-layout.sidebar-collapsed .sidebar-user-info {
  display: none;
}

.app-layout.sidebar-collapsed .brand-row {
  justify-content: center;
}

.app-layout.sidebar-collapsed .sidebar-nav a {
  justify-content: center;
  padding: 10px 0;
}

.app-layout.sidebar-collapsed .sidebar-header,
.app-layout.sidebar-collapsed .sidebar-footer {
  padding-left: 0;
  padding-right: 0;
}

.app-layout.sidebar-collapsed .sidebar-user {
  justify-content: center;
  width: 100%;
}

.app-layout.sidebar-collapsed .sidebar-footer {
  flex-direction: column;
  gap: 10px;
}