/* ============================================================
   SMM Agents Console — Design System
   ============================================================ */

:root {
  --bg-base: #0a0e17;
  --bg-surface: #0f1520;
  --bg-surface2: #141c2b;
  --bg-surface3: #1a2435;
  --bg-elevated: #1e2a3e;
  --bg-hover: #222f44;
  --bg-input: #0c1119;

  --border: #1e2a3e;
  --border2: #2a3a52;
  --border-focus: #3b82f6;

  --text: #e8edf5;
  --text2: #b0bdd0;
  --text3: #7a8ba3;
  --text-inverse: #0a0e17;

  --accent: #3b82f6;
  --accent-hover: #2563eb;
  --accent-subtle: rgba(59, 130, 246, 0.12);
  --accent-border: rgba(59, 130, 246, 0.3);

  --green: #22c55e;
  --green-subtle: rgba(34, 197, 94, 0.1);
  --green-border: rgba(34, 197, 94, 0.25);

  --yellow: #eab308;
  --yellow-subtle: rgba(234, 179, 8, 0.1);
  --yellow-border: rgba(234, 179, 8, 0.25);

  --red: #ef4444;
  --red-subtle: rgba(239, 68, 68, 0.1);
  --red-border: rgba(239, 68, 68, 0.25);

  --orange: #f97316;
  --purple: #a855f7;
  --cyan: #06b6d4;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;

  --shadow-sm: 0 1px 3px rgba(0,0,0,.2);
  --shadow: 0 4px 16px rgba(0,0,0,.25);
  --shadow-lg: 0 12px 40px rgba(0,0,0,.35);

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', 'Cascadia Code', Consolas, monospace;

  --sidebar-w: 300px;
  --topbar-h: 52px;
}

*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--text);
  background:
    radial-gradient(ellipse at 20% 0%, rgba(59,130,246,.06), transparent 50%),
    radial-gradient(ellipse at 80% 100%, rgba(168,85,247,.04), transparent 50%),
    var(--bg-base);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  min-height: 100vh;
}

h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; }
p { margin: 0; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============================================================
   Topbar
   ============================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(10, 14, 23, 0.85);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 20px;
  min-width: 0;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  flex-shrink: 0;
}

.logo-text {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: -0.02em;
}

.topbar-meta {
  font-size: 12px;
  color: var(--text3);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.health-dots {
  display: flex;
  align-items: center;
  gap: 6px;
}

.health-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: background 0.3s;
}

.health-dot.healthy { background: var(--green); box-shadow: 0 0 6px rgba(34,197,94,.4); }
.health-dot.warning { background: var(--yellow); box-shadow: 0 0 6px rgba(234,179,8,.4); }
.health-dot.error { background: var(--red); box-shadow: 0 0 6px rgba(239,68,68,.4); animation: pulse-dot 2s infinite; }
.health-dot.info { background: var(--text3); }

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.mode-toggle {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 2px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface2);
}

.mode-toggle-btn {
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--text3);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  padding: 6px 9px;
}

.mode-toggle-btn:hover {
  color: var(--text2);
  background: var(--bg-hover);
}

.mode-toggle-btn.active {
  color: white;
  background: var(--accent);
}

/* ============================================================
   Layout
   ============================================================ */

.app-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: calc(100vh - var(--topbar-h));
}

/* ============================================================
   Sidebar
   ============================================================ */

.sidebar {
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  height: calc(100vh - var(--topbar-h));
  position: sticky;
  top: var(--topbar-h);
  display: flex;
  flex-direction: column;
}

.sidebar-section {
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.sidebar-section:last-child {
  border-bottom: none;
  margin-top: auto;
}

.sidebar-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text3);
  margin-bottom: 10px;
}

/* Aggregate strip */
.agg-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.agg-item {
  text-align: center;
  padding: 10px 4px;
  border-radius: var(--radius);
  background: var(--bg-surface2);
  border: 1px solid var(--border);
}

.agg-value {
  font-size: 20px;
  font-weight: 700;
  line-height: 1.2;
}

.agg-label {
  font-size: 10px;
  color: var(--text3);
  margin-top: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Channel nav */
.channel-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.ch-card {
  display: block;
  padding: 12px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
  background: transparent;
}

.ch-card:hover {
  background: var(--bg-surface2);
  border-color: var(--border);
}

.ch-card.active {
  background: var(--accent-subtle);
  border-color: var(--accent-border);
}

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

.ch-card-name {
  min-width: 0;
  font-weight: 600;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-card-badges {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-width: 0;
}

.ch-card-badges .badge {
  max-width: 104px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ch-state-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface2);
  color: var(--text3);
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
  line-height: 1;
}

.ch-state-enabled {
  color: var(--green);
  background: var(--green-subtle);
  border-color: var(--green-border);
}

.ch-state-paused {
  color: var(--yellow);
  background: var(--yellow-subtle);
  border-color: var(--yellow-border);
}

.ch-state-off {
  color: var(--text3);
  background: var(--bg-input);
  border-color: var(--border);
}

.ch-card-meta {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  flex-direction: column;
  gap: 2px;
}

/* System info */
.system-info {
  font-size: 11.5px;
  color: var(--text3);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.system-info .sys-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.system-info .sys-val {
  color: var(--text2);
  font-family: var(--font-mono);
  font-size: 11px;
}

/* ============================================================
   Status badges
   ============================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid;
  line-height: 1.3;
}

.badge-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}

.badge-posted        { color: var(--green);  background: var(--green-subtle);  border-color: var(--green-border); }
.badge-posted .badge-dot { background: var(--green); }

.badge-completed     { color: var(--text3);  background: var(--bg-surface2);   border-color: var(--border); }
.badge-completed .badge-dot { background: var(--text3); }

.badge-posted_warning { color: var(--yellow); background: var(--yellow-subtle); border-color: var(--yellow-border); }
.badge-posted_warning .badge-dot { background: var(--yellow); }

.badge-research_only { color: var(--cyan);   background: rgba(6,182,212,.1);   border-color: rgba(6,182,212,.25); }
.badge-research_only .badge-dot { background: var(--cyan); }

.badge-maintenance   { color: var(--purple); background: rgba(168,85,247,.1);  border-color: rgba(168,85,247,.25); }
.badge-maintenance .badge-dot { background: var(--purple); }

.badge-running       { color: var(--accent); background: var(--accent-subtle); border-color: var(--accent-border); }
.badge-running .badge-dot { background: var(--accent); animation: pulse-dot 1.5s infinite; }

.badge-locked        { color: var(--orange); background: rgba(249,115,22,.1);  border-color: rgba(249,115,22,.25); }
.badge-locked .badge-dot { background: var(--orange); }

.badge-error         { color: var(--red);    background: var(--red-subtle);    border-color: var(--red-border); }
.badge-error .badge-dot { background: var(--red); }

.badge-timeout       { color: var(--red);    background: var(--red-subtle);    border-color: var(--red-border); }
.badge-timeout .badge-dot { background: var(--red); }

.badge-no_post       { color: var(--orange); background: rgba(249,115,22,.1); border-color: rgba(249,115,22,.25); }
.badge-no_post .badge-dot { background: var(--orange); }

.badge-unknown       { color: var(--yellow); background: var(--yellow-subtle); border-color: var(--yellow-border); }
.badge-unknown .badge-dot { background: var(--yellow); }

.badge-no_data       { color: var(--text3);  background: var(--bg-surface2);   border-color: var(--border); }
.badge-no_data .badge-dot { background: var(--text3); }

/* Health badge */
.badge-healthy       { color: var(--green);  background: var(--green-subtle);  border-color: var(--green-border); }
.badge-warning       { color: var(--yellow); background: var(--yellow-subtle); border-color: var(--yellow-border); }
.badge-info          { color: var(--text3);  background: var(--bg-surface2);   border-color: var(--border); }

/* ============================================================
   Empty state
   ============================================================ */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 60vh;
  color: var(--text3);
  text-align: center;
  padding: 40px;
}

.empty-icon { color: var(--border2); margin-bottom: 16px; }
.empty-title { font-size: 18px; font-weight: 600; color: var(--text2); margin-bottom: 8px; }
.empty-desc { font-size: 13px; max-width: 360px; line-height: 1.6; }

.empty-inline {
  padding: 20px;
  border: 1px dashed var(--border2);
  border-radius: var(--radius);
  color: var(--text3);
  font-size: 13px;
  text-align: center;
}

/* ============================================================
   Main content area
   ============================================================ */

.main-content {
  padding: 24px;
  min-width: 0;
  overflow-x: hidden;
}

.channel-detail {
  display: grid;
  gap: 20px;
}

/* ============================================================
   Hero section
   ============================================================ */

.hero {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: start;
  padding: 20px;
  border-radius: var(--radius-xl);
  background: linear-gradient(135deg, var(--accent-subtle), rgba(59,130,246,.03) 40%, var(--bg-surface2));
  border: 1px solid var(--accent-border);
}

.hero-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  font-size: 12.5px;
  color: var(--text3);
}

.hero-meta-item {
  display: flex;
  align-items: center;
  gap: 5px;
}

.hero-meta-item svg {
  opacity: 0.5;
  flex-shrink: 0;
}

.hero-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.hero-log-name {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
}

/* ============================================================
   Action toolbar
   ============================================================ */

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

/* ============================================================
   Buttons
   ============================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border: 1px solid var(--border2);
  border-radius: var(--radius);
  background: var(--bg-surface2);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
  line-height: 1.3;
}

.btn:hover { background: var(--bg-hover); border-color: var(--border2); }
.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger {
  color: var(--red);
  border-color: var(--red-border);
  background: var(--red-subtle);
}

.btn-danger:hover { background: rgba(239,68,68,.15); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
}

.btn-ghost:hover { background: var(--bg-surface2); border-color: var(--border); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

.btn svg { flex-shrink: 0; }

/* ============================================================
   Metrics grid
   ============================================================ */

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 10px;
}

.metric-card {
  padding: 14px;
  border-radius: var(--radius);
  background: var(--bg-surface2);
  border: 1px solid var(--border);
}

.metric-label {
  font-size: 11px;
  color: var(--text3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
}

.metric-sub {
  font-size: 11px;
  color: var(--text3);
  margin-top: 4px;
}

/* ============================================================
   Sections / Cards
   ============================================================ */

.section {
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface2);
}

.section-title {
  font-size: 13.5px;
  font-weight: 600;
}

.section-meta {
  font-size: 11px;
  color: var(--text3);
}

.section-body {
  padding: 16px 18px;
}

.section-body-flush {
  padding: 0;
}

/* Two-column grid for sections */
.section-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.section-grid > * { min-width: 0; }

/* ============================================================
   Feed items (posts, usage, timeline)
   ============================================================ */

.feed {
  display: flex;
  flex-direction: column;
  max-height: 480px;
  overflow-y: auto;
}

.feed-item {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}

.feed-item:last-child { border-bottom: none; }
.feed-item:hover { background: var(--bg-surface2); }

.feed-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 4px;
}

.feed-title {
  font-weight: 600;
  font-size: 12.5px;
}

.feed-body {
  font-size: 12.5px;
  color: var(--text2);
  line-height: 1.55;
  overflow-wrap: anywhere;
}

.feed-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 500;
  background: var(--bg-surface3);
  border: 1px solid var(--border);
  color: var(--text3);
  white-space: nowrap;
}

/* ============================================================
   Timeline
   ============================================================ */

.timeline-scroll {
  max-height: 500px;
  overflow-y: auto;
}

.tl-item {
  display: grid;
  grid-template-columns: 56px 20px 1fr;
  gap: 0 10px;
  padding: 6px 18px;
  font-size: 12.5px;
  align-items: start;
}

.tl-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text3);
  text-align: right;
  padding-top: 2px;
}

.tl-indicator {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 5px;
}

.tl-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--border2);
  flex-shrink: 0;
}

.tl-dot.tool_call  { background: var(--accent); }
.tl-dot.tool_result { background: var(--green); }
.tl-dot.assistant   { background: var(--purple); }
.tl-dot.error       { background: var(--red); }
.tl-dot.system      { background: var(--cyan); }
.tl-dot.turn        { background: var(--text3); }

.tl-content {
  min-width: 0;
}

.tl-label {
  font-weight: 500;
  color: var(--text2);
}

.tl-detail {
  font-size: 11.5px;
  color: var(--text3);
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  max-height: 60px;
  overflow: hidden;
  transition: max-height 0.2s;
}

.tl-detail.expanded {
  max-height: none;
}

.tl-item:hover .tl-detail {
  max-height: none;
}

.tl-filter-btn.active {
  background: var(--accent-subtle);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* ============================================================
   Log viewer
   ============================================================ */

.section-header-wrap {
  flex-wrap: wrap;
  gap: 8px 12px;
}

.log-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.log-frame {
  border-radius: var(--radius);
  background: var(--bg-input);
  border: 1px solid var(--border);
  overflow: hidden;
}

.log-text {
  margin: 0;
  padding: 14px 16px;
  max-height: 500px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.6;
  color: var(--text2);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  tab-size: 4;
}

.log-search-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.log-search-bar input {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  width: 180px;
}

.log-search-bar input:focus {
  outline: none;
  border-color: var(--accent);
}

.log-search-info {
  font-size: 11px;
  color: var(--text3);
}

mark.log-highlight {
  background: rgba(234, 179, 8, 0.3);
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
}

/* ============================================================
   File editor
   ============================================================ */

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

.file-tab {
  padding: 5px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: transparent;
  color: var(--text3);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.file-tab:hover { background: var(--bg-surface2); color: var(--text2); }
.file-tab.active { background: var(--accent-subtle); color: var(--accent); border-color: var(--accent-border); }

.file-editor {
  width: 100%;
  min-height: 320px;
  max-height: 600px;
  resize: vertical;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-input);
  color: var(--text2);
  padding: 14px 16px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.55;
  tab-size: 2;
}

.file-editor:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

/* File description bar */
.file-desc-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

.file-desc-text {
  font-size: 12px;
  color: var(--text3);
  line-height: 1.4;
}

.file-mode-toggle {
  display: flex;
  gap: 2px;
  background: var(--bg-surface2);
  border-radius: var(--radius-sm);
  padding: 2px;
  flex-shrink: 0;
}

.file-mode-toggle .btn.active {
  background: var(--accent-subtle);
  border-color: var(--accent-border);
  color: var(--accent);
}

/* File status badges on tabs */
.file-tab-status {
  display: inline-block;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 1px 5px;
  border-radius: 999px;
  margin-left: 5px;
  vertical-align: middle;
}

.file-tab-status-empty {
  background: var(--red-subtle);
  color: var(--red);
  border: 1px solid var(--red-border);
}

.file-tab-status-template {
  background: var(--yellow-subtle);
  color: var(--yellow);
  border: 1px solid var(--yellow-border);
}

.file-tab-status-minimal {
  background: rgba(6,182,212,.1);
  color: var(--cyan);
  border: 1px solid rgba(6,182,212,.25);
}

/* File guidance banner */
.file-guidance {
  padding: 10px 18px;
  font-size: 12.5px;
  line-height: 1.5;
  border-bottom: 1px solid var(--border);
}

.file-guidance-empty {
  background: var(--red-subtle);
  color: var(--red);
  border-left: 3px solid var(--red);
}

.file-guidance-template {
  background: var(--yellow-subtle);
  color: var(--yellow);
  border-left: 3px solid var(--yellow);
}

/* Markdown preview */
.file-preview {
  padding: 18px;
  min-height: 200px;
  max-height: 600px;
  overflow-y: auto;
  line-height: 1.6;
  color: var(--text2);
}

.md-h1 { font-size: 20px; font-weight: 700; color: var(--text); margin: 16px 0 8px; padding-bottom: 6px; border-bottom: 1px solid var(--border); }
.md-h2 { font-size: 16px; font-weight: 600; color: var(--text); margin: 14px 0 6px; }
.md-h3 { font-size: 14px; font-weight: 600; color: var(--text2); margin: 12px 0 4px; }
.md-h4 { font-size: 13px; font-weight: 600; color: var(--text2); margin: 10px 0 4px; }

.md-p { margin: 4px 0; font-size: 13.5px; }

.md-list { margin: 4px 0 8px 8px; padding-left: 16px; }
.md-list li { margin: 2px 0; font-size: 13.5px; }

.md-code {
  display: block;
  margin: 8px 0;
  padding: 12px 14px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.55;
  overflow-x: auto;
  color: var(--text2);
  white-space: pre-wrap;
}

.md-code code { background: none; padding: 0; }

.md-inline-code {
  background: var(--bg-surface3);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 12px;
}

.md-url {
  word-break: break-all;
}

.md-spacer { height: 8px; }

.md-empty {
  color: var(--text3);
  font-style: italic;
  padding: 20px 0;
}

/* JSON syntax highlighting */
.json-key { color: var(--accent); }
.json-str { color: var(--green); }
.json-num { color: var(--orange); }
.json-bool { color: var(--purple); }

/* ============================================================
   Select / inputs
   ============================================================ */

select {
  padding: 5px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-surface2);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  cursor: pointer;
}

select:focus { outline: none; border-color: var(--accent); }

label.toggle-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text3);
  cursor: pointer;
  user-select: none;
}

label.toggle-label input[type="checkbox"] {
  accent-color: var(--accent);
  width: 14px;
  height: 14px;
}

/* ============================================================
   Toast notifications
   ============================================================ */

.toast-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 200;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  max-width: 420px;
  padding: 10px 16px;
  border-radius: var(--radius);
  background: var(--bg-elevated);
  border: 1px solid var(--border2);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  color: var(--text);
  animation: toast-in 0.25s ease;
}

.toast.success { border-color: var(--green-border); }
.toast.error { border-color: var(--red-border); color: var(--red); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ============================================================
   Mobile sidebar
   ============================================================ */

.mobile-menu-btn {
  display: none;
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 150;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  color: white;
  cursor: pointer;
  box-shadow: var(--shadow-lg);
  align-items: center;
  justify-content: center;
}

/* ============================================================
   Health issues list
   ============================================================ */

.health-issues {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.health-issue {
  font-size: 12px;
  color: var(--text3);
  padding: 4px 8px;
  background: var(--bg-surface2);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--yellow);
}

.health-issue.error-issue {
  border-left-color: var(--red);
}

/* ============================================================
   Scrollbar
   ============================================================ */

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

/* ============================================================
   Responsive
   ============================================================ */

@media (max-width: 1100px) {
  .section-grid { grid-template-columns: 1fr; }
  .simple-actions { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 860px) {
  :root { --sidebar-w: 260px; }
  .main-content { padding: 16px; }
  .hero { grid-template-columns: 1fr; }
  .hero-right { align-items: flex-start; flex-direction: row; gap: 12px; }
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .simple-hero { grid-template-columns: 1fr; }
  .simple-next-run { min-height: auto; }
}

@media (max-width: 680px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 90;
    transform: translateX(-100%);
    transition: transform 0.25s ease;
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: var(--shadow-lg);
  }

  .mobile-menu-btn { display: flex; }

  .main-content { padding: 14px; }

  .topbar-meta { display: none; }

  .metrics { grid-template-columns: repeat(2, 1fr); }
  .simple-grid { grid-template-columns: 1fr; }

  .hero-title { font-size: 20px; }
}

/* ============================================================
   Loading & overlays
   ============================================================ */

.btn.loading {
  pointer-events: none;
  opacity: 0.7;
}

.btn.loading::after {
  content: '';
  width: 12px;
  height: 12px;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  margin-left: 4px;
}

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

.confirm-overlay {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: rgba(0,0,0,.5);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: fade-in 0.15s ease;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.confirm-dialog {
  background: var(--bg-elevated);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  padding: 24px;
  max-width: 380px;
  width: 90%;
  box-shadow: var(--shadow-lg);
}

.confirm-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 8px;
}

.confirm-body {
  font-size: 13px;
  color: var(--text2);
  margin-bottom: 20px;
  line-height: 1.5;
}

.confirm-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
}

.channel-wizard {
  max-width: 760px;
  width: min(760px, 94vw);
}

.wizard-steps {
  display: flex;
  gap: 8px;
  margin: 12px 0 18px;
}

.wizard-step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-surface2);
  color: var(--text3);
  font-size: 12px;
  font-weight: 800;
}

.wizard-step.active {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
}

.wizard-actions {
  align-items: center;
  margin-top: 16px;
}

.wizard-spacer {
  flex: 1;
}

/* ============================================================
   Topics display
   ============================================================ */

.topics-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 8px;
}

.topic-tag {
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  background: var(--bg-surface3);
  border: 1px solid var(--border);
  color: var(--text3);
}

/* ============================================================
   Status detail banner
   ============================================================ */

.status-detail-banner {
  padding: 10px 16px;
  border-radius: var(--radius);
  font-size: 12.5px;
  line-height: 1.5;
  border-left: 3px solid var(--text3);
  background: var(--bg-surface2);
  color: var(--text2);
}

.status-detail-banner.status-detail-posted {
  border-left-color: var(--green);
  background: var(--green-subtle);
}

.status-detail-banner.status-detail-posted_warning {
  border-left-color: var(--yellow);
  background: var(--yellow-subtle);
}

.status-detail-banner.status-detail-no_post {
  border-left-color: var(--orange);
  background: rgba(249,115,22,.08);
}

.status-detail-banner.status-detail-error,
.status-detail-banner.status-detail-timeout {
  border-left-color: var(--red);
  background: var(--red-subtle);
}

.status-detail-banner.status-detail-completed {
  border-left-color: var(--green);
  background: var(--green-subtle);
}

.status-detail-banner.status-detail-research_only {
  border-left-color: var(--cyan);
  background: rgba(6,182,212,.08);
}

.status-detail-banner.status-detail-maintenance {
  border-left-color: var(--purple);
  background: rgba(168,85,247,.08);
}

/* ============================================================
   Simple mode
   ============================================================ */

.simple-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 260px;
  gap: 18px;
  align-items: stretch;
  padding: 22px;
  border-radius: var(--radius-lg);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.simple-hero-healthy { border-color: var(--green-border); }
.simple-hero-warning { border-color: var(--yellow-border); }
.simple-hero-error { border-color: var(--red-border); }
.simple-hero-info { border-color: rgba(6,182,212,.25); }

.simple-eyebrow {
  color: var(--text3);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .08em;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.simple-title {
  color: var(--text);
  font-size: 30px;
  font-weight: 750;
  line-height: 1.1;
  margin-bottom: 14px;
}

.simple-status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
  align-items: center;
  color: var(--text2);
  font-size: 13px;
}

.simple-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.simple-status-pill span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  color: var(--text-inverse);
  font-size: 11px;
  line-height: 1;
}

.simple-status-healthy { color: var(--green); background: var(--green-subtle); border-color: var(--green-border); }
.simple-status-healthy span { background: var(--green); }
.simple-status-warning { color: var(--yellow); background: var(--yellow-subtle); border-color: var(--yellow-border); }
.simple-status-warning span { background: var(--yellow); }
.simple-status-error { color: var(--red); background: var(--red-subtle); border-color: var(--red-border); }
.simple-status-error span { background: var(--red); color: white; }
.simple-status-info { color: var(--cyan); background: rgba(6,182,212,.08); border-color: rgba(6,182,212,.25); }
.simple-status-info span { background: var(--cyan); }

.simple-next-run {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  min-height: 120px;
  padding: 18px;
  border-radius: var(--radius);
  background: var(--bg-surface2);
  border: 1px solid var(--border);
}

.simple-next-run span,
.simple-next-run small,
.simple-muted {
  color: var(--text3);
  font-size: 12px;
}

.simple-next-run strong {
  color: var(--text);
  font-size: 24px;
  line-height: 1.15;
}

.simple-alert {
  padding: 14px 16px;
  border-radius: var(--radius);
  background: var(--bg-surface2);
  border: 1px solid var(--border);
}

.simple-alert-warning { border-color: var(--yellow-border); background: var(--yellow-subtle); }
.simple-alert-error { border-color: var(--red-border); background: var(--red-subtle); }
.simple-alert-info { border-color: rgba(6,182,212,.25); background: rgba(6,182,212,.08); }

.simple-alert-title {
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 8px;
}

.simple-alert-list {
  display: grid;
  gap: 6px;
  color: var(--text2);
  font-size: 12.5px;
}

.simple-actions {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.simple-action {
  display: flex;
  align-items: center;
  gap: 11px;
  min-height: 72px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-surface);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  text-align: left;
  transition: background .15s, border-color .15s, transform .15s;
}

.simple-action:hover {
  background: var(--bg-surface2);
  border-color: var(--border2);
}

.simple-action:active {
  transform: translateY(1px);
}

.simple-action-primary {
  background: var(--accent-subtle);
  border-color: var(--accent-border);
}

.simple-action-danger {
  background: var(--red-subtle);
  border-color: var(--red-border);
}

.simple-action-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface3);
  color: var(--accent);
  flex: 0 0 auto;
  font-weight: 800;
}

.simple-action b {
  display: block;
  font-size: 13.5px;
  margin-bottom: 2px;
}

.simple-action small {
  color: var(--text3);
  display: block;
  font-size: 11.5px;
  line-height: 1.35;
}

.simple-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.simple-panel {
  min-width: 0;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--bg-surface);
  border: 1px solid var(--border);
}

.simple-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--text2);
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 12px;
}

.simple-big {
  color: var(--text);
  font-size: 24px;
  font-weight: 750;
  line-height: 1.15;
  margin-bottom: 4px;
}

.simple-note {
  color: var(--text2);
  font-size: 12px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

.simple-post-preview {
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  margin-bottom: 10px;
  overflow-wrap: anywhere;
}

.simple-schedule {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.simple-post-list {
  display: grid;
}

.simple-post-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  width: 100%;
  padding: 14px 18px;
  border: 0;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}

.simple-post-row:last-child {
  border-bottom: 0;
}

.simple-post-row:hover {
  background: var(--bg-surface2);
}

.simple-post-thumb {
  width: 62px;
  height: 48px;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--bg-surface3);
}

.simple-post-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.simple-post-main {
  min-width: 0;
}

.simple-post-title {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.simple-post-meta {
  color: var(--text3);
  display: block;
  font-size: 11.5px;
  margin-top: 3px;
}

/* Channel card detail (sidebar) */
.ch-card-detail {
  font-size: 10.5px;
  color: var(--text3);
  margin: 2px 0 4px;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ============================================================
   Photo previews in feed
   ============================================================ */

.feed-item-photo {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 12px;
  align-items: start;
}

.feed-thumb {
  width: 72px;
  height: 54px;
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--bg-surface3);
  flex-shrink: 0;
}

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

.feed-content {
  min-width: 0;
}

/* ============================================================
   Post modal — Telegram preview
   ============================================================ */

.post-modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border2);
  border-radius: var(--radius-lg);
  max-width: 520px;
  width: 92%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.post-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface2);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}

.post-modal-close {
  font-size: 16px;
  line-height: 1;
  padding: 4px 8px;
}

.post-modal-photo {
  width: 100%;
  max-height: 300px;
  overflow: hidden;
  background: var(--bg-surface3);
}

.post-modal-photo img {
  width: 100%;
  height: auto;
  max-height: 300px;
  object-fit: cover;
  display: block;
}

.post-modal-body {
  padding: 18px;
}

.post-modal-meta {
  padding: 10px 18px;
  font-size: 11px;
  color: var(--text3);
  border-top: 1px solid var(--border);
  background: var(--bg-surface2);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* Telegram HTML preview styles */
.tg-preview {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text);
  word-wrap: break-word;
}

.tg-preview strong { font-weight: 600; }
.tg-preview em { font-style: italic; }

.tg-preview .tg-code {
  background: var(--bg-surface3);
  padding: 1px 5px;
  border-radius: 3px;
  font-family: var(--font-mono);
  font-size: 13px;
}

.tg-preview .tg-pre {
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  font-family: var(--font-mono);
  font-size: 12px;
  overflow-x: auto;
  margin: 8px 0;
}

.tg-preview .tg-link {
  color: var(--accent);
  text-decoration: none;
}

.tg-preview .tg-link:hover { text-decoration: underline; }

.feed-item-clickable { cursor: pointer; }
.feed-item-clickable:hover { background: var(--bg-hover); }

/* ============================================================
   Log syntax highlighting
   ============================================================ */

.log-turn       { color: var(--text3); font-weight: 500; }
.log-tool-call  { color: var(--accent); }
.log-tool-result { color: var(--text3); }
.log-tool-ok    { color: var(--green); }
.log-tool-err   { color: var(--red); }
.log-error      { color: var(--red); font-weight: 600; background: var(--red-subtle); display: inline-block; width: 100%; padding: 0 4px; border-radius: 2px; }
.log-assistant  { color: var(--purple); }
.log-system     { color: var(--cyan); }
.log-header     { color: var(--text3); font-weight: 600; }

/* Log + Timeline side-by-side */
.log-timeline-grid {
  grid-template-columns: 1fr 1fr;
}

.log-timeline-grid .log-frame { }
.log-timeline-grid .log-text { max-height: 600px; }
.log-timeline-grid .timeline-scroll { max-height: 600px; }

.log-controls-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 18px;
  border-bottom: 1px solid var(--border);
  background: var(--bg-surface);
}

@media (max-width: 1100px) {
  .log-timeline-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   Add channel form
   ============================================================ */

.add-channel-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 12px;
}

.form-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-row-2col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.form-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text2);
}

.form-hint {
  font-weight: 400;
  color: var(--text3);
  font-size: 11px;
}

.form-input {
  padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-input);
  color: var(--text);
  font: inherit;
  font-size: 13px;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-subtle);
}

.form-note {
  font-size: 11px;
  color: var(--text3);
  line-height: 1.5;
  padding: 8px 10px;
  background: var(--bg-surface3);
  border-radius: var(--radius-sm);
}

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

.draft-textarea {
  min-height: 240px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
}

.draft-small-textarea {
  min-height: 170px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.45;
}

.draft-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.draft-summary div {
  min-width: 0;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface2);
}

.draft-summary b {
  display: block;
  color: var(--text);
  font-size: 16px;
  margin-bottom: 3px;
  overflow-wrap: anywhere;
}

.draft-summary span {
  color: var(--text3);
  font-size: 11px;
}

/* Add channel card in nav */
.ch-card-add {
  border: 1px dashed var(--border2);
  opacity: 0.7;
  transition: opacity 0.15s;
}

.ch-card-add:hover {
  opacity: 1;
  border-color: var(--accent-border);
  background: var(--accent-subtle);
}

/* ============================================================
   Keyboard shortcut hints
   ============================================================ */

.kbd {
  display: inline-block;
  padding: 1px 5px;
  border: 1px solid var(--border2);
  border-radius: 4px;
  background: var(--bg-surface3);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--text3);
  line-height: 1.4;
}

/* ============================================================
   Schedule editor
   ============================================================ */

.simple-weekly .section-body {
  display: grid;
  gap: 14px;
}

.weekly-controls {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.weekly-day-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.weekly-legacy-note {
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--yellow-border);
  background: var(--yellow-subtle);
  color: var(--text2);
  font-size: 12px;
  line-height: 1.45;
}

.weekly-day {
  min-width: 0;
  padding: 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-surface2);
}

.weekly-day-active {
  border-color: var(--accent-border);
  background: var(--accent-subtle);
}

.weekly-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 12px;
}

.weekly-day-head strong {
  color: var(--text);
  font-size: 13px;
}

.weekly-day-head span {
  color: var(--text3);
  font-size: 11px;
}

.weekly-run-buttons {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 4px;
}

.weekly-run-btn {
  height: 28px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-input);
  color: var(--text2);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.weekly-run-btn:hover,
.weekly-run-btn.active {
  color: var(--text);
  border-color: var(--accent-border);
  background: var(--bg-surface3);
}

.weekly-run-btn.active {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.weekly-day-times {
  min-height: 30px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 4px;
  margin-top: 8px;
}

.weekly-day-times span {
  color: var(--text3);
  font-size: 10.5px;
  font-family: var(--font-mono);
}

.sched-simple {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sched-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sched-label {
  font-size: 11px;
  color: var(--text3);
  font-weight: 500;
}

.sched-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sched-current {
  margin-bottom: 6px;
}

.sched-current-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text2);
  margin-bottom: 8px;
  display: block;
}

.sched-divider {
  border-top: 1px solid var(--border);
  margin: 12px 0;
}

.sched-time {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-family: var(--font-mono);
  font-weight: 500;
  background: var(--accent-subtle);
  border: 1px solid var(--accent-border);
  color: var(--accent);
}

.sched-time-new {
  background: var(--bg-surface3);
  border-color: var(--border2);
  color: var(--text3);
}

.sched-preview-new {
  margin-top: 8px;
}

/* ============================================================
   Settings page
   ============================================================ */

.settings-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.setting-row {
  display: grid;
  grid-template-columns: 1fr 280px;
  gap: 12px;
  align-items: center;
  padding: 6px 0;
}

.setting-info {
  min-width: 0;
}

.setting-label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.setting-desc {
  font-size: 11.5px;
  color: var(--text3);
  margin-top: 1px;
}

.setting-input {
  width: 100%;
}

.token-input {
  font-family: var(--font-mono);
  font-size: 12px;
}

@media (max-width: 680px) {
  .setting-row {
    grid-template-columns: 1fr;
    gap: 4px;
  }
  .draft-summary { grid-template-columns: 1fr; }
  .channel-wizard { width: 94vw; padding: 18px; }
  .wizard-actions { flex-wrap: wrap; }
}

@media (max-width: 1100px) {
  .weekly-day-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  .weekly-day-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .weekly-controls { align-items: stretch; }
  .weekly-controls .sched-field,
  .weekly-controls .btn { width: 100%; }
}

/* ============================================================
   Login screen
   ============================================================ */

.login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background:
    radial-gradient(ellipse at 30% 20%, rgba(59,130,246,.08), transparent 50%),
    radial-gradient(ellipse at 70% 80%, rgba(168,85,247,.06), transparent 50%),
    var(--bg-base);
}

.login-card {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  padding: 40px 36px;
  width: 360px;
  max-width: 92vw;
  box-shadow: var(--shadow-lg);
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-bottom: 28px;
  color: var(--text);
  font-size: 20px;
  font-weight: 700;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.login-form .form-input {
  padding: 10px 14px;
  font-size: 14px;
}

.login-btn {
  padding: 10px;
  font-size: 14px;
  margin-top: 4px;
}

.login-error {
  font-size: 13px;
  color: var(--red);
  text-align: center;
  min-height: 18px;
}

/* User menu in topbar */
.user-menu {
  display: flex;
  align-items: center;
  gap: 6px;
  padding-left: 8px;
  border-left: 1px solid var(--border);
  margin-left: 4px;
}

.user-name {
  font-size: 12px;
  color: var(--text2);
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Language toggle */
.lang-toggle {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  min-width: 32px;
}

/* ============================================================
   Responsive continued
   ============================================================ */

@media (max-width: 480px) {
  .metrics { grid-template-columns: 1fr; }
  .agg-strip { grid-template-columns: 1fr; }
  .topbar-right { gap: 6px; }
  .health-dots { display: none; }
  .mode-toggle-btn { padding: 6px 7px; font-size: 11px; }
  .simple-actions { grid-template-columns: 1fr; }
  .simple-title { font-size: 24px; }
  .simple-hero { padding: 18px; }
}
