:root {
    --bg: #f8fafc;
    --panel: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --nav: #1e293b;
    --accent: #3b82f6;
    --accent-glow: rgba(59, 130, 246, 0.15);
    --soft: #f1f5f9;
    --warn: #f59e0b;
    --ok: #10b981;
    --bad: #ef4444;
    --radius-lg: 20px;
    --radius-md: 12px;
    --shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.05), 0 8px 10px -6px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1);
}

* {
    box-sizing: border-box;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    margin: 0;
    background: var(--bg);
    font-family: 'Inter', sans-serif;
    color: var(--ink);
    line-height: 1.5;
}

h1, h2, h3, strong {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
}

/* Sidebar */
.side {
    position: fixed;
    inset: 0 auto 0 0;
    width: 280px;
    background: var(--nav);
    color: #fff;
    padding: 32px 20px;
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.05);
    z-index: 100;
}

.logo {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 40px;
    padding: 0 12px;
}

.mark {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: linear-gradient(135deg, #60a5fa, #3b82f6);
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 900;
    font-size: 20px;
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.3);
}

.logo strong {
    font-size: 20px;
    display: block;
    line-height: 1.1;
}

.logo span {
    font-size: 12px;
    color: #94a3b8;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

nav a {
    display: flex;
    align-items: center;
    color: #94a3b8;
    text-decoration: none;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    margin: 4px 0;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s ease;
}

nav a:hover, nav a.active {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
}

nav a.active {
    background: var(--accent);
    box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.logout-link {
    margin-top: auto;
    color: #fca5a5;
}

/* Main Layout */
.main {
    margin-left: 280px;
    padding: 40px;
    min-height: 100vh;
}

.content-wrapper {
    max-width: 1200px;
    margin: 0 auto;
}

.head {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 32px;
}

.head h1 {
    font-size: 36px;
    margin: 0 0 4px;
    letter-spacing: -0.02em;
    color: #1e293b;
}

.head p {
    color: var(--muted);
    margin: 0;
    font-size: 16px;
}

/* Panels & Cards */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 32px;
    margin-bottom: 24px;
    box-shadow: var(--shadow);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.panel:hover {
    box-shadow: var(--shadow-lg);
}

.cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: 20px;
    margin-bottom: 32px;
}

.card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 24px;
    box-shadow: var(--shadow);
}

.card span {
    color: var(--muted);
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.card strong {
    font-size: 40px;
    display: block;
    margin-top: 8px;
    color: #1e293b;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 12px 24px;
    border-radius: var(--radius-md);
    font-weight: 700;
    font-size: 14px;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s ease;
    border: 1px solid transparent;
}

.btn.dark {
    background: #1e293b;
    color: #fff;
}

.btn.dark:hover {
    background: #0f172a;
    transform: translateY(-1px);
}

.btn.accent {
    background: var(--accent);
    color: #fff;
}

.btn.accent:hover {
    background: #2563eb;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.3);
}

.btn.small {
    padding: 8px 16px;
    font-size: 12px;
}

.btn.bad {
    background: #fef2f2;
    color: var(--bad);
    border-color: #fee2e2;
}

.btn.bad:hover {
    background: var(--bad);
    color: #fff;
}

/* Tables */
table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
}

th {
    text-align: left;
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
    padding: 16px;
    border-bottom: 2px solid var(--line);
}

td {
    padding: 16px;
    border-bottom: 1px solid var(--line);
    font-size: 14px;
    color: #475467;
}

tr:last-child td {
    border-bottom: none;
}

/* Pills */
.pill {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    background: var(--soft);
    color: #475467;
}

.pill.ok { background: #ecfdf3; color: #027a48; }
.pill.bad { background: #fef3f2; color: #b42318; }
.pill.warn { background: #fffbeb; color: #b45309; }

/* Forms */
.gridform {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 24px;
}

.gridform label {
    display: flex;
    flex-direction: column;
    gap: 8px;
    font-weight: 600;
    font-size: 14px;
    color: var(--muted);
}

.gridform .wide {
    grid-column: 1 / -1;
}

.gridform button {
    grid-column: 1 / -1;
    margin-top: 12px;
}

.box {
    background: var(--soft);
    padding: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    margin-bottom: 24px;
}

.inline {
    display: flex;
    gap: 12px;
    background: var(--soft);
    padding: 12px;
    border-radius: var(--radius-md);
    align-items: center;
}

input, textarea, select {
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-family: inherit;
    font-size: 14px;
    outline: none;
    transition: all 0.2s ease;
    background: #fff;
    width: 100%;
}

textarea {
    min-height: 120px;
    resize: vertical;
}

input:focus, textarea:focus, select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.grow { flex: 1; }

/* Flash Messages */
.notice {
    padding: 16px 20px;
    border-radius: var(--radius-md);
    margin-bottom: 24px;
    font-weight: 600;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from { transform: translateY(-20px); opacity: 0; }
    to { transform: translateY(0); opacity: 1; }
}

.notice.success { background: #ecfdf3; color: #027a48; border: 1px solid #abefc6; }
.notice.danger { background: #fef2f2; color: #b42318; border: 1px solid #fecdca; }

/* Chat Interface (Premium Version) */
.chat-shell {
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    height: 70vh;
}

.chat-window {
    flex: 1;
    overflow-y: auto;
    padding: 32px;
    background: #fff;
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.bubble {
    display: flex;
    gap: 16px;
    max-width: 80%;
}

.bubble.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}

.bubble-body {
    padding: 16px 20px;
    border-radius: var(--radius-lg);
    font-size: 15px;
    position: relative;
}

.bubble.assistant .bubble-body {
    background: var(--soft);
    color: #1e293b;
    border-bottom-left-radius: 4px;
}

.bubble.user .bubble-body {
    background: var(--accent);
    color: #fff;
    border-bottom-right-radius: 4px;
}

.chat-input {
    padding: 24px;
    background: #fff;
    border-top: 1px solid var(--line);
    display: flex;
    gap: 12px;
}

/* Layout Utilities */
.split-layout {
    display: grid;
    grid-template-columns: 1.5fr 1fr;
    gap: 32px;
    align-items: start;
}

.media-column {
    display: flex;
    flex-direction: column;
    gap: 24px;
}

.preview-card {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    box-shadow: var(--shadow);
}

.media-container img, .media-container video {
    display: block;
    max-width: 100%;
}

@media (max-width: 1024px) {
    .split-layout {
        grid-template-columns: 1fr;
    }
    .side { width: 80px; padding: 32px 12px; }
    .logo div:last-child, nav a span { display: none; }
    .main { margin-left: 80px; }
    nav a { justify-content: center; padding: 12px; }
}

@media (max-width: 768px) {
    .side { position: static; width: 100%; height: auto; box-shadow: none; }
    .main { margin-left: 0; padding: 20px; }
    .head { flex-direction: column; align-items: flex-start; gap: 16px; }
}

/* v18 Inbox redesign */
.toolbar-clean { background: transparent; padding: 0; }
.inbox-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}
.stat-chip {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 18px;
    padding: 18px 20px;
    box-shadow: var(--shadow);
}
.stat-chip span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.stat-chip strong {
    display: block;
    margin-top: 4px;
    font-size: 28px;
    color: var(--ink);
}
.inbox-panel { padding: 22px; }
.pill-tabs {
    background: #f8fafc;
    border: 1px solid var(--line);
    flex-wrap: wrap;
    margin-bottom: 20px;
}
.pill-tabs a {
    text-decoration: none;
    color: #475569;
    font-weight: 800;
    padding: 9px 14px;
    border-radius: 999px;
    transition: .2s ease;
}
.pill-tabs a:hover, .pill-tabs a.active {
    color: #fff;
    background: #1e293b;
}
.inbox-list { display: grid; gap: 16px; }
.inbox-card {
    border: 1px solid var(--line);
    border-radius: 18px;
    background: #fff;
    padding: 18px;
    box-shadow: 0 6px 18px rgba(15, 23, 42, .04);
}
.inbox-card.status-deleted { opacity: .72; background: #f8fafc; }
.inbox-card-top {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: flex-start;
}
.event-title { font-weight: 900; font-size: 16px; color: #0f172a; }
.event-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 6px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
}
.event-meta span {
    background: #f1f5f9;
    border-radius: 999px;
    padding: 4px 9px;
}
.event-text {
    margin: 16px 0 12px;
    font-size: 15px;
    color: #1e293b;
    white-space: pre-wrap;
}
.event-id {
    display: inline-block;
    font-size: 12px;
    color: #64748b;
    background: #f8fafc;
    border: 1px dashed #cbd5e1;
    padding: 6px 10px;
    border-radius: 999px;
    margin-bottom: 14px;
}
.inbox-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    border-top: 1px solid var(--line);
    padding-top: 14px;
}
.empty-state {
    text-align: center;
    padding: 48px 24px;
    color: var(--muted);
    border: 1px dashed var(--line);
    border-radius: 18px;
    background: #f8fafc;
}
.compact-answer, .ai-answer {
    margin-top: 14px;
    padding: 14px;
    border-radius: 16px;
    background: #f8fafc;
    border: 1px solid var(--line);
}

/* v18 Copilot history polish */
.chat-layout .panel .message-card {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 14px;
    margin-bottom: 10px;
}
.chat-layout .panel .message-card.active {
    border-color: var(--accent);
    box-shadow: 0 0 0 4px var(--accent-glow);
}
.bubble-body p { white-space: pre-wrap; }
@media (max-width: 980px) {
    .chat-layout { grid-template-columns: 1fr !important; }
    .bubble { max-width: 100%; }
}
/* v19 multi-entity additions */
.entity-switcher{background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.08);border-radius:16px;padding:14px;margin:0 0 22px;color:#fff}.entity-switcher .mini-label{font-size:11px;color:#94a3b8;text-transform:uppercase;font-weight:800;letter-spacing:.06em}.entity-switcher strong{display:block;font-size:16px}.entity-switcher span{display:block;color:#cbd5e1;font-size:12px}.entity-list{display:flex;flex-wrap:wrap;gap:6px;margin-top:12px}.entity-chip{border:0;border-radius:999px;padding:6px 10px;background:rgba(255,255,255,.08);color:#cbd5e1;font-weight:700;cursor:pointer}.entity-chip.on{background:#3b82f6;color:white}.entity-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(280px,1fr));gap:18px}.entity-card{background:#fff;border:1px solid var(--line);border-radius:18px;padding:20px;box-shadow:var(--shadow)}.entity-card.active{border-color:var(--accent);box-shadow:0 0 0 4px var(--accent-glow),var(--shadow)}.entity-card summary{cursor:pointer;list-style:none}.entity-card-head{display:flex;justify-content:space-between;gap:12px;align-items:flex-start}.entity-card h3{margin:0 0 6px}.entity-card p{color:var(--muted);font-size:14px}.mini-stats{display:grid;grid-template-columns:repeat(2,1fr);gap:8px;margin:14px 0}.mini-stats span{background:var(--soft);border-radius:12px;padding:10px;color:var(--muted);font-size:12px}.mini-stats b{display:block;color:var(--ink);font-size:18px}.btn.small{padding:8px 12px;font-size:12px}.inline.compact{gap:8px;flex-wrap:wrap}.compact-form textarea{min-height:84px}.rules-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px;margin-top:18px}.entity-strip{display:flex;align-items:center;justify-content:space-between;gap:14px;padding:18px 22px}.message-card.active{background:var(--soft);border-radius:12px}.chat-window{max-height:68vh;overflow-y:auto}.bubble-body p{white-space:pre-wrap}.pill.ok{background:#ecfdf5;color:#047857}.pill.warn{background:#fffbeb;color:#b45309}.pill.bad{background:#fef2f2;color:#b91c1c}.danger{background:#fee2e2;color:#991b1b}.grow{flex:1}

/* V20 clean multi-entity navigation */
.entity-home-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(310px, 1fr));
    gap: 22px;
    align-items: stretch;
}
.entity-home-card {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    padding: 26px;
    box-shadow: var(--shadow);
    display: flex;
    flex-direction: column;
    gap: 16px;
    min-height: 280px;
}
.entity-home-card.active {
    border-color: rgba(59,130,246,.55);
    box-shadow: 0 0 0 4px rgba(59,130,246,.10), var(--shadow-lg);
}
.entity-home-card.add-card {
    background: linear-gradient(180deg, #ffffff, #f8fafc);
    border-style: dashed;
}
.entity-card-top {
    display: flex;
    gap: 14px;
    align-items: center;
}
.entity-card-top h2 { margin: 0; font-size: 24px; }
.entity-avatar {
    width: 52px;
    height: 52px;
    border-radius: 16px;
    display: grid;
    place-items: center;
    color: white;
    font-weight: 900;
    background: linear-gradient(135deg, #3b82f6, #1e293b);
    box-shadow: var(--shadow);
}
.entity-desc { color: #334155; min-height: 52px; margin: 0; }
.entity-stats-mini {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
}
.entity-stats-mini span {
    background: var(--soft);
    border-radius: 12px;
    padding: 10px 12px;
    color: var(--muted);
    font-size: 13px;
}
.entity-stats-mini strong {
    display: block;
    color: var(--ink);
    font-size: 22px;
}
.entity-card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: auto;
}
.stack-form { display: grid; gap: 12px; }
.stack-form input, .stack-form select, .stack-form textarea,
.gridform input, .gridform select, .gridform textarea, .chat-input input {
    width: 100%;
}
.entity-overview-panel .gridform { margin-top: 22px; }
.inbox-list { display: grid; gap: 14px; }
.inbox-item {
    border: 1px solid var(--line);
    background: #fff;
    border-radius: 18px;
    padding: 18px;
}
.inbox-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 10px;
}
.inbox-text { font-size: 16px; color: var(--ink); white-space: pre-wrap; }
.tabs { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 18px; }
.tabs a { background: var(--soft); padding: 8px 12px; border-radius: 999px; font-weight: 700; text-decoration: none; }
.ai-reply { margin-top: 14px; padding: 14px; border-radius: 14px; background: #f8fafc; border: 1px solid var(--line); }
.ai-reply textarea { width: 100%; min-height: 90px; margin: 8px 0; }
@media (max-width: 900px) {
    .entity-home-grid { grid-template-columns: 1fr; }
    .chat-layout { grid-template-columns: 1fr !important; }
}

/* V21 structure cleanup */
.clean-cards .entity-home-card { min-height: 245px; text-decoration: none; color: inherit; position: relative; }
.entity-link-card { cursor: pointer; transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease; }
.entity-link-card:hover { transform: translateY(-3px); border-color: rgba(59,130,246,.45); box-shadow: var(--shadow-lg); }
.entity-link-card .card-arrow { margin-top: auto; font-weight: 900; color: var(--accent); }
.add-entity-card { text-align: left; border: 1px dashed #cbd5e1; }
.entity-avatar.plus { background: linear-gradient(135deg,#22c55e,#0f172a); }
.side .entity-switcher { display:none !important; }
.status-row { display:flex; gap:10px; align-items:center; flex-wrap:wrap; }
.toolbar-clean { background: transparent !important; padding: 0 !important; }
.metric-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(160px,1fr)); gap:16px; margin-bottom:24px; }
.metric-card { background:#fff; border:1px solid var(--line); border-radius:18px; padding:20px; box-shadow:var(--shadow); }
.metric-card span { display:block; color:var(--muted); font-size:12px; font-weight:900; text-transform:uppercase; letter-spacing:.05em; }
.metric-card strong { display:block; font-size:30px; color:var(--ink); margin-top:6px; }
.chart-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(360px,1fr)); gap:20px; }
.chart-panel canvas { margin-top:16px; }
.pretty-settings { display:grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap:14px; align-items:center; }
.pretty-settings .toggle { background:#f8fafc; border:1px solid var(--line); border-radius:16px; padding:14px 16px; display:flex; gap:10px; align-items:center; font-weight:800; color:#334155; }
.pretty-settings button { justify-self:start; }
.modal-backdrop { position:fixed; inset:0; z-index:2000; background:rgba(15,23,42,.48); backdrop-filter: blur(6px); display:none; align-items:center; justify-content:center; padding:24px; }
.modal-backdrop.show { display:flex; }
.modal-card { width:min(620px,96vw); max-height:90vh; overflow:auto; background:#fff; border:1px solid var(--line); border-radius:24px; padding:28px; box-shadow:var(--shadow-lg); position:relative; }
.modal-card.wide-modal { width:min(960px,96vw); }
.modal-close { position:absolute; top:14px; right:16px; border:0; background:#f1f5f9; color:#0f172a; border-radius:999px; width:34px; height:34px; font-size:22px; cursor:pointer; }
.two-options { display:grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap:18px; margin-top:20px; }
.option-card { border:1px solid var(--line); border-radius:18px; padding:20px; background:#f8fafc; }
.upload-line { flex-wrap:wrap; }
.knowledge-hero .gridform { margin-top:22px; }
.section-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(320px,1fr)); gap:18px; margin:18px 0 22px; }
.section-box { display:flex; flex-direction:column; gap:8px; background:#f8fafc; border:1px solid var(--line); border-radius:18px; padding:16px; }
.section-box.priority { background:#fff; border-color:rgba(59,130,246,.35); box-shadow:0 0 0 4px rgba(59,130,246,.06); }
.section-box span { font-weight:900; color:#0f172a; }
.section-box textarea { min-height:160px; background:#fff; }
.section-box small { color:var(--muted); font-weight:700; }
.nested-panel { box-shadow:none; margin-top:12px; }
@media (max-width: 820px) { .chart-grid { grid-template-columns:1fr; } .metric-grid { grid-template-columns:repeat(2,1fr); } }

/* V22 interface refinements */
.center-actions{display:flex;justify-content:center;align-items:center;margin-top:18px;gap:12px}.section-title-row{display:flex;justify-content:space-between;align-items:center;gap:16px;margin-bottom:18px}.section-grid-two{grid-template-columns:repeat(2,minmax(0,1fr))}.section-grid-two .section-box textarea{min-height:155px}.dirty-submit:disabled{opacity:.45;cursor:not-allowed}.dirty-submit.enabled{opacity:1}.editable-list{display:grid;gap:18px}.editable-card{position:relative;background:#fff;border:1px solid var(--line);border-radius:20px;padding:18px;box-shadow:var(--shadow)}.editable-card-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}.editable-card-head h3{margin:0;font-size:18px}.x-delete{border:0;background:#fee2e2;color:#991b1b;width:34px;height:34px;border-radius:999px;font-size:22px;font-weight:900;line-height:1;cursor:pointer;display:grid;place-items:center}.x-delete:hover{background:#fecaca}.faq-list,.rules-list{grid-template-columns:repeat(auto-fit,minmax(360px,1fr))}.faq-card label{display:block;margin-bottom:12px}.faq-card textarea,.editable-card textarea{width:100%}.knowledge-hero .wide{grid-column:1/-1}.v22-settings{grid-template-columns:repeat(auto-fit,minmax(240px,1fr)) auto}.switch-card{display:flex!important;align-items:center!important;gap:14px!important;background:#f8fafc!important;border:1px solid var(--line)!important;border-radius:18px!important;padding:16px!important;min-height:84px}.switch-card input{display:none}.switch-ui{width:46px;height:26px;background:#cbd5e1;border-radius:999px;position:relative;flex:0 0 auto;transition:.2s}.switch-ui:after{content:"";position:absolute;width:20px;height:20px;left:3px;top:3px;background:#fff;border-radius:50%;box-shadow:0 2px 6px rgba(15,23,42,.22);transition:.2s}.switch-card input:checked+.switch-ui{background:#3b82f6}.switch-card input:checked+.switch-ui:after{transform:translateX(20px)}.switch-card strong{display:block;color:#0f172a}.switch-card small{display:block;color:#64748b;margin-top:3px}.inbox-item .btn.dark,.connect-card .btn.dark,header .btn.dark{box-shadow:var(--shadow)}.toolbar-clean .btn.dark{min-width:190px}.knowledge-hero input[type="checkbox"]{display:none!important}@media(max-width:920px){.section-grid-two{grid-template-columns:1fr}.v22-settings{grid-template-columns:1fr}.faq-list,.rules-list{grid-template-columns:1fr}.section-title-row{align-items:flex-start;flex-direction:column}.toolbar-clean .btn.dark{min-width:0;width:100%}}

/* V23 knowledge accordions */
.accordion-list { display: grid; gap: 12px; }
.accordion-card { border: 1px solid var(--line); border-radius: 18px; background: #fff; overflow: hidden; box-shadow: 0 8px 20px rgba(15, 23, 42, .04); }
.accordion-card summary { cursor: pointer; list-style: none; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 18px 20px; font-weight: 800; }
.accordion-card summary::-webkit-details-marker { display: none; }
.accordion-card summary:after { content: '+'; min-width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border-radius: 999px; background: #eef2ff; color: #2563eb; font-weight: 900; }
.accordion-card[open] summary:after { content: '−'; background: #dbeafe; }
.accordion-card summary span { flex: 1; color: #0f172a; }
.accordion-card summary small { flex: 1; color: #64748b; font-weight: 600; text-align: right; line-height: 1.35; }
.accordion-card form { padding: 0 20px 20px; border-top: 1px solid #eef2f7; }
.split-actions { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px; }
.split-actions.wide { grid-column: 1 / -1; }
.x-delete { border: 0; width: 42px; height: 42px; border-radius: 999px; background: #fee2e2; color: #b91c1c; font-size: 24px; font-weight: 900; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.x-delete:hover { background: #fecaca; transform: translateY(-1px); }
.dirty-submit:disabled { opacity: .45; cursor: not-allowed; }
.dirty-submit.enabled { opacity: 1; cursor: pointer; }
@media (max-width: 760px) { .accordion-card summary { flex-direction: column; align-items: flex-start; } .accordion-card summary small { text-align: left; } }

/* V25 UI polish */
.faq-list .accordion-card summary small{display:none!important}
.faq-list .accordion-card summary span{font-size:16px;line-height:1.35;max-width:calc(100% - 48px)}
.rules-list .accordion-card summary{min-height:88px;align-items:center;background:linear-gradient(180deg,#fff,#fbfdff)}
.rules-list .accordion-card summary span{font-size:15px;line-height:1.45;font-weight:750;color:#0f172a;max-width:calc(100% - 48px)}
.rules-list .accordion-card summary small{display:none!important}
.rules-list .accordion-card form{background:#fff}
.accordion-card.rule-card summary span{width:100%}
.pretty-settings.v22-settings{display:grid;grid-template-columns:repeat(auto-fit,minmax(230px,1fr));align-items:stretch;gap:16px}
.pretty-settings.v22-settings .btn{align-self:center;min-height:54px;width:max-content;padding-inline:28px}
.switch-card{justify-content:flex-start}
.switch-card strong{font-size:15px}.switch-card small{font-size:12px}
@media(max-width:760px){.pretty-settings.v22-settings .btn{width:100%}.rules-list .accordion-card summary span,.faq-list .accordion-card summary span{max-width:100%}}

/* V26 Copilot history redesign */
.pro-chat-layout{display:grid;grid-template-columns:300px 1fr;gap:20px;align-items:stretch;min-height:70vh}.conversation-panel{padding:24px;position:sticky;top:24px;height:70vh;display:flex;flex-direction:column;overflow:hidden}.conversation-panel-head{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-bottom:16px}.conversation-panel-head h3{margin:0;font-size:18px}.conversation-panel-head span{min-width:28px;height:28px;border-radius:999px;background:var(--soft);color:var(--muted);font-weight:800;display:grid;place-items:center}.conversation-list{overflow-y:auto;padding-right:6px;display:flex;flex-direction:column;gap:10px;scrollbar-width:thin;scrollbar-color:#cbd5e1 transparent}.conversation-list::-webkit-scrollbar,.pro-chat-window::-webkit-scrollbar{width:8px}.conversation-list::-webkit-scrollbar-thumb,.pro-chat-window::-webkit-scrollbar-thumb{background:#cbd5e1;border-radius:999px}.conversation-list::-webkit-scrollbar-track,.pro-chat-window::-webkit-scrollbar-track{background:transparent}.conversation-item{display:block;text-decoration:none;color:var(--ink);border:1px solid var(--line);border-radius:16px;padding:14px 14px;background:#fff;transition:.18s ease;box-shadow:0 2px 8px rgba(15,23,42,.03)}.conversation-item:hover{transform:translateY(-1px);border-color:#bfdbfe;background:#f8fbff}.conversation-item.active{border-color:var(--accent);box-shadow:0 0 0 3px var(--accent-glow);background:#f8fbff}.conversation-item strong{display:block;font-size:14px;line-height:1.35;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.conversation-item small{display:block;margin-top:6px;color:var(--muted);font-size:12px}.pro-chat-shell{height:70vh;border:1px solid var(--line);box-shadow:var(--shadow);background:#fff}.pro-chat-window{max-height:none}.pro-chat-input{padding:18px 22px}.copilot-actions{flex-wrap:wrap}.copilot-head{align-items:center}@media(max-width:900px){.pro-chat-layout{grid-template-columns:1fr}.conversation-panel{position:relative;height:280px}.pro-chat-shell{height:68vh}}

/* V27 polish */
.conversation-panel { max-height: calc(100vh - 190px); overflow: hidden; display: flex; flex-direction: column; }
.conversation-panel .conversation-list { overflow-y: auto; padding-right: 6px; max-height: calc(100vh - 300px); }
.conversation-panel .conversation-list::-webkit-scrollbar { width: 8px; }
.conversation-panel .conversation-list::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 999px; }
.conversation-panel .conversation-list::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 999px; }
.conversation-item strong { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.instagram-clean-panel { padding: 34px; }
.ig-profile-card { display: flex; gap: 22px; align-items: flex-start; }
.ig-avatar { width: 64px; height: 64px; border-radius: 20px; background: linear-gradient(135deg,#1e293b,#3b82f6); color:#fff; display:grid; place-items:center; font-weight:900; font-size:26px; box-shadow: 0 12px 22px rgba(59,130,246,.22); flex:0 0 auto; }
.muted-avatar { background: #e2e8f0; color: #475569; box-shadow: none; }
.ig-profile-main { flex: 1; }
.eyebrow { display:inline-block; font-size:12px; text-transform:uppercase; letter-spacing:.08em; color:#64748b; font-weight:800; margin-bottom:4px; }
.ig-profile-main h2 { margin:0 0 18px; font-size:28px; color:#0f172a; }
.ig-meta-grid { display:grid; grid-template-columns: repeat(3, minmax(170px,1fr)); gap:14px; }
.ig-meta-grid div { background:#f8fafc; border:1px solid #e2e8f0; border-radius:16px; padding:16px; }
.ig-meta-grid span { display:block; color:#64748b; font-size:13px; font-weight:700; margin-bottom:6px; }
.ig-meta-grid strong { font-size:15px; word-break:break-word; }
.ig-action-row { margin-top:26px; display:flex; justify-content:flex-start; }
.ig-empty-state { display:flex; gap:22px; align-items:flex-start; }
.ig-empty-state h2 { margin-top:0; }
.login-page-v27 { min-height:100vh; margin:0; background: radial-gradient(circle at top left, rgba(59,130,246,.2), transparent 34%), linear-gradient(135deg,#0f172a 0%,#1e293b 48%,#f8fafc 48%,#f8fafc 100%); display:grid; place-items:center; padding:32px; font-family:'Inter',sans-serif; }
.login-shell-v27 { width:min(1080px, 100%); display:grid; grid-template-columns: 1.1fr .9fr; gap:28px; align-items:stretch; }
.login-brand-v27 { color:#fff; padding:52px; border-radius:32px; background:rgba(15,23,42,.72); border:1px solid rgba(255,255,255,.12); box-shadow:0 28px 70px rgba(15,23,42,.28); min-height:520px; display:flex; flex-direction:column; justify-content:center; }
.login-logo-v27 { width:62px; height:62px; border-radius:18px; background:linear-gradient(135deg,#60a5fa,#3b82f6); display:grid; place-items:center; font-size:28px; font-weight:900; margin-bottom:24px; box-shadow:0 16px 32px rgba(59,130,246,.32); }
.login-kicker-v27 { text-transform:uppercase; letter-spacing:.12em; color:#93c5fd; font-size:12px; font-weight:900; margin:0 0 12px; }
.login-brand-v27 h1 { font-size:48px; margin:0 0 14px; letter-spacing:-.04em; color:#fff; }
.login-brand-v27 p { color:#cbd5e1; font-size:17px; line-height:1.7; max-width:560px; }
.login-features-v27 { display:flex; flex-wrap:wrap; gap:10px; margin-top:28px; }
.login-features-v27 span { background:rgba(255,255,255,.09); border:1px solid rgba(255,255,255,.12); padding:10px 14px; border-radius:999px; color:#dbeafe; font-weight:800; font-size:13px; }
.login-card-v27 { background:#fff; border:1px solid #e2e8f0; border-radius:32px; padding:44px; box-shadow:0 28px 70px rgba(15,23,42,.14); display:flex; align-items:center; }
.login-card-v27 form { width:100%; }
.login-card-v27 h2 { font-size:34px; margin:0 0 6px; letter-spacing:-.03em; }
.login-card-v27 p { color:#64748b; margin:0 0 28px; }
.login-card-v27 label { display:block; font-weight:800; color:#334155; margin-bottom:18px; }
.login-card-v27 input { display:block; width:100%; margin-top:8px; border:1px solid #dbe3ee; background:#f8fafc; border-radius:16px; padding:15px 16px; font-size:15px; outline:none; transition:.2s; }
.login-card-v27 input:focus { border-color:#3b82f6; box-shadow:0 0 0 4px rgba(59,130,246,.12); background:#fff; }
.login-submit-v27 { width:100%; margin-top:8px; min-height:52px; border-radius:16px; }
@media(max-width: 860px){ .login-shell-v27{grid-template-columns:1fr;} .login-brand-v27{min-height:auto;padding:34px;} .login-card-v27{padding:30px;} .ig-meta-grid{grid-template-columns:1fr;} }

/* V31 content detail cleanup + entity logo */
.logo-upload-card{margin-top:18px;border:1px solid var(--line);background:#f8fbff;border-radius:22px;padding:16px;display:grid;grid-template-columns:76px 1fr auto;gap:16px;align-items:center}.logo-preview{width:76px;height:76px;border-radius:20px;background:linear-gradient(135deg,#2563eb,#1e3a8a);display:grid;place-items:center;color:#fff;font-weight:900;font-size:28px;overflow:hidden;box-shadow:0 10px 24px rgba(37,99,235,.18)}.logo-preview img{width:100%;height:100%;object-fit:contain;background:#fff;padding:8px}.logo-upload-card h3{margin:0 0 4px;font-size:17px}.logo-upload-form{display:flex;gap:10px;align-items:center;flex-wrap:wrap;justify-content:flex-end}.logo-upload-form input[type=file]{max-width:240px;background:#fff;border:1px solid var(--line);border-radius:14px;padding:10px}.ai-image-preview{overflow:hidden;border-radius:var(--radius-md)}.ai-image-preview img{min-height:160px;object-fit:cover}.media-column .panel h2{letter-spacing:-.02em}@media(max-width:820px){.logo-upload-card{grid-template-columns:1fr}.logo-upload-form{justify-content:flex-start}.logo-preview{width:64px;height:64px}}

/* V36 Welcome workspace selector */
.welcome-body{
    min-height:100vh;
    margin:0;
    background:
        radial-gradient(circle at 10% 10%, rgba(59,130,246,.16), transparent 28%),
        radial-gradient(circle at 90% 8%, rgba(16,185,129,.13), transparent 28%),
        linear-gradient(135deg,#f8fafc 0%,#eef6ff 52%,#f8fafc 100%);
    overflow-x:hidden;
}
.welcome-bg-orb{position:fixed;border-radius:999px;filter:blur(14px);opacity:.35;pointer-events:none;animation:floatOrb 12s ease-in-out infinite alternate}.orb-a{width:380px;height:380px;background:#bfdbfe;left:-120px;top:80px}.orb-b{width:320px;height:320px;background:#bbf7d0;right:-90px;bottom:70px;animation-delay:1.8s}@keyframes floatOrb{from{transform:translate3d(0,0,0) scale(1)}to{transform:translate3d(28px,-22px,0) scale(1.08)}}
.welcome-shell{width:min(1220px,94vw);margin:0 auto;padding:34px 0 56px;position:relative;z-index:1}.welcome-hero{display:flex;justify-content:space-between;align-items:center;gap:18px;margin-bottom:58px}.welcome-brand{display:flex;align-items:center;gap:14px}.welcome-brand-mark{width:52px;height:52px;border-radius:18px;background:linear-gradient(135deg,#3b82f6,#0f172a);color:white;display:grid;place-items:center;font-weight:900;font-size:22px;box-shadow:0 18px 32px rgba(59,130,246,.25)}.welcome-brand strong{display:block;font-size:22px;color:#0f172a}.welcome-brand span{display:block;font-size:12px;text-transform:uppercase;letter-spacing:.12em;color:#64748b;font-weight:800}.welcome-logout{display:inline-flex;align-items:center;justify-content:center;padding:12px 18px;border-radius:999px;background:rgba(255,255,255,.72);border:1px solid rgba(226,232,240,.9);color:#334155;text-decoration:none;font-weight:800;box-shadow:0 12px 24px rgba(15,23,42,.06);backdrop-filter:blur(10px)}
.welcome-intro{max-width:860px;margin-bottom:34px}.welcome-intro .eyebrow{font-size:13px;text-transform:uppercase;letter-spacing:.14em;font-weight:900;color:#2563eb;margin:0 0 12px}.welcome-intro h1{font-size:clamp(28px,4.2vw,48px);line-height:1.08;letter-spacing:-.04em;margin:0;color:#0f172a;max-width:820px}.welcome-intro p{max-width:780px;color:#475569;font-size:17px;line-height:1.72;margin:18px 0 0}.welcome-grid{display:grid;grid-template-columns:repeat(auto-fit,minmax(310px,1fr));gap:24px;align-items:stretch}.welcome-card{appearance:none;text-align:left;text-decoration:none;color:inherit;background:rgba(255,255,255,.82);border:1px solid rgba(203,213,225,.9);border-radius:28px;padding:28px;min-height:310px;box-shadow:0 22px 46px rgba(15,23,42,.08);backdrop-filter:blur(14px);display:flex;flex-direction:column;gap:18px;cursor:pointer;position:relative;overflow:hidden;animation:riseIn .62s cubic-bezier(.2,.7,.2,1) both;animation-delay:var(--delay,0ms);transition:transform .22s ease,box-shadow .22s ease,border-color .22s ease}.welcome-card:before{content:"";position:absolute;inset:0;background:linear-gradient(135deg,rgba(59,130,246,.10),transparent 42%);opacity:0;transition:.22s}.welcome-card:hover{transform:translateY(-6px);border-color:rgba(59,130,246,.55);box-shadow:0 30px 70px rgba(15,23,42,.14)}.welcome-card:hover:before{opacity:1}.welcome-card-head{position:relative;display:flex;gap:16px;align-items:center}.welcome-avatar{width:64px;height:64px;border-radius:22px;background:linear-gradient(135deg,#3b82f6,#0f172a);display:grid;place-items:center;box-shadow:0 16px 28px rgba(37,99,235,.22);overflow:hidden;flex:0 0 auto}.welcome-avatar img{width:100%;height:100%;object-fit:contain;background:white;padding:8px}.welcome-avatar span{font-size:24px;font-weight:900;color:white}.welcome-avatar.add{background:linear-gradient(135deg,#22c55e,#064e3b)}.welcome-card h2{margin:0;font-size:28px;letter-spacing:-.025em;line-height:1.12}.welcome-card p{margin:0}.welcome-card-head p{font-weight:700;color:#64748b}.welcome-desc{position:relative;color:#334155;font-size:16px;line-height:1.62;min-height:76px}.welcome-card-meta{display:grid;grid-template-columns:repeat(2,1fr);gap:10px;position:relative}.welcome-card-meta span{background:#f1f5f9;border:1px solid #e2e8f0;border-radius:15px;padding:10px 12px;font-weight:800;color:#475569;font-size:13px}.welcome-open{position:relative;margin-top:auto;color:#2563eb;font-weight:900}.welcome-open.green{color:#059669}.welcome-add-card{border:1px dashed rgba(16,185,129,.55);background:linear-gradient(180deg,rgba(255,255,255,.78),rgba(240,253,244,.82))}.welcome-flash{margin-bottom:18px}.welcome-modal{border-radius:30px}.optional-instagram-box{background:#f8fafc;border:1px solid #e2e8f0;border-radius:20px;padding:18px}.optional-instagram-box h3{margin:0 0 4px}.modal-actions-row{display:flex;justify-content:flex-end;margin-top:6px}@keyframes riseIn{from{opacity:0;transform:translateY(18px) scale(.98)}to{opacity:1;transform:translateY(0) scale(1)}}@media(max-width:720px){.welcome-hero{align-items:flex-start;flex-direction:column;margin-bottom:34px}.welcome-grid{grid-template-columns:1fr}.welcome-card{min-height:0}.welcome-card-meta{grid-template-columns:1fr 1fr}.welcome-shell{padding-top:24px}.welcome-intro h1{font-size:32px;line-height:1.12}.welcome-intro p{font-size:16px}}


/* FINAL UI polish */
.welcome-body{background:radial-gradient(circle at 12% 4%,#eff6ff 0,#f8fafc 34%,#fff 100%);font-family:Inter,system-ui,sans-serif;color:#0f172a;}
.welcome-shell{width:min(1180px,92vw);padding-top:42px;}
.welcome-hero{background:rgba(255,255,255,.72);border:1px solid rgba(226,232,240,.9);box-shadow:0 18px 50px rgba(15,23,42,.06);border-radius:26px;padding:14px 18px;margin-bottom:54px;backdrop-filter:blur(18px)}
.welcome-brand-mark{background:linear-gradient(145deg,#111827,#334155);box-shadow:0 14px 30px rgba(15,23,42,.18)}
.welcome-intro{max-width:900px;margin-bottom:34px;}
.welcome-intro h1{font-family:Outfit,Inter,sans-serif;font-size:clamp(34px,4.8vw,58px);line-height:1.02;letter-spacing:-.045em;max-width:900px;}
.welcome-intro p{font-size:18px;line-height:1.7;max-width:820px;color:#475569;}
.welcome-card{border-radius:30px;background:rgba(255,255,255,.88);border-color:rgba(203,213,225,.95);box-shadow:0 26px 60px rgba(15,23,42,.09);min-height:330px;}
.welcome-card:hover{transform:translateY(-7px);box-shadow:0 34px 82px rgba(15,23,42,.14)}
.welcome-avatar{width:68px;height:68px;border-radius:24px;background:linear-gradient(145deg,#1d4ed8,#111827)}
.welcome-avatar img{padding:9px;object-fit:contain;}
.welcome-card h2{font-family:Outfit,Inter,sans-serif;font-size:30px;}
.welcome-card-meta span{background:#f8fafc;border-color:#e5e7eb;color:#334155;}
.content-wrapper .panel{box-shadow:0 16px 44px rgba(15,23,42,.06)}
.preview-card img{box-shadow:0 16px 44px rgba(15,23,42,.10)}

/* V42 adaptive marketing calendar */
.calendar-actions { gap: 10px; align-items: center; flex-wrap: wrap; }
.calendar-actions input { min-width: 340px; }
.calendar-grid-v42 { display: grid; grid-template-columns: minmax(240px, 320px) 1fr; gap: 22px; align-items: start; }
.calendar-side-v42 p { line-height: 1.7; }
.mini-kpis-v42 { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 18px 0; }
.mini-kpis-v42 div { border: 1px solid var(--line); border-radius: 16px; padding: 14px; background: var(--soft); }
.mini-kpis-v42 strong { display: block; font-size: 28px; color: var(--text); }
.mini-kpis-v42 span { color: var(--muted); font-size: 13px; }
.calendar-main-v42 { min-height: 560px; }
.calendar-head-row-v42 { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; }
.timeline-v42 { display: grid; gap: 14px; }
.calendar-item-v42 { display: grid; grid-template-columns: 92px 1fr; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: 22px; text-decoration: none; color: inherit; background: #fff; box-shadow: 0 10px 24px rgba(15,30,53,.06); transition: transform .15s ease, box-shadow .15s ease; }
.calendar-item-v42:hover { transform: translateY(-2px); box-shadow: 0 16px 34px rgba(15,30,53,.10); }
.calendar-date-v42 { border-radius: 18px; background: var(--soft); display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 86px; }
.calendar-date-v42 strong { font-size: 22px; }
.calendar-date-v42 span { color: var(--muted); font-weight: 700; }
.calendar-meta-v42 { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.calendar-body-v42 h3 { margin: 0 0 6px; }
.calendar-body-v42 p { margin: 0 0 8px; color: var(--text); line-height: 1.55; }
.calendar-body-v42 small { color: var(--muted); line-height: 1.5; display: block; }
.empty-calendar-v42 { border: 1px dashed var(--line); border-radius: 22px; padding: 40px; text-align: center; background: var(--soft); }
.status-approved { border-color: rgba(0,128,96,.28); }
.status-published { opacity: .75; }
.status-planned { border-color: rgba(71,99,255,.22); }
.action-center-v42 { margin-top: 16px; }
.action-card-v42 { border: 1px solid var(--line); border-radius: 18px; padding: 14px; margin-top: 10px; background: var(--soft); }
.action-card-v42 header { display: flex; justify-content: space-between; gap: 10px; align-items: center; margin-bottom: 8px; }
.action-card-v42 p { white-space: pre-wrap; color: var(--muted); font-size: 13px; }
@media (max-width: 960px) { .calendar-grid-v42 { grid-template-columns: 1fr; } .calendar-actions input { min-width: 100%; } .calendar-item-v42 { grid-template-columns: 1fr; } }
.pro-chat-layout{grid-template-columns:300px minmax(420px,1fr) minmax(260px,340px)}
.action-center-v42{height:70vh;overflow:auto;position:sticky;top:24px}
@media(max-width:1180px){.pro-chat-layout{grid-template-columns:1fr}.action-center-v42{height:auto;position:relative;top:auto}}

/* V43 simplified copilote layout: no action-validation side panel inside the chat page. */
.copilot-only-layout{grid-template-columns:300px minmax(420px,1fr)!important;}
@media(max-width:1180px){.copilot-only-layout{grid-template-columns:1fr!important;}}
