/* Novisly app — design system aligned with the marketing site (website/assets/css/styles.css) */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

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

:root {
  /* brand palette */
  --blue:       #2b3a8f;
  --blue-700:   #1f2a6b;
  --blue-500:   #3a4bbf;
  --blue-tint:  rgba(58,75,191,0.12);
  --green:      #3cc66b;
  --green-600:  #2fae5b;
  --green-tint: rgba(60,198,107,0.14);

  /* semantic roles
     brand  = structural accent (focus, links, info)
     accent = primary action / "on" state (CTAs, toggles, active nav) */
  --brand:         var(--blue);
  --brand-strong:  var(--blue-700);
  --brand-tint:    var(--blue-tint);
  --accent:        var(--green);
  --accent-strong: var(--green-600);
  --accent-tint:   var(--green-tint);
  --accent-ink:    #06301a;   /* readable text on the green accent */

  --sidebar-w: 220px;
  --sidebar-bg: #0e1430;      /* brand navy (matches marketing footer) */
  --text: #111827;
  --text-muted: #475569;
  --border: #e5e9f2;
  --bg: #f6f8fc;
  --card: #ffffff;
  --success: #2fae5b;
  --danger: #cf222e;
  --warning: #b45309;
  --radius: 12px;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  background: var(--sidebar-bg);
  color: #ccc;
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0; left: 0; bottom: 0;
  z-index: 100;
}

#sidebar .logo {
  padding: 20px 20px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
#sidebar .logo .logo-img {
  height: 26px;
  width: auto;
  display: block;
  margin-bottom: 7px;
  filter: brightness(0) invert(1);   /* render the brand mark in white on the navy sidebar */
}
#sidebar .logo h2 {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
#sidebar .logo span {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

#sidebar nav {
  flex: 1;
  padding: 12px 0;
}

#sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  color: #aaa;
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
  border-left: 3px solid transparent;
}
#sidebar nav a:hover { background: rgba(255,255,255,0.05); color: #fff; }
#sidebar nav a.active {
  color: #fff;
  background: rgba(60,198,107,0.15);
  border-left-color: var(--accent);
}
#sidebar nav a .icon { font-size: 16px; width: 20px; text-align: center; }

#sidebar .nav-footer {
  border-top: 1px solid rgba(255,255,255,0.08);
}
#sidebar .portal-badge {
  padding: 14px 20px 6px;
  font-size: 11px;
  color: #888;
  font-weight: 600;
  word-break: break-all;
}
#sidebar .nav-logout {
  display: block;
  padding: 4px 20px 16px;
  font-size: 12px;
  color: #777;
  text-decoration: none;
}
#sidebar .nav-logout:hover { color: var(--accent); }

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

.page-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 20px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.page-header h1 { font-size: 18px; font-weight: 700; }
.page-header p  { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

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

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 24px;
  margin-bottom: 20px;
}
.card-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 16px;
}

/* ── Stat tiles ──────────────────────────────────────────────────────────── */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}
.stat-tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.stat-tile .value { font-size: 28px; font-weight: 700; }
.stat-tile .label { font-size: 12px; color: var(--text-muted); margin-top: 4px; }

/* ── Tables ──────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; padding: 10px 14px; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.4px; border-bottom: 2px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: #fafafa; }

/* ── Badges ──────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}
.badge-green  { background: #d1fadf; color: #14532d; }
.badge-red    { background: #fee2e2; color: #7f1d1d; }
.badge-orange { background: #fef3c7; color: #b45309; }
.badge-blue   { background: #dbeafe; color: #1e3a5f; }
.badge-gray   { background: #f3f4f6; color: #374151; }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, opacity 0.15s;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary  { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled)  { background: var(--accent-strong); }
.btn-secondary { background: #fff; color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: #f5f5f5; }
.btn-danger   { background: #fff; color: var(--danger); border-color: #fca5a5; }
.btn-danger:hover:not(:disabled)   { background: #fee2e2; }
.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 700; color: #444; margin-bottom: 5px; }
.form-group small { display: block; margin-top: 4px; color: var(--text-muted); font-size: 11px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=tel], input[type=url], input[type=search], select, textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-tint);
}
select { cursor: pointer; }

/* ── Form layout helpers ─────────────────────────────────────────────────── */
.form-row { display: flex; gap: 12px; }
.form-row > .form-group { flex: 1; }

/* ── Collapsible modal sections ──────────────────────────────────────────── */
.form-section { border: 1px solid var(--border); border-radius: 8px; margin-bottom: 14px; }
.form-section > summary {
  list-style: none; cursor: pointer; padding: 12px 14px;
  font-size: 13px; font-weight: 700; color: #444;
  display: flex; align-items: center; justify-content: space-between;
}
.form-section > summary::-webkit-details-marker { display: none; }
.form-section > summary::after { content: '▸'; color: #999; transition: transform .15s; }
.form-section[open] > summary::after { transform: rotate(90deg); }
.form-section[open] > summary { border-bottom: 1px solid var(--border); }
.form-section .section-body { padding: 14px; }
.form-section .form-group:last-child { margin-bottom: 0; }

/* ── Structured-data builder ─────────────────────────────────────────────── */
.sd-toggle { display: inline-flex; border: 1px solid var(--border); border-radius: 6px; overflow: hidden; margin-bottom: 10px; }
.sd-toggle button { background: #fff; border: none; padding: 6px 14px; font-size: 12px; cursor: pointer; color: var(--text-muted); }
.sd-toggle button.active { background: var(--accent-tint); color: var(--accent-strong); font-weight: 700; }
.sd-row { display: flex; gap: 8px; margin-bottom: 8px; align-items: center; }
.sd-row input { margin: 0; }
.sd-row .sd-name { flex: 0 0 38%; }
.sd-row .sd-desc { flex: 1; }
.sd-row .sd-del { flex: 0 0 auto; background: none; border: none; color: var(--danger); cursor: pointer; font-size: 16px; padding: 0 4px; }

/* ── Post-call action builder ────────────────────────────────────────────── */
.action-row {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
  background: #fafafa;
}
.action-row-head { display: flex; gap: 8px; align-items: center; margin-bottom: 10px; }
.action-row-head select { flex: 1; }
.action-row .sub { margin-bottom: 8px; }
.action-row .sub:last-child { margin-bottom: 0; }
.action-row label { display: block; font-size: 11px; font-weight: 700; color: #555; margin-bottom: 4px; }
.action-row textarea { min-height: 54px; resize: vertical; font-family: inherit; }
.cond-row { display: flex; gap: 8px; align-items: center; }
.token-hint { font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.5; }
.token-hint code { background: #eee; padding: 1px 4px; border-radius: 3px; }
.token-chips { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; align-items: center; }
.token-chips .chips-label { font-size: 11px; color: var(--text-muted); margin-right: 2px; }
.token-chip {
  background: #eef1f6; border: 1px solid var(--border); border-radius: 4px;
  padding: 2px 7px; font-size: 11px; font-family: ui-monospace, Menlo, Consolas, monospace;
  color: #334; cursor: pointer;
}
.token-chip:hover { background: var(--brand-tint); border-color: var(--brand); color: var(--brand-strong); }
.token-chip.is-field { background: #e7f5ec; border-color: #b6e0c4; color: #1a7f37; }
.token-chip.is-field:hover { background: #d1fadf; }
.actions-empty { font-size: 12px; color: var(--text-muted); padding: 6px 0 10px; }

/* ── Modal ───────────────────────────────────────────────────────────────── */
.modal-backdrop {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.4);
  z-index: 200;
  align-items: center;
  justify-content: center;
}
.modal-backdrop.open { display: flex; }
.modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
}
.modal-header {
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 { font-size: 16px; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; font-size: 20px; color: #888; padding: 0 4px; }
.modal-body  { padding: 20px 24px; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border); display: flex; gap: 10px; justify-content: flex-end; }

/* ── Drawer variant: right-anchored half-screen panel ────────────────────── */
.modal-backdrop.drawer { justify-content: flex-end; align-items: stretch; }
.modal-backdrop.drawer .modal {
  width: 50vw;
  min-width: 520px;          /* never narrower than the old modal */
  max-width: none;
  height: 100vh;
  max-height: 100vh;
  border-radius: 0;
  box-shadow: -20px 0 60px rgba(0,0,0,0.25);
  display: flex;
  flex-direction: column;
  overflow: hidden;          /* header/footer fixed, body scrolls */
  animation: drawer-in 0.18s ease-out;
}
.modal-backdrop.drawer .modal-body { flex: 1; overflow-y: auto; }
@keyframes drawer-in { from { transform: translateX(28px); opacity: 0.5; } to { transform: none; opacity: 1; } }

@media (max-width: 780px) {
  .modal-backdrop.drawer .modal { width: 100vw; min-width: 0; }
}

/* ── Alerts ──────────────────────────────────────────────────────────────── */
.alert { padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }
.alert-success { background: #d1fadf; color: #14532d; }
.alert-error   { background: #fee2e2; color: #7f1d1d; }
.alert-info    { background: #dbeafe; color: #1e3a5f; }

/* ── Checklist ───────────────────────────────────────────────────────────── */
.checklist { list-style: none; }
.checklist li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.checklist li:last-child { border-bottom: none; }
.check-icon { font-size: 16px; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 12px; }
.empty-state p { font-size: 14px; }

/* ── Pagination ──────────────────────────────────────────────────────────── */
.pagination { display: flex; align-items: center; gap: 8px; margin-top: 16px; justify-content: flex-end; }
.pagination span { font-size: 13px; color: var(--text-muted); }

/* ── Toggle switch ───────────────────────────────────────────────────────── */
.toggle { position: relative; display: inline-block; width: 36px; height: 20px; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0;
  background: #ccc; border-radius: 20px; cursor: pointer; transition: 0.2s;
}
.toggle-slider::before {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  left: 3px; top: 3px;
  background: #fff; border-radius: 50%; transition: 0.2s;
}
.toggle input:checked + .toggle-slider { background: var(--accent); }
.toggle input:checked + .toggle-slider::before { transform: translateX(16px); }

/* ── Loading spinner ─────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
  vertical-align: middle;
}
@keyframes spin { to { transform: rotate(360deg); } }

hr { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── Auth pages ──────────────────────────────────────────────────────────── */
.auth-logo { display: block; height: 34px; width: auto; margin-bottom: 24px; }
