:root {
  --bg: #0d0b1f; --bg2: #14112b; --card: #181533; --card2: #1f1b3f; --line: #2b2655;
  --text: #f2f0ff; --muted: #9b97c4; --accent: #6d5cff; --accent2: #8b7dff;
  --green: #34d399; --amber: #fbbf24; --red: #f87171; --blue: #60a5fa;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(1200px 600px at 80% -10%, #2a1f6b55, transparent), var(--bg);
  color: var(--text); font: 15px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; letter-spacing: -.01em; }
.muted { color: var(--muted); }
.hidden { display: none !important; }

/* layout */
.shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.side { background: linear-gradient(180deg, #120f2a, #0e0c20); border-right: 1px solid var(--line); padding: 22px 14px; display: flex; flex-direction: column; gap: 6px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 22px; font-weight: 700; font-size: 20px; line-height: 1.1; }
.brand small { display: block; font-size: 12px; font-weight: 500; color: var(--muted); letter-spacing: .06em; text-transform: uppercase; }
.logo { width: 38px; height: 38px; border-radius: 11px; background: linear-gradient(135deg, var(--accent), #a855f7); display: grid; place-items: center; flex: none; }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav button { all: unset; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 12px; color: var(--muted); font-weight: 500; }
.nav button:hover { background: #ffffff0a; color: var(--text); }
.nav button.on { background: linear-gradient(90deg, #5b4bf0, #6d5cff99); color: #fff; }
.nav svg { width: 19px; height: 19px; flex: none; }
.side .grow { flex: 1; }
.main { padding: 26px 30px 40px; min-width: 0; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.top h1 { font-size: 28px; }
.top p { margin: 4px 0 0; color: var(--muted); }
.who { display: flex; align-items: center; gap: 10px; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), #a855f7); display: grid; place-items: center; font-weight: 700; flex: none; }

/* cards */
.card { background: linear-gradient(180deg, var(--card2), var(--card)); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card h2 { font-size: 19px; margin-bottom: 14px; }
.grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.stat { display: flex; align-items: center; gap: 14px; }
.stat .ic { width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: #6d5cff2e; }
.stat .ic svg { width: 26px; height: 26px; }
.stat .n { font-size: 28px; font-weight: 700; line-height: 1.1; }
.cols { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 20px; align-items: start; }
.cols > .stack { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* buttons */
.btn { cursor: pointer; border: 1px solid var(--line); background: #ffffff08; padding: 10px 16px; border-radius: 12px; font-weight: 600; display: inline-flex; align-items: center; justify-content: center; gap: 8px; }
.btn:hover { background: #ffffff12; }
.btn.primary { background: linear-gradient(90deg, #5b4bf0, #7a6bff); border-color: transparent; box-shadow: 0 6px 20px #5b4bf055; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--red); }
.btn.sm { padding: 6px 11px; font-size: 13px; border-radius: 9px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.actions { display: flex; flex-direction: column; gap: 10px; }
.actions .btn { justify-content: flex-start; padding: 13px 16px; }

/* calendar */
.cal-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; flex-wrap: wrap; }
.cal-head .ttl { display: flex; align-items: center; gap: 14px; font-weight: 600; }
.icon-btn { all: unset; cursor: pointer; width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; border: 1px solid var(--line); }
.icon-btn:hover { background: #ffffff12; }
.cal-wrap { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; }
.cal { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.cal .dow { text-align: center; padding: 8px 0; font-size: 12px; color: var(--muted); background: #ffffff06; border-bottom: 1px solid var(--line); }
.cal .day { min-height: 74px; padding: 6px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); cursor: pointer; display: flex; flex-direction: column; gap: 4px; }
.cal .day:nth-child(7n) { border-right: 0; }
.cal .day:hover { background: #ffffff0a; }
.cal .day.out { opacity: .38; }
.cal .day .num { font-size: 13px; font-weight: 600; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal .day.today .num { background: var(--accent); }
.cal .day.sel { outline: 2px solid var(--accent2); outline-offset: -2px; background: #6d5cff1f; }
.chip { font-size: 11px; padding: 2px 7px; border-radius: 7px; background: #6d5cff40; color: #cfc9ff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dots { display: flex; gap: 3px; flex-wrap: wrap; }
.dot { width: 7px; height: 7px; border-radius: 50%; }
.agenda h3 { font-size: 17px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: #6d5cff40; color: #d6d1ff; font-weight: 600; }
.slot { display: flex; gap: 12px; padding: 12px; border-radius: 12px; background: #ffffff08; border: 1px solid var(--line); margin-bottom: 10px; border-left: 4px solid var(--c, var(--accent)); cursor: pointer; }
.slot:hover { background: #ffffff10; }
.slot .t { font-size: 12px; color: var(--muted); }
.slot .nm { font-weight: 600; }
.slot .sv { font-size: 13px; color: var(--muted); }
.slot .rt { margin-left: auto; text-align: right; display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.empty { padding: 28px 10px; text-align: center; color: var(--muted); }

/* status */
.st { font-size: 12px; font-weight: 600; padding: 3px 10px; border-radius: 99px; text-transform: capitalize; display: inline-block; }
.st.confirmed { background: #34d39922; color: var(--green); }
.st.pending { background: #fbbf2422; color: var(--amber); }
.st.completed { background: #60a5fa22; color: var(--blue); }
.st.cancelled { background: #f8717122; color: var(--red); }
.st.sent { background: #34d39922; color: var(--green); }
.st.failed { background: #f8717122; color: var(--red); }
.st.not-configured, .st.preview-only { background: #fbbf2422; color: var(--amber); }

/* tables */
.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 12px 10px; border-bottom: 1px solid #ffffff0d; vertical-align: middle; }
.tbl tr.click { cursor: pointer; }
.tbl tr.click:hover td { background: #ffffff08; }
.who-cell { display: flex; align-items: center; gap: 10px; }
.av-sm { width: 32px; height: 32px; border-radius: 50%; background: #6d5cff55; display: grid; place-items: center; font-size: 12px; font-weight: 700; flex: none; }
.tbl-wrap { overflow-x: auto; }
.toolbar { display: flex; gap: 10px; margin-bottom: 14px; flex-wrap: wrap; align-items: center; }

/* forms / modal */
.overlay { position: fixed; inset: 0; background: #05040f99; backdrop-filter: blur(4px); display: grid; place-items: center; padding: 16px; z-index: 50; overflow-y: auto; }
.modal { background: var(--card); border: 1px solid var(--line); border-radius: 20px; width: 100%; max-width: 560px; padding: 24px; box-shadow: 0 30px 80px #000a; max-height: calc(100vh - 32px); overflow-y: auto; }
.modal h2 { font-size: 21px; margin-bottom: 16px; }
.form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form .full { grid-column: 1 / -1; }
label.f { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
input, select, textarea { background: #0d0b1f; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; width: 100%; color-scheme: dark; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent); border-color: transparent; }
textarea { resize: vertical; min-height: 90px; }
.modal .foot { display: flex; justify-content: flex-end; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.err { color: var(--red); font-size: 14px; margin-top: 10px; }
.notice { background: #fbbf2418; border: 1px solid #fbbf2455; color: #fde7a6; padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 12px; }
.chk { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px; cursor: pointer; }
.chk input { width: 18px; height: 18px; accent-color: var(--accent); }
.toast { background: #1f1b3f; border: 1px solid var(--line); padding: 12px 16px; border-radius: 12px; box-shadow: 0 10px 30px #0008; margin-top: 8px; }
.toast.bad { border-color: #f8717188; }
#toast-root { position: fixed; right: 18px; bottom: 18px; z-index: 80; }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login .box { width: 100%; max-width: 380px; text-align: center; }
.login .logo { margin: 0 auto 14px; width: 54px; height: 54px; border-radius: 16px; }
.login form { display: flex; flex-direction: column; gap: 12px; margin-top: 20px; text-align: left; }

/* responsive */
@media (max-width: 1100px) { .cols { grid-template-columns: 1fr; } .cal-wrap { grid-template-columns: 1fr; } .grid4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: static; height: auto; flex-direction: row; align-items: center; overflow-x: auto; padding: 10px; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { padding: 0 8px 0 4px; }
  .brand small, .side .grow, .side .out-btn { display: none; }
  .nav { flex-direction: row; }
  .nav button { white-space: nowrap; padding: 9px 12px; }
  .main { padding: 18px 16px 40px; }
  .form { grid-template-columns: 1fr; }
  .cal .day { min-height: 56px; padding: 4px; }
  .chip { display: none; }
}
@media (max-width: 480px) { .grid4 { grid-template-columns: 1fr; } }
