* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', Arial, sans-serif; background: #f3f5f1; color: #1d281f; }
.admin-container { display: flex; min-height: 100vh; }
.sidebar { width: 250px; background: #1e2a21; color: #fff; display: flex; flex-direction: column; position: fixed; left: 0; top: 0; bottom: 0; }
.sidebar-header { padding: 22px 18px; border-bottom: 1px solid rgba(255,255,255,.12); }
.sidebar-header h2 { font-size: 20px; margin-bottom: 6px; }
.sidebar-header p { font-size: 12px; color: rgba(255,255,255,.65); line-height: 1.5; }
.sidebar-nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 6px; }
.nav-item { display: flex; align-items: center; gap: 10px; color: rgba(255,255,255,.78); text-decoration: none; padding: 11px 12px; border-radius: 12px; }
.nav-item:hover, .nav-item.active { background: rgba(255,255,255,.12); color: #fff; }
.sidebar-footer { margin-top: auto; padding: 18px; border-top: 1px solid rgba(255,255,255,.12); }
.back-link { color: #fff; text-decoration: none; font-size: 14px; }
.main-content { margin-left: 250px; padding: 24px; width: calc(100% - 250px); }
.editor-notice { background: #fff8e7; border: 1px solid #f0d08a; color: #6a4b10; border-radius: 14px; padding: 12px 14px; margin-bottom: 18px; font-size: 13px; }
.editor-notice code { background: rgba(255,255,255,.7); padding: 2px 5px; border-radius: 4px; }
.content-section { display: none; }
.content-section.active { display: block; }
.section-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-header h1 { font-size: 28px; margin-bottom: 4px; }
.section-header p { color: #6b7569; font-size: 13px; }
.btn { border: 0; border-radius: 10px; padding: 9px 14px; cursor: pointer; font-weight: 700; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
.btn-primary { background: #1f5f3a; color: #fff; }
.btn-primary:hover { background: #174d2e; }
.btn-secondary { background: #e9eee7; color: #203024; border: 1px solid #d6ddd4; }
.btn-danger { background: #f7e4e1; color: #a3322a; border: 1px solid #efcbc5; }
.btn-sm { padding: 6px 9px; font-size: 12px; border-radius: 8px; }
.filter-bar { display: grid; grid-template-columns: 150px 210px 150px 1fr; gap: 10px; background: #fff; border: 1px solid #e1e6df; border-radius: 16px; padding: 12px; margin-bottom: 14px; box-shadow: 0 8px 24px rgba(30,42,33,.06); }
.filter-group { display: flex; flex-direction: column; gap: 5px; }
.filter-group label { font-size: 11px; color: #69746a; font-weight: 800; }
select, input, textarea { width: 100%; border: 1px solid #d6ddd4; border-radius: 10px; padding: 9px 10px; font: inherit; background: #fff; color: #1d281f; }
textarea { resize: vertical; line-height: 1.6; }
.events-table-container { background: #fff; border: 1px solid #e1e6df; border-radius: 16px; overflow: hidden; box-shadow: 0 12px 32px rgba(30,42,33,.07); }
.events-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
th { text-align: left; padding: 12px 10px; font-size: 12px; color: #5f6b61; background: #f7f9f5; border-bottom: 1px solid #e6ebe3; }
td { padding: 11px 10px; border-bottom: 1px solid #eef1ec; vertical-align: middle; font-size: 13px; }
tr:hover td { background: #fbfcfa; }
.col-date { width: 110px; }.col-force { width: 100px; }.col-type { width: 72px; }.col-title { width: auto; }.col-place { width: 140px; }.col-imp { width: 58px; }.col-actions { width: 122px; }
.date-cell, .type-badge { white-space: nowrap; display: inline-block; }
.date-cell { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; color: #243228; }
.force-pill { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; max-width: 88px; overflow: hidden; text-overflow: ellipsis; }
.force-dot { width: 9px; height: 9px; border-radius: 50%; flex-shrink: 0; }
.type-badge { padding: 3px 8px; border-radius: 999px; background: #edf2ea; color: #354438; font-size: 12px; line-height: 1.2; }
.title-cell strong { display: block; line-height: 1.35; font-size: 13px; margin-bottom: 4px; word-break: break-word; }
.title-cell small { display: block; color: #6c756b; line-height: 1.45; font-size: 11px; word-break: break-word; }
.place-cell { line-height: 1.35; color: #354438; }
.action-cell { display: flex; gap: 6px; align-items: center; justify-content: flex-start; flex-wrap: nowrap; }
.pagination { display: flex; align-items: center; gap: 10px; margin-top: 14px; color: #5e685e; }
.page-jump { display: inline-flex; align-items: center; gap: 6px; margin-left: auto; }
.page-jump input { width: 70px; padding: 6px 8px; }
.subject-type-tabs { display: flex; gap: 8px; margin-bottom: 14px; }
.tab-btn { border: 1px solid #d6ddd4; background: #fff; padding: 8px 12px; border-radius: 999px; cursor: pointer; color: #405043; }
.tab-btn.active { background: #1f5f3a; color: #fff; border-color: #1f5f3a; }
.subjects-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.subject-card { background: #fff; border: 1px solid #e1e6df; border-radius: 16px; padding: 15px; box-shadow: 0 8px 22px rgba(30,42,33,.06); display: flex; flex-direction: column; gap: 8px; }
.subject-card-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.subject-title { display: flex; align-items: center; gap: 8px; min-width: 0; }
.subject-color { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.18); flex-shrink: 0; }
.subject-card h3 { font-size: 17px; line-height: 1.35; word-break: break-word; }
.subject-card p { font-size: 13px; line-height: 1.55; color: #5f6b61; }
.subject-actions { display: flex; gap: 6px; }
.import-options, .export-options { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px,1fr)); gap: 14px; }
.import-card, .export-card { background: #fff; border: 1px solid #e1e6df; border-radius: 16px; padding: 18px; box-shadow: 0 8px 24px rgba(30,42,33,.06); }
.import-card h3, .export-card h3 { margin-bottom: 8px; }
.import-card p, .export-card p { color: #657066; font-size: 13px; line-height: 1.6; margin-bottom: 12px; }
.import-card textarea { min-height: 190px; margin-bottom: 12px; }
.modal { position: fixed; inset: 0; background: rgba(18,27,21,.42); display: none; align-items: center; justify-content: center; padding: 22px; z-index: 999; }
.modal.show { display: flex; }
.modal-content { background: #fff; width: min(780px, 100%); max-height: 92vh; overflow: hidden; border-radius: 18px; box-shadow: 0 24px 80px rgba(0,0,0,.25); display: flex; flex-direction: column; }
.modal-content.wide { width: min(1080px, 100%); }
.modal-header, .modal-footer { padding: 16px 18px; border-bottom: 1px solid #e8ede6; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.modal-footer { border-bottom: 0; border-top: 1px solid #e8ede6; justify-content: flex-end; }
.modal-header h2 { font-size: 20px; }
.modal-close { border: 0; background: transparent; font-size: 26px; cursor: pointer; color: #667066; }
.modal-body { padding: 18px; overflow-y: auto; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; }
.form-group { margin-bottom: 13px; }
.form-group label { display: block; margin-bottom: 6px; font-size: 12px; font-weight: 800; color: #4d594f; }
.form-group label small { font-weight: 600; color: #8a958a; }
.inline-check label { display: flex; align-items: center; gap: 8px; }
.inline-check input { width: auto; }
@media (max-width: 920px) { .sidebar { position: static; width: 100%; height: auto; } .admin-container { display: block; } .main-content { margin-left: 0; width: 100%; padding: 16px; } .filter-bar { grid-template-columns: 1fr; } .events-table { min-width: 880px; } .events-table-container { overflow-x: auto; } }

.subject-subunits { display: flex; flex-wrap: wrap; gap: 5px; margin: 8px 0; }
.subject-subunits span { display: inline-flex; padding: 3px 7px; border-radius: 999px; background: #f0f3ef; color: #4f5a51; font-size: 11px; border: 1px solid rgba(0,0,0,.06); }

/* v7 GitHub-ready data editor refinements */
body { background: linear-gradient(135deg, #f5f7f2 0%, #edf2ec 100%); }
.sidebar { box-shadow: 12px 0 36px rgba(30,42,33,.12); }
.editor-notice, .filter-bar, .events-table-container, .subject-card, .import-card, .export-card {
  box-shadow: 0 12px 34px rgba(30,42,33,.07);
}
.events-table-container { overflow-x: auto; }
.events-table { min-width: 920px; }
.title-cell strong { font-size: 12.5px; }
.title-cell small { max-height: 3.1em; overflow: hidden; }
.action-cell .btn { min-width: 48px; }
.type-badge { min-width: 42px; text-align: center; }
.date-cell { letter-spacing: .02em; }
.subject-card { transition: transform .18s ease, box-shadow .18s ease; }
.subject-card:hover { transform: translateY(-2px); box-shadow: 0 16px 38px rgba(30,42,33,.10); }

@media (max-width: 1100px) {
  .filter-bar { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .section-header { align-items: flex-start; }
}
@media (max-width: 760px) {
  .sidebar-header { padding: 14px; }
  .sidebar-header h2 { font-size: 17px; }
  .sidebar-header p { display: none; }
  .sidebar-nav { flex-direction: row; overflow-x: auto; padding: 10px; gap: 8px; }
  .nav-item { flex: 0 0 auto; padding: 9px 10px; font-size: 13px; }
  .sidebar-footer { display: none; }
  .main-content { padding: 12px; }
  .editor-notice { font-size: 12px; line-height: 1.55; }
  .section-header { flex-direction: column; gap: 10px; }
  .section-header h1 { font-size: 22px; }
  .filter-bar { grid-template-columns: 1fr; padding: 10px; }
  .events-table { min-width: 820px; }
  .pagination { flex-wrap: wrap; }
  .page-jump { width: 100%; margin-left: 0; }
  .subjects-grid { grid-template-columns: 1fr; }
  .modal { padding: 10px; align-items: flex-end; }
  .modal-content, .modal-content.wide { width: 100%; max-height: 94dvh; border-radius: 18px 18px 0 0; }
  .form-row { grid-template-columns: 1fr; gap: 0; }
}
