/* ============================================================
   CSS Custom Properties
   ============================================================ */
:root {
  --sidebar-w: 220px;
  --topbar-h: 60px;

  --color-bg:       #f0f2f8;
  --color-surface:  #ffffff;
  --color-border:   #e2e8f0;

  --color-sidebar-bg:     #1e2140;
  --color-sidebar-hover:  #2a2f56;
  --color-sidebar-active: #3b4278;
  --color-sidebar-text:   #8892b0;
  --color-sidebar-active-text: #ffffff;

  --color-primary:  #6366f1;
  --color-primary-hover: #4f46e5;
  --color-success:  #10b981;
  --color-warning:  #f59e0b;
  --color-danger:   #ef4444;
  --color-info:     #3b82f6;

  --color-text:       #1e293b;
  --color-text-muted: #64748b;

  --radius-sm: 4px;
  --radius-md: 8px;
  --radius-lg: 12px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
  --shadow-md: 0 4px 16px rgba(0,0,0,.10);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.14);

  --font-sans: 'Inter', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'Consolas', monospace;
}

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

html { font-size: 15px; }

body {
  font-family: var(--font-sans);
  background: var(--color-bg);
  color: var(--color-text);
  display: flex;
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--color-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
  font-family: var(--font-mono);
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: var(--radius-sm);
  font-size: .85em;
}

/* ============================================================
   Sidebar
   ============================================================ */
.sidebar {
  width: var(--sidebar-w);
  background: var(--color-sidebar-bg);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 20px 16px 18px;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
  border-bottom: 1px solid rgba(255,255,255,.07);
}

.sidebar-nav {
  flex: 1;
  padding: 12px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-radius: var(--radius-md);
  color: var(--color-sidebar-text);
  font-size: .875rem;
  font-weight: 500;
  margin-bottom: 2px;
  transition: background .15s, color .15s;
  text-decoration: none;
}
.nav-item svg { width: 18px; height: 18px; flex-shrink: 0; }
.nav-item:hover { background: var(--color-sidebar-hover); color: #c8d0e8; text-decoration: none; }
.nav-item.active { background: var(--color-sidebar-active); color: var(--color-sidebar-active-text); }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.07);
}
.version-badge {
  font-size: .75rem;
  color: var(--color-sidebar-text);
}

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

.topbar {
  height: var(--topbar-h);
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}
.topbar-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--color-text);
}
.topbar-actions { display: flex; gap: 8px; align-items: center; }

.page-body { padding: 24px; flex: 1; }

/* ============================================================
   Flash messages
   ============================================================ */
.flash-container { padding: 0 24px; }
.flash {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  margin-bottom: 8px;
  font-size: .875rem;
  font-weight: 500;
}
.flash-success { background: #d1fae5; color: #065f46; border: 1px solid #6ee7b7; }
.flash-error   { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }
.flash-warning { background: #fef3c7; color: #92400e; border: 1px solid #fcd34d; }
.flash-info    { background: #dbeafe; color: #1e40af; border: 1px solid #93c5fd; }
.flash-close { background: none; border: none; cursor: pointer; font-size: 1.1rem; opacity: .6; }
.flash-close:hover { opacity: 1; }

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
  gap: 8px;
}
.card-title {
  font-size: .95rem;
  font-weight: 700;
  color: var(--color-text);
}
.form-card { max-width: 760px; }
.mt-4 { margin-top: 16px; }
.mb-4 { margin-bottom: 16px; }
.p-4 { padding: 16px 20px; }
.border-top { border-top: 1px solid var(--color-border); }

/* ============================================================
   Stats grid
   ============================================================ */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 20px;
}
@media (max-width: 900px) { .stats-grid { grid-template-columns: repeat(2,1fr); } }

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 18px 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-md);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.stat-icon svg { width: 22px; height: 22px; color: #fff; }
.stat-icon-blue   { background: linear-gradient(135deg,#6366f1,#818cf8); }
.stat-icon-green  { background: linear-gradient(135deg,#10b981,#34d399); }
.stat-icon-yellow { background: linear-gradient(135deg,#f59e0b,#fbbf24); }
.stat-icon-red    { background: linear-gradient(135deg,#ef4444,#f87171); }

.stat-value { font-size: 1.6rem; font-weight: 800; line-height: 1.2; }
.stat-sub   { font-size: .9rem; font-weight: 400; color: var(--color-text-muted); }
.stat-label { font-size: .8rem; color: var(--color-text-muted); font-weight: 500; margin-top: 2px; }

/* ============================================================
   Two-col layout
   ============================================================ */
.two-col-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 960px) { .two-col-grid { grid-template-columns: 1fr; } }

/* ============================================================
   Tables
   ============================================================ */
.table-wrap { overflow-x: auto; }
.table {
  width: 100%;
  border-collapse: collapse;
  font-size: .875rem;
}
.table th {
  padding: 10px 16px;
  text-align: left;
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
  background: #f8fafc;
  border-bottom: 1px solid var(--color-border);
}
.table td {
  padding: 11px 16px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #f8fafc; }

.empty-row { color: var(--color-text-muted); text-align: center; padding: 32px !important; }
.td-title { max-width: 260px; }
.text-nowrap { white-space: nowrap; }
.log-message { max-width: 380px; word-break: break-word; }

/* Log row tinting */
.log-row-error td   { border-left: 3px solid var(--color-danger); }
.log-row-success td { border-left: 3px solid var(--color-success); }
.log-row-warning td { border-left: 3px solid var(--color-warning); }

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: uppercase;
}
.badge-sm { padding: 1px 7px; font-size: .68rem; }
.ml-1 { margin-left: 4px; }

.badge-published { background: #d1fae5; color: #065f46; }
.badge-draft     { background: #fef3c7; color: #92400e; }
.badge-failed    { background: #fee2e2; color: #991b1b; }
.badge-info      { background: #dbeafe; color: #1e40af; }
.badge-success   { background: #d1fae5; color: #065f46; }
.badge-error     { background: #fee2e2; color: #991b1b; }
.badge-warning   { background: #fef3c7; color: #92400e; }
.badge-category  { background: #ede9fe; color: #5b21b6; }
.badge-action    { background: #f1f5f9; color: #475569; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: var(--radius-md);
  font-size: .85rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, box-shadow .15s, opacity .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:hover { background: var(--color-primary-hover); }

.btn-ghost { background: transparent; border-color: var(--color-border); color: var(--color-text); }
.btn-ghost:hover { background: #f1f5f9; }

.btn-danger { background: var(--color-danger); color: #fff; border-color: var(--color-danger); }
.btn-danger:hover { background: #dc2626; }

.btn-sm  { padding: 5px 11px; font-size: .8rem; }
.btn-xs  { padding: 3px 8px; font-size: .75rem; }
.btn-lg  { padding: 10px 20px; font-size: .95rem; }

.action-group { display: flex; gap: 5px; flex-wrap: wrap; }

/* ============================================================
   Forms
   ============================================================ */
.form-section { padding: 20px 24px; border-bottom: 1px solid var(--color-border); }
.form-section:last-of-type { border-bottom: none; }
.section-title { font-size: .9rem; font-weight: 700; color: var(--color-text); margin-bottom: 14px; }

.form-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }
@media (max-width: 640px) {
  .form-grid-2, .form-grid-3 { grid-template-columns: 1fr; }
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-label { font-size: .82rem; font-weight: 600; color: var(--color-text); }
.form-hint  { font-size: .78rem; color: var(--color-text-muted); margin-top: 3px; }

.form-input, .form-select {
  padding: 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-family: var(--font-sans);
  background: #fff;
  color: var(--color-text);
  transition: border-color .15s, box-shadow .15s;
  width: 100%;
}
.form-input:focus, .form-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(99,102,241,.15);
}
.form-input::placeholder { color: #94a3b8; }
.w-auto { width: auto; }

.form-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  padding: 16px 24px;
  border-top: 1px solid var(--color-border);
}
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 12px; }
.mb-3 { margin-bottom: 12px; }

/* Toggle switch */
.toggle-label { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.toggle-input { display: none; }
.toggle-track {
  width: 38px; height: 21px;
  background: #cbd5e1;
  border-radius: 999px;
  position: relative;
  transition: background .2s;
  flex-shrink: 0;
}
.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px; left: 3px;
  width: 15px; height: 15px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.toggle-input:checked + .toggle-track { background: var(--color-primary); }
.toggle-input:checked + .toggle-track::after { transform: translateX(17px); }

/* ============================================================
   Activity feed
   ============================================================ */
.activity-feed { padding: 8px 0; max-height: 380px; overflow-y: auto; }
.activity-item {
  display: flex;
  gap: 12px;
  padding: 9px 20px;
  border-left: 2px solid transparent;
}
.activity-item.activity-success { border-color: var(--color-success); }
.activity-item.activity-error   { border-color: var(--color-danger); }
.activity-item.activity-warning { border-color: var(--color-warning); }
.activity-item.activity-info    { border-color: var(--color-info); }

.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-border);
  margin-top: 5px;
  flex-shrink: 0;
}
.activity-success .activity-dot { background: var(--color-success); }
.activity-error   .activity-dot { background: var(--color-danger); }
.activity-warning .activity-dot { background: var(--color-warning); }
.activity-info    .activity-dot { background: var(--color-info); }

.activity-msg  { font-size: .85rem; line-height: 1.4; }
.activity-meta { display: flex; gap: 8px; align-items: center; margin-top: 3px; }

.live-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--color-success);
  box-shadow: 0 0 0 3px rgba(16,185,129,.2);
  animation: pulse 2s infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(16,185,129,.2); }
  50% { box-shadow: 0 0 0 6px rgba(16,185,129,.05); }
}

/* ============================================================
   Trend grid
   ============================================================ */
.trend-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  padding: 16px 20px;
}
.trend-card {
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s, transform .1s;
}
.trend-card:hover {
  border-color: var(--color-primary);
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.trend-source { font-size: .7rem; font-weight: 600; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 5px; }
.trend-topic  { font-size: .9rem; font-weight: 600; line-height: 1.4; }
.trend-action { font-size: .75rem; color: var(--color-primary); margin-top: 6px; opacity: 0; transition: opacity .15s; }
.trend-card:hover .trend-action { opacity: 1; }
.trend-empty  { padding: 40px; text-align: center; color: var(--color-text-muted); grid-column: 1/-1; }
.trend-topic-preview {
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px;
  font-weight: 600;
}

.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ============================================================
   Tabs
   ============================================================ */
.tab-bar { display: flex; gap: 4px; margin-bottom: 16px; border-bottom: 2px solid var(--color-border); }
.tab-btn {
  padding: 8px 16px;
  border: none;
  background: none;
  font-size: .875rem;
  font-weight: 600;
  color: var(--color-text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.tab-btn:hover { color: var(--color-text); }
.tab-btn.active { color: var(--color-primary); border-bottom-color: var(--color-primary); }
.tab-panel.hidden { display: none; }

/* ============================================================
   Modals
   ============================================================ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
}
.modal {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 480px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
}
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.3rem; cursor: pointer; color: var(--color-text-muted); }
.modal-body  { padding: 20px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 20px; border-top: 1px solid var(--color-border); }
.modal-result { padding: 12px 16px; font-size: .875rem; line-height: 1.5; }
.result-success { background: #d1fae5; color: #065f46; }
.result-error   { background: #fee2e2; color: #991b1b; }

/* ============================================================
   Schedule page
   ============================================================ */
.schedule-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--color-border);
  flex-wrap: wrap;
}
.schedule-row:last-child { border-bottom: none; }
.schedule-form { grid-column: 1/-1; background: #f8fafc; border-top: 1px solid var(--color-border); padding: 16px 20px; }
.schedule-form.hidden { display: none; }
.schedule-account .fw-600 { font-weight: 600; }
.schedule-next { text-align: right; }

/* ============================================================
   Progress steps (generate page)
   ============================================================ */
.progress-section { margin-top: 20px; padding: 16px; background: #f8fafc; border-radius: var(--radius-md); }
.progress-step {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  color: var(--color-text-muted);
  font-size: .875rem;
}
.progress-step.active { color: var(--color-primary); font-weight: 600; }
.progress-step.done   { color: var(--color-success); }
.progress-step.error  { color: var(--color-danger); }
.step-dot {
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--color-border);
  flex-shrink: 0;
}
.progress-step.active .step-dot { background: var(--color-primary); animation: pulse 1.2s infinite; }
.progress-step.done .step-dot   { background: var(--color-success); }
.progress-step.error .step-dot  { background: var(--color-danger); }

/* ============================================================
   Info box
   ============================================================ */
.info-box {
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  overflow: hidden;
  margin-top: 10px;
}
.info-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 14px;
  font-size: .85rem;
  border-bottom: 1px solid var(--color-border);
}
.info-row:last-child { border-bottom: none; }
.info-row span { color: var(--color-text-muted); }

/* ============================================================
   Post detail
   ============================================================ */
.meta-list { padding: 4px 0; }
.meta-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 20px;
  font-size: .875rem;
  border-bottom: 1px solid var(--color-border);
  gap: 12px;
}
.meta-row:last-child { border-bottom: none; }
.meta-row > span:first-child { color: var(--color-text-muted); flex-shrink: 0; }

.post-thumb { width: 100%; border-radius: var(--radius-md); display: block; }
.post-content-preview { overflow-y: auto; max-height: 520px; line-height: 1.7; }
.post-content-preview h2 { font-size: 1.15rem; margin: 1.2em 0 .5em; }
.post-content-preview h3 { font-size: 1rem; margin: 1em 0 .4em; }
.post-content-preview p  { margin-bottom: .9em; }
.post-content-preview ul { padding-left: 1.4em; margin-bottom: .9em; }
.post-content-preview li { margin-bottom: .3em; }

.post-preview { padding: 0; }
.post-preview-meta { display: flex; gap: 6px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.post-preview-title { font-size: 1.05rem; font-weight: 700; line-height: 1.4; margin-bottom: 8px; }
.post-preview-summary { font-size: .875rem; color: var(--color-text-muted); margin-bottom: 12px; }
.post-preview-actions { display: flex; gap: 8px; }

/* ============================================================
   Toast notifications
   ============================================================ */
#toast-container {
  position: fixed;
  bottom: 20px; right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 500;
}
.toast {
  padding: 10px 18px;
  border-radius: var(--radius-md);
  font-size: .875rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  animation: slide-in .2s ease;
  min-width: 240px;
  max-width: 360px;
}
.toast-success { background: #065f46; color: #d1fae5; }
.toast-error   { background: #991b1b; color: #fee2e2; }
.toast-info    { background: #1e40af; color: #dbeafe; }
@keyframes slide-in { from { opacity:0; transform: translateX(20px); } to { opacity:1; transform:none; } }

/* ============================================================
   Spinners
   ============================================================ */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid rgba(99,102,241,.3);
  border-top-color: var(--color-primary);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
.spinner-sm {
  display: inline-block;
  width: 13px; height: 13px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   Misc utilities
   ============================================================ */
.hidden { display: none !important; }
.text-muted  { color: var(--color-text-muted); }
.text-sm     { font-size: .82rem; }
.text-mono   { font-family: var(--font-mono); }
.text-danger { color: var(--color-danger); }
.fw-600      { font-weight: 600; }
.link-primary { color: var(--color-primary); font-weight: 500; }
.link-muted   { color: var(--color-text-muted); font-size: .82rem; }
.account-name { font-weight: 600; }
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px;
  border-top: 1px solid var(--color-border);
}

/* ============================================================
   Category chip grid (account form)
   ============================================================ */
.category-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}
.category-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  border: 1.5px solid var(--color-border);
  background: #fff;
  font-size: .82rem;
  font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, background .15s, color .15s;
  user-select: none;
}
.category-chip input[type="checkbox"] { display: none; }
.category-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.category-chip.selected {
  border-color: var(--color-primary);
  background: #eef2ff;
  color: var(--color-primary);
  font-weight: 600;
}
.badge-xs { padding: 1px 6px; font-size: .65rem; }
.section-hint {
  font-size: .78rem;
  font-weight: 400;
  color: var(--color-text-muted);
  margin-left: 8px;
}

/* ============================================================
   Language selector (account form)
   ============================================================ */
.lang-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 4px;
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 16px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: #fff;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  user-select: none;
  min-width: 160px;
}
.lang-option input[type="radio"] { display: none; }
.lang-option:hover { border-color: var(--color-primary); }
.lang-option.selected {
  border-color: var(--color-primary);
  background: #eef2ff;
}
.lang-flag  { font-size: 1.3rem; line-height: 1; }
.lang-label { font-size: .85rem; font-weight: 500; }

/* ============================================================
   Flexible schedule builder
   ============================================================ */
.schedule-row {
  display: grid;
  grid-template-columns: 1.8fr 1.6fr 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-bottom: 1px solid var(--color-border);
}
.schedule-row:last-child { border-bottom: none; }

.schedule-summary { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }

.schedule-form {
  grid-column: 1 / -1;
  background: #f8fafc;
  border-top: 1px solid var(--color-border);
  padding: 20px;
  margin: 0 -20px;
}
.schedule-form.hidden { display: none; }

/* Day-of-week chips */
.dow-grid {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.dow-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 36px;
  border-radius: var(--radius-md);
  border: 1.5px solid var(--color-border);
  background: #fff;
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all .15s;
  user-select: none;
}
.dow-chip input[type="checkbox"] { display: none; }
.dow-chip:hover { border-color: var(--color-primary); color: var(--color-primary); }
.dow-chip.selected {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: #fff;
}

/* Inline field row (label + input side by side) */
.inline-fields {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.inline-fields .form-label { margin: 0; white-space: nowrap; }
.w-80  { width: 80px; }
.w-auto { width: auto; }

/* Times list for daily schedule */
.times-list { display: flex; flex-direction: column; gap: 6px; margin-top: 4px; }
.time-row   { display: flex; align-items: center; gap: 8px; }

/* Cron examples */
.cron-reference { font-size: .78rem; color: var(--color-text-muted); }
.cron-eg {
  cursor: pointer;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: .78rem;
  margin: 0 2px;
}
.cron-eg:hover { background: #e0e7ff; color: var(--color-primary); }

/* sfield hidden by default — JS reveals per type */
.sfield { margin-top: 12px; }

/* Categories column in accounts table */
.cats-list { display: flex; flex-wrap: wrap; gap: 3px; }
