:root {
  --bg: #0e1116;
  --bg-2: #151a22;
  --bg-3: #1d2430;
  --card: rgba(21, 26, 34, 0.94);
  --line: rgba(255, 255, 255, 0.08);
  --text: #edf3f8;
  --muted: #9aa8b7;
  --blue: #0592cb;
  --blue-2: #00b2ff;
  --lime: #b0cb1f;
  --red: #ff5d5d;
  --orange: #ffb545;
  --green: #36d399;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.35);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --font: Inter, Arial, Helvetica, sans-serif;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 12% 12%, rgba(5, 146, 203, 0.24), transparent 26%),
    radial-gradient(circle at 86% 0%, rgba(176, 203, 31, 0.14), transparent 24%),
    linear-gradient(135deg, #0b0d12, var(--bg));
  color: var(--text);
  font-family: var(--font);
  overflow-x: hidden;
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }
button { -webkit-tap-highlight-color: transparent; }
.app-shell { display: grid; grid-template-columns: 300px minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  border-right: 1px solid var(--line);
  background: rgba(10, 13, 18, 0.9);
  backdrop-filter: blur(18px);
  z-index: 40;
}
.sidebar-overlay { display: none; }
.brand { display: flex; align-items: center; gap: 14px; margin-bottom: 32px; }
.brand-mark {
  width: 50px; height: 50px; display: grid; place-items: center;
  border-radius: 17px; color: #071017; font-weight: 900; letter-spacing: -0.05em;
  background: linear-gradient(135deg, var(--lime), var(--blue-2));
  box-shadow: 0 12px 32px rgba(5, 146, 203, 0.25);
}
.brand small { display: block; color: var(--muted); margin-top: 4px; }
.nav { display: grid; gap: 8px; margin-bottom: 28px; }
.nav a { padding: 12px 14px; border-radius: 14px; color: var(--muted); border: 1px solid transparent; transition: .2s ease; }
.nav a:hover, .nav a.active { color: var(--text); background: rgba(255,255,255,.06); border-color: var(--line); }
.side-card { padding: 18px; border-radius: var(--radius-lg); border: 1px solid var(--line); background: linear-gradient(180deg, rgba(5,146,203,.16), rgba(255,255,255,.04)); }
.side-card b { display: block; margin-bottom: 8px; }
.side-card p { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; }
.main { padding: 28px; max-width: 1680px; width: 100%; margin: 0 auto; min-width: 0; }
.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 22px; margin-bottom: 28px; }
.title-block { min-width: 0; }
.title-block h1 { margin: 0; font-size: clamp(32px, 4vw, 56px); letter-spacing: -0.065em; line-height: 1.02; }
.title-block p { margin: 12px 0 0; color: var(--muted); max-width: 880px; line-height: 1.55; font-size: 16px; }
.top-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: flex-end; flex: 0 0 auto; }
.top-actions-inline { flex: 0 1 auto; }
.btn {
  border: 0; cursor: pointer; padding: 12px 16px; border-radius: 14px;
  color: var(--text); background: var(--bg-3); border: 1px solid var(--line);
  transition: .2s ease; white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); border-color: rgba(255,255,255,.18); }
.btn-primary { color: #071017; font-weight: 800; background: linear-gradient(135deg, var(--lime), #d7ef55); border-color: transparent; }
.btn-blue { font-weight: 800; background: linear-gradient(135deg, var(--blue), var(--blue-2)); border-color: transparent; }
.btn-danger { background: rgba(255,93,93,.12); border-color: rgba(255,93,93,.28); color: #ffd6d6; }
.grid { display: grid; gap: 18px; }
.stats { grid-template-columns: repeat(4, minmax(0, 1fr)); margin-bottom: 18px; }
.stat-card, .panel, .listing-card, .source-card { border: 1px solid var(--line); background: var(--card); border-radius: var(--radius-xl); box-shadow: var(--shadow); }
.stat-card { padding: 22px; position: relative; overflow: hidden; }
.stat-card::after { content:""; position: absolute; inset: auto -30px -55px auto; width: 130px; height: 130px; border-radius: 999px; background: rgba(5,146,203,.12); }
.stat-label { color: var(--muted); font-size: 14px; margin-bottom: 8px; }
.stat-value { font-size: 34px; font-weight: 900; letter-spacing: -.04em; }
.stat-note { margin-top: 10px; color: var(--muted); font-size: 13px; }
.two-col { grid-template-columns: minmax(0, 1.05fr) minmax(0, .95fr); align-items: start; }
.panel { padding: 22px; overflow: hidden; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h2, .panel-head h3 { margin: 0; letter-spacing: -.04em; font-size: 28px; line-height: 1.08; }
.panel-head p { margin: 8px 0 0; color: var(--muted); line-height: 1.45; font-size: 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.field { display: grid; gap: 8px; }
.field.full { grid-column: 1 / -1; }
.field label { color: var(--muted); font-size: 13px; }
.input, .select, .textarea { width: 100%; color: var(--text); background: rgba(255,255,255,.055); border: 1px solid var(--line); border-radius: 14px; padding: 12px 13px; outline: none; }
.textarea { min-height: 88px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { border-color: rgba(5,146,203,.8); box-shadow: 0 0 0 4px rgba(5,146,203,.12); }
.select option { color: #111; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 8px 10px; border-radius: 999px; color: var(--muted); background: rgba(255,255,255,.055); border: 1px solid var(--line); font-size: 13px; }
.chip strong { color: var(--text); }
.status-dot { width: 8px; height: 8px; flex: 0 0 auto; border-radius: 999px; background: var(--muted); }
.status-dot.good { background: var(--green); } .status-dot.warn { background: var(--orange); } .status-dot.bad { background: var(--red); } .status-dot.blue { background: var(--blue-2); }
.badge { display: inline-flex; align-items: center; justify-content: center; padding: 6px 9px; border-radius: 999px; font-size: 12px; border: 1px solid var(--line); color: var(--muted); background: rgba(255,255,255,.05); white-space: nowrap; }
.badge.a { color: #b9ffdc; border-color: rgba(54,211,153,.32); background: rgba(54,211,153,.1); }
.badge.b { color: #cfefff; border-color: rgba(0,178,255,.32); background: rgba(0,178,255,.09); }
.badge.c { color: #fff0c9; border-color: rgba(255,181,69,.32); background: rgba(255,181,69,.1); }
.badge.d { color: #ffd6d6; border-color: rgba(255,93,93,.32); background: rgba(255,93,93,.1); }
.badge.leasing { color: #f3ffd0; border-color: rgba(176,203,31,.35); background: rgba(176,203,31,.11); }
.source-toolbar { display: grid; grid-template-columns: minmax(0, 1fr) 220px 220px; gap: 12px; margin-bottom: 14px; }
.source-list { display: grid; gap: 12px; max-height: 620px; overflow: auto; padding-right: 4px; }
.source-card { padding: 16px; border-radius: 20px; box-shadow: none; background: rgba(255,255,255,.035); }
.source-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.source-card h4 { margin: 0 0 5px; }
.source-card p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.4; }
.source-meta { display: flex; flex-wrap: wrap; gap: 7px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 10px 12px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.045); color: var(--muted); cursor: pointer; transition: .2s ease; }
.tab.active, .tab:hover { color: var(--text); border-color: rgba(5,146,203,.5); background: rgba(5,146,203,.16); }
.query-list, .activity-list { display: grid; gap: 12px; }
.query-item, .activity-item { padding: 14px; border-radius: 18px; background: rgba(255,255,255,.045); border: 1px solid var(--line); }
.query-item-top, .activity-item-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.query-item h4, .activity-item h4 { margin: 0; }
.query-item p, .activity-item p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
.listings-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.listing-card { padding: 16px; border-radius: 22px; box-shadow: none; background: rgba(255,255,255,.045); }
.listing-img { height: 150px; border-radius: 16px; margin-bottom: 14px; background: linear-gradient(135deg, rgba(5,146,203,.22), rgba(176,203,31,.12)), repeating-linear-gradient(45deg, rgba(255,255,255,.035) 0 8px, transparent 8px 16px); display: grid; place-items: center; color: rgba(255,255,255,.72); font-size: 42px; }
.listing-card h4 { margin: 0 0 8px; letter-spacing: -.03em; }
.price { font-size: 22px; font-weight: 900; color: var(--lime); margin-bottom: 10px; }
.listing-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 12px 0; }
.meta-box { padding: 9px; border-radius: 12px; background: rgba(0,0,0,.16); border: 1px solid var(--line); }
.meta-box span { display: block; color: var(--muted); font-size: 11px; margin-bottom: 3px; }
.meta-box b { font-size: 13px; }
.card-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 12px; }
.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 18px; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td { text-align: left; padding: 13px 14px; border-bottom: 1px solid var(--line); font-size: 14px; }
th { color: var(--muted); font-weight: 600; background: rgba(255,255,255,.035); }
tr:last-child td { border-bottom: 0; }
.toast-area { position: fixed; right: 22px; bottom: 22px; z-index: 100; display: grid; gap: 10px; width: min(390px, calc(100vw - 32px)); }
.toast { padding: 15px; border-radius: 18px; background: rgba(16,22,30,.96); border: 1px solid var(--line); box-shadow: var(--shadow); animation: slideIn .25s ease both; }
.toast b { display: block; margin-bottom: 4px; }
.toast p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }
@keyframes slideIn { from { transform: translateY(10px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }
.modal-backdrop { position: fixed; inset: 0; display: none; place-items: center; padding: 22px; z-index: 80; background: rgba(0,0,0,.66); backdrop-filter: blur(12px); }
.modal-backdrop.open { display: grid; }
.modal { width: min(720px, 100%); max-height: 88vh; overflow: auto; border-radius: var(--radius-xl); background: #111722; border: 1px solid var(--line); box-shadow: var(--shadow); padding: 22px; }
.modal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 16px; }
.modal-head h3 { margin: 0; font-size: 24px; letter-spacing: -.04em; }
.modal-head p { margin: 7px 0 0; color: var(--muted); }
.section-spacer { height: 18px; }
.mobile-menu { display: none; }
.empty-state { padding: 34px; text-align: center; color: var(--muted); border: 1px dashed rgba(255,255,255,.18); border-radius: 22px; background: rgba(255,255,255,.025); }
.progress { height: 9px; border-radius: 999px; background: rgba(255,255,255,.08); overflow: hidden; border: 1px solid var(--line); }
.progress span { display: block; height: 100%; width: 0%; background: linear-gradient(90deg, var(--blue), var(--lime)); transition: width .4s ease; }
.legal-note { padding: 14px; border-radius: 18px; background: rgba(255,181,69,.1); border: 1px solid rgba(255,181,69,.24); color: #ffe5b8; line-height: 1.5; font-size: 14px; }
@media (max-width: 1280px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .listings-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { flex-direction: column; align-items: stretch; }
  .top-actions { justify-content: flex-start; }
}
@media (max-width: 900px) {
  :root { --radius-xl: 22px; --radius-lg: 17px; }
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(320px, 86vw); height: 100dvh; overflow-y: auto; transform: translateX(-105%); transition: transform .25s ease; box-shadow: 24px 0 70px rgba(0,0,0,.45); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-overlay { position: fixed; inset: 0; z-index: 30; display: none; background: rgba(0,0,0,.58); backdrop-filter: blur(3px); }
  .sidebar-overlay.open { display: block; }
  body.menu-open { overflow: hidden; }
  .mobile-menu { display: inline-flex; }
  .main { max-width: none; padding: 18px; }
  .two-col, .source-toolbar { grid-template-columns: 1fr; }
  .side-card { display: none; }
}
@media (max-width: 760px) {
  html, body { width: 100%; max-width: 100%; overflow-x: hidden; }
  body { background: radial-gradient(circle at 18% 0%, rgba(5,146,203,.2), transparent 30%), linear-gradient(135deg, #0b0d12, var(--bg)); }
  .main { width: 100%; padding: 14px; }
  .topbar { gap: 16px; margin-bottom: 18px; }
  .title-block h1 { font-size: clamp(30px, 10.5vw, 42px); line-height: .98; letter-spacing: -.075em; overflow-wrap: anywhere; }
  .title-block p { font-size: 14px; line-height: 1.45; }
  .top-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; justify-content: stretch; }
  .top-actions .btn { width: 100%; justify-content: center; text-align: center; padding: 12px 10px; }
  .top-actions .btn-primary { grid-column: 1 / -1; min-height: 50px; }
  .top-actions-inline { grid-template-columns: 1fr; }
  .top-actions-inline .btn-primary { grid-column: auto; }
  .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 11px 13px; border-radius: 13px; white-space: normal; line-height: 1.2; }
  .stats, .two-col, .listings-grid, .form-grid, .source-toolbar { grid-template-columns: 1fr !important; }
  .stats { gap: 12px; margin-bottom: 14px; }
  .stat-card, .panel, .listing-card, .source-card { box-shadow: 0 12px 34px rgba(0,0,0,.24); }
  .stat-card { padding: 16px; min-height: auto; }
  .stat-value { font-size: 30px; }
  .stat-note { font-size: 12px; }
  .panel { padding: 16px; }
  .panel-head { flex-direction: column; align-items: stretch; gap: 12px; }
  .panel-head h2, .panel-head h3 { font-size: 24px; line-height: 1.05; }
  .panel-head .btn, .panel-head .badge { align-self: flex-start; }
  .chip-row, .source-meta, .tabs { gap: 7px; }
  .chip { width: 100%; justify-content: flex-start; border-radius: 14px; white-space: normal; line-height: 1.35; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; margin-right: -16px; padding-right: 16px; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tab { flex: 0 0 auto; padding: 10px 13px; }
  .source-list { max-height: none; overflow: visible; padding-right: 0; }
  .source-card { padding: 14px; }
  .source-card-top, .query-item-top, .activity-item-top { flex-direction: column; align-items: flex-start; }
  .source-meta .badge, .query-item .badge, .listing-card .badge { white-space: normal; text-align: left; line-height: 1.25; }
  .listing-img { height: 118px; font-size: 34px; }
  .listing-meta { grid-template-columns: 1fr; }
  .card-actions { grid-template-columns: 1fr; }
  table { min-width: 680px; }
  th, td { padding: 11px 12px; font-size: 13px; }
  .modal-backdrop { padding: 10px; align-items: end; }
  .modal { width: 100%; max-height: 92dvh; padding: 16px; border-radius: 22px 22px 0 0; }
  .modal-head { flex-direction: column; align-items: stretch; }
  .modal-head h3 { font-size: 22px; }
  .input, .select, .textarea { font-size: 16px; min-height: 46px; }
  .toast-area { left: 12px; right: 12px; bottom: 12px; width: auto; }
}
@media (max-width: 420px) {
  .main { padding: 12px; }
  .top-actions { grid-template-columns: 1fr; }
  .top-actions .btn-primary { grid-column: auto; }
  .title-block h1 { font-size: 32px; }
  .panel-head h2, .panel-head h3 { font-size: 22px; }
}
