/* dnial.shk Dashboard — Warp-inspired Design System */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #080807;
  --surface: #111110;
  --surface2: #1a1a19;
  --parchment: #f5f4f1;
  --ash: #a5a4a2;
  --stone: #7a7978;
  --purple-gray: #5c5a5f;
  --earth: #2c2c2b;
  --earth-hover: #3a3a39;
  --charcoal: #353534;
  --border: rgba(200, 200, 198, 0.18);
  --border-subtle: rgba(200, 200, 198, 0.08);
  --border-hover: rgba(200, 200, 198, 0.3);
  --frosted: rgba(255, 255, 255, 0.03);
  --frosted-btn: rgba(255, 255, 255, 0.08);
  --green: #4ade80;
  --green-dim: rgba(74, 222, 128, 0.12);
  --yellow: #fbbf24;
  --yellow-dim: rgba(251, 191, 36, 0.12);
  --red: #f87171;
  --red-dim: rgba(248, 113, 113, 0.1);
  --purple: #a78bfa;
  --purple-dim: rgba(167, 139, 250, 0.12);
  --blue: #60a5fa;
  --blue-dim: rgba(96, 165, 250, 0.12);
  --radius: 14px;
  --radius-sm: 8px;
  --radius-pill: 50px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, 'Courier New', monospace;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="light"] {
  --bg: #f5f2ec;
  --surface: #ffffff;
  --surface2: #efeae0;
  --parchment: #1e1b17;
  --ash: #5a5854;
  --stone: #88857f;
  --purple-gray: #6e6c70;
  --earth: #e4dfd2;
  --earth-hover: #d5cfbd;
  --charcoal: #c7c0ab;
  --border: rgba(30, 25, 20, 0.22);
  --border-subtle: rgba(30, 25, 20, 0.08);
  --border-hover: rgba(30, 25, 20, 0.38);
  --frosted: rgba(0, 0, 0, 0.03);
  --frosted-btn: rgba(0, 0, 0, 0.06);
  --green-dim: rgba(34, 158, 75, 0.18);
  --yellow-dim: rgba(202, 138, 4, 0.18);
  --red-dim: rgba(220, 38, 38, 0.15);
  --purple-dim: rgba(139, 92, 246, 0.18);
  --blue-dim: rgba(37, 99, 235, 0.18);
  --green: #16a34a;
  --yellow: #ca8a04;
  --red: #dc2626;
  --purple: #8b5cf6;
  --blue: #2563eb;
}

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

body {
  background: var(--bg);
  color: var(--parchment);
  font-family: var(--font);
  font-size: 14px;
  font-weight: 400;
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

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

/* ─── Auth gate ─── */
#expired {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; text-align: center;
}

.expired-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem 3rem;
  max-width: 400px;
  animation: fadeIn 0.4s ease-out;
}

.expired-icon { margin-bottom: 1.25rem; opacity: 0.5; }
.expired-box h2 { color: var(--red); margin-bottom: 0.5rem; font-size: 1.1rem; font-weight: 600; }
.expired-box p { color: var(--stone); font-size: 0.875rem; }
.expired-box code { background: var(--earth); padding: 0.15rem 0.5rem; border-radius: var(--radius-sm); font-size: 0.8rem; color: var(--ash); font-family: var(--font-mono); }
.expired-box a { display: inline-block; margin-top: 0.75rem; padding: 0.6rem 1.75rem; background: var(--earth); color: var(--parchment); border-radius: var(--radius-pill); text-decoration: none; font-weight: 500; font-size: 0.875rem; border: 1px solid var(--border); transition: all var(--transition); }
.expired-box a:hover { background: var(--earth-hover); border-color: var(--border-hover); }

/* ─── Dashboard ─── */
#dashboard {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1.25rem 3rem;
  animation: fadeIn 0.3s ease-out;
}

/* ─── Header ─── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 1.25rem 0;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.75rem;
}

.header-left { display: flex; align-items: center; gap: 0.875rem; }

.header-brand {
  font-size: 1.2rem; font-weight: 700; color: var(--parchment);
  letter-spacing: -0.03em;
}

.header-logo { color: var(--ash); }
.header-divider { width: 1px; height: 1.25rem; background: var(--border); }
.header-subtitle { font-size: 0.75rem; color: var(--stone); font-weight: 400; letter-spacing: 1.4px; text-transform: uppercase; }

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

.session-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 6px rgba(74, 222, 128, 0.4);
}

.header-meta { font-size: 0.75rem; color: var(--stone); }

/* ─── Tabs ─── */
.tabs {
  display: flex; gap: 2px;
  margin-bottom: 1.75rem;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 3px;
  border: 1px solid var(--border-subtle);
}

.tab-btn {
  flex: 1; background: transparent; border: none;
  color: var(--stone);
  padding: 0.6rem 1rem;
  border-radius: calc(var(--radius) - 3px);
  cursor: pointer;
  font-size: 0.8125rem; font-weight: 500; font-family: var(--font);
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
}

.tab-icon { flex-shrink: 0; opacity: 0.5; transition: opacity var(--transition); }
.tab-btn:hover { color: var(--parchment); background: var(--frosted); }
.tab-btn:hover .tab-icon { opacity: 0.8; }
.tab-btn.active { background: var(--earth); color: var(--parchment); }
.tab-btn.active .tab-icon { opacity: 1; }

.tab-panel { display: none; }
.tab-panel.active { display: block; animation: fadeIn 0.2s ease-out; }

/* ─── Buttons ─── */
.btn {
  display: inline-flex; align-items: center; gap: 0.4rem;
  padding: 0.5rem 1.1rem;
  border-radius: var(--radius-pill);
  border: none; cursor: pointer;
  font-size: 0.8125rem; font-weight: 500; font-family: var(--font);
  transition: all var(--transition);
  white-space: nowrap;
}

.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }

.btn-primary { background: var(--earth); color: var(--parchment); border: 1px solid var(--border); }
.btn-primary:hover:not(:disabled) { background: var(--earth-hover); border-color: var(--border-hover); }

.btn-success { background: var(--green-dim); color: var(--green); border: 1px solid rgba(74, 222, 128, 0.2); }
.btn-success:hover:not(:disabled) { background: rgba(74, 222, 128, 0.18); }

.btn-warning { background: var(--yellow-dim); color: var(--yellow); border: 1px solid rgba(251, 191, 36, 0.2); }
.btn-warning:hover:not(:disabled) { background: rgba(251, 191, 36, 0.18); }

.btn-purple { background: var(--purple-dim); color: var(--purple); border: 1px solid rgba(167, 139, 250, 0.2); }
.btn-purple:hover:not(:disabled) { background: rgba(167, 139, 250, 0.18); }

.btn-danger { background: transparent; color: var(--red); border: 1px solid var(--red-dim); }
.btn-danger:hover:not(:disabled) { background: var(--red-dim); }

.btn-ghost { background: transparent; color: var(--stone); border: 1px solid var(--border-subtle); }
.btn-ghost:hover:not(:disabled) { color: var(--parchment); border-color: var(--border); background: var(--frosted); }

.btn-sm { padding: 0.35rem 0.8rem; font-size: 0.75rem; }

/* ─── Section header ─── */
.section-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; flex-wrap: wrap; gap: 0.5rem; }

.section-title {
  font-size: 0.7rem; font-weight: 600; color: var(--stone);
  text-transform: uppercase; letter-spacing: 1.6px;
}

/* ─── Inputs ─── */
textarea, input[type="text"], input[type="number"], input[type="password"] {
  background: var(--bg);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--parchment);
  padding: 0.6rem 0.75rem;
  font-size: 0.8125rem;
  font-family: var(--font);
  outline: none;
  transition: border-color var(--transition);
}

textarea { width: 100%; resize: vertical; font-family: var(--font-mono); }
textarea:focus, input:focus { border-color: var(--border-hover); }
textarea::placeholder, input::placeholder { color: var(--purple-gray); }

.url-input-area { margin-bottom: 1.25rem; }
.url-actions { display: flex; gap: 0.5rem; margin-top: 0.5rem; flex-wrap: wrap; }

.input-label { font-size: 0.7rem; font-weight: 600; color: var(--stone); text-transform: uppercase; letter-spacing: 1.4px; margin-bottom: 0.5rem; }

/* ─── Table ─── */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border-subtle); }
table { width: 100%; border-collapse: collapse; min-width: 600px; }
thead { background: var(--surface); }
th { padding: 0.625rem 0.875rem; text-align: left; font-size: 0.7rem; font-weight: 600; color: var(--stone); text-transform: uppercase; letter-spacing: 1.2px; border-bottom: 1px solid var(--border-subtle); }
td { padding: 0.625rem 0.875rem; border-bottom: 1px solid var(--border-subtle); vertical-align: middle; color: var(--ash); }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--frosted); }

.td-link { color: var(--ash); text-decoration: none; font-family: var(--font-mono); font-size: 0.75rem; }
.td-link:hover { color: var(--parchment); text-decoration: underline; }
.td-actions { display: flex; gap: 0.375rem; flex-wrap: wrap; }

.remarks-input {
  width: 100%; min-width: 100px;
  background: transparent; border: 1px solid transparent;
  border-radius: var(--radius-sm); color: var(--parchment);
  padding: 0.25rem 0.375rem; font-size: 0.8125rem;
  transition: all var(--transition);
}
.remarks-input:hover { border-color: var(--border-subtle); }
.remarks-input:focus { border-color: var(--border-hover); background: var(--surface); outline: none; }

/* ─── Badges ─── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-pill);
  font-size: 0.65rem; font-weight: 600;
  letter-spacing: 0.8px; text-transform: uppercase;
}

.badge-pending  { background: var(--frosted-btn); color: var(--stone); }
.badge-scraped  { background: var(--yellow-dim); color: var(--yellow); }
.badge-manual   { background: var(--yellow-dim); color: var(--yellow); }
.badge-approved { background: var(--green-dim); color: var(--green); }
.badge-draft    { background: var(--frosted-btn); color: var(--ash); }
.badge-queued   { background: var(--purple-dim); color: var(--purple); }
.badge-posted   { background: var(--green-dim); color: var(--green); }

/* ─── Post cards ─── */
.posts-grid { display: flex; flex-direction: column; gap: 1rem; }

.post-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--transition);
}
.post-card:hover { border-color: var(--border); }

.post-card-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-subtle);
  flex-wrap: wrap; gap: 0.5rem;
}

.post-card-product { font-size: 0.8125rem; font-weight: 500; color: var(--parchment); }
.post-card-price { font-size: 0.75rem; color: var(--stone); margin-left: 0.375rem; }
.post-card-meta-right { display: flex; align-items: center; gap: 0.5rem; }

.post-block { padding: 0.75rem 1rem; border-left: 3px solid transparent; }
.post-block + .post-block { border-top: 1px solid var(--border-subtle); }
.post-block-purple { border-left-color: var(--purple); }
.post-block-yellow { border-left-color: var(--yellow); }

.post-block-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--stone); margin-bottom: 0.375rem; }
.post-block-purple .post-block-label { color: var(--purple); }
.post-block-yellow .post-block-label { color: var(--yellow); }

.post-block-text { font-size: 0.8125rem; line-height: 1.6; color: var(--ash); white-space: pre-wrap; word-break: break-word; }

.post-card-actions {
  display: flex; gap: 0.375rem;
  padding: 0.625rem 1rem;
  border-top: 1px solid var(--border-subtle);
  background: var(--frosted);
  flex-wrap: wrap;
}

/* ─── Stats ─── */
.stat-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.75rem; margin-bottom: 1.5rem; }

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1rem;
  text-align: center;
  transition: border-color var(--transition);
}
.stat-card:hover { border-color: var(--border); }

.stat-card-label { font-size: 0.65rem; font-weight: 600; text-transform: uppercase; letter-spacing: 1.4px; color: var(--stone); margin-bottom: 0.5rem; }
.stat-card-value { font-size: 1.5rem; font-weight: 700; line-height: 1; }

.stat-card-green .stat-card-value { color: var(--green); }
.stat-card-purple .stat-card-value { color: var(--purple); }
.stat-card-yellow .stat-card-value { color: var(--yellow); }
.stat-card-text .stat-card-value { color: var(--parchment); }
.stat-card-blue .stat-card-value { color: var(--blue, #60a5fa); }

/* ─── Ratio control ─── */
.ratio-control {
  display: flex; align-items: center; gap: 0.75rem;
  margin-bottom: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 0.75rem 1rem;
}
.ratio-control label { font-size: 0.8125rem; color: var(--stone); white-space: nowrap; }
.ratio-control input { width: 70px; }

/* ─── Queue list ─── */
.queue-list { display: flex; flex-direction: column; gap: 0.5rem; }

.queue-item {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex; align-items: flex-start; gap: 1rem;
  transition: border-color var(--transition);
}
.queue-item:hover { border-color: var(--border); }

.queue-item-order { font-size: 0.7rem; font-weight: 600; color: var(--stone); width: 1.5rem; flex-shrink: 0; margin-top: 0.125rem; }
.queue-item-content { flex: 1; min-width: 0; }
.queue-item-text { font-size: 0.8125rem; color: var(--ash); overflow: hidden; text-overflow: ellipsis; }
.queue-item-meta { font-size: 0.65rem; color: var(--stone); margin-top: 0.25rem; }
.queue-item-actions { display: flex; gap: 0.375rem; flex-shrink: 0; align-items: center; }

/* ─── Library ─── */
.library-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.library-count { font-size: 0.8125rem; color: var(--stone); }
.library-list { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }

.library-item {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  display: flex; gap: 0.75rem; align-items: flex-start;
  transition: border-color var(--transition);
}
.library-item:hover { border-color: var(--border); }

.library-item-num { font-size: 0.65rem; color: var(--stone); width: 1.5rem; flex-shrink: 0; padding-top: 0.125rem; font-family: var(--font-mono); }
.library-item-body { flex: 1; min-width: 0; }
.library-item-category {
  display: inline-block; font-size: 0.6rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 1.2px;
  color: var(--ash); background: var(--frosted-btn);
  padding: 0.1rem 0.5rem; border-radius: var(--radius-pill);
  margin-bottom: 0.375rem;
}
.library-item-text { font-size: 0.8125rem; color: var(--ash); line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.library-item-actions { display: flex; gap: 0.375rem; flex-shrink: 0; align-items: flex-start; padding-top: 0.125rem; }

/* ─── Pagination ─── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 0.5rem; }
.pagination-info { font-size: 0.75rem; color: var(--stone); }

/* ─── States ─── */
.empty-state { text-align: center; padding: 3rem 1rem; color: var(--stone); }
.empty-state p { font-size: 0.875rem; }

.loading { text-align: center; padding: 2rem; color: var(--stone); font-size: 0.875rem; }
.spinner {
  display: inline-block; width: 14px; height: 14px;
  border: 2px solid var(--border); border-top-color: var(--ash);
  border-radius: 50%; animation: spin 0.7s linear infinite;
  margin-right: 0.5rem; vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Toast ─── */
#toast {
  position: fixed; bottom: 1.5rem; left: 50%;
  transform: translateX(-50%) translateY(2rem);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  padding: 0.6rem 1.25rem;
  font-size: 0.8125rem; color: var(--parchment);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  opacity: 0; transition: all 0.25s ease;
  pointer-events: none; white-space: nowrap; z-index: 9999;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
#toast.toast-success { border-color: rgba(74, 222, 128, 0.3); color: var(--green); }
#toast.toast-error { border-color: rgba(248, 113, 113, 0.3); color: var(--red); }
#toast.toast-info { border-color: var(--border); color: var(--ash); }

/* ─── Product cards (mobile) ─── */
.product-cards { display: none; flex-direction: column; gap: 0.75rem; }

.product-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  padding: 1rem;
  transition: border-color var(--transition);
}
.product-card:hover { border-color: var(--border); }

.product-card-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 0.5rem; margin-bottom: 0.5rem; }
.product-card-name { font-size: 0.875rem; font-weight: 500; color: var(--parchment); flex: 1; min-width: 0; word-break: break-word; }
.product-card-link { display: block; font-family: var(--font-mono); font-size: 0.7rem; color: var(--stone); text-decoration: none; margin-bottom: 0.5rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.product-card-link:hover { color: var(--ash); }

.product-card-remarks {
  width: 100%; background: var(--bg); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); color: var(--parchment);
  padding: 0.4rem 0.625rem; font-size: 0.8125rem;
  margin-bottom: 0.625rem; outline: none;
}
.product-card-remarks:focus { border-color: var(--border-hover); }
.product-card-footer { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.product-card-actions { display: flex; gap: 0.375rem; flex-wrap: wrap; }

/* ─── Highlight (manual entry) ─── */
.input-highlight { border-color: rgba(251, 191, 36, 0.4) !important; background: rgba(251, 191, 36, 0.05) !important; }

/* ─── Touch targets ─── */
@media (pointer: coarse) {
  .btn { min-height: 38px; padding: 0.5rem 1.1rem; }
  .btn-sm { min-height: 34px; padding: 0.4rem 0.85rem; }
  .tab-btn { padding: 0.7rem 1rem; }
}

/* ─── Mobile ─── */
@media (max-width: 640px) {
  body { font-size: 15px; }
  #dashboard { padding: 0 0.75rem 2rem; }
  .header { flex-direction: column; align-items: flex-start; gap: 0.25rem; padding: 0.75rem 0; margin-bottom: 1rem; }
  .tabs { flex-wrap: wrap; gap: 2px; }
  .tab-btn { flex: none; width: calc(50% - 2px); padding: 0.65rem 0.5rem; }
  .stat-cards { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
  .stat-card { padding: 0.75rem; }
  .stat-card-value { font-size: 1.25rem; }
  .url-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
  .url-actions .btn { justify-content: center; }
  .table-wrap { display: none; }
  .product-cards { display: flex; }
  .post-card-meta { flex-direction: column; align-items: flex-start; }
  .post-card-actions .btn { flex: 1; justify-content: center; }
  .post-block { padding: 0.625rem 0.75rem; }
  .queue-item { flex-wrap: wrap; }
  .queue-item-text { white-space: normal; }
  .queue-item-actions { width: 100%; justify-content: flex-end; margin-top: 0.25rem; }
  .library-item { flex-wrap: wrap; }
  .library-item-actions { width: 100%; justify-content: flex-end; margin-top: 0.25rem; }
  .ratio-control { flex-wrap: wrap; }
  .pagination { gap: 0.375rem; }
  .rj-stats-row { grid-template-columns: repeat(2, 1fr); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .login-box { padding: 2rem 1.5rem; max-width: 100%; margin: 1rem; }
  .modal { width: 95%; padding: 1.25rem; }
}

@media (min-width: 641px) {
  .product-cards { display: none; }
}

/* ─── Library tags ─── */
.library-tags {
  display: flex; gap: 0.375rem; flex-wrap: wrap;
  margin-bottom: 1rem;
}

.tag-btn {
  background: var(--frosted-btn); color: var(--stone);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-pill);
  padding: 0.3rem 0.75rem; font-size: 0.75rem; font-weight: 500;
  font-family: var(--font); cursor: pointer;
  transition: all var(--transition);
}
.tag-btn:hover { color: var(--parchment); border-color: var(--border); }
.tag-active { background: var(--earth); color: var(--parchment); border-color: var(--border); }
.tag-count { opacity: 0.5; font-size: 0.65rem; margin-left: 0.125rem; }

/* ─── Paste buttons ─── */
.textarea-wrap { position: relative; }
.textarea-wrap textarea { padding-right: 2.5rem; }
.textarea-icon {
  position: absolute; top: 0.5rem; right: 0.5rem;
  background: var(--earth); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 0.35rem;
  color: var(--ash); cursor: pointer;
  transition: all var(--transition);
  display: flex; align-items: center; justify-content: center;
}
.textarea-icon:hover { color: var(--parchment); border-color: var(--border-hover); }

.input-with-paste { display: flex; align-items: center; gap: 0.25rem; }
.input-with-paste input { flex: 1; min-width: 0; }
.paste-btn {
  background: none; border: none; color: var(--stone);
  cursor: pointer; padding: 0.2rem; flex-shrink: 0;
  opacity: 0; transition: opacity var(--transition);
  display: flex; align-items: center;
}
.input-with-paste:hover .paste-btn { opacity: 1; }
.paste-btn:hover { color: var(--parchment); }

@media (pointer: coarse) {
  .paste-btn { opacity: 0.6; }
}

/* ─── Ebook Tab ──────────────────────────────────────────────── */

.ebook-list { display: flex; flex-direction: column; gap: 0.75rem; }

.ebook-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 1rem;
  transition: border-color 0.15s;
}
.ebook-card:hover { border-color: var(--border); }
.ebook-card.ebook-used { opacity: 0.55; }

.ebook-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.ebook-card-header > div { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

.ebook-book-tag, .ebook-funnel-tag {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 0.15rem 0.5rem;
  border-radius: 20px;
  background: var(--surface2);
  color: var(--stone);
}
.ebook-funnel-tag { color: var(--purple); background: rgba(139, 92, 246, 0.1); }

.ebook-meta { font-size: 0.75rem; color: var(--ash); }

.ebook-chain { display: flex; flex-direction: column; gap: 0.4rem; }

.ebook-chain-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.8rem;
  line-height: 1.5;
}

.chain-num {
  flex-shrink: 0;
  width: 1.4rem;
  height: 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--surface2);
  color: var(--ash);
  font-size: 0.65rem;
  font-weight: 600;
  margin-top: 0.1rem;
}

.chain-text { color: var(--parchment); }

.ebook-card-footer { margin-top: 0.75rem; display: flex; justify-content: flex-end; }

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
}
.stats-row .stat-card {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.75rem;
  text-align: center;
}
.stats-row .stat-value { font-size: 1.25rem; font-weight: 700; color: var(--parchment); }
.stats-row .stat-label { font-size: 0.65rem; text-transform: uppercase; letter-spacing: 1px; color: var(--stone); margin-top: 0.25rem; }

/* ─── Account Switcher ─── */
.account-switcher {
  display: flex;
  gap: 4px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 3px;
  border: 1px solid var(--border-subtle);
  margin-bottom: 1rem;
}

.account-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--stone);
  padding: 0.55rem 1rem;
  border-radius: calc(var(--radius) - 3px);
  cursor: pointer;
  font-size: 0.8125rem;
  font-weight: 600;
  font-family: var(--font);
  transition: all var(--transition);
}

.account-btn:hover { color: var(--parchment); background: var(--frosted); }
.account-btn.active { background: var(--earth); color: var(--parchment); }

.account-panel { display: none; }
.account-panel.active { display: block; animation: fadeIn 0.25s ease-out; }

/* ─── Rujilabs post items ─── */
.rj-item {
  background: var(--surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  transition: border-color var(--transition);
}
.rj-item:hover { border-color: var(--border); }

.rj-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.5rem;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.rj-item-header > div { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }

.rj-item-tags { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.rj-tag {
  font-size: 0.6rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; padding: 0.15rem 0.5rem; border-radius: 20px;
  background: var(--surface2); color: var(--stone);
}

.rj-item-text {
  font-size: 0.8125rem; color: var(--ash); line-height: 1.55;
  white-space: pre-wrap; word-break: break-word;
}

.rj-item-text--separator {
  margin-top: 0.375rem;
  border-top: 1px dashed var(--border-subtle);
  padding-top: 0.375rem;
}

.rj-item-part-label {
  color: var(--stone);
  font-size: 0.65rem;
  font-weight: 600;
}

.rj-tag-purple {
  color: var(--purple);
  background: rgba(139, 92, 246, 0.1);
}

.rj-item-id {
  font-size: 0.7rem;
  color: var(--stone);
}

.rj-item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0 0;
}

.rj-item-sent-at {
  font-size: 0.7rem;
  color: var(--stone);
}

.rj-threads-link {
  font-size: 0.7rem;
  color: var(--ash);
  text-decoration: none;
}
.rj-threads-link:hover { color: var(--parchment); }

.rj-settings-section {
  margin-bottom: 1rem;
}

.rj-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}

.rj-settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.rj-settings-field-label {
  font-size: 0.65rem;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.rj-settings-field input {
  font-size: 0.8rem;
  padding: 0.3rem 0.5rem;
}

.rj-edit-textarea {
  font-size: 0.8rem;
  min-height: 200px;
}

.rj-item-actions {
  display: flex; gap: 0.375rem; margin-top: 0.5rem;
  padding-top: 0.5rem; border-top: 1px solid var(--border-subtle);
  flex-wrap: wrap;
}

.rj-stats-row {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem; margin-bottom: 1.5rem;
}

.rj-actions-bar {
  display: flex; gap: 0.5rem; margin-bottom: 1rem; flex-wrap: wrap;
  align-items: center;
}

.rj-actions-bar .section-title { margin-bottom: 0; }

.rj-modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center; z-index: 1000;
}
.rj-modal {
  background: #111110; border: 1px solid rgba(200,200,198,0.18);
  border-radius: 12px; padding: 1.5rem; width: 90%; max-width: 480px;
  max-height: 85vh; overflow-y: auto; color: #f5f4f1;
}
.rj-modal h2 { margin: 0 0 1rem; font-size: 1.1rem; }
.rj-modal .field { margin-bottom: 0.75rem; }
.rj-modal .field label {
  display: block; font-size: 0.7rem; color: #7a7978;
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.25rem;
}
.rj-modal .field input,
.rj-modal .field select,
.rj-modal .field textarea {
  width: 100%; padding: 0.4rem 0.6rem; border: 1px solid rgba(200,200,198,0.18);
  border-radius: 6px; font-size: 0.85rem; background: #080807;
  color: #f5f4f1; font-family: inherit;
}
.rj-modal .field textarea { min-height: 60px; resize: vertical; }
.rj-modal .actions {
  display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem;
}
.rj-modal .actions button.primary {
  background: #a78bfa; color: #fff; border: none; padding: 0.5rem 1.2rem;
  border-radius: 6px; cursor: pointer; font-size: 0.85rem; font-weight: 600;
}
.rj-modal .actions button.primary:hover { opacity: 0.9; }
.rj-modal .actions button.primary:disabled { opacity: 0.5; cursor: not-allowed; }
.rj-modal .actions button:not(.primary) {
  background: rgba(255,255,255,0.08); color: #a5a4a2; border: 1px solid rgba(200,200,198,0.18);
  padding: 0.5rem 1rem; border-radius: 6px; cursor: pointer; font-size: 0.85rem;
}

.settings-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: 12px;
  padding: 1.5rem; margin-bottom: 1rem;
}
.settings-section { margin-bottom: 1.5rem; }
.settings-section:last-child { margin-bottom: 0; }
.settings-section-title {
  font-size: 1rem; font-weight: 600; color: var(--parchment);
  margin: 0 0 0.25rem;
}
.settings-hint {
  font-size: 0.75rem; color: var(--stone); margin: 0 0 1rem;
}
.settings-field { margin-bottom: 1rem; }
.settings-field:last-child { margin-bottom: 0; }
.settings-label {
  display: block; font-size: 0.7rem; color: var(--stone);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.3rem;
}
.settings-input {
  width: 100%; padding: 0.5rem 0.75rem; border: 1px solid var(--border);
  border-radius: 8px; font-size: 0.85rem; background: var(--bg);
  color: var(--parchment); font-family: inherit; transition: border-color 0.2s;
}
.settings-input:focus {
  outline: none; border-color: var(--purple);
}

/* ─── Focus Visible ─── */
*:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

.btn:focus-visible, .tab-btn:focus-visible, .tag-btn:focus-visible,
.account-btn:focus-visible, .textarea-icon:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 2px;
}

input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 2px solid var(--purple);
  outline-offset: 0;
}

/* ─── Login Page ─── */
.login-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2.5rem;
  width: 100%;
  max-width: 380px;
  margin: 1rem;
  animation: fadeIn 0.4s ease-out;
}

.login-title {
  font-size: 1.2rem; font-weight: 700; margin-bottom: 0.25rem;
  letter-spacing: -0.03em; color: var(--parchment);
}

.login-title span { color: var(--ash); }

.login-sub {
  font-size: 0.7rem; color: var(--stone); margin-bottom: 1.75rem;
  text-transform: uppercase; letter-spacing: 1.4px;
}

.login-label {
  font-size: 0.7rem; font-weight: 600; color: var(--stone);
  text-transform: uppercase; letter-spacing: 1.2px;
  display: block; margin-bottom: 0.4rem;
}

.login-input {
  width: 100%; background: var(--bg);
  border: 1px solid var(--border-subtle); border-radius: var(--radius-sm);
  color: var(--parchment); padding: 0.7rem 0.9rem;
  font-size: 0.875rem; outline: none; font-family: var(--font-mono);
  transition: border-color var(--transition);
}

.login-input:focus { border-color: var(--border-hover); }

.login-remember {
  display: flex; align-items: center; gap: 0.5rem;
  margin-top: 1rem; font-size: 0.8rem; color: var(--stone);
}

.login-remember input { accent-color: var(--ash); }

.login-remember-label {
  margin: 0; text-transform: none; font-weight: 400;
  font-size: 0.8rem; color: #7575a0;
}

.login-btn {
  width: 100%; margin-top: 1rem; padding: 0.75rem;
  background: var(--earth); color: var(--parchment);
  border: 1px solid var(--border); border-radius: var(--radius-pill);
  font-size: 0.875rem; font-weight: 500; font-family: var(--font);
  cursor: pointer; transition: all var(--transition);
}

.login-btn:hover:not(:disabled) { background: var(--earth-hover); border-color: var(--border-hover); }
.login-btn:active { transform: scale(0.98); }
.login-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.login-msg { margin-top: 1rem; font-size: 0.8rem; text-align: center; min-height: 1.2rem; }
.login-msg.err { color: var(--red); }
.login-msg.ok { color: var(--green); }

.login-hint {
  font-size: 0.65rem; color: var(--purple-gray);
  margin-top: 1.5rem; text-align: center; letter-spacing: 0.3px;
}

.login-center {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh;
}

/* ─── Modal (generic, replaces prompt/alert) ─── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.7);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000; animation: fadeIn 0.15s ease-out;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px; padding: 1.5rem;
  width: 90%; max-width: 480px;
  max-height: 85vh; overflow-y: auto;
  animation: fadeIn 0.2s ease-out;
}

.modal h2 {
  margin: 0 0 1rem; font-size: 1.1rem; color: var(--parchment);
}

.modal .field { margin-bottom: 0.75rem; }

.modal .field label {
  display: block; font-size: 0.7rem; color: var(--stone);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.25rem;
}

.modal .field input,
.modal .field select,
.modal .field textarea {
  width: 100%; padding: 0.5rem 0.6rem;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.85rem; background: var(--bg);
  color: var(--parchment); font-family: inherit;
}

.modal .field textarea { min-height: 60px; resize: vertical; }

.modal .modal-field { margin-bottom: 0.75rem; }

.modal .modal-field label {
  display: block; font-size: 0.7rem; color: var(--stone);
  text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 0.25rem;
}

.modal .modal-field input,
.modal .modal-field textarea {
  width: 100%; padding: 0.5rem 0.6rem;
  border: 1px solid var(--border); border-radius: 8px;
  font-size: 0.85rem; background: var(--bg);
  color: var(--parchment); font-family: inherit;
}

.modal .modal-field textarea { min-height: 60px; resize: vertical; }

.modal .modal-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}

.modal .modal-header h3 {
  margin: 0; font-size: 1.1rem; color: var(--parchment);
}

.modal .modal-close {
  background: none; border: none; color: var(--ash);
  font-size: 1.5rem; cursor: pointer; padding: 0; line-height: 1;
}

.modal .modal-close:hover { color: var(--parchment); }

.modal .modal-body { margin-bottom: 1rem; }

.modal .modal-footer {
  display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem;
}

.modal .actions {
  display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1rem;
}

.modal .actions button.primary {
  background: var(--earth); color: var(--parchment);
  border: 1px solid var(--border); padding: 0.5rem 1.2rem;
  border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-weight: 600;
  font-family: var(--font); transition: all var(--transition);
}

.modal .actions button.primary:hover:not(:disabled) {
  background: var(--earth-hover); border-color: var(--border-hover);
}

.modal .actions button.primary:disabled { opacity: 0.5; cursor: not-allowed; }

.modal .actions button:not(.primary) {
  background: transparent; color: var(--ash);
  border: 1px solid var(--border-subtle);
  padding: 0.5rem 1rem; border-radius: 8px;
  cursor: pointer; font-size: 0.85rem; font-family: var(--font);
  transition: all var(--transition);
}

.modal .actions button:not(.primary):hover {
  color: var(--parchment); border-color: var(--border);
  background: var(--frosted);
}

/* Search input in section header */
.search-input {
  flex: 1; min-width: 180px; max-width: 360px;
  padding: 0.5rem 0.75rem;
  background: var(--frosted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius);
  color: var(--parchment);
  font-size: 0.8125rem;
  font-family: inherit;
  transition: border-color var(--transition);
}
.search-input:focus {
  outline: none;
  border-color: var(--border);
}
.search-input::placeholder { color: rgba(230, 221, 208, 0.4); }

/* Bulk action bar */
.bulk-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 0.75rem; flex-wrap: wrap;
  margin-bottom: 0.75rem;
  padding: 0.65rem 1rem;
  background: rgba(139, 92, 246, 0.08);
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: var(--radius);
  font-size: 0.8125rem; color: var(--parchment);
}
.bulk-bar[hidden] { display: none; }
.bulk-bar-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }

/* Checkbox column */
.td-check { width: 36px; text-align: center; padding: 0.5rem !important; }
.td-check input[type="checkbox"],
.product-checkbox {
  width: 18px; height: 18px; cursor: pointer;
  accent-color: #8b5cf6;
}
.product-card-check {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.7rem; color: rgba(230, 221, 208, 0.55);
  margin-bottom: 0.35rem; cursor: pointer;
  user-select: none;
}

/* Posts tab: section divider + dim posted */
.posts-section-divider {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 0.75rem;
  margin: 1.25rem 0 0.25rem;
  padding: 0.5rem 0.75rem;
  color: rgba(230, 221, 208, 0.45);
  font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.08em;
  border-top: 1px dashed var(--border-subtle);
}
.post-card-dim {
  opacity: 0.55;
  transition: opacity var(--transition);
}
.post-card-dim:hover { opacity: 1; }

/* ===================== Calendar ===================== */
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 1rem;
}
.calendar-weekday {
  padding: 0.4rem 0; text-align: center;
  font-size: 0.7rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ash);
}
.calendar-cell {
  min-height: 72px;
  padding: 0.4rem;
  background: var(--frosted);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  text-align: left;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--parchment);
  display: flex; flex-direction: column; justify-content: space-between;
}
.calendar-cell:hover {
  background: var(--frosted-btn);
  border-color: var(--border);
}
.calendar-cell-blank { background: transparent; border: none; cursor: default; }
.calendar-cell-today { border-color: rgba(139, 92, 246, 0.5); background: rgba(139, 92, 246, 0.05); }
.calendar-cell-selected { border-color: var(--purple); background: var(--purple-dim); }
.calendar-day-num { font-size: 0.85rem; font-weight: 500; }
.calendar-dot-bar { display: flex; gap: 3px; flex-wrap: wrap; margin-top: 0.3rem; }
.calendar-dot { width: 6px; height: 6px; border-radius: 50%; }
.calendar-dot-draft { background: var(--ash); }
.calendar-dot-queued { background: var(--purple); }
.calendar-dot-posted { background: var(--green); }
.calendar-dot-failed { background: var(--red); }
.calendar-dot-more { font-size: 0.65rem; color: var(--ash); }
.calendar-selected { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--border-subtle); }
.calendar-selected-heading { font-weight: 600; font-size: 0.85rem; margin-bottom: 0.75rem; color: var(--parchment); }
.calendar-post-row {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.4rem 0; font-size: 0.8rem;
  border-bottom: 1px dashed var(--border-subtle);
}
.calendar-post-row:last-child { border-bottom: none; }
.calendar-post-time { min-width: 52px; font-family: var(--font-mono); color: var(--ash); font-size: 0.75rem; }
.calendar-post-text { color: var(--parchment); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.calendar-hint { color: var(--stone); font-size: 0.8rem; padding: 0.75rem 0; }

/* ===================== Post labels ===================== */
.post-labels { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-bottom: 0.5rem; }
.label-chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.15rem 0.5rem;
  background: rgba(96, 165, 250, 0.1);
  color: var(--blue);
  border: 1px solid rgba(96, 165, 250, 0.3);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 500;
}
.label-chip-x {
  background: transparent; border: none; color: inherit;
  cursor: pointer; font-size: 0.85rem; line-height: 1;
  padding: 0; margin-left: 0.1rem;
}
.label-chip-x:hover { color: var(--red); }
.label-add {
  background: transparent; border: 1px dashed var(--border-subtle);
  color: var(--stone); padding: 0.15rem 0.55rem;
  border-radius: 999px; font-size: 0.7rem; cursor: pointer;
  transition: all var(--transition);
}
.label-add:hover { border-color: var(--border); color: var(--parchment); }

/* ===================== Engagement hint chips ===================== */
.post-hints, .hint-chip-bar { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-bottom: 0.4rem; }
.hint-chip {
  font-size: 0.65rem; padding: 0.15rem 0.5rem;
  border-radius: 999px; font-weight: 500;
  text-transform: lowercase;
}
.hint-ok   { background: var(--green-dim); color: var(--green); }
.hint-warn { background: var(--yellow-dim); color: var(--yellow); }
.hint-bad  { background: var(--red-dim);   color: var(--red); }

/* ===================== Activity timeline ===================== */
.post-timeline {
  margin: 0.6rem 0 0.2rem;
  font-size: 0.75rem;
}
.post-timeline summary {
  cursor: pointer; color: var(--ash); padding: 0.2rem 0;
  list-style: none; outline: none;
}
.post-timeline summary::-webkit-details-marker { display: none; }
.post-timeline summary::before { content: '▸ '; font-size: 0.7rem; }
.post-timeline[open] summary::before { content: '▾ '; }
.post-timeline-body { margin-top: 0.3rem; padding-left: 0.5rem; border-left: 2px solid var(--border-subtle); }
.timeline-row { display: flex; align-items: baseline; gap: 0.5rem; padding: 0.15rem 0; }
.timeline-icon { font-size: 0.7rem; color: var(--purple); min-width: 12px; }
.timeline-label { color: var(--parchment); flex: 1; }
.timeline-time { color: var(--stone); font-family: var(--font-mono); font-size: 0.7rem; }
.timeline-empty { color: var(--stone); font-size: 0.75rem; padding: 0.3rem 0; }

/* ===================== Queue next-slot pill ===================== */
.queue-item-slot {
  display: inline-flex; align-items: center;
  padding: 0.1rem 0.5rem;
  background: rgba(167, 139, 250, 0.1);
  color: var(--purple);
  border-radius: 999px;
  font-size: 0.7rem; font-family: var(--font-mono);
  margin-left: 0.4rem;
}

/* ===================== Hashtag manager + picker ===================== */
.hashtag-list { display: flex; flex-direction: column; gap: 0.75rem; margin-bottom: 1rem; }
.hashtag-row { background: var(--frosted); border: 1px solid var(--border-subtle); border-radius: var(--radius-sm); padding: 0.6rem; }
.hashtag-row-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.4rem; }
.hashtag-row-head strong { font-size: 0.85rem; }
.hashtag-new { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: flex-start; }
.hashtag-new .settings-input { flex: 1; min-width: 160px; }
.hashtag-picker { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.4rem; }
.hashtag-pick {
  background: rgba(167, 139, 250, 0.08);
  border: 1px solid rgba(167, 139, 250, 0.25);
  color: var(--purple);
  border-radius: 999px;
  padding: 0.2rem 0.6rem; font-size: 0.7rem; cursor: pointer;
  transition: all var(--transition);
}
.hashtag-pick:hover { background: rgba(167, 139, 250, 0.18); }

/* ===================== Schedule bar ===================== */
.schedule-bar {
  margin-top: 0.6rem; padding: 0.5rem 0;
  user-select: none;
}
.schedule-bar-track {
  position: relative;
  height: 32px;
  background: linear-gradient(90deg, var(--frosted), var(--frosted-btn), var(--frosted));
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
}
.schedule-bar-labels {
  display: flex; justify-content: space-between;
  margin-top: 0.3rem; font-size: 0.65rem; color: var(--stone); font-family: var(--font-mono);
}
.schedule-pin {
  position: absolute; top: 50%; transform: translate(-50%, -50%);
  padding: 0.15rem 0.4rem;
  background: var(--purple); color: #fff;
  font-size: 0.6rem; font-family: var(--font-mono);
  border-radius: 999px; white-space: nowrap;
}
.schedule-now {
  position: absolute; top: 0; bottom: 0;
  width: 2px; background: var(--yellow);
  box-shadow: 0 0 8px var(--yellow);
}

/* ===================== Sidebar rail (desktop) =====================
   Fixed-position so it doesn't depend on #dashboard's display (inline
   style overrides would break a grid layout). */
.sidebar-rail { display: none; }

@media (min-width: 1100px) {
  .sidebar-rail {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 56px;
    background: var(--surface);
    border-right: 1px solid var(--border-subtle);
    display: flex; flex-direction: column; align-items: center; gap: 0.4rem;
    padding: 1rem 0;
    z-index: 5;
  }
  #dashboard { padding-left: 56px; }
  .sidebar-rail-btn {
    width: 40px; height: 40px;
    display: flex; align-items: center; justify-content: center;
    background: transparent; border: none;
    color: var(--stone); border-radius: 10px;
    cursor: pointer; transition: all var(--transition);
  }
  .sidebar-rail-btn:hover { background: var(--frosted-btn); color: var(--parchment); }
  .sidebar-rail-btn.active { background: var(--purple-dim); color: var(--purple); }
}

/* Threads preview modal */
.preview-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  display: flex; align-items: center; justify-content: center;
  z-index: 1500; padding: 1rem;
}
.threads-preview {
  background: var(--surface);
  color: var(--parchment);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%; max-width: 520px;
  max-height: 85vh; overflow-y: auto;
  padding: 1.25rem;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.threads-preview-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.75rem; }
.threads-preview-header h3 { font-size: 0.9rem; color: var(--ash); font-weight: 600; }
.threads-preview-status {
  display: inline-block; margin-bottom: 1rem;
  padding: 0.25rem 0.75rem;
  background: var(--purple-dim); color: var(--purple);
  border-radius: 999px; font-size: 0.7rem; text-transform: uppercase;
  letter-spacing: 0.05em;
}
.threads-post {
  display: flex; gap: 0.75rem;
  padding: 0.9rem 0;
  border-bottom: 1px solid var(--border-subtle);
}
.threads-post:last-of-type { border-bottom: none; }
.threads-avatar {
  flex-shrink: 0;
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg, #a78bfa, #6366f1);
  color: #fff; font-weight: 700; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
}
.threads-body { flex: 1; min-width: 0; }
.threads-meta { display: flex; align-items: baseline; gap: 0.5rem; margin-bottom: 0.3rem; }
.threads-handle { font-weight: 600; font-size: 0.875rem; color: var(--parchment); }
.threads-age { font-size: 0.75rem; color: var(--ash); }
.threads-text { font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word; color: var(--parchment); }
.threads-count { margin-top: 0.4rem; font-size: 0.7rem; color: var(--stone); font-family: var(--font-mono); }
.threads-count-over { color: var(--red); font-weight: 600; }
.threads-thread-line {
  width: 2px; height: 16px;
  background: var(--border);
  margin-left: 19px;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: var(--frosted);
  border: 1px solid var(--border-subtle);
  border-radius: 50%;
  color: var(--ash);
  cursor: pointer;
  transition: all var(--transition);
  margin-right: 0.5rem;
}
.theme-toggle:hover {
  color: var(--parchment);
  border-color: var(--border);
  background: var(--frosted-btn);
}
.theme-toggle .theme-icon-light { display: none; }
[data-theme="light"] .theme-toggle .theme-icon-dark { display: none; }
[data-theme="light"] .theme-toggle .theme-icon-light { display: block; }

/* Shortcuts help list */
.shortcuts-list { display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.85rem; }
.shortcuts-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.4rem 0; border-bottom: 1px solid var(--border-subtle); }
.shortcuts-row:last-child { border-bottom: none; }
.shortcuts-row kbd {
  display: inline-block; min-width: 42px; text-align: center;
  padding: 0.2rem 0.5rem; font-family: var(--font-mono); font-size: 0.75rem;
  background: var(--frosted-btn); border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm); color: var(--parchment);
}
.shortcuts-row span { color: var(--ash); }

/* Undo snackbar */
.undo-bar {
  position: fixed; bottom: 1.25rem; left: 50%;
  transform: translateX(-50%) translateY(130%);
  display: flex; align-items: center; gap: 1rem;
  padding: 0.7rem 1rem 0.7rem 1.25rem;
  background: rgba(30, 26, 20, 0.95);
  color: var(--parchment);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  font-size: 0.8125rem;
  z-index: 2000;
  backdrop-filter: blur(12px);
  transition: transform 240ms cubic-bezier(.2,.9,.3,1.2), opacity 200ms;
  opacity: 0;
  pointer-events: none;
}
.undo-bar.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}
.undo-bar-msg { color: var(--parchment); }
.undo-bar-btn {
  background: transparent; border: 1px solid rgba(139, 92, 246, 0.4);
  color: #c4b5fd; padding: 0.3rem 0.9rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; cursor: pointer;
  text-transform: uppercase; letter-spacing: 0.05em;
  transition: all var(--transition);
}
.undo-bar-btn:hover {
  background: rgba(139, 92, 246, 0.15);
  border-color: rgba(139, 92, 246, 0.7);
  color: #e9d5ff;
}

/* Rujilabs bulk select */
.rj-item-header-left { display: flex; align-items: center; gap: 0.5rem; }
.rj-checkbox { width: 18px; height: 18px; cursor: pointer; accent-color: #8b5cf6; }
.rj-select-all {
  display: inline-flex; align-items: center; gap: 0.4rem;
  font-size: 0.75rem; color: rgba(230, 221, 208, 0.55);
  cursor: pointer; user-select: none;
}
.rj-select-hint { color: rgba(230, 221, 208, 0.4); font-size: 0.75rem; }
.bulk-bar[hidden] { display: none !important; }

/* Mobile polish */
@media (max-width: 640px) {
  .search-input { max-width: none; width: 100%; min-width: 0; }
  .bulk-bar { flex-direction: column; align-items: stretch; }
  .bulk-bar-actions { justify-content: stretch; }
  .bulk-bar-actions .btn { flex: 1; }
  .btn-sm { min-height: 36px; padding: 0.45rem 0.8rem; }
  .td-actions .btn-sm { min-width: 44px; }
}
