/* ===== TP3D DOCS - Estilos Notion-like sobre Bootstrap ===== */

body {
  background: #191919;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: #e0e0e0;
}

/* ===== NAVBAR ===== */
.navbar.bg-dark {
  padding: 10px 0;
}

.nav-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 1.1rem;
  color: #aaa;
  background: none;
  border: none;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  text-decoration: none;
}

.nav-icon-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

html.light-theme .nav-icon-btn {
  color: #777;
}

html.light-theme .nav-icon-btn:hover {
  background: rgba(0, 0, 0, 0.06);
  color: #333;
}

/* ===== NAV SEARCH BAR ===== */
.nav-search-form {
  position: relative;
  flex: 1;
  max-width: 360px;
  margin: 0 16px;
}

.nav-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  color: #666;
  font-size: 0.85rem;
  pointer-events: none;
}

.nav-search-input {
  width: 100%;
  padding: 6px 12px 6px 32px;
  border-radius: 8px;
  border: 1px solid #333;
  background: #252525;
  color: #e0e0e0;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.15s, background 0.15s;
}

.nav-search-input::placeholder {
  color: #666;
}

.nav-search-input:focus {
  border-color: #5a7ca8;
  background: #2a2a2a;
}

html.light-theme .nav-search-input {
  background: #f0f0f0;
  border-color: #ddd;
  color: #333;
}

html.light-theme .nav-search-input::placeholder {
  color: #999;
}

html.light-theme .nav-search-input:focus {
  border-color: #5a7ca8;
  background: #fff;
}

html.light-theme .nav-search-icon {
  color: #999;
}

/* ===== LAYOUT: Sidebar + Main ===== */

.app-layout {
  display: flex;
  min-height: calc(100vh - 56px);
}

/* Sidebar */
.sidebar {
  width: 260px;
  min-width: 260px;
  background: #202020;
  border-right: 1px solid #2e2e2e;
  overflow-y: auto;
  padding: 16px 0;
  transition: width 0.25s ease, min-width 0.25s ease;
}

.sidebar.collapsed {
  width: 0;
  min-width: 0;
  overflow: hidden;
  padding: 0;
  border-right: none;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 8px 8px 10px;
  margin-bottom: 4px;
}

.letter-spacing {
  letter-spacing: 0.05em;
}

/* Sidebar home button */
.sidebar-home-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  padding: 8px 12px;
  border-radius: 8px;
  color: #cfcfcf;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}

.sidebar-home-btn:hover {
  background: #2e2e2e;
  color: #fff;
}

.sidebar-home-btn.active {
  background: #333;
  color: #fff;
}

/* Section label */
.sidebar-section-label {
  padding: 4px 16px 6px;
}

/* Sidebar toggle button */
.sidebar-toggle-btn {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 1rem;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s, color 0.15s;
}

.sidebar:hover .sidebar-toggle-btn {
  opacity: 1;
}

.sidebar-toggle-btn:hover {
  background: #333;
  color: #fff;
}

/* Floating open button (visible when collapsed) */
.sidebar-open-btn {
  display: none;
  position: fixed;
  top: 64px;
  left: 8px;
  z-index: 100;
  background: #252525;
  border: 1px solid #333;
  border-radius: 6px;
  color: #aaa;
  cursor: pointer;
  padding: 6px 10px;
  font-size: 1.1rem;
  transition: background 0.15s, color 0.15s;
}

.sidebar-open-btn:hover {
  background: #333;
  color: #fff;
}

.sidebar-nav {
  padding: 0 8px;
}

.sidebar-area {
  margin-bottom: 4px;
}

.sidebar-area-header {
  display: flex;
  align-items: center;
}

.sidebar-area-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 6px;
  color: #cfcfcf;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  transition: background 0.15s;
  flex: 1;
  min-width: 0;
}

.sidebar-area-toggle {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  transition: all 0.15s;
  flex-shrink: 0;
}

.sidebar-area-toggle:hover {
  background: #2e2e2e;
  color: #ccc;
}

.sidebar-area-toggle.expanded i {
  transform: rotate(90deg);
}

.sidebar-area-toggle i {
  transition: transform 0.2s;
}

.sidebar-area-link:hover {
  background: #2e2e2e;
  color: #fff;
}

.sidebar-area-link.active {
  background: #333;
  color: #fff;
}

.sidebar-subs {
  padding-left: 20px;
  margin-top: 2px;
  border-left: 2px solid #2e2e2e;
  margin-left: 16px;
  display: none;
}

.sidebar-subs.open {
  display: block;
}

.sidebar-sub-link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 5px;
  color: #888;
  text-decoration: none;
  font-size: 0.84rem;
  transition: background 0.15s;
}

.sidebar-sub-link:hover {
  background: #2e2e2e;
  color: #ccc;
}

.sidebar-sub-link.active {
  background: #333;
  color: #fff;
  font-weight: 500;
}

/* Sidebar favorites */
.sidebar-favs-section {
  padding-bottom: 4px;
}

.sidebar-fav-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 12px 5px 16px;
  color: #cfcfcf;
  text-decoration: none;
  font-size: 0.82rem;
  border-radius: 4px;
  transition: background 0.15s;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-fav-link span {
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-fav-link i {
  color: #d4a017;
  font-size: 0.7rem;
  flex-shrink: 0;
}

.sidebar-fav-link:hover {
  background: #2a2a2a;
  color: #fff;
}

/* Fav button on document page */
.fav-btn i {
  transition: color 0.15s;
}
.fav-btn.fav-active,
.fav-btn.fav-active:hover {
  color: #d4a017 !important;
}

/* Main content */
.main-content {
  flex: 1;
  padding: 28px 48px;
  overflow-y: auto;
  background: #191919;
}

/* ===== AREA BIG CARDS (Home) ===== */

.areas-grid {
  display: grid;
  grid-template-columns: repeat(4, 260px);
  gap: 24px;
  justify-content: center;
  margin-top: 90px;
}

.area-big-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: #202020;
  border: 1px solid #2e2e2e;
  border-radius: 12px;
  padding: 24px;
  text-decoration: none;
  color: #e0e0e0;
  transition: transform 0.15s, box-shadow 0.2s, border-color 0.2s;
}

.area-big-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  border-color: #444;
  color: #e0e0e0;
}

.area-big-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  margin-bottom: 14px;
  flex-shrink: 0;
}

.area-big-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 6px;
  color: #e0e0e0;
}

.area-big-card-desc {
  font-size: 0.85rem;
  color: #888;
  margin-bottom: 14px;
  line-height: 1.4;
}

.area-big-card-stats {
  display: flex;
  gap: 16px;
  font-size: 0.8rem;
  color: #666;
  justify-content: center;
}

.area-big-card-stats i {
  margin-right: 3px;
}

/* ===== DOCUMENTOS RECIENTES ===== */

.recent-section {
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #2e2e2e;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.recent-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.recent-list {
  display: flex;
  flex-direction: column;
}

.recent-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  text-decoration: none;
  color: #e0e0e0;
  transition: background 0.15s;
}

.recent-item:hover {
  background: #252525;
  color: #fff;
}

.recent-item-icon {
  color: #666;
  font-size: 1rem;
  flex-shrink: 0;
}

.recent-item-title {
  flex: 1;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.recent-item-date {
  font-size: 0.75rem;
  color: #666;
  flex-shrink: 0;
}

/* ===== SEARCH RESULTS ===== */

.search-results-page {
  max-width: 800px;
  margin: 0 auto;
}

.search-results-header {
  margin-bottom: 24px;
}

.search-results-title {
  font-size: 1.4rem;
  font-weight: 600;
  color: #e0e0e0;
}

.search-results-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.search-result-item {
  display: block;
  padding: 12px 16px;
  border-radius: 8px;
  text-decoration: none;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: #252525;
}

.search-result-top {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.search-result-icon {
  color: #666;
  font-size: 1rem;
  flex-shrink: 0;
}

.search-result-title {
  font-size: 0.95rem;
  font-weight: 500;
  color: #e0e0e0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-breadcrumb {
  font-size: 0.75rem;
  color: #777;
  margin-left: 24px;
  margin-bottom: 4px;
}

.search-result-snippet {
  font-size: 0.8rem;
  color: #888;
  margin-left: 24px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.search-result-date {
  font-size: 0.7rem;
  color: #555;
  margin-left: 24px;
  margin-top: 4px;
}

/* Light theme overrides for search results */
html.light-theme .search-results-title {
  color: #222;
}
html.light-theme .search-result-item:hover {
  background: #f0f0f0;
}
html.light-theme .search-result-title {
  color: #333;
}
html.light-theme .search-result-icon {
  color: #999;
}
html.light-theme .search-result-breadcrumb {
  color: #888;
}
html.light-theme .search-result-snippet {
  color: #666;
}
html.light-theme .search-result-date {
  color: #999;
}

/* ===== NOTION PAGE HEADER ===== */

.notion-page-header {
  margin-bottom: 20px;
  text-align: center;
}

.notion-page-title {
  font-size: 2rem;
  font-weight: 700;
  color: #e0e0e0;
  margin-bottom: 4px;
}

/* ===== NOTION TOOLBAR (tabs + nuevo) ===== */

.notion-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  border-bottom: 1px solid #2e2e2e;
  padding-bottom: 8px;
}

.notion-tabs {
  display: flex;
  gap: 4px;
}

.notion-tab {
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 0.88rem;
  color: #888;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.notion-tab:hover {
  background: #2e2e2e;
  color: #ccc;
}

.notion-tab.active {
  background: #2e2e2e;
  color: #fff;
  font-weight: 500;
}

.notion-nuevo-btn {
  font-weight: 600;
  padding: 5px 16px;
}

/* ===== NOTION TABLE ===== */

.notion-table-wrapper {
  overflow-x: auto;
}

.notion-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.notion-table thead th {
  padding: 8px 12px;
  font-weight: 500;
  font-size: 0.82rem;
  color: #888;
  border-bottom: 1px solid #2e2e2e;
  white-space: nowrap;
  background: transparent;
  text-transform: none;
}

.notion-table .col-name { min-width: 300px; }
.notion-table .col-cat { min-width: 130px; }
.notion-table .col-date {
  min-width: 180px;
  font-size: 0.83rem;
}

/* Rows */
.notion-row {
  cursor: pointer;
  transition: background 0.1s;
  border-bottom: 1px solid #2a2a2a;
}

.notion-row:hover {
  background: #222;
}

.notion-row td {
  padding: 10px 12px;
  vertical-align: middle;
  color: #ccc;
}

.notion-name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.doc-name {
  color: #e0e0e0;
  font-weight: 500;
}

.notion-row-actions {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}

.notion-row:hover .notion-row-actions {
  opacity: 1;
}

.notion-open-btn,
.notion-copy-btn {
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #333;
  color: #ccc;
  border: 1px solid #444;
  border-radius: 4px;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
  cursor: pointer;
}

.notion-copy-btn {
  padding: 2px 6px;
  font-size: 0.8rem;
}

.notion-open-btn:hover,
.notion-copy-btn:hover {
  background: #444;
  color: #fff;
}

.notion-copy-btn.copied {
  color: #6eeb83;
  border-color: #6eeb83;
}

/* ===== NOTION TAGS ===== */

.notion-tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
}

/* ===== CATEGORY DROPDOWN ===== */
/* Context menu */
.ctx-menu {
  position: fixed;
  z-index: 2000;
  width: 260px;
  background: #252525;
  border: 1px solid #3a3a3a;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.6), 0 2px 8px rgba(0,0,0,0.3);
  overflow: hidden;
  user-select: none;
}
.ctx-menu-search-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 8px;
  border-bottom: 1px solid #333;
}
.ctx-menu-search-icon {
  color: #777;
  font-size: 0.8rem;
  flex-shrink: 0;
}
.ctx-menu-search {
  background: transparent;
  border: none;
  outline: none;
  color: #e0e0e0;
  font-size: 0.85rem;
  width: 100%;
  padding: 0;
}
.ctx-menu-search::placeholder { color: #666; }
.ctx-menu-body {
  padding: 4px 0;
}
.ctx-menu-section {
  padding: 6px 12px 3px;
  font-size: 0.7rem;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.ctx-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px;
  font-size: 0.85rem;
  color: #d0d0d0;
  cursor: pointer;
  transition: background 0.08s;
  border-radius: 4px;
  margin: 1px 4px;
}
.ctx-menu-item:hover {
  background: #333;
  color: #fff;
}
.ctx-menu-item i {
  font-size: 0.9rem;
  width: 18px;
  text-align: center;
  color: #888;
  flex-shrink: 0;
}
.ctx-menu-item:hover i { color: #bbb; }
.ctx-menu-item span:first-of-type { flex: 1; }
.ctx-menu-hint {
  font-size: 0.72rem;
  color: #555;
  flex-shrink: 0;
}
.ctx-menu-danger { color: #f87171 !important; }
.ctx-menu-danger i { color: #f87171 !important; }
.ctx-menu-danger:hover { background: rgba(248,113,113,0.08) !important; }
.ctx-menu-divider {
  height: 1px;
  background: #333;
  margin: 4px 0;
}
.ctx-menu-footer {
  display: none;
  flex-direction: column;
  gap: 1px;
  padding: 8px 12px;
  border-top: 1px solid #333;
  font-size: 0.72rem;
  color: #555;
}
/* Light theme */
html.light-theme .ctx-menu {
  background: #fff;
  border-color: #e0e0e0;
  box-shadow: 0 12px 32px rgba(0,0,0,0.15);
}
html.light-theme .ctx-menu-search-wrap { border-color: #eee; }
html.light-theme .ctx-menu-search { color: #333; }
html.light-theme .ctx-menu-search::placeholder { color: #aaa; }
html.light-theme .ctx-menu-search-icon { color: #aaa; }
html.light-theme .ctx-menu-section { color: #aaa; }
html.light-theme .ctx-menu-item { color: #333; }
html.light-theme .ctx-menu-item:hover { background: #f5f5f5; color: #111; }
html.light-theme .ctx-menu-item i { color: #777; }
html.light-theme .ctx-menu-divider { background: #eee; }
html.light-theme .ctx-menu-footer { border-color: #eee; color: #aaa; }

.cat-dropdown {
  position: fixed;
  z-index: 1000;
  min-width: 220px;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  padding: 6px 0;
  margin-top: 4px;
}
.cat-dropdown-search {
  width: calc(100% - 16px);
  margin: 4px 8px 6px;
  padding: 6px 10px;
  background: #222;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  color: #ccc;
  font-size: 0.82rem;
  outline: none;
}
.cat-dropdown-search:focus {
  border-color: #5a7ca8;
}
.cat-dropdown-search::placeholder {
  color: #666;
}
.cat-dropdown-list {
  max-height: 240px;
  overflow-y: auto;
}
.cat-dropdown-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  cursor: pointer;
  transition: background 0.1s;
}
.cat-dropdown-item:hover {
  background: #333;
}
.cat-dropdown-item.active {
  background: #333;
}
.cat-dropdown-item .notion-tag {
  pointer-events: none;
}
.cat-remove-icon {
  font-size: 0.7rem;
  color: #888;
  margin-left: 8px;
}

/* ===== ADD ROW ===== */

.notion-add-row {
  display: block;
  padding: 10px 12px;
  color: #666;
  text-decoration: none;
  font-size: 0.88rem;
  transition: color 0.15s;
  border-top: 1px solid #2a2a2a;
  margin-top: 2px;
}

.notion-add-row:hover {
  color: #aaa;
  background: #222;
}

/* ===== NOTION EMPTY ===== */

.notion-empty {
  text-align: center;
  padding: 60px 20px;
  background: #202020;
  border-radius: 8px;
  border: 1px solid #2e2e2e;
}

/* ===== POR CATEGORIA - GROUPS ===== */

.notion-group {
  margin-bottom: 24px;
}

.notion-group-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid #2e2e2e;
  margin-bottom: 8px;
}

.notion-subgroup {
  margin-bottom: 16px;
  margin-left: 8px;
}

.notion-subgroup-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 4px;
  font-size: 0.9rem;
  color: #aaa;
}

.notion-table.compact .notion-row td {
  padding: 8px 12px;
}

/* ===== DOCUMENT ARTICLE (Ver documento) ===== */

.doc-article {
  max-width: 750px;
  padding-top: 8px;
}

/* Accent strip above title */
.doc-header-accent {
  height: 3px;
  border-radius: 3px;
  margin-bottom: 24px;
  opacity: 0.6;
}

.doc-notion-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

/* Colored icon container */
.doc-icon-wrapper {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.4rem;
  margin-bottom: 14px;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.doc-title {
  font-size: 2.4rem;
  font-weight: 700;
  color: #ececec;
  line-height: 1.2;
  letter-spacing: -0.02em;
  margin: 0;
  flex: 1;
}

/* Property panel */
.doc-properties {
  margin-bottom: 20px;
  padding: 4px 0;
  border-top: 1px solid #2a2a2a;
}

.doc-prop-row {
  display: flex;
  align-items: center;
  padding: 7px 8px;
  margin: 0 -8px;
  border-radius: 4px;
  font-size: 0.9rem;
  transition: background 0.1s ease;
}

.doc-prop-row:hover {
  background: #252525;
}

.doc-prop-label {
  width: 160px;
  min-width: 160px;
  color: #7a7a7a;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  gap: 7px;
  user-select: none;
}

.doc-prop-label i {
  font-size: 0.9rem;
  opacity: 0.7;
}

.doc-prop-value {
  flex: 1;
  color: #c8c8c8;
}

.doc-prop-value a.text-muted {
  transition: color 0.15s;
}

.doc-prop-value a.text-muted:hover {
  color: #e0e0e0 !important;
}

/* Custom estado badges */
.doc-prop-value .badge.bg-success {
  background: rgba(46, 125, 50, 0.18) !important;
  color: #66bb6a !important;
  font-weight: 500;
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: 4px;
}

.doc-prop-value .badge.bg-warning {
  background: rgba(255, 167, 38, 0.15) !important;
  color: #ffa726 !important;
  font-weight: 500;
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: 4px;
}

/* Attachment link chip */
.doc-prop-value a[target="_blank"] {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  background: #252525;
  border-radius: 4px;
  color: #8eb8e0;
  font-size: 0.85rem;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
}

.doc-prop-value a[target="_blank"]:hover {
  background: #2e2e2e;
  color: #a8d4f8;
}

/* Actions bar */
.doc-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 8px 0 12px;
}

.doc-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 4px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #888;
  background: none;
  border: none;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
}

.doc-action-btn:hover {
  background: #2a2a2a;
  color: #d0d0d0;
}

.doc-action-btn--danger:hover {
  background: rgba(239, 83, 80, 0.12);
  color: #ef5350;
}

/* Auto-save status */
.doc-autosave-status {
  font-size: 0.78rem;
  color: transparent;
  padding: 5px 6px;
  transition: color 0.2s;
}
.doc-autosave-status--saving {
  color: #888;
}
.doc-autosave-status--saved {
  color: #4caf50;
}
.doc-autosave-status--error {
  color: #ef5350;
}

/* Titulo editable estilo Notion */
.doc-title--editable {
  cursor: text;
  outline: none;
  border-radius: 4px;
  transition: background 0.15s;
}
.doc-title--editable:focus {
  background: rgba(255,255,255,0.04);
}
.doc-title--editable:empty::before {
  content: 'Sin titulo';
  color: #555;
}

/* Contenido Notion: Quill transparente, toolbar oculta hasta foco */
.doc-content--notion {
  padding: 0;
}
.doc-content--notion .ql-toolbar {
  border: none !important;
  border-bottom: 1px solid #2a2a2a !important;
  background: #161616;
  border-radius: 6px 6px 0 0;
  opacity: 0;
  max-height: 0;
  overflow: hidden;
  padding: 0 !important;
  transition: max-height 0.18s ease, opacity 0.18s ease, padding 0.18s ease;
  pointer-events: none;
}
.doc-content--notion:focus-within .ql-toolbar {
  opacity: 1;
  max-height: 60px;
  padding: 6px 8px !important;
  pointer-events: auto;
}
.doc-content--notion .ql-container {
  border: none !important;
  background: transparent;
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}
.doc-content--notion .ql-editor {
  padding: 0;
  min-height: 200px;
  font-size: 1rem;
  line-height: 1.75;
  color: inherit;
}
.doc-content--notion .ql-editor.ql-blank::before {
  color: #555;
  font-style: italic;
  left: 0;
}

/* Creator column in tables */
.col-user {
  width: 150px;
}
.notion-creator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}
.notion-creator-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #5b8af0;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.6rem;
  font-weight: 600;
  flex-shrink: 0;
}
.recent-item-creator {
  color: #888;
  font-size: 0.8rem;
  white-space: nowrap;
}

/* Document relations (flujos + docs relacionados) */
.doc-relations {
  background: rgba(255,255,255,0.02);
  border: 1px solid #2a2a2a;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 12px;
}
.doc-relations-section {
  margin-bottom: 10px;
}
.doc-relations-section:last-child { margin-bottom: 0; }
.doc-relations-label {
  font-size: 0.78rem;
  color: #888;
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
}
.doc-relations-items {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.doc-relation-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 16px;
  font-size: 0.82rem;
  text-decoration: none;
  transition: background 0.15s, border-color 0.15s;
}
.doc-relation-chip--diag {
  background: rgba(156,106,222,0.12);
  border: 1px solid rgba(156,106,222,0.25);
  color: #b88be8;
}
.doc-relation-chip--diag:hover {
  background: rgba(156,106,222,0.22);
  color: #c9a5f0;
}
.doc-relation-chip--doc {
  background: rgba(91,138,240,0.1);
  border: 1px solid rgba(91,138,240,0.2);
  color: #7aa5f0;
}
.doc-relation-chip--doc:hover {
  background: rgba(91,138,240,0.2);
  color: #9abcff;
}
.doc-relation-via {
  color: #666;
  font-size: 0.72rem;
  margin-left: 2px;
}

/* Solo lectura badge */
.doc-readonly-badge {
  position: fixed;
  top: 70px;
  right: 24px;
  background: rgba(255,255,255,0.08);
  color: #aaa;
  padding: 5px 14px;
  border-radius: 20px;
  font-size: 0.78rem;
  z-index: 100;
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255,255,255,0.06);
}

/* Boton compartir en header del documento */
.doc-share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255,255,255,0.06);
  color: #aaa;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  padding: 7px 16px;
  font-size: 0.84rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  align-self: center;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.doc-share-btn:hover {
  background: rgba(255,255,255,0.1);
  color: #e0e0e0;
  border-color: #555;
}

/* Share modal */
.share-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.65);
  z-index: 1050;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(4px);
}
.share-modal {
  background: #1e1e1e;
  border: 1px solid #333;
  border-radius: 14px;
  width: 640px;
  max-width: 95vw;
  max-height: 85vh;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(0,0,0,0.6);
}
.share-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 1px solid #2a2a2a;
}
.share-modal-header h3 {
  margin: 0;
  font-size: 1.15rem;
  color: #e0e0e0;
  font-weight: 600;
}
.share-modal-close {
  background: none;
  border: none;
  color: #888;
  font-size: 1.6rem;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  transition: color 0.15s;
}
.share-modal-close:hover { color: #fff; }
.share-modal-body {
  padding: 20px 24px;
  overflow-y: auto;
  max-height: 65vh;
}
.share-add-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
}
.share-select {
  flex: 1;
  padding: 10px 14px;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  color: #d6d6d6;
  font-size: 0.9rem;
}
.share-select:focus {
  border-color: #5b8af0;
  outline: none;
}
.share-select--small {
  flex: 0 0 130px;
}
.share-add-btn {
  background: #5b8af0;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.share-add-btn:hover { background: #4a7ae0; }
.share-loading, .share-empty {
  text-align: center;
  color: #888;
  padding: 28px 20px;
  font-size: 0.95rem;
}
.share-section-label {
  font-size: 0.78rem;
  color: #888;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  font-weight: 600;
}
.share-perm-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  border-radius: 8px;
  margin-bottom: 6px;
  background: rgba(255,255,255,0.02);
  border: 1px solid #2a2a2a;
  transition: background 0.15s;
}
.share-perm-row:hover {
  background: rgba(255,255,255,0.04);
}
.share-perm-user {
  display: flex;
  align-items: center;
  gap: 12px;
}
.share-perm-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #5b8af0;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.78rem;
  font-weight: 600;
  flex-shrink: 0;
}
.share-perm-user strong {
  font-size: 0.92rem;
  color: #e0e0e0;
}
.share-perm-user small {
  font-size: 0.8rem;
}
.share-perm-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.share-perm-badge {
  font-size: 0.8rem;
  padding: 4px 12px;
  border-radius: 14px;
  font-weight: 500;
}
.share-perm-badge--ver {
  background: rgba(91,138,240,0.15);
  color: #5b8af0;
}
.share-perm-badge--editar {
  background: rgba(76,175,80,0.15);
  color: #4caf50;
}
.share-remove-btn {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  font-size: 0.85rem;
  transition: background 0.15s, color 0.15s;
}
.share-remove-btn:hover {
  background: rgba(239,83,80,0.15);
  color: #ef5350;
}

/* Content separator */
.doc-content-separator {
  height: 1px;
  background: linear-gradient(90deg, #2e2e2e, #3a3a3a, #2e2e2e);
  margin: 8px 0 32px;
  opacity: 0.7;
}

/* Document content - refined typography */
.doc-content {
  font-size: 1rem;
  line-height: 1.85;
  color: #d6d6d6;
  word-wrap: break-word;
  max-width: 100%;
}

.doc-content .text-muted.fst-italic {
  padding: 40px 0;
  text-align: center;
  font-size: 0.95rem;
}

.doc-content h1 {
  font-size: 1.7rem;
  margin: 1.8em 0 0.6em;
  color: #e8e8e8;
  font-weight: 700;
  padding-bottom: 0.3em;
  border-bottom: 1px solid #2e2e2e;
}
.doc-content h2 {
  font-size: 1.4rem;
  margin: 1.5em 0 0.5em;
  color: #e4e4e4;
  font-weight: 600;
}
.doc-content h3 {
  font-size: 1.2rem;
  margin: 1.3em 0 0.4em;
  color: #e0e0e0;
  font-weight: 600;
}
.doc-content p { margin-bottom: 1em; }
.doc-content ul, .doc-content ol { margin-bottom: 1em; padding-left: 1.8em; }
.doc-content li { margin-bottom: 0.3em; }
.doc-content blockquote {
  border-left: 3px solid #5a7ca8;
  padding: 8px 16px;
  margin: 1.2em 0;
  color: #b0b0b0;
  background: #1e1e24;
  border-radius: 0 6px 6px 0;
}
.doc-content pre {
  background: #1a1a2e;
  border: 1px solid #2a2a3e;
  border-radius: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  font-size: 0.88rem;
  line-height: 1.6;
  color: #d4d4d4;
  margin: 1.2em 0;
  position: relative;
}
.doc-content pre code {
  background: transparent;
  padding: 0;
  border-radius: 0;
  font-size: inherit;
  color: inherit;
}
.doc-content code {
  background: #2a2a3e;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 0.88em;
  color: #e0a0c0;
  font-family: 'SF Mono', 'Fira Code', 'Cascadia Code', Consolas, monospace;
}
.code-copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #333;
  border: 1px solid #444;
  color: #aaa;
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 0.78rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.doc-content pre:hover .code-copy-btn { opacity: 1; }
.code-copy-btn:hover { background: #444; color: #fff; }
.doc-content img {
  max-width: 100%;
  border-radius: 8px;
  margin: 1.2em 0;
  border: 1px solid #2e2e2e;
}

/* Videos en documentos y editor */
.doc-content iframe,
.ql-editor iframe {
  width: 100%;
  max-width: 100%;
  aspect-ratio: 16/9;
  border: none;
  border-radius: 8px;
  margin: 16px 0;
}
.doc-content video,
.ql-editor video {
  width: 100%;
  max-width: 100%;
  border-radius: 8px;
  margin: 16px 0;
  background: #000;
}

/* Boton subir video debajo del editor */
.editor-extra-actions {
  display: flex;
  align-items: center;
  margin-top: 8px;
}

.doc-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: 0.9rem;
  border-radius: 8px;
  overflow: hidden;
}
.doc-content table th {
  background: #252535;
  font-weight: 600;
  color: #d0d0d0;
  padding: 10px 14px;
  border: 1px solid #333;
  text-align: left;
}
.doc-content table td {
  padding: 10px 14px;
  border: 1px solid #2e2e2e;
  color: #c0c0c0;
}
.doc-content table tr:nth-child(even) td { background: #1c1c24; }
.doc-content table tr:hover td { background: #222230; }
.doc-content a {
  color: #6ea8d9;
  text-decoration: underline;
  text-decoration-color: #4a6a8a;
  text-underline-offset: 2px;
}
.doc-content a:hover { color: #8ec4f0; text-decoration-color: #6ea8d9; }
.doc-content hr {
  border: none;
  border-top: 1px solid #2e2e2e;
  margin: 2em 0;
}

/* ===== AREA / SUBCATEGORIA VIEWS ===== */

.area-card {
  border: 1px solid #2e2e2e;
  background: #202020;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.area-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  border-color: #444;
}

.area-card .card-title { color: #e0e0e0; }
.area-card .card-text { color: #999 !important; }

.sub-card {
  border: 1px solid #2e2e2e;
  background: #202020;
  transition: box-shadow 0.2s;
}

.sub-card:hover {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.doc-list-item {
  display: block;
  padding: 14px 16px;
  background: #202020;
  border: 1px solid #2e2e2e;
  border-radius: 8px;
  transition: background 0.15s;
  color: #e0e0e0;
  text-decoration: none;
}

.doc-list-item:hover {
  background: #282828;
}

/* ===== COLLABORATIVE EDITING ===== */

.collab-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: #888;
}

.collab-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #4caf50;
}

.collab-status.disconnected .collab-dot {
  background: #f44336;
}

.collab-users {
  display: flex;
  gap: 6px;
  align-items: center;
}
.collab-user-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(255,255,255,0.07);
  border-radius: 14px;
  padding: 2px 8px 2px 2px;
  cursor: default;
}
.collab-user-pill-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.55rem;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.collab-user-pill-name {
  font-size: 0.7rem;
  font-weight: 500;
  color: #ccc;
  white-space: nowrap;
}
html.light-theme .collab-user-pill {
  background: rgba(0,0,0,0.06);
}
html.light-theme .collab-user-pill-name {
  color: #555;
}

/* Cursores de otros usuarios - flag siempre visible */
.ql-cursor .ql-cursor-flag {
  opacity: 1 !important;
  visibility: visible !important;
  transition: none !important;
  padding: 1px 6px !important;
  border-radius: 3px 3px 3px 0 !important;
}
.ql-cursor .ql-cursor-flag .ql-cursor-name {
  font-size: 0.65rem;
}

/* Quill tooltip (video/link URL input) */
.ql-tooltip {
  background: #2a2a2a !important;
  border: 1px solid #444 !important;
  border-radius: 6px !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4) !important;
  color: #e0e0e0 !important;
  padding: 8px 12px !important;
  left: 50% !important;
  transform: translateX(-50%) !important;
}
.ql-tooltip input[type="text"] {
  background: #1e1e1e !important;
  border: 1px solid #555 !important;
  border-radius: 4px !important;
  color: #e0e0e0 !important;
  padding: 4px 8px !important;
  font-size: 0.8rem !important;
  outline: none !important;
}
.ql-tooltip input[type="text"]:focus {
  border-color: #5a7ca8 !important;
}
.ql-tooltip .ql-action::after,
.ql-tooltip .ql-remove::after {
  color: #5a7ca8 !important;
  font-size: 0.8rem !important;
}
.ql-tooltip .ql-action:hover::after,
.ql-tooltip .ql-remove:hover::after {
  color: #7db4e0 !important;
}
.ql-tooltip .ql-preview {
  color: #8ab4d8 !important;
  font-size: 0.8rem !important;
}
.ql-tooltip::before {
  color: #999 !important;
  font-size: 0.8rem !important;
}
html.light-theme .ql-tooltip {
  background: #fff !important;
  border-color: #ddd !important;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1) !important;
  color: #333 !important;
}
html.light-theme .ql-tooltip input[type="text"] {
  background: #f8f8f8 !important;
  border-color: #ccc !important;
  color: #333 !important;
}
html.light-theme .ql-tooltip::before {
  color: #666 !important;
}
html.light-theme .ql-tooltip .ql-preview {
  color: #1a73e8 !important;
}

/* ===== QUILL EDITOR ===== */

.quill-editor {
  background: #1e1e1e;
  min-height: 300px;
  border: 1px solid #333;
  border-radius: 0 0 6px 6px;
}

.quill-editor .ql-editor {
  min-height: 280px;
  font-size: 1rem;
  line-height: 1.7;
  color: #d0d0d0;
}

.quill-editor .ql-editor * {
  color: #d0d0d0 !important;
}

.quill-editor .ql-editor a {
  color: #6ea8d9 !important;
}

.quill-editor .ql-editor code,
.quill-editor .ql-editor pre {
  color: #d4d4d4 !important;
}

.quill-editor .ql-editor.ql-blank::before {
  color: #666 !important;
  font-style: italic;
}

.ql-toolbar.ql-snow {
  border-color: #333 !important;
  background: #252525;
}

.ql-container.ql-snow {
  border-color: #333 !important;
}

.ql-snow .ql-stroke { stroke: #999 !important; }
.ql-snow .ql-fill { fill: #999 !important; }
.ql-snow .ql-picker-label { color: #999 !important; }
.ql-snow .ql-picker-options { background: #2a2a2a !important; border-color: #444 !important; }
.ql-snow .ql-picker-item { color: #ccc !important; }

/* ===== DOC FORM FOOTER ===== */

.doc-form-footer {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #2e2e2e;
}

.doc-form-meta {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
}

.doc-form-meta-item {
  flex: 1;
}

.doc-form-meta-label {
  display: block;
  font-size: 0.8rem;
  font-weight: 500;
  color: #888;
  margin-bottom: 6px;
}

.doc-form-meta-label i {
  margin-right: 4px;
}

.doc-form-meta-hint {
  font-size: 0.75rem;
  color: #666;
  margin-top: 4px;
}

.doc-form-meta .form-control,
.doc-form-meta .form-select {
  background: #252525;
  border-color: #333;
  color: #ccc;
  font-size: 0.85rem;
}

.doc-form-meta .form-control:focus,
.doc-form-meta .form-select:focus {
  border-color: #5a7ca8;
  background: #2a2a2a;
  color: #e0e0e0;
}

.doc-form-meta input[type="file"]::file-selector-button {
  background: #333 !important;
  color: #ccc !important;
  border: none !important;
  border-right: 1px solid #444 !important;
  padding: 6px 14px;
  margin-right: 10px;
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}
.doc-form-meta input[type="file"]:hover::file-selector-button {
  background: #2a6496 !important;
  color: #fff !important;
}

.doc-form-actions {
  display: flex;
  gap: 8px;
}

/* ===== BREADCRUMBS ===== */

.breadcrumb {
  background: none;
  padding: 0;
  font-size: 0.88rem;
}

.breadcrumb-item a {
  color: #888;
  text-decoration: none;
}

.breadcrumb-item a:hover {
  color: #ccc;
}

.breadcrumb-item.active {
  color: #aaa;
}

/* ===== BOOTSTRAP DARK OVERRIDES ===== */

.card {
  background: #202020;
  border-color: #2e2e2e;
  color: #e0e0e0;
}

.form-control, .form-select {
  background: #252525;
  border-color: #3a3a3a;
  color: #e0e0e0;
}

.form-control:focus, .form-select:focus {
  background: #2a2a2a;
  border-color: #5a7ca8;
  color: #e0e0e0;
  box-shadow: 0 0 0 3px rgba(90, 124, 168, 0.2);
}

.form-control::placeholder { color: #666; }
.form-label { color: #bbb; }

.table { color: #ccc; }
.table-light { background: #252525 !important; }
.table-light th { color: #aaa !important; background: #252525 !important; }
.table-hover > tbody > tr:hover { background: #282828; color: #e0e0e0; }
.table-secondary { background: #222 !important; }

.badge.bg-light { background: #333 !important; color: #ccc !important; }

.alert-success { background: #1a3a1a; color: #8fdf8f; border-color: #2a5a2a; }
.alert-danger { background: #3a1a1a; color: #df8f8f; border-color: #5a2a2a; }
.btn-close { filter: invert(1); }

.text-muted { color: #777 !important; }
.text-dark { color: #e0e0e0 !important; }

/* ===== SEARCH BAR ===== */

.notion-search-bar {
  padding: 8px 0;
}
.notion-search-bar .input-group-text {
  background: #252525;
  border-color: #3a3a3a;
  color: #666;
}
.notion-search-bar .form-control {
  background: #252525;
  border-color: #3a3a3a;
  color: #e0e0e0;
}
.notion-search-bar .form-control::placeholder { color: #555; }

/* ===== PAGINATION ===== */

.notion-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid #2a2a2a;
  margin-top: 8px;
}
.notion-page-link {
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  color: #ccc;
  text-decoration: none;
  background: #252525;
  border: 1px solid #3a3a3a;
  transition: background 0.15s, color 0.15s;
}
.notion-page-link:hover { background: #333; color: #fff; }
.notion-page-info { font-size: 0.82rem; color: #777; }

/* ===== IMPORT MODAL ===== */

.import-modal {
  background: #1e1e1e;
  border: 1px solid #333;
  color: #e0e0e0;
}
.import-modal .modal-header { border-bottom-color: #333; }
.import-modal .nav-tabs { border-bottom-color: #3a3a3a; }
.import-modal .nav-link { color: #aaa; border-color: transparent; }
.import-modal .nav-link.active {
  background: #252525;
  color: #e0e0e0;
  border-color: #3a3a3a #3a3a3a #252525;
}
.import-textarea {
  background: #1a1a1a !important;
  border-color: #3a3a3a !important;
  color: #d0d0d0 !important;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 0.88rem;
}

/* ===== ADMIN BACKOFFICE ===== */

.admin-main {
  max-width: 960px;
  margin: 0 auto;
  padding: 28px 24px;
  background: #191919;
  min-height: calc(100vh - 56px);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

.admin-header h2 {
  font-size: 1.6rem;
  font-weight: 700;
  color: #ececec;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-header h2 i {
  opacity: 0.6;
}

.admin-tabs {
  display: flex;
  gap: 4px;
  margin-bottom: 24px;
  border-bottom: 1px solid #2e2e2e;
  padding-bottom: 8px;
}

.admin-tab {
  padding: 6px 16px;
  border-radius: 4px;
  font-size: 0.88rem;
  color: #888;
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  font-weight: 500;
}

.admin-tab:hover {
  background: #2e2e2e;
  color: #ccc;
}

.admin-tab.active {
  background: #2e2e2e;
  color: #fff;
}

/* Admin cards grid */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.admin-card {
  background: #202020;
  border: 1px solid #2e2e2e;
  border-radius: 12px;
  padding: 20px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.admin-card:hover {
  border-color: #444;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.admin-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}

.admin-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.admin-card-status {
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.admin-card-status.active {
  background: rgba(46, 125, 50, 0.18);
  color: #66bb6a;
}

.admin-card-status.inactive {
  background: rgba(158, 158, 158, 0.15);
  color: #999;
}

.admin-card-name {
  font-size: 1.05rem;
  font-weight: 600;
  color: #e0e0e0;
  margin-bottom: 4px;
}

.admin-card-desc {
  font-size: 0.82rem;
  color: #777;
  margin-bottom: 12px;
  line-height: 1.4;
}

.admin-card-stats {
  font-size: 0.78rem;
  color: #666;
  display: flex;
  gap: 12px;
  margin-bottom: 12px;
}

.admin-card-stats i {
  margin-right: 3px;
}

.admin-card-actions {
  display: flex;
  gap: 4px;
  padding-top: 10px;
  border-top: 1px solid #2a2a2a;
}

/* Admin grouped list (subcategorias) */
.admin-group {
  margin-bottom: 28px;
}

.admin-group-header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  margin-bottom: 0;
  border-bottom: 1px solid #2e2e2e;
  user-select: none;
}

.admin-group-chevron {
  font-size: 0.75rem;
  color: #666;
  transition: transform 0.2s;
  flex-shrink: 0;
}

.admin-group.collapsed .admin-group-chevron {
  transform: rotate(-90deg);
}

.admin-group-body {
  overflow: hidden;
  transition: max-height 0.25s ease;
  max-height: 1000px;
}

.admin-group.collapsed .admin-group-body {
  max-height: 0;
}

.admin-group.collapsed .admin-group-header {
  margin-bottom: 0;
  border-bottom-color: transparent;
}

.admin-group-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.admin-group-name {
  font-size: 0.95rem;
  font-weight: 600;
  color: #cfcfcf;
}

.admin-group-count {
  font-size: 0.78rem;
  color: #666;
  margin-left: auto;
}

.admin-item {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  margin: 0 -12px;
  border-radius: 6px;
  transition: background 0.1s;
}

.admin-item:hover {
  background: #252525;
}

.admin-item-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: #d0d0d0;
  flex: 1;
}

.admin-item-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.78rem;
  color: #666;
}

.admin-item-actions {
  display: flex;
  gap: 2px;
  margin-left: 12px;
  opacity: 0;
  transition: opacity 0.15s;
}

.admin-item:hover .admin-item-actions {
  opacity: 1;
}

/* Admin form card */
.admin-form-card {
  background: #202020;
  border: 1px solid #2e2e2e;
  border-radius: 12px;
  padding: 24px;
  max-width: 600px;
}

/* Icon picker fix (replace CSS variables) */
.icon-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-picker-item {
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #2e2e2e;
  border-radius: 8px;
  background: #252525;
  color: #888;
  font-size: 1.3rem;
  cursor: pointer;
  transition: all 0.15s;
}

.icon-picker-item:hover {
  border-color: #5a7ca8;
  color: #5a7ca8;
}

.icon-picker-item.active {
  border-color: #5a7ca8;
  background: #5a7ca8;
  color: #fff;
}

/* Area picker (formulario de categorias) */
.area-picker-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.area-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border: 2px solid #2e2e2e;
  border-radius: 10px;
  background: #252525;
  color: #ccc;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 0.9rem;
}

.area-picker-item:hover {
  border-color: #444;
  background: #2a2a2a;
}

.area-picker-item.active {
  border-color: var(--picker-text, #5a7ca8);
  background: var(--picker-bg, #d3e5ef);
  color: var(--picker-text, #2e6b8a);
}

.area-picker-item.active .area-picker-name {
  color: var(--picker-text, #2e6b8a);
  font-weight: 600;
}

.area-picker-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  flex-shrink: 0;
}

.area-picker-name {
  white-space: nowrap;
}

/* Quick-add button in group header */
.admin-group-add {
  margin-left: auto;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.15s;
  opacity: 0;
}

.admin-group-header:hover .admin-group-add {
  opacity: 1;
}

.admin-group-add:hover {
  background: #2e7d32;
  color: #fff;
}

/* Empty area item */
.admin-item--empty {
  padding: 12px 16px;
  border-bottom: none;
}

.admin-item--empty a {
  color: #5a7ca8;
  text-decoration: none;
}

.admin-item--empty a:hover {
  text-decoration: underline;
}

/* Admin new button */
.admin-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 16px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 600;
  background: #2e7d32;
  color: #fff;
  text-decoration: none;
  border: none;
  transition: background 0.15s;
}

.admin-new-btn:hover {
  background: #388e3c;
  color: #fff;
}

/* ===== LIGHT THEME ===== */

html.light-theme body {
  background: #f5f5f5;
  color: #333;
}

/* Navbar light */
html.light-theme .navbar.bg-dark {
  background-color: #fff !important;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
html.light-theme .navbar.bg-dark .navbar-brand span {
  color: #555 !important;
}
html.light-theme .navbar.bg-dark .btn-outline-light {
  color: #555 !important;
  border-color: #ddd !important;
}
html.light-theme .navbar.bg-dark .btn-outline-light:hover {
  background: #f0f0f0 !important;
  color: #333 !important;
}
html.light-theme .navbar.bg-dark .btn-primary {
  background: #2e7d32;
  border-color: #2e7d32;
}
html.light-theme #themeToggle i {
  color: #555;
}

/* Sidebar light */
html.light-theme .sidebar {
  background: #fff;
  border-right-color: #e0e0e0;
}
html.light-theme .sidebar-home-btn {
  color: #555;
}
html.light-theme .sidebar-home-btn:hover {
  background: #f0f0f0;
  color: #222;
}
html.light-theme .sidebar-home-btn.active {
  background: #e8e8e8;
  color: #222;
}
html.light-theme .sidebar-toggle-btn {
  color: #999;
}
html.light-theme .sidebar-toggle-btn:hover {
  background: #e8e8e8;
  color: #333;
}
html.light-theme .sidebar-open-btn {
  background: #fff;
  border-color: #ddd;
  color: #888;
}
html.light-theme .sidebar-fav-link {
  color: #555;
}
html.light-theme .sidebar-fav-link:hover {
  background: #eee;
  color: #222;
}
html.light-theme .sidebar-open-btn:hover {
  background: #f0f0f0;
  color: #333;
}
html.light-theme .sidebar-area-link {
  color: #444;
}
html.light-theme .sidebar-area-link:hover {
  background: #f0f0f0;
  color: #111;
}
html.light-theme .sidebar-area-link.active {
  background: #e8e8e8;
  color: #111;
}
html.light-theme .sidebar-area-toggle {
  color: #999;
}
html.light-theme .sidebar-area-toggle:hover {
  background: #f0f0f0;
  color: #555;
}
html.light-theme .sidebar-sub-link {
  color: #777;
}
html.light-theme .sidebar-sub-link:hover {
  background: #f0f0f0;
  color: #333;
}
html.light-theme .sidebar-sub-link.active {
  background: #e8e8e8;
  color: #111;
}

/* Main content light */
html.light-theme .main-content {
  background: #f5f5f5;
}

/* Area big cards light */
html.light-theme .area-big-card {
  background: #fff;
  border-color: #e0e0e0;
  color: #333;
}
html.light-theme .area-big-card:hover {
  border-color: #ccc;
  box-shadow: 0 8px 24px rgba(0,0,0,0.08);
  color: #333;
}
html.light-theme .area-big-card-title {
  color: #333;
}
html.light-theme .area-big-card-desc {
  color: #777;
}
html.light-theme .area-big-card-stats {
  color: #999;
}

/* Recent documents */
html.light-theme .recent-item {
  color: #333;
}
html.light-theme .recent-item:hover {
  background: #f0f0f0;
  color: #111;
}
html.light-theme .recent-item-icon {
  color: #999;
}
html.light-theme .recent-item-date {
  color: #999;
}

/* Notion page header */
html.light-theme .notion-page-title {
  color: #222;
}

/* Notion toolbar + tabs */
html.light-theme .notion-toolbar {
  border-bottom-color: #e0e0e0;
}
html.light-theme .notion-tab {
  color: #777;
}
html.light-theme .notion-tab:hover {
  background: #f0f0f0;
  color: #333;
}
html.light-theme .notion-tab.active {
  background: #e8e8e8;
  color: #111;
}

/* Notion table */
html.light-theme .notion-table thead th {
  color: #888;
  border-bottom-color: #e0e0e0;
}
html.light-theme .notion-row {
  border-bottom-color: #eee;
}
html.light-theme .notion-row:hover {
  background: #f8f8f8;
}
html.light-theme .notion-row td {
  color: #555;
}
html.light-theme .doc-name {
  color: #222;
}
html.light-theme .notion-open-btn,
html.light-theme .notion-copy-btn {
  background: #e8e8e8;
  color: #555;
  border-color: #ddd;
}
html.light-theme .notion-open-btn:hover,
html.light-theme .notion-copy-btn:hover {
  background: #ddd;
  color: #111;
}

/* Category dropdown - light theme */
html.light-theme .cat-dropdown {
  background: #fff;
  border-color: #e0e0e0;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}
html.light-theme .cat-dropdown-search {
  background: #f8f8f8;
  border-color: #ddd;
  color: #333;
}
html.light-theme .cat-dropdown-search::placeholder {
  color: #aaa;
}
html.light-theme .cat-dropdown-item:hover {
  background: #f5f5f5;
}
html.light-theme .cat-dropdown-item.active {
  background: #f0f0f0;
}

/* Add row */
html.light-theme .notion-add-row {
  color: #999;
  border-top-color: #eee;
}
html.light-theme .notion-add-row:hover {
  color: #555;
  background: #f8f8f8;
}

/* Notion empty */
html.light-theme .notion-empty {
  background: #fff;
  border-color: #e0e0e0;
}

/* Notion groups */
html.light-theme .notion-group-header {
  border-bottom-color: #e0e0e0;
}
html.light-theme .notion-subgroup-header {
  color: #666;
}

/* Document article */
html.light-theme .doc-title {
  color: #222;
}
html.light-theme .doc-properties {
  border-top-color: #eee;
}
html.light-theme .doc-prop-row:hover {
  background: #f8f8f8;
}
html.light-theme .doc-prop-label {
  color: #888;
}
html.light-theme .doc-prop-value {
  color: #444;
}
html.light-theme .doc-prop-value a.text-muted:hover {
  color: #222 !important;
}
html.light-theme .doc-prop-value a[target="_blank"] {
  background: #f0f4f8;
  color: #3a7ab5;
}
html.light-theme .doc-prop-value a[target="_blank"]:hover {
  background: #e4ecf4;
  color: #2a5a8a;
}
html.light-theme .doc-content-separator {
  background: linear-gradient(90deg, #e0e0e0, #d0d0d0, #e0e0e0);
}
html.light-theme .doc-content {
  color: #333;
}
html.light-theme .doc-content h1 {
  color: #222;
  border-bottom-color: #e0e0e0;
}
html.light-theme .doc-content h2 {
  color: #333;
}
html.light-theme .doc-content h3 {
  color: #444;
}
html.light-theme .doc-content blockquote {
  background: #f0f4f8;
  color: #555;
  border-left-color: #5a7ca8;
}
html.light-theme .doc-content pre {
  background: #f6f8fa;
  border-color: #e0e0e0;
  color: #333;
}
html.light-theme .doc-content code {
  background: #f0f0f8;
  color: #c7254e;
}
html.light-theme .code-copy-btn {
  background: #e8e8e8;
  border-color: #ddd;
  color: #666;
}
html.light-theme .code-copy-btn:hover {
  background: #ddd;
  color: #333;
}
html.light-theme .doc-content img {
  border-color: #e0e0e0;
}
html.light-theme .doc-content table th {
  background: #f6f8fa;
  color: #333;
  border-color: #e0e0e0;
}
html.light-theme .doc-content table td {
  border-color: #eee;
  color: #444;
}
html.light-theme .doc-content table tr:nth-child(even) td {
  background: #fafafa;
}
html.light-theme .doc-content table tr:hover td {
  background: #f0f4f8;
}
html.light-theme .doc-content a {
  color: #2a6cb5;
  text-decoration-color: #8cb8e0;
}
html.light-theme .doc-content a:hover {
  color: #1a4c85;
}
html.light-theme .doc-content hr {
  border-top-color: #e0e0e0;
}

/* Action buttons */
html.light-theme .doc-action-btn {
  color: #777;
}
html.light-theme .doc-action-btn:hover {
  background: #f0f0f0;
  color: #333;
}

/* Area / Sub cards */
html.light-theme .area-card {
  background: #fff;
  border-color: #e0e0e0;
}
html.light-theme .area-card:hover {
  border-color: #ccc;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
html.light-theme .area-card .card-title {
  color: #333;
}
html.light-theme .area-card .card-text {
  color: #777 !important;
}
html.light-theme .sub-card {
  background: #fff;
  border-color: #e0e0e0;
}
html.light-theme .doc-list-item {
  background: #fff;
  border-color: #e0e0e0;
  color: #333;
}
html.light-theme .doc-list-item:hover {
  background: #f8f8f8;
}

/* Collab status */
html.light-theme .collab-status {
  color: #777;
}

/* Quill editor */
html.light-theme .quill-editor {
  background: #fff;
  border-color: #ddd;
}
html.light-theme .quill-editor .ql-editor {
  color: #333;
}
html.light-theme .quill-editor .ql-editor * {
  color: #333 !important;
}
html.light-theme .quill-editor .ql-editor a {
  color: #2a6cb5 !important;
}
html.light-theme .quill-editor .ql-editor code,
html.light-theme .quill-editor .ql-editor pre {
  color: #333 !important;
}
html.light-theme .quill-editor .ql-editor.ql-blank::before {
  color: #aaa !important;
}
html.light-theme .ql-toolbar.ql-snow {
  background: #fafafa;
  border-color: #ddd !important;
}
html.light-theme .ql-container.ql-snow {
  border-color: #ddd !important;
}
html.light-theme .ql-snow .ql-stroke {
  stroke: #555 !important;
}
html.light-theme .ql-snow .ql-fill {
  fill: #555 !important;
}
html.light-theme .ql-snow .ql-picker-label {
  color: #555 !important;
}
html.light-theme .ql-snow .ql-picker-options {
  background: #fff !important;
  border-color: #ddd !important;
}
html.light-theme .ql-snow .ql-picker-item {
  color: #333 !important;
}

/* Doc form footer */
html.light-theme .doc-form-footer {
  border-top-color: #e0e0e0;
}
html.light-theme .doc-form-meta .form-control,
html.light-theme .doc-form-meta .form-select {
  background: #fff;
  border-color: #ddd;
  color: #333;
}
html.light-theme .doc-form-meta .form-control:focus,
html.light-theme .doc-form-meta .form-select:focus {
  border-color: #5a7ca8;
  background: #fff;
}
html.light-theme .doc-form-meta input[type="file"]::file-selector-button {
  background: #f0f0f0 !important;
  color: #333 !important;
  border-right: 1px solid #ddd !important;
  transition: background 0.2s, color 0.2s;
}
html.light-theme .doc-form-meta input[type="file"]:hover::file-selector-button {
  background: #5a9fd4 !important;
  color: #fff !important;
}

/* Breadcrumbs */
html.light-theme .breadcrumb-item a {
  color: #777;
}
html.light-theme .breadcrumb-item a:hover {
  color: #333;
}
html.light-theme .breadcrumb-item.active {
  color: #555;
}

/* Bootstrap overrides light */
html.light-theme .card {
  background: #fff;
  border-color: #e0e0e0;
  color: #333;
}
html.light-theme .form-control,
html.light-theme .form-select {
  background: #fff;
  border-color: #ddd;
  color: #333;
}
html.light-theme .form-control:focus,
html.light-theme .form-select:focus {
  background: #fff;
  border-color: #5a7ca8;
  color: #333;
  box-shadow: 0 0 0 3px rgba(90,124,168,0.15);
}
html.light-theme .form-control::placeholder {
  color: #aaa;
}
html.light-theme .form-label {
  color: #555;
}
html.light-theme .table {
  color: #333;
}
html.light-theme .table-light {
  background: #fafafa !important;
}
html.light-theme .table-light th {
  color: #555 !important;
  background: #fafafa !important;
}
html.light-theme .table-hover > tbody > tr:hover {
  background: #f5f5f5;
  color: #222;
}
html.light-theme .table-secondary {
  background: #f0f0f0 !important;
}
html.light-theme .badge.bg-light {
  background: #e8e8e8 !important;
  color: #555 !important;
}
html.light-theme .alert-success {
  background: #e8f5e9;
  color: #2e7d32;
  border-color: #c8e6c9;
}
html.light-theme .alert-danger {
  background: #ffebee;
  color: #c62828;
  border-color: #ffcdd2;
}
html.light-theme .btn-close {
  filter: none;
}
html.light-theme .text-muted {
  color: #888 !important;
}
html.light-theme .text-dark {
  color: #222 !important;
}

/* Search bar light */
html.light-theme .notion-search-bar .input-group-text {
  background: #fff;
  border-color: #ddd;
  color: #999;
}
html.light-theme .notion-search-bar .form-control {
  background: #fff;
  border-color: #ddd;
  color: #333;
}
html.light-theme .notion-search-bar .form-control::placeholder {
  color: #aaa;
}

/* Pagination light */
html.light-theme .notion-pagination {
  border-top-color: #eee;
}
html.light-theme .notion-page-link {
  background: #fff;
  border-color: #ddd;
  color: #555;
}
html.light-theme .notion-page-link:hover {
  background: #f0f0f0;
  color: #222;
}
html.light-theme .notion-page-info {
  color: #888;
}

/* Import modal light */
html.light-theme .import-modal {
  background: #fff;
  border-color: #ddd;
  color: #333;
}
html.light-theme .import-modal .modal-header {
  border-bottom-color: #eee;
}
html.light-theme .import-modal .nav-tabs {
  border-bottom-color: #ddd;
}
html.light-theme .import-modal .nav-link {
  color: #777;
}
html.light-theme .import-modal .nav-link.active {
  background: #fff;
  color: #333;
  border-color: #ddd #ddd #fff;
}
html.light-theme .import-textarea {
  background: #fafafa !important;
  border-color: #ddd !important;
  color: #333 !important;
}

/* Admin backoffice light */
html.light-theme .admin-main {
  background: #f5f5f5;
}
html.light-theme .admin-header h2 {
  color: #222;
}
html.light-theme .admin-tabs {
  border-bottom-color: #e0e0e0;
}
html.light-theme .admin-tab {
  color: #777;
}
html.light-theme .admin-tab:hover {
  background: #f0f0f0;
  color: #333;
}
html.light-theme .admin-tab.active {
  background: #e8e8e8;
  color: #111;
}
html.light-theme .admin-card {
  background: #fff;
  border-color: #e0e0e0;
}
html.light-theme .admin-card:hover {
  border-color: #ccc;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
html.light-theme .admin-card-name {
  color: #333;
}
html.light-theme .admin-card-desc {
  color: #777;
}
html.light-theme .admin-card-stats {
  color: #999;
}
html.light-theme .admin-card-actions {
  border-top-color: #eee;
}
html.light-theme .admin-group-header {
  border-bottom-color: #e0e0e0;
}
html.light-theme .admin-group-chevron {
  color: #999;
}
html.light-theme .admin-group.collapsed .admin-group-header {
  border-bottom-color: transparent;
}
html.light-theme .admin-group-name {
  color: #333;
}
html.light-theme .admin-group-count {
  color: #999;
}
html.light-theme .admin-item:hover {
  background: #f8f8f8;
}
html.light-theme .admin-item-name {
  color: #333;
}
html.light-theme .admin-item-meta {
  color: #999;
}
html.light-theme .admin-form-card {
  background: #fff;
  border-color: #e0e0e0;
}

/* Icon picker light */
html.light-theme .icon-picker-item {
  border-color: #e0e0e0;
  background: #fafafa;
  color: #777;
}
html.light-theme .icon-picker-item:hover {
  border-color: #5a7ca8;
  color: #5a7ca8;
}

/* Area picker light */
html.light-theme .area-picker-item {
  border-color: #e0e0e0;
  background: #fafafa;
  color: #555;
}
html.light-theme .area-picker-item:hover {
  border-color: #ccc;
  background: #f0f0f0;
}

/* Admin quick-add */
html.light-theme .admin-group-add {
  color: #999;
}
html.light-theme .admin-item--empty a {
  color: #5a7ca8;
}

/* Responsive sidebar border */
@media (max-width: 768px) {
  html.light-theme .sidebar {
    border-bottom-color: #e0e0e0;
  }
}

/* ===== RESPONSIVE ===== */

@media (max-width: 768px) {
  .app-layout {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-width: auto;
    border-right: none;
    border-bottom: 1px solid #2e2e2e;
    max-height: 50vh;
  }

  .main-content {
    padding: 20px 16px;
  }

  .areas-grid {
    grid-template-columns: 1fr;
    max-width: 300px;
    margin-left: auto;
    margin-right: auto;
  }

  .notion-page-title {
    font-size: 1.4rem;
  }

  .doc-title {
    font-size: 1.5rem;
  }

  .doc-notion-header {
    margin-bottom: 20px;
  }

  .doc-icon-wrapper {
    width: 40px;
    height: 40px;
    font-size: 1.2rem;
  }

  .doc-prop-label {
    width: 120px;
    min-width: 120px;
    font-size: 0.8rem;
  }

  .doc-action-btn {
    padding: 4px 8px;
    font-size: 0.78rem;
  }

  .notion-table .col-date { display: none; }

  .notion-toolbar {
    flex-wrap: wrap;
    gap: 8px;
  }

  .sidebar-toggle-btn,
  .sidebar-open-btn {
    display: none !important;
  }

  .admin-grid {
    grid-template-columns: 1fr;
  }

  .admin-main {
    padding: 20px 16px;
  }

  .admin-item-actions {
    opacity: 1;
  }
}

/* ===== LOGIN PAGE ===== */
.login-container {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  background: #191919;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: #252525;
  border: 1px solid #333;
  border-radius: 12px;
  padding: 40px 32px;
}
.login-logo {
  text-align: center;
  margin-bottom: 32px;
}
.login-logo h2 {
  color: #ccc;
  font-weight: 500;
  margin-top: 12px;
  font-size: 1.4rem;
}
.login-card .form-label {
  color: #aaa;
  font-size: 0.85rem;
}
.login-card .form-control {
  background: #1e1e1e;
  border-color: #3a3a3a;
  color: #e0e0e0;
}
.login-card .form-control:focus {
  background: #222;
  border-color: #5a7ca8;
  color: #e0e0e0;
  box-shadow: 0 0 0 2px rgba(90,124,168,0.15);
}
.login-card .btn-primary {
  background: #5a7ca8;
  border-color: #5a7ca8;
}
.login-card .btn-primary:hover {
  background: #4a6c98;
  border-color: #4a6c98;
}

/* Light theme login */
html.light-theme .login-container {
  background: #f5f5f5;
}
html.light-theme .login-card {
  background: #fff;
  border-color: #e0e0e0;
}
html.light-theme .login-logo h2 {
  color: #333;
}
html.light-theme .login-card .form-label {
  color: #555;
}
html.light-theme .login-card .form-control {
  background: #f8f8f8;
  border-color: #ddd;
  color: #333;
}
html.light-theme .login-card .form-control:focus {
  background: #fff;
  border-color: #5a7ca8;
  color: #333;
}

/* ===== USER AVATAR IN NAVBAR ===== */
.nav-user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #5a7ca8;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: default;
  margin-left: 4px;
}

/* Sidebar diagrama */
.sidebar-diag-title {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  font-size: 0.92rem;
  font-weight: 600;
  color: #e0e0e0;
  border-bottom: 1px solid #2a2a2a;
  margin-bottom: 4px;
}
.sidebar-diag-title i {
  color: #b88be8;
  font-size: 1.1rem;
}
.sidebar-doc-area {
  display: block;
  font-size: 0.68rem;
  color: #666;
  margin-top: 1px;
  margin-left: 22px;
}

/* ===== DIAGRAMAS ===== */
.diag-page { padding: 0 0 40px; }
.diag-page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 24px;
  gap: 16px;
}
.diag-page-title {
  font-size: 1.3rem;
  font-weight: 600;
  margin: 0;
  color: #e0e0e0;
}
.diag-new-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #5b8af0;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 9px 18px;
  font-size: 0.88rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.15s;
}
.diag-new-btn:hover { background: #4a7ae0; color: #fff; }
.diag-empty {
  text-align: center;
  padding: 60px 20px;
}
.diag-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.diag-card {
  background: #1e1e1e;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.diag-card:hover {
  border-color: #5b8af0;
  box-shadow: 0 4px 20px rgba(91,138,240,0.12);
  color: inherit;
}
.diag-card-preview {
  height: 160px;
  background: #161616;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.diag-card-preview img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.diag-card-placeholder {
  color: #333;
  font-size: 3rem;
}
.diag-card-body {
  padding: 12px 16px;
}
.diag-card-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 6px;
  color: #e0e0e0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.diag-card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 0.78rem;
  color: #888;
}
.diag-card-meta i { margin-right: 3px; }

/* Editor de diagramas */
.diag-editor-page {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 56px);
  margin: -20px -32px;
}
.diag-editor-header {
  padding: 12px 20px;
  border-bottom: 1px solid #2a2a2a;
  background: #1a1a1a;
  flex-shrink: 0;
}
.diag-editor-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.diag-title-input {
  flex: 1;
  background: transparent;
  border: none;
  color: #e0e0e0;
  font-size: 1.1rem;
  font-weight: 600;
  outline: none;
  padding: 4px 8px;
  border-radius: 4px;
}
.diag-title-input:focus {
  background: rgba(255,255,255,0.04);
}
.diag-editor-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.diag-toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.diag-toolbar-label {
  font-size: 0.8rem;
  color: #888;
  white-space: nowrap;
}
.diag-areas-checkboxes {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.diag-area-check {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: #bbb;
  background: #2a2a2a;
  padding: 3px 10px;
  border-radius: 12px;
  cursor: pointer;
  transition: background 0.15s;
}
.diag-area-check:hover { background: #333; }
.diag-area-check input { accent-color: #5b8af0; }
.diag-toolbar-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #2a2a2a;
  border: 1px solid #3a3a3a;
  color: #ccc;
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 0.82rem;
  cursor: pointer;
}
.diag-toolbar-btn:hover { background: #333; color: #fff; }
.diag-toolbar-btn--danger:hover { background: rgba(239,83,80,0.15); color: #ef5350; border-color: #ef5350; }
.diag-linked-docs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.diag-linked-doc {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: rgba(91,138,240,0.1);
  border: 1px solid rgba(91,138,240,0.2);
  color: #7aa5f0;
  padding: 3px 10px;
  border-radius: 14px;
  font-size: 0.8rem;
}
.diag-linked-doc a { color: inherit; text-decoration: none; }
.diag-linked-doc a:hover { text-decoration: underline; }
.diag-unlink-btn {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 0 2px;
  line-height: 1;
}
.diag-unlink-btn:hover { color: #ef5350; }
.diag-editor-container {
  flex: 1;
  position: relative;
}
.diag-drawio-frame {
  width: 100%;
  height: 100%;
  border: none;
}
.diag-doc-results {
  max-height: 300px;
  overflow-y: auto;
}
.diag-doc-result-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #2a2a2a;
  gap: 10px;
}
.diag-doc-result-row:last-child { border-bottom: none; }

/* ===== PRINT / EXPORTAR PDF ===== */
@media print {
  /* Ocultar navegacion y controles */
  .navbar,
  .sidebar,
  .sidebar-open-btn,
  .doc-actions,
  .alert,
  .doc-header-accent {
    display: none !important;
  }

  /* Layout: solo contenido, sin sidebar */
  .app-layout {
    display: block !important;
  }
  .main-content {
    margin-left: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
  }

  /* Forzar colores de impresion */
  body,
  .main-content,
  .doc-article {
    background: #fff !important;
    color: #000 !important;
  }

  .doc-article {
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .doc-notion-header {
    margin-bottom: 16px !important;
  }
  .doc-title {
    color: #000 !important;
    font-size: 24pt !important;
  }
  .doc-icon-wrapper {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  /* Propiedades del documento */
  .doc-properties {
    border: 1px solid #ccc !important;
    background: #f9f9f9 !important;
    margin-bottom: 20px !important;
  }
  .doc-prop-row {
    border-color: #ddd !important;
  }
  .doc-prop-label,
  .doc-prop-value,
  .doc-prop-value a {
    color: #333 !important;
  }
  .notion-tag {
    print-color-adjust: exact;
    -webkit-print-color-adjust: exact;
  }

  /* Contenido */
  .doc-content {
    color: #000 !important;
  }
  .doc-content h1, .doc-content h2, .doc-content h3,
  .doc-content h4, .doc-content h5, .doc-content h6 {
    color: #000 !important;
  }
  .doc-content a {
    color: #0066cc !important;
    text-decoration: underline !important;
  }
  .doc-content blockquote {
    border-left: 3px solid #999 !important;
    background: #f5f5f5 !important;
    color: #333 !important;
  }
  .doc-content pre,
  .doc-content code {
    background: #f5f5f5 !important;
    color: #333 !important;
    border: 1px solid #ddd !important;
  }
  .doc-content table {
    border-color: #ccc !important;
  }
  .doc-content th {
    background: #eee !important;
    color: #000 !important;
  }
  .doc-content td {
    color: #000 !important;
    border-color: #ccc !important;
  }

  /* Evitar cortes en medio de elementos */
  .doc-content pre,
  .doc-content table,
  .doc-content blockquote {
    page-break-inside: avoid;
  }

  /* Ocultar boton copiar de code blocks */
  .code-copy-btn {
    display: none !important;
  }

  /* Videos: mostrar placeholder en vez del video */
  .doc-content iframe,
  .doc-content video {
    display: none !important;
  }
}
