/* public/css/admin.css */
:root {
  --color-primary: #2D2D2D;
  --color-accent: #C9A96E;
  --color-bg: #F7F7F5;
  --color-card: #FFFFFF;
  --color-text: #2D2D2D;
  --color-muted: #888;
  --color-border: #E5E5E0;
  --color-inbound: #F0F0ED;
  --color-outbound: #DCF7D6;
  --color-error: #D9534F;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--color-bg); color: var(--color-text);
}
button { cursor: pointer; font-family: inherit; }
input, textarea, button {
  font-family: inherit; font-size: 15px;
  border: 1px solid var(--color-border); border-radius: 6px;
  padding: 10px 12px;
}
input:focus, textarea:focus { outline: 2px solid var(--color-accent); }

/* Login page */
.login-wrap {
  display: flex; min-height: 100vh;
  align-items: center; justify-content: center;
}
.login-card {
  background: var(--color-card);
  padding: 32px; border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.05);
  width: 360px;
}
.login-card h1 { margin: 0 0 24px; font-size: 20px; }
.login-card label { display: block; font-size: 13px; margin-bottom: 4px; color: var(--color-muted); }
.login-card input { width: 100%; margin-bottom: 16px; }
.login-card button {
  width: 100%; background: var(--color-primary); color: white;
  border: none; padding: 12px; font-weight: 600;
}
.login-card button:hover { background: #000; }
.login-error { color: var(--color-error); font-size: 13px; min-height: 20px; margin-bottom: 8px; }

/* Inbox layout */
.layout { display: grid; grid-template-columns: 340px 1fr; height: 100vh; }
.sidebar { background: var(--color-card); border-right: 1px solid var(--color-border); overflow-y: auto; }
.sidebar-header { padding: 16px; border-bottom: 1px solid var(--color-border); font-weight: 600; display:flex; justify-content:space-between; align-items:center; }
.sidebar-header .logout { font-size: 12px; color: var(--color-muted); background:none; border:none; padding: 4px 8px; }
.conversation-item { padding: 14px 16px; border-bottom: 1px solid var(--color-border); cursor: pointer; }
.conversation-item:hover { background: var(--color-inbound); }
.conversation-item.active { background: var(--color-inbound); }
.conversation-item .name { font-weight: 600; font-size: 14px; }
.conversation-item .phone { font-size: 12px; color: var(--color-muted); }
.conversation-item .preview { font-size: 13px; color: var(--color-muted); margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.conversation-item .status-pill { font-size: 11px; padding: 2px 8px; border-radius: 10px; }
.status-bot_active { background: #DCF7D6; color: #2D5A2D; }
.status-paused_human { background: #FCE4E4; color: #8B1A1A; }
.status-human_takeover { background: #FFF4D6; color: #826500; }
.status-standby { background: #E5E5E0; color: #555; }
.status-closed { background: #E5E5E0; color: #888; }
.main { display: flex; flex-direction: column; height: 100vh; }
.main-header { padding: 16px 24px; border-bottom: 1px solid var(--color-border); background: var(--color-card); }
.messages { flex: 1; overflow-y: auto; padding: 24px; background: var(--color-bg); display: flex; flex-direction: column; }
.message {
  max-width: 540px; margin-bottom: 10px; padding: 10px 14px;
  border-radius: 10px; white-space: pre-wrap; word-break: break-word;
}
.message.inbound { background: var(--color-card); border: 1px solid var(--color-border); margin-right: auto; }
.message.outbound { background: var(--color-outbound); margin-left: auto; }
.message .meta { font-size: 11px; color: var(--color-muted); margin-top: 4px; }
.message img { max-width: 320px; border-radius: 6px; display: block; margin-top: 6px; }
.reply-box { border-top: 1px solid var(--color-border); padding: 16px; background: var(--color-card); }
.reply-box textarea { width: 100%; min-height: 70px; resize: vertical; }
.reply-box .actions { display: flex; justify-content: flex-end; margin-top: 8px; gap: 8px; }
.reply-box button { background: var(--color-primary); color: white; border: none; padding: 8px 20px; font-weight: 600; }
.reply-box button:disabled { opacity: 0.6; cursor: not-allowed; }
.empty { color: var(--color-muted); text-align: center; padding: 40px; }

/* ── Top nav (used on intake / status / users pages) ─────────────────────── */
.admin-topbar {
  display: flex; align-items: center; gap: 16px;
  background: var(--color-card);
  border-bottom: 1px solid var(--color-border);
  padding: 10px 20px;
  position: sticky; top: 0; z-index: 50;
  font-size: 14px;
}
.admin-topbar .brand { font-weight: 700; color: var(--color-primary); margin-right: 8px; }
.admin-topbar .links { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.admin-topbar .links a {
  text-decoration: none; color: #4b5563; padding: 6px 12px; border-radius: 6px;
  font-size: 13px; font-weight: 500;
}
.admin-topbar .links a:hover { background: var(--color-inbound); color: var(--color-primary); }
.admin-topbar .links a.active { background: var(--color-primary); color: #fff; }
.admin-topbar .who { display: flex; align-items: center; gap: 10px; }
.admin-topbar .user-tag { font-size: 12px; color: var(--color-muted); }
.admin-topbar .user-tag em { color: #9ca3af; font-style: normal; }
.admin-topbar #topbarLogout {
  font-size: 12px; padding: 4px 10px; background: none;
  border: 1px solid var(--color-border); color: var(--color-muted);
}
.admin-topbar #topbarLogout:hover { background: var(--color-inbound); }

/* ── Status page ────────────────────────────────────────────────────────── */
.status-wrap { max-width: 1200px; margin: 24px auto; padding: 0 20px 60px; }
.status-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.status-card {
  background: var(--color-card);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 16px 20px;
}
.status-card h3 {
  margin: 0 0 12px; font-size: 14px; color: var(--color-muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  display: flex; align-items: center; justify-content: space-between;
}
.status-card h3 .count {
  background: var(--color-inbound); color: var(--color-primary);
  border-radius: 12px; padding: 2px 10px; font-size: 12px;
}
.heartbeat {
  display: flex; align-items: center; gap: 12px; padding: 14px 18px;
  background: var(--color-card); border: 1px solid var(--color-border);
  border-radius: 10px; margin-bottom: 16px;
}
.heartbeat .dot {
  width: 10px; height: 10px; border-radius: 50%; background: #9ca3af;
}
.heartbeat.online  .dot { background: #16a34a; box-shadow: 0 0 0 3px rgba(22,163,74,0.2); }
.heartbeat.stale   .dot { background: #f59e0b; }
.heartbeat.offline .dot { background: #dc2626; }
.heartbeat.unknown .dot { background: #9ca3af; }
.heartbeat .label { font-weight: 600; }
.heartbeat .age { color: var(--color-muted); font-size: 13px; }
.job-row {
  display: grid; grid-template-columns: 1fr auto;
  padding: 10px 0; border-bottom: 1px solid var(--color-border); gap: 8px;
}
.job-row:last-child { border-bottom: none; }
.job-row .name { font-weight: 600; font-size: 14px; }
.job-row .meta { font-size: 12px; color: var(--color-muted); margin-top: 2px; }
.job-row .right { text-align: right; font-size: 12px; }
.job-row .market-tag {
  display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 11px;
  font-weight: 600; margin-right: 6px;
}
.job-row .market-TR { background: #fef3c7; color: #92400e; }
.job-row .market-EU { background: #dbeafe; color: #1e40af; }
.job-row .ftp-link { color: #2563eb; text-decoration: none; word-break: break-all; }
.job-row .ftp-link:hover { text-decoration: underline; }
.job-row .err-preview {
  background: #fef2f2; color: #991b1b; padding: 4px 8px;
  border-radius: 4px; font-family: monospace; font-size: 11px; margin-top: 4px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.job-row .status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px;
  font-weight: 600;
}
.needs-review-card {
  border-left: 4px solid #f59e0b;
  background: linear-gradient(to right, #fffbeb, var(--color-card) 12%);
}
.needs-review-card h3 { color: #92400e; }
.needs-review-row {
  display: block;
  background: #fffbeb;
  border-radius: 8px;
  padding: 14px 16px !important;
  margin-bottom: 10px;
  border: 1px solid #fde68a;
}
.needs-review-row:last-child { margin-bottom: 0; }
.needs-review-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 12px; margin-bottom: 10px;
}
.review-report {
  margin: 0; padding: 12px 14px;
  background: #fff; border: 1px solid #fde68a; border-radius: 6px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px; line-height: 1.55; color: #1f2937;
  white-space: pre-wrap; word-break: break-word;
  max-height: 420px; overflow-y: auto;
}
.review-report::-webkit-scrollbar { width: 8px; }
.review-report::-webkit-scrollbar-thumb { background: #fde68a; border-radius: 4px; }

.status-pending             { background: #f3f4f6; color: #4b5563; }
.status-running             { background: #fef3c7; color: #92400e; }
.status-done                { background: #d1fae5; color: #065f46; }
.status-failed              { background: #fee2e2; color: #991b1b; }
.status-ready_to_send       { background: #dcfce7; color: #14532d; border: 1px solid #86efac; }
.status-sent                { background: #16a34a; color: #ffffff; border: 1px solid #15803d; }
.status-needs_human_review  { background: #fef3c7; color: #713f12; border: 1px solid #fde047; }
.status-review_failed       { background: #fee2e2; color: #991b1b; border: 1px solid #fca5a5; }

/* Filter bar */
.status-filters {
  display: flex; gap: 12px; align-items: end; flex-wrap: wrap;
  background: var(--color-card); border: 1px solid var(--color-border);
  border-radius: 10px; padding: 12px 16px; margin-bottom: 16px;
}
.status-filters .filter { display: flex; flex-direction: column; gap: 4px; min-width: 130px; }
.status-filters .filter label { font-size: 11px; color: var(--color-muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.status-filters .filter select,
.status-filters .filter input {
  padding: 7px 10px; font-size: 13px; border: 1px solid var(--color-border);
  border-radius: 6px; background: #fff;
}
.status-filters .filter-clear {
  padding: 8px 14px; font-size: 12px; background: none;
  border: 1px solid var(--color-border); border-radius: 6px; color: var(--color-muted);
  align-self: end;
}
.status-filters .filter-clear:hover { background: var(--color-inbound); }

/* Submitter chip — colored per username */
.user-chip {
  display: inline-block; padding: 1px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600; margin-right: 4px;
  background: #e0e7ff; color: #3730a3;
}
.user-chip.c0 { background:#fee2e2; color:#991b1b; }
.user-chip.c1 { background:#fef3c7; color:#92400e; }
.user-chip.c2 { background:#d1fae5; color:#065f46; }
.user-chip.c3 { background:#dbeafe; color:#1e40af; }
.user-chip.c4 { background:#fce7f3; color:#9f1239; }
.user-chip.c5 { background:#ddd6fe; color:#5b21b6; }
.user-chip.c6 { background:#cffafe; color:#155e75; }
.user-chip.c7 { background:#fed7aa; color:#9a3412; }

.detail-btn {
  font-size: 11px; padding: 3px 9px;
  background: #fff; border: 1px solid var(--color-border);
  border-radius: 5px; cursor: pointer; color: var(--color-primary);
}
.detail-btn:hover { background: var(--color-inbound); }
.detail-btn.stuck-warn {
  background: #fef3c7; border-color: #fbbf24; color: #92400e;
}
.detail-btn.stuck-warn:hover { background: #fde68a; }
.detail-btn.approve-btn {
  background: #d1fae5; border-color: #6ee7b7; color: #065f46; font-weight: 700;
}
.detail-btn.approve-btn:hover { background: #a7f3d0; }
.detail-btn.rebuild-btn {
  background: #fee2e2; border-color: #fca5a5; color: #991b1b; font-weight: 600;
}
.detail-btn.rebuild-btn:hover { background: #fecaca; }
.detail-btn.revise-btn {
  background: #eef2ff; border-color: #c7d2fe; color: #3730a3; font-weight: 600;
}
.detail-btn.revise-btn:hover { background: #e0e7ff; }

/* Version badge — shows "v2", "v3" etc. next to the latest-build status on
 * the clients page. Means: original + N revisions. v1 (no revisions) is
 * intentionally NOT rendered to avoid noise on every just-built site. */
.version-badge {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 10px; font-weight: 700; letter-spacing: 0.04em;
  background: #ede9fe; color: #5b21b6; vertical-align: middle;
  margin-left: 4px;
}
#rebuildModal textarea {
  width: 100%; min-height: 180px; padding: 12px 14px;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 13px; line-height: 1.55;
  border: 1px solid var(--color-border); border-radius: 8px;
  resize: vertical; box-sizing: border-box;
}
#rebuildModal textarea:focus {
  outline: none; border-color: #f59e0b;
  box-shadow: 0 0 0 3px rgba(245, 158, 11, 0.15);
}
.type-tag {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 600; margin-right: 4px;
}
.type-tag.type-revision  { background: #ede9fe; color: #5b21b6; }
.type-tag.type-approval  { background: #fef3c7; color: #92400e; }
.type-tag.type-review    { background: #e0f2fe; color: #075985; }
.type-tag.type-plan-held { background: #fff7ed; color: #9a3412; border: 1px solid #fed7aa; }
.job-actions {
  display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px;
}
.modal-actions {
  display: flex; gap: 8px; padding-top: 14px; margin-top: 8px;
  border-top: 1px solid var(--color-border);
}
.modal-actions .detail-btn {
  font-size: 13px; padding: 6px 14px;
}

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  z-index: 1000; display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 20px; overflow-y: auto;
}
.modal-card {
  background: var(--color-card); border-radius: 12px; max-width: 900px; width: 100%;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25); overflow: hidden;
}
.modal-head {
  display: flex; justify-content: space-between; align-items: flex-start;
  padding: 18px 22px; border-bottom: 1px solid var(--color-border);
}
.modal-body {
  padding: 18px 22px; max-height: 70vh; overflow-y: auto;
}
.modal-body .field-block { margin-bottom: 16px; }
.modal-body .field-block .field-label {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.05em; color: var(--color-muted); margin-bottom: 6px;
}
.modal-body .field-block .field-value {
  font-size: 13px; word-break: break-word;
}
.modal-body pre.log-pre {
  background: #0f172a; color: #e2e8f0; padding: 14px 16px;
  border-radius: 8px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 11px; line-height: 1.5; max-height: 400px; overflow: auto;
  white-space: pre-wrap; word-break: break-word; margin: 0;
}
.modal-body pre.err-pre {
  background: #fef2f2; color: #991b1b; padding: 12px 14px;
  border-radius: 8px; font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; white-space: pre-wrap; word-break: break-word; margin: 0;
  border: 1px solid #fecaca;
}
.modal-body .empty-log {
  font-size: 12px; color: var(--color-muted); font-style: italic;
}

/* Intake snapshot block — what the customer asked for, shown next to log */
.modal-body .intake-block {
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  padding: 14px 16px;
}
.modal-body .intake-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 4px;
}
@media (max-width: 700px) {
  .modal-body .intake-grid { grid-template-columns: 1fr; }
}
.modal-body .intake-col { min-width: 0; }
.modal-body .intake-subhead {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--color-muted);
  margin: 0 0 6px;
}
.modal-body .kv-row {
  display: grid; grid-template-columns: 130px 1fr; gap: 8px;
  font-size: 13px; padding: 3px 0; border-bottom: 1px dashed #e5e7eb;
  align-items: baseline;
}
.modal-body .kv-row:last-child { border-bottom: 0; }
.modal-body .kv-key { color: var(--color-muted); font-weight: 600; }
.modal-body .kv-val { word-break: break-word; color: var(--color-primary); }
.modal-body .brief-block {
  background: #fff; border: 1px solid var(--color-border);
  border-radius: 6px; padding: 10px 12px;
  font-size: 13px; line-height: 1.5; color: var(--color-primary);
  max-height: 220px; overflow-y: auto;
}
.modal-body .photo-row {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 4px 0; font-size: 12px;
  border-bottom: 1px dashed #e5e7eb;
}
.modal-body .photo-row:last-child { border-bottom: 0; }
.modal-body .photo-row code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  background: #fff; padding: 2px 6px; border-radius: 4px; font-size: 11px;
  border: 1px solid var(--color-border);
}
.modal-body .photo-caption { color: var(--color-muted); flex: 1; }
.modal-body .photo-tag {
  display: inline-block; padding: 1px 6px; border-radius: 8px;
  background: #ede9fe; color: #5b21b6;
  font-size: 10px; font-weight: 600; margin-left: 4px;
}
.modal-body .comp-pill {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 10px; font-weight: 700; margin-left: 6px;
  vertical-align: middle;
}
.modal-body .comp-pill.good { background: #d1fae5; color: #065f46; }
.modal-body .comp-pill.mid  { background: #fef3c7; color: #92400e; }
.modal-body .comp-pill.low  { background: #fee2e2; color: #991b1b; }
.modal-body pre.review-notes {
  background: #f0f9ff; color: #0c4a6e;
  border: 1px solid #bae6fd;
}

/* ── Clients (all intakes) page ─────────────────────────────────────────── */
.clients-wrap { max-width: 1400px; margin: 24px auto; padding: 0 20px 60px; }
.clients-meta {
  font-size: 13px; color: var(--color-muted); margin: 12px 0 8px;
}
.clients-table-wrap {
  background: var(--color-card); border: 1px solid var(--color-border);
  border-radius: 10px; overflow: hidden; overflow-x: auto;
}
.clients-table {
  width: 100%; border-collapse: collapse; min-width: 1100px;
}
.clients-table th, .clients-table td {
  padding: 10px 12px; text-align: left; font-size: 13px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: top;
}
.clients-table th {
  background: var(--color-bg); font-weight: 600;
  color: var(--color-muted); font-size: 11px;
  text-transform: uppercase; letter-spacing: 0.04em;
  position: sticky; top: 0; z-index: 1;
}
.clients-table tr:last-child td { border-bottom: none; }
.clients-table tr[data-client-id] { cursor: pointer; }
.clients-table tr[data-client-id]:hover { background: var(--color-inbound); }
.clients-table .meta {
  font-size: 11px; color: var(--color-muted); margin-top: 2px;
}
.clients-table code {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px; background: var(--color-bg); padding: 1px 6px;
  border-radius: 4px;
}
.clients-table .status-badge {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.clients-table .comp-pill {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 700;
}
.clients-table .comp-pill.good { background: #d1fae5; color: #065f46; }
.clients-table .comp-pill.mid  { background: #fef3c7; color: #92400e; }
.clients-table .comp-pill.low  { background: #fee2e2; color: #991b1b; }
.clients-table .market-tag {
  display: inline-block; padding: 1px 7px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.clients-table .market-TR { background: #fef3c7; color: #92400e; }
.clients-table .market-EU { background: #cffafe; color: #155e75; }
.empty-cell {
  padding: 28px; text-align: center; color: var(--color-muted);
  font-style: italic;
}
.pagination {
  display: flex; gap: 16px; align-items: center; justify-content: center;
  margin-top: 18px;
}
.pagination button {
  padding: 8px 16px; font-size: 13px;
  background: var(--color-card); border: 1px solid var(--color-border);
  border-radius: 6px; cursor: pointer;
}
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }
.pagination button:not(:disabled):hover { background: var(--color-inbound); }
.pagination #pageRange {
  font-size: 13px; color: var(--color-muted);
}

/* ── Users page ─────────────────────────────────────────────────────────── */
.users-wrap { max-width: 1000px; margin: 24px auto; padding: 0 20px 60px; }
.users-table {
  width: 100%; border-collapse: collapse;
  background: var(--color-card); border: 1px solid var(--color-border);
  border-radius: 10px; overflow: hidden;
}
.users-table th, .users-table td {
  padding: 10px 14px; text-align: left; font-size: 13px;
  border-bottom: 1px solid var(--color-border);
}
.users-table th { background: var(--color-bg); font-weight: 600; color: var(--color-muted); }
.users-table tr:last-child td { border-bottom: none; }
.users-table .role-pill, .users-table .org-pill {
  display: inline-block; padding: 2px 8px; border-radius: 10px;
  font-size: 11px; font-weight: 600;
}
.role-owner { background: #fce7f3; color: #9f1239; }
.role-team  { background: #ddd6fe; color: #5b21b6; }
.role-sales { background: #dbeafe; color: #1e40af; }
.org-oyta     { background: #fef3c7; color: #92400e; }
.org-wacademy { background: #cffafe; color: #155e75; }
.org-both     { background: #f3f4f6; color: #4b5563; }
.users-table button {
  font-size: 12px; padding: 4px 10px; margin-right: 4px;
  background: none; border: 1px solid var(--color-border); border-radius: 5px;
}
.users-table button:hover { background: var(--color-inbound); }
.users-table button.danger { color: #b91c1c; border-color: #fecaca; }
.users-table button.danger:hover { background: #fef2f2; }

/* User create form */
.user-form {
  background: var(--color-card); border: 1px solid var(--color-border);
  border-radius: 10px; padding: 20px; margin-bottom: 20px;
}
.user-form h3 { margin: 0 0 14px; font-size: 16px; }
.user-form-row { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 12px; align-items: end; }
.user-form-row .field label {
  display: block; font-size: 12px; color: var(--color-muted); margin-bottom: 4px;
}
.user-form-row .field input,
.user-form-row .field select {
  width: 100%; padding: 8px 10px; font-size: 13px;
}
.user-form button.primary {
  padding: 9px 18px; background: #16a34a; color: white;
  border: none; font-weight: 600; font-size: 13px;
}
.user-form button.primary:hover { background: #15803d; }
.user-form .form-msg { margin-top: 10px; font-size: 13px; }
.user-form .form-msg.ok  { color: #166534; }
.user-form .form-msg.err { color: #b91c1c; }
@media (max-width: 800px) {
  .status-grid { grid-template-columns: 1fr; }
  .user-form-row { grid-template-columns: 1fr 1fr; }
}

/* ── Demo-lifecycle: Paid badge + danger action button ───────────────────── */
.paid-badge { font: inherit; cursor: pointer; border-radius: 999px; padding: 2px 10px; border: 1px solid transparent; }
.paid-badge.on  { background: #d1fae5; color: #065f46; border-color: #86efac; }
.paid-badge.off { background: #f3f4f6; color: #6b7280; border-color: #e5e7eb; }
.detail-btn.danger { color: #b91c1c; border-color: #fecaca; }
.detail-btn.danger:hover { background: #fef2f2; }

/* ── Decision summary box — "what you need to decide" at human gates ──────── */
.decision-box {
  margin: 10px 0 4px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid var(--color-border, #e5e7eb);
  background: #fffaf0;
  border-left: 4px solid var(--color-accent, #f59e0b);
  line-height: 1.5;
}
.decision-box.decision-review { background: #f0f7ff; border-left-color: #3b82f6; }
.decision-title { font-weight: 700; margin-bottom: 4px; }
.decision-line { font-size: 0.92rem; color: var(--color-text, #1f2937); margin-top: 2px; }
.decision-line.decision-do { color: var(--color-muted, #6b7280); margin-top: 5px; }

/* ── Client hub (client.html) ─────────────────────────────────────── */
.hub-wrap { max-width: 920px; margin: 20px auto; padding: 0 16px 80px; }
.hub-back { color: #2563eb; text-decoration: none; font-size: 13px; }
.hub-back:hover { text-decoration: underline; }

.hub-head { background: #3a1722; color: #fff; border-radius: 12px; padding: 16px 18px; margin: 12px 0 0; }
.hub-head .hub-nm { font-size: 20px; font-weight: 700; }
.hub-head .hub-meta { font-size: 12.5px; opacity: .85; margin-top: 3px; }
.hub-acts { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 12px; }
.hub-acts .hb {
  font-size: 12px; padding: 6px 11px; border-radius: 7px; cursor: pointer;
  border: 1px solid rgba(255,255,255,.35); color: #fff; background: rgba(255,255,255,.10);
  text-decoration: none; display: inline-flex; align-items: center; gap: 5px;
}
.hub-acts .hb:hover { background: rgba(255,255,255,.20); }
.hub-acts .hb.live { background: #1f7a4d; border-color: #1f7a4d; }
.hub-acts .hb.del  { background: #7a1f2b; border-color: #7a1f2b; }
.hub-paid { font-weight: 700; }

.tabs { display: flex; gap: 2px; border-bottom: 1px solid #e2e4ea; margin-top: 14px; flex-wrap: wrap; }
.tab {
  padding: 10px 14px; font-size: 13px; color: #6b7280; cursor: pointer;
  border: none; background: none; border-bottom: 2px solid transparent; font-family: inherit;
}
.tab.on { color: #3a1722; border-bottom-color: #3a1722; font-weight: 700; }
.tab:disabled, .tab.soon { color: #c2c5cc; cursor: not-allowed; }
.pane { padding: 16px 2px; }
.pane[hidden] { display: none; }

.ver {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px;
  border: 1px solid #ececf0; border-radius: 9px; margin-bottom: 8px; background: #fafafb;
}
.ver .vtag { font-weight: 700; font-size: 13px; min-width: 38px; }
.ver .vcur { background: #e7f6ee; color: #1f7a4d; border: 1px solid #b7e3ca; border-radius: 6px; padding: 1px 7px; font-size: 11px; font-weight: 700; }
.ver .vdate { color: #9ca3af; font-size: 12px; margin-left: auto; }
.ver .vlink { color: #2563eb; font-size: 13px; text-decoration: none; }
.ver .vlink:hover { text-decoration: underline; }
.pane-empty { color: #9ca3af; font-size: 14px; padding: 8px 2px; }
.pane-soon  { color: #9ca3af; font-size: 14px; padding: 18px 2px; font-style: italic; }

/* ── Credentials tab ──────────────────────────────────────────────── */
.cred-card { border: 1px solid #e6e7ec; border-radius: 10px; padding: 12px 14px; margin-bottom: 16px; }
.cred-card h4 { margin: 0 0 3px; font-size: 14px; }
.cred-hint { color: #9ca3af; font-size: 12px; margin: 0 0 10px; }
.cred-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.cred-grid label { display: block; font-size: 11px; color: #6b7280; font-weight: 600; }
.cred-grid input { width: 100%; box-sizing: border-box; margin-top: 3px; padding: 7px 9px; border: 1px solid #d7d9e0; border-radius: 6px; font-size: 13px; }
.cred-full { grid-column: 1 / -1; }
.cred-saverow { display: flex; justify-content: flex-end; margin-top: 10px; }
.cred-btn { background: #3a1722; color: #fff; border: none; border-radius: 7px; padding: 7px 13px; font-size: 13px; cursor: pointer; }
.cred-btn.ghost { background: #fff; color: #3a1722; border: 1px solid #d7d9e0; }

/* ── Login vault (credentials list) ───────────────────────────────── */
.vault-head { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 10px; }
.vault-head h4 { margin: 0; font-size: 14px; }
.vault-row { display: flex; align-items: center; gap: 10px; padding: 9px 11px; border: 1px solid #e6e7ec; border-radius: 9px; margin-bottom: 7px; background: #fafafb; }
.vault-ico { width: 24px; height: 24px; border-radius: 6px; background: #efe7ea; display: grid; place-items: center; font-size: 13px; }
.vault-who { min-width: 150px; }
.vault-svc { font-weight: 700; font-size: 12.5px; }
.vault-usr { color: #6b7280; font-size: 11.5px; }
.vault-pw { font-family: monospace; color: #6b7280; letter-spacing: 1px; }
.vault-pw.shown { color: #111; background: #fff3cd; padding: 1px 6px; border-radius: 4px; letter-spacing: 0; }
.vault-acts { margin-left: auto; display: flex; gap: 6px; }
.vault-mini { font-size: 11px; padding: 4px 8px; border-radius: 6px; border: 1px solid #d7d9e0; background: #fff; color: #374151; cursor: pointer; }
.vault-mini.rev { border-color: #3a1722; color: #3a1722; font-weight: 600; }
.vault-mini.del { border-color: #f0c2c2; color: #b3261e; }

/* ── Domain tab ───────────────────────────────────────────────────── */
.dom-status { font-size: 13px; margin: 4px 0 12px; }
.dom-status.ok { color: #1f7a4d; }
.dom-status.warn { color: #9a6b00; }
.dom-actions { display: flex; gap: 8px; }
.dom-result { margin-top: 12px; font-size: 13px; }
.dom-ok { color: #1f7a4d; }
.dom-bad { color: #9a6b00; }

/* ── Editor login form ─────────────────────────────────────────────── */
.el-row { display: flex; gap: 8px; align-items: center; }
.el-row input { flex: 1; padding: 7px 9px; border: 1px solid #d7d9e0; border-radius: 6px; font-size: 13px; }

/* ── Credential form modal (add/edit) ──────────────────────────────── */
.cf-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.45); display: grid; place-items: center; z-index: 50; }
.cf-modal { background: #fff; border-radius: 12px; padding: 18px 20px; width: min(440px, 92vw); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
.cf-modal h4 { margin: 0 0 12px; font-size: 15px; }
.cf-modal label { display: block; font-size: 12px; color: #374151; font-weight: 600; margin-bottom: 10px; }
.cf-modal input, .cf-modal select, .cf-modal textarea { width: 100%; box-sizing: border-box; margin-top: 3px; padding: 8px 10px; border: 1px solid #d7d9e0; border-radius: 7px; font-size: 13px; font-family: inherit; }
.cf-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 6px; }
.cf-err { color: #b3261e; font-size: 12px; margin-top: 8px; }

/* ── Products tab ─────────────────────────────────────────────────────── */
.shop-btn-row { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }

.prod-table-wrap { overflow-x: auto; margin-bottom: 14px; }
.prod-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.prod-table th { text-align: left; font-size: 11px; color: #6b7280; font-weight: 600; padding: 6px 8px; border-bottom: 2px solid #e6e7ec; white-space: nowrap; }
.prod-table td { padding: 7px 8px; border-bottom: 1px solid #f0f0ed; vertical-align: middle; }
.prod-table tr:last-child td { border-bottom: none; }
.prod-table tr:hover td { background: #fafafb; }
.prod-name { font-weight: 500; max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prod-price { font-family: monospace; font-size: 12px; }
.prod-status-sel { font-size: 12px; padding: 4px 6px; border: 1px solid #d7d9e0; border-radius: 5px; background: #fff; cursor: pointer; }
.prod-status-cell { white-space: nowrap; }
.prod-req { color: #b3261e; }

.prod-add-wrap, .prod-import-wrap { margin-top: 10px; }
.prod-add-wrap summary, .prod-import-wrap summary { list-style: none; cursor: pointer; display: inline-block; }
.prod-add-wrap summary::-webkit-details-marker,
.prod-import-wrap summary::-webkit-details-marker { display: none; }
.prod-add-form, .prod-import-form { margin-top: 12px; padding: 12px; background: #fafafb; border: 1px solid #e6e7ec; border-radius: 8px; }
.prod-import-form textarea { width: 100%; box-sizing: border-box; padding: 8px 10px; border: 1px solid #d7d9e0; border-radius: 6px; font-size: 13px; font-family: inherit; resize: vertical; }
.prod-fail-list { margin: 6px 0 0; padding-left: 18px; font-size: 12px; color: #b3261e; }

/* ── Provision shop card ───────────────────────────────────────────────── */
.provision-card { border-color: #d1d5db; background: #fafafa; }
.provision-status { margin-top: 10px; font-size: 13px; }
.provision-running { color: #374151; }
.provision-log { display: block; font-size: 11px; color: #6b7280; margin-top: 4px; font-family: monospace; }
.provision-ok { color: #1f7a4d; }
.provision-err { color: #b3261e; }
