/* hyperlocai admin — shared styles */

:root {
  --bg:        #f7f8fa;
  --surface:   #ffffff;
  --border:    #e6e8ec;
  --text:      #1a1d24;
  --muted:     #6b7280;
  --accent:    #2563eb;
  --accent-hover: #1d4ed8;
  --danger:    #dc2626;
  --success:   #16a34a;
  --warning:   #d97706;
  --radius:    8px;
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  padding: 0;
  font-size: 14px;
  line-height: 1.5;
}

.shell { max-width: 1080px; margin: 0 auto; padding: 24px; }

/* ── Top nav ─────────────────────────────────────────────────────── */
.topnav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.topnav a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
  padding: 6px 10px;
  border-radius: 6px;
}
.topnav a:hover { background: var(--bg); }
.topnav .brand { font-weight: 700; color: var(--accent); }
.topnav .spacer { flex: 1; }
.topnav .user { color: var(--muted); font-size: 13px; }
.topnav button {
  background: none;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 12px;
  font: inherit;
  cursor: pointer;
  color: var(--text);
}
.topnav button:hover { background: var(--bg); }

/* ── Page headers ────────────────────────────────────────────────── */
.page-header {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 20px;
}
.page-header h1 { font-size: 22px; margin: 0; }
.page-header .spacer { flex: 1; }

/* ── Buttons ─────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
}
.btn:hover { background: var(--bg); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

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

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

/* ── Cards / panels ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
}
.card h2 {
  font-size: 16px;
  margin: 0 0 12px;
  font-weight: 600;
}
.card .subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-top: -4px;
  margin-bottom: 16px;
}

/* ── Forms ───────────────────────────────────────────────────────── */
.field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 14px;
}
.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}
.field .hint {
  font-size: 12px;
  color: var(--muted);
}
.field input[type=text],
.field input[type=email],
.field input[type=tel],
.field input[type=number],
.field input[type=url],
.field select,
.field textarea {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 8px 10px;
  font: inherit;
  background: var(--surface);
  color: var(--text);
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.field textarea { resize: vertical; min-height: 80px; }

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

/* ── Tables ──────────────────────────────────────────────────────── */
.table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.table th, .table td {
  text-align: left;
  padding: 10px 14px;
  font-size: 13px;
}
.table th {
  background: var(--bg);
  font-weight: 600;
  color: var(--muted);
  border-bottom: 1px solid var(--border);
}
.table tr { border-bottom: 1px solid var(--border); }
.table tr:last-child { border-bottom: none; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover { background: var(--bg); }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  background: var(--bg);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.badge-success { background: #d1fae5; color: var(--success); }
.badge-warning { background: #fef3c7; color: var(--warning); }
.badge-info    { background: #dbeafe; color: var(--accent); }
.badge-danger  { background: #fee2e2; color: var(--danger); }
.badge-neutral { background: var(--bg); color: var(--muted); }

/* ── Alerts ──────────────────────────────────────────────────────── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
  margin-bottom: 14px;
  font-size: 13px;
}
.alert-error   { border-color: #fecaca; background: #fef2f2; color: #991b1b; }
.alert-success { border-color: #a7f3d0; background: #ecfdf5; color: #065f46; }
.alert-info    { border-color: #bfdbfe; background: #eff6ff; color: #1e40af; }

/* ── Steps / wizard ──────────────────────────────────────────────── */
.steps {
  display: flex;
  gap: 0;
  margin-bottom: 24px;
}
.steps .step {
  flex: 1;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-align: center;
  font-size: 13px;
  color: var(--muted);
  position: relative;
}
.steps .step:first-child { border-radius: var(--radius) 0 0 var(--radius); }
.steps .step:last-child  { border-radius: 0 var(--radius) var(--radius) 0; }
.steps .step + .step { border-left: none; }
.steps .step.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
  font-weight: 600;
}
.steps .step.done {
  background: #ecfdf5;
  color: var(--success);
  border-color: #a7f3d0;
}

/* ── Login page (centered card) ──────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.login-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
}
.login-card h1 {
  margin: 0 0 4px;
  font-size: 20px;
}
.login-card .subtitle {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 20px;
}

/* ── Empty state ─────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 60px 20px;
  color: var(--muted);
}
.empty h3 { color: var(--text); margin: 0 0 4px; }
.empty p { margin: 0 0 16px; }

/* ── Misc ────────────────────────────────────────────────────────── */
code, pre {
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12px;
}
pre.codeblock {
  background: #0f172a;
  color: #e2e8f0;
  padding: 12px 16px;
  border-radius: var(--radius);
  overflow-x: auto;
}
.muted { color: var(--muted); }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 8px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.hide { display: none !important; }

/* ── Tabs ────────────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tabs .tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font: inherit;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
  margin-bottom: -1px;
}
.tabs .tab:hover { color: var(--text); }
.tabs .tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ── Icon buttons (delete, etc.) ─────────────────────────────────── */
.icon-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 14px;
  cursor: pointer;
  line-height: 1;
}
.icon-btn:hover { background: var(--bg); border-color: var(--border); }
.icon-btn.danger:hover { background: #fef2f2; border-color: #fecaca; }

/* ── Transcript blocks (voicemail / AI call) ─────────────────────── */
.transcript-block {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  margin-bottom: 10px;
  font-size: 13px;
  white-space: pre-wrap;
}
.transcript-block:last-child { margin-bottom: 0; }

/* ── SMS thread ──────────────────────────────────────────────────── */
.sms-thread { display: flex; flex-direction: column; gap: 8px; }
.sms-row { display: flex; flex-direction: column; max-width: 80%; }
.sms-row.in  { align-self: flex-start; align-items: flex-start; }
.sms-row.out { align-self: flex-end;   align-items: flex-end; }
.sms-bubble {
  padding: 8px 12px;
  border-radius: 14px;
  font-size: 13px;
  white-space: pre-wrap;
  word-break: break-word;
}
.sms-row.in  .sms-bubble { background: var(--bg); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.sms-row.out .sms-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.sms-meta { font-size: 11px; margin-top: 2px; }

/* ── Conversion checklist ────────────────────────────────────────── */
.checklist { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.checklist li { padding: 4px 0; }
.checklist li.done { color: var(--success); }
.checklist li.todo { color: var(--muted); }

/* ── Per-event AI read (inside transcript blocks) ────────────────── */
.ai-note {
  margin-top: 8px;
  padding: 6px 10px;
  background: #eff6ff;
  border-left: 3px solid var(--accent);
  border-radius: 4px;
  font-size: 12.5px;
  color: #1e3a5f;
}
.ai-note-label {
  font-weight: 600;
  color: var(--accent);
  margin-right: 4px;
}

/* ── Service-list editor (stacked list) ──────────────────────────── */
.service-editor { margin-top: 4px; }
.service-editor .se-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.service-editor .se-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  font-size: 14px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.service-editor .se-item:last-child { border-bottom: none; }
.service-editor .se-item:nth-child(even) { background: #fafbfc; }
.service-editor .se-item-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
}
.service-editor .se-item-x {
  border: 1px solid var(--border);
  background: #fff;
  color: #b91c1c;
  font-size: 12px;
  line-height: 1;
  cursor: pointer;
  padding: 5px 11px;
  border-radius: 6px;
  white-space: nowrap;
}
.service-editor .se-item-x:hover { background: #fef2f2; border-color: #fca5a5; }
.service-editor .se-add {
  display: flex;
  gap: 8px;
}
.service-editor .se-input {
  flex: 1;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
}
.service-editor .se-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: -1px;
  border-color: var(--accent);
}
.service-editor .se-add-btn { white-space: nowrap; }
.service-editor .se-empty {
  margin: 8px 0 0;
  font-size: 12px;
  color: var(--muted);
}

/* Read-only services list shown in the onboarding activation summary */
.service-summary {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}
.service-summary .se-sum-item {
  padding: 8px 12px;
  font-size: 13px;
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.service-summary .se-sum-item:last-child { border-bottom: none; }
.service-summary .se-sum-item:nth-child(even) { background: #fafbfc; }

/* ── Small button + danger-ghost (row actions) ───────────────────── */
.btn-sm {
  padding: 5px 11px;
  font-size: 12px;
  line-height: 1;
}
.btn-danger-ghost {
  background: #fff;
  color: var(--danger);
  border-color: var(--border);
}
.btn-danger-ghost:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

/* ── Modal (confirmation dialog) ─────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}
.modal-overlay.hide { display: none; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  max-width: 440px;
  width: 100%;
  padding: 22px 22px 18px;
  box-shadow: 0 18px 48px rgba(0, 0, 0, 0.22);
}
.modal h3 { margin: 0 0 8px; font-size: 17px; }
.modal p { margin: 0 0 12px; color: var(--muted); font-size: 14px; line-height: 1.5; }
.modal .modal-warn {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  border-radius: 6px;
  padding: 10px 12px;
  font-size: 13px;
  margin-bottom: 16px;
}
.modal .modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}
