:root {
    --bg: #120f18;
    --bg-2: #17131f;
    --card: rgba(255,255,255,0.045);
    --card-solid: rgba(22,18,30,0.94);
    --border: rgba(212,175,122,0.20);
    --text: #f3ede4;
    --muted: #a89bb5;
    --accent: #d8b273;
    --accent-2: #ecd6a8;
    --accent-dark: #b8935a;
    --danger: #e2708a;
    --ok: #6fc9a4;
    --radius: 18px;
    --shadow: 0 24px 60px rgba(0,0,0,0.45);
    --shadow-sm: 0 8px 24px rgba(0,0,0,0.30);
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
    margin: 0;
    font-family: 'Inter', -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1100px 520px at 8% -8%, rgba(216,178,115,0.16), transparent 60%),
        radial-gradient(900px 480px at 100% 0%, rgba(150,90,150,0.14), transparent 55%),
        radial-gradient(1200px 700px at 50% 110%, rgba(216,178,115,0.08), transparent 60%),
        var(--bg);
    background-attachment: fixed;
    min-height: 100vh;
    position: relative;
}
h1, h2, .sidebar-brand {
    font-family: 'Playfair Display', Georgia, serif;
    letter-spacing: 0.01em;
}
::selection { background: rgba(216,178,115,0.35); color: #fff; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(212,175,122,0.35); border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: rgba(212,175,122,0.55); }

/* Декоративный слой с фигурками (фен, ножницы, машинка, шампунь) — фон, не мешает кликам */
.decor-layer {
    position: fixed;
    inset: 0;
    pointer-events: none;
    z-index: 0;
    overflow: hidden;
}
.decor-icon {
    position: absolute;
    width: 84px;
    height: 84px;
    color: var(--accent);
    opacity: 0.10;
    filter: blur(0.2px);
    will-change: transform;
}
.decor-icon svg { width: 100%; height: 100%; display: block; }
.decor-icon-inner { animation: decorFloat 10s ease-in-out infinite; }
.decor-icon.d1 { top: 10%; left: 5%; width: 96px; }
.decor-icon.d2 { top: 16%; right: 6%; width: 78px; }
.decor-icon.d3 { top: 62%; left: 3%; width: 88px; }
.decor-icon.d4 { top: 72%; right: 8%; width: 92px; }
.decor-icon.d5 { top: 40%; right: 22%; width: 60px; opacity: 0.07; }
.decor-icon.d1 .decor-icon-inner { animation-duration: 11s; }
.decor-icon.d2 .decor-icon-inner { animation-duration: 9s; animation-delay: .4s; }
.decor-icon.d3 .decor-icon-inner { animation-duration: 12s; animation-delay: .8s; }
.decor-icon.d4 .decor-icon-inner { animation-duration: 10s; animation-delay: .2s; }
.decor-icon.d5 .decor-icon-inner { animation-duration: 8s; animation-delay: .6s; }
@keyframes decorFloat {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-16px) rotate(6deg); }
}
@media (max-width: 900px) {
    .decor-icon { display: none; }
}

/* Левый сайдбар с двумя агентами вместо верхнего меню */
.app-shell { display: flex; align-items: flex-start; position: relative; z-index: 1; }
.sidebar {
    width: 252px; flex-shrink: 0; min-height: 100vh;
    position: sticky; top: 0; align-self: flex-start;
    padding: 26px 16px; display: flex; flex-direction: column;
    background: rgba(18, 15, 24, 0.55);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border-right: 1px solid var(--border);
    z-index: 20;
}
.sidebar-brand {
    font-weight: 700; font-size: 19px; padding: 2px 10px 26px;
    background: linear-gradient(120deg, var(--accent-2), var(--accent) 60%);
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.nav-group { margin-bottom: 22px; }
.nav-group-title {
    font-size: 11px; text-transform: uppercase; letter-spacing: .07em;
    color: var(--muted); padding: 0 10px; margin-bottom: 8px;
}
.nav-group a {
    display: block; padding: 9px 10px; margin-bottom: 2px; border-radius: 10px;
    color: var(--muted); text-decoration: none; font-size: 14px;
    transition: background .2s ease, color .2s ease;
}
.nav-group a:hover { color: var(--accent-2); background: rgba(216,178,115,0.08); }
.nav-group a.active { color: var(--accent-2); background: rgba(216,178,115,0.14); font-weight: 600; }
.sidebar-spacer { flex: 1; }
.sidebar-logout {
    display: block; padding: 12px 10px 0; margin-top: 6px; border-top: 1px solid var(--border);
    color: var(--muted); text-decoration: none; font-size: 14px;
}
.sidebar-logout:hover { color: var(--danger); }
@media (max-width: 900px) {
    .app-shell { flex-direction: column; }
    .sidebar { width: 100%; position: relative; min-height: auto; }
}

.container { max-width: 1100px; margin: 0 auto; padding: 32px 24px 80px; position: relative; z-index: 1; flex: 1; min-width: 0; }

.card {
    background: linear-gradient(180deg, var(--card), rgba(255,255,255,0.02)), var(--card-solid);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-sm);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform .35s ease, box-shadow .35s ease, border-color .35s ease;
}
h1 { font-size: 26px; margin: 0 0 18px; color: var(--text); }
h2 { font-size: 18px; margin: 0 0 12px; color: var(--accent-2); }

.btn {
    display: inline-block; padding: 9px 18px; border-radius: 10px; border: none;
    background: linear-gradient(135deg, var(--accent-2), var(--accent));
    color: #241a10; font-weight: 600;
    cursor: pointer; font-size: 14px; text-decoration: none;
    box-shadow: 0 6px 18px rgba(216,178,115,0.20);
    transition: transform .2s ease, box-shadow .2s ease, filter .2s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 10px 26px rgba(216,178,115,0.32); filter: brightness(1.04); }
.btn:active { transform: translateY(0); }
.btn-ghost {
    background: transparent; color: var(--accent-2); border: 1px solid var(--border);
    box-shadow: none;
}
.btn-ghost:hover { background: rgba(216,178,115,0.10); box-shadow: none; }
.btn-danger { background: linear-gradient(135deg, #ef92a4, var(--danger)); color: #2a0d14; box-shadow: 0 6px 18px rgba(226,112,138,0.25); }

input, textarea, select {
    width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 14px; font-family: inherit;
    background: rgba(255,255,255,0.04); color: var(--text);
    transition: border-color .2s ease, box-shadow .2s ease;
}
input:focus, textarea:focus, select:focus {
    outline: none; border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(216,178,115,0.15);
}
input::placeholder, textarea::placeholder { color: #7d7189; }
label { font-size: 13px; color: var(--muted); display: block; margin-bottom: 5px; }

/* Календарь */
.calendar-grid {
    display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px;
}
.calendar-cell {
    background: var(--card-solid); border: 1px solid var(--border); border-radius: 14px;
    padding: 12px; min-height: 130px; font-size: 13px;
    transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease;
}
.calendar-cell:hover { border-color: rgba(212,175,122,0.4); box-shadow: var(--shadow-sm); }
.calendar-cell .date { font-weight: 700; color: var(--accent-2); margin-bottom: 8px; font-family: 'Playfair Display', serif; }
.tag {
    display: inline-block; font-size: 11px; padding: 3px 9px; border-radius: 999px;
    background: rgba(216,178,115,0.14); color: var(--accent-2); margin-bottom: 4px;
    border: 1px solid rgba(216,178,115,0.20);
}
.tag-format { background: rgba(226,112,138,0.14); color: #f3a9b8; border-color: rgba(226,112,138,0.22); }
.status-draft { color: var(--muted); }
.status-approved { color: var(--ok); }
.status-published { color: var(--accent-2); font-weight: 700; }
.status-rejected { color: var(--danger); }
.snippet { color: var(--text); margin-top: 8px; line-height: 1.45; opacity: 0.92; }

/* Чат */
.chat-window {
    height: 480px; overflow-y: auto; background: var(--card-solid); border: 1px solid var(--border);
    border-radius: var(--radius); padding: 18px; margin-bottom: 14px;
    box-shadow: var(--shadow-sm);
}
.msg { margin-bottom: 16px; max-width: 80%; }
.msg-user { margin-left: auto; text-align: right; }
.msg-bubble {
    display: inline-block; padding: 11px 15px; border-radius: 16px; line-height: 1.5; font-size: 14px;
    white-space: pre-wrap; text-align: left;
}
.msg-user .msg-bubble { background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #241a10; border-bottom-right-radius: 4px; }
.msg-agent .msg-bubble { background: rgba(255,255,255,0.06); color: var(--text); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-form { display: flex; gap: 10px; }
.chat-form textarea { flex: 1; resize: none; height: 54px; }

/* Статистика */
.stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-box {
    background: var(--card-solid); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px;
    transition: transform .3s ease, box-shadow .3s ease;
}
.stat-box:hover { transform: translateY(-3px); box-shadow: var(--shadow-sm); }
.stat-value {
    font-size: 26px; font-weight: 700; font-family: 'Playfair Display', serif;
    background: linear-gradient(120deg, var(--accent-2), var(--accent));
    -webkit-background-clip: text; background-clip: text; color: transparent;
}
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr { transition: background .2s ease; }
tbody tr:hover { background: rgba(216,178,115,0.05); }
.budget-bar { height: 9px; border-radius: 5px; background: rgba(255,255,255,0.06); overflow: hidden; margin-top: 7px; }
.budget-bar-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 5px; }
.budget-bar-fill.over { background: linear-gradient(90deg, var(--danger), #f3a9b8); }

.login-box { max-width: 380px; margin: 100px auto; }
.login-box h1 { text-align: center; }
.error { color: var(--danger); font-size: 13px; margin-bottom: 12px; }

/* Модалка с полным текстом поста */
.post-card-clickable { cursor: pointer; }
.post-card-clickable:hover .snippet { color: var(--accent-2); }
.modal-overlay {
    position: fixed; inset: 0; background: rgba(8, 6, 12, 0.72);
    backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
    display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 20px;
}
.modal-box {
    background: var(--card-solid); border: 1px solid var(--border); border-radius: var(--radius); padding: 28px;
    max-width: 640px; width: 100%; max-height: 85vh; overflow-y: auto; position: relative;
    box-shadow: var(--shadow);
}
.modal-close {
    position: absolute; top: 12px; right: 14px; background: transparent; border: none;
    font-size: 24px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px;
    transition: color .2s ease, transform .2s ease;
}
.modal-close:hover { color: var(--accent-2); transform: rotate(90deg); }

/* Ручное удаление поста (крестик на карточке в календаре) */
.post-card-wrap { position: relative; margin-bottom: 10px; }
.post-delete-btn {
    position: absolute; top: -6px; right: -6px; width: 20px; height: 20px; border-radius: 50%;
    background: var(--danger); color: #fff; border: none; font-size: 14px; line-height: 18px;
    cursor: pointer; opacity: 0; transition: opacity .15s, transform .15s; padding: 0; z-index: 5;
}
.post-card-wrap:hover .post-delete-btn { opacity: 1; }
.post-delete-btn:hover { background: #c23f66; transform: scale(1.08); }

/* Появление блоков при прокрутке */
.reveal {
    opacity: 0; transform: translateY(22px);
    transition: opacity .65s cubic-bezier(.2,.65,.3,1), transform .65s cubic-bezier(.2,.65,.3,1);
}
.reveal.in-view { opacity: 1; transform: translateY(0); }
@media (prefers-reduced-motion: reduce) {
    .reveal { opacity: 1; transform: none; transition: none; }
    .decor-icon-inner { animation: none; }
}
