:root {
  --bg: #06101c;
  --panel: #0b1b2b;
  --panel-2: #0f2336;
  --panel-3: #132a3f;
  --line: rgba(91, 164, 230, .2);
  --line-hi: rgba(77, 163, 255, .48);
  --text: #f3f8fd;
  --muted: #8ea5ba;
  --blue: #238bff;
  --cyan: #48dfff;
  --green: #27d692;
  --amber: #f7b928;
  --red: #ff6b73;
  --font: "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", monospace;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  min-height: 100vh;
  color: var(--text);
  font-family: var(--font);
  background:
    linear-gradient(rgba(77,163,255,.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(77,163,255,.055) 1px, transparent 1px),
    radial-gradient(circle at 15% 10%, rgba(35,139,255,.14), transparent 28%),
    var(--bg);
  background-size: 48px 48px, 48px 48px, auto, auto;
}
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
button { color: inherit; }

.demo-static { max-width: 900px; margin: 48px auto; padding: 0 24px; line-height: 1.75; }
.demo-static h1 { margin-bottom: 20px; font-size: clamp(1.8rem, 4vw, 2.8rem); line-height: 1.2; }
.demo-static p, .demo-static ul { margin: 20px 0; }
.demo-static ul { padding-left: 24px; }
.demo-static a { color: #72b5ff; text-decoration: underline; text-underline-offset: 4px; }

.demo-shell { min-height: 100vh; display: grid; grid-template-columns: 238px 1fr; }
.demo-sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px 18px;
  background: rgba(5, 14, 25, .94);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.demo-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 8px 22px;
  border-bottom: 1px solid var(--line);
}
.demo-brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--blue), var(--cyan));
  font-weight: 700;
  box-shadow: 0 0 20px rgba(35,139,255,.26);
}
.demo-brand-copy strong { display: block; font-size: .9rem; }
.demo-brand-copy span {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .58rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}
.demo-nav { display: grid; gap: 5px; margin-top: 24px; }
.demo-nav button {
  width: 100%;
  padding: 11px 12px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--muted);
  text-align: left;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: .18s ease;
}
.demo-nav button::before {
  content: "";
  width: 7px;
  height: 7px;
  border: 1px solid currentColor;
}
.demo-nav button:hover,
.demo-nav button.active {
  color: #fff;
  background: rgba(35,139,255,.1);
  border-color: rgba(77,163,255,.24);
}
.demo-nav button.active::before {
  background: var(--blue);
  border-color: var(--blue);
  box-shadow: 0 0 10px var(--blue);
}
.demo-side-foot { margin-top: auto; display: grid; gap: 10px; }
.demo-badge {
  padding: 10px 12px;
  border: 1px solid rgba(39,214,146,.25);
  background: rgba(39,214,146,.07);
  color: #8ce7bd;
  font-family: var(--mono);
  font-size: .65rem;
  line-height: 1.55;
}
.back-link {
  color: var(--muted);
  font-family: var(--mono);
  font-size: .68rem;
  padding: 7px 2px;
}
.back-link:hover { color: #fff; }

.demo-main { min-width: 0; }
.demo-topbar {
  min-height: 72px;
  padding: 14px 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(6,16,28,.82);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 15;
}
.demo-title small {
  display: block;
  color: var(--blue);
  font-family: var(--mono);
  font-size: .6rem;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.demo-title h1 { display: block; margin: 2px 0 0; font-size: 1.05rem; font-weight: 700; line-height: inherit; }
.demo-actions { display: flex; align-items: center; gap: 10px; }
.demo-user {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  background: var(--panel-3);
  border: 1px solid var(--line);
  font-size: .75rem;
  font-weight: 700;
}
.mobile-menu { display: none; }
.btn {
  min-height: 40px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  cursor: pointer;
  font-size: .82rem;
  font-weight: 600;
  transition: .18s ease;
}
.btn:hover { border-color: var(--line-hi); transform: translateY(-1px); }
.btn-primary {
  background: linear-gradient(135deg, #1473e6, #238bff);
  border-color: rgba(255,255,255,.15);
  box-shadow: 0 8px 24px rgba(20,115,230,.22);
}
.btn-ghost { background: transparent; color: #b7c8d8; }
.btn-small { min-height: 32px; padding: 6px 10px; font-size: .72rem; }

.demo-content { padding: 28px; max-width: 1500px; margin: 0 auto; }
.view { display: none; }
.view.active { display: block; animation: viewIn .24s ease; }
@keyframes viewIn { from { opacity: 0; transform: translateY(6px); } }
.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}
.page-head h2 { font-size: clamp(1.65rem, 3vw, 2.35rem); letter-spacing: -.035em; }
.page-head p { color: var(--muted); margin-top: 6px; max-width: 660px; line-height: 1.6; }
.live-label {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-family: var(--mono);
  font-size: .65rem;
  white-space: nowrap;
}
.live-label::before {
  content: "";
  width: 7px;
  height: 7px;
  background: var(--green);
  box-shadow: 0 0 10px var(--green);
}

.metric-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.metric {
  min-height: 120px;
  padding: 18px;
  background: rgba(11,27,43,.92);
  border: 1px solid var(--line);
  position: relative;
}
.metric::before {
  content: "";
  position: absolute;
  left: -1px;
  top: -1px;
  width: 34px;
  height: 2px;
  background: var(--blue);
}
.metric-label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: .62rem;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.metric-value { font-size: 2rem; font-weight: 600; margin-top: 12px; line-height: 1; }
.metric-note { margin-top: 9px; color: var(--green); font-size: .72rem; }

.dashboard-grid { display: grid; grid-template-columns: 1.45fr .85fr; gap: 16px; margin-top: 16px; }
.panel {
  background: rgba(11,27,43,.92);
  border: 1px solid var(--line);
  min-width: 0;
}
.panel-head {
  min-height: 52px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.panel-head strong { font-size: .9rem; }
.panel-head span {
  color: var(--muted);
  font-family: var(--mono);
  font-size: .6rem;
  text-transform: uppercase;
}
.panel-body { padding: 16px; }
.bars { height: 220px; display: flex; align-items: flex-end; gap: 10px; padding-top: 20px; }
.bar {
  flex: 1;
  min-width: 18px;
  height: var(--h);
  background: linear-gradient(to top, rgba(35,139,255,.22), var(--blue));
  border-top: 2px solid var(--cyan);
  position: relative;
}
.bar:hover { filter: brightness(1.2); }
.bar::after {
  content: attr(data-label);
  position: absolute;
  bottom: -24px;
  left: 50%;
  transform: translateX(-50%);
  color: var(--muted);
  font-family: var(--mono);
  font-size: .55rem;
}
.activity { list-style: none; }
.activity li {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: 8px 1fr auto;
  gap: 10px;
  align-items: start;
}
.activity li:last-child { border-bottom: 0; }
.activity i { width: 7px; height: 7px; background: var(--blue); margin-top: 6px; }
.activity b { font-size: .8rem; display: block; }
.activity small { color: var(--muted); font-size: .68rem; line-height: 1.45; }
.activity time { color: var(--muted); font-family: var(--mono); font-size: .56rem; white-space: nowrap; }

.toolbar {
  padding: 14px;
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--line);
}
.field {
  min-height: 40px;
  padding: 9px 12px;
  color: var(--text);
  background: #081725;
  border: 1px solid var(--line);
  outline: none;
}
.field:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(35,139,255,.1); }
.search { min-width: 240px; flex: 1; }
.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.data-table th {
  padding: 12px 14px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: .58rem;
  text-align: left;
  text-transform: uppercase;
  letter-spacing: .08em;
  border-bottom: 1px solid var(--line);
}
.data-table td {
  padding: 14px;
  font-size: .8rem;
  border-bottom: 1px solid rgba(91,164,230,.12);
}
.data-table tr:hover td { background: rgba(35,139,255,.045); }
.status {
  display: inline-flex;
  padding: 4px 8px;
  border: 1px solid;
  font-family: var(--mono);
  font-size: .58rem;
  text-transform: uppercase;
}
.status-new { color: #8ac6ff; border-color: rgba(35,139,255,.35); background: rgba(35,139,255,.08); }
.status-progress { color: #ffd374; border-color: rgba(247,185,40,.35); background: rgba(247,185,40,.08); }
.status-done { color: #77e4b5; border-color: rgba(39,214,146,.35); background: rgba(39,214,146,.08); }
.status-lost { color: #ff9ba1; border-color: rgba(255,107,115,.35); background: rgba(255,107,115,.08); }
.row-action {
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-family: var(--mono);
  font-size: .65rem;
}

.kanban { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 14px; overflow-x: auto; padding-bottom: 5px; }
.kanban-col {
  min-height: 420px;
  padding: 12px;
  background: rgba(8,23,37,.72);
  border: 1px solid var(--line);
}
.kanban-head {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  color: #c9d7e4;
  font-size: .78rem;
}
.kanban-head span { color: var(--muted); font-family: var(--mono); }
.lead-card {
  padding: 13px;
  margin-bottom: 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
}
.lead-card strong { font-size: .82rem; }
.lead-card p { color: var(--muted); font-size: .7rem; margin-top: 5px; }
.lead-value { margin: 12px 0 10px; color: #8ec6ff; font-family: var(--mono); font-size: .68rem; }
.lead-card button { width: 100%; }

.report-layout { display: grid; grid-template-columns: .9fr 1.1fr; gap: 18px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-group { display: grid; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-group label {
  color: var(--muted);
  font-family: var(--mono);
  font-size: .6rem;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.form-group textarea { min-height: 92px; resize: vertical; }
.report-preview {
  min-height: 580px;
  padding: 38px;
  background: #f7f9fb;
  color: #172332;
  box-shadow: 0 18px 50px rgba(0,0,0,.24);
}
.report-preview-head {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 2px solid #1473e6;
}
.report-preview h2 { font-size: 1.45rem; }
.report-preview small { color: #6c7b89; }
.report-logo { color: #1473e6; font-weight: 700; }
.report-block { margin-top: 25px; }
.report-block h3 { color: #1473e6; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; }
.report-block p { margin-top: 8px; line-height: 1.65; font-size: .86rem; white-space: pre-line; }
.report-signature { margin-top: 65px; display: flex; justify-content: space-between; color: #6c7b89; font-size: .72rem; }

.modal {
  position: fixed;
  inset: 0;
  display: none;
  place-items: center;
  padding: 20px;
  background: rgba(1,7,13,.76);
  backdrop-filter: blur(7px);
  z-index: 100;
}
.modal.open { display: grid; }
.modal-card {
  width: min(520px, 100%);
  background: #0b1b2b;
  border: 1px solid var(--line-hi);
  box-shadow: 0 30px 90px rgba(0,0,0,.5);
}
.modal-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
}
.modal-close { border: 0; background: transparent; cursor: pointer; color: var(--muted); font-size: 1.2rem; }
.modal-body { padding: 18px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; }
.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  max-width: 340px;
  padding: 13px 16px;
  background: #102a3e;
  border: 1px solid rgba(39,214,146,.42);
  color: #baf2d7;
  font-size: .78rem;
  box-shadow: 0 16px 45px rgba(0,0,0,.35);
  transform: translateY(30px);
  opacity: 0;
  pointer-events: none;
  transition: .25s ease;
  z-index: 120;
}
.toast.show { transform: none; opacity: 1; }
.empty { padding: 32px; text-align: center; color: var(--muted); }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .dashboard-grid, .report-layout { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .demo-shell { grid-template-columns: 1fr; }
  .demo-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: 260px;
    transform: translateX(-100%);
    transition: transform .25s ease;
    box-shadow: 20px 0 60px rgba(0,0,0,.45);
  }
  .demo-sidebar.open { transform: none; }
  .mobile-menu { display: grid; place-items: center; width: 40px; padding: 0; }
  .demo-topbar { padding: 12px 16px; }
  .demo-content { padding: 20px 16px 40px; }
  .demo-actions .btn-primary { display: none; }
  .page-head { align-items: flex-start; flex-direction: column; }
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: auto; }
  .report-preview { padding: 24px; min-height: 520px; }
}

@media (max-width: 460px) {
  .metric-grid { grid-template-columns: 1fr; }
  .toolbar { flex-direction: column; }
  .search { min-width: 0; width: 100%; }
  .toolbar .field, .toolbar .btn { width: 100%; }
  .report-preview-head { flex-direction: column; }
}
