/* ============================================================
   Алевтина — Админ-панель · стиль (пудровый, тёплый)
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Playfair+Display:wght@500;600&display=swap');

:root {
  --milk: #FBF6F2;
  --milk-2: #F6EEE8;
  --panel: #FFFFFF;
  --powder-soft: #F8E8E5;
  --rose: #C58A84;
  --rose-deep: #B0716B;
  --rose-tint: #E7C7C2;
  --ink: #463C38;
  --ink-soft: #6C615B;
  --ink-faint: #9B8E87;
  --line: rgba(112, 86, 80, 0.13);
  --line-2: rgba(112, 86, 80, 0.08);
  --ok: #5B9B79;
  --ok-bg: #E7F2EC;
  --warn: #C9963F;
  --warn-bg: #F7EEDD;
  --new: #B0716B;
  --new-bg: #F6E4E1;
  --sh-sm: 0 2px 10px rgba(120, 86, 80, 0.05);
  --sh-md: 0 12px 30px rgba(120, 86, 80, 0.10);
  --sh-lg: 0 26px 60px rgba(120, 86, 80, 0.16);
  --r: 16px;
  --r-lg: 22px;
  --ease: cubic-bezier(0.22, 0.61, 0.36, 1);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Manrope", system-ui, sans-serif;
  background: var(--milk-2);
  color: var(--ink);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { margin: 0; font-weight: 700; }
.serif { font-family: "Playfair Display", Georgia, serif; font-weight: 600; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; }
a { color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--rose-tint); border-radius: 10px; border: 3px solid var(--milk-2); }

/* ---------------- LOGIN ---------------- */
.login {
  position: fixed; inset: 0; z-index: 50;
  display: grid; place-items: center; padding: 24px;
  background:
    radial-gradient(55% 50% at 80% 15%, var(--powder-soft), transparent 60%),
    radial-gradient(50% 55% at 10% 85%, #F3EAE0, transparent 60%),
    var(--milk);
}
.login__card {
  width: min(400px, 100%); background: var(--panel);
  border-radius: 26px; box-shadow: var(--sh-lg); padding: 40px 36px;
  text-align: center; border: 1px solid var(--line);
}
.login__mark {
  width: 58px; height: 58px; border-radius: 50%; margin: 0 auto 20px;
  background: linear-gradient(140deg, var(--rose-tint), var(--rose));
  color: #fff; display: grid; place-items: center;
  font-family: "Playfair Display", serif; font-size: 28px;
}
.login__card h1 { font-size: 23px; }
.login__card .serif { font-weight: 600; }
.login__card p { color: var(--ink-soft); font-size: 14px; margin: 8px 0 26px; }
.login__field { position: relative; margin-bottom: 14px; }
.login__field input {
  width: 100%; padding: 15px 16px; border-radius: 14px; font-size: 15px;
  border: 1px solid var(--line); background: var(--milk); color: var(--ink);
  transition: border-color .25s, box-shadow .25s; text-align: center;
}
.login__field input:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 4px rgba(197,138,132,.14); }
.login__btn {
  width: 100%; padding: 15px; border: none; border-radius: 14px; color: #fff; font-weight: 600; font-size: 15px;
  background: linear-gradient(135deg, var(--rose), var(--rose-deep));
  box-shadow: 0 12px 26px rgba(176,113,107,.32); transition: transform .3s var(--ease);
}
.login__btn:hover { transform: translateY(-2px); }
.login__hint { font-size: 12.5px; color: var(--ink-faint); margin-top: 18px; }
.login__hint code { background: var(--milk-2); padding: 2px 8px; border-radius: 6px; color: var(--rose-deep); font-weight: 600; }
.login__err { color: #c0726f; font-size: 13px; margin-top: 12px; min-height: 18px; }

/* ---------------- APP SHELL ---------------- */
.app { display: grid; grid-template-columns: 256px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar__brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 22px; }
.sidebar__mark { width: 40px; height: 40px; border-radius: 50%; background: linear-gradient(140deg, var(--rose-tint), var(--rose)); color: #fff; display: grid; place-items: center; font-family: "Playfair Display", serif; font-size: 20px; }
.sidebar__brand b { display: block; font-family: "Playfair Display", serif; font-size: 18px; font-weight: 600; }
.sidebar__brand small { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-faint); }
.nav-group { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; }
.nav-label { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-faint); padding: 14px 12px 6px; font-weight: 700; }
.nav-btn {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 12px;
  background: none; border: none; color: var(--ink-soft); font-size: 14.5px; font-weight: 500; text-align: left;
  transition: background .2s, color .2s;
}
.nav-btn svg { width: 19px; height: 19px; }
.nav-btn:hover { background: var(--milk-2); color: var(--ink); }
.nav-btn.active { background: linear-gradient(135deg, var(--rose), var(--rose-deep)); color: #fff; box-shadow: 0 8px 20px rgba(176,113,107,.28); }
.nav-btn .badge { margin-left: auto; background: var(--new-bg); color: var(--new); font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 100px; }
.nav-btn.active .badge { background: rgba(255,255,255,.25); color: #fff; }
.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; padding-top: 16px; }
.sidebar__foot a, .sidebar__foot button {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 11px;
  background: var(--milk-2); border: 1px solid var(--line-2); color: var(--ink-soft); font-size: 13.5px; font-weight: 500;
  text-decoration: none; transition: background .2s;
}
.sidebar__foot a:hover, .sidebar__foot button:hover { background: var(--powder-soft); color: var(--rose-deep); }
.sidebar__foot svg { width: 17px; height: 17px; }

/* ---------------- MAIN ---------------- */
.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; gap: 18px; padding: 20px 30px;
  border-bottom: 1px solid var(--line); background: rgba(251,246,242,.8);
  backdrop-filter: blur(10px); position: sticky; top: 0; z-index: 10;
}
.topbar__burger { display: none; }
.topbar h2 { font-size: 21px; font-family: "Playfair Display", serif; font-weight: 600; }
.topbar__sub { font-size: 13px; color: var(--ink-faint); margin-top: 2px; }
.topbar__spacer { flex: 1; }
.seg { display: inline-flex; background: var(--milk-2); border: 1px solid var(--line); border-radius: 11px; padding: 3px; gap: 2px; }
.seg button { border: none; background: none; padding: 7px 13px; border-radius: 8px; font-size: 13px; font-weight: 600; color: var(--ink-soft); transition: all .2s; }
.seg button.active { background: var(--panel); color: var(--rose-deep); box-shadow: var(--sh-sm); }

.content { padding: 28px 30px 70px; overflow-y: auto; }
.view[hidden] { display: none; }
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details[open] > summary i[data-lucide="chevron-down"] { transform: rotate(180deg); }
details > summary i[data-lucide="chevron-down"] { transition: transform .3s var(--ease); }

/* ---------------- CARDS / GENERIC ---------------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--sh-sm); }
.card__head { display: flex; align-items: center; gap: 14px; padding: 20px 24px; border-bottom: 1px solid var(--line-2); }
.card__head h3 { font-size: 16px; }
.card__head .ic { width: 34px; height: 34px; border-radius: 10px; background: var(--powder-soft); color: var(--rose-deep); display: grid; place-items: center; }
.card__head .ic svg { width: 18px; height: 18px; }
.card__head .spacer { flex: 1; }
.card__body { padding: 22px 24px; }

.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.mt { margin-top: 18px; }

/* KPI */
.kpi { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 22px; box-shadow: var(--sh-sm); position: relative; overflow: hidden; }
.kpi__ic { width: 42px; height: 42px; border-radius: 12px; display: grid; place-items: center; background: var(--powder-soft); color: var(--rose-deep); margin-bottom: 16px; }
.kpi__ic svg { width: 21px; height: 21px; }
.kpi__val { font-family: "Playfair Display", serif; font-size: 34px; font-weight: 600; line-height: 1; }
.kpi__label { font-size: 13.5px; color: var(--ink-soft); margin-top: 8px; }
.kpi__delta { font-size: 12.5px; font-weight: 600; margin-top: 10px; display: inline-flex; align-items: center; gap: 4px; padding: 3px 9px; border-radius: 100px; }
.kpi__delta.up { color: var(--ok); background: var(--ok-bg); }
.kpi__delta.down { color: #c0726f; background: var(--new-bg); }
.kpi__delta svg { width: 13px; height: 13px; }

/* bar chart */
.chart { display: flex; align-items: stretch; gap: 6px; height: 200px; padding-top: 10px; }
.chart__col { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 8px; min-width: 0; }
.chart__barwrap { width: 100%; flex: 1; display: flex; align-items: flex-end; justify-content: center; }
.chart__bar { width: 70%; max-width: 26px; border-radius: 7px 7px 3px 3px; background: linear-gradient(180deg, var(--rose), var(--rose-deep)); transition: height .6s var(--ease); position: relative; min-height: 3px; }
.chart__bar:hover { filter: brightness(1.06); }
.chart__bar .tip { position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%) translateY(-6px); background: var(--ink); color: #fff; font-size: 11px; padding: 4px 8px; border-radius: 6px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .2s; }
.chart__bar:hover .tip { opacity: 1; }
.chart__x { font-size: 10.5px; color: var(--ink-faint); white-space: nowrap; }

/* horizontal bars */
.hbars { display: flex; flex-direction: column; gap: 14px; }
.hbar__top { display: flex; justify-content: space-between; font-size: 13.5px; margin-bottom: 6px; }
.hbar__top b { font-weight: 600; }
.hbar__top span { color: var(--ink-faint); }
.hbar__track { height: 10px; background: var(--milk-2); border-radius: 100px; overflow: hidden; }
.hbar__fill { height: 100%; border-radius: 100px; background: linear-gradient(90deg, var(--rose-tint), var(--rose)); transition: width .7s var(--ease); }

/* donut */
.donut-row { display: flex; align-items: center; gap: 26px; }
.donut { width: 150px; height: 150px; flex: none; }
.legend { display: flex; flex-direction: column; gap: 12px; }
.legend__item { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.legend__dot { width: 12px; height: 12px; border-radius: 4px; flex: none; }
.legend__item b { font-weight: 700; }
.legend__item span { color: var(--ink-faint); margin-left: auto; }

/* funnel */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel__row { display: flex; align-items: center; gap: 14px; }
.funnel__bar { height: 38px; border-radius: 10px; display: flex; align-items: center; padding: 0 14px; color: #fff; font-weight: 600; font-size: 13.5px; min-width: 60px; transition: width .7s var(--ease); }
.funnel__label { width: 130px; font-size: 13.5px; color: var(--ink-soft); flex: none; }

/* ---------------- TABLE ---------------- */
.toolbar { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; margin-bottom: 18px; }
.search { position: relative; flex: 1; min-width: 200px; }
.search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 17px; height: 17px; color: var(--ink-faint); }
.search input { width: 100%; padding: 11px 14px 11px 40px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel); font-size: 14px; }
.search input:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 4px rgba(197,138,132,.12); }
.btn-sm { padding: 10px 15px; border-radius: 11px; border: 1px solid var(--line); background: var(--panel); color: var(--ink); font-size: 13.5px; font-weight: 600; display: inline-flex; align-items: center; gap: 7px; transition: all .2s; }
.btn-sm:hover { border-color: var(--rose); color: var(--rose-deep); }
.btn-sm svg { width: 16px; height: 16px; }
.btn-rose { background: linear-gradient(135deg, var(--rose), var(--rose-deep)); color: #fff; border: none; box-shadow: 0 8px 18px rgba(176,113,107,.26); }
.btn-rose:hover { color: #fff; transform: translateY(-1px); }
.btn-danger:hover { border-color: #d98b8b; color: #c0726f; }

.table-wrap { overflow-x: auto; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--panel); box-shadow: var(--sh-sm); }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
thead th { text-align: left; font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--ink-faint); font-weight: 700; padding: 15px 18px; border-bottom: 1px solid var(--line); white-space: nowrap; }
tbody td { padding: 14px 18px; border-bottom: 1px solid var(--line-2); font-size: 14px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--milk); }
.lead-name { font-weight: 600; }
.lead-sub { font-size: 12.5px; color: var(--ink-faint); }
.pill { font-size: 12px; font-weight: 600; padding: 4px 11px; border-radius: 100px; display: inline-block; }
.pill.src-zapis { background: var(--powder-soft); color: var(--rose-deep); }
.pill.src-beseda { background: #EDF0EC; color: #6E8A6F; }
.status-select { padding: 6px 10px; border-radius: 9px; border: 1px solid var(--line); font-size: 12.5px; font-weight: 600; background: var(--panel); }
.status-new { color: var(--new); background: var(--new-bg); border-color: transparent; }
.status-progress { color: var(--warn); background: var(--warn-bg); border-color: transparent; }
.status-done { color: var(--ok); background: var(--ok-bg); border-color: transparent; }
.icon-btn { width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--panel); display: grid; place-items: center; color: var(--ink-soft); transition: all .2s; }
.icon-btn:hover { border-color: #d98b8b; color: #c0726f; }
.icon-btn svg { width: 16px; height: 16px; }
.empty { text-align: center; padding: 60px 20px; color: var(--ink-faint); }
.empty svg { width: 40px; height: 40px; margin-bottom: 12px; opacity: .5; }
.empty code { background: var(--milk); padding: 2px 6px; border-radius: 6px; font-size: 12px; }

/* ---------------- ЗВОНКИ ---------------- */
.rooms-list { display: flex; flex-direction: column; gap: 12px; }
.room-row {
  display: flex; align-items: center; gap: 18px; flex-wrap: wrap;
  padding: 14px 16px; border: 1px solid var(--line); border-radius: var(--r-lg);
  background: var(--milk);
}
.room-row__main { flex: 1 1 200px; min-width: 0; }
.room-row__title { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 14.5px; }
.room-emoji { font-size: 20px; letter-spacing: .1em; }
.room-row__meta { font-size: 12px; color: var(--ink-faint); margin-top: 3px; }
.room-badge {
  font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 999px;
  background: rgba(70,60,56,.08); color: var(--ink-soft);
}
.room-badge.live { background: rgba(91,157,119,.16); color: #3f7d5a; }
.room-row__pin { text-align: center; }
.room-row__pin span { display: block; font-size: 10.5px; letter-spacing: .08em; color: var(--ink-faint); text-transform: uppercase; }
.room-row__pin b { font-size: 21px; letter-spacing: .12em; font-variant-numeric: tabular-nums; }
.room-row__actions { display: flex; gap: 8px; flex-wrap: wrap; }
@media (max-width: 640px) {
  .room-row { gap: 12px; }
  .room-row__pin { text-align: left; }
  .room-row__actions { width: 100%; }
}

/* ---------------- EDITORS ---------------- */
.editor-section { margin-bottom: 18px; }
.field-row { display: grid; gap: 16px; margin-bottom: 16px; }
.field-row.cols-2 { grid-template-columns: 1fr 1fr; }
.field-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }
.fld { display: flex; flex-direction: column; gap: 6px; }
.fld label { font-size: 12.5px; font-weight: 600; color: var(--ink-soft); }
.fld input, .fld textarea, .fld select {
  width: 100%; padding: 11px 13px; border-radius: 11px; border: 1px solid var(--line);
  background: var(--milk); color: var(--ink); font-size: 14px; transition: border-color .2s, box-shadow .2s;
}
.fld textarea { resize: vertical; min-height: 76px; line-height: 1.5; }
.fld input:focus, .fld textarea:focus, .fld select:focus { outline: none; border-color: var(--rose); box-shadow: 0 0 0 4px rgba(197,138,132,.12); background: var(--panel); }

.item-card { border: 1px solid var(--line); border-radius: 14px; padding: 16px; margin-bottom: 14px; background: var(--milk); position: relative; }
.item-card__head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.item-card__head .grip { color: var(--ink-faint); }
.item-card__head b { font-size: 13px; color: var(--ink-faint); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.item-card__del { margin-left: auto; }
.add-btn { width: 100%; padding: 13px; border-radius: 12px; border: 1.5px dashed var(--rose-tint); background: var(--powder-soft); color: var(--rose-deep); font-weight: 600; font-size: 14px; display: flex; align-items: center; justify-content: center; gap: 8px; transition: all .2s; }
.add-btn:hover { background: var(--rose-tint); }
.add-btn svg { width: 17px; height: 17px; }

/* toggles */
.toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 15px 0; border-bottom: 1px solid var(--line-2); }
.toggle-row:last-child { border-bottom: none; }
.toggle-row b { font-weight: 600; }
.toggle-row p { font-size: 13px; color: var(--ink-faint); margin: 2px 0 0; }
.switch { position: relative; width: 48px; height: 28px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .track { position: absolute; inset: 0; background: var(--line); border-radius: 100px; transition: background .25s; }
.switch .track::before { content: ""; position: absolute; left: 3px; top: 3px; width: 22px; height: 22px; background: #fff; border-radius: 50%; transition: transform .25s; box-shadow: var(--sh-sm); }
.switch input:checked + .track { background: linear-gradient(135deg, var(--rose), var(--rose-deep)); }
.switch input:checked + .track::before { transform: translateX(20px); }

/* color + palette */
.swatch-row { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch { width: 40px; height: 40px; border-radius: 11px; border: 2px solid transparent; cursor: pointer; transition: transform .2s; box-shadow: var(--sh-sm); }
.swatch:hover { transform: scale(1.08); }
.swatch.active { border-color: var(--ink); }
.palette-row { display: flex; flex-direction: column; gap: 10px; }
.palette { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 14px; border: 2px solid var(--line); cursor: pointer; transition: all .2s; }
.palette.active { border-color: var(--rose-deep); background: var(--powder-soft); }
.palette__chips { display: flex; gap: 5px; }
.palette__chips span { width: 26px; height: 26px; border-radius: 7px; }
.palette b { font-size: 14px; }

.photo-drop { border: 1.5px dashed var(--rose-tint); border-radius: 14px; padding: 18px; display: flex; align-items: center; gap: 16px; background: var(--milk); }
.photo-drop__prev { width: 76px; height: 92px; border-radius: 11px; background: var(--powder-soft) center/cover; flex: none; display: grid; place-items: center; color: var(--rose-deep); overflow: hidden; }
.photo-drop__prev svg { width: 26px; height: 26px; }
.photo-drop__body { flex: 1; }
.photo-drop__body p { font-size: 12.5px; color: var(--ink-faint); margin: 4px 0 0; }

/* sticky save bar */
.savebar {
  position: sticky; bottom: 0; margin: 24px -30px -70px; padding: 16px 30px;
  background: rgba(255,255,255,.9); backdrop-filter: blur(12px); border-top: 1px solid var(--line);
  display: flex; align-items: center; gap: 14px; z-index: 5;
}
.savebar span { font-size: 13.5px; color: var(--ink-soft); }
.savebar .spacer { flex: 1; }

/* toast */
.toasts { position: fixed; bottom: 24px; right: 24px; z-index: 100; display: flex; flex-direction: column; gap: 10px; }
.toast { background: var(--ink); color: #fff; padding: 13px 18px; border-radius: 13px; font-size: 14px; font-weight: 500; box-shadow: var(--sh-lg); display: flex; align-items: center; gap: 10px; animation: toastIn .35s var(--ease); }
.toast.ok { background: linear-gradient(135deg, #5B9B79, #4A8A68); }
.toast svg { width: 18px; height: 18px; }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }

/* confirm modal */
.cmodal { position: fixed; inset: 0; z-index: 90; display: none; place-items: center; padding: 20px; }
.cmodal.open { display: grid; }
.cmodal__ov { position: absolute; inset: 0; background: rgba(70,60,56,.4); backdrop-filter: blur(4px); }
.cmodal__box { position: relative; background: var(--panel); border-radius: 20px; box-shadow: var(--sh-lg); padding: 30px; width: min(420px, 100%); }
.cmodal__box h3 { font-size: 19px; margin-bottom: 8px; }
.cmodal__box p { color: var(--ink-soft); font-size: 14px; margin-bottom: 22px; }
.cmodal__actions { display: flex; gap: 10px; justify-content: flex-end; }

/* responsive */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 40; transform: translateX(-100%); transition: transform .3s var(--ease); width: 256px; box-shadow: var(--sh-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(70,60,56,.4); z-index: 35; }
  .topbar__burger { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel); }
  .topbar__burger svg { width: 20px; height: 20px; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .field-row.cols-2, .field-row.cols-3 { grid-template-columns: 1fr; }
  .content { padding: 22px 18px 70px; }
  .topbar { padding: 16px 18px; }
  .savebar { margin: 24px -18px -70px; padding: 14px 18px; }
}
