/* ── Professional pass — fonts, sidebar, favicon, polish ─────────────────────
   Loaded last. Overrides and enhances the existing design system with a
   more professional typography, refined sidebar, and polished components.     */

/* ══ Typography ═══════════════════════════════════════════════════════════ */
:root {
  --font: 'Inter', 'Plus Jakarta Sans', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Plus Jakarta Sans', 'Inter', ui-sans-serif, system-ui, sans-serif;
  --mono: 'Geist Mono', 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
}

body {
  font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
}

/* ══ Sidebar — compact & clean ═══════════════════════════════════════════ */
.dash-side {
  background: var(--side-bg);
  border-right: 1px solid var(--line-soft);
  padding: 0.75rem 0.6rem;
  gap: 0;
}

.side-brand {
  margin: 0 0 0.8rem;
  padding: 0 0.4rem;
}

.brand-link {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  text-decoration: none !important;
  color: var(--txt) !important;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1rem;
  letter-spacing: -0.01em;
}

.brand-link img {
  width: 24px;
  height: 24px;
  border-radius: 6px;
}

.side-user {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.55rem;
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  background: var(--row);
  text-decoration: none !important;
  color: var(--txt) !important;
  margin-bottom: 0.75rem;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.side-user:hover {
  border-color: var(--acc-line);
  background: var(--acc-soft);
}

.side-avatar {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  padding: 1.5px;
  background: linear-gradient(135deg, var(--acc), var(--acc-2));
  flex: none;
}

.side-avatar img {
  border-radius: 6.5px;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.side-user-name {
  font-weight: 600;
  font-size: 0.85rem;
  line-height: 1.2;
}

.side-user-handle {
  color: var(--muted);
  font-size: 0.72rem;
  line-height: 1.2;
}

.u-role {
  font-size: 0.55rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 0.12rem 0.35rem;
  border-radius: 4px;
  background: var(--acc-soft);
  color: var(--acc);
  border: 1px solid var(--acc-line);
  margin-left: auto;
  flex: none;
}

.side-label {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
  padding: 0.7rem 0.5rem 0.3rem;
  font-weight: 700;
  opacity: 0.6;
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 1px;
  flex: 1;
  align-content: start;
  padding-bottom: 0.5rem;
}

.side-nav a {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.42rem 0.55rem;
  border-radius: 8px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  border: 1px solid transparent;
  transition: background 0.12s ease, color 0.12s ease;
}

.side-nav a .ico {
  width: 15px;
  height: 15px;
  opacity: 0.7;
  flex: none;
  transition: color 0.12s ease, opacity 0.12s ease;
}

.side-nav a:hover {
  color: var(--txt);
  background: var(--row);
}

.side-nav a:hover .ico {
  opacity: 1;
  color: var(--acc);
}

.side-nav a.active {
  color: var(--txt);
  background: var(--acc-soft);
  border-color: var(--acc-line);
  font-weight: 600;
}

.side-nav a.active::before {
  content: '';
  position: absolute;
  left: 0.25rem;
  top: 20%;
  bottom: 20%;
  width: 2.5px;
  border-radius: 2px;
  background: var(--acc);
}

.side-nav a.active .ico {
  color: var(--acc);
  opacity: 1;
}

.nav-badge {
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 0.1rem 0.3rem;
  border-radius: 4px;
  background: var(--warn-soft, rgba(255, 180, 84, 0.14));
  color: var(--warn, #ffb454);
  border: 1px solid var(--warn-line, rgba(255, 180, 84, 0.32));
  text-transform: uppercase;
  margin-left: auto;
}

/* Side search - compact */
.side-search {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.55rem;
  margin-bottom: 0.5rem;
  border-radius: 8px;
  border: 1px solid var(--line-soft);
  background: var(--field-bg);
  transition: border-color 0.15s ease;
}

.side-search:focus-within {
  border-color: var(--acc-line);
}

.side-search .ico {
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex: none;
}

.side-search input {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--txt);
  font-size: 0.8rem;
  outline: none;
  font-family: var(--font);
}

.side-search input::placeholder {
  color: var(--muted);
  font-size: 0.8rem;
}

/* Side foot - compact */
.side-foot {
  padding-top: 0.5rem;
  border-top: 1px solid var(--line-soft);
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.side-mini {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.38rem 0.55rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}

.side-mini:hover {
  background: var(--row);
  color: var(--txt);
}

.side-danger:hover {
  background: rgba(255, 92, 122, 0.1);
  color: var(--bad);
}

/* Side foot */
.side-foot {
  padding-top: 0.8rem;
  border-top: 1px solid var(--line-soft);
  margin-top: auto;
}

.side-mini {
  padding: 0.55rem 0.75rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.18s ease;
}

.side-mini:hover {
  background: var(--row);
  color: var(--txt);
  transform: translateX(2px);
}

.side-danger:hover {
  background: rgba(255, 92, 122, 0.1);
  color: var(--bad);
}

/* ══ Professional polish ═══════════════════════════════════════════════════ */

/* Better focus rings */
:focus-visible {
  outline: 2px solid var(--acc);
  outline-offset: 2px;
  border-radius: 6px;
  box-shadow: 0 0 0 4px var(--acc-soft);
}

/* Smooth scrolling */
html {
  scroll-behavior: smooth;
}

/* Card hover - subtle, no layout shift */
.card, .acard, .panel-window {
  transition: box-shadow 0.25s ease,
              border-color 0.25s ease;
}

.card:hover, .acard:hover {
  border-color: var(--acc-line);
  box-shadow: 0 4px 16px -4px var(--acc-glow);
}

/* Better buttons */
.btn {
  font-weight: 600;
  letter-spacing: -0.01em;
  transition: all 0.2s cubic-bezier(0.22, 1, 0.36, 1);
}

.btn-primary {
  background: linear-gradient(135deg, var(--acc), var(--acc-grad-end));
  box-shadow: 0 4px 16px -4px var(--acc-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px -6px var(--acc-glow);
}

/* Better topbar */
.dash-top {
  backdrop-filter: blur(20px) saturate(1.6);
  -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-bottom: 1px solid var(--line);
}

.dash-title {
  font-family: var(--font-display);
  font-weight: 700;
  letter-spacing: -0.025em;
}

/* Better search */
.top-search {
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--field-bg);
  padding: 0.45rem 0.85rem;
  transition: all 0.2s ease;
}

.top-search:hover {
  border-color: var(--acc-line);
  background: var(--acc-soft);
}

/* Better user avatar in topbar */
.top-user {
  border-radius: 10px;
  padding: 0.3rem 0.7rem;
  border: 1px solid var(--line);
  transition: all 0.2s ease;
}

.top-user:hover {
  border-color: var(--acc-line);
  background: var(--acc-soft);
}

/* ══ Responsive ═══════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .dash-shell {
    grid-template-columns: 1fr;
  }
  
  .dash-side {
    position: fixed;
    left: 0;
    top: 0;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.22, 1, 0.36, 1);
  }
  
  body.side-open .dash-side {
    transform: translateX(0);
  }
}

/* ══ Securing page fix ═════════════════════════════════════════════════════ */
.secure-run .card-head,
.secure-run {
  min-width: 0;
}

.secure-layout {
  display: grid;
  grid-template-columns: minmax(0, 260px) minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  width: 100%;
}

.secure-layout > * {
  min-width: 0;
  overflow: hidden;
}

.pick-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pick-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: inherit;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
  width: 100%;
}

.pick-item:hover {
  border-color: var(--acc-line);
}

.pick-item.active {
  border-color: var(--acc);
  background: var(--acc-soft);
}

.pick-item .ico {
  width: 16px;
  height: 16px;
  color: var(--acc);
  opacity: 0;
}

.pick-item.active .ico {
  opacity: 1;
}

.pick-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.pick-body strong {
  font-size: 14px;
}

.pick-body em {
  font-size: 11.5px;
  color: var(--muted);
  font-style: normal;
}

.secure-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.secure-form .field {
  margin-bottom: 12px;
}

.secure-form-col {
  min-width: 0;
}

.secure-results {
  min-width: 0;
}

.stat-rail {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.domain-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 11px 12px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  margin-bottom: 12px;
}

.domain-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.domain-row .input,
.domain-row select.input {
  max-width: 190px;
}

.job-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 460px;
  overflow-y: auto;
}

.job-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 26px 16px;
  border: 1px dashed var(--line);
  border-radius: 12px;
  text-align: center;
  color: var(--muted);
}

@media (max-width: 900px) {
  .secure-layout {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .secure-results {
    grid-column: 1 / -1;
    position: static;
  }
}

@media (max-width: 760px) {
  .secure-layout {
    grid-template-columns: minmax(0, 1fr);
  }
  .pick-list {
    max-height: 200px;
    overflow-y: auto;
  }
  .domain-block {
    flex-direction: column;
  }
}

/* ══ Command builder ══════════════════════════════════════════════════════ */
.cmd-builder {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.cmd-preview {
  grid-column: 1 / -1;
  margin-top: 0.5rem;
}

.cmd-preview .embed-preview {
  max-width: 480px;
}

.cmd-builder-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.cmd-builder-list {
  min-width: 0;
}

.cmd-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.cmd-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--row);
  transition: border-color 0.15s ease;
}

.cmd-item:hover {
  border-color: var(--acc-line);
}

.cmd-item-name {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--acc);
}

.cmd-item-desc {
  font-size: 0.8rem;
  color: var(--muted);
}

.cmd-item-actions {
  display: flex;
  gap: 0.35rem;
  flex: none;
}

@media (max-width: 768px) {
  .cmd-builder {
    grid-template-columns: 1fr;
  }
}

/* ══ Print ═══════════════════════════════════════════════════════════════ */
@media print {
  .dash-side, .dash-top, .side-foot {
    display: none;
  }
}

/* ── Sidebar refinement pass (loaded last, so these win) ──────────────── */
.dash-side { padding: 1rem 0.85rem 1rem 0.95rem; }
.side-brand { padding: 0.1rem 0.15rem 0.9rem; }
.brand-link { align-items: center; }

.side-search {
  display: flex; align-items: center; gap: 0.5rem;
  margin: 0 0 0.55rem; padding: 0.42rem 0.65rem;
  border: 1px solid var(--line-soft); border-radius: 10px;
  background: var(--field-bg);
  transition: border-color var(--dur) var(--ease), box-shadow var(--dur) var(--ease), background var(--dur) var(--ease);
}
.side-search .ico { width: 14px; height: 14px; opacity: 0.55; flex: none; }
.side-search:focus-within {
  border-color: var(--acc-line);
  background: var(--panel);
  box-shadow: 0 0 0 3px var(--acc-glow, rgba(94, 234, 212, 0.14));
}
.side-search:focus-within .ico { opacity: 1; color: var(--acc); }
.side-search input { flex: 1; min-width: 0; border: none; background: none; outline: none; font: inherit; font-size: 0.82rem; color: var(--txt); }
.side-search input::placeholder { color: var(--muted); opacity: 0.8; }

.side-user {
  border: 1px solid var(--line-soft); border-radius: 12px;
  padding: 0.5rem 0.55rem; margin-bottom: 0.35rem;
  background: var(--panel);
  transition: border-color var(--dur) var(--ease), background var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.side-user:hover { border-color: var(--acc-line); background: var(--acc-soft); transform: translateY(-1px); }

.side-label {
  font-size: 0.6rem; letter-spacing: 0.16em; font-weight: 700;
  color: var(--muted); opacity: 0.55;
  padding: 1.05rem 0.6rem 0.35rem;
}
.side-label:first-child { padding-top: 0.5rem; }

.side-nav { gap: 2px; }
.side-nav a {
  gap: 0.6rem;
  padding: 0.46rem 0.6rem 0.46rem 0.75rem;
  border-radius: 9px;
  font-size: 0.85rem; font-weight: 520;
  transition: background var(--dur) var(--ease), color var(--dur) var(--ease),
    border-color var(--dur) var(--ease), transform var(--dur) var(--ease);
}
.side-nav a .ico { width: 16px; height: 16px; opacity: 0.65; }
.side-nav a:hover { transform: translateX(2px); }
.side-nav a:hover .ico { opacity: 1; color: var(--acc); }
.side-nav a.active {
  background: linear-gradient(90deg, var(--acc-soft), transparent 145%);
  border-color: var(--acc-line);
  font-weight: 600;
  box-shadow: inset 0 0 0 1px rgba(94, 234, 212, 0.06);
}
.side-nav a.active::before {
  left: 0.3rem; top: 22%; bottom: 22%; width: 3px; border-radius: 3px;
  background: var(--acc);
  box-shadow: 0 0 10px var(--acc-glow, rgba(94, 234, 212, 0.45));
}
.side-nav a .nav-txt { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-nav a .nav-badge {
  margin-left: auto; font-size: 0.52rem; font-weight: 700; letter-spacing: 0.06em;
  padding: 0.12rem 0.34rem; border-radius: 999px;
}
.side-nav a.active .nav-badge { color: var(--acc); border-color: var(--acc-line); background: var(--acc-soft); }
.side-nav a:focus-visible, .side-mini:focus-visible { outline: 2px solid var(--acc-line); outline-offset: 2px; }

.side-mini { border-radius: 9px; transition: background var(--dur) var(--ease), color var(--dur) var(--ease); }
.side-mini:hover { color: var(--txt); background: var(--row); }

@media (max-width: 860px) {
  .dash-side { padding: 0.8rem 0.7rem; }
}

/* ── Embed editor: give the "Editing" line room, stop the collision ───── */
.embed-workbench { gap: 2.25rem; }
.embed-fields > p.muted.small {
  display: flex; flex-wrap: wrap; align-items: baseline;
  gap: 0.25rem 0.55rem; margin: 0 0 0.15rem; line-height: 1.45;
}
.embed-fields #embed-customized-note {
  padding: 0.1rem 0.45rem; border-radius: 999px;
  border: 1px solid var(--line-soft); background: var(--panel);
  font-size: 0.72rem;
}
.embed-fields #embed-dirty { margin-left: 0.15rem; }
.field-head { min-width: 0; }
.field-head > span:first-child { min-width: 0; }
@media (max-width: 1080px) {
  .embed-workbench { gap: 1.4rem; }
}

/* ── Overview page pass ─────────────────────────────────────────────────── */
.overview-page .hero-body { padding: 26px 28px; gap: 24px; }
.overview-page .hero-eyebrow { margin-bottom: 14px; }
.overview-page .hero-title { margin-bottom: 10px; }
.overview-page .hero-sub { max-width: 620px; }

.overview-page .panel-2 > .card { display: flex; flex-direction: column; }
.overview-page .panel-2 .donut-wrap { flex: 1; align-content: center; }

.overview-page .overview-lists { align-items: start; }
.overview-page .overview-lists .card-head { padding: 15px 18px; }
.overview-page .overview-lists .empty {
  margin: 14px 16px 16px;
  padding: 34px 20px;
  border-radius: 12px;
}

.overview-page .ov-bots {
  max-height: 384px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}
.overview-page .ov-bots .table thead th { background: var(--panel-2); }
.overview-page .ov-bots .table tbody tr:last-child td { border-bottom: 0; }

@media (max-width: 760px) {
  .overview-page .hero-body { padding: 20px 18px; }
  .overview-page .ov-bots { max-height: none; }
}
