:root {
    --ebf-primary: #2f5bff;
    --ebf-primary-dark: #2140b8;
    --ebf-success: #22c55e;
    --ebf-danger: #ef4444;
    --ebf-gray: #64748b;
    --ebf-border: #e2e8f0;
    --ebf-odd: #ffffff;
    --ebf-even: #f8fafc;
    --ebf-hover: #f1f5f9;
    --ebf-shadow: 0 10px 25px rgba(15, 23, 42, 0.08);
}

#ebf-container {
    width: 95vw;
    max-width: 1824px;
    margin: 30px auto;
    padding: 24px;
    background: #fff;
    border-radius: 16px;
    box-shadow: var(--ebf-shadow);
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: #0f172a;
}

.ebf-controls { margin-bottom: 16px; }
.ebf-controls-row {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    justify-content: space-between;
}
.ebf-actions {
    display: inline-flex;
    gap: 8px;
    margin-left: auto;
}

.ebf-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.ebf-filters input,
.ebf-filters select {
    padding: 10px 12px;
    border: 1px solid var(--ebf-border);
    border-radius: 8px;
    font-size: 14px;
    background: #fff;
}

.ebf-filters input:focus,
.ebf-filters select:focus {
    outline: none;
    border-color: var(--ebf-primary);
    box-shadow: 0 0 0 3px rgba(47, 91, 255, 0.12);
}

.ebf-btn {
    padding: 10px 16px;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.2s;
}

.ebf-btn-primary { background: var(--ebf-primary); color: #fff; }
.ebf-btn-primary:hover { background: var(--ebf-primary-dark); }
.ebf-btn-success { background: var(--ebf-success); color: #fff; }
.ebf-btn-danger { background: var(--ebf-danger); color: #fff; }
.ebf-btn-secondary { background: var(--ebf-gray); color: #fff; }

.ebf-info { margin: 10px 0 16px; color: #475569; font-size: 13px; }
.ebf-info strong { color: var(--ebf-primary); }

.ebf-table-wrap { overflow-x: auto; border: 1px solid var(--ebf-border); border-radius: 12px; }
.ebf-table { width: 100%; border-collapse: collapse; }
.ebf-table th { background: #1e293b; color: #fff; padding: 12px; font-size: 13px; text-align: left; }
.ebf-table td { padding: 12px; border-bottom: 1px solid var(--ebf-border); vertical-align: top; }
.ebf-table th,
.ebf-table td,
.ebf-table input,
.ebf-table select {
    font-family: system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 13px;
}
.ebf-sortable { cursor: pointer; user-select: none; }
.ebf-sort-icon { margin-left: 6px; font-size: 11px; opacity: 0.85; }
.ebf-table tbody tr.ebf-row:nth-child(4n+1) { background: var(--ebf-odd); }
.ebf-table tbody tr.ebf-row:nth-child(4n+3) { background: var(--ebf-even); }
.ebf-table tbody tr.ebf-row:hover { background: var(--ebf-hover); }

.ebf-col-select { width: 40px; text-align: center; }
.ebf-col-num { width: 70px; text-align: center; }
.ebf-col-year { width: 80px; text-align: center; }
.ebf-col-channel { width: 120px; }
.ebf-col-desc { min-width: 260px; }
.ebf-col-link, .ebf-col-file { width: 80px; text-align: center; }
.ebf-col-actions { width: 90px; text-align: center; }
.ebf-col-category { width: 1%; white-space: nowrap; }
.ebf-col-title { width: 120px; white-space: normal; word-break: break-word; }

.ebf-bold { font-weight: 600; }
.ebf-empty { text-align: center; padding: 40px; color: #94a3b8; }

.ebf-btn-box {
    padding: 4px 8px;
    border: 1px solid #cbd5f5;
    border-radius: 6px;
    background: #f8fafc;
    cursor: pointer;
    font-weight: 600;
    font-size: 12px;
    color: #1e293b;
}
.ebf-btn-box:hover { background: #eef2ff; }

.ebf-edit-field { display: none; }
.ebf-row.ebf-editing .ebf-edit-field { display: block; }
.ebf-row.ebf-editing .ebf-display { display: none; }

.ebf-edit-row { background: #eff6ff !important; }
.ebf-edit-cell { padding: 20px !important; }
.ebf-add-row { background: #f8fafc; }
.ebf-add-row-template { display: none; }
.ebf-add-row { display: table-row; }
.ebf-add-row input,
.ebf-add-row select {
    width: 100%;
    box-sizing: border-box;
    padding: 6px 8px;
    border: 1px solid var(--ebf-border);
    border-radius: 6px;
    background: #fff;
}

.ebf-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 14px;
}

.ebf-form-group { display: flex; flex-direction: column; }
.ebf-form-group label { font-size: 12px; margin-bottom: 6px; color: #334155; }
.ebf-form-group input,
.ebf-form-group textarea {
    padding: 10px;
    border: 1px solid var(--ebf-border);
    border-radius: 8px;
    font-size: 14px;
    resize: vertical;
}

.ebf-form-group textarea { min-height: 80px; }
.ebf-form-group.ebf-full { grid-column: 1 / -1; }
.ebf-form-actions { margin-top: 12px; display: flex; gap: 10px; justify-content: flex-end; }

.ebf-bottom { margin-top: 12px; }
.ebf-export-form { display: inline-flex; margin-left: 8px; }

.ebf-desc {
    display: -webkit-box;
    -webkit-line-clamp: 5;
    -webkit-box-orient: vertical;
    overflow: hidden;
    line-height: 1.4;
    max-height: calc(1.4em * 5);
    cursor: pointer;
}
.ebf-desc.ebf-desc-expanded {
    -webkit-line-clamp: unset;
    max-height: none;
}

.ebf-pagination { display: flex; gap: 6px; justify-content: center; align-items: center; flex-wrap: wrap; margin-top: 16px; }
.ebf-pagination a {
    padding: 8px 12px;
    border: 1px solid var(--ebf-border);
    border-radius: 6px;
    text-decoration: none;
    color: #475569;
}
.ebf-pagination a.active { background: var(--ebf-primary); color: #fff; }
.ebf-page-ellipsis { color: #94a3b8; padding: 0 4px; }

.ebf-modal {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
}
.ebf-modal-content {
    background: #fff;
    padding: 24px;
    border-radius: 12px;
    width: 90%;
    max-width: 960px;
    max-height: 90vh;
    overflow-y: auto;
}
.ebf-modal-close { float: right; cursor: pointer; font-size: 24px; }

input[type="checkbox"] { width: 18px; height: 18px; accent-color: var(--ebf-primary); }

@media (max-width: 1200px) {
    .ebf-form-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    #ebf-container { width: 100%; padding: 16px; }
    .ebf-form-grid { grid-template-columns: 1fr; }
    .ebf-filters { flex-direction: column; align-items: stretch; }
    .ebf-actions { display: none; }
    .ebf-table { table-layout: fixed; width: 100%; }
    .ebf-table-wrap { overflow-x: hidden; }
    .ebf-col-select,
    .ebf-col-num,
    .ebf-col-desc,
    .ebf-col-link,
    .ebf-col-file,
    .ebf-col-actions,
    .ebf-col-title,
    .ebf-table th:nth-child(1),
    .ebf-table th:nth-child(4),
    .ebf-table th:nth-child(5),
    .ebf-table th:nth-child(9),
    .ebf-table th:nth-child(10),
    .ebf-table th:nth-child(11),
    .ebf-table th:nth-child(12),
    .ebf-table th:nth-child(13) { display: none; }
    .ebf-col-category,
    .ebf-col-year,
    .ebf-col-channel,
    .ebf-mobile-title { display: table-cell; }
    .ebf-col-category,
    .ebf-col-year,
    .ebf-col-channel,
    .ebf-mobile-title { width: 25%; }
    .ebf-col-category,
    .ebf-mobile-title {
        white-space: normal;
        word-break: break-word;
    }
    .ebf-table th:nth-child(2),
    .ebf-table th:nth-child(3),
    .ebf-table th:nth-child(7),
    .ebf-table th:nth-child(8) { display: table-cell; }
    .ebf-mobile-details td { background: #f8fafc; }
    .ebf-mobile-details-inner { padding: 12px; display: grid; gap: 6px; }
    .ebf-pagination { justify-content: center; }
}
