:root {
  --ink: #101225;
  --ink-soft: #5b6178;
  --muted: #9aa0b5;
  --line: #e6e9f2;
  --bg: #f5f7fb;
  --card: #ffffff;
  --brand: #3662ff;
  --brand-hover: #2a4fd6;
  --brand-light: #eef2ff;
  --danger: #e11d48;
  --success: #059669;
  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 8px 24px rgba(16, 18, 37, 0.06);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Manrope", ui-sans-serif, system-ui, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; font-weight: 600; }
a:hover { color: var(--brand-hover); }

.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}
.aside {
  width: 240px;
  flex: 0 0 240px;
  background: #fff;
  border-right: 1px solid var(--line);
  padding: 18px 14px 40px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}
.aside-brand img { height: 30px; width: auto; display: block; margin: 4px 8px 18px; }
.aside-nav { display: flex; flex-direction: column; gap: 2px; }
.aside-group {
  margin: 14px 8px 6px;
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}
.aside-link {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  border-radius: 10px;
  padding: 10px 12px;
  font: inherit;
  font-size: 0.9rem;
  font-weight: 650;
  color: var(--ink-soft);
  cursor: pointer;
  text-decoration: none;
}
.aside-link:hover { background: var(--brand-light); color: var(--brand); }
.aside-link.is-active { background: var(--brand); color: #fff !important; }
.wrap {
  flex: 1;
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 20px 72px;
}
.top-mobile { display: none; }
.docs-list { list-style: none; padding: 0; margin: 0; }
.docs-list li { border-bottom: 1px solid var(--line); }
.docs-list li:last-child { border-bottom: 0; }
.docs-list a {
  display: block;
  padding: 12px 2px;
  color: var(--ink);
  font-weight: 650;
}
.docs-list a:hover { color: var(--brand); }
.cms-doc img { max-width: 100%; height: auto; border-radius: 10px; }
.cms-doc figure { margin: 16px 0; text-align: center; }

.editor-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}
@media (min-width: 1100px) {
  .editor-layout:has(#preview-pane:not([hidden])) {
    grid-template-columns: 1.2fr 0.8fr;
  }
}
.editor-preview iframe {
  width: 100%;
  height: 720px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}
.presets-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 8px;
}
.preset-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
}
.preset-card:hover { border-color: var(--brand); }
.preset-swatches { display: flex; gap: 4px; }
.preset-swatches i {
  width: 16px; height: 16px; border-radius: 50%;
  border: 1px solid var(--line); display: inline-block;
}
.item-card {
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  background: var(--bg);
}

/* Header */
.top {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 -20px 28px;
  padding: 14px 20px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid rgba(230, 233, 242, 0.9);
  backdrop-filter: blur(12px);
}
.brand img { height: 32px; width: auto; display: block; }
.top-nav { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.top-link {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 650;
  color: var(--ink-soft);
  background: transparent;
  border: 0;
  cursor: pointer;
}
.top-link:hover { color: var(--brand); background: var(--brand-light); }
.top-link-primary {
  background: var(--brand);
  color: #fff !important;
}
.top-link-primary:hover { background: var(--brand-hover); color: #fff !important; }

/* Type */
h1, .display {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: 1.55rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0 0 8px;
  color: var(--ink);
}
h2 {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin: 0 0 12px;
}
.page-lead { color: var(--ink-soft); font-size: 0.975rem; margin: 0 0 22px; }
.muted { color: var(--muted); font-size: 0.9rem; }

/* Cards */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow);
}
.card-quiet { box-shadow: none; }

label {
  display: block;
  font-size: 0.82rem;
  margin: 12px 0 6px;
  color: var(--ink-soft);
  font-weight: 700;
}
input, select, textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  font: inherit;
  background: #fff;
  color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(54, 98, 255, 0.14);
}

button, .btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 0;
  border-radius: 12px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 700;
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--brand);
  color: #fff;
  transition: background 0.15s ease, transform 0.15s ease;
}
button:hover, .btn:hover { background: var(--brand-hover); }
.btn-secondary, button.btn-secondary {
  background: #fff;
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-secondary:hover, button.btn-secondary:hover {
  background: var(--bg);
  border-color: #d5dae8;
  color: var(--ink);
}
.btn-ghost {
  background: transparent;
  color: var(--ink-soft);
  border: 1px solid transparent;
}
.btn-ghost:hover { background: var(--brand-light); color: var(--brand); }
.btn-danger, button.btn-danger {
  background: #fff;
  color: var(--danger);
  border: 1px solid #fecdd3;
}
.btn-danger:hover, button.btn-danger:hover {
  background: #fff1f2;
  color: var(--danger);
}
.btn-block { width: 100%; }

.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.err { color: var(--danger); font-size: 0.9rem; margin-top: 10px; min-height: 1.2em; }
.ok { color: var(--success); font-size: 0.9rem; margin-top: 10px; }

/* Multi tabs */
.tabs {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
  margin: 0 0 22px;
  padding: 4px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
}
.tab {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 0.875rem;
  font-weight: 700;
  color: var(--ink-soft);
}
.tab:hover { color: var(--brand); background: var(--brand-light); }
.tab.is-active {
  color: #fff;
  background: var(--brand);
}
.tab.is-active:hover { color: #fff; background: var(--brand-hover); }

/* Dashboard list */
.list-item {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}
.list-item:last-child { border-bottom: 0; }
.multi-card {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.multi-card h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 800;
}
.multi-url {
  margin-top: 6px;
  font-size: 0.85rem;
  color: var(--ink-soft);
  word-break: break-all;
}
.multi-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.block {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
  margin-bottom: 10px;
  background: #fff;
}
.block-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  margin-bottom: 8px;
}
.chip {
  font-size: 0.72rem;
  font-weight: 800;
  background: var(--brand-light);
  color: var(--brand);
  padding: 3px 9px;
  border-radius: 999px;
}
pre.json {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  background: var(--bg);
  padding: 10px;
  border-radius: 8px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}
.kpi {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
}
.kpi-n {
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--brand);
}
.kpi-l { margin-top: 4px; font-size: 0.8rem; color: var(--ink-soft); font-weight: 650; }

.create-box {
  display: grid;
  gap: 12px;
}
@media (min-width: 720px) {
  .create-box {
    grid-template-columns: 1.1fr 1fr auto;
    align-items: end;
  }
  .create-box label { margin-top: 0; }
}

.empty {
  text-align: center;
  padding: 36px 16px;
  color: var(--ink-soft);
}

/* Auth */
.auth-page {
  min-height: 100vh;
  display: flex;
  flex-wrap: wrap;
  background: #fff;
}
.auth-aside {
  flex: 1 1 340px;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 28px;
  text-align: center;
  background:
    radial-gradient(700px 320px at 20% 0%, rgba(54, 98, 255, 0.18), transparent 55%),
    radial-gradient(500px 280px at 90% 80%, rgba(54, 98, 255, 0.10), transparent 50%),
    linear-gradient(180deg, #ffffff 0%, #f5f7fb 100%);
}
.auth-aside img.logo { height: 44px; width: auto; }
.auth-aside .tagline {
  max-width: 340px;
  margin-top: 28px;
  font-family: "Unbounded", "Manrope", sans-serif;
  font-size: 1.35rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1.35;
  color: var(--ink);
}
.auth-aside .aside-note {
  max-width: 320px;
  margin-top: 14px;
  font-size: 0.95rem;
  color: var(--ink-soft);
  line-height: 1.5;
}
.auth-main {
  flex: 1 1 400px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.auth-box { width: 100%; max-width: 420px; }
.auth-box h1 {
  font-size: 1.65rem;
  margin-bottom: 6px;
}
.auth-links { margin: 0 0 18px; font-size: 0.95rem; color: var(--muted); }
.auth-box button[type="submit"] { width: 100%; margin-top: 8px; padding: 13px 18px; }
.auth-foot {
  width: 100%;
  padding: 16px;
  text-align: center;
  font-size: 0.85rem;
  color: var(--muted);
  background: #fff;
  border-top: 1px solid var(--line);
}
.auth-foot a { margin: 0 8px; color: var(--muted); font-weight: 600; }
.auth-foot a:hover { color: var(--brand); }

@media (max-width: 900px) {
  .aside {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 40;
    transform: translateX(-105%);
    transition: transform 0.2s ease;
    box-shadow: var(--shadow);
  }
  body.aside-open .aside { transform: translateX(0); }
  .top-mobile {
    display: flex;
    margin: 0 0 18px;
    padding: 0;
    background: transparent;
    border: 0;
    backdrop-filter: none;
    position: static;
  }
  .wrap { padding-top: 12px; }
}
@media (max-width: 720px) {
  .multi-card { flex-direction: column; }
}

/* —— Constructor (Taplink-style phone preview) —— */
.wrap-constructor {
  max-width: 1280px;
  padding-bottom: 40px;
}
.ctor-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 18px;
}
.ctor-title {
  font-size: 1.35rem;
  margin-bottom: 4px;
}
.ctor-top-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.ctor {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 28px;
  align-items: start;
}
.ctor-panel { min-width: 0; }
.ctor-toolbar {
  margin-bottom: 14px;
}
.ctor-toolbar h2 {
  margin-bottom: 12px;
  font-size: 0.95rem;
}
.block-palette {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.palette-cat-title {
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}
.palette-cat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 8px;
}
.palette-ico {
  font-size: 1.25rem;
  color: var(--brand);
  line-height: 1;
}
.palette-ico .fa, .palette-ico .fas, .palette-ico .far {
  font-size: 1.2rem;
}
.ctor-block-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--brand-light);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  flex: 0 0 auto;
}
.ctor-block.is-hidden {
  opacity: 0.72;
  border-style: dashed;
}
.chip-muted {
  background: #f1f3f9;
  color: var(--ink-soft);
  font-weight: 700;
}
.block-tabs {
  display: flex;
  gap: 4px;
  margin: 8px 0 14px;
  padding: 4px;
  background: var(--bg);
  border-radius: 12px;
}
.block-tab {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 8px 10px;
  border-radius: 10px;
  cursor: pointer;
}
.block-tab.is-active {
  background: #fff;
  color: var(--brand);
  box-shadow: 0 1px 4px rgba(16, 18, 37, 0.08);
}
.tab-pane-note {
  padding: 14px;
  background: var(--bg);
  border-radius: 12px;
  font-size: 0.9rem;
  line-height: 1.45;
}
.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 12px;
}
.settings-sep {
  grid-column: 1 / -1;
  margin: 12px 0 4px;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}
.settings-grid .grid-full { grid-column: 1 / -1; }
.html-code-editor {
  width: 100%;
  min-height: 220px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 13px;
  line-height: 1.45;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0f172a;
  color: #e2e8f0;
  resize: vertical;
}
.form-field-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  display: grid;
  gap: 8px;
}
.form-fields-editor { margin: 10px 0; }
.booking-master-row,
.booking-service-row {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 10px;
  display: grid;
  gap: 8px;
}
.booking-services { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.booking-masters { margin-bottom: 10px; }
.list-layout-bar { margin-bottom: 12px; }
.settings-actions {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.settings-hint {
  margin: -2px 0 8px;
  font-size: 0.8rem;
  text-align: center;
}
.check-row {
  display: flex !important;
  align-items: center;
  gap: 10px;
  grid-column: 1 / -1;
  font-weight: 650;
  color: var(--ink);
}
.check-row input { width: auto; margin: 0; }
.icon-picks {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}
.icon-pick {
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
}
.icon-pick:hover, .icon-pick.is-active {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand);
}
@media (max-width: 640px) {
  .settings-grid { grid-template-columns: 1fr; }
}
.palette-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 12px 8px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 650;
  font-size: 0.72rem;
  line-height: 1.2;
  text-align: center;
  transition: border-color 0.15s, background 0.15s, transform 0.12s;
}
.palette-btn:hover {
  border-color: var(--brand);
  background: var(--brand-light);
  color: var(--brand);
  transform: translateY(-1px);
}
.palette-ico {
  font-size: 1.25rem;
  font-weight: 400;
  letter-spacing: 0;
  color: var(--brand);
  line-height: 1;
  font-family: inherit;
}
.palette-name { color: inherit; }

.ctor-blocks { display: flex; flex-direction: column; gap: 10px; }
.ctor-empty { background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }

.ctor-block {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.ctor-block.is-open {
  border-color: #c5d0ff;
  box-shadow: 0 10px 28px rgba(54, 98, 255, 0.1);
}
.ctor-block-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  border: 0;
  background: transparent;
  cursor: pointer;
  text-align: left;
  color: var(--ink);
  font: inherit;
  border-radius: 0;
}
.ctor-block-bar:hover { background: var(--bg); }
.ctor-block-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.ctor-block-ico {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--brand-light);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  flex: 0 0 auto;
  font-family: "Unbounded", "Manrope", sans-serif;
}
.ctor-block-sum {
  display: block;
  margin-top: 2px;
  font-size: 0.8rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 420px;
}
.ctor-block-chev {
  color: var(--muted);
  font-size: 0.85rem;
  flex: 0 0 auto;
}
.ctor-block-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
}
.ctor-block-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 12px 0 4px;
}
.ctor-block-foot {
  margin-top: 10px;
  justify-content: flex-end;
}
.btn-sm {
  padding: 7px 12px;
  font-size: 0.8rem;
  border-radius: 10px;
}
.docs-mini { margin-left: auto; font-size: 0.8rem; }
.item-label { margin-bottom: 6px; }
.upload-row { margin: 8px 0; }

.ctor-preview-col {
  position: sticky;
  top: 72px;
}
.phone-shell {
  position: relative;
  width: 100%;
  max-width: 300px;
  margin: 0 auto;
  background: #11131a;
  border-radius: 36px;
  padding: 14px 12px 18px;
  box-shadow:
    0 0 0 2px #2a2e3a,
    0 22px 50px rgba(16, 18, 37, 0.28);
}
.phone-notch {
  width: 96px;
  height: 10px;
  margin: 0 auto 10px;
  background: #1c1f2a;
  border-radius: 999px;
}
.phone-shell iframe {
  display: block;
  width: 100%;
  height: 580px;
  border: 0;
  border-radius: 24px;
  background: #fff;
}
.phone-hint {
  text-align: center;
  margin: 12px 8px 0;
  font-size: 0.8rem;
  line-height: 1.4;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(16, 18, 37, 0.35);
  z-index: 60;
}
.drawer {
  position: fixed;
  top: 0;
  right: 0;
  z-index: 70;
  width: min(420px, 100%);
  height: 100vh;
  background: #fff;
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 40px rgba(16, 18, 37, 0.12);
  padding: 20px;
  overflow: auto;
}
.drawer-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.drawer-head h2 { margin: 0; }
.drawer-form { display: grid; gap: 4px; margin-top: 16px; }
body.drawer-open { overflow: hidden; }

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translateX(-50%);
  z-index: 90;
  background: var(--ink);
  color: #fff;
  padding: 12px 18px;
  border-radius: 12px;
  font-weight: 650;
  font-size: 0.9rem;
  box-shadow: var(--shadow);
  max-width: min(90vw, 420px);
}
.toast-err { background: var(--danger); }

@media (max-width: 1080px) {
  .ctor {
    grid-template-columns: 1fr;
  }
  .ctor-preview-col {
    position: static;
    order: -1;
  }
  .phone-shell {
    max-width: 280px;
  }
  .phone-shell iframe {
    height: 480px;
  }
}
@media (max-width: 900px) {
  .ctor-preview-col { top: 12px; }
}
