/* ========== BASE ========== */
:root {
    --g1: #667eea;
    --g2: #764ba2;
    --g3: #f093fb;
    --accent: #7c5cfc;
    --accent2: #a855f7;
    --success: #34d399;
    --warn: #fb923c;
    --danger: #f87171;
    --bg: #faf9fe;
    --card: #ffffff;
    --text: #1e1b4b;
    --text2: #6b7280;
    --text3: #a5b4c4;
    --border: #e8e4f0;
    --radius: 14px;
    --shadow: 0 2px 16px rgba(118,75,162,0.08);
    --shadow-lg: 0 8px 32px rgba(118,75,162,0.12);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
    overflow-x: clip;
}

/* ========== AUTH ========== */
.auth-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--g1), var(--g2));
    padding: 20px;
}

.auth-card {
    background: var(--card);
    border-radius: 24px;
    padding: 40px 32px;
    width: 100%;
    max-width: 360px;
    box-shadow: var(--shadow-lg);
    text-align: center;
}

.auth-logo {
    width: 56px; height: 56px;
    background: linear-gradient(135deg, var(--g1), var(--g2));
    border-radius: 16px;
    display: inline-flex;
    align-items: center; justify-content: center;
    font-weight: 700; font-size: 20px; color: #fff;
    margin-bottom: 16px;
}

.auth-title {
    font-size: 22px; font-weight: 700;
    margin-bottom: 24px; color: var(--text);
}

#authForm input {
    width: 100%;
    padding: 12px 14px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    outline: none;
    margin-bottom: 10px;
    transition: border-color 0.2s;
    background: var(--bg);
}
#authForm input:focus { border-color: var(--accent); }

.auth-btn {
    width: 100%;
    margin-bottom: 8px;
    padding: 12px !important;
    font-size: 14px !important;
}

.auth-error {
    color: var(--danger);
    font-size: 13px;
    margin-top: 8px;
}
.auth-error.hidden { display: none; }

/* ========== PROJECT SELECTOR ========== */
.project-selector {
    display: flex;
    align-items: center;
    gap: 4px;
}

.project-selector select {
    background: rgba(255,255,255,0.15);
    color: #fff;
    border: none;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    max-width: 160px;
    backdrop-filter: blur(4px);
    -webkit-appearance: none;
    appearance: none;
}
.project-selector select option {
    color: var(--text);
    background: var(--card);
}

.btn-logout {
    background: rgba(255,255,255,0.1) !important;
    font-size: 11px !important;
    padding: 5px 10px !important;
}

.modal-small {
    max-width: 380px;
}

/* ========== HEADER ========== */
header {
    background: linear-gradient(135deg, var(--g1), var(--g2));
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 100;
    flex-wrap: wrap;
    gap: 10px;
}

.header-left { display: flex; align-items: center; gap: 10px; }

.logo {
    width: 34px; height: 34px;
    background: rgba(255,255,255,0.2);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 700; font-size: 13px; color: #fff;
    backdrop-filter: blur(8px);
}

header h1 { font-size: 18px; font-weight: 700; color: #fff; letter-spacing: -0.3px; }

.header-controls { display: flex; align-items: center; gap: 8px; }

.btn-icon {
    background: rgba(255,255,255,0.15);
    border: none; color: #fff;
    width: 34px; height: 34px;
    border-radius: 10px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.2s;
    backdrop-filter: blur(4px);
}
.btn-icon:hover { background: rgba(255,255,255,0.3); }

.btn-icon-sm {
    background: var(--accent);
    border: none; color: #fff;
    width: 36px; height: 36px;
    border-radius: 10px; font-size: 20px;
    cursor: pointer; flex-shrink: 0;
}

.week-nav { display: flex; align-items: center; gap: 6px; }

#dateRange {
    font-size: 13px;
    color: rgba(255,255,255,0.85);
    min-width: 140px;
    text-align: center;
    font-weight: 500;
}

.btn-pill {
    background: rgba(255,255,255,0.2);
    color: #fff; border: none;
    padding: 7px 14px; border-radius: 20px;
    font-size: 12px; font-weight: 600;
    cursor: pointer; backdrop-filter: blur(4px);
    transition: background 0.2s;
    font-family: inherit;
}
.btn-pill:hover { background: rgba(255,255,255,0.35); }

/* ========== VIEW TABS ========== */
.view-tabs {
    display: none;
    background: var(--card);
    padding: 6px; gap: 4px;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 62px; z-index: 90;
}

.view-tab {
    flex: 1; padding: 8px;
    border: none; background: transparent;
    border-radius: 10px;
    font-size: 13px; font-weight: 600;
    color: var(--text2); cursor: pointer;
    transition: all 0.2s; font-family: inherit;
}
.view-tab.active {
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff;
}

/* ========== DAY PICKER ========== */
.day-picker {
    display: flex;
    padding: 6px 10px; gap: 4px;
    background: var(--card);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 108px; z-index: 89;
    overflow-x: auto;
}
.day-picker.hidden { display: none; }

.day-pick {
    flex: 1; min-width: 40px;
    padding: 8px 4px;
    border: 2px solid var(--border);
    background: transparent;
    border-radius: 10px;
    font-size: 13px; font-weight: 600;
    color: var(--text2); cursor: pointer;
    transition: all 0.2s; font-family: inherit;
}
.day-pick.active {
    border-color: var(--accent);
    background: linear-gradient(135deg, rgba(124,92,252,0.08), rgba(168,85,247,0.08));
    color: var(--accent);
}

/* ========== DIARY GRID ========== */
.diary {
    padding: 16px;
    max-width: 1440px;
    margin: 0 auto;
    overflow: hidden;
}

.diary-scroll {
    overflow-x: auto;
    overflow-y: visible;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

.diary-header {
    display: grid;
    grid-template-columns: 110px repeat(4, minmax(200px, 1fr));
    gap: 6px; margin-bottom: 6px;
    min-width: 0;
}

.day-label-header,
.week-header {
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff;
    padding: 10px 8px;
    border-radius: var(--radius);
    font-weight: 600;
    text-align: center;
    font-size: 12px;
}

.day-row {
    display: grid;
    grid-template-columns: 110px repeat(4, minmax(200px, 1fr));
    gap: 6px; margin-bottom: 6px;
    min-width: 0;
}

/* Day Label */
.day-label {
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff;
    padding: 10px 6px;
    border-radius: var(--radius);
    display: flex; flex-direction: column;
    align-items: center; justify-content: flex-start;
    text-align: center; gap: 4px;
}
.day-label.today {
    background: linear-gradient(135deg, var(--accent), var(--g3));
    color: #fff;
}

.day-name { font-size: 13px; font-weight: 700; }

.day-rubrics-list { display: flex; flex-direction: column; gap: 2px; width: 100%; }

.day-rubric-tag {
    font-size: 9px; padding: 2px 4px;
    border-radius: 4px;
    font-weight: 600; text-align: center;
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* ========== DAY CELL ========== */
.day-cell {
    background: var(--card);
    border-radius: var(--radius);
    min-height: 150px;
    border: 2px solid transparent;
    display: flex; flex-direction: column;
    transition: all 0.25s;
    box-shadow: var(--shadow);
}
.day-cell:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
    transform: translateY(-1px);
}
.day-cell.today {
    border-color: var(--accent);
    background: linear-gradient(170deg, #faf8ff, #f3f0ff);
}

.cell-date {
    font-size: 11px; color: var(--text3);
    padding: 8px 10px 0; font-weight: 600;
}
.cell-date.today { color: var(--accent); font-weight: 700; }

/* Section labels */
.cell-section-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--accent);
    margin-bottom: 3px;
    font-weight: 700;
}
.cell-section-label--brief { color: var(--g2); }
.cell-section-label--fact { color: var(--success); }

.cell-section-label.fact-mismatch {
    color: var(--danger);
    border: 2px dotted var(--danger);
    border-radius: 6px;
    padding: 1px 8px;
    display: inline-block;
}

/* Plan */
.cell-plan {
    padding: 4px 10px 5px;
    border-bottom: 1px solid var(--border);
}

.plan-rubrics { display: flex; flex-wrap: wrap; gap: 3px; }

.plan-rubric-badge {
    font-size: 10px; padding: 2px 7px;
    border-radius: 6px; font-weight: 600;
}
.plan-rubric-badge.done { box-shadow: 0 0 0 1.5px rgba(52,211,153,0.5); }
.plan-rubric-badge.missing { opacity: 0.3; }

/* Brief */
.cell-brief {
    padding: 4px 10px 5px;
    border-bottom: 1px solid var(--border);
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
}

.brief-preview-text {
    font-size: 11px;
    color: #000;
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin-top: 2px;
}

.brief-audio-tag {
    font-size: 10px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 2px;
}

.brief-preview-hint {
    font-size: 10px;
    color: #ccc;
    font-style: italic;
    margin-top: 2px;
}

.cell-brief:hover, .mobile-cell-brief:hover {
    background: linear-gradient(135deg, #ede9fe, #e0dbf5);
}

.brief-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.brief-mic-btn {
    background: none;
    border: none;
    color: var(--accent);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    opacity: 0.6;
    transition: opacity 0.2s;
}
.brief-mic-btn:hover { opacity: 1; }

.brief-audio-wrap {
    display: flex;
    align-items: center;
    gap: 4px;
    margin-top: 3px;
}

.cell-brief-audio, .mobile-brief-audio {
    height: 28px;
    flex: 1;
}

.modal-brief-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.modal-brief-textarea {
    width: 100%;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    padding: 8px 10px;
    font-size: 13px;
    font-family: inherit;
    color: #000;
    resize: none;
    outline: none;
    background: var(--bg);
    transition: border-color 0.2s;
}
.modal-brief-textarea:focus { border-color: var(--accent); }

.cell-brief-input {
    width: 100%; border: none;
    background: transparent;
    font-size: 11px; font-family: inherit;
    color: #000;
    resize: none; outline: none;
    line-height: 1.4; padding: 2px 0;
}
.cell-brief-input::placeholder { color: #bbb; font-style: italic; }

/* Fact */
.cell-fact {
    padding: 4px 10px 10px;
    flex: 1;
    display: flex; flex-direction: column;
}

.add-post-btn {
    width: 100%; padding: 6px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text3);
    font-size: 14px; font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: auto;
    font-family: inherit;
}
.add-post-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: rgba(124,92,252,0.04);
}

/* ========== POST CARD ========== */
.post-card {
    background: linear-gradient(135deg, #faf9fe, #f5f3ff);
    border-radius: 10px;
    padding: 0;
    margin-bottom: 4px;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    overflow: hidden;
    position: relative;
}
.post-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(124,92,252,0.12);
}

.post-card-rubric-badge {
    position: absolute;
    top: 6px; left: 6px;
    font-size: 9px; padding: 2px 7px;
    border-radius: 5px; font-weight: 600;
    z-index: 2;
    box-shadow: 0 1px 4px rgba(0,0,0,0.15);
}

.post-card-image {
    width: 100%;
    aspect-ratio: 4/5;
    object-fit: contain;
    background: #f5f3ff;
    border-radius: 8px 8px 0 0;
    display: block;
}

.photo-dots {
    display: flex;
    justify-content: center;
    gap: 4px;
    padding: 4px 0;
}
.photo-dot {
    width: 6px; height: 6px;
    border-radius: 50%;
    background: var(--border);
}
.photo-dot.active {
    background: var(--accent);
}

.post-card-video {
    width: 100%;
    aspect-ratio: 9/16;
    max-height: 150px;
    object-fit: contain;
    background: #1a1a2e;
    border-radius: 8px;
}

.post-card-body {
    padding: 6px 8px 8px;
}

.post-card-text {
    font-size: 11px; color: var(--text2);
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-card-meta { display: flex; gap: 3px; margin-top: 4px; flex-wrap: wrap; }

.badge {
    font-size: 9px; padding: 2px 6px;
    border-radius: 5px; font-weight: 600;
}
.badge-rubric { /* color set dynamically */ }
.badge-beginner { background: linear-gradient(135deg, #fbbf24, #f59e0b); color: #fff; }
.badge-advanced { background: linear-gradient(135deg, #f87171, #ef4444); color: #fff; }

/* ========== PHOTO GALLERY (view modal) ========== */
.photo-gallery {
    position: relative;
    margin-bottom: 14px;
}
.photo-gallery img {
    width: 100%;
    max-height: 60vh;
    object-fit: contain;
    background: #f5f3ff;
    border-radius: 12px;
    display: block;
}
.photo-gallery-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 36px; height: 36px;
    border-radius: 50%;
    background: rgba(255,255,255,0.85);
    border: none;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    z-index: 2;
    transition: background 0.2s;
}
.photo-gallery-btn:hover { background: #fff; }
.photo-gallery-btn.prev { left: 8px; }
.photo-gallery-btn.next { right: 8px; }
.photo-gallery-dots {
    display: flex;
    justify-content: center;
    gap: 5px;
    padding: 8px 0 4px;
}
.photo-gallery-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.2s;
    cursor: pointer;
}
.photo-gallery-dot.active {
    background: var(--accent);
}
.photo-gallery-counter {
    text-align: center;
    font-size: 12px;
    color: var(--text3);
    margin-top: 2px;
}
.photo-gallery-downloads {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-top: 8px;
}

/* Published draft indicator */
.draft-published-indicator {
    display: inline-block;
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--success);
    background: rgba(52,211,153,0.1);
    padding: 2px 6px;
    border-radius: 4px;
    margin-left: 6px;
}

/* ========== WEEK VIEW ========== */
.week-view {
    padding: 12px;
    display: flex; flex-direction: column;
    gap: 10px;
}

.week-day-card {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
}

.week-day-header {
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff;
    padding: 10px 14px;
    font-weight: 700; font-size: 14px;
    display: flex; justify-content: space-between; align-items: center;
}
.week-day-header.today-header {
    background: linear-gradient(135deg, var(--accent), var(--g3));
}
.week-day-header .date-badge {
    background: rgba(255,255,255,0.2);
    padding: 3px 10px; border-radius: 8px;
    font-size: 12px; font-weight: 600;
}

.week-day-body { padding: 10px 14px; }

/* ========== DAYS VIEW ========== */
.days-view { padding: 12px; }

.days-swiper {
    display: flex; gap: 12px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px;
}
.days-swiper::-webkit-scrollbar { height: 4px; }
.days-swiper::-webkit-scrollbar-track { background: transparent; }
.days-swiper::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.days-card {
    min-width: 85%; max-width: 85%;
    scroll-snap-align: center;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden; flex-shrink: 0;
}

.days-card-header {
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff;
    padding: 12px 16px;
    font-weight: 700; font-size: 15px;
}
.days-card-header.today-header {
    background: linear-gradient(135deg, var(--accent), var(--g3));
}

.days-card-body { padding: 12px 16px; }

/* Mobile shared */
.mobile-cell-plan,
.mobile-cell-brief,
.mobile-cell-fact { margin-bottom: 8px; }

.mobile-cell-brief {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border-radius: 10px; padding: 8px 12px;
}

.mobile-brief-input {
    width: 100%; border: none;
    background: transparent;
    font-size: 13px; font-family: inherit;
    color: #000;
    resize: none; outline: none;
    line-height: 1.5; padding: 0;
}
.mobile-brief-input::placeholder { color: #bbb; }

.mobile-add-btn {
    width: 100%; padding: 10px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text3);
    font-size: 14px; font-weight: 600;
    cursor: pointer; transition: all 0.2s;
    font-family: inherit;
}
.mobile-add-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* ========== MODAL ========== */
.modal {
    position: fixed; inset: 0;
    background: rgba(30,27,75,0.4);
    display: flex; align-items: center; justify-content: center;
    z-index: 1000;
    backdrop-filter: blur(6px);
    padding: 12px;
}
.modal.hidden { display: none; }

.modal-content {
    background: var(--card);
    border-radius: 20px;
    width: 100%; max-width: 540px;
    max-height: 88vh;
    overflow-y: auto;
    padding: 22px;
    box-shadow: 0 24px 64px rgba(30,27,75,0.2);
    display: flex;
    flex-direction: column;
}
.modal-wide { max-width: 680px; }

.modal-header {
    display: flex; align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.modal-header h2 { font-size: 18px; letter-spacing: -0.3px; }

.modal-close {
    background: none; border: none;
    font-size: 28px; color: var(--text3);
    cursor: pointer;
}
.modal-close:hover { color: var(--text); }

/* Modal brief */
.modal-brief {
    display: flex; align-items: flex-start; gap: 10px;
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    margin-bottom: 16px;
    order: 10;
}
.modal-brief.hidden { display: none; }
.modal-brief-icon { font-size: 20px; flex-shrink: 0; }
.modal-brief-content { flex: 1; }
.modal-brief-label {
    font-size: 10px; font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--g2);
    margin-bottom: 4px;
}
.modal-brief-content > div:last-child {
    font-size: 14px; color: var(--text);
    line-height: 1.5; white-space: pre-wrap;
}

/* Form */
.form-group { margin-bottom: 14px; }

.form-group label {
    display: block;
    font-size: 11px; font-weight: 700;
    color: var(--text2);
    margin-bottom: 5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
}

.label-with-action { display: flex; align-items: center; justify-content: space-between; }

.btn-clear {
    background: none; border: none;
    color: var(--danger);
    font-size: 11px; cursor: pointer;
    padding: 2px 6px; border-radius: 6px;
    font-family: inherit;
}
.btn-clear:hover { background: #fef2f2; }

.form-group textarea,
.form-group input[type="text"],
.form-group select {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid var(--border);
    border-radius: 10px;
    font-size: 14px; font-family: inherit;
    transition: border-color 0.2s;
    outline: none;
    background: var(--bg);
}
.form-group textarea:focus,
.form-group input[type="text"]:focus,
.form-group select:focus { border-color: var(--accent); }

.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Audience */
.audience-toggle { display: flex; gap: 6px; }
.toggle-option { flex: 1; cursor: pointer; }
.toggle-option input { display: none; }

.toggle-label {
    display: block; text-align: center;
    padding: 9px 4px; border-radius: 10px;
    font-size: 11px; font-weight: 600;
    border: 2px solid var(--border);
    transition: all 0.2s;
}
.toggle-option input:checked + .tl-begin {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
    border-color: transparent; color: #fff;
}
.toggle-option input:checked + .tl-adv {
    background: linear-gradient(135deg, #f87171, #ef4444);
    border-color: transparent; color: #fff;
}

/* Image */
.image-preview {
    width: 100%; min-height: 70px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer; overflow: hidden;
    transition: border-color 0.2s;
    position: relative;
}
.image-preview:hover { border-color: var(--accent); }
.image-preview img { max-width: 100%; max-height: 280px; object-fit: contain; }
.upload-placeholder { color: var(--text3); font-size: 13px; font-weight: 500; }

.preview-remove-btn {
    position: absolute; top: 6px; right: 6px;
    width: 26px; height: 26px; border-radius: 50%;
    background: rgba(248,113,113,0.9);
    color: #fff; border: none;
    font-size: 16px; cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}
.preview-remove-btn:hover { background: #ef4444; }

/* Video */
/* Voice */
.voice-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

.btn-voice-record {
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: 12px;
    padding: 10px 16px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text2);
    cursor: pointer;
    width: 100%;
    transition: all 0.2s;
    font-family: inherit;
}
.btn-voice-record:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.btn-voice-record.recording {
    border-color: var(--danger);
    border-style: solid;
    color: var(--danger);
    animation: pulse-border 1.5s infinite;
}
.btn-voice-record.recording .voice-mic {
    stroke: var(--danger);
}

@keyframes pulse-border {
    0%, 100% { box-shadow: 0 0 0 0 rgba(248,113,113,0.3); }
    50% { box-shadow: 0 0 0 6px rgba(248,113,113,0); }
}

.voice-timer {
    font-size: 14px;
    font-weight: 600;
    color: var(--danger);
    font-variant-numeric: tabular-nums;
    min-width: 40px;
}
.voice-timer.hidden { display: none; }

.voice-preview {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    background: var(--bg);
    padding: 8px 12px;
    border-radius: 10px;
}
.voice-preview.hidden { display: none; }

.voice-audio-player {
    flex: 1;
    height: 36px;
}

.post-card-audio {
    width: 100%;
    height: 32px;
    margin-bottom: 4px;
}

.view-audio-block {
    margin-bottom: 14px;
}
.view-audio {
    width: 100%;
    height: 40px;
}

.btn-video-upload {
    background: var(--bg);
    border: 2px dashed var(--border);
    border-radius: 12px; padding: 10px;
    font-size: 13px; font-weight: 500;
    color: var(--text3); cursor: pointer;
    width: 100%; transition: all 0.2s;
    font-family: inherit;
}
.btn-video-upload:hover { border-color: var(--accent); color: var(--accent); }

.video-attached {
    display: flex; align-items: center; gap: 8px;
    background: var(--bg); padding: 10px 14px;
    border-radius: 12px;
}
.video-attached-icon { font-size: 18px; }
.video-attached-name {
    flex: 1; font-size: 13px; color: var(--text);
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.video-progress { margin-top: 8px; display: flex; align-items: center; gap: 10px; }
.video-progress.hidden { display: none; }
.video-progress-bar { flex: 1; height: 5px; background: var(--border); border-radius: 3px; overflow: hidden; }
.video-progress-fill { height: 100%; background: linear-gradient(90deg, var(--g1), var(--g2)); border-radius: 3px; transition: width 0.2s; }
#videoProgressText { font-size: 11px; color: var(--text2); min-width: 36px; }

/* View modal */
.view-body { padding: 4px 0; }
.view-image { width: 100%; max-height: 60vh; object-fit: contain; background: #f5f3ff; border-radius: 12px; margin-bottom: 14px; }
.view-video-block { margin-bottom: 14px; }
.view-video { width: 100%; max-height: 60vh; object-fit: contain; border-radius: 12px; background: #000; margin-bottom: 8px; }

.btn-download {
    display: inline-flex; align-items: center; gap: 6px;
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff; text-decoration: none;
    padding: 8px 16px; border-radius: 10px;
    font-size: 13px; font-weight: 600;
}
.btn-download:hover { opacity: 0.9; }

.view-text { font-size: 15px; line-height: 1.7; color: var(--text); white-space: pre-wrap; margin-bottom: 14px; }
.view-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.view-actions { margin-top: 14px; display: flex; justify-content: flex-end; }

/* Buttons */
.form-actions {
    display: flex; justify-content: space-between; align-items: center;
    margin-top: 16px; padding-top: 14px;
    border-top: 1px solid var(--border); gap: 8px;
}
.form-actions-right { display: flex; gap: 8px; }

.btn-save {
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff; border: none;
    padding: 10px 22px; border-radius: 10px;
    font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit;
    transition: opacity 0.2s;
}
.btn-save:hover { opacity: 0.9; }

.btn-cancel {
    background: var(--bg);
    color: var(--text2);
    border: 2px solid var(--border);
    padding: 10px 20px; border-radius: 10px;
    font-size: 14px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}
.btn-cancel:hover { background: var(--border); }

.btn-delete {
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: #fff; border: none;
    padding: 10px 16px; border-radius: 10px;
    font-size: 13px; font-weight: 600;
    cursor: pointer; font-family: inherit;
}

.btn-delete-small {
    background: none; border: none;
    color: var(--danger);
    font-size: 16px; cursor: pointer;
    padding: 2px 6px; border-radius: 6px;
}
.btn-delete-small:hover { background: #fef2f2; }

.hidden { display: none !important; }

/* Settings */
.settings-section { margin-bottom: 20px; }
.settings-section h3 { font-size: 15px; margin-bottom: 10px; letter-spacing: -0.2px; }

.rubric-list { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.rubric-item {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg);
    padding: 5px 10px; border-radius: 10px;
    font-size: 13px;
}
.rubric-color-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }

.add-rubric-inline { display: flex; gap: 8px; align-items: center; }
.add-rubric-inline input[type="text"] {
    flex: 1; padding: 8px 12px;
    border: 2px solid var(--border);
    border-radius: 10px; font-size: 14px;
    outline: none; font-family: inherit;
}
.add-rubric-inline input[type="text"]:focus { border-color: var(--accent); }
.add-rubric-inline input[type="color"] { width: 36px; height: 36px; border: none; border-radius: 10px; cursor: pointer; padding: 2px; }

.schedule-grid { display: flex; flex-direction: column; gap: 6px; }
.schedule-day-row {
    display: flex; align-items: center; gap: 10px;
    padding: 8px 12px;
    background: var(--bg);
    border-radius: 10px; flex-wrap: wrap;
}
.schedule-day-name { font-weight: 700; font-size: 13px; min-width: 100px; }
.schedule-rubric-checks { display: flex; flex-wrap: wrap; gap: 6px; }

.schedule-check-label {
    display: flex; align-items: center; gap: 4px;
    font-size: 12px; cursor: pointer;
    padding: 4px 8px; border-radius: 8px;
    border: 2px solid var(--border);
    transition: all 0.2s; user-select: none;
}
.schedule-check-label.checked {
    border-color: var(--rubric-color, var(--accent));
    background: color-mix(in srgb, var(--rubric-color, var(--accent)) 10%, white);
}
.schedule-check-label input { accent-color: var(--rubric-color, var(--accent)); }

/* ========== DRAFTS VIEW ========== */
.drafts-container {
    padding: 16px;
    max-width: 1440px;
    margin: 0 auto;
}

/* --- Mini Calendar --- */
.drafts-mini-calendar {
    margin-bottom: 24px;
}
.drafts-mini-cal-header {
    display: grid;
    grid-template-columns: 90px repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}
.drafts-mini-cal-week-hdr {
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff;
    padding: 6px 4px;
    border-radius: 8px;
    font-weight: 600;
    text-align: center;
    font-size: 10px;
}
.drafts-mini-cal-row {
    display: grid;
    grid-template-columns: 90px repeat(4, 1fr);
    gap: 4px;
    margin-bottom: 4px;
}
.drafts-mini-cal-day-label {
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff;
    padding: 6px 4px;
    border-radius: 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    font-size: 11px;
    font-weight: 600;
    text-align: center;
}
.drafts-mini-cal-day-label.today {
    background: linear-gradient(135deg, var(--accent), var(--g3));
}
.drafts-mini-cal-day-name {
    font-size: 11px;
    font-weight: 700;
}
.drafts-mini-rubric-tag {
    font-size: 7px;
    padding: 1px 3px;
    border-radius: 3px;
    font-weight: 600;
    white-space: normal;
    word-break: break-word;
    line-height: 1.2;
}
.drafts-mini-cell {
    border-radius: 8px;
    width: 100%;
    aspect-ratio: 1/1;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    transition: all 0.2s;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    cursor: pointer;
}
.drafts-mini-cell:hover {
    opacity: 0.85;
    transform: scale(1.04);
}
.drafts-mini-cell.today {
    outline: 2.5px solid var(--accent);
    outline-offset: -1px;
}
.drafts-mini-cell-text {
    font-size: 9px;
    font-weight: 500;
    text-align: left;
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    word-break: break-word;
    max-width: 100%;
    padding: 2px;
}
.drafts-mini-cell-dot {
    position: absolute;
    bottom: 3px;
    right: 3px;
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
    box-shadow: 0 0 0 1.5px #fff;
}

/* --- Day Sections with Horizontal Scroll --- */
.drafts-day-section {
    margin-bottom: 24px;
}
.drafts-day-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff;
    border-radius: 10px 10px 0 0;
    font-weight: 700;
    font-size: 14px;
    flex-wrap: wrap;
}
.drafts-day-section-header.today {
    background: linear-gradient(135deg, var(--accent), var(--g3));
}
.drafts-day-section-name {
    font-size: 14px;
    font-weight: 700;
}
.drafts-day-section-badges {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
}
.drafts-day-section-badge {
    font-size: 10px;
    padding: 2px 7px;
    border-radius: 5px;
    font-weight: 600;
}
.drafts-day-scroll {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    scroll-snap-type: x mandatory;
    -webkit-overflow-scrolling: touch;
    padding: 12px 4px 12px;
    background: var(--bg);
    border-radius: 0 0 10px 10px;
    border: 1px solid var(--border);
    border-top: none;
}
.drafts-day-scroll::-webkit-scrollbar { height: 4px; }
.drafts-day-scroll::-webkit-scrollbar-track { background: transparent; }
.drafts-day-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 4px; }

.drafts-day-card {
    min-width: 75vw;
    max-width: 75vw;
    scroll-snap-align: start;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 10px;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    border: 2px solid transparent;
    transition: all 0.25s;
}
.drafts-day-card:hover {
    border-color: var(--accent);
    box-shadow: var(--shadow-lg);
}
.drafts-day-card.today {
    border-color: var(--accent);
    background: linear-gradient(170deg, #faf8ff, #f3f0ff);
}
.drafts-day-card-date {
    font-size: 12px;
    color: var(--text3);
    font-weight: 600;
    margin-bottom: 6px;
}
.drafts-day-card-brief {
    font-size: 12px;
    color: #000;
    line-height: 1.4;
    margin-bottom: 8px;
    white-space: pre-wrap;
    word-break: break-word;
    padding: 8px 10px;
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border-radius: 8px;
    cursor: pointer;
    transition: background 0.2s;
}
.drafts-day-card-brief:hover {
    background: linear-gradient(135deg, #ede9fe, #e0dbf5);
}
.drafts-day-card-preview {
    background: linear-gradient(135deg, #f5f3ff, #ede9fe);
    border-radius: 8px;
    padding: 0;
    margin-bottom: 8px;
    flex: 1;
    overflow: hidden;
}
.drafts-day-card-preview-image {
    width: 100%;
    aspect-ratio: 4/5;
    object-fit: contain;
    background: #f5f3ff;
    display: block;
    border-radius: 8px 8px 0 0;
}
.drafts-day-card-preview-body {
    padding: 8px 10px;
}

/* Shared draft styles (kept) */
.draft-cell-preview-text {
    font-size: 11px;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 4;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.draft-cell-preview-label {
    font-size: 9px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--accent);
    font-weight: 700;
    margin-bottom: 2px;
}
.draft-create-btn {
    padding: 8px 14px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    background: transparent;
    color: var(--text3);
    font-size: 13px; font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    position: relative;
    margin-top: auto;
    width: 100%;
}
.draft-create-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Create menu popup */
.draft-create-menu {
    position: absolute;
    bottom: calc(100% + 6px);
    left: 50%;
    transform: translateX(-50%);
    background: var(--card);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 6px;
    z-index: 200;
    min-width: 130px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.draft-create-menu::after {
    content: '';
    position: absolute;
    bottom: -6px;
    left: 50%;
    transform: translateX(-50%);
    width: 12px; height: 12px;
    background: var(--card);
    clip-path: polygon(50% 100%, 0 0, 100% 0);
}
.draft-create-menu-item {
    padding: 8px 14px;
    border: none;
    background: transparent;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    cursor: pointer;
    text-align: left;
    font-family: inherit;
    transition: background 0.15s;
}
.draft-create-menu-item:hover {
    background: linear-gradient(135deg, rgba(124,92,252,0.08), rgba(168,85,247,0.08));
    color: var(--accent);
}
.drafts-day-card-actions {
    display: flex;
    gap: 6px;
    margin-top: 4px;
}
.draft-edit-btn {
    padding: 6px 12px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff;
    font-size: 12px; font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
    flex: 1;
}
.draft-edit-btn:hover { opacity: 0.85; }
.draft-delete-btn {
    padding: 6px 10px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #f87171, #ef4444);
    color: #fff;
    font-size: 12px; font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: opacity 0.2s;
    flex-shrink: 0;
}
.draft-delete-btn:hover { opacity: 0.85; }

/* ========== FULL-SCREEN EDITOR ========== */
.editor-overlay {
    position: fixed;
    inset: 0;
    background: #fff;
    z-index: 2000;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
}
.editor-overlay.hidden { display: none; }

.editor-container {
    max-width: 720px;
    width: 100%;
    margin: 0 auto;
    padding: 20px 24px 40px;
    flex: 1;
}
.editor-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
    padding-bottom: 4px;
    border-bottom: 1px solid var(--border);
}
.editor-header h2 {
    font-size: 14px;
    letter-spacing: -0.3px;
}
.editor-body {}

/* Rich text toolbar */
.editor-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 6px;
}
.editor-tb-btn {
    width: 34px; height: 34px;
    border: 2px solid var(--border);
    border-radius: 8px;
    background: var(--bg);
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text);
    transition: all 0.15s;
    font-family: inherit;
}
.editor-tb-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Contenteditable area */
.editor-step {
    display: flex;
    flex-direction: column;
    height: calc(100vh - 60px);
    overflow: hidden;
    padding-bottom: 10px;
}

.editor-voice-section {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.editor-voice-btn-inline {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text2);
    padding: 8px 14px;
    cursor: pointer;
    font-size: 13px;
    font-family: inherit;
    transition: all 0.2s;
}
.editor-voice-btn-inline:hover { border-color: var(--accent); color: var(--accent); }
.editor-voice-btn-inline.recording { border-color: var(--danger); color: var(--danger); }

.editor-next-btn {
    width: 100%;
    margin-top: 10px;
    padding: 14px !important;
    font-size: 16px !important;
}

.editor-text-main { flex: 1; display: flex; flex-direction: column; }

.editor-textarea {
    width: 100%;
    flex: 1;
    min-height: 60vh;
    padding: 16px;
    border: 2px solid var(--border);
    border-radius: 12px;
    font-size: 15px;
    font-family: 'Inter', -apple-system, sans-serif;
    font-weight: 500;
    line-height: 1.7;
    resize: none;
    outline: none;
    background: var(--bg);
    transition: border-color 0.2s;
    color: var(--text);
}
.editor-textarea:focus { border-color: var(--accent); }
.editor-textarea::placeholder { color: var(--text3); }

.editor-bottom-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}
.editor-bottom-icons { display: flex; gap: 8px; }
.editor-icon-btn {
    background: none;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    color: var(--text2);
    padding: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}
.editor-icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.editor-icon-label { font-size: 11px; font-weight: 600; }

.editor-body { display: flex; flex-direction: column; min-height: calc(100vh - 60px); }

.editor-media-drop {
    margin-bottom: 10px;
}

.editor-media-carousel {
    position: relative;
}

.editor-media-placeholder {
    height: 30vh;
    border: 2px dashed var(--border);
    border-radius: 14px;
    background: var(--bg);
    display: flex;
    align-items: center;
    justify-content: center;
}

.editor-media-add-buttons {
    display: flex;
    gap: 10px;
}

.editor-media-add-btn {
    padding: 14px 24px;
    border: 2px dashed var(--border);
    border-radius: 12px;
    background: var(--card);
    color: var(--text2);
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}
.editor-media-add-btn:hover { border-color: var(--accent); color: var(--accent); }

.editor-media-display {
    border-radius: 14px;
    overflow: hidden;
    background: #f5f3ff;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    max-height: 30vh;
}

.editor-media-img {
    max-width: 100%;
    max-height: 30vh;
    object-fit: contain;
}

.editor-media-vid {
    max-width: 100%;
    max-height: 30vh;
    object-fit: contain;
    background: #1a1a2e;
}

.editor-media-delete {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: rgba(239,68,68,0.85);
    color: #fff;
    border: none;
    font-size: 16px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 5;
    box-shadow: 0 2px 6px rgba(0,0,0,0.2);
}
.editor-media-delete:hover { background: #ef4444; }

.editor-media-nav {
    position: absolute;
    top: 0; left: 0; right: 0; bottom: 0;
    pointer-events: none;
}
.editor-media-nav .photo-gallery-btn { pointer-events: auto; }

.editor-media-add-more {
    display: flex;
    gap: 6px;
    justify-content: center;
    margin-top: 8px;
}

.editor-media-add-btn-sm {
    padding: 6px 14px;
    border: 1.5px dashed var(--border);
    border-radius: 8px;
    background: none;
    color: var(--text3);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.editor-media-add-btn-sm:hover { border-color: var(--accent); color: var(--accent); }

.editor-step2-content {
    padding: 6px 0;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
}

.editor-step2-textarea {
    width: 100%;
    min-height: 80px;
    max-height: 15vh;
    padding: 12px;
    border: 1.5px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: 'Inter', -apple-system, sans-serif;
    font-weight: 500;
    line-height: 1.6;
    resize: vertical;
    outline: none;
    background: var(--bg);
    color: var(--text);
    transition: border-color 0.2s;
}
.editor-step2-textarea:focus { border-color: var(--accent); }

.editor-step2-voice {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.editor-step2-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-top: 1px solid var(--border);
    margin-top: auto;
    margin-top: 8px;
}

.brief-modal-actions { flex-wrap: wrap; gap: 8px; }
.brief-create-btns { display: flex; gap: 6px; }
.brief-create-btn { font-size: 12px !important; padding: 6px 12px !important; }

.editor-contenteditable {
    display: none; /* deprecated, using textarea now */
    word-wrap: break-word;
}
.editor-contenteditable:focus {
    border-color: var(--accent);
}
.editor-contenteditable:empty::before {
    content: attr(data-placeholder);
    color: var(--text3);
    pointer-events: none;
}

/* Emoji picker */
.editor-emoji-picker {
    display: grid;
    grid-template-columns: repeat(10, 1fr);
    gap: 4px;
    padding: 10px;
    border: 2px solid var(--border);
    border-radius: 10px;
    background: var(--card);
    margin-bottom: 6px;
    max-height: 180px;
    overflow-y: auto;
}
.editor-emoji-picker.hidden { display: none; }
.editor-emoji-btn {
    width: 32px; height: 32px;
    border: none;
    background: transparent;
    border-radius: 6px;
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}
.editor-emoji-btn:hover {
    background: var(--bg);
}

/* Photos grid */
.editor-photos-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.editor-photo-thumb {
    position: relative;
    width: 80px; height: 80px;
    border-radius: 10px;
    overflow: hidden;
    border: 2px solid var(--border);
}
.editor-photo-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
}
.editor-photo-remove {
    position: absolute; top: 3px; right: 3px;
    width: 20px; height: 20px;
    border-radius: 50%;
    background: rgba(248,113,113,0.9);
    color: #fff;
    border: none;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}
.editor-photo-remove:hover { background: #ef4444; }
.editor-add-photo-btn {
    width: 80px; height: 80px;
    border: 2px dashed var(--border);
    border-radius: 10px;
    background: transparent;
    color: var(--text3);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.editor-add-photo-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

/* Editor actions */
.editor-actions {
    display: flex;
    gap: 10px;
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    flex-wrap: wrap;
}
.editor-download-btn {
    background: var(--bg) !important;
    color: var(--text2) !important;
    border: 2px solid var(--border) !important;
    padding: 10px 18px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 600;
    cursor: pointer;
}
.editor-download-btn:hover {
    border-color: var(--accent) !important;
    color: var(--accent) !important;
}

/* ========== WEEK FILTER BUTTONS ========== */
.drafts-week-filter {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
}
.drafts-week-filter-btn {
    padding: 6px 14px;
    border: 2px solid var(--border);
    border-radius: 20px;
    background: transparent;
    color: var(--text2);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.drafts-week-filter-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.drafts-week-filter-btn.active {
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff;
    border-color: transparent;
}

/* Single week mode for mini calendar */
.drafts-mini-cal-header.single-week {
    grid-template-columns: 90px 1fr;
}
.drafts-mini-cal-row.single-week {
    grid-template-columns: 90px 1fr;
}
.drafts-mini-cal-row.single-week .drafts-mini-cell {
    aspect-ratio: 3/1;
}
.drafts-mini-cal-row.single-week .drafts-mini-cell-text {
    font-size: 12px;
    -webkit-line-clamp: 3;
}

/* ========== FILTER A FLOATING BUTTON ========== */
.filter-a-btn {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    border: 2px solid var(--border);
    background: var(--card);
    color: var(--text2);
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    z-index: 500;
    box-shadow: var(--shadow-lg);
    transition: all 0.2s;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
}
.filter-a-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: scale(1.05);
}
.filter-a-btn.active {
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff;
    border-color: transparent;
    box-shadow: 0 4px 16px rgba(124,92,252,0.35);
}

/* ========== DIMMED CELL (filterA) ========== */
.drafts-mini-cell.dimmed {
    visibility: hidden;
}

/* ========== TAG A INDICATOR ON MINI CELL ========== */
.drafts-mini-cell-tag-a {
    position: absolute;
    top: 2px;
    right: 2px;
    font-size: 8px;
    font-weight: 800;
    line-height: 1;
    opacity: 0.7;
}

/* ========== TAG A TOGGLE IN BRIEF MODAL ========== */
.brief-tag-a-wrap {
    margin-bottom: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.brief-tag-a-btn {
    padding: 4px 12px;
    border: 2px solid var(--border);
    border-radius: 16px;
    background: transparent;
    color: var(--text2);
    font-size: 13px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.brief-tag-a-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}
.brief-tag-a-btn.active {
    background: linear-gradient(135deg, var(--g1), var(--g2));
    color: #fff;
    border-color: transparent;
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
    .view-tabs { display: flex; }

    .diary {
        overflow: clip;
    }

    header {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
}

@media (max-width: 768px) {
    header { padding: 10px 14px; }
    header h1 { font-size: 16px; }
    #viewOverview .diary { padding: 8px; }
    .modal-content { padding: 16px; border-radius: 16px; }
    .form-row { grid-template-columns: 1fr; gap: 10px; }
    .days-card { min-width: 88%; max-width: 88%; }
    .schedule-day-name { min-width: 70px; font-size: 12px; }
    .editor-textarea { min-height: 40vh; }
    .drafts-day-card { min-width: 80vw; max-width: 80vw; }
    .drafts-mini-cal-header,
    .drafts-mini-cal-row {
        grid-template-columns: 60px repeat(4, 1fr);
    }
    .drafts-mini-cal-header.single-week,
    .drafts-mini-cal-row.single-week {
        grid-template-columns: 60px 1fr;
    }
    .drafts-mini-cal-day-label { font-size: 10px; padding: 4px 2px; }
    .drafts-mini-cell-text { font-size: 8px; }
    .drafts-mini-cal-row.single-week .drafts-mini-cell-text { font-size: 11px; }
}

@media (max-width: 480px) {
    .header-left h1 { display: none; }
    #dateRange { font-size: 11px; min-width: 100px; }
    .btn-pill { font-size: 11px; padding: 6px 10px; }
    .days-card { min-width: 92%; max-width: 92%; }
    .schedule-day-name { min-width: 100%; }
    .schedule-rubric-checks { width: 100%; }
    .drafts-day-card { min-width: 80vw; max-width: 80vw; }
}

@media (max-width: 400px) {
    .drafts-mini-cal-header,
    .drafts-mini-cal-row {
        grid-template-columns: 48px repeat(4, 1fr);
    }
    .drafts-mini-cal-header.single-week,
    .drafts-mini-cal-row.single-week {
        grid-template-columns: 48px 1fr;
    }
    .drafts-mini-cal-day-label { font-size: 9px; padding: 3px 1px; }
    .drafts-mini-rubric-tag { font-size: 6px; }
    .drafts-mini-cell-text { font-size: 7px; }
    .drafts-mini-cal-row.single-week .drafts-mini-cell-text { font-size: 10px; }
}

@media (min-width: 1025px) {
    .view-tabs { display: none !important; }
    .day-picker { display: none !important; }
    #viewWeek { display: none !important; }
    #viewDays { display: none !important; }
    #viewOverview { display: block !important; }
    #viewDrafts.desktop-active { display: block !important; }
    #viewOverview.desktop-hidden { display: none !important; }
    .drafts-day-card { min-width: 220px; max-width: 280px; }
    .drafts-day-scroll { padding: 12px 8px; }
}
