/* ============================================================
   DESIGN SYSTEM — Tailwind UI Style
   ============================================================ */

:root {
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', 'Fira Code', 'Consolas', monospace;
  --sidebar-w: 256px;
  --sidebar-w-collapsed: 64px;
}

[data-font-size="sm"] { font-size: 14px; }
[data-font-size="md"] { font-size: 15px; }
[data-font-size="lg"] { font-size: 17px; }

/* ----- Tema Claro (padrao) ----- */
[data-theme="light"], :root {
  --bg-body: #ffffff;
  --bg-surface: #ffffff;
  --bg-elevated: #f9fafb;
  --bg-hover: #f3f4f6;
  --text-primary: #000000;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border: #e5e7eb;
  --border-light: #f3f4f6;
  --overlay: rgba(0,0,0,.35);
  --scrollbar: #d1d5db;
  --scrollbar-hover: #9ca3af;
}

/* ----- Tema Escuro ----- */
[data-theme="dark"] {
  --bg-body: #000000;
  --bg-surface: #111111;
  --bg-elevated: #1a1a1a;
  --bg-hover: #222222;
  --text-primary: #ffffff;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border: #222222;
  --border-light: #1a1a1a;
  --overlay: rgba(0,0,0,.7);
  --scrollbar: #333333;
  --scrollbar-hover: #555555;
}

[data-theme="dark"] .card-body { background: #e3e3e3; }
[data-theme="dark"] .card-body h4 { color: #000000; }
[data-theme="dark"] .card-body p { color: #000000 !important; }
[data-theme="dark"] .card-footer-actions { background: #e3e3e3; }
[data-theme="dark"] .card-footer { background: #e3e3e3; }

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

html { font-size: 15px; }

body {
  font-family: var(--font);
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--cor-primaria, #101840); text-decoration: none; }
a:hover { text-decoration: underline; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--scrollbar); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--scrollbar-hover); }

/* ============================================================
   SIDEBAR — Fixa, lado esquerdo
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: #101840;
  background-image: linear-gradient(180deg, rgba(255,255,255,0.03) 0%, rgba(0,0,0,0.12) 100%);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0;
  height: 100vh;
  z-index: 100;
  overflow-y: auto;
  flex-shrink: 0;
}

.sidebar_header {
  padding: 1.25rem 1.25rem .75rem;
  border-bottom: 1px solid rgba(255,255,255,.1);
}

.sidebar_logo_text {
  font-size: 1rem;
  font-weight: 700;
  color: #ffffff;
  letter-spacing: -.02em;
}

.sidebar_menu { flex: 1; padding: .5rem .75rem; }
.sidebar_footer { padding: .5rem .75rem; border-top: 1px solid rgba(255,255,255,.1); }

.sidebar_item {
  display: flex;
  align-items: center;
  gap: .75rem;
  padding: .625rem .75rem;
  color: rgba(255,255,255,.65);
  text-decoration: none;
  border-radius: 8px;
  transition: all .15s;
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 2px;
}

.sidebar_item:hover {
  color: #ffffff;
  background: rgba(255,255,255,.1);
  text-decoration: none;
}

.sidebar_item.active {
  color: #ffffff;
  background: rgba(255,255,255,.12);
  font-weight: 600;
}

.sidebar_icon {
  font-size: 1rem;
  min-width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
  opacity: .8;
}

.sidebar_item.active .sidebar_icon { opacity: 1; }

/* ============================================================
   MAIN
   ============================================================ */
.main-content {
  margin-left: var(--sidebar-w);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .75rem 1.5rem;
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar_left h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--text-primary);
}

.topbar_right {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.topbar_right .font-size-btn,
.topbar_right .theme-toggle {
  margin-left: 20px;
}

.topbar_right a.topbar-icon {
  margin-left: 20px;
}

.user-name {
  color: var(--text-secondary);
  font-size: .85rem;
  font-weight: 500;
}

.user-sep {
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  flex-shrink: 0;
}

.topbar-icon {
  font-size: 1.3rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color .15s;
  line-height: 1;
}
.topbar-icon:hover { color: var(--text-primary); text-decoration: none; }

.font-size-btn {
  font-size: .85rem;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  line-height: 1;
}

/* Theme Toggle */
.theme-toggle {
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-radius: 9999px;
  cursor: pointer;
  position: relative;
  width: 48px;
  height: 26px;
  flex-shrink: 0;
  transition: all .15s;
}

.theme-toggle:hover { border-color: #101840; }

.theme-toggle__thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #101840;
  transition: transform .2s;
  position: absolute;
  top: 3px;
  left: 3px;
}

[data-theme="light"] .theme-toggle__thumb {
  transform: translateX(22px);
}

.theme-toggle__icon {
  font-size: .65rem;
  line-height: 1;
  z-index: 1;
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  transition: opacity .15s;
}

.theme-toggle__icon--sun { left: 5px; opacity: 1; color: #f59e0b; }
.theme-toggle__icon--moon { right: 5px; opacity: 0; color: #6366f1; }

[data-theme="dark"] .theme-toggle__icon--sun { opacity: 0; }
[data-theme="dark"] .theme-toggle__icon--moon { opacity: 1; }

/* Alerts */
.alert {
  padding: .625rem 1rem;
  margin: 0 1.5rem .5rem;
  border-radius: 8px;
  font-size: .85rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}

.alert.success { background: #f0fdf4; border: 1px solid #228822; color: #228822; }
[data-theme="dark"] .alert.success { background: rgba(34,136,34,.15); }

.alert.error { background: #fef2f2; border: 1px solid #e32367; color: #e32367; }
[data-theme="dark"] .alert.error { background: rgba(227,35,103,.15); }

.content {
  padding: 1.5rem;
  flex: 1;
}

/* ============================================================
   MODULE HEADER
   ============================================================ */
.module-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  gap: .75rem;
}

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

.filters {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  gap: .25rem;
  align-items: center;
}

/* ============================================================
   FORM ELEMENTS
   ============================================================ */
.form-select {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: .85rem;
  min-width: 160px;
  transition: border .15s;
  cursor: pointer;
}

.form-select:focus { outline: none; border-color: #101840; box-shadow: 0 0 0 3px rgba(16,24,64,.1); }

.form-group input,
.form-group textarea,
.form-group select {
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: .9rem;
  transition: border .15s;
  width: 100%;
}

.form-group input:focus,
.form-group textarea:focus { outline: none; border-color: #101840; box-shadow: 0 0 0 3px rgba(16,24,64,.1); }

.form-group textarea { resize: vertical; min-height: 80px; font-family: var(--font-mono); font-size: .8rem; }

.form-group label {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: .25rem;
}

/* ============================================================
   BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: .85rem;
  font-weight: 500;
  transition: all .2s;
  white-space: nowrap;
  line-height: 1.4;
  color: #ffffff;
  background-image: linear-gradient(180deg, rgba(255,255,255,0.08) 0%, rgba(0,0,0,0.06) 100%);
  box-shadow: 0 2px 6px rgba(0,0,0,0.1);
}

.btn:hover { box-shadow: 0 4px 14px rgba(0,0,0,0.18); }

.btn-sm { padding: .35rem .7rem; font-size: .8rem; }
.btn-bold { font-weight: 700; }

.btn-primary { background: #101840; }
.btn-primary:hover { background: #1a2450; }

.btn-success { background: #228822; }
.btn-success:hover { background: #1a6e1a; }

.btn-danger { background: #dc2626; }
.btn-danger:hover { background: #b91c1c; }

.btn-edit { background: transparent; border: 1px solid #101840; color: #000000; font-weight: 700; }
.btn-edit:hover { background: rgba(16,24,64,.08); }

.btn-delete { background: #dc2626; font-weight: 700; }
.btn-delete:hover { background: #b91c1c; }

.btn-copy { background: #228822; font-size: 1.02rem; }
.btn-copy:hover { background: #1a6e1a; }

.btn-ver { background: transparent; color: #101840; }
.btn-ver:hover { background: rgba(16,24,64,.08); }

.btn-zip { background: transparent; color: #101840; }
.btn-zip:hover { background: rgba(16,24,64,.08); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-outline:hover { background: var(--bg-hover); color: var(--text-primary); border-color: #101840; }
.btn-outline-danger { background: transparent; border: 1px solid #dc2626; color: #dc2626; }
.btn-outline-danger:hover { background: rgba(220,38,38,.08); }
.btn-outline-info { background: transparent; border: 1px solid #101840; color: #101840; }
.btn-outline-info:hover { background: rgba(16,24,64,.08); }
.btn-fav {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-secondary);
}
.btn-fav.active {
  background: #f59e0b20;
  border-color: #f59e0b;
  color: #f59e0b;
}
.btn-fav.active:hover {
  background: #f59e0b30;
}

.filter-bar {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin-bottom: 1.5rem;
  padding: .75rem 1rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.filter-bar::-webkit-scrollbar { display: none; }

.filter-bar-label {
  font-size: .8rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: .03em;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-bar-pills {
  display: flex;
  gap: .35rem;
  flex-wrap: nowrap;
}

.filter-btn {
  padding: .35rem .85rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--bg-surface);
  color: var(--text-secondary);
  font-size: .8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  flex-shrink: 0;
  line-height: 1.4;
}

.filter-btn:hover {
  border-color: #101840;
  color: var(--text-primary);
  background: var(--bg-hover);
}

.filter-btn.active {
  background: #101840;
  border-color: #101840;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16,24,64,.25);
}

.filter-btn.active:hover {
  opacity: .9;
  box-shadow: 0 4px 12px rgba(16,24,64,.3);
}

/* ============================================================
   CARDS GRID
   ============================================================ */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--card-gap, 1.25rem);
}

.card-item {
  background: var(--card-bg, var(--bg-elevated));
  border: var(--card-border-w, 1px) solid var(--card-border, var(--border-light));
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: all .2s;
}

.card-item:hover {
  background: var(--bg-hover);
}

.card-actions {
  display: flex;
  gap: .35rem;
  padding: .5rem .75rem;
  justify-content: flex-end;
  background: var(--card-actions-bg, var(--card-bg, var(--bg-elevated)));
  border-bottom: var(--card-border-w, 1px) solid var(--card-border, var(--border-light));
}

.card-img {
  height: 180px;
  overflow: hidden;
  position: relative;
}

.card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  transition: transform .3s;
}

.card-item:hover .card-img img {
  transform: scale(1.03);
}

.card-body {
  padding: .75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.card-body h4 {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.3;
  text-transform: uppercase;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: .35rem;
  margin-top: auto;
}

.tag {
  font-size: .7rem;
  padding: .125rem .45rem;
  background: #101840;
  border-radius: 4px;
  color: #ffffff;
  font-weight: 500;
}

.tag {
  display: inline-block;
  padding: .15rem .55rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 600;
  background: #10184010;
  color: #101840;
  white-space: nowrap;
  text-transform: lowercase;
}

.card-footer {
  padding: .5rem .75rem;
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  border-top: 1px solid var(--border-light);
}

.card-footer-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  width: 100%;
}

.btn-star {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 2.16rem;
  line-height: 1;
  color: #101840;
  padding: 0 .2rem;
  transition: color .15s;
  flex-shrink: 0;
  margin-right: auto;
}

.btn-star:hover { color: #f59e0b; }

.btn-star.active { color: #f59e0b; }

#fav_btn.active {
  background: #f59e0b;
  color: #ffffff;
  border-color: #f59e0b;
}

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 2rem;
  color: var(--text-muted);
}

/* ============================================================
   PAGINATION
   ============================================================ */
.pagination {
  margin-top: 2rem;
  display: flex;
  justify-content: center;
}

.pagination-list {
  display: flex;
  list-style: none;
  gap: .25rem;
  flex-wrap: wrap;
  justify-content: center;
}

.page-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 34px;
  padding: 0 .5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: .82rem;
  background: var(--bg-surface);
  cursor: pointer;
  transition: all .15s;
}

[data-theme="light"] .page-link { background: #ebebeb; }

.page-link:hover { background: var(--bg-hover); border-color: #101840; color: var(--text-primary); text-decoration: none; }
.page-link.active { background: #101840; border-color: #101840; color: #ffffff; font-weight: 600; }

/* ============================================================
   MODAL
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  animation: fadeIn .15s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.modal {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  width: 92%;
  max-width: 740px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  animation: scaleIn .15s ease;
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(.97); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: .25rem;
  border-radius: 6px;
  transition: all .15s;
}

.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }

.modal-body { padding: 1.25rem; }
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
}

/* Form rows in modal */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
}

.form-group .font-mono { font-family: var(--font-mono); font-size: .8rem; }

/* ============================================================
   LOGIN
   ============================================================ */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--bg-body);
}

.login-box {
  background: var(--bg-surface);
  padding: 2.5rem;
  border-radius: 12px;
  width: 100%;
  max-width: 400px;
  border: 1px solid var(--border);
  box-shadow: 0 4px 24px rgba(0,0,0,.08);
}

.login-box h1 {
  color: #101840;
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: .25rem;
}

[data-theme="dark"] .login-box h1 { color: #ffffff; }

.login-box p { color: var(--text-secondary); margin-bottom: 1.5rem; font-size: .9rem; }
.login-box label { display: block; margin-bottom: .25rem; color: var(--text-secondary); font-size: .8rem; font-weight: 600; }
.login-box input { width: 100%; padding: .6rem .75rem; margin-bottom: 1rem; border: 1px solid var(--border); border-radius: 8px; background: var(--bg-body); color: var(--text-primary); font-size: .9rem; transition: border .15s; }
.login-box input:focus { outline: none; border-color: #101840; box-shadow: 0 0 0 3px rgba(16,24,64,.1); }
.login-box button { width: 100%; padding: .65rem; background: #101840; color: #fff; border: none; border-radius: 8px; font-size: .9rem; font-weight: 600; cursor: pointer; transition: background .15s; }
.login-box button:hover { background: #1a2450; }

/* ============================================================
   TOAST
   ============================================================ */
.toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 300;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}

.toast {
  padding: .625rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 500;
  animation: slideInRight .25s ease;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: #fff;
}

.toast.success { background: #228822; }
.toast.error { background: #e32367; }

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 768px) {
  .sidebar { width: var(--sidebar-w-collapsed); }
  .sidebar_logo_text,
  .sidebar_text { display: none; }
  .sidebar_header { padding: 1rem .75rem; }
  .sidebar_item { justify-content: center; padding: .625rem; }
  .sidebar_icon { margin: 0; }
  .main-content { margin-left: var(--sidebar-w-collapsed); }
  .form-row { grid-template-columns: 1fr; }
  .module-header { flex-direction: column; align-items: stretch; }
  .cards-grid { grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); }
  .topbar { padding: .65rem 1rem; }
  .content { padding: 1rem; }
}

@media (max-width: 480px) {
  .cards-grid { grid-template-columns: 1fr; }
  .login-box { padding: 1.5rem; }
}

/* ============================================================
   LOADING SPINNER
   ============================================================ */
.cards-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  grid-column: 1 / -1;
}

.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--border);
  border-top: 4px solid #101840;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ============================================================
   ADMIN TABS
   ============================================================ */
.admin-tabs {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.admin-tabs-nav {
  display: flex;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}

.admin-tab {
  flex: 1;
  padding: .75rem 1rem;
  border: none;
  background: none;
  color: var(--text-secondary);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  white-space: nowrap;
  text-align: center;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.admin-tab:hover {
  color: var(--text-primary);
  background: var(--bg-hover);
}

.admin-tab.active {
  color: #101840;
  border-bottom-color: #101840;
  background: var(--bg-elevated);
}

[data-theme="dark"] .admin-tab.active {
  color: #ffffff;
}

.admin-tab-panel {
  display: none;
  padding: 1.25rem;
}

.admin-tab-panel.active {
  display: block;
}

/* ============================================================
   ACCORDION
   ============================================================ */
.accordion-list {
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.accordion-item {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  transition: all .15s;
}

.accordion-item:hover {
  border-color: var(--text-muted);
}

.accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .85rem 1rem;
  cursor: pointer;
  gap: .75rem;
  user-select: none;
}

.accordion-header-left {
  display: flex;
  align-items: center;
  gap: .75rem;
  flex: 1;
  min-width: 0;
}

.accordion-title {
  font-size: .9rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.accordion-categoria {
  font-size: .72rem;
  font-weight: 500;
  color: #ffffff;
  background: #000000;
  padding: .125rem .5rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.accordion-actions {
  display: flex;
  align-items: center;
  gap: .35rem;
  flex-shrink: 0;
}

.accordion-arrow {
  font-size: .7rem;
  color: var(--text-muted);
  transition: transform .2s;
  margin-left: .25rem;
}

.accordion-item.open .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .25s ease, padding .25s ease;
  padding: 0 1rem;
}

.accordion-item.open .accordion-body {
  max-height: none;
  padding: 0 1rem 1rem;
}

.accordion-texto {
  font-size: .88rem;
  line-height: 1.6;
  color: var(--text-primary);
}

.accordion-texto img {
  max-width: 100%;
  height: auto;
  border-radius: 8px;
  margin: .5rem 0;
}

.accordion-texto ul, .accordion-texto ol {
  padding-left: 1.5rem;
  margin: .5rem 0;
}

.accordion-texto p {
  margin: .5rem 0;
}

/* ============================================================
   RICH TEXT EDITOR
   ============================================================ */
.modal-doc {
  max-width: 860px;
}

.editor-toolbar {
  display: flex;
  align-items: center;
  gap: .25rem;
  padding: .4rem .5rem;
  background: var(--bg-hover);
  border: 1px solid var(--border);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  flex-wrap: wrap;
}

.editor-toolbar button {
  background: none;
  border: none;
  padding: .25rem .5rem;
  border-radius: 4px;
  cursor: pointer;
  font-size: .82rem;
  color: var(--text-secondary);
  transition: all .1s;
}

.editor-toolbar button:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

.toolbar-sep {
  width: 1px;
  height: 18px;
  background: var(--border);
  margin: 0 .25rem;
}

.editor {
  min-height: 260px;
  max-height: 500px;
  overflow-y: auto;
  padding: .75rem;
  border: 1px solid var(--border);
  border-radius: 0 0 8px 8px;
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: .9rem;
  line-height: 1.6;
  outline: none;
}

.editor:focus {
  border-color: #101840;
  box-shadow: 0 0 0 3px rgba(16,24,64,.1);
}

.editor img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  margin: .5rem 0;
}

.editor ul, .editor ol {
  padding-left: 1.5rem;
  margin: .5rem 0;
}

.editor p {
  margin: .5rem 0;
}