:root {
    --sidebar-width: 220px;
    --primary: #00A1D6;
    --primary-dark: #0087b3;
    --danger: #EF4444;
    --success: #10B981;
    --warning: #F59E0B;
    --bg: #f5f7fa;
    --card-bg: #ffffff;
    --text: #1f2937;
    --text-secondary: #6b7280;
    --border: #e5e7eb;
    --shadow: 0 1px 3px rgba(0,0,0,0.08);
    --radius: 12px;
}

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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    display: flex;
    min-height: 100vh;
}

/* ── Sidebar ─────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--card-bg);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    height: 100vh;
    z-index: 100;
}

.logo {
    padding: 24px 20px;
    display: flex;
    align-items: center;
    gap: 10px;
    border-bottom: 1px solid var(--border);
}

.logo-icon { font-size: 24px; }
.logo-text { font-size: 16px; font-weight: 700; color: var(--text); }

.nav-menu {
    list-style: none;
    padding: 16px 12px;
    flex: 1;
}

.nav-menu li { margin-bottom: 4px; }

.nav-menu a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 8px;
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 14px;
    transition: all 0.2s;
}

.nav-menu a:hover { background: #f3f4f6; color: var(--text); }
.nav-menu a.active { background: rgba(0,161,214,0.1); color: var(--primary); font-weight: 600; }
.nav-icon { font-size: 18px; }

.nav-footer {
    padding: 16px;
    border-top: 1px solid var(--border);
    text-align: center;
    color: var(--text-secondary);
    font-size: 12px;
}

/* ── Main Content ────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    padding: 32px;
    max-width: calc(100vw - var(--sidebar-width));
}

.page-header {
    margin-bottom: 28px;
}

.page-header h1 { font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.subtitle { color: var(--text-secondary); font-size: 14px; }

.month-nav {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 12px;
}

.month-title { font-size: 18px; font-weight: 600; min-width: 120px; text-align: center; }

/* ── Stats Grid ──────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: 16px;
    margin-bottom: 28px;
}

.stat-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.stat-card.primary { border-left: 4px solid var(--primary); }

.stat-icon { font-size: 28px; margin-bottom: 8px; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--text); margin-bottom: 4px; }
.stat-label { font-size: 13px; color: var(--text-secondary); }

/* ── Dashboard Grid ──────────────────── */
.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.panel {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

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

.panel-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
}

.panel-header h2 { font-size: 16px; font-weight: 600; }

.panel-body { padding: 16px 20px; }

.empty { color: var(--text-secondary); text-align: center; padding: 24px; font-size: 14px; }

/* ── Plan Items ──────────────────────── */
.plan-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 8px;
    margin-bottom: 8px;
    background: #f9fafb;
    font-size: 14px;
}

.plan-item:last-child { margin-bottom: 0; }

.plan-badge { font-size: 12px; white-space: nowrap; }
.plan-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.plan-date { color: var(--text-secondary); font-size: 12px; min-width: 36px; }

.plan-status {
    font-size: 11px;
    padding: 2px 8px;
    border-radius: 12px;
    text-transform: uppercase;
    font-weight: 600;
}

.status-planned { background: #fef3c7; color: #92400e; }
.status-completed { background: #d1fae5; color: #065f46; }
.status-cancelled { background: #fee2e2; color: #991b1b; }

/* ── Data Table ──────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; padding: 10px 12px; color: var(--text-secondary); font-weight: 500; border-bottom: 1px solid var(--border); font-size: 12px; text-transform: uppercase; }
.data-table td { padding: 12px; border-bottom: 1px solid var(--border); }
.data-table tr:hover { background: #f9fafb; }
.title-cell { max-width: 300px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.data-table code { background: #f3f4f6; padding: 2px 6px; border-radius: 4px; font-size: 12px; }

/* ── Account Row ─────────────────────── */
.account-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.account-row:last-child { border-bottom: none; }
.account-dot { width: 10px; height: 10px; border-radius: 50%; }
.account-platform { color: var(--text-secondary); min-width: 60px; }
.account-name { flex: 1; }
.account-fans { color: var(--primary); font-weight: 600; }

/* ── Account Grid ────────────────────── */
.account-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.account-card {
    background: var(--card-bg);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
    overflow: hidden;
}

.account-header {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 20px;
    border-left: 4px solid var(--primary);
}

.account-icon {
    width: 44px; height: 44px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: white; font-weight: 700; font-size: 18px;
}

.account-info h3 { font-size: 16px; font-weight: 600; margin-bottom: 4px; }
.account-platform-tag { font-size: 12px; color: var(--text-secondary); }
.primary-badge { background: var(--primary); color: white; font-size: 10px; padding: 2px 8px; border-radius: 10px; margin-left: 6px; }

.account-body { padding: 0 20px 12px; }
.account-field { display: flex; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid #f3f4f6; font-size: 13px; }
.account-field:last-child { border-bottom: none; }
.field-label { color: var(--text-secondary); }
.field-value { color: var(--text); font-weight: 500; }
.field-value.fans { color: var(--primary); }
.field-value.link { color: var(--primary); text-decoration: none; }

.account-actions { display: flex; gap: 8px; padding: 12px 20px; border-top: 1px solid var(--border); }

.add-card {
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    min-height: 200px; cursor: pointer; border: 2px dashed var(--border);
    transition: all 0.2s;
}
.add-card:hover { border-color: var(--primary); background: rgba(0,161,214,0.03); }
.add-icon { font-size: 36px; color: var(--text-secondary); margin-bottom: 8px; }
.add-card p { color: var(--text-secondary); font-size: 14px; }

/* ── Calendar ────────────────────────── */
.calendar-legend { display: flex; gap: 20px; margin-bottom: 16px; font-size: 13px; }
.legend-item { display: flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; }
.dot.live { background: #EF4444; }
.dot.video { background: #3B82F6; }
.dot.completed { background: #10B981; }

.calendar-wrap { background: var(--card-bg); border-radius: var(--radius); box-shadow: var(--shadow); border: 1px solid var(--border); overflow: hidden; }

.calendar-header {
    display: grid; grid-template-columns: repeat(7, 1fr);
    background: #f9fafb; border-bottom: 1px solid var(--border);
}
.calendar-header div { padding: 12px; text-align: center; font-size: 13px; font-weight: 600; color: var(--text-secondary); }

.calendar-grid { display: grid; grid-template-columns: repeat(7, 1fr); }

.calendar-day {
    min-height: 110px;
    border-right: 1px solid var(--border);
    border-bottom: 1px solid var(--border);
    padding: 8px;
    position: relative;
    transition: background 0.15s;
}
.calendar-day:nth-child(7n) { border-right: none; }
.calendar-day:hover { background: #f9fafb; }
.calendar-day.other-month { background: #fafafa; }
.calendar-day.other-month .day-number { color: #c1c1c1; }

.day-number { font-size: 13px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.day-plans { display: flex; flex-direction: column; gap: 3px; }

.day-plan {
    font-size: 11px;
    padding: 3px 6px;
    border-radius: 4px;
    cursor: pointer;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    transition: opacity 0.15s;
}
.day-plan:hover { opacity: 0.8; }
.day-plan.live { background: #fee2e2; color: #991b1b; }
.day-plan.video { background: #dbeafe; color: #1e40af; }
.day-plan.completed { opacity: 0.6; text-decoration: line-through; }

.add-plan-btn {
    position: absolute;
    bottom: 6px; right: 6px;
    width: 22px; height: 22px;
    border-radius: 50%;
    border: none;
    background: var(--primary);
    color: white;
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
    opacity: 0;
    transition: opacity 0.15s;
    display: flex; align-items: center; justify-content: center;
}
.calendar-day:hover .add-plan-btn { opacity: 1; }
.add-plan-btn:hover { background: var(--primary-dark); }

/* ── Buttons ─────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

.btn:hover { background: #f3f4f6; }
.btn-primary { background: var(--primary); color: white; border-color: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #f3f4f6; border-color: var(--border); }
.btn-success { background: var(--success); color: white; border-color: var(--success); }
.btn-danger { background: var(--danger); color: white; border-color: var(--danger); }
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* ── Modal ───────────────────────────── */
.modal {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: var(--card-bg);
    border-radius: var(--radius);
    width: 100%;
    max-width: 440px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border);
}
.modal-header h3 { font-size: 16px; font-weight: 600; }
.close-btn { background: none; border: none; font-size: 22px; cursor: pointer; color: var(--text-secondary); }
.close-btn:hover { color: var(--text); }

.modal-body { padding: 16px 20px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 16px 20px; border-top: 1px solid var(--border); }

/* ── Form ────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--text-secondary); }
.form-group input, .form-group select, .form-group textarea {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    background: var(--card-bg);
    color: var(--text);
}
.form-group input:focus, .form-group select:focus { outline: none; border-color: var(--primary); }

.checkbox-label { display: flex !important; align-items: center; gap: 8px; cursor: pointer; }
.checkbox-label input { width: auto; }

/* ── Toast ───────────────────────────── */
.toast {
    position: fixed;
    bottom: 24px; right: 24px;
    padding: 12px 20px;
    border-radius: 8px;
    background: var(--text);
    color: white;
    font-size: 14px;
    z-index: 2000;
    animation: slideIn 0.3s ease;
}
.toast-success { background: var(--success); }
.toast-error { background: var(--danger); }

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

/* ── Incr Tag & Grid ─────────────────── */
.incr-tag {
    display: inline-block;
    margin-left: 6px;
    padding: 2px 8px;
    background: var(--success);
    color: white;
    font-size: 11px;
    border-radius: 10px;
    font-weight: 600;
}

.incr-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
}

.incr-item {
    text-align: center;
    padding: 12px;
    background: #f9fafb;
    border-radius: 8px;
}

.incr-value {
    display: block;
    font-size: 20px;
    font-weight: 700;
    color: var(--success);
    margin-bottom: 4px;
}

.incr-name {
    font-size: 12px;
    color: var(--text-secondary);
}

/* ── Finance Badges ──────────────────── */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 12px;
    font-weight: 600;
}

.badge-income { background: #d1fae5; color: #065f46; }
.badge-expense { background: #fee2e2; color: #991b1b; }

.text-income { color: var(--success); font-weight: 600; }
.text-expense { color: var(--danger); font-weight: 600; }

.help-text {
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 8px;
    padding: 8px;
    background: #f9fafb;
    border-radius: 6px;
}

/* ── Stage Badges ────────────────────── */
.stage-badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 4px;
    font-size: 11px;
    font-weight: 600;
}
.stage-confirmed { background: #dbeafe; color: #1e40af; }
.stage-pending_settlement { background: #fef3c7; color: #92400e; }
.stage-received { background: #d1fae5; color: #065f46; }
.stage-cancelled { background: #fee2e2; color: #991b1b; }
.stage-paid { background: #f3e8ff; color: #6b21a8; }

/* ── Summary List ────────────────────── */
.summary-list { list-style: none; }
.summary-list li {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: 14px;
}
.summary-list li:last-child { border-bottom: none; }
.summary-item-left { display: flex; align-items: center; gap: 8px; }
.summary-icon { font-size: 18px; }
.summary-name { color: var(--text); }
.summary-count { color: var(--text-secondary); font-size: 12px; }
.summary-value { font-weight: 600; }

/* ── Chart Container ─────────────────── */
.chart-container { position: relative; height: 260px; }

/* ── Filter Bar ──────────────────────── */
.filter-bar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin-bottom: 16px;
}
.filter-bar select, .filter-bar input {
    padding: 6px 10px;
    border: 1px solid var(--border);
    border-radius: 6px;
    font-size: 13px;
    background: var(--card-bg);
}

/* ── Responsive ──────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 60px; }
    .logo-text, .nav-menu a span:last-child, .nav-footer { display: none; }
    .main-content { margin-left: 60px; padding: 16px; }
    .dashboard-grid { grid-template-columns: 1fr; }
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
    .account-grid { grid-template-columns: 1fr; }
}
