/* ============================================
   InsightTube Dashboard - Light Theme
   ============================================ */

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

:root {
    --bg: #f5f5f7;
    --bg-card: #ffffff;
    --bg-card-hover: #fafafa;
    --bg-modal: #ffffff;
    --bg-input: #f0f0f3;
    --border: #e0e0e4;
    --border-focus: #7c6ef0;
    --text: #1d1d1f;
    --text-muted: #86868b;
    --accent: #7c6ef0;
    --accent-light: #ede9fe;
    --accent-hover: #6b5ce7;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --danger-light: #fef2f2;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --success: #10b981;
    --success-light: #ecfdf5;
    --tag-bg: #f0ecff;
    --tag-text: #6b5ce7;
    --radius: 12px;
    --radius-sm: 8px;
    --shadow-sm: 0 1px 3px rgba(0,0,0,0.06);
    --shadow: 0 4px 12px rgba(0,0,0,0.08);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
    --transition: 0.2s ease;
}

html { font-size: 15px; }

body {
    font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    padding-bottom: 2rem;
}

/* --- Header --- */
.header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    background: rgba(255,255,255,0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.header h1 {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.count-badge {
    background: var(--accent-light);
    color: var(--accent);
    padding: 0.2rem 0.65rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
}

/* --- Filter Bar --- */
.filter-bar {
    display: flex;
    align-items: flex-end;
    gap: 0.75rem;
    padding: 0.85rem 1.5rem;
    border-bottom: 1px solid var(--border);
    background: #fff;
    flex-wrap: wrap;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
}

.filter-group label {
    font-size: 0.65rem;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.06em;
    font-weight: 600;
}

.filter-group select,
.filter-group input {
    background: var(--bg-input);
    border: 1px solid transparent;
    color: var(--text);
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.85rem;
    outline: none;
    transition: all var(--transition);
}

.filter-group select:focus,
.filter-group input:focus {
    border-color: var(--accent);
    background: #fff;
    box-shadow: 0 0 0 3px var(--accent-light);
}

.search-group { flex: 1; min-width: 180px; }
.search-group input { width: 100%; }

/* --- Buttons --- */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.45rem 0.85rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 0.82rem;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    font-family: inherit;
    white-space: nowrap;
    font-weight: 500;
}

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

.btn-secondary {
    background: var(--bg-input);
    color: var(--text);
}
.btn-secondary:hover { background: var(--border); }

.btn-outline {
    background: transparent;
    border: 1px solid var(--border);
    color: var(--text-muted);
}
.btn-outline:hover { border-color: #999; color: var(--text); background: var(--bg-input); }

.btn-danger {
    background: transparent;
    color: var(--danger);
    border: 1px solid #fecaca;
}
.btn-danger:hover { background: var(--danger-light); }

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

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    font-size: 1.1rem;
    padding: 0.3rem 0.4rem;
    border-radius: 6px;
}
.btn-ghost:hover { background: var(--bg-input); color: var(--text); }

.btn-obsidian {
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent-light);
}
.btn-obsidian:hover { background: var(--accent-light); border-color: var(--accent); }

/* --- Card List --- */
.card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 0.85rem;
    padding: 1.25rem 1.5rem;
}

/* --- Card --- */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    cursor: pointer;
    transition: all var(--transition);
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.card:hover {
    border-color: var(--ch-color, var(--accent));
    box-shadow: 0 4px 12px color-mix(in srgb, var(--ch-color, var(--accent)) 15%, transparent);
    transform: translateY(-2px);
}

.card-channel {
    font-size: 0.72rem;
    color: var(--accent);
    font-weight: 600;
}

.card-title {
    font-size: 0.95rem;
    font-weight: 600;
    line-height: 1.4;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.card-preview {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.5;
}

.card-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: auto;
    padding-top: 0.55rem;
    border-top: 1px solid var(--border);
}

.card-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }

.tag {
    background: var(--tag-bg);
    color: var(--tag-text);
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    font-size: 0.68rem;
    font-weight: 500;
}

.card-date { font-size: 0.7rem; color: var(--text-muted); }

/* --- 읽음 체크박스 (Letter) --- */
.card-read-check {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border: 1.5px solid var(--border);
    border-radius: 5px;
    cursor: pointer;
    transition: all var(--transition);
    background: #fff;
    flex-shrink: 0;
    position: relative;
}

.card-read-check:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.card-read-check input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 100%;
    height: 100%;
    cursor: pointer;
    margin: 0;
}

.card-read-icon {
    font-size: 0.7rem;
    font-weight: 700;
    color: #fff;
    pointer-events: none;
}

.card-read-check:has(input:checked) {
    background: var(--accent);
    border-color: var(--accent);
}

/* 읽음 처리된 카드 */
.card--read {
    opacity: 0.5;
    border-style: dashed;
}

.card--read:hover {
    opacity: 0.75;
}

.card-category {
    font-size: 0.68rem;
    color: var(--warning);
    background: var(--warning-light);
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    font-weight: 500;
}

/* --- Status Badge --- */
.card-status {
    display: inline-block;
    font-size: 0.62rem;
    padding: 0.12rem 0.45rem;
    border-radius: 4px;
    font-weight: 600;
}

.card-status[data-status="To Read"] { background: var(--accent-light); color: var(--accent); }
.card-status[data-status="To Watch"] { background: var(--warning-light); color: var(--warning); }
.card-status[data-status="To Obsidian"] { background: var(--success-light); color: var(--success); }
.card-status[data-status="Error"] { background: #fff1f2; color: #e11d48; }
.card-status[data-status="Deleted"] { background: var(--danger-light); color: var(--danger); }

/* --- Empty / Loading --- */
.empty-state {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-muted);
    font-size: 1rem;
}

.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 3rem;
    color: var(--text-muted);
}
.loading.hidden { display: none; }

.spinner {
    width: 26px;
    height: 26px;
    border: 3px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- Modal --- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    backdrop-filter: blur(4px);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s ease;
}
.modal-overlay.active { opacity: 1; pointer-events: auto; }

.modal {
    background: var(--bg-modal);
    border: 1px solid var(--border);
    border-radius: 16px;
    width: 90%;
    max-width: 900px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    transform: translateY(16px) scale(0.98);
    transition: transform 0.25s ease;
}
.modal-overlay.active .modal { transform: translateY(0) scale(1); }

.modal-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--border);
    gap: 1rem;
}

.modal-header h2 {
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.4;
}

.modal-close { flex-shrink: 0; }

.modal-meta {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 1.5rem;
    font-size: 0.78rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
    background: var(--bg);
    flex-wrap: wrap;
}

.modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    font-size: 0.92rem;
    line-height: 1.75;
    color: var(--text);
    word-break: keep-all;
    overflow-wrap: break-word;
}

/* 마크다운 렌더링 - 풍부한 타이포그래피 */

.modal-body h1,
.modal-body h2,
.modal-body h3,
.modal-body h4 {
    font-weight: 700;
    line-height: 1.4;
    margin-top: 1.6rem;
    margin-bottom: 0.6rem;
}

.modal-body h1 {
    font-size: 1.35rem;
    padding-bottom: 0.45rem;
    border-bottom: 2px solid var(--accent-light);
}

.modal-body h2 {
    font-size: 1.15rem;
    color: var(--accent);
    padding-bottom: 0.35rem;
    border-bottom: 1px solid var(--border);
}

.modal-body h3 {
    font-size: 1rem;
    color: var(--text);
}

.modal-body h4 {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.modal-body h1:first-child,
.modal-body h2:first-child,
.modal-body h3:first-child {
    margin-top: 0;
}

.modal-body p {
    margin-bottom: 0.85rem;
}

.modal-body ul,
.modal-body ol {
    margin-left: 1.4rem;
    margin-bottom: 0.85rem;
    padding-left: 0.4rem;
}

.modal-body ul { list-style: disc; }
.modal-body ol { list-style: decimal; }

.modal-body li {
    margin-bottom: 0.35rem;
    line-height: 1.65;
}

.modal-body li > ul,
.modal-body li > ol {
    margin-top: 0.3rem;
    margin-bottom: 0.3rem;
}

/* 인라인 코드 */
.modal-body code {
    background: var(--accent-light);
    color: var(--accent-hover);
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    font-size: 0.82em;
    font-family: 'Consolas', 'Monaco', 'Menlo', monospace;
}

/* 코드 블록 */
.modal-body pre {
    background: #1e1e2e;
    color: #cdd6f4;
    padding: 1rem 1.2rem;
    border-radius: var(--radius);
    overflow-x: auto;
    margin-bottom: 1rem;
    font-size: 0.8rem;
    line-height: 1.6;
}

.modal-body pre code {
    background: none;
    color: inherit;
    padding: 0;
    border-radius: 0;
    font-size: inherit;
}

/* 인용문 */
.modal-body blockquote {
    border-left: 3px solid var(--accent);
    background: var(--accent-light);
    padding: 0.75rem 1rem;
    margin: 0 0 1rem 0;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
    color: #4a4a5a;
    font-style: italic;
}

.modal-body blockquote p:last-child {
    margin-bottom: 0;
}

/* 강조 */
.modal-body strong {
    color: var(--text);
    font-weight: 700;
}

.modal-body em {
    font-style: italic;
    color: #555;
}

/* 링크 */
.modal-body a {
    color: var(--accent);
    text-decoration: none;
    border-bottom: 1px solid transparent;
    transition: border-color var(--transition);
}

.modal-body a:hover {
    border-bottom-color: var(--accent);
}

/* 수평선 */
.modal-body hr {
    border: none;
    border-top: 1px solid var(--border);
    margin: 1.5rem 0;
}

/* 테이블 */
.modal-body table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 1rem;
    font-size: 0.85rem;
}

.modal-body thead th {
    background: var(--bg);
    font-weight: 700;
    text-align: left;
    padding: 0.55rem 0.75rem;
    border-bottom: 2px solid var(--border);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: var(--text-muted);
}

.modal-body tbody td {
    padding: 0.5rem 0.75rem;
    border-bottom: 1px solid var(--border);
}

.modal-body tbody tr:hover {
    background: var(--bg);
}

/* 이미지 */
.modal-body img {
    max-width: 100%;
    border-radius: var(--radius-sm);
    margin: 0.5rem 0;
}

.modal-actions {
    display: flex;
    gap: 0.5rem;
    padding: 0.85rem 1.5rem;
    border-top: 1px solid var(--border);
    background: var(--bg);
    border-radius: 0 0 16px 16px;
    flex-wrap: wrap;
}

/* 모달 읽음 체크박스 */
.modal-read-check {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-left: auto;
    padding: 0.35rem 0.7rem;
    border: 1.5px solid var(--border);
    border-radius: 8px;
    cursor: pointer;
    transition: all var(--transition);
    background: #fff;
    user-select: none;
}
.modal-read-check:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}
.modal-read-check input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--accent);
    margin: 0;
}
.modal-read-label {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
}
.modal-read-check:has(input:checked) {
    background: var(--accent);
    border-color: var(--accent);
}
.modal-read-check:has(input:checked) .modal-read-label {
    color: #fff;
}

/* --- Edit Mode (모달 내 편집 폼) --- */
.edit-form { display: flex; flex-direction: column; gap: 1rem; }

.edit-field label {
    display: block;
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    color: var(--text-muted);
    letter-spacing: 0.04em;
    margin-bottom: 0.3rem;
}

.edit-field input,
.edit-field textarea,
.edit-field select {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.5rem 0.7rem;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: all var(--transition);
    resize: vertical;
}

.edit-field input:focus,
.edit-field textarea:focus,
.edit-field select:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.edit-field textarea { min-height: 320px; font-family: 'Consolas', 'Monaco', monospace; font-size: 0.82rem; line-height: 1.6; }

.edit-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.edit-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
}

/* --- Toast --- */
.toast-container {
    position: fixed;
    bottom: 1.5rem;
    right: 1.5rem;
    z-index: 300;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.toast {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 1rem;
    font-size: 0.85rem;
    box-shadow: var(--shadow);
    animation: slideIn 0.3s ease, fadeOut 0.3s ease 2.5s forwards;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error   { border-left: 3px solid var(--danger); }
.toast.info    { border-left: 3px solid var(--accent); }

@keyframes slideIn {
    from { transform: translateX(100%); opacity: 0; }
    to   { transform: translateX(0); opacity: 1; }
}
@keyframes fadeOut { to { opacity: 0; transform: translateY(10px); } }

/* --- Landing Page --- */
.landing {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 2rem;
    gap: 3rem;
}

.landing-header { text-align: center; }

.landing-logo {
    font-size: 2.4rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.landing-sub { color: var(--text-muted); font-size: 0.95rem; margin-top: 0.5rem; }

.landing-cards {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.5rem;
    width: 100%;
    max-width: 720px;
}

.landing-card {
    position: relative;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 2rem 1.8rem;
    text-decoration: none;
    color: var(--text);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
}

.landing-card:hover {
    border-color: var(--accent);
    transform: translateY(-4px);
    box-shadow: var(--shadow-lg);
}

.landing-card-icon { font-size: 2.2rem; margin-bottom: 0.3rem; }
.landing-card-title { font-size: 1.25rem; font-weight: 700; }

.landing-card-desc {
    font-size: 0.8rem;
    color: var(--accent);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.landing-card-detail {
    font-size: 0.85rem;
    color: var(--text-muted);
    line-height: 1.55;
    margin-top: 0.3rem;
}

.landing-card-arrow {
    position: absolute;
    bottom: 1.5rem;
    right: 1.8rem;
    font-size: 1.3rem;
    color: var(--text-muted);
    transition: all 0.3s ease;
}
.landing-card:hover .landing-card-arrow { color: var(--accent); transform: translateX(4px); }

/* 랜딩 Mobile 링크 */
.landing-mobile-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: 1px dashed #c4b5fd;
    border-radius: var(--radius-sm);
    background: #fff;
    color: var(--accent);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
}
.landing-mobile-link:hover {
    background: var(--accent-light);
    border-color: var(--accent);
}

/* 랜딩 Error 링크 */
.landing-error-link {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 1.2rem;
    border: 1px dashed #fca5a5;
    border-radius: var(--radius-sm);
    background: #fff;
    color: #e11d48;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--transition);
}

.landing-error-link:hover {
    background: #fff1f2;
    border-color: #e11d48;
}

.landing-error-count {
    background: #e11d48;
    color: #fff;
    font-size: 0.7rem;
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    min-width: 1.2rem;
    text-align: center;
}

.landing-error-count:empty {
    display: none;
}

/* Error 카드 좌측 보더 */
.error-card {
    border-left: 3px solid #e11d48;
}

.error-badge {
    background: #fff1f2 !important;
    color: #e11d48 !important;
}

/* --- Date Group (Letter 날짜별 그룹핑) --- */
.card-list.date-grouped {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
}

.date-group {
    border-bottom: 1px solid var(--border);
}

.date-group-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.75rem 1.5rem;
    background: var(--bg);
    width: 100%;
    border: none;
    font-family: inherit;
    cursor: default;
}

.date-group-header.toggle {
    cursor: pointer;
    transition: background var(--transition);
}

.date-group-header.toggle:hover {
    background: var(--border);
}

.date-group-arrow {
    font-size: 0.65rem;
    color: var(--text-muted);
    transition: transform 0.2s ease;
    width: 0.8rem;
    text-align: center;
}

.date-group-label {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
}

.date-group-header.today .date-group-label {
    color: var(--accent);
}

.date-group-count {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
    background: var(--bg-input);
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
}

.date-group-cards {
    padding: 1rem 1.5rem;
}

.date-group-cards.card-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
    gap: 0.85rem;
}

/* --- Brief Layout (2-column) --- */
.brief-layout {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 0;
    min-height: calc(100vh - 120px);
}

.brief-main {
    min-width: 0;
}

/* --- Requester Panel (Brief 우측 사이드바) --- */
.requester-panel {
    border-left: 1px solid var(--border);
    background: #fff;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    position: sticky;
    top: 120px;
}

.requester-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.requester-panel-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
}

.requester-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

/* 요청자 칩 버튼 */
.requester-chip {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: #fff;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text);
}

.requester-chip:hover {
    border-color: var(--accent);
    background: var(--accent-light);
}

.requester-chip.active {
    background: var(--accent);
    color: #fff;
    border-color: var(--accent);
}

.requester-chip .chip-count {
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(0,0,0,0.08);
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
    min-width: 1.4rem;
    text-align: center;
}

.requester-chip.active .chip-count {
    background: rgba(255,255,255,0.25);
}

/* 전체 보기 칩 */
.requester-chip-all {
    color: var(--text-muted);
    font-weight: 600;
    border-style: dashed;
}

.requester-chip-all.active {
    background: var(--accent);
    color: #fff;
    border-style: solid;
    border-color: var(--accent);
}

/* --- 요청자별 현황 차트 (Brief) --- */
.req-chart-section {
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.req-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.75rem 0.35rem;
    gap: 0.4rem;
}

.req-chart-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.req-chart-legend {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.req-chart-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.25rem 0.75rem 0.65rem;
    max-height: 200px;
    overflow-y: auto;
}

.req-chart-empty {
    text-align: center;
    padding: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Letter Layout (2-column) --- */
.letter-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 0;
    min-height: calc(100vh - 120px);
}

.letter-main {
    min-width: 0;
}

/* --- Channel Panel (우측 사이드바) --- */
.channel-panel {
    border-left: 1px solid var(--border);
    background: #fff;
    display: flex;
    flex-direction: column;
    height: calc(100vh - 120px);
    position: sticky;
    top: 120px;
}

.channel-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.channel-panel-header h3 {
    font-size: 0.9rem;
    font-weight: 700;
}

.channel-add-form {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--border);
    background: var(--bg);
}

.channel-add-form input {
    width: 100%;
    background: #fff;
    border: 1px solid var(--border);
    color: var(--text);
    padding: 0.4rem 0.6rem;
    border-radius: var(--radius-sm);
    font-size: 0.8rem;
    outline: none;
    transition: all var(--transition);
    font-family: inherit;
}

.channel-add-form input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.btn-sm {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
}

.channel-list {
    flex: 1;
    overflow-y: auto;
    padding: 0.5rem 0;
}

/* 개별 채널 행 */
.channel-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.25rem;
    padding: 0.55rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--transition);
}

.channel-row:hover {
    background: var(--bg);
}

.channel-row-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.channel-row-name {
    font-size: 0.82rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.channel-row-name a {
    color: var(--text);
    text-decoration: none;
}
.channel-row-name a:hover {
    color: var(--accent);
}

/* 체크박스 토글 */
.time-check {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
}

.time-check-label {
    font-size: 0.58rem;
    color: var(--text-muted);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.time-check input[type="checkbox"] {
    width: 18px;
    height: 18px;
    accent-color: var(--accent);
    cursor: pointer;
    border-radius: 4px;
}

/* 채널 편집/삭제 인라인 */
.channel-row-actions {
    display: flex;
    gap: 0.2rem;
    margin-left: 0.25rem;
}

.channel-row-actions button {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 0.72rem;
    padding: 0.2rem;
    border-radius: 4px;
    color: var(--text-muted);
    transition: all var(--transition);
}
.channel-row-actions button:hover {
    background: var(--bg-input);
    color: var(--text);
}

/* 채널 패널 빈 상태 */
.channel-empty {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--text-muted);
    font-size: 0.85rem;
}

/* --- 채널별 현황 차트 섹션 --- */
.ch-chart-section {
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
}

.ch-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 1rem 0.35rem;
    gap: 0.5rem;
}

.ch-chart-title {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
}

.ch-chart-legend {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.ch-legend-item {
    display: inline-flex;
    align-items: center;
    gap: 0.2rem;
    font-size: 0.58rem;
    color: var(--text-muted);
    font-weight: 500;
}

.ch-legend-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0;
}

.ch-chart-body {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
    padding: 0.25rem 1rem 0.65rem;
    max-height: 240px;
    overflow-y: auto;
}

.ch-chart-row {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.ch-chart-label {
    font-size: 0.68rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.3;
}

.ch-chart-bar-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.ch-chart-bar {
    display: flex;
    height: 7px;
    border-radius: 3.5px;
    overflow: hidden;
    flex: 1;
    background: var(--bg-input);
    min-width: 0;
}

.ch-bar-seg {
    min-width: 2px;
    height: 100%;
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.ch-bar-seg:first-child { border-radius: 3.5px 0 0 3.5px; }
.ch-bar-seg:last-child  { border-radius: 0 3.5px 3.5px 0; }
.ch-bar-seg:only-child  { border-radius: 3.5px; }

.ch-chart-val {
    font-size: 0.6rem;
    font-weight: 700;
    color: var(--text-muted);
    min-width: 1.2rem;
    text-align: right;
    flex-shrink: 0;
}

.ch-chart-empty {
    text-align: center;
    padding: 1rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* --- Responsive --- */
@media (max-width: 900px) {
    .brief-layout {
        grid-template-columns: 1fr;
    }
    .requester-panel {
        position: static;
        height: auto;
        max-height: 40vh;
        border-left: none;
        border-top: 1px solid var(--border);
    }
    .letter-layout {
        grid-template-columns: 1fr;
    }
    .channel-panel {
        position: static;
        height: auto;
        max-height: 50vh;
        border-left: none;
        border-top: 1px solid var(--border);
    }
}

@media (max-width: 640px) {
    .landing-cards { grid-template-columns: 1fr; }
    .landing-logo { font-size: 1.8rem; }
    .header h1 { font-size: 1rem; }
    .filter-bar { flex-direction: column; gap: 0.5rem; }
    .filter-group { width: 100%; }
    .filter-group select, .filter-group input { width: 100%; }
    .card-list { grid-template-columns: 1fr; padding: 1rem; }
    .modal { width: 95%; max-height: 90vh; }
    .modal-actions { flex-direction: column; }
    .modal-actions .btn { width: 100%; justify-content: center; }
    .edit-row { grid-template-columns: 1fr; }
}
