/* ===========================
   PostPilot AI — Complete Stylesheet
   v2.0 — All features included
   =========================== */

/* === RESET & BASE === */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
    background: #F4F6F9;
    color: #1A1A2E;
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: #0A66C2; text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

/* === OVERLAY / ONBOARDING === */
.overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: linear-gradient(135deg, #0A66C2 0%, #004182 100%);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow-y: auto;
    padding: 20px;
}

.ob-container {
    background: #fff;
    border-radius: 20px;
    padding: 40px;
    max-width: 600px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,.3);
}

.ob-header {
    text-align: center;
    margin-bottom: 30px;
}

.ob-logo {
    font-size: 2rem;
    font-weight: 800;
    color: #0A66C2;
}

.ob-sub {
    color: #666;
    font-size: .95rem;
    margin-top: 4px;
}

.ob-step {
    display: none;
}

.ob-step.active {
    display: block;
}

.step-badge {
    display: inline-block;
    background: #E3F2FD;
    color: #0A66C2;
    padding: 4px 14px;
    border-radius: 50px;
    font-size: .75rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.ob-step h2 {
    font-size: 1.5rem;
    margin-bottom: 8px;
    color: #1A1A2E;
}

.ob-step > p {
    color: #555;
    font-size: .92rem;
    margin-bottom: 24px;
    line-height: 1.5;
}

.ob-actions {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
}

/* === FORM ELEMENTS === */
.input-group {
    margin-bottom: 18px;
}

.input-group label {
    display: block;
    font-weight: 600;
    font-size: .85rem;
    color: #333;
    margin-bottom: 6px;
}

.input-group input,
.input-group textarea,
.input-group select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-family: inherit;
    font-size: .9rem;
    color: #1A1A2E;
    background: #fff;
    transition: border-color .2s;
}

.input-group input:focus,
.input-group textarea:focus,
.input-group select:focus {
    outline: none;
    border-color: #0A66C2;
    box-shadow: 0 0 0 3px rgba(10, 102, 194, .1);
}

.input-group textarea {
    resize: vertical;
    min-height: 80px;
}

.hint {
    font-size: .78rem;
    color: #888;
    margin-top: 4px;
}

/* === BUTTONS === */
.btn-primary {
    background: #0A66C2;
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 10px;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}

.btn-primary:hover { background: #004182; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.btn-lg { padding: 14px 28px; font-size: 1rem; }
.btn-full { width: 100%; }

.btn-ghost {
    background: transparent;
    color: #0A66C2;
    border: 2px solid #E0E0E0;
    padding: 10px 22px;
    border-radius: 10px;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
}

.btn-ghost:hover { border-color: #0A66C2; background: #F4F8FF; }

.btn-sm {
    background: #F4F6F9;
    color: #333;
    border: 1px solid #E0E0E0;
    padding: 6px 14px;
    border-radius: 8px;
    font-family: inherit;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}

.btn-sm:hover { background: #E8E8E8; }

.btn-success {
    background: #2E7D32;
    color: #fff;
    border: none;
    padding: 6px 14px;
    border-radius: 8px;
    font-family: inherit;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-success:hover { background: #1B5E20; }

.btn-danger {
    background: #C62828;
    color: #fff;
    border: none;
    padding: 10px 22px;
    border-radius: 10px;
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
}

.btn-danger:hover { background: #B71C1C; }

.btn-outline-sm {
    background: transparent;
    color: #555;
    border: 1px solid #E0E0E0;
    padding: 6px 14px;
    border-radius: 8px;
    font-family: inherit;
    font-size: .8rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
}

.btn-outline-sm:hover { border-color: #0A66C2; color: #0A66C2; }

.btn-action {
    display: block;
    width: 100%;
    text-align: left;
    background: #FAFBFC;
    border: 1px solid #E8E8E8;
    border-radius: 10px;
    padding: 12px 16px;
    font-family: inherit;
    font-size: .88rem;
    font-weight: 500;
    cursor: pointer;
    transition: all .15s;
    color: #333;
    margin-bottom: 8px;
}

.btn-action:hover { background: #E3F2FD; border-color: #0A66C2; color: #0A66C2; }

/* === LOADER === */
.loader-container {
    text-align: center;
    padding: 40px 20px;
}

.loader-container p {
    color: #888;
    font-size: .88rem;
    margin-top: 16px;
}

.loader {
    width: 40px;
    height: 40px;
    border: 4px solid #E0E0E0;
    border-top-color: #0A66C2;
    border-radius: 50%;
    animation: spin .8s linear infinite;
    margin: 0 auto;
}

@keyframes spin { to { transform: rotate(360deg); } }

.inline-loader {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.dot-pulse {
    display: inline-flex;
    gap: 4px;
}

.dot-pulse span {
    width: 6px;
    height: 6px;
    background: #0A66C2;
    border-radius: 50%;
    animation: dotPulse .6s ease-in-out infinite alternate;
}

.dot-pulse span:nth-child(2) { animation-delay: .2s; }
.dot-pulse span:nth-child(3) { animation-delay: .4s; }

@keyframes dotPulse {
    from { opacity: .3; transform: scale(.8); }
    to { opacity: 1; transform: scale(1.2); }
}

/* === VOICE PROFILE CARD === */
.vp-card {
    background: #FAFBFC;
    border-radius: 14px;
    padding: 20px;
    border: 1px solid #E8E8E8;
}

.vp-item {
    padding: 10px 0;
    border-bottom: 1px solid #F0F0F0;
}

.vp-item:last-child { border-bottom: none; }

.vp-label {
    font-size: .75rem;
    font-weight: 700;
    color: #0A66C2;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}

.vp-value {
    font-size: .88rem;
    color: #333;
    line-height: 1.5;
}

/* === APP LAYOUT === */
#app {
    display: grid;
    grid-template-columns: 240px 1fr;
    min-height: 100vh;
}

/* === SIDEBAR === */
#sidebar {
    background: #fff;
    border-right: 1px solid #E8E8E8;
    display: flex;
    flex-direction: column;
    height: 100vh;
    position: sticky;
    top: 0;
    z-index: 100;
    overflow-y: auto;
}

.sidebar-logo {
    font-size: 1.3rem;
    font-weight: 800;
    color: #0A66C2;
    padding: 20px;
    cursor: pointer;
    border-bottom: 1px solid #F0F0F0;
}

.sidebar-menu {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 20px;
    cursor: pointer;
    transition: all .15s;
    color: #555;
    font-size: .88rem;
    font-weight: 500;
    border-left: 3px solid transparent;
}

.nav-item:hover {
    background: #F4F8FF;
    color: #0A66C2;
}

.nav-item.active {
    background: #E3F2FD;
    color: #0A66C2;
    font-weight: 700;
    border-left-color: #0A66C2;
}

.nav-icon { font-size: 1.1rem; }

.sidebar-footer {
    padding: 16px 20px;
    border-top: 1px solid #F0F0F0;
}

.user-pill {
    background: #F4F6F9;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: .82rem;
    font-weight: 600;
    color: #555;
    text-align: center;
}

/* === MAIN CONTENT === */
#mainContent {
    padding: 32px;
    overflow-y: auto;
    min-height: 100vh;
}

.app-section {
    display: none;
}

.app-section.active {
    display: block;
}

.section-top {
    margin-bottom: 28px;
}

.section-top h1 {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1A1A2E;
}

.section-desc {
    color: #666;
    font-size: .92rem;
    margin-top: 4px;
}

/* === STAT GRID === */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    text-align: center;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    border: 1px solid #E8E8E8;
}

.stat-card.accent { border-left: 4px solid #0A66C2; }
.stat-card.success { border-left: 4px solid #2E7D32; }
.stat-card.purple { border-left: 4px solid #7B1FA2; }

.stat-val {
    font-size: 2rem;
    font-weight: 800;
    color: #1A1A2E;
}

.stat-lbl {
    font-size: .78rem;
    color: #888;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-top: 4px;
}

/* === DASHBOARD === */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.dash-card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    border: 1px solid #E8E8E8;
}

.dash-card h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: #1A1A2E;
}

.empty-state {
    text-align: center;
    padding: 30px 20px;
    color: #999;
    font-size: .9rem;
}

.draft-snippet {
    padding: 12px;
    border: 1px solid #F0F0F0;
    border-radius: 10px;
    margin-bottom: 8px;
    cursor: pointer;
    transition: all .15s;
}

.draft-snippet:hover {
    border-color: #0A66C2;
    background: #F4F8FF;
}

.draft-snippet-title {
    font-size: .88rem;
    font-weight: 500;
    color: #333;
    margin-bottom: 6px;
}

.draft-snippet-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    font-size: .75rem;
    color: #888;
}

.quick-actions {
    display: flex;
    flex-direction: column;
}

/* === GENERATE === */
.gen-layout {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 24px;
    align-items: start;
}

.gen-card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    border: 1px solid #E8E8E8;
}

.gen-card h3 {
    font-size: 1rem;
    margin-bottom: 20px;
    color: #1A1A2E;
}

.gen-output h3 {
    margin-bottom: 16px;
    color: #1A1A2E;
}

.tone-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.tone-btn {
    padding: 6px 12px;
    border: 2px solid #E0E0E0;
    border-radius: 50px;
    background: #fff;
    font-size: .78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    color: #555;
    font-family: inherit;
}

.tone-btn:hover { border-color: #0A66C2; color: #0A66C2; }
.tone-btn.active { border-color: #0A66C2; background: #E3F2FD; color: #0A66C2; }

/* === POST CARD === */
.post-card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    border: 1px solid #E8E8E8;
    transition: border-color .2s;
}

.post-card:hover { border-color: #BBDEFB; }

.post-meta {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 14px;
}

.post-tone-badge {
    background: #E3F2FD;
    color: #0A66C2;
    padding: 3px 12px;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: capitalize;
}

.post-status-badge {
    padding: 3px 12px;
    border-radius: 50px;
    font-size: .72rem;
    font-weight: 700;
    text-transform: capitalize;
}

.status-draft { background: #FFF3E0; color: #E65100; }
.status-approved { background: #E8F5E9; color: #2E7D32; }
.status-published { background: #E3F2FD; color: #0A66C2; }

.post-date {
    font-size: .72rem;
    color: #aaa;
}

.post-content {
    font-size: .92rem;
    line-height: 1.7;
    color: #333;
    white-space: pre-wrap;
    word-wrap: break-word;
    margin-bottom: 12px;
}

.post-hashtags {
    font-size: .82rem;
    color: #0A66C2;
    margin-bottom: 12px;
    font-weight: 500;
}

.post-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    flex-wrap: wrap;
    padding-top: 12px;
    border-top: 1px solid #F0F0F0;
}

.post-word-count {
    margin-left: auto;
    font-size: .72rem;
    color: #aaa;
    font-weight: 600;
}

/* === FILTER BAR === */
.filter-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 20px;
}

.filter-btn {
    padding: 8px 18px;
    border: 2px solid #E0E0E0;
    border-radius: 50px;
    background: #fff;
    font-size: .82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all .15s;
    color: #555;
    font-family: inherit;
}

.filter-btn:hover { border-color: #0A66C2; color: #0A66C2; }
.filter-btn.active { border-color: #0A66C2; background: #E3F2FD; color: #0A66C2; }

/* === CALENDAR === */
.cal-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 20px;
    margin-bottom: 20px;
}

.cal-week-label {
    font-weight: 700;
    font-size: 1rem;
    color: #1A1A2E;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.cal-day {
    background: #fff;
    border-radius: 12px;
    padding: 12px;
    min-height: 140px;
    border: 1px solid #E8E8E8;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.cal-day.today { border-color: #0A66C2; background: #F4F8FF; }

.cal-day-header {
    font-size: .72rem;
    font-weight: 700;
    color: #888;
    text-transform: uppercase;
}

.cal-day-num {
    font-size: 1.1rem;
    font-weight: 800;
    color: #1A1A2E;
}

.cal-post-item {
    font-size: .68rem;
    padding: 4px 8px;
    background: #E3F2FD;
    border-radius: 6px;
    cursor: pointer;
    color: #0A66C2;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.cal-post-item.cal-approved { background: #E8F5E9; color: #2E7D32; }
.cal-post-item.cal-published { background: #EDE7F6; color: #7B1FA2; }

.cal-add-btn {
    margin-top: auto;
    font-size: .7rem;
    color: #aaa;
    background: none;
    border: 1px dashed #ddd;
    border-radius: 6px;
    padding: 4px;
    cursor: pointer;
    font-family: inherit;
}

.cal-add-btn:hover { color: #0A66C2; border-color: #0A66C2; }

/* === SMART PROMPTS === */
.prompt-container {
    max-width: 700px;
}

.prompt-card {
    background: #fff;
    border-radius: 14px;
    padding: 32px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    border: 1px solid #E8E8E8;
}

.prompt-category {
    display: inline-block;
    background: #FFF3E0;
    color: #E65100;
    padding: 4px 14px;
    border-radius: 50px;
    font-size: .75rem;
    font-weight: 700;
    margin-bottom: 16px;
}

.prompt-card h2 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    color: #1A1A2E;
    line-height: 1.4;
}

.prompt-actions {
    display: flex;
    gap: 10px;
    margin-top: 16px;
}

/* === DOCUMENT ANALYZER === */
.doc-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 24px;
    align-items: start;
}

.doc-output h3 {
    margin-bottom: 16px;
}

/* === TOPIC IDEAS === */
.topics-controls {
    display: flex;
    gap: 12px;
    align-items: center;
    margin-bottom: 20px;
}

.topics-controls select {
    padding: 10px 14px;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-family: inherit;
    font-size: .9rem;
}

.topic-card {
    display: flex;
    gap: 16px;
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    margin-bottom: 12px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    border: 1px solid #E8E8E8;
    transition: border-color .2s;
}

.topic-card:hover { border-color: #BBDEFB; }

.topic-num {
    width: 36px;
    height: 36px;
    background: #E3F2FD;
    color: #0A66C2;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    flex-shrink: 0;
    font-size: .9rem;
}

.topic-body { flex: 1; }

.topic-title {
    font-weight: 700;
    font-size: 1rem;
    color: #1A1A2E;
    margin-bottom: 6px;
}

.topic-desc {
    font-size: .85rem;
    color: #555;
    line-height: 1.5;
    margin-bottom: 10px;
}

.topic-tags {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}

.topic-tag {
    padding: 3px 10px;
    background: #F4F6F9;
    color: #555;
    border-radius: 50px;
    font-size: .7rem;
    font-weight: 600;
}

.topic-actions {
    display: flex;
    gap: 8px;
}

/* === SETTINGS === */
.settings-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 16px;
}

.setting-card {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    border: 1px solid #E8E8E8;
}

.setting-card h3 {
    font-size: .95rem;
    margin-bottom: 14px;
    color: #1A1A2E;
}

.setting-card select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-family: inherit;
    font-size: .9rem;
}

/* === VOICE PROFILE PAGE === */
.vp-section {
    background: #fff;
    border-radius: 14px;
    padding: 24px;
    margin-bottom: 16px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    border: 1px solid #E8E8E8;
}

.vp-section h3 {
    font-size: 1rem;
    margin-bottom: 16px;
    color: #1A1A2E;
}

.vp-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

.vp-grid-item {
    padding: 12px;
    background: #FAFBFC;
    border-radius: 10px;
    border: 1px solid #F0F0F0;
}

.vp-grid-label {
    font-size: .72rem;
    font-weight: 700;
    color: #0A66C2;
    text-transform: uppercase;
    letter-spacing: .5px;
    margin-bottom: 4px;
}

.vp-grid-value {
    font-size: .85rem;
    color: #333;
    line-height: 1.5;
}

.vp-bar-container {
    margin-bottom: 14px;
}

.vp-bar-label-row {
    display: flex;
    justify-content: space-between;
    margin-bottom: 4px;
}

.vp-bar-name {
    font-size: .82rem;
    font-weight: 600;
    color: #333;
}

.vp-bar-pct {
    font-size: .82rem;
    font-weight: 700;
    color: #0A66C2;
}

.vp-bar-track {
    height: 8px;
    background: #F0F0F0;
    border-radius: 10px;
    overflow: hidden;
}

.vp-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0A66C2, #4FC3F7);
    border-radius: 10px;
    transition: width .5s ease;
}

/* === ANALYTICS CHARTS === */
.tone-chart, .activity-chart {
    padding: 10px 0;
}

.tone-bar-row, .activity-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.tone-bar-label, .activity-day {
    width: 110px;
    font-size: .8rem;
    font-weight: 600;
    color: #333;
    flex-shrink: 0;
}

.tone-bar-track, .activity-bar-track {
    flex: 1;
    height: 20px;
    background: #F0F0F0;
    border-radius: 10px;
    overflow: hidden;
}

.tone-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #0A66C2, #4FC3F7);
    border-radius: 10px;
    transition: width .5s ease;
}

.activity-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, #2E7D32, #81C784);
    border-radius: 10px;
    transition: width .5s ease;
}

.tone-bar-count, .activity-count {
    width: 30px;
    font-size: .8rem;
    font-weight: 700;
    color: #555;
    text-align: right;
}

/* === MODAL === */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.5);
    z-index: 10000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.modal-box {
    background: #fff;
    border-radius: 16px;
    max-width: 600px;
    width: 100%;
    max-height: 85vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,.2);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px 24px;
    border-bottom: 1px solid #F0F0F0;
}

.modal-header h3 {
    font-size: 1.1rem;
    color: #1A1A2E;
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: #F4F6F9;
    border-radius: 50%;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #555;
}

.modal-close:hover { background: #E0E0E0; }

.modal-body {
    padding: 24px;
}

.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid #F0F0F0;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

.schedule-row {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.schedule-row label {
    width: 50px;
    font-weight: 600;
    font-size: .85rem;
}

.schedule-row input {
    flex: 1;
    padding: 8px 12px;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    font-family: inherit;
}

/* === TOAST === */
#toastContainer {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 99999;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 18px;
    border-radius: 12px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(0,0,0,.12);
    animation: slideIn .3s ease;
    font-size: .88rem;
}

.toast-success { border-left: 4px solid #2E7D32; }
.toast-error { border-left: 4px solid #C62828; }
.toast-warning { border-left: 4px solid #F57F17; }
.toast-info { border-left: 4px solid #0A66C2; }

.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-msg { flex: 1; color: #333; }

.toast-close {
    background: none;
    border: none;
    font-size: .9rem;
    color: #aaa;
    cursor: pointer;
    padding: 0 4px;
}

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to { transform: translateX(0); opacity: 1; }
}

@keyframes slideOut {
    from { transform: translateX(0); opacity: 1; }
    to { transform: translateX(100%); opacity: 0; }
}

/* ===========================
   IMAGE UPLOAD
   =========================== */
.image-upload-area {
    position: relative;
}

.image-upload-area input[type="file"] {
    position: absolute;
    width: 0;
    height: 0;
    opacity: 0;
    overflow: hidden;
}

.image-upload-label {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 20px;
    border: 2px dashed #ccc;
    border-radius: 12px;
    cursor: pointer;
    transition: all .2s;
    text-align: center;
    gap: 6px;
    background: #FAFBFC;
}

.image-upload-label:hover {
    border-color: #0A66C2;
    background: #F4F8FF;
}

.image-upload-icon {
    font-size: 1rem;
    font-weight: 600;
    color: #0A66C2;
}

.image-preview {
    margin-top: 12px;
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid #E0E0E0;
}

.image-preview img {
    width: 100%;
    max-height: 200px;
    object-fit: cover;
    display: block;
    border-radius: 12px;
}

.image-remove-btn {
    position: absolute;
    top: 8px;
    right: 8px;
    background: rgba(0,0,0,.6);
    color: #fff;
    border: none;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    font-size: .85rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-remove-btn:hover { background: rgba(198, 40, 40, .9); }

.image-info {
    padding: 8px 12px;
    background: #F4F6F9;
    font-size: .75rem;
    color: #555;
    display: flex;
    justify-content: space-between;
}

.post-image {
    margin: 10px 0;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid #E8E8E8;
}

.post-image img {
    width: 100%;
    max-height: 300px;
    object-fit: cover;
    display: block;
}

/* ===========================
   SOURCE REFERENCES
   =========================== */
.post-sources {
    margin: 10px 0;
    padding: 10px 14px;
    background: #FFF8E1;
    border-radius: 10px;
    border: 1px solid #FFE082;
    font-size: .78rem;
}

.post-sources strong { color: #F57F17; }
.post-sources a { color: #E65100; word-break: break-all; }

/* ===========================
   FEEDBACK CHATBOT
   =========================== */
.feedback-layout {
    display: grid;
    grid-template-columns: 320px 1fr;
    gap: 24px;
    align-items: start;
    min-height: 600px;
}

.feedback-sidebar-panel {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.feedback-card {
    background: #fff;
    border-radius: 14px;
    padding: 20px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    border: 1px solid #E8E8E8;
}

.feedback-card h3 {
    font-size: .95rem;
    margin-bottom: 12px;
}

.feedback-card select {
    width: 100%;
    padding: 8px 12px;
    border: 2px solid #E0E0E0;
    border-radius: 8px;
    font-family: inherit;
    font-size: .85rem;
}

.feedback-post-preview {
    margin-top: 12px;
    padding: 12px;
    background: #FAFBFC;
    border-radius: 10px;
    border: 1px solid #F0F0F0;
    font-size: .82rem;
    line-height: 1.6;
    color: #333;
    white-space: pre-wrap;
    max-height: 200px;
    overflow-y: auto;
}

.feedback-memory-list {
    max-height: 250px;
    overflow-y: auto;
}

.feedback-memory-item {
    padding: 8px 12px;
    background: #F4F6F9;
    border-radius: 8px;
    margin-bottom: 6px;
    font-size: .78rem;
    color: #333;
    border-left: 3px solid #0A66C2;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.feedback-memory-item .mem-text { flex: 1; }

.feedback-memory-item .mem-type {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    color: #0A66C2;
    flex-shrink: 0;
}

.feedback-memory-item.mem-like { border-left-color: #2E7D32; }
.feedback-memory-item.mem-like .mem-type { color: #2E7D32; }

.feedback-memory-item.mem-dislike { border-left-color: #C62828; }
.feedback-memory-item.mem-dislike .mem-type { color: #C62828; }

.feedback-chat-area {
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 2px 10px rgba(0,0,0,.04);
    border: 1px solid #E8E8E8;
    display: flex;
    flex-direction: column;
    min-height: 600px;
    max-height: 75vh;
}

.chat-container {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.chat-message {
    display: flex;
    gap: 12px;
    max-width: 85%;
    animation: chatFadeIn .3s ease;
}

@keyframes chatFadeIn {
    from { opacity: 0; transform: translateY(8px); }
    to { opacity: 1; transform: translateY(0); }
}

.chat-message.chat-ai { align-self: flex-start; }
.chat-message.chat-user { align-self: flex-end; flex-direction: row-reverse; }

.chat-avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    background: #F4F6F9;
}

.chat-user .chat-avatar { background: #E3F2FD; }

.chat-bubble {
    background: #F4F6F9;
    padding: 14px 18px;
    border-radius: 14px;
    font-size: .88rem;
    line-height: 1.6;
    color: #333;
}

.chat-bubble p { margin-bottom: 8px; }
.chat-bubble p:last-child { margin-bottom: 0; }

.chat-bubble ul {
    margin: 6px 0;
    padding-left: 20px;
}

.chat-bubble li {
    font-size: .82rem;
    color: #555;
    margin-bottom: 4px;
}

.chat-user .chat-bubble {
    background: #0A66C2;
    color: #fff;
}

.chat-bubble .revised-post {
    background: #fff;
    padding: 12px;
    border-radius: 10px;
    margin-top: 10px;
    white-space: pre-wrap;
    font-size: .85rem;
    line-height: 1.6;
    border: 1px solid #E0E0E0;
    color: #333;
}

.chat-bubble .chat-actions {
    display: flex;
    gap: 6px;
    margin-top: 10px;
    flex-wrap: wrap;
}

.chat-bubble .chat-actions button {
    padding: 4px 12px;
    border-radius: 8px;
    font-size: .75rem;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid #E0E0E0;
    background: #fff;
    color: #333;
    transition: all .2s;
    font-family: inherit;
}

.chat-bubble .chat-actions button:hover {
    border-color: #0A66C2;
    color: #0A66C2;
}

.chat-input-area {
    display: flex;
    gap: 10px;
    padding: 16px 24px;
    border-top: 1px solid #F0F0F0;
    align-items: flex-end;
}

.chat-input-area textarea {
    flex: 1;
    padding: 10px 14px;
    border: 2px solid #E0E0E0;
    border-radius: 10px;
    font-family: inherit;
    font-size: .88rem;
    resize: none;
    max-height: 100px;
}

.chat-input-area textarea:focus {
    outline: none;
    border-color: #0A66C2;
}

.chat-input-area .btn-primary {
    flex-shrink: 0;
    padding: 10px 20px;
}

/* === RESPONSIVE === */
@media (max-width: 1100px) {
    #app { grid-template-columns: 200px 1fr; }
    .gen-layout { grid-template-columns: 1fr; }
    .doc-layout { grid-template-columns: 1fr; }
    .dash-grid { grid-template-columns: 1fr; }
    .feedback-layout { grid-template-columns: 1fr; }
}

@media (max-width: 800px) {
    #app { grid-template-columns: 1fr; }
    #sidebar {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        height: auto;
        flex-direction: row;
        border-right: none;
        border-top: 1px solid #E8E8E8;
        z-index: 100;
    }
    .sidebar-logo, .sidebar-footer { display: none; }
    .sidebar-menu {
        display: flex;
        overflow-x: auto;
        padding: 8px;
        gap: 2px;
    }
    .nav-item {
        flex-direction: column;
        gap: 2px;
        padding: 8px 10px;
        border-left: none;
        border-bottom: 2px solid transparent;
        font-size: .68rem;
        min-width: 60px;
        text-align: center;
    }
    .nav-item.active { border-left: none; border-bottom-color: #0A66C2; }
    .nav-label { font-size: .62rem; }
    #mainContent { padding: 20px; padding-bottom: 80px; }
    .cal-grid { grid-template-columns: repeat(3, 1fr); }
    .stat-grid { grid-template-columns: repeat(2, 1fr); }
    .feedback-layout { grid-template-columns: 1fr; }
    .feedback-chat-area { min-height: 400px; max-height: 60vh; }
    .chat-message { max-width: 95%; }
    .vp-grid { grid-template-columns: 1fr; }
}