/* =========================================================
   Demo CRM klienta (wulkanizacja) — light glassmorphism
   Pokazowy panel, który handlowiec prezentuje klientowi.
   ========================================================= */

:root {
  --bg:        #eef3fb;
  --bg-2:      #e7edf8;
  --ink:       #16203a;
  --muted:     #5d6b86;
  --line:      rgba(22, 32, 58, 0.08);
  --brand:     #2f6bff;
  --brand-2:   #00c2a8;
  --accent:    #ff7a45;
  --ok:        #18b368;
  --glass:     rgba(255, 255, 255, 0.55);
  --glass-2:   rgba(255, 255, 255, 0.38);
  --glass-bd:  rgba(255, 255, 255, 0.75);
  --shadow:    0 8px 32px rgba(31, 45, 80, 0.12);
  --radius:    18px;
  --radius-sm: 12px;
  --f: 'Plus Jakarta Sans', system-ui, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body {
  font-family: var(--f);
  color: var(--ink);
  background:
    radial-gradient(900px 500px at 12% -8%, #cfe0ff 0%, transparent 55%),
    radial-gradient(800px 500px at 100% 0%, #c8f5ec 0%, transparent 50%),
    linear-gradient(160deg, var(--bg) 0%, var(--bg-2) 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.glass {
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  border: 1px solid var(--glass-bd);
  box-shadow: var(--shadow);
}

.app { display: grid; grid-template-columns: 244px 1fr; min-height: 100vh; }

/* ===== sidebar ===== */
.sidebar { margin: 14px 0 14px 14px; border-radius: var(--radius); padding: 18px 14px; display: flex; flex-direction: column; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 16px; }
.brand-logo { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--brand), var(--brand-2)); display: grid; place-items: center; color: #fff; font-weight: 800; }
.brand-name { font-weight: 800; font-size: 1rem; line-height: 1.1; }
.brand-sub { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.nav a { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 11px; color: var(--muted); font-weight: 600; font-size: .92rem; text-decoration: none; transition: .15s; }
.nav a svg { width: 18px; height: 18px; }
.nav a:hover { background: rgba(255,255,255,.5); color: var(--ink); }
.nav a.active { background: linear-gradient(135deg, rgba(47,107,255,.14), rgba(0,194,168,.12)); color: var(--brand); }
.side-foot { margin-top: auto; padding: 12px 10px 4px; border-top: 1px solid var(--line); }
.side-user { display: flex; align-items: center; gap: 10px; font-size: .82rem; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: #d9e4fb; display: grid; place-items: center; font-weight: 700; color: var(--brand); }

/* ===== main ===== */
.main { padding: 14px 18px 24px; }
.topbar { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.topbar h1 { font-size: 1.5rem; font-weight: 800; letter-spacing: -.02em; }
.topbar .date { color: var(--muted); font-size: .88rem; }
.pill-live { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: 999px; font-weight: 700; font-size: .82rem; color: var(--ok); }
.pill-live .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 0 4px rgba(24,179,104,.18); animation: pulse 1.8s infinite; }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.45} }
.premium-tag { display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px; background: linear-gradient(135deg,#1b2240,#39406b); color: #ffd9a8; font-weight: 700; font-size: .76rem; letter-spacing: .03em; }

/* ===== stat cards ===== */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 14px; }
.stat { border-radius: var(--radius); padding: 16px 18px; }
.stat .lbl { font-size: .78rem; color: var(--muted); font-weight: 600; display: flex; align-items: center; gap: 7px; }
.stat .val { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; margin-top: 8px; }
.stat .sub { font-size: .76rem; margin-top: 2px; font-weight: 600; }
.up { color: var(--ok); } .accent { color: var(--accent); } .brandc { color: var(--brand); }
.stat .ic { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; }

/* ===== grid ===== */
.grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 14px; }
.panel { border-radius: var(--radius); padding: 18px; }
.panel h2 { font-size: 1rem; font-weight: 800; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }
.panel h2 .count { margin-left: auto; font-size: .76rem; color: var(--muted); font-weight: 600; }

/* visit list */
.visit { display: flex; align-items: center; gap: 14px; padding: 11px 0; border-top: 1px solid var(--line); }
.visit:first-of-type { border-top: none; }
.visit .time { font-weight: 800; font-size: .92rem; width: 52px; color: var(--brand); }
.visit .who { flex: 1; min-width: 0; }
.visit .who b { display: block; font-size: .92rem; }
.visit .who span { font-size: .78rem; color: var(--muted); }
.tag { padding: 4px 10px; border-radius: 999px; font-size: .72rem; font-weight: 700; }
.tag.green { background: rgba(24,179,104,.12); color: var(--ok); }
.tag.blue { background: rgba(47,107,255,.12); color: var(--brand); }
.tag.amber { background: rgba(255,122,69,.14); color: var(--accent); }
.bay { font-size: .72rem; color: var(--muted); font-weight: 600; }

/* chart */
.chart { display: flex; align-items: flex-end; gap: 10px; height: 120px; margin-top: 8px; }
.chart .bar { flex: 1; border-radius: 7px 7px 0 0; background: linear-gradient(180deg, var(--brand), #76a4ff); position: relative; }
.chart .bar span { position: absolute; bottom: -20px; left: 0; right: 0; text-align: center; font-size: .68rem; color: var(--muted); }

/* AI call */
.call { padding: 12px; border-radius: var(--radius-sm); background: rgba(255,255,255,.45); border: 1px solid var(--line); margin-bottom: 10px; }
.call .head { display: flex; align-items: center; gap: 8px; font-size: .8rem; color: var(--muted); margin-bottom: 8px; }
.call .head .ai { background: rgba(47,107,255,.12); color: var(--brand); font-weight: 800; padding: 2px 8px; border-radius: 999px; font-size: .7rem; }
.bubble { font-size: .82rem; padding: 7px 11px; border-radius: 11px; margin-bottom: 5px; max-width: 90%; }
.bubble.ai { background: rgba(47,107,255,.10); color: #1a3576; border-bottom-left-radius: 3px; }
.bubble.cli { background: rgba(22,32,58,.06); margin-left: auto; border-bottom-right-radius: 3px; }
.call .res { margin-top: 8px; font-size: .76rem; font-weight: 700; color: var(--ok); display: flex; align-items: center; gap: 6px; }

/* sms */
.sms { display: flex; gap: 10px; align-items: flex-start; padding: 9px 0; border-top: 1px solid var(--line); }
.sms:first-of-type { border-top: none; }
.sms .ic { width: 30px; height: 30px; border-radius: 9px; background: rgba(0,194,168,.12); color: var(--brand-2); display: grid; place-items: center; flex-shrink: 0; }
.sms b { font-size: .82rem; } .sms p { font-size: .78rem; color: var(--muted); }
.muted { color: var(--muted); }

@media (max-width: 1000px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .stats { grid-template-columns: repeat(2,1fr); }
  .grid { grid-template-columns: 1fr; }
}




/* ===== view switching ===== */
.view { display: none; animation: fade .25s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ===== kalendarz ===== */
.cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.cal-col { background: rgba(255,255,255,.4); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 8px; min-height: 180px; }
.cal-col.off { background: rgba(255,255,255,.22); }
.cal-day { font-weight: 800; font-size: .8rem; margin-bottom: 8px; color: var(--ink); }
.ev { font-size: .72rem; font-weight: 600; padding: 5px 7px; border-radius: 8px; margin-bottom: 5px; line-height: 1.2; }
.ev.blue { background: rgba(47,107,255,.12); color: #1a3576; }
.ev.green { background: rgba(24,179,104,.14); color: #0c6e44; }
.ev.amber { background: rgba(255,122,69,.16); color: #a8430f; }
.legend { display: flex; gap: 18px; margin-top: 14px; font-size: .78rem; color: var(--muted); }
.legend i.d { display: inline-block; width: 9px; height: 9px; border-radius: 3px; margin-right: 5px; vertical-align: middle; }
.legend i.d.blue { background: #2f6bff; } .legend i.d.green { background: var(--ok); } .legend i.d.amber { background: var(--accent); }

/* ===== tables ===== */
.tbl { width: 100%; border-collapse: collapse; font-size: .86rem; }
.tbl thead th { text-align: left; font-size: .7rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 700; padding: 0 12px 10px; }
.tbl tbody td { padding: 11px 12px; border-top: 1px solid var(--line); color: var(--ink); }
.tbl tbody tr:hover { background: rgba(255,255,255,.4); }
.tbl b { font-weight: 700; }

/* ===== sms / kampanie ===== */
.sms .bay { margin-left: auto; font-size: .72rem; color: var(--muted); white-space: nowrap; }
.camp { padding: 11px 0; border-top: 1px solid var(--line); }
.camp:first-of-type { border-top: none; }
.camp b { font-size: .88rem; } .camp p { font-size: .76rem; margin: 2px 0 7px; }
.bar-row { height: 7px; border-radius: 999px; background: rgba(22,32,58,.08); overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--brand), var(--brand-2)); }

/* ===== ustawienia ===== */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 0; border-top: 1px solid var(--line); font-size: .9rem; }
.set-row:first-of-type { border-top: none; }
.set-row span:first-child { color: var(--muted); }

/* ===== responsywność mobilna (na końcu — nadpisuje reguły bazowe) ===== */
@media (max-width: 1000px) {
  .topbar { flex-wrap: wrap; }
  .topbar .pill-live { margin-left: 0; }
  .main { padding: 14px 14px 22px; }
  /* kalendarz: dni jeden pod drugim zamiast 7 wąskich kolumn */
  .cal { display: flex; flex-direction: column; gap: 8px; }
  .cal-col { min-height: auto; }
  /* tabele: poziomy scroll wewnątrz panelu zamiast rozpychania strony */
  .panel { overflow-x: auto; }
  table.tbl { min-width: 460px; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: 1fr 1fr; }
  .topbar h1 { font-size: 1.3rem; }
  .premium-tag, .pill-live { font-size: .7rem; padding: 6px 10px; }
  .stat .val { font-size: 1.5rem; }
  .legend { flex-wrap: wrap; gap: 10px; }
}
