:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #101012;
  color: #f5f3f1;
}

* { box-sizing: border-box; }
body { margin: 0; background: #101012; }
a { color: #f4aaa5; }

.app-shell {
  min-height: 100vh;
  margin-right: 264px;
}
.sidebar {
  position: fixed;
  z-index: 10;
  top: 0;
  right: 0;
  width: 264px;
  min-height: 100vh;
  padding: 26px 18px 18px;
  border: 1px solid #403b40;
  border-right: 0;
  border-radius: 18px 0 0 18px;
  background: linear-gradient(160deg, #211e23 0%, #171619 48%, #141316 100%);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .22);
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand { color: #fff; text-decoration: none; font-weight: 750; font-size: 1.15rem; letter-spacing: -.02em; padding: 0 6px; }
.brand span { color: #aaa4a2; font-weight: 400; }
.sidebar-caption { margin: -12px 6px 0; color: #9f989b; font-size: .82rem; line-height: 1.45; }
.side-nav { display: grid; gap: 8px; }
.logout-form { margin-top: auto; padding: 6px; }
.logout-button { width: 100%; border: 1px solid #514b50; border-radius: 8px; padding: 10px 12px; color: #cfc7c8; background: transparent; font: inherit; cursor: pointer; }
.logout-button:hover { color: #fff; background: #2b272d; }
.nav-link { display: flex; align-items: center; gap: 10px; color: #d8d1d0; text-decoration: none; padding: 12px; border: 1px solid transparent; border-radius: 10px; transition: .15s ease; }
.nav-icon { width: 20px; color: #e9a29c; text-align: center; font-size: 1rem; }
.nav-link:hover { background: #2b272d; border-color: #423b42; }
.nav-link.active { background: linear-gradient(120deg, #4b3338, #3b2c34); border-color: #70474d; color: #fff4f2; font-weight: 700; }
.nav-link.active .nav-icon { color: #ffd0cb; }
.container { width: min(1080px, 100%); margin: 0 auto; padding: 48px 32px 72px; }
h1 { margin: 0 0 8px; font-size: 2rem; }
h2 { margin: 16px 0 8px; font-size: 1.25rem; }
p { color: #c9c3c2; line-height: 1.5; }
.sort-hint { color: #aaa3a5; font-size: .9rem; }
.page-heading, .form-heading { display: flex; justify-content: space-between; gap: 24px; align-items: flex-start; margin-bottom: 32px; }
.admin-home { max-width: 920px; }
.admin-sections { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.admin-section-card { min-height: 230px; display: flex; flex-direction: column; padding: 24px; border: 1px solid #403a40; border-radius: 14px; background: linear-gradient(145deg, #211e23, #18171b); color: #f5f3f1; text-decoration: none; transition: transform .15s ease, border-color .15s ease, background .15s ease; }
.admin-section-card:hover { transform: translateY(-3px); border-color: #a35e60; background: linear-gradient(145deg, #2a2227, #1c191e); }
.admin-section-card h2 { margin: 16px 0 6px; }
.admin-section-card p { margin: 0; }
.admin-section-icon { width: 38px; height: 38px; display: grid; place-items: center; border: 1px solid #70474d; border-radius: 10px; color: #ffd0cb; background: #4b3338; font-size: 1.2rem; }
.admin-section-link { margin-top: auto; padding-top: 24px; color: #f4aaa5; font-weight: 700; }
.button {
  display: inline-block; border: 1px solid #555052; border-radius: 8px; padding: 10px 14px;
  color: #fff; text-decoration: none; background: #252328; font: inherit; cursor: pointer;
}
.button:hover { background: #373238; }
.button.primary { background: #df7069; border-color: #df7069; color: #201012; font-weight: 700; }
.button.primary:hover { background: #f4857e; }
.promotion-tabs { display: flex; gap: 8px; margin: -10px 0 26px; border-bottom: 1px solid #39363a; }
.promotion-tab { display: inline-block; padding: 9px 4px 11px; color: #aaa3a5; text-decoration: none; border-bottom: 2px solid transparent; }
.promotion-tab:hover { color: #f0e8e7; }
.promotion-tab.active { color: #ffd0cd; border-bottom-color: #df7069; font-weight: 700; }
.button.danger { border-color: #78474a; color: #ffc5c6; }
.button.danger:hover { background: #4a292d; }
.promotions { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; }
.promotion-card, .promotion-form, .empty { border: 1px solid #39363a; border-radius: 12px; padding: 22px; background: #1a191d; }
.draggable-card { transition: opacity .15s ease, transform .15s ease, border-color .15s ease; }
.card-status { display: flex; align-items: center; gap: 8px; }
.drag-handle { width: 28px; height: 28px; padding: 0; border: 0; border-radius: 6px; background: transparent; color: #aaa3a5; cursor: grab; font-size: 1.3rem; line-height: 1; touch-action: none; }
.drag-handle:hover { background: #312d32; color: #fff; }
.drag-handle:active { cursor: grabbing; }
.draggable-card.dragging { opacity: .28; transform: scale(.98); pointer-events: none; }
.archived-card { opacity: .8; }
.card-topline { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.status { text-transform: uppercase; letter-spacing: .07em; font-size: .72rem; padding: 4px 7px; border-radius: 999px; background: #3a383c; }
.status.published { background: #24533d; color: #a4ebbd; }
.status.draft { background: #5b4c24; color: #ffe5a0; }
.status.archived { background: #4a4144; color: #d5ccd0; }
.muted, small { color: #aaa3a5; font-size: .88rem; }
.link { overflow-wrap: anywhere; }
.card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.card-actions form { margin: 0; }
.history-list { max-width: 760px; display: grid; gap: 12px; }
.history-entry { border-left: 3px solid #df7069; padding: 14px 16px; background: #1a191d; border-radius: 0 8px 8px 0; }
.history-entry p { margin: 8px 0 0; }
code { color: #ffd0cd; }

.bot-builder { width: 100%; max-width: 1180px; margin: 0 auto; }
.builder-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 24px; margin-bottom: 28px; }
.builder-heading h1 { margin-top: 4px; }
.builder-heading p { max-width: 700px; margin-bottom: 0; }
.eyebrow { color: #e9a29c; text-transform: uppercase; letter-spacing: .1em; font-size: .72rem; font-weight: 700; }
.prototype-badge, .mock-status { border: 1px solid #695543; background: #3d3325; color: #ffdda4; padding: 6px 9px; border-radius: 999px; white-space: nowrap; font-size: .78rem; }
.phone-wrap { width: 100%; min-height: 670px; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 8px; background: transparent; }
.phone-device { width: min(100%, 390px); flex: 0 0 auto; overflow: hidden; border: 8px solid #242226; border-radius: 30px; background: #20242b; box-shadow: 0 20px 48px rgba(0,0,0,.35); }
.phone-speaker { width: 95px; height: 18px; margin: 8px auto -2px; border-radius: 0 0 14px 14px; background: #242226; }
.telegram-bar { min-height: 62px; display: flex; align-items: center; gap: 12px; padding: 10px 14px; color: #fff; background: #313b47; }
.telegram-bar strong, .telegram-bar span { display: block; }
.telegram-bar span { color: #bfcbd5; font-size: .76rem; }
.telegram-more { margin-left: auto; font-size: 1.4rem !important; }
.preview-back { width: 28px; border: 0; background: transparent; color: #fff; font-size: 2rem; line-height: 1; cursor: pointer; }
.preview-back:disabled { opacity: .35; cursor: default; }
.phone-chat { min-height: 430px; padding: 18px 12px; background: #202831; }
.bot-bubble { width: fit-content; max-width: 94%; padding: 11px 12px 5px; border-radius: 12px 12px 12px 2px; background: #303b47; color: #f2f4f6; font-size: .91rem; line-height: 1.38; box-shadow: 0 1px 2px rgba(0,0,0,.28); }
.bot-bubble a { color: #67c1f0; text-decoration: none; }
.bot-bubble a:hover { text-decoration: underline; }
.message-time { display: block; margin-top: 5px; color: #afbbc5; text-align: right; font-size: .67rem; }
.preview-keyboard { display: grid; gap: 4px; padding: 7px; background: #272e37; }
.preview-keyboard.two-columns { grid-template-columns: 1fr 1fr; }
.telegram-button { border: 0; border-radius: 6px; min-height: 36px; padding: 7px 10px; background: #36424e; color: #76c6f0; font: inherit; font-size: .86rem; cursor: pointer; box-shadow: 0 1px 1px rgba(0,0,0,.18); }
.telegram-button:hover, .telegram-button.selected { background: #435463; }
.preview-path { width: min(100%, 390px); min-height: 36px; margin: 14px 0 0; color: #aaa3a5; text-align: center; font-size: .82rem; overflow-wrap: anywhere; }
.edit-screen { justify-self: center; margin-top: 14px; }
.edit-screen.promotion-manager-link { border-color: #c77772; color: #ffd0cd; }
.editor-modal { position: fixed; z-index: 30; inset: 0; display: grid; justify-items: end; }
.editor-modal[hidden] { display: none; }
.editor-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.58); }
.editor-sheet { position: relative; width: min(600px, 100%); height: 100%; overflow-y: auto; padding: 32px; border-left: 1px solid #4a4348; background: #1a181c; box-shadow: -18px 0 50px rgba(0,0,0,.35); }
.sheet-heading { display: flex; justify-content: space-between; align-items: start; gap: 18px; margin-bottom: 26px; }
.sheet-heading h2 { margin: 6px 0 0; font-size: 1.45rem; }
.close-editor { width: 36px; height: 36px; border: 1px solid #514b50; border-radius: 8px; background: #29262b; color: #fff; font-size: 1.5rem; cursor: pointer; }
.editor-button-list { display: grid; gap: 12px; margin: 14px 0 22px; }
.text-link-list { display: grid; gap: 10px; margin: 14px 0 22px; }
.text-link-card { display: grid; grid-template-columns: 1fr 1.4fr; gap: 10px; padding: 12px; border: 1px solid #403a40; border-radius: 10px; background: #221f24; }
.text-link-card .mock-field { margin: 0; font-size: .82rem; }
.editor-button-card { margin: 0; border: 1px solid #403a40; border-radius: 10px; overflow: hidden; background: #221f24; }
.editor-button-summary { display: grid; grid-template-columns: 38px minmax(0, 1fr); align-items: stretch; }
.editor-button-toggle { display: grid; grid-template-columns: minmax(0, 1fr) auto 18px; align-items: center; gap: 10px; border: 0; padding: 13px 14px 13px 0; color: #f0e9e8; background: transparent; text-align: left; font: inherit; cursor: pointer; }
.editor-button-toggle small { color: #a9a1a4; white-space: nowrap; }
.toggle-chevron { color: #bfb6b8; font-size: 1.1rem; transition: transform .15s ease; }
.editor-button-card.expanded .toggle-chevron { transform: rotate(180deg); }
.editor-button-details { padding: 16px; border-top: 1px solid #403a40; background: #1d1b1f; }
.editor-button-card .mock-field:last-child { margin-bottom: 0; }
.editor-button-card.dragging { opacity: .3; pointer-events: none; }
.editor-drag-handle { margin: 6px 3px 6px 6px; border: 0; border-radius: 5px; padding: 1px 5px; color: #bdb4b5; background: transparent; font-size: 1.15rem; cursor: grab; touch-action: none; }
.editor-drag-handle:hover { color: #fff; background: #363137; }
.editor-drag-handle:active { cursor: grabbing; }
.sheet-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
.editor-save-error { margin: 20px 0 0; padding: 10px 12px; border: 1px solid #8e4d52; border-radius: 8px; color: #ffc9c8; background: #3e2529; }
.editor-save-notice { margin: 20px 0 0; padding: 10px 12px; border: 1px solid #416b52; border-radius: 8px; color: #b9efc8; background: #1e3829; }
.button:disabled { cursor: wait; opacity: .65; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(100%, 420px); padding: 32px; border: 1px solid #403a40; border-radius: 14px; background: #1a181c; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-card h1 { margin-top: 8px; }
.login-form { display: grid; gap: 18px; margin-top: 26px; }
.login-form .button { width: 100%; text-align: center; }
.login-error { padding: 10px 12px; border: 1px solid #8e4d52; border-radius: 8px; color: #ffc9c8; background: #3e2529; }
.back { display: inline-block; margin-bottom: 18px; text-decoration: none; }
.promotion-form { max-width: 760px; display: grid; gap: 20px; }
label { display: grid; gap: 8px; color: #ece7e6; font-weight: 600; }
input, textarea, select {
  width: 100%; border: 1px solid #514d50; border-radius: 7px; padding: 11px 12px;
  background: #111014; color: #fff; font: inherit;
}
textarea { resize: vertical; }
.two-columns, .three-columns { display: grid; gap: 16px; }
.two-columns { grid-template-columns: 1fr 1fr; }
.three-columns { grid-template-columns: 1fr 1fr 1fr; }
.short-field { max-width: 190px; }
.form-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 4px; }

@media (max-width: 720px) {
  .app-shell { margin: 0; display: flex; flex-direction: column; padding: 12px; gap: 12px; }
  .sidebar { order: -1; position: static; width: auto; min-height: auto; padding: 16px; flex-direction: row; align-items: center; flex-wrap: wrap; gap: 12px; border-radius: 14px; border-right: 1px solid #403b40; }
  .sidebar-caption { display: none; }
  .side-nav { display: flex; gap: 4px; }
  .container { padding: 32px 16px; }
  .page-heading { flex-direction: column; }
  .admin-sections { grid-template-columns: 1fr; }
  .two-columns, .three-columns { grid-template-columns: 1fr; }
  .builder-heading { display: grid; grid-template-columns: 1fr; }
  .builder-heading { gap: 12px; }
  .editor-sheet { width: 100%; padding: 22px 16px; }
}
