:root { --ink: #29253a; --muted: #716e7d; --violet: #56339d; --violet-deep: #241b42; --border: #e8e3ef; --surface: #fff; --canvas: #f7f5fa; }
* { box-sizing: border-box; }
body { color: var(--ink); background: var(--canvas); font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif; }
.admin-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); }
.admin-sidebar { background: var(--violet-deep); color: #fff; display: flex; flex-direction: column; padding: 30px 18px 20px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 12px; color: #fff; text-decoration: none; padding: 0 12px 26px; font-size: 18px; line-height: 1.1; font-weight: 700; letter-spacing: -.03em; }
.brand:hover { color: #fff; }
.brand small { display: block; color: #b9acd1; font-size: 11px; font-weight: 500; letter-spacing: .09em; margin-top: 6px; text-transform: uppercase; }
.brand-mark, .login-mark { display: grid; place-items: center; background: #8c63dc; color: #fff; border-radius: 15px; font-size: 27px; flex: none; width: 45px; height: 45px; }
.admin-nav { display: grid; gap: 5px; }
.admin-nav a, .logout-form button { width: 100%; display: block; text-align: left; padding: 11px 15px; color: #cec5dd; border: 0; border-radius: 11px; text-decoration: none; background: transparent; font-weight: 560; }
.admin-nav a:hover, .logout-form button:hover { background: #3b2b61; color: #fff; }
.admin-nav a.active { background: #6944ac; color: #fff; box-shadow: inset 3px 0 #d6c1ff; }
.logout-form { margin-top: auto; }
.admin-main { width: 100%; min-width: 0; max-width: 1600px; padding: 25px clamp(18px, 3vw, 48px) 50px; }
.page-top { display: flex; justify-content: space-between; align-items: center; padding-bottom: 24px; border-bottom: 1px solid var(--border); margin-bottom: 28px; }
.eyebrow { color: #827693; font-size: 11px; font-weight: 750; letter-spacing: .18em; }
.server-pill { border: 1px solid #ded5e8; background: #fff; border-radius: 100px; padding: 6px 11px; color: #645c73; font-size: 12px; font-weight: 650; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 27px; }
.page-heading h1 { font-size: clamp(28px, 3vw, 39px); line-height: 1.13; letter-spacing: -.055em; font-weight: 760; margin: 0 0 7px; }
.page-heading p, .surface-heading p { margin: 0; color: var(--muted); }
.back-link { display: inline-block; color: var(--violet); font-size: 13px; font-weight: 650; text-decoration: none; margin-bottom: 14px; }
.btn-primary { background: var(--violet); border-color: var(--violet); }
.btn-primary:hover, .btn-primary:focus { background: #462688; border-color: #462688; }
.btn-outline-primary { color: var(--violet); border-color: #baa9da; }
.btn-outline-primary:hover { background: var(--violet); border-color: var(--violet); }
.btn-check:checked + .btn-outline-primary, .btn-check:focus-visible + .btn-outline-primary { background: var(--violet); border-color: var(--violet); color: #fff; }
.metric-card, .surface { background: var(--surface); border: 1px solid var(--border); border-radius: 17px; box-shadow: 0 8px 30px rgba(43, 30, 70, .035); }
.metric-card { min-height: 133px; display: flex; flex-direction: column; padding: 20px 23px; }
.metric-card span { color: var(--muted); font-size: 13px; font-weight: 600; }
.metric-card strong { font-size: 32px; letter-spacing: -.05em; line-height: 1.4; }
.metric-card small { color: #9893a3; font-size: 12px; }
.surface { overflow: hidden; }
.surface-heading { display: flex; justify-content: space-between; align-items: center; gap: 18px; padding: 21px 24px; border-bottom: 1px solid var(--border); }
.surface-heading h2, .section-title { font-size: 18px; font-weight: 710; letter-spacing: -.03em; margin: 0; }
.surface-heading p { font-size: 13px; margin-top: 4px; }
.surface .table th { background: #fcfbfd; color: #817c89; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; white-space: nowrap; font-weight: 730; border-color: var(--border); padding: 13px 20px; }
.surface .table td { color: var(--ink); border-color: var(--border); padding: 15px 20px; vertical-align: middle; }
.surface .table td small { color: var(--muted); display: block; font-size: 12px; }
.table-title { color: var(--ink); text-decoration: none; font-weight: 700; }
.table-title:hover { color: var(--violet); }
.empty-cell { text-align: center; padding: 35px !important; color: var(--muted) !important; }
.status-chip { display: inline-block; border-radius: 100px; padding: 6px 10px; background: #f0eef3; color: #726c79; font-size: 12px; font-weight: 700; white-space: nowrap; }
.status-chip.on { background: #e6f5e9; color: #25713d; }
.status-chip.off { background: #f3edf5; color: #74677f; }
.access-toggle { display: flex; align-items: center; gap: 8px; margin: 0; }
.access-toggle .btn { white-space: nowrap; }
.search-field { max-width: 290px; }
.feedback-list { padding: 4px 24px; }
.feedback-item { border-bottom: 1px solid var(--border); padding: 20px 0; }
.feedback-item:last-child { border: 0; }
.feedback-item div { display: flex; justify-content: space-between; gap: 12px; }
.feedback-item div span, .feedback-item small { color: var(--muted); font-size: 12px; }
.feedback-item p { margin: 9px 0 6px; white-space: pre-wrap; }
.form-surface { padding: 24px; }
.form-label { font-size: 13px; font-weight: 680; }
.form-control:focus { border-color: #9b7ad4; box-shadow: 0 0 0 .2rem rgba(102, 68, 169, .13); }
.form-actions, .action-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.form-actions { border-top: 1px solid var(--border); padding-top: 21px; margin-top: 23px; }
.preview-sticky { position: sticky; top: 26px; }
.preview-sticky .section-title { margin: 3px 0 15px; }
.telegram-preview { border: 1px solid #dcd9e2; border-radius: 17px; overflow: hidden; background: #fff; box-shadow: 0 15px 35px rgba(40, 30, 60, .08); max-width: 390px; }
.telegram-preview img { display: block; width: 100%; max-height: 360px; object-fit: cover; }
.telegram-preview img[hidden], .photo-placeholder[hidden] { display: none; }
.photo-placeholder { min-height: 220px; display: grid; place-items: center; color: #a39aaf; background: linear-gradient(135deg, #f4f0f9, #eae4f3); }
.preview-caption { padding: 17px 19px 12px; white-space: pre-wrap; overflow-wrap: anywhere; }
.preview-caption strong { font-size: 14px; }
.preview-caption .preview-ad-body { font-size: 14px; margin: 14px 0; }
.preview-button { display: block; border-top: 1px solid var(--border); text-align: center; padding: 14px; color: #4e64ad; font-weight: 720; text-decoration: none; }
.preview-help { color: var(--muted); font-size: 12px; margin-top: 12px; }
.capacity-note { color: var(--muted); background: #f7f3fc; padding: 12px 14px; border-radius: 9px; font-size: 13px; }
.package-picker { display: flex; gap: 8px; align-items: center; }
.package-picker .form-control { max-width: 160px; }
.shortfall-form { border-top: 1px solid var(--border); margin-top: 23px; padding-top: 20px; }
.detail-grid { display: grid; grid-template-columns: 1fr auto; gap: 14px; padding: 23px 25px; }
.detail-grid span { color: var(--muted); }
.uncertain-item { padding: 18px 24px; border-bottom: 1px solid var(--border); }
.uncertain-item small { display: block; color: var(--muted); }
.login-body { display: grid; min-height: 100vh; place-items: center; padding: 18px; background: radial-gradient(circle at 20% 20%, #7356a8, #2c2046 55%, #1d1731); }
.login-card { width: min(100%, 430px); background: white; border-radius: 22px; padding: 37px; box-shadow: 0 25px 60px rgba(13, 5, 34, .3); }
.login-mark { margin-bottom: 23px; }
.login-card h1 { font-size: 30px; font-weight: 760; letter-spacing: -.05em; margin: 8px 0 6px; }
.login-card p { color: var(--muted); margin-bottom: 27px; }
.chat-shell { display: grid; grid-template-columns: minmax(250px, 320px) minmax(0, 1fr); height: calc(100vh - 230px); min-height: 520px; }
.chat-sidebar { display: flex; flex-direction: column; border-right: 1px solid var(--border); min-height: 0; }
.chat-search { padding: 16px; border-bottom: 1px solid var(--border); }
.chat-list { overflow-y: auto; flex: 1; }
.chat-list-item { display: block; padding: 13px 16px; border-bottom: 1px solid var(--border); color: var(--ink); text-decoration: none; }
.chat-list-item:hover { background: #faf8fd; color: var(--ink); }
.chat-list-item.active { background: #f1ebfb; box-shadow: inset 3px 0 var(--violet); }
.chat-list-top { display: flex; justify-content: space-between; gap: 10px; }
.chat-list-top strong { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-list-top time { color: var(--muted); font-size: 11px; flex: none; }
.chat-list-item small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-header { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border); }
.chat-header strong { display: block; font-size: 16px; }
.chat-header small { color: var(--muted); font-size: 12px; }
.chat-back { display: none; color: var(--violet); font-weight: 650; text-decoration: none; font-size: 13px; }
.chat-log { flex: 1; overflow-y: auto; padding: 18px 20px; background: #f6f3fa; display: flex; flex-direction: column; gap: 6px; }
.chat-older { align-self: center; border: 1px solid var(--border); background: #fff; color: var(--violet); border-radius: 100px; padding: 6px 14px; font-size: 12px; font-weight: 650; margin-bottom: 8px; }
.chat-day { align-self: center; margin: 10px 0 4px; }
.chat-day span { background: #e9e2f4; color: #6b6379; border-radius: 100px; padding: 3px 11px; font-size: 11px; font-weight: 650; }
.chat-bubble { max-width: min(72%, 560px); padding: 8px 12px 6px; border-radius: 15px; background: #fff; border: 1px solid var(--border); align-self: flex-start; box-shadow: 0 1px 2px rgba(43, 30, 70, .05); }
.chat-bubble.from-bot { align-self: flex-end; background: #ece4fb; border-color: #ddd0f3; }
.chat-bubble.from-admin { align-self: flex-end; background: var(--violet); border-color: var(--violet); color: #fff; }
.chat-bubble p { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.chat-bubble img { display: block; max-width: 100%; max-height: 260px; border-radius: 10px; margin-bottom: 6px; }
.chat-bubble video { display: block; max-width: 100%; max-height: 300px; border-radius: 10px; margin-bottom: 6px; background: #000; }
.chat-bubble audio { display: block; width: min(320px, 100%); margin-bottom: 4px; }
.chat-media-name { display: block; font-size: 12px; color: var(--muted); }
.chat-media-missing { display: block; font-size: 12px; color: var(--muted); font-style: italic; }
.chat-author { display: block; font-size: 11px; font-weight: 700; color: var(--violet); margin-bottom: 2px; }
.chat-bubble.from-admin .chat-author, .chat-bubble.from-admin time, .chat-bubble.from-admin a { color: #e6dcff; }
.chat-bubble time { display: block; text-align: right; font-size: 10px; color: var(--muted); margin-top: 3px; }
.chat-button-press { font-size: 13px; color: var(--muted); font-style: italic; }
.chat-notice { font-size: 13px; color: #6b5a8e; }
.chat-sticker { font-size: 30px; line-height: 1.1; }
.chat-file { font-weight: 650; color: var(--violet); text-decoration: none; }
.chat-reply { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; padding: 14px 20px; border-top: 1px solid var(--border); align-items: end; }
.chat-attach { font-size: 18px; line-height: 1; padding: 10px 12px; }
.chat-attachment { grid-column: 1 / -1; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #f1ebfb; border-radius: 9px; padding: 6px 10px; font-size: 13px; }
.chat-attachment[hidden] { display: none; }
.chat-attachment button { border: 0; background: transparent; color: var(--violet); font-weight: 700; }
.chat-reply textarea { resize: vertical; min-height: 44px; }
.chat-status { grid-column: 1 / -1; }
.chat-status:empty { display: none; }
.chat-error { color: #a61b1b; font-size: 13px; font-weight: 600; }
.chat-empty { margin: auto; color: var(--muted); padding: 30px; text-align: center; }
.chat-log .chat-empty:not(:only-child) { display: none; }
.log-filters { flex-wrap: wrap; }
.log-list { max-height: 72vh; overflow-y: auto; }
.log-entry { display: grid; grid-template-columns: 150px 86px minmax(0, 1fr); gap: 12px; padding: 10px 24px; border-bottom: 1px solid var(--border); font-size: 13px; align-items: baseline; }
.log-entry time { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 12px; }
.log-level { justify-self: start; border-radius: 100px; padding: 2px 9px; font-size: 11px; font-weight: 700; background: #f0eef3; color: #726c79; }
.level-warning .log-level { background: #fff2d6; color: #8a5a00; }
.level-error .log-level, .level-critical .log-level { background: #fde6e6; color: #a61b1b; }
.level-error, .level-critical { background: #fffafa; }
.log-message { overflow-wrap: anywhere; }
.log-message details { margin-top: 6px; }
.log-message summary { cursor: pointer; color: var(--violet); font-size: 12px; font-weight: 650; }
.log-message pre { background: #211b31; color: #ece5f6; font-size: 12px; padding: 12px 14px; border-radius: 9px; margin: 8px 0 0; white-space: pre-wrap; }
@media (max-width: 850px) { .admin-shell { grid-template-columns: 1fr; } .admin-sidebar { height: auto; position: static; padding: 17px; min-width: 0; } .brand { padding-bottom: 12px; } .admin-nav { display: flex; overflow: auto; gap: 4px; } .admin-nav a { white-space: nowrap; width: auto; } .logout-form { position: absolute; right: 15px; top: 27px; margin: 0; } .logout-form button { font-size: 12px; padding: 8px; } .admin-main { padding-top: 18px; } }
@media (max-width: 580px) { .page-heading { align-items: flex-start; flex-direction: column; } .surface-heading { align-items: flex-start; flex-direction: column; } .search-field { max-width: none; width: 100%; } .login-card { padding: 28px; } }
@media (max-width: 850px) { .chat-shell { grid-template-columns: 1fr; height: auto; min-height: 0; } .chat-shell.has-chat .chat-sidebar { display: none; } .chat-shell:not(.has-chat) .chat-pane { display: none; } .chat-back { display: inline; } .chat-log { flex: none; height: 60vh; } .chat-bubble { max-width: 88%; } }
@media (max-width: 580px) { .log-entry { grid-template-columns: 1fr; gap: 4px; padding: 10px 16px; } }
.format-toolbar { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.broadcast-text { white-space: pre-wrap; overflow-wrap: anywhere; background: #f7f3fc; border-radius: 9px; padding: 14px 16px; font-size: 14px; }
.broadcast-admin { max-width: 240px; }
.draft-note { font-weight: 650; color: #3d7a4f; }
.spend-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 13px; color: var(--muted); }
.spend-legend span { display: inline-flex; align-items: center; gap: 6px; }
.spend-swatch { display: inline-block; width: 10px; height: 10px; border-radius: 2px; }
.spend-swatch.chat { background: #2a78d6; }
.spend-swatch.scheme { background: #eb6834; }
.spend-chart-wrap { padding: 16px 20px 8px; }
.spend-chart { display: block; width: 100%; height: auto; }
.spend-grid { stroke: #ebe7f0; stroke-width: 1; }
.spend-axis { fill: #827693; font-size: 11px; }
.spend-chat { fill: #2a78d6; }
.spend-scheme { fill: #eb6834; }
.spend-hit { fill: transparent; }
.spend-bar { cursor: default; outline: none; }
.spend-bar:hover path, .spend-bar:focus path { opacity: .78; }
.spend-bar:focus-visible .spend-hit { stroke: var(--violet); stroke-width: 1.5; }
.spend-tip { position: fixed; z-index: 20; pointer-events: none; background: #fff; border: 1px solid var(--border); border-radius: 9px; padding: 8px 11px; font-size: 12px; color: var(--muted); box-shadow: 0 8px 22px rgba(40, 30, 60, .12); }
.spend-tip strong { color: var(--ink); font-size: 14px; }
.quiet-row td { color: var(--muted); }
.budget-meter { height: 6px; }
.price-table input { max-width: 120px; }
.budget-input { max-width: 180px; }
.chat-tabs { display: inline-flex; gap: 4px; background: #efeaf6; border-radius: 10px; padding: 4px; flex-shrink: 0; }
.chat-tabs a { padding: 7px 14px; border-radius: 8px; color: var(--muted); font-weight: 650; font-size: 13px; text-decoration: none; white-space: nowrap; }
.chat-tabs a.active { background: #fff; color: var(--violet); box-shadow: 0 1px 2px rgba(43, 30, 70, .08); }
.feed-heading { flex-wrap: wrap; }
.feed-controls { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.feed-periods { display: flex; flex-wrap: wrap; gap: 6px; }
.feed-summary { margin: 0; color: var(--muted); font-size: 13px; }
.feed-row { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 14px; padding: 12px 24px; border-bottom: 1px solid var(--border); }
.feed-row time { color: var(--muted); font-size: 12px; padding-top: 2px; white-space: nowrap; }
.feed-who { font-size: 13px; margin-bottom: 3px; }
.feed-text { white-space: pre-wrap; overflow-wrap: anywhere; }
.feed-admin { background: #faf8fd; }
.feed-bot .feed-text { color: var(--muted); }
.feed-thumb { display: block; max-width: 120px; max-height: 120px; border-radius: 8px; object-fit: cover; margin: 2px 0 4px; }
.feed-pages { display: flex; align-items: center; justify-content: center; gap: 14px; padding: 16px; font-size: 13px; color: var(--muted); }
@media (max-width: 580px) { .feed-row { grid-template-columns: 1fr; gap: 4px; padding: 10px 16px; } }
