/* =============================================================================
   CXLogiq "Mission Control" theme
   -----------------------------------------------------------------------------
   Dark navy canvas, cyan brand accent, blue gradients, the swoosh motif.
   ALL brand colours live here as CSS variables — change them in one place to
   re-skin the whole app. Derived from the CXLogiq logo + Mission Control art.
   ========================================================================== */

:root {
  /* Brand */
  --cx-cyan: #00aeef;          /* the "CX" blue — primary accent          */
  --cx-cyan-bright: #29c6ff;   /* swoosh highlight / hovers               */
  --cx-cyan-deep: #0288c4;
  --cx-orange: #f0512a;        /* Mission Control stripe — sparing accent */

  /* Navy canvas + surfaces */
  --navy-950: #060c16;
  --navy-900: #0a1322;
  --navy-850: #0e1a2c;
  --navy-800: #0f2740;
  --surface: #0e1826;
  --surface-2: #13202f;
  --surface-3: #18293b;

  /* Lines + text */
  --border: rgba(41, 198, 255, 0.14);
  --border-strong: rgba(41, 198, 255, 0.32);
  --text: #e6eef6;
  --text-muted: #ccd8e7;
  --text-dim: #5d6e83;

  /* Semantics */
  --good: #34d399;
  --warn: #f0512a;
  --skip: #b9c4d0;
  --info: var(--cx-cyan);

  /* Effects */
  --grad-button: linear-gradient(135deg, #0b7fc4 0%, #16b6f0 100%);
  --grad-header: linear-gradient(180deg, #0c2c4d 0%, #0a1322 72%);
  --glow: 0 0 22px rgba(0, 174, 239, 0.35);
  --radius: 14px;
  --radius-sm: 9px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

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

body {
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 80% -10%, rgba(0, 174, 239, 0.10), transparent 60%),
    radial-gradient(900px 500px at -10% 10%, rgba(15, 39, 64, 0.55), transparent 55%),
    var(--navy-950);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ----- Layout ----------------------------------------------------------- */
.container { width: min(1080px, 92vw); margin: 0 auto; }
.stack > * + * { margin-top: 18px; }

/* ----- Masthead --------------------------------------------------------- */
.masthead {
  position: relative;
  overflow: hidden;
  background: var(--grad-header);
  border-bottom: 1px solid var(--border);
}
.masthead__mesh { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.masthead__swoosh {
  position: absolute; left: 0; right: 0; bottom: -2px; width: 100%;
  opacity: 0.5; pointer-events: none; user-select: none;
}
.masthead__inner {
  position: relative; z-index: 2;
  display: flex; align-items: center; justify-content: space-between;
  gap: 20px; padding: 26px 0 40px;
}
.masthead__lockup { display: flex; align-items: center; gap: 18px; }
.masthead__lockup img { height: 50px; filter: drop-shadow(0 6px 18px rgba(0,0,0,0.45)); }
.masthead__title { margin: 0; font-size: 13px; letter-spacing: 0.32em; text-transform: uppercase; color: var(--cx-cyan-bright); }
.masthead__subtitle { margin: 4px 0 0; font-size: 22px; font-weight: 700; }
.masthead__brand img { height: 33px; opacity: 0.92; }

/* "Knowledge Logiq" app wordmark — Knowledge in brand cyan, Logiq in white. */
.kl-wordmark { margin: 0; font-size: 34px; font-weight: 800; line-height: 1; letter-spacing: -0.01em; }
.kl-wordmark .kl-k { color: var(--cx-cyan); }
.kl-wordmark .kl-l { color: #fff; margin-left: 7px; }
.kl-tagline { margin: 8px 0 0; font-size: 11px; letter-spacing: 0.24em; text-transform: uppercase; color: var(--text-muted); }

/* ----- Panels (numbered steps) ----------------------------------------- */
main { padding: 28px 0 60px; }
.panel {
  background: linear-gradient(180deg, var(--surface) 0%, var(--surface-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px 24px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.panel__head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.panel__num {
  flex: none; width: 30px; height: 30px; border-radius: 50%;
  display: grid; place-items: center; font-weight: 700; font-size: 14px;
  color: var(--navy-950); background: var(--cx-cyan); box-shadow: var(--glow);
}
.panel__title { margin: 0; font-size: 17px; font-weight: 700; }
.panel__hint { margin: 2px 0 0; font-size: 13px; color: var(--text-muted); }
.panel.is-disabled { opacity: 0.55; filter: saturate(0.6); }

/* ----- Micro labels + fields ------------------------------------------- */
.micro { font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim); display: block; margin-bottom: 6px; }
.grid { display: grid; gap: 14px; }
.grid.cols-2 { grid-template-columns: 1fr 1fr; }
.grid.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

input[type="text"], input[type="password"], input[type="url"], select {
  width: 100%; padding: 11px 13px; color: var(--text);
  background: var(--navy-900); border: 1px solid var(--border);
  border-radius: var(--radius-sm); font-family: inherit; font-size: 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}
input:focus, select:focus { outline: none; border-color: var(--border-strong); box-shadow: var(--glow); }
select option { background: var(--navy-900); }

/* ----- Buttons ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 11px 18px; font-family: inherit; font-size: 14px; font-weight: 600;
  color: var(--text); background: var(--surface-3);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  transition: transform 0.08s, box-shadow 0.15s, border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { color: #fff; background: var(--grad-button); border: none; box-shadow: var(--glow); }
.btn--primary:hover { box-shadow: 0 0 28px rgba(0, 174, 239, 0.55); }
.btn--ghost { background: transparent; }
.btn--lg { padding: 14px 26px; font-size: 15px; }

/* ----- Connection status chip ------------------------------------------ */
.chip { display: inline-flex; align-items: center; gap: 7px; padding: 5px 11px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 1px solid var(--border); }
.chip__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-dim); }
.chip.is-connected { color: var(--good); border-color: rgba(52, 211, 153, 0.4); }
.chip.is-connected .chip__dot { background: var(--good); box-shadow: 0 0 10px var(--good); }
.chip.is-error { color: var(--warn); border-color: rgba(240, 81, 42, 0.4); }
.chip.is-error .chip__dot { background: var(--warn); }
.chip.is-connecting { color: var(--cx-cyan-bright); }
.chip.is-connecting .chip__dot { background: var(--cx-cyan-bright); animation: pulse 1s infinite; }
@keyframes pulse { 50% { opacity: 0.3; } }

/* ----- File list -------------------------------------------------------- */
.dropzone {
  border: 1.5px dashed var(--border-strong); border-radius: var(--radius);
  padding: 26px; text-align: center; color: var(--text-muted);
  background: rgba(0, 174, 239, 0.03); transition: background 0.15s, border-color 0.15s;
}
.dropzone.is-over { background: rgba(0, 174, 239, 0.08); border-color: var(--cx-cyan); }
.filelist { margin-top: 16px; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.filerow { display: grid; grid-template-columns: 1fr auto auto auto auto; align-items: center; gap: 14px; padding: 12px 16px; border-top: 1px solid var(--border); }
.filerow:first-child { border-top: none; }
.filerow__name { font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filerow__meta { font-size: 12px; color: var(--text-dim); }

/* Format badges (colour-coded by family) */
.badge { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 3px 8px; border-radius: 6px; border: 1px solid var(--border); color: var(--text-muted); }
.badge--doc { color: #6db4ff; border-color: rgba(109,180,255,0.4); }
.badge--text { color: #34d399; border-color: rgba(52,211,153,0.4); }
.badge--data { color: #ffb454; border-color: rgba(255,180,84,0.4); }
.badge--unsupported { color: var(--warn); border-color: rgba(240,81,42,0.4); }

/* Native/Fabric segmented toggle */
.seg { display: inline-flex; background: var(--navy-900); border: 1px solid var(--border); border-radius: 999px; padding: 3px; }
.seg button { border: none; background: transparent; color: var(--text-muted); font-family: inherit; font-size: 12px; font-weight: 600; padding: 5px 13px; border-radius: 999px; cursor: pointer; transition: all 0.12s; }
.seg button.is-active[data-mode="native"] { background: var(--cx-cyan); color: var(--navy-950); }
.seg button.is-active[data-mode="fabric"] { background: var(--cx-orange); color: #fff; }

/* Status chips on file rows */
.status { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; }
.status--idle { color: var(--text-dim); }
.status--processing { color: var(--cx-cyan-bright); }
.status--created { color: var(--good); }
.status--updated { color: #6db4ff; }
.status--skipped { color: var(--skip); }
.status--uploaded { color: var(--good); }
.status--failed { color: var(--warn); }

.iconbtn { background: none; border: none; color: var(--text-dim); cursor: pointer; font-size: 16px; padding: 4px; }
.iconbtn:hover { color: var(--warn); }

/* ----- Results log ------------------------------------------------------ */
.log { font-family: 'SF Mono', ui-monospace, 'Cascadia Code', Consolas, monospace; font-size: 12.5px; background: var(--navy-950); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 14px 16px; max-height: 280px; overflow-y: auto; }
.log__line { padding: 2px 0; color: var(--text-muted); }
.log__line .t { color: var(--text-dim); }
.log__line.ok { color: var(--good); }
.log__line.err { color: var(--warn); }
.log__line.info { color: var(--cx-cyan-bright); }

/* ----- Misc ------------------------------------------------------------- */
.newsource { display: flex; gap: 8px; align-items: center; margin-top: 8px; flex-wrap: wrap; }
.newsource input { flex: 1; min-width: 120px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.muted { color: var(--text-muted); }
.note { font-size: 12.5px; color: var(--text-muted); background: rgba(0,174,239,0.05); border-left: 3px solid var(--cx-cyan); padding: 9px 12px; border-radius: 0 8px 8px 0; }
.footer { text-align: center; color: var(--text-dim); font-size: 12px; padding: 28px 0; }
.footer a { color: var(--text-muted); }

@media (max-width: 720px) {
  .grid.cols-2, .grid.cols-3 { grid-template-columns: 1fr; }
  .filerow { grid-template-columns: 1fr auto; row-gap: 8px; }
  .masthead__brand { display: none; }
}
