/* ==========================================================================
   Find · find.fit2deploy.com
   f2dERP design language — centralized variables, no inline styles.
   ========================================================================== */

:root {
  /* Brand */
  --purple:        #6b3fd4;
  --purple-600:    #5a32bd;
  --purple-050:    #efeafb;
  --purple-ring:   rgba(107, 63, 212, 0.28);

  /* Light theme surfaces */
  --bg:            #f6f5fb;
  --surface:       #ffffff;
  --surface-2:     #faf9fe;
  --border:        #e6e3f0;
  --border-strong: #d5d0e6;

  /* Text */
  --text:          #1c1830;
  --text-2:        #5b566e;
  --text-muted:    #928da6;

  /* Feedback */
  --danger:        #d0433f;
  --danger-bg:     #fbeceb;
  --ok:            #2f9e6d;

  /* Tag hues */
  --mobile-bg:     #e7f0ff;  --mobile-fg:   #2c62c9;
  --landline-bg:   #eef7ee;  --landline-fg: #2f8a52;
  --tollfree-bg:   #f4eefb;  --tollfree-fg: #7a45c9;

  /* Shape */
  --radius:        12px;
  --radius-sm:     8px;
  --shadow:        0 1px 2px rgba(28, 24, 48, 0.05), 0 6px 20px rgba(28, 24, 48, 0.06);
  --font:          'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono:          ui-monospace, 'SF Mono', 'Cascadia Code', Menlo, monospace;
}

[data-theme="dark"] {
  --bg:            #14121c;
  --surface:       #1d1a29;
  --surface-2:     #241f34;
  --border:        #2f2a40;
  --border-strong: #3b3552;

  --text:          #eceaf4;
  --text-2:        #b3adc7;
  --text-muted:    #7b7592;

  --purple-050:    #251d3d;
  --danger-bg:     #3a1f22;

  --mobile-bg:     #1f2c47;  --mobile-fg:   #86b0ff;
  --landline-bg:   #1e3327;  --landline-fg: #7fd3a0;
  --tollfree-bg:   #2c2140;  --tollfree-fg: #c4a0ff;

  --shadow:        0 1px 2px rgba(0,0,0,0.3), 0 8px 24px rgba(0,0,0,0.35);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* --- Topbar --------------------------------------------------------------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 22px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 12px; }

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border-radius: 9px;
  background: var(--purple);
  color: #fff;
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0.5px;
}
.brand-name { font-weight: 700; font-size: 16px; }
.brand-tag {
  font-size: 12px;
  color: var(--text-muted);
  border-left: 1px solid var(--border);
  padding-left: 12px;
}

.credits-pill {
  font-size: 12px;
  font-weight: 600;
  color: var(--purple);
  background: var(--purple-050);
  padding: 5px 11px;
  border-radius: 999px;
}

.icon-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  width: 34px; height: 34px;
  border-radius: 9px;
  cursor: pointer;
  font-size: 15px;
  transition: background .15s, border-color .15s;
}
.icon-btn:hover { background: var(--surface-2); border-color: var(--border-strong); }

.text-link { color: var(--purple); text-decoration: none; font-weight: 500; }
.text-link:hover { text-decoration: underline; }

/* --- Layout --------------------------------------------------------------- */
.layout {
  display: grid;
  grid-template-columns: 268px 1fr;
  gap: 22px;
  max-width: 1240px;
  margin: 22px auto;
  padding: 0 22px;
  align-items: start;
}

/* --- Filters -------------------------------------------------------------- */
.filters {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 82px;
}
.filters-title {
  margin: 0 0 14px;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-muted);
}

.field { display: block; margin-bottom: 13px; }
.field-label {
  display: block;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-2);
  margin-bottom: 5px;
}
.field input[type="text"],
.field input[type="password"],
.field select {
  width: 100%;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field input:focus,
.field select:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-ring);
}

.check-group {
  display: flex;
  flex-direction: column;
  gap: 9px;
  margin: 14px 0 16px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}
.check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-2);
  cursor: pointer;
}
.check input { accent-color: var(--purple); width: 15px; height: 15px; }

/* --- Buttons -------------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 15px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: background .15s, border-color .15s, opacity .15s;
  white-space: nowrap;
}
.btn-block { width: 100%; margin-top: 8px; }
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-600); }
.btn-outline { background: var(--surface); color: var(--purple); border-color: var(--border-strong); }
.btn-outline:hover:not(:disabled) { border-color: var(--purple); background: var(--purple-050); }
.btn-ghost { background: transparent; color: var(--text-2); border-color: var(--border); }
.btn-ghost:hover { background: var(--surface-2); }
.btn:disabled, .btn.is-disabled {
  opacity: .45;
  cursor: not-allowed;
  pointer-events: none;
}

/* --- Results -------------------------------------------------------------- */
.results {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.results-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
}
.results-count { font-size: 14px; }
.results-count strong { font-size: 18px; }
.muted { color: var(--text-muted); font-weight: 400; }
.results-actions { display: flex; gap: 10px; }

/* --- Table ---------------------------------------------------------------- */
.table-wrap { overflow-x: auto; }
.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.grid thead th {
  text-align: left;
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 11px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
}
.grid tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.grid tbody tr:hover { background: var(--surface-2); }
.col-check { width: 38px; text-align: center; }
.col-check input { accent-color: var(--purple); width: 15px; height: 15px; }
.col-rating { text-align: right; white-space: nowrap; }

.cell-company { font-weight: 600; color: var(--text); }
.cell-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.mono { font-family: var(--mono); font-size: 12.5px; }

.tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  padding: 2px 7px;
  border-radius: 999px;
  margin-left: 6px;
  vertical-align: middle;
}
.tag-mobile   { background: var(--mobile-bg);   color: var(--mobile-fg); }
.tag-landline { background: var(--landline-bg); color: var(--landline-fg); }
.tag-tollfree { background: var(--tollfree-bg); color: var(--tollfree-fg); }

/* --- Pager ---------------------------------------------------------------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 16px;
}
.pager-info { font-size: 13px; color: var(--text-2); }

/* --- Empty / notes -------------------------------------------------------- */
.empty { padding: 54px 24px; text-align: center; }
.empty-title { font-size: 16px; font-weight: 600; margin: 0 0 6px; }
.empty-sub { color: var(--text-2); margin: 0 0 14px; }
.empty-code, .mono code {
  display: inline-block;
  font-family: var(--mono);
  font-size: 12.5px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  color: var(--purple);
}
.preview-note {
  padding: 14px 20px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  margin: 0;
}

/* --- Alerts --------------------------------------------------------------- */
.alert {
  padding: 11px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  margin-bottom: 14px;
}
.alert-error { background: var(--danger-bg); color: var(--danger); }

/* --- Login ---------------------------------------------------------------- */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
}
.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 30px;
  width: 100%;
  max-width: 360px;
}
.brand-lockup { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.login-title { margin: 0; font-size: 20px; }
.login-sub { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.login-form { display: block; }

/* --- Responsive ----------------------------------------------------------- */
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
  .filters { position: static; }
  .results-actions { width: 100%; }
  .results-actions .btn { flex: 1; }
}

/* Accessibility: honour reduced motion + keep focus visible */
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; }

/* ==========================================================================
   Control panel additions — nav, stats, panels, run log, saved searches
   ========================================================================== */

/* Primary nav in topbar */
.mainnav { display: flex; gap: 4px; margin-left: 8px; }
.navlink {
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: background .15s, color .15s;
}
.navlink:hover { background: var(--surface-2); color: var(--text); }
.navlink.is-active { background: var(--purple-050); color: var(--purple); font-weight: 600; }

/* Page container (Discover / Activity) */
.page {
  max-width: 1080px;
  margin: 22px auto;
  padding: 0 22px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Stat cards */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px 18px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-num { font-size: 24px; font-weight: 700; color: var(--text); line-height: 1.1; }
.stat-label { font-size: 12px; color: var(--text-muted); }

/* Panels */
.panel-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
}
.panel-title { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.panel-sub { margin: 0 0 16px; font-size: 13px; color: var(--text-2); }
.panel-note { margin: 14px 0 0; font-size: 12px; color: var(--text-muted); }

/* Forms inside panels */
.stack { display: flex; flex-direction: column; gap: 13px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field textarea {
  width: 100%;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  resize: vertical;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea:focus {
  border-color: var(--purple);
  box-shadow: 0 0 0 3px var(--purple-ring);
}
.panel .btn { align-self: flex-start; }

/* Run log */
.run-log {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.run-log-title {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
}
.run-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  font-size: 13px;
  border-bottom: 1px dashed var(--border);
}
.run-row:last-child { border-bottom: 0; }
.run-q { flex: 1; color: var(--text); }
.run-status { font-weight: 600; color: var(--text-2); }
.run-status.ok { color: var(--ok); }
.run-status.err { color: var(--danger); }
.run-msg { flex-basis: 100%; font-size: 12px; color: var(--danger); }

/* Tag variants for statuses */
.tag-ok  { background: var(--landline-bg); color: var(--landline-fg); }
.tag-err { background: var(--danger-bg);   color: var(--danger); }

/* Saved searches (sidebar + activity) */
.saved-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
}
.saved-empty { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; }
.saved-list { list-style: none; margin: 0 0 14px; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.saved-list.wide { gap: 8px; }
.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 7px 10px;
}
.saved-link { color: var(--purple); text-decoration: none; font-size: 13px; font-weight: 500; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.saved-link:hover { text-decoration: underline; }
.saved-del-form { margin: 0; line-height: 0; }
.saved-del {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 17px;
  line-height: 1;
  padding: 0 2px;
}
.saved-del:hover { color: var(--danger); }
.saved-save-form { display: flex; flex-direction: column; gap: 8px; }
.saved-save-form input[type="text"] {
  width: 100%;
  padding: 9px 11px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
}
.saved-save-form input[type="text"]:focus { border-color: var(--purple); box-shadow: 0 0 0 3px var(--purple-ring); }

/* Alert variants */
.alert-ok { background: var(--landline-bg); color: var(--landline-fg); }
.alert-inline { margin: 16px 20px 0; }

/* Responsive for control panel */
@media (max-width: 860px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .panel-grid { grid-template-columns: 1fr; }
  .row2 { grid-template-columns: 1fr; }
  .mainnav { margin-left: 0; }
  .brand-tag { display: none; }
}
