/* Base Styles & Design Tokens */
:root {
  --font-family: 'Inter', system-ui, -apple-system, sans-serif;
  
  /* Color Palette (Glassmorphism & Zucchini Green Theme) */
  --bg-main: #060c08; /* Deep dark zucchini background */
  --bg-sidebar: #0b140e; /* Dark zucchini sidebar */
  --glass-bg: rgba(255, 255, 255, 0.02);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-hover: rgba(255, 255, 255, 0.06);
  --glass-active: rgba(255, 255, 255, 0.1);
  
  --primary: #2ecc71; /* Zucchini Neon Green */
  --primary-hover: #27ae60;
  --primary-glow: rgba(46, 204, 113, 0.35);
  
  --success: #1abc9c; /* Mint/Teal Green */
  --success-glow: rgba(26, 188, 156, 0.35);
  
  --warning: #f59e0b; /* Amber */
  --warning-glow: rgba(245, 158, 11, 0.4);
  
  --danger: #ef4444; /* Rose Red */
  --danger-glow: rgba(239, 68, 68, 0.4);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #6b7280;
  
  --border-radius: 12px;
  --border-radius-lg: 16px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  overflow: hidden;
  height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* App Container Layout */
.app-container {
  display: flex;
  height: 100vh;
  width: 100vw;
}

/* Sidebar Navigation */
.sidebar {
  width: 260px;
  flex-shrink: 0;
  background-color: var(--bg-sidebar);
  border-right: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  padding: 24px 16px;
  overflow: hidden;
  transition: width 0.2s ease, padding 0.2s ease;
}

/* Collapsed icon rail. Toggled via .sidebar-toggle-btn (setupCollapsible in main.js,
   storageKey 'ui.sidebar.open'), state remembered in localStorage like the other
   collapsible sections. */
.sidebar.sidebar-collapsed {
  width: 64px;
  padding-left: 8px;
  padding-right: 8px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 36px;
  padding-left: 8px;
}

.sidebar.sidebar-collapsed .sidebar-brand {
  flex-direction: column;
  justify-content: center;
  padding-left: 0;
  margin-bottom: 24px;
}

.sidebar.sidebar-collapsed .brand-text,
.sidebar.sidebar-collapsed .lang-toggle-container {
  display: none;
}

.sidebar-toggle-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 11px;
  cursor: pointer;
  transition: var(--transition);
}

.sidebar-toggle-btn:hover {
  background-color: var(--glass-hover);
  color: var(--text-main);
}

.brand-icon {
  width: 42px;
  height: 42px;
  background: linear-gradient(135deg, var(--primary), var(--success));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
  box-shadow: 0 4px 12px var(--primary-glow);
}

.brand-text h2 {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.brand-text span {
  font-size: 11px;
  color: var(--text-muted);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: none;
  border: none;
  border-radius: var(--border-radius);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.nav-item i {
  font-size: 16px;
}

.nav-item:hover {
  background-color: var(--glass-hover);
  color: var(--text-main);
}

.nav-item.active {
  background-color: rgba(59, 130, 246, 0.1);
  color: var(--primary);
  font-weight: 600;
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 3px;
  background-color: var(--primary);
  border-radius: 0 4px 4px 0;
}

.nav-item .badge {
  margin-left: auto;
  background-color: var(--glass-active);
  color: var(--text-main);
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--glass-border);
}

.sidebar-footer {
  border-top: 1px solid var(--glass-border);
  padding-top: 16px;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Collapsed icon rail: hide labels/badges, center the icons, keep tooltips (title/
   aria-label on each nav item) as the only way to identify them. */
.sidebar.sidebar-collapsed .nav-item {
  justify-content: center;
  padding: 12px 0;
  gap: 0;
}

.sidebar.sidebar-collapsed .nav-item span {
  display: none;
}

.sidebar.sidebar-collapsed .sidebar-footer .status-indicator span:not(.dot) {
  display: none;
}

.sidebar.sidebar-collapsed .sidebar-footer {
  display: flex;
  justify-content: center;
}

.status-indicator .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--success);
  box-shadow: 0 0 8px var(--success);
}

/* Main Content Area */
.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Glassmorphism Cards */
.glass-card {
  background: var(--glass-bg);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius-lg);
  backdrop-filter: blur(15px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  transition: var(--transition);
}

/* View Container */
.view-container {
  flex: 1;
  padding: 32px;
  overflow-y: auto;
}

.tab-view {
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.tab-view.active {
  display: block;
}

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

/* Dashboard Tab Styles */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px;
}

.stat-icon {
  width: 50px;
  height: 50px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: #fff;
}

.stat-icon.bg-blue {
  background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.stat-icon.bg-yellow {
  background: linear-gradient(135deg, #f59e0b, #b45309);
  box-shadow: 0 4px 12px var(--warning-glow);
}

.stat-icon.bg-orange {
  background: linear-gradient(135deg, #f97316, #c2410c);
  box-shadow: 0 4px 12px rgba(249, 115, 22, 0.4);
}

.stat-icon.bg-green {
  background: linear-gradient(135deg, #10b981, #047857);
  box-shadow: 0 4px 12px var(--success-glow);
}

.stat-info h3 {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.stat-value {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

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

.card-header h2 {
  font-size: 15px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.card-body {
  padding: 24px;
}

/* Forms & Inputs */
.modern-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

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

.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input, .form-select, .form-textarea {
  background-color: rgba(15, 22, 38, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  color: var(--text-main);
  padding: 12px 16px;
  font-size: 14px;
  transition: var(--transition);
  outline: none;
  font-family: var(--font-family);
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.form-textarea {
  resize: vertical;
  min-height: 240px;
}

.form-textarea.short {
  min-height: 90px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border: none;
  border-radius: var(--border-radius);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.btn-primary {
  background-color: var(--primary);
  color: #fff;
}
.btn-primary:hover {
  background-color: var(--primary-hover);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-success {
  background-color: var(--success);
  color: #fff;
}
.btn-success:hover {
  background-color: #059669;
  box-shadow: 0 4px 12px var(--success-glow);
}

.btn-warning {
  background-color: var(--warning);
  color: #0b0f19;
}
.btn-warning:hover {
  background-color: #d97706;
  box-shadow: 0 4px 12px var(--warning-glow);
}

.btn-secondary {
  background-color: var(--glass-active);
  color: var(--text-main);
  border: 1px solid var(--glass-border);
}
.btn-secondary:hover {
  background-color: var(--glass-hover);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 11px;
}

.w-100 {
  width: 100%;
}

/* Activity List */
.activity-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 300px;
  overflow-y: auto;
}

.activity-item {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  padding: 10px;
  border-radius: 8px;
  background-color: rgba(255, 255, 255, 0.01);
}

.activity-item.empty {
  justify-content: center;
  color: var(--text-dark);
}

/* Articles Layout */
.articles-layout {
  display: flex;
  gap: 0;
  /* Was 100vh - 160px, which budgeted for the now-removed 70px .top-header row;
     dropping the header reclaims that height for the editor. */
  height: calc(100vh - 90px);
}

.articles-list-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  width: 40%;
  min-width: 300px;
  max-width: 60%;
  flex-shrink: 0;
}

.panel-header {
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.search-bar {
  display: flex;
  align-items: center;
  background-color: rgba(15, 22, 38, 0.4);
  border: 1px solid var(--glass-border);
  border-radius: var(--border-radius);
  padding: 10px 16px;
  gap: 10px;
}

.search-bar input {
  background: none;
  border: none;
  outline: none;
  color: var(--text-main);
  width: 100%;
  font-size: 13px;
}

.filter-bar {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-btn {
  background: none;
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  color: var(--text-muted);
  font-size: 11px;
  padding: 6px 14px;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}

.filter-btn:hover {
  background-color: var(--glass-hover);
  color: var(--text-main);
}

.filter-btn.active {
  background-color: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

/* Per-source toggles: lit = shown, dim = hidden. Green to keep them visually apart
   from the blue status filters, which are single-choice rather than on/off. */
#source-filter-bar {
  margin-top: 6px;
}

.source-filter-btn {
  padding: 4px 10px;
  font-size: 10.5px;
}

.source-filter-btn.active {
  background-color: var(--success, #22c55e);
  border-color: var(--success, #22c55e);
  color: #fff;
}

.source-filter-btn:not(.active) {
  opacity: 0.55;
  text-decoration: line-through;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
}

.articles-list-container {
  display: flex;
  flex-direction: column;
}

.list-loading {
  text-align: center;
  padding: 32px;
  color: var(--text-dark);
  font-size: 13px;
}

.filter-btn[data-filter="PENDING_REVIEW"].active {
  background-color: var(--success);
  border-color: var(--success);
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.4);
}
.filter-btn[data-filter="FOR_CONSIDERATION"].active {
  background-color: #f59e0b;
  border-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.4);
}
.filter-btn[data-filter="NOT_RELEVANT"].active {
  background-color: #ef4444;
  border-color: #ef4444;
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.4);
}
.filter-btn[data-filter="PENDING_TRANSLATION"].active {
  background-color: #6366f1;
  border-color: #6366f1;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.4);
}
.filter-btn[data-filter="SENT_TO_CMS"].active {
  background-color: #0891b2;
  border-color: #0891b2;
  box-shadow: 0 0 10px rgba(8, 145, 178, 0.4);
}
.filter-btn[data-filter="PUBLISHED"].active {
  background-color: #06b6d4;
  border-color: #06b6d4;
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.4);
}

.bulk-actions-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.95);
  border-bottom: 1px solid var(--glass-border);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
  transition: var(--transition);
  animation: slideDown 0.2s ease-out;
}

.bulk-actions-bar.hidden {
  display: none !important;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-5px); }
  to { opacity: 1; transform: translateY(0); }
}

.article-select-checkbox {
  width: 15px;
  height: 15px;
  accent-color: var(--primary);
  cursor: pointer;
  margin-top: 2px;
  margin-right: 12px;
  flex-shrink: 0;
}

/* Article List Item */
.article-item-card {
  display: flex;
  align-items: flex-start;
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
  cursor: pointer;
  transition: var(--transition);
}

.article-item-card:hover {
  background-color: var(--glass-hover);
}

.article-item-card.selected {
  background-color: rgba(59, 130, 246, 0.08);
  border-left: 3px solid var(--primary);
}

.card-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.site-tag {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--primary);
}

.status-badge {
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
}

.status-badge.pending_translation { background-color: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-badge.for_consideration { background-color: rgba(59, 130, 246, 0.15); color: #3b82f6; }
.status-badge.not_relevant { background-color: rgba(108, 117, 125, 0.15); color: #6c757d; }
.status-badge.pending_review { background-color: rgba(249, 115, 22, 0.15); color: #f97316; }
.status-badge.pending_cms_upload { background-color: rgba(245, 158, 11, 0.15); color: var(--warning); }
.status-badge.cms_uploading { background-color: rgba(147, 51, 234, 0.15); color: #a855f7; }
.status-badge.sent_to_cms { background-color: rgba(6, 182, 212, 0.15); color: #06b6d4; }
.status-badge.published { background-color: rgba(16, 185, 129, 0.15); color: var(--success); }

.card-title-text {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
  margin-bottom: 8px;
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.card-meta-row {
  font-size: 10px;
  color: var(--text-dark);
  display: flex;
  justify-content: space-between;
}

/* Editor Panel */
.articles-editor-panel {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex: 1;
  min-width: 400px;
}

.editor-empty-state {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--text-dark);
  text-align: center;
  padding: 32px;
  gap: 12px;
}

.editor-empty-state i {
  font-size: 48px;
}

.editor-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-header {
  padding: 12px 16px;
  border-bottom: 1px solid var(--glass-border);
}

.status-tag {
  font-size: 10px;
  font-weight: 700;
  background-color: var(--glass-active);
  padding: 4px 10px;
  border-radius: 20px;
  display: inline-block;
  margin-bottom: 6px;
}

.editor-header h2 {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 6px;
}

.meta-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  font-size: 11px;
  color: var(--text-muted);
}

.meta-row a {
  color: var(--primary);
  text-decoration: none;
}

/* No vertical padding here: this is the sticky scroll container for the CKEditor
   toolbar, and Blink anchors sticky offsets to the content box. Any padding-top
   parks the toolbar that far below the tab bar and lets content scroll through
   the gap. The inset lives on .tab-edit-view instead. */
.editor-body {
  flex: 1;
  overflow-y: auto;
  padding: 0;
}

.tabs-editor-nav {
  display: flex;
  border-bottom: 1px solid var(--glass-border);
  gap: 16px;
  padding: 0 24px;
  background-color: var(--bg-sidebar);
  z-index: 10;
}

.tab-edit-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 4px;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: var(--transition);
}

.tab-edit-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.tab-edit-view {
  display: none;
}

.tab-edit-view.active {
  display: block;
  padding: 24px;
}

.czech-content {
  background-color: rgba(255, 255, 255, 0.01);
  border: 1px solid var(--glass-border);
  padding: 16px;
  border-radius: var(--border-radius);
}

.czech-content h4 {
  margin-bottom: 12px;
}

.czech-body-text {
  font-size: 13px;
  line-height: 1.6;
  white-space: pre-wrap;
  color: var(--text-muted);
}

.media-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 12px;
}

.media-item {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--glass-border);
}

.editor-footer {
  padding: 5px 14px;
  border-top: 1px solid var(--glass-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.footer-right {
  display: flex;
  gap: 12px;
}

/* Shorten the footer/header control row at large OS scaling. The footer buttons get
   their own tighter padding and font-size (still >=11px, labels stay readable, no
   icon-only buttons) since the row has five of them and needs to be as short as
   possible; the header buttons keep the vertical-only trim they already had.
   .collapse-toggle-inline is excluded in the header so its own already-compact
   2px vertical padding (see the collapse-toggle rules below) isn't overridden
   by this higher-specificity selector. */
.editor-footer button {
  padding: 3px 10px;
  font-size: 11px;
  gap: 6px;
}

.editor-header button:not(.collapse-toggle-inline) {
  padding-top: 4px;
  padding-bottom: 4px;
}

@media (max-height: 900px) {
  .editor-header {
    padding: 8px 12px;
  }

  .editor-header h2 {
    font-size: 14px;
  }

  .editor-footer {
    padding: 3px 10px;
  }

  .editor-footer button {
    padding: 2px 8px;
  }
}

.hidden {
  display: none !important;
}

/* n8n Tab styles */
.n8n-layout {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.n8n-status-card {
  padding: 24px;
}

.n8n-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.n8n-badge {
  font-weight: 700;
  font-size: 16px;
  color: var(--primary);
}

.connection-status {
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.connection-status .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: var(--text-dark);
}

.connection-status.active .dot {
  background-color: var(--success);
  box-shadow: 0 0 6px var(--success);
}

.connection-status.inactive .dot {
  background-color: var(--danger);
  box-shadow: 0 0 6px var(--danger);
}

.n8n-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Modern Tables */
.table-responsive {
  width: 100%;
  overflow-x: auto;
}

.modern-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 13px;
}

.modern-table th {
  padding: 12px 16px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 1px solid var(--glass-border);
}

.modern-table td {
  padding: 16px;
  border-bottom: 1px solid var(--glass-border);
}

.table-loading {
  text-align: center;
  color: var(--text-dark);
  padding: 32px;
}

.workflow-status-badge {
  font-size: 10px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 12px;
  display: inline-block;
}

.workflow-status-badge.active {
  background-color: rgba(16, 185, 129, 0.15);
  color: var(--success);
}

.workflow-status-badge.inactive {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
}

/* Settings view */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.form-actions {
  margin-top: 24px;
  display: flex;
  justify-content: flex-end;
}

/* Toast Container */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 1000;
}

.toast {
  background-color: #1f2937;
  color: #fff;
  padding: 16px 24px;
  border-radius: var(--border-radius);
  border-left: 4px solid var(--primary);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease-out;
}

.toast.success { border-left-color: var(--success); }
.toast.error { border-left-color: var(--danger); }
.toast.warning { border-left-color: var(--warning); }

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

.gallery-card {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
  background: rgba(11, 20, 14, 0.4);
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), border-color 0.3s ease, box-shadow 0.3s ease;
}

/* No translateY here: the gallery now lives in a height-capped scroll wrapper and a
   lifted card would just clip against it. */
.gallery-card:hover {
  border-color: var(--primary);
  box-shadow: 0 8px 24px rgba(46, 204, 113, 0.2);
}

.gallery-item-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

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

.gallery-card-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(to top, rgba(6, 12, 8, 0.8) 0%, rgba(6, 12, 8, 0.1) 60%);
  opacity: 0;
  display: flex;
  justify-content: center;
  align-items: flex-end;
  padding: 12px;
  transition: opacity 0.3s ease;
}

.gallery-card:hover .gallery-card-overlay {
  opacity: 1;
}

.btn-gallery-action {
  background-color: var(--primary);
  color: #060c08;
  border: none;
  padding: 6px 12px;
  font-size: 11px;
  font-weight: 700;
  border-radius: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  transition: background-color 0.2s ease, transform 0.2s ease;
  box-shadow: 0 2px 8px rgba(46, 204, 113, 0.3);
}

.btn-gallery-action:hover {
  background-color: #27ae60;
  transform: scale(1.05);
}

/* Modal animation overrides */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Resize Handle split divider style */
.resize-handle {
  width: 12px;
  cursor: col-resize;
  background: transparent;
  position: relative;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
  flex-shrink: 0;
}

.resize-handle::after {
  content: "";
  width: 2px;
  height: 40px;
  background-color: var(--glass-border);
  border-radius: 1px;
  transition: background-color 0.2s, height 0.2s;
}

.resize-handle:hover::after, .resize-handle.active::after {
  background-color: var(--primary);
  height: 60px;
}

.resize-handle:hover {
  background: rgba(59, 130, 246, 0.05);
}

/* Thumbnail preview link style */
.editor-thumbnail-container {
  flex-shrink: 0;
}

.editor-thumbnail-container img {
  width: 120px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s, box-shadow 0.25s;
}

.editor-thumbnail-container img:hover {
  border-color: var(--primary);
  transform: scale(1.05);
  box-shadow: 0 4px 12px var(--primary-glow);
}

/* Category Tag Pills */
.category-tag-pill {
  display: inline-block;
  font-size: 10px;
  padding: 2px 7px;
  border-radius: 4px;
  font-weight: 700;
  color: #fff !important;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-left: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  background: var(--primary); /* default fallback */
  white-space: nowrap;
}

.category-tag-pill.luat-phap { background-color: #6366f1 !important; }
.category-tag-pill.giao-thong { background-color: #f59e0b !important; }
.category-tag-pill.thoi-tiet { background-color: #06b6d4 !important; }
.category-tag-pill.y-te { background-color: #10b981 !important; }
.category-tag-pill.cu-tru { background-color: #8b5cf6 !important; }
.category-tag-pill.doi-song { background-color: #ec4899 !important; }
.category-tag-pill.an-ninh { background-color: #ef4444 !important; }

/* Selected Categories Tags and Available Grid */
.category-tag-card {
  position: relative;
  display: flex;
  align-items: center;
  padding: 6px 12px;
  padding-right: 24px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  color: #fff !important;
  background-color: var(--primary);
  box-shadow: 0 2px 4px rgba(0,0,0,0.15);
  transition: all 0.2s ease;
  cursor: default;
  user-select: none;
}

.category-tag-card .remove-category-btn {
  position: absolute;
  top: 50%;
  right: 6px;
  transform: translateY(-50%);
  width: 14px;
  height: 14px;
  background: rgba(0,0,0,0.3);
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, background 0.2s ease;
}

.category-tag-card:hover .remove-category-btn {
  opacity: 1;
}

.category-tag-card .remove-category-btn:hover {
  background: rgba(239, 68, 68, 0.8);
}

.available-categories-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease;
  padding: 4px;
}

.available-categories-grid label:hover {
  color: #fff;
}

.available-categories-grid input[type="checkbox"] {
  cursor: pointer;
  accent-color: var(--primary);
  width: 14px;
  height: 14px;
}

/* Color Highlighted Category Tags */
.category-tag-card.tin_the_gioi_international { background-color: #3b82f6; }
.category-tag-card.tin_noi_bat_featured { background-color: #ef4444; }
.category-tag-card.tin_tuc_news { background-color: #10b981; }
.category-tag-card.tin_sec_czech_news { background-color: #8b5cf6; }
.category-tag-card.tin_nong_hot_news { background-color: #f97316; }
.category-tag-card.tin_viet_nam_vietnam_news { background-color: #06b6d4; }
.category-tag-card.thoi_su_current_events { background-color: #ec4899; }
.category-tag-card.kinh_te_economy { background-color: #f59e0b; }
.category-tag-card.kinh_te_sec_czech_economy { background-color: #14b8a6; }
.category-tag-card.giai_tri_entertainment { background-color: #6366f1; }
.category-tag-card.cong_dong_vietnamese_community { background-color: #a855f7; }
.category-tag-card.kinh_te_the_gioi_world_economy { background-color: #eab308; }
.category-tag-card.van_hoa_va_du_lich_culture_and_tourism { background-color: #22c55e; }
.category-tag-card.nguoi_viet_tai_sec_vietnamese_people_in_czech { background-color: #d946ef; }
.category-tag-card.nguoi_viet_5_chau_vietnamese_people_around_the_world { background-color: #f43f5e; }
.category-tag-card.kinh_te_viet_nam_vietnam_economy { background-color: #84cc16; }
.category-tag-card.doi_song_va_phap_luat_life_and_law { background-color: #64748b; }
.category-tag-card.star_stars_and_celebrities { background-color: #db2777; }
.category-tag-card.the_thao_sports { background-color: #2563eb; }
.category-tag-card.meo_vat_cuoc_song_life_tips { background-color: #059669; }
.category-tag-card.tamdamedia_v_cestine_tamdamedia_in_czech { background-color: #7c3aed; }
.category-tag-card.tu_vi_va_phong_thuy_horoscope_and_feng_shui { background-color: #d97706; }
.category-tag-card.v_cestine_in_czech { background-color: #4f46e5; }
.category-tag-card.am_thuc_food { background-color: #ea580c; }
.category-tag-card.zajimavosti_interesting_facts { background-color: #0d9488; }
.category-tag-card.vareni_s_tamdou_cooking_with_tamda { background-color: #be185d; }
.category-tag-card.bang_tin_cong_dong_community_news { background-color: #475569; }
.category-tag-card.cestovani_s_tamdou_travel_with_tamda { background-color: #15803d; }
.category-tag-card.vietnamske_tradice_a_zvyky_vietnamske_traditions_and_customs { background-color: #9333ea; }

/* Autocomplete Dropdown Styles */
.autocomplete-option {
  padding: 8px 12px;
  cursor: pointer;
  font-size: 13px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  color: var(--text-main);
  transition: background 0.15s;
}

.autocomplete-option:hover, .autocomplete-option.active {
  background-color: var(--primary);
  color: #fff;
}

.btn-meta-blue {
  background-color: #1877f2;
  color: #fff;
  border-color: #1877f2;
}

.btn-meta-blue:hover {
  background-color: #166fe5;
  border-color: #166fe5;
}

/* Album Gallery Thumbnails (Smaller + Hover Scale Pop-up) */
.media-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(85px, 1fr));
  gap: 10px;
  padding: 4px 0;
}

/* The gallery sits outside .editor-body, so without a cap it steals editor height
   one grid row at a time as the image count grows. */
#gallery-wrapper {
  /* vh-relative so a short window doesn't hand the gallery a fixed 200px out of an
     already cramped panel -- .editor-body is the only element that yields here. */
  max-height: min(200px, 25vh);
  overflow-y: auto;
  margin-top: 8px;
}

/* Shared collapsible section header (gallery, AI triage, raw HTML, categories). */
.collapse-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: rgba(255, 255, 255, 0.04);
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}

.collapse-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Inline variant for the meta row, where the toggle sits beside links. */
.collapse-toggle-inline {
  width: auto;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
}

.collapse-count {
  margin-left: auto;
  background: rgba(16, 185, 129, 0.18);
  color: var(--primary);
  border-radius: 10px;
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 700;
}

/* Remembered collapse preference. Kept separate from .hidden so per-article
   show/hide logic and the user's toggle never overwrite each other. */
.collapsed {
  display: none !important;
}

.gallery-image-thumb-card {
  position: relative;
  width: 100%;
  height: 85px;
  border-radius: 6px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  transition: transform 0.22s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.22s ease, border-color 0.2s ease;
}

.gallery-image-thumb-card:hover {
  transform: scale(1.22);
  z-index: 50;
  border-color: var(--primary);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.7);
}

.gallery-image-thumb-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Article Card Thumbnail Hover Spotlight trigger */
.card-thumbnail-container img, #web-cover-preview, #fb-image-preview {
  cursor: pointer;
  transition: transform 0.2s ease, filter 0.2s ease;
}

.card-thumbnail-container img:hover, #web-cover-preview:hover, #fb-image-preview:hover {
  transform: scale(1.05);
  filter: brightness(1.15);
}

/* Image Spotlight Lightbox Modal */
.image-spotlight-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.image-spotlight-backdrop.active {
  opacity: 1;
  pointer-events: auto;
}

.image-spotlight-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  transform: scale(0.95);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.image-spotlight-backdrop.active .image-spotlight-content {
  transform: scale(1);
}

.image-spotlight-close {
  position: absolute;
  top: -42px;
  right: 0;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #fff;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.image-spotlight-close:hover {
  background: rgba(239, 68, 68, 0.8);
  transform: scale(1.1);
}

.image-spotlight-img {
  max-width: 100%;
  max-height: 80vh;
  border-radius: 8px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.9);
  object-fit: contain;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.image-spotlight-caption {
  margin-top: 12px;
  color: #f1f5f9;
  font-size: 13px;
  text-align: center;
  max-width: 750px;
  background: rgba(15, 23, 42, 0.8);
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* CKEditor 5 Dark Theme Styling */
.ck.ck-editor {
  width: 100% !important;
}

.ck.ck-editor__main>.ck-editor__editable {
  background-color: rgba(17, 30, 22, 0.85) !important;
  color: #f1f5f9 !important;
  min-height: 280px !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  border-radius: 0 0 6px 6px !important;
  font-family: 'Inter', sans-serif !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
}

.ck.ck-editor__main>.ck-editor__editable:focus {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.15) !important;
}

/* CKEditor's own StickyPanelView never fires here -- it measures against the window
   viewport and Rect.getVisible() clips to .editor-body, so limiterRect.top is never
   negative. This CSS sticky is the real one; it only lands flush because .editor-body
   carries no padding (see the note there). */
.ck.ck-editor__top {
  position: sticky !important;
  top: 0 !important;
  z-index: 10 !important;
}

.ck.ck-toolbar {
  background-color: #111e16 !important;
  border-color: rgba(255, 255, 255, 0.12) !important;
  border-radius: 6px 6px 0 0 !important;
}

.ck.ck-toolbar .ck-button {
  color: #cbd5e1 !important;
}

.ck.ck-toolbar .ck-button:hover {
  background-color: rgba(255, 255, 255, 0.1) !important;
  color: #fff !important;
}

.ck.ck-toolbar .ck-button.ck-on {
  background-color: rgba(16, 185, 129, 0.25) !important;
  color: #10b981 !important;
}

.ck.ck-dropdown__panel {
  background-color: #111e16 !important;
  border-color: rgba(255, 255, 255, 0.15) !important;
}

.ck.ck-list__item .ck-button {
  color: #e2e8f0 !important;
}

.ck.ck-list__item .ck-button:hover {
  background-color: rgba(16, 185, 129, 0.2) !important;
}

/* Hide raw textarea element when CKEditor 5 is initialized */
#web-ckeditor-container textarea#web-ckeditor {
  display: none !important;
}

/* Frozen Bulk Actions Bar */
.bulk-actions-bar {
  position: sticky;
  top: 0;
  z-index: 15;
  background: rgba(15, 23, 42, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--glass-border);
  padding: 8px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}


/* Article Retention settings */
.retention-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
}

.retention-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 140px;
}

.retention-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
}

.retention-field .form-input {
  margin: 0;
}

.retention-switch {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  padding-bottom: 8px;
}

.retention-switch input {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--primary);
}

/* One tile per status, so each age limit is visibly tied to what it deletes. */
.retention-status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
  gap: 10px;
}

.retention-status-tile {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 8px 10px;
}

.retention-status-tile.is-default {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.07);
}

.retention-status-tile .tile-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.retention-status-tile .tile-name {
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.retention-status-tile .tile-count {
  font-size: 10.5px;
  color: var(--text-muted);
}

.retention-status-tile input {
  width: 70px;
  flex-shrink: 0;
  text-align: right;
  margin: 0;
}

.purge-status-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 108px;
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.02);
}

.purge-status-chip {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--glass-border);
  cursor: pointer;
  user-select: none;
}

.purge-status-chip input {
  accent-color: var(--primary);
  cursor: pointer;
  margin: 0;
}

.purge-status-chip.checked {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.15);
  color: var(--primary);
}

.retention-result {
  margin-top: 14px;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
  background: rgba(255, 255, 255, 0.03);
  font-size: 12.5px;
  line-height: 1.7;
}

.retention-result.is-danger {
  border-color: rgba(239, 68, 68, 0.4);
  background: rgba(239, 68, 68, 0.08);
}

.retention-result.is-success {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.08);
}

/* Translator glossary */
.autopush-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 0 0 12px;
  line-height: 1.55;
}

.autopush-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 10px;
}

.autopush-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
  border-radius: 6px;
  padding: 9px 11px;
}

/* On is the unusual state -- it is the one that sends without asking, so it is the one
   that has to be readable at a glance across a dozen sources. */
.autopush-row.is-on {
  border-color: rgba(6, 182, 212, 0.45);
  background: rgba(6, 182, 212, 0.08);
}

.autopush-row.is-disabled {
  opacity: 0.55;
}

.autopush-source {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.autopush-source .autopush-name {
  font-size: 12.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.autopush-source .autopush-state {
  font-size: 10.5px;
  color: var(--text-muted);
}

.autopush-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  margin: 0;
  cursor: pointer;
  accent-color: var(--primary);
}

.autopush-row.is-disabled input[type="checkbox"] {
  cursor: not-allowed;
}

.glossary-hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin: 4px 0 8px;
  line-height: 1.5;
}

.glossary-hint code {
  background: rgba(255, 255, 255, 0.06);
  border-radius: 3px;
  padding: 1px 5px;
  font-size: 11px;
}

.glossary-textarea {
  font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
  font-size: 12.5px;
  line-height: 1.6;
  resize: vertical;
}

.glossary-invalid {
  margin-top: 10px;
}

.glossary-invalid-title {
  font-weight: 600;
  color: var(--danger);
  display: flex;
  align-items: center;
  gap: 6px;
}

.glossary-invalid ul {
  margin: 8px 0 0;
  padding-left: 18px;
}

.glossary-invalid li {
  margin-bottom: 4px;
}

.glossary-invalid code {
  background: rgba(239, 68, 68, 0.12);
  border-radius: 3px;
  padding: 1px 6px;
  font-size: 12px;
}

/* Recycle bin */
.bin-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-top: 14px;
}

.bin-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition);
}

.bin-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.bin-item.selected {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.08);
}

.bin-item input[type="checkbox"] {
  accent-color: var(--primary);
  cursor: pointer;
  flex-shrink: 0;
}

.bin-item-main {
  flex: 1;
  min-width: 0;
}

.bin-item-title {
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bin-item-meta {
  font-size: 11px;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 3px;
}

/* Marks statuses that n8n polls, so restoring re-runs paid work or re-publishes. */
.bin-pipeline-flag {
  color: var(--warning);
  font-weight: 600;
}

.bin-countdown {
  font-size: 11px;
  font-weight: 600;
  flex-shrink: 0;
  text-align: right;
  min-width: 96px;
}

.bin-countdown.is-soon {
  color: var(--danger);
}

/* ---- Account menu (sidebar footer) */
.account-menu {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 12px;
}
.account-who {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
  min-width: 0;
}
.account-name {
  color: var(--text-main);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar.sidebar-collapsed .account-label,
.sidebar.sidebar-collapsed .account-name,
.sidebar.sidebar-collapsed #btn-sign-out span {
  display: none;
}

/* ---- Sign-in page (login.html) */
body.signin-page {
  overflow: auto;
  height: auto;
  min-height: 100vh;
}
.signin-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
}
.signin-card {
  width: 100%;
  max-width: 400px;
}
.signin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.signin-lang {
  display: flex;
  gap: 2px;
  padding: 2px;
  border-radius: 6px;
  border: 1px solid var(--glass-border);
}
.signin-lang .lang-toggle-btn {
  padding: 3px 6px;
  font-size: 10px;
  font-weight: 700;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
}
.signin-lang .lang-toggle-btn.active {
  background: var(--primary);
  color: #fff;
}
.signin-error {
  color: var(--danger);
  font-size: 13px;
  margin: 4px 0 12px;
}
.signin-submit {
  width: 100%;
  justify-content: center;
}

/* ---- Roles: Admin-only controls are hidden from Editors (the server refuses them anyway) */
body[data-role="editor"] .admin-only {
  display: none !important;
}

/* ---- Users page (js/users.js) and change-password page (password.html) */
#users-tab.active {
  display: flex;
  flex-direction: column;
  gap: 20px;
}
.users-add-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  align-items: end;
}
.users-add-form .form-group {
  margin-bottom: 0;
}
.users-hint,
.users-note {
  color: var(--text-muted);
  font-size: 12px;
}
.users-hint {
  margin-top: 12px;
}
.users-you {
  color: var(--text-muted);
  font-size: 12px;
}
.users-role-select {
  min-width: 140px;
}
.users-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.users-actions .users-danger {
  color: var(--danger);
}
.users-status-disabled {
  opacity: 0.7;
}
#btn-change-password {
  text-decoration: none;
  text-align: center;
}
.sidebar.sidebar-collapsed #btn-change-password span {
  display: none;
}
.password-note {
  color: var(--text-muted);
  font-size: 13px;
  margin-bottom: 12px;
}
.password-links {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
.password-links a {
  color: var(--primary);
  font-size: 13px;

/* ---- API keys page (#10, js/apiKeys.js). Admin only: hidden until "who am I" says admin. */
body:not([data-role="admin"]) .api-keys-admin-only {
  display: none !important;
}
.api-keys-hint {
  color: var(--text-muted);
  margin-bottom: 1rem;
}
.api-key-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1rem;
}
.api-key-form .form-group {
  margin-bottom: 0;
  min-width: 200px;
}
.api-key-secret-box {
  border: 1px solid var(--warning);
  background: rgba(245, 158, 11, 0.08);
  border-radius: var(--border-radius);
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
}
.api-key-secret-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-top: 0.5rem;
}
.api-key-secret-row .form-input {
  flex: 1;
  font-family: monospace;
}

/* Article history (#11, js/history.js) */
.history-attribution {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 16px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}
.history-attribution-label {
  font-weight: 600;
}
.history-list {
  list-style: none;
  margin: 0;
  padding: 0;
}
.history-entry {
  display: grid;
  grid-template-columns: minmax(110px, auto) 1fr auto;
  gap: 4px 12px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}
.history-time {
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.history-action {
  font-weight: 600;
}
.history-actor {
  overflow-wrap: anywhere;
}
.history-actor-deleted {
  color: var(--text-muted);
  font-style: italic;
}
.history-note {
  padding: 12px 0;
  color: var(--text-muted);
}
@media (max-width: 600px) {
  .history-entry {
    grid-template-columns: 1fr;
  }
}
