:root {
    --bg: #08111f;
    --panel: rgba(10, 22, 39, 0.86);
    --panel-soft: rgba(17, 31, 54, 0.7);
    --text: #e9f1ff;
    --muted: #98a9c9;
    --border: rgba(146, 175, 235, 0.16);
    --primary: #6ea8fe;
    --primary-strong: #4b8df8;
    --secondary: #8b7cff;
    --danger: #ff6b87;
    --success: #3dd9a3;
    --warning: #ffc857;
    --shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
    font-family: Inter, Segoe UI, Arial, sans-serif;
    font-size: 15px;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(110, 168, 254, 0.16), transparent 30%),
        radial-gradient(circle at top right, rgba(139, 124, 255, 0.16), transparent 25%),
        linear-gradient(180deg, #07101d 0%, #091524 100%);
}

a { color: inherit; text-decoration: none; }
button, input, textarea, select {
    font: inherit;
}

.login-body {
    display: grid;
    place-items: center;
    min-height: 100vh;
    padding: 24px;
}

.login-shell {
    width: 100%;
    max-width: 520px;
}

.login-card, .panel, .stat-card, .post-card, .sidebar {
    backdrop-filter: blur(18px);
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 24px;
    box-shadow: var(--shadow);
}

.login-card {
    padding: 32px;
}

.app-shell {
    display: grid;
    grid-template-columns: 340px 1fr;
    gap: 24px;
    padding: 24px;
    transition: grid-template-columns 0.28s ease, gap 0.28s ease;
}

.sidebar {
    display: flex;
    flex-direction: column;
    gap: 14px;
    padding: 20px;
    position: sticky;
    top: 24px;
    height: calc(100vh - 48px);
    transition: transform 0.28s ease, opacity 0.22s ease, visibility 0.22s ease;
}

.sidebar-toggle {
    align-self: flex-end;
    width: 38px;
    height: 38px;
    min-width: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(15, 27, 46, 0.78);
    color: var(--text);
    cursor: pointer;
    padding: 0;
    font-size: 18px;
    line-height: 1;
}

.app-shell.sidebar-collapsed {
    grid-template-columns: 0 1fr;
    gap: 0;
}

.app-shell.sidebar-collapsed .sidebar {
    transform: translateX(calc(-100% - 24px));
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.sidebar-reveal {
    position: fixed;
    left: 16px;
    top: 18px;
    z-index: 110;
    width: 42px;
    height: 42px;
    min-width: 42px;
    display: none;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: rgba(10, 22, 39, 0.92);
    color: var(--text);
    box-shadow: var(--shadow);
    cursor: pointer;
    font-size: 18px;
}

.app-shell.sidebar-collapsed .sidebar-reveal {
    display: inline-flex;
}

.content {
    display: flex;
    flex-direction: column;
    gap: 24px;
    max-height: calc(100vh - 48px);
    overflow-y: auto;
}

.panel {
    padding: 24px;
}

.soft {
    background: var(--panel-soft);
}

.eyebrow {
    color: var(--primary);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.16em;
    margin-bottom: 8px;
}

h1, h2, h3, p { margin-top: 0; }
h1 { font-size: 26px; line-height: 1.1; margin-bottom: 8px; }
h2 { font-size: 24px; margin-bottom: 8px; }
h3 { font-size: 17px; margin-bottom: 8px; }

.sidebar h1 {
    font-size: 17px;
    line-height: 1.05;
    margin-bottom: 6px;
}

.muted { color: var(--muted); }
.small { font-size: 12px; }
.mono { font-family: Consolas, monospace; word-break: break-all; }
.hint { color: var(--muted); font-size: 12px; margin-top: 8px; }

.stats-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.stat-card {
    padding: 12px 14px;
    border-radius: 18px;
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 6px;
}

.stat-card strong {
    font-size: 24px;
    line-height: 1;
}

.sidebar-links-panel {
    padding: 14px 16px;
}

.sidebar-links-panel h3 {
    margin-bottom: 6px;
}

.sidebar-links-panel p {
    margin-bottom: 8px;
}

.sidebar-links-panel p:last-child {
    margin-bottom: 0;
}

.sidebar-action-button {
    padding: 8px 12px;
    border-radius: 10px;
    font-size: 13px;
    line-height: 1.2;
}

.inner-panel h3,
.compact-details summary,
.section-head h3 {
    font-size: 15px;
}

.feature-list {
    margin: 0;
    padding-left: 18px;
    color: var(--muted);
}

.stack {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.split-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

label {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

input, textarea, select {
    width: 100%;
    border: 1px solid var(--border);
    background: rgba(8, 18, 33, 0.88);
    color: var(--text);
    padding: 14px 16px;
    border-radius: 16px;
    outline: none;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

input:focus, textarea:focus, select:focus {
    border-color: rgba(110, 168, 254, 0.7);
    transform: translateY(-1px);
}

textarea {
    min-height: 240px;
    resize: vertical;
}

.editor-text-label {
    gap: 10px;
    margin-bottom: 12px;
}

.editor-meta-row {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.03);
    transition: border-color 0.2s ease, background 0.2s ease;
}

.editor-char-counter {
    flex: 0 0 auto;
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.editor-char-hint {
    color: var(--muted);
    text-align: right;
}

.editor-char-counter.is-warning,
.editor-char-hint.is-warning {
    color: #ffe5a2;
}

.editor-char-counter.is-danger,
.editor-char-hint.is-danger {
    color: #ffd4de;
}

.editor-meta-row.is-warning {
    border-color: rgba(255, 200, 87, 0.34);
    background: rgba(255, 200, 87, 0.08);
}

.editor-meta-row.is-danger {
    border-color: rgba(255, 107, 135, 0.34);
    background: rgba(255, 107, 135, 0.08);
}

.visual-editor-shell {
    display: none;
}

.visual-editor-shell.is-active {
    display: block;
}

.visual-editor {
    min-height: 260px;
    border: 1px solid var(--border);
    background: rgba(8, 18, 33, 0.88);
    color: var(--text);
    padding: 14px 16px;
    border-radius: 16px;
    outline: none;
    line-height: 1.65;
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.visual-editor:focus {
    border-color: rgba(110, 168, 254, 0.7);
    transform: translateY(-1px);
}

.visual-editor b,
.visual-editor strong {
    font-weight: 700;
}

.visual-editor i,
.visual-editor em {
    font-style: italic;
}

.visual-editor u {
    text-decoration: underline;
}

.visual-editor s {
    text-decoration: line-through;
}

.visual-editor code {
    background: rgba(110, 168, 254, 0.12);
    border-radius: 8px;
    padding: 2px 6px;
    font-family: "JetBrains Mono", "Consolas", monospace;
}

.visual-editor [data-spoiler] {
    background: rgba(255, 255, 255, 0.12);
    color: transparent;
    border-radius: 6px;
    padding: 0 4px;
}

.visual-editor [data-spoiler]:hover {
    color: var(--text);
}

textarea[data-editor-textarea].is-hidden {
    display: none;
}

.editor-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 12px;
}

.editor-toolbar button,
.button {
    border: 1px solid var(--border);
    background: rgba(13, 25, 45, 0.9);
    color: var(--text);
    padding: 10px 14px;
    border-radius: 12px;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.2;
    transition: transform 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.editor-toolbar button:hover,
.button:hover {
    transform: translateY(-1px);
    border-color: rgba(110, 168, 254, 0.48);
}

.button.primary {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: #08111f;
    border-color: transparent;
    font-weight: 700;
}

.button.secondary {
    background: linear-gradient(135deg, #8b7cff, #7a67ff);
    border-color: transparent;
}

.button.success {
    background: linear-gradient(135deg, #3ddc84, #1fb86a);
    color: #07150d;
    border-color: transparent;
    font-weight: 700;
}

.button.ghost {
    background: rgba(15, 27, 46, 0.62);
}

.button.danger {
    background: rgba(255, 107, 135, 0.18);
    color: #ffdbe4;
}

.button.wide {
    width: 100%;
    text-align: center;
}

.button-row {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.editor-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-bottom: 20px;
}

.editor-actions-sticky {
    position: sticky;
    top: 12px;
    z-index: 20;
    padding: 14px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(7, 16, 29, 0.92);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.22);
}

.editor-actions-top {
    width: 100%;
    margin-bottom: 0;
}

.editor-actions-main,
.editor-actions-side {
    display: flex;
    gap: 12px;
    flex-wrap: wrap;
    align-items: center;
}

.button-row.compact {
    justify-content: space-between;
}

.form-grid-compact {
    gap: 12px 16px;
    margin-bottom: 12px;
}

.split-grid-tight {
    gap: 12px;
}

.compact-details {
    margin: 12px 0;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(9, 20, 37, 0.52);
    overflow: hidden;
}

.compact-details summary {
    cursor: pointer;
    list-style: none;
    padding: 14px 16px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.compact-details summary::-webkit-details-marker {
    display: none;
}

.compact-details summary::after {
    content: '⌄';
    color: var(--muted);
    transition: transform 0.2s ease;
}

.compact-details[open] summary::after {
    transform: rotate(180deg);
}

.compact-details-body {
    padding: 0 16px 16px;
}

.compact-section {
    margin: 0;
}

body.has-modal-open {
    overflow: hidden;
}

.preview-modal[hidden] {
    display: none;
}

.preview-modal {
    position: fixed;
    inset: 0;
    z-index: 120;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px 16px;
}

.preview-modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(2, 8, 18, 0.78);
    backdrop-filter: blur(6px);
}

.preview-modal-dialog {
    position: relative;
    z-index: 1;
    width: min(760px, 100%);
    max-height: min(calc(100vh - 40px), 920px);
    border: 1px solid var(--border);
    border-radius: 24px;
    background: linear-gradient(180deg, rgba(10, 21, 38, 0.98), rgba(7, 16, 29, 0.98));
    box-shadow: 0 28px 80px rgba(0, 0, 0, 0.45);
    overflow: hidden;
    transform: translateY(18px) scale(0.98);
    opacity: 0;
    transition: opacity 0.18s ease, transform 0.18s ease;
}

.preview-modal.is-open .preview-modal-dialog {
    transform: translateY(0) scale(1);
    opacity: 1;
}

.preview-modal-head {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
    padding: 18px 20px 14px;
    border-bottom: 1px solid var(--border);
}

.preview-modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(100vh - 152px);
}

.telegram-media-preview[hidden] {
    display: none;
}

.telegram-media-preview {
    margin-bottom: 12px;
    border-radius: 18px;
    overflow: hidden;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
}

.telegram-media-preview img {
    display: block;
    width: 100%;
    max-height: 360px;
    object-fit: cover;
}

.preview-modal-close {
    width: 38px;
    height: 38px;
    min-width: 38px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(15, 27, 46, 0.75);
    color: var(--text);
    cursor: pointer;
    font-size: 24px;
    line-height: 1;
    padding: 0;
}

.checkbox-row {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    padding-top: 28px;
}

.checkbox-row.top-aligned {
    align-items: flex-start;
}

.checkbox-row input {
    width: auto;
}

.alert {
    border-radius: 16px;
    padding: 14px 16px;
    margin-bottom: 18px;
    border: 1px solid transparent;
}

.flash-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    transition: opacity 0.35s ease, transform 0.35s ease, margin 0.35s ease, padding 0.35s ease;
}

.flash-alert.is-hiding {
    opacity: 0;
    transform: translateY(-8px);
    margin-bottom: 0;
    padding-top: 0;
    padding-bottom: 0;
}

.alert-close {
    width: 30px;
    height: 30px;
    min-width: 30px;
    border: 1px solid var(--border);
    border-radius: 999px;
    background: rgba(8, 18, 33, 0.4);
    color: var(--text);
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

.alert.success {
    background: rgba(61, 217, 163, 0.13);
    border-color: rgba(61, 217, 163, 0.3);
}

.alert.error {
    background: rgba(255, 107, 135, 0.13);
    border-color: rgba(255, 107, 135, 0.3);
}

.alert.warning {
    background: rgba(255, 200, 87, 0.12);
    border-color: rgba(255, 200, 87, 0.26);
}

.section-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 18px;
}

.post-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 16px;
}

.pool-toolbar {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.filter-chip,
.pagination-page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 14px;
    border-radius: 999px;
    border: 1px solid var(--border);
    background: rgba(15, 27, 46, 0.62);
    color: var(--text);
    transition: border-color 0.2s ease, transform 0.2s ease, background 0.2s ease;
}

.filter-chip:hover,
.pagination-page:hover {
    transform: translateY(-1px);
    border-color: rgba(110, 168, 254, 0.48);
}

.filter-chip.active,
.pagination-page.active {
    background: rgba(110, 168, 254, 0.16);
    border-color: rgba(110, 168, 254, 0.34);
    color: #d9e7ff;
}

.post-compact-list {
    display: grid;
    gap: 10px;
}

.post-compact-head,
.post-compact-row {
    display: grid;
    grid-template-columns: 160px 140px 170px minmax(0, 1.4fr) minmax(220px, 1fr) 170px;
    gap: 14px;
    align-items: start;
}

.post-compact-head-media,
.post-compact-row.has-thumbnail {
    grid-template-columns: 150px 150px 90px minmax(0, 1.2fr) minmax(160px, 0.8fr) 150px;
}

.post-compact-row:not(.has-thumbnail) {
    grid-template-columns: 140px 170px minmax(0, 1.4fr) minmax(220px, 1fr) 170px;
}

.post-compact-head {
    padding: 0 12px 8px;
    color: var(--muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.post-compact-row {
    padding: 14px 12px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(9, 20, 37, 0.7);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.post-compact-row:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
    border-color: rgba(110, 168, 254, 0.3);
}

.post-compact-row.has-thumbnail {
    padding: 10px 12px;
    align-items: center;
}

.post-compact-thumb {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    overflow: hidden;
    background: rgba(8, 18, 33, 0.6);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.post-compact-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.post-compact-cell {
    min-width: 0;
}

.post-compact-text {
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.45;
    word-break: break-word;
}

.post-compact-summary {
    display: grid;
    gap: 6px;
    color: var(--muted);
    font-size: 13px;
}

.post-inline-alert {
    display: inline-flex;
    width: fit-content;
    max-width: 100%;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    line-height: 1.3;
}

.post-inline-alert.error {
    background: rgba(255, 107, 135, 0.14);
    color: #ffd4de;
}

.post-inline-alert.warning {
    background: rgba(255, 200, 87, 0.14);
    color: #ffe5a2;
}

.post-compact-actions {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.post-compact-actions form {
    margin: 0;
}

.pagination-bar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    margin-top: 18px;
}

.pagination-pages {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 8px;
}

.button.disabled {
    pointer-events: none;
    opacity: 0.45;
}

.calendar-pill-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 10px;
    align-items: stretch;
}

.calendar-pill-actions form {
    margin: 0;
    display: flex;
}

.calendar-action-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 7px 10px;
    font-size: 12px;
    border-radius: 10px;
    min-height: 34px;
    white-space: nowrap;
}

.template-list,
.calendar-list {
    display: grid;
    gap: 16px;
    margin-top: 20px;
}

.preview-shell {
    margin-top: 20px;
}

.preview-card {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 20px;
    background: rgba(9, 20, 37, 0.76);
}

.preview-head {
    margin-bottom: 16px;
}

.telegram-preview {
    display: flex;
    justify-content: center;
}

.telegram-bubble {
    width: 100%;
    max-width: 520px;
    background: linear-gradient(180deg, rgba(29, 48, 74, 0.95), rgba(16, 29, 49, 0.95));
    border: 1px solid rgba(146, 175, 235, 0.22);
    border-radius: 22px;
    padding: 18px;
}

.telegram-content {
    line-height: 1.55;
    margin-bottom: 14px;
}

.telegram-buttons {
    display: grid;
    gap: 8px;
}

.telegram-reactions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
}

.telegram-reaction {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    color: #eef5ff;
    font-size: 13px;
}

.telegram-button-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 8px;
}

.telegram-button {
    display: inline-flex;
    justify-content: center;
    padding: 10px 12px;
    border-radius: 12px;
    background: rgba(110, 168, 254, 0.16);
    border: 1px solid rgba(110, 168, 254, 0.24);
    color: #d9e7ff;
    text-align: center;
}

.calendar-weekly {
    display: grid;
    gap: 20px;
    margin-bottom: 20px;
}

.week-card {
    border: 1px solid var(--border);
    border-radius: 22px;
    padding: 18px;
    background: rgba(9, 20, 37, 0.7);
}

.week-head {
    margin-bottom: 14px;
}

.week-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 16px;
}

.calendar-day {
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 18px;
    background: rgba(9, 20, 37, 0.72);
}

.calendar-day-head {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
}

.calendar-day-items {
    display: grid;
    gap: 10px;
}

/* Thumbnails and Media Indicators */

.media-indicators {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 16px;
    line-height: 1;
}

.media-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 999px;
    background: rgba(110, 168, 254, 0.2);
    color: var(--primary);
    font-size: 11px;
    font-weight: 700;
}

.post-compact-cell[data-label="Канал"] {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.vk-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 4px 8px;
    border-radius: 6px;
    background: linear-gradient(135deg, #4a76a8, #5181b8);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    min-width: fit-content;
}

/* Calendar Pill with Thumbnail */

.calendar-pill {
    display: grid;
    gap: 6px;
    padding: 12px;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.04);
    align-items: start;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.calendar-pill:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.calendar-pill.has-thumbnail {
    display: grid;
    grid-template-columns: 80px 1fr;
    gap: 14px;
    padding: 10px;
}

.calendar-pill-thumb {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    overflow: hidden;
    background: rgba(8, 18, 33, 0.6);
    border: 1px solid var(--border);
    flex-shrink: 0;
}

.calendar-pill-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.calendar-pill-content {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
}

.calendar-pill-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
}

.calendar-pill-time {
    font-size: 13px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.calendar-pill strong {
    display: block;
    line-height: 1.35;
    word-break: break-word;
}

.post-card {
    padding: 20px;
}

.template-card,
.calendar-card,
.inner-panel {
    border-radius: 20px;
}

.template-card {
    padding: 20px;
    border: 1px solid var(--border);
    background: rgba(9, 20, 37, 0.7);
}

.calendar-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    border: 1px solid var(--border);
    background: rgba(9, 20, 37, 0.7);
}

.calendar-meta {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 8px;
}

.post-card-top {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
}

.post-card-title {
    font-size: 18px;
    line-height: 1.35;
    margin-bottom: 6px;
}

.post-compact-cell[data-label="Статус"] {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    border-radius: 999px;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    min-width: fit-content;
    white-space: nowrap;
}

.badge-draft { background: rgba(110, 168, 254, 0.14); color: #b8d3ff; }
.badge-scheduled { background: rgba(255, 200, 87, 0.14); color: #ffe5a2; }
.badge-published { background: rgba(61, 217, 163, 0.14); color: #bff7e4; }
.badge-failed { background: rgba(255, 107, 135, 0.14); color: #ffd4de; }
.calendar-pill.badge-draft { border: 1px solid rgba(110, 168, 254, 0.18); }
.calendar-pill.badge-scheduled { border: 1px solid rgba(255, 200, 87, 0.22); }
.calendar-pill.badge-published { border: 1px solid rgba(61, 217, 163, 0.2); }
.calendar-pill.badge-failed { border: 1px solid rgba(255, 107, 135, 0.2); }

.clamped {
    color: var(--muted);
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    min-height: 100px;
}

.meta-grid {
    display: grid;
    gap: 8px;
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 16px;
}

.gallery-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px;
}

.gallery-item {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(8, 18, 33, 0.5);
}

.chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.chip {
    display: inline-flex;
    align-items: center;
    padding: 8px 12px;
    border-radius: 999px;
    background: rgba(110, 168, 254, 0.12);
    color: #c9ddff;
    font-size: 12px;
}

.sortable-chips {
    min-height: 48px;
}

.sortable-chip {
    cursor: grab;
    user-select: none;
}

.sortable-chip.dragging {
    opacity: 0.55;
    transform: scale(0.98);
}

.existing-media h4 {
    margin-bottom: 12px;
}

.empty-state {
    border: 1px dashed var(--border);
    border-radius: 20px;
    padding: 32px;
    text-align: center;
    color: var(--muted);
}

/* Dashboard Analytics Widgets */

.stats-grid-3 {
    grid-template-columns: repeat(3, 1fr);
}

.best-time-badge {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    padding: 12px 16px;
    border-radius: 16px;
    background: linear-gradient(135deg, rgba(110, 168, 254, 0.16), rgba(139, 124, 255, 0.14));
    border: 1px solid rgba(110, 168, 254, 0.28);
    text-align: right;
}

.best-time-badge span {
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.best-time-badge strong {
    font-size: 22px;
    line-height: 1;
    color: var(--primary);
}

.time-chart {
    display: flex;
    gap: 4px;
    align-items: flex-end;
    height: 200px;
    padding: 20px 0 30px;
    margin: 20px 0;
}

.time-bar-wrapper {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-end;
    height: 100%;
    gap: 8px;
}

.time-bar {
    width: 100%;
    background: linear-gradient(180deg, rgba(110, 168, 254, 0.5), rgba(110, 168, 254, 0.3));
    border-radius: 8px 8px 4px 4px;
    border: 1px solid rgba(110, 168, 254, 0.3);
    transition: all 0.3s ease;
    position: relative;
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding-top: 6px;
    min-height: 8px;
}

.time-bar.is-best {
    background: linear-gradient(180deg, rgba(61, 217, 163, 0.7), rgba(61, 217, 163, 0.5));
    border-color: rgba(61, 217, 163, 0.5);
    box-shadow: 0 0 20px rgba(61, 217, 163, 0.3);
}

.time-bar:hover {
    transform: scaleY(1.05);
    background: linear-gradient(180deg, rgba(110, 168, 254, 0.7), rgba(110, 168, 254, 0.5));
    border-color: rgba(110, 168, 254, 0.5);
}

.time-bar-value {
    font-size: 10px;
    font-weight: 700;
    color: var(--text);
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.5);
}

.time-bar-label {
    font-size: 11px;
    color: var(--muted);
    font-variant-numeric: tabular-nums;
}

.hashtag-grid {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 16px;
}

.hashtag-row {
    display: grid;
    grid-template-columns: 200px 1fr;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(9, 20, 37, 0.5);
    border: 1px solid var(--border);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.hashtag-row:hover {
    border-color: rgba(110, 168, 254, 0.4);
    transform: translateX(4px);
}

.hashtag-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.hashtag-name {
    font-size: 16px;
    color: var(--primary);
    font-weight: 700;
}

.hashtag-meta {
    color: var(--muted);
    font-size: 12px;
}

.hashtag-stats {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
}

.hashtag-bar-wrapper {
    position: relative;
    height: 28px;
    background: rgba(8, 18, 33, 0.7);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.hashtag-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(110, 168, 254, 0.5), rgba(139, 124, 255, 0.5));
    border-radius: 999px;
    transition: width 0.4s ease;
}

.hashtag-numbers {
    display: flex;
    gap: 16px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.hashtag-numbers span {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.button-clicks-list {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-top: 20px;
}

.button-click-row {
    display: grid;
    grid-template-columns: minmax(200px, 1fr) 2fr auto;
    gap: 16px;
    align-items: center;
    padding: 14px 16px;
    border-radius: 16px;
    background: rgba(9, 20, 37, 0.5);
    border: 1px solid var(--border);
    transition: border-color 0.2s ease, transform 0.2s ease;
}

.button-click-row:hover {
    border-color: rgba(110, 168, 254, 0.4);
    transform: translateX(4px);
}

.button-click-info {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.button-click-info strong {
    font-size: 14px;
    line-height: 1.4;
}

.button-click-url {
    word-break: break-all;
    line-height: 1.4;
}

.button-click-bar-wrapper {
    position: relative;
    height: 28px;
    background: rgba(8, 18, 33, 0.7);
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--border);
}

.button-click-bar {
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, rgba(255, 107, 135, 0.5), rgba(255, 157, 87, 0.5));
    border-radius: 999px;
    transition: width 0.4s ease;
}

.button-click-count {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
    min-width: 80px;
}

.button-click-count strong {
    font-size: 22px;
    line-height: 1;
    color: var(--danger);
}

@media (max-width: 1080px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
    }
}

@media (max-width: 720px) {
    .form-grid {
        grid-template-columns: 1fr;
    }

    .split-grid,
    .gallery-grid {
        grid-template-columns: 1fr;
    }

    .stats-grid-3 {
        grid-template-columns: 1fr;
    }

    .time-chart {
        height: 160px;
        overflow-x: auto;
        padding-bottom: 40px;
    }

    .time-bar-wrapper {
        min-width: 24px;
    }

    .time-bar-label {
        font-size: 9px;
    }

    .best-time-badge {
        align-items: flex-start;
        text-align: left;
        margin-top: 12px;
    }

    .hashtag-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .hashtag-stats {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .hashtag-numbers {
        justify-content: flex-start;
    }

    .button-click-row {
        grid-template-columns: 1fr;
        gap: 12px;
    }

    .button-click-bar-wrapper {
        height: 20px;
    }

    .button-click-count {
        flex-direction: row;
        align-items: baseline;
        gap: 8px;
        min-width: auto;
    }

    .button-click-count strong {
        font-size: 18px;
    }

    .button-row,
    .button-row.compact,
    .editor-actions,
    .editor-actions-main,
    .editor-actions-side {
        flex-direction: column;
        align-items: stretch;
    }

    .editor-actions-sticky {
        position: static;
        top: auto;
    }

    .compact-details-body {
        padding: 0 12px 12px;
    }

    .post-list,
    .calendar-card {
        grid-template-columns: 1fr;
    }

    .app-shell,
    .app-shell.sidebar-collapsed {
        grid-template-columns: 1fr;
        gap: 16px;
    }

    .app-shell.sidebar-collapsed .sidebar {
        display: none;
    }

    .sidebar-reveal {
        top: 12px;
        left: 12px;
    }

    .pool-toolbar,
    .pagination-bar {
        flex-direction: column;
        align-items: stretch;
    }

    .calendar-pill-actions {
        flex-direction: column;
    }

    .calendar-pill-actions form,
    .calendar-action-button {
        width: 100%;
    }

    .post-compact-head {
        display: none;
    }

    .post-compact-row,
    .post-compact-row.has-thumbnail {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .post-compact-thumb {
        width: 100%;
        height: 120px;
        border-radius: 10px;
    }

    .calendar-pill.has-thumbnail {
        grid-template-columns: 1fr;
        gap: 10px;
    }

    .calendar-pill-thumb {
        width: 100%;
        height: 140px;
    }

    .media-indicators {
        font-size: 18px;
    }

    .post-compact-cell::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        color: var(--muted);
        font-size: 11px;
        text-transform: uppercase;
        letter-spacing: 0.08em;
    }

    .post-compact-actions {
        flex-direction: column;
    }

    .calendar-card {
        display: grid;
    }

    .calendar-meta {
        align-items: flex-start;
    }
}

.filter-form {
    position: sticky;
    top: 12px;
    z-index: 10;
    margin-bottom: 0;
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: 18px;
    background: rgba(9, 20, 37, 0.9);
    backdrop-filter: blur(18px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}

.filter-grid {
    display: grid;
    grid-template-columns: 2fr 1fr 1fr auto;
    gap: 14px;
    align-items: end;
}

.filter-item label {
    font-size: 12px;
    color: var(--muted);
    margin-bottom: 6px;
}

.filter-item input {
    padding: 10px 12px;
    font-size: 13px;
    min-height: 42px;
}

.filter-item-buttons {
    display: flex;
    gap: 8px;
}

@media (max-width: 720px) {
    .filter-grid {
        grid-template-columns: 1fr;
    }

    .filter-item-buttons {
        flex-direction: column;
    }

.filter-item-buttons .button {
        width: 100%;
    }
}

.filter-spacer {
    height: 48px;
}

.bulk-actions-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    background: rgba(110, 168, 254, 0.06);
    border-radius: 18px 18px 0 0;
    margin: -16px -16px 16px -16px;
}

.checkbox-row {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
}

.checkbox-row input[type="checkbox"] {
    width: 18px;
    height: 18px;
    cursor: pointer;
}

.select-all-checkbox {
    font-weight: 600;
    color: var(--text);
}

.post-compact-checkbox {
    width: 40px;
    padding: 8px 0 8px 8px;
    flex-shrink: 0;
}

.post-compact-head .post-compact-checkbox {
    padding-left: 8px;
}

.post-compact-thumb-placeholder {
    width: 80px;
    height: 80px;
    border-radius: 12px;
    background: rgba(8, 18, 33, 0.3);
    border: 1px dashed var(--border);
    flex-shrink: 0;
}

.post-compact-row-wrapper {
    display: flex;
    gap: 10px;
    align-items: start;
}

.post-compact-row-wrapper .post-compact-checkbox {
    padding: 0;
    width: 32px;
    display: flex;
    align-items: center;
}

.post-compact-row-wrapper .post-compact-row {
    flex: 1;
}

@media (max-width: 720px) {
    .bulk-actions-bar {
        flex-direction: column;
        align-items: stretch;
        gap: 12px;
    }

    .select-all-checkbox {
        justify-content: space-between;
    }

    #bulk-delete-btn {
        width: 100%;
    }
}

.post-compact-list {
    display: grid;
    gap: 10px;
    padding-bottom: 24px;
    padding-top: 24px;
    margin-top: -24px;
}
}

