/* ============================================================
   JARVIS COMPANY OS
   Palette encre bleue profonde. Chaque pole porte sa couleur,
   la couleur est une information, pas une decoration.
   ============================================================ */

:root {
  --ink: #0e1116;
  --ink-raised: #151a22;
  --ink-high: #1c222c;
  --line: #232a36;
  --line-soft: #1a202a;

  --text: #e9ecf1;
  --text-dim: #98a2b3;
  --text-faint: #5f6879;

  --fb: #4c8dff;
  --ig: #e8734a;
  --fv: #a07cff;
  --bots: #4fc3a1;
  --attn: #f2b441;

  --ok: #4fc3a1;
  --warn: #f2b441;
  --bad: #f2665c;

  --radius: 10px;
  --rail: 232px;
  --maxw: 760px;

  --font: "Instrument Sans", -apple-system, BlinkMacSystemFont, "Segoe UI",
    system-ui, sans-serif;
}

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

html {
  background: var(--ink);
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--ink);
  color: var(--text);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "cv05" 1;
  min-height: 100dvh;
  overflow-x: hidden;
}

button,
input,
textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: none;
  border: none;
  outline: none;
}

button {
  cursor: pointer;
}

:focus-visible {
  outline: 2px solid var(--fb);
  outline-offset: 2px;
  border-radius: 4px;
}

.hidden {
  display: none !important;
}

/* ---------- Ecran de connexion ---------- */

.gate {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.gate-inner {
  width: 100%;
  max-width: 340px;
}

.gate-mark {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.14em;
  color: var(--text-faint);
  margin-bottom: 28px;
}

.gate-title {
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.2;
  margin-bottom: 6px;
}

.gate-sub {
  color: var(--text-dim);
  font-size: 14px;
  margin-bottom: 28px;
}

.gate-field {
  display: flex;
  gap: 8px;
}

.gate-input {
  flex: 1;
  background: var(--ink-raised);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 11px 13px;
  transition: border-color 0.15s;
}

.gate-input:focus {
  border-color: var(--fb);
}

.gate-btn {
  background: var(--text);
  color: var(--ink);
  font-weight: 600;
  border-radius: var(--radius);
  padding: 11px 18px;
}

.gate-error {
  color: var(--bad);
  font-size: 13px;
  margin-top: 12px;
  min-height: 18px;
}

/* ---------- Structure ---------- */

.shell {
  display: flex;
  min-height: 100dvh;
}

.rail {
  width: var(--rail);
  flex-shrink: 0;
  border-right: 1px solid var(--line-soft);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100dvh;
}

.rail-mark {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  color: var(--text-faint);
  padding: 0 10px;
  margin-bottom: 22px;
}

.rail-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 7px;
  color: var(--text-dim);
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  width: 100%;
  transition: background 0.12s, color 0.12s;
}

.rail-link:hover {
  background: var(--ink-raised);
  color: var(--text);
}

.rail-link.is-active {
  background: var(--ink-high);
  color: var(--text);
}

.rail-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}

.rail-foot {
  margin-top: auto;
  border-top: 1px solid var(--line-soft);
  padding-top: 14px;
}

.conn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 5px 10px;
  font-size: 12.5px;
  color: var(--text-faint);
}

.conn-state {
  font-weight: 600;
}

.conn-state.on {
  color: var(--ok);
}

.conn-state.off {
  color: var(--text-faint);
}

.conn-link {
  color: var(--fb);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.scroll {
  flex: 1;
  overflow-y: auto;
  padding: 40px 32px 180px;
}

.col {
  max-width: var(--maxw);
  margin: 0 auto;
}

/* ---------- En-tete du jour ---------- */

.head {
  margin-bottom: 34px;
}

.head-meta {
  font-size: 13px;
  color: var(--text-faint);
  margin-bottom: 10px;
}

.head-title {
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.1;
  margin-bottom: 14px;
}

.head-synth {
  font-size: 16.5px;
  line-height: 1.6;
  color: var(--text-dim);
  max-width: 62ch;
}

.head-actions {
  display: flex;
  gap: 8px;
  margin-top: 20px;
}

.pill {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 13px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-dim);
  transition: border-color 0.12s, color 0.12s;
}

.pill:hover {
  border-color: var(--text-faint);
  color: var(--text);
}

/* ---------- Bloc attention ---------- */

.attn {
  border: 1px solid rgba(242, 180, 65, 0.28);
  background: rgba(242, 180, 65, 0.05);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 30px;
}

.attn-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--attn);
  margin-bottom: 12px;
}

.attn-item {
  display: flex;
  gap: 11px;
  padding: 8px 0;
  border-top: 1px solid rgba(242, 180, 65, 0.14);
}

.attn-item:first-of-type {
  border-top: none;
  padding-top: 0;
}

.attn-body {
  flex: 1;
  min-width: 0;
}

.attn-what {
  font-weight: 500;
  line-height: 1.45;
}

.attn-why {
  color: var(--text-dim);
  font-size: 13.5px;
  margin-top: 2px;
}

.attn-ask {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--attn);
  white-space: nowrap;
  padding-top: 1px;
}

/* ---------- Poles ---------- */

.poles {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.pole {
  display: flex;
  gap: 18px;
  padding: 20px 0 20px 18px;
  border-left: 2px solid var(--line);
  transition: border-color 0.2s;
}

.pole[data-pole="facebook"] {
  border-left-color: var(--fb);
}
.pole[data-pole="instagram"] {
  border-left-color: var(--ig);
}
.pole[data-pole="fanvue"] {
  border-left-color: var(--fv);
}
.pole[data-pole="bots"] {
  border-left-color: var(--bots);
}

.pole-side {
  width: 118px;
  flex-shrink: 0;
}

.pole-name {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.pole-stamp {
  font-size: 12px;
  color: var(--text-faint);
  margin-top: 3px;
}

.pole-body {
  flex: 1;
  min-width: 0;
}

.pole-line {
  line-height: 1.55;
  margin-bottom: 12px;
}

.facts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
}

.fact {
  min-width: 84px;
}

.fact-n {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
}

.fact-k {
  font-size: 12.5px;
  color: var(--text-faint);
  margin-top: 1px;
}

.fact.is-stale .fact-n {
  color: var(--text-faint);
}

.notes {
  margin-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.note {
  display: flex;
  gap: 9px;
  font-size: 13.5px;
  color: var(--text-dim);
  line-height: 1.5;
}

.note-tick {
  color: var(--text-faint);
  flex-shrink: 0;
}

.note[data-kind="blocked"] .note-tick {
  color: var(--bad);
}
.note[data-kind="running"] .note-tick {
  color: var(--fb);
}
.note[data-kind="done"] .note-tick {
  color: var(--ok);
}

/* ---------- Etats ---------- */

.empty {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 26px 22px;
  text-align: left;
}

.empty-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.empty-body {
  color: var(--text-dim);
  font-size: 14px;
  max-width: 54ch;
  margin-bottom: 14px;
}

.empty-btn {
  background: var(--text);
  color: var(--ink);
  font-weight: 600;
  font-size: 13.5px;
  border-radius: 7px;
  padding: 8px 14px;
  text-decoration: none;
  display: inline-block;
}

.loading {
  color: var(--text-faint);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.spark {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--fb);
  animation: breathe 1.4s ease-in-out infinite;
}

@keyframes breathe {
  0%,
  100% {
    opacity: 0.25;
    transform: scale(0.8);
  }
  50% {
    opacity: 1;
    transform: scale(1);
  }
}

/* ---------- Conversation ---------- */

.thread {
  max-width: var(--maxw);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 26px;
}

.turn-you {
  align-self: flex-end;
  max-width: 84%;
  background: var(--ink-high);
  border-radius: 14px 14px 3px 14px;
  padding: 11px 15px;
  line-height: 1.55;
}

.turn-jarvis {
  max-width: 92%;
  line-height: 1.65;
}

.turn-body {
  min-height: 16px;
}

.turn-jarvis p {
  margin-bottom: 11px;
}

.turn-jarvis p:last-child {
  margin-bottom: 0;
}

.turn-jarvis strong {
  font-weight: 600;
}

.turn-jarvis ul {
  margin: 0 0 11px 18px;
}

.turn-jarvis li {
  margin-bottom: 4px;
}

.tools {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 11px;
}

.tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-dim);
  background: var(--ink-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 3px 10px;
}

.tool-dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--bots);
}

.tool[data-src="fanvue"] .tool-dot {
  background: var(--fv);
}
.tool[data-src="drive"] .tool-dot {
  background: var(--fb);
}

.caret {
  display: inline-block;
  width: 7px;
  height: 15px;
  background: var(--text);
  vertical-align: -2px;
  animation: blink 1s steps(2) infinite;
}

@keyframes blink {
  0%,
  50% {
    opacity: 1;
  }
  51%,
  100% {
    opacity: 0;
  }
}

/* ---------- Composer ---------- */

.dock {
  position: fixed;
  left: var(--rail);
  right: 0;
  bottom: 0;
  padding: 16px 32px calc(16px + env(safe-area-inset-bottom));
  background: linear-gradient(
    to top,
    var(--ink) 55%,
    rgba(14, 17, 22, 0)
  );
  pointer-events: none;
}

.dock-inner {
  max-width: var(--maxw);
  margin: 0 auto;
  pointer-events: auto;
}

.hints {
  display: flex;
  gap: 6px;
  margin-bottom: 9px;
  overflow-x: auto;
  scrollbar-width: none;
}

.hints::-webkit-scrollbar {
  display: none;
}

.hint {
  white-space: nowrap;
  font-size: 12.5px;
  color: var(--text-dim);
  background: var(--ink-raised);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 12px;
  flex-shrink: 0;
}

.hint:hover {
  color: var(--text);
  border-color: var(--text-faint);
}

.box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  background: var(--ink-raised);
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 8px 8px 8px 14px;
  transition: border-color 0.15s;
}

.box:focus-within {
  border-color: #37414f;
}

.box-input {
  flex: 1;
  resize: none;
  max-height: 180px;
  line-height: 1.5;
  padding: 5px 0;
}

.box-input::placeholder {
  color: var(--text-faint);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--text-dim);
  flex-shrink: 0;
  transition: background 0.12s, color 0.12s;
}

.icon-btn:hover {
  background: var(--ink-high);
  color: var(--text);
}

.icon-btn.is-live {
  background: var(--bad);
  color: #fff;
  animation: pulse 1.3s ease-in-out infinite;
}

.icon-btn.is-on {
  color: var(--bots);
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(242, 102, 92, 0.5);
  }
  70% {
    box-shadow: 0 0 0 9px rgba(242, 102, 92, 0);
  }
}

.send {
  background: var(--text);
  color: var(--ink);
}

.send:hover {
  background: #fff;
  color: var(--ink);
}

.send:disabled {
  background: var(--ink-high);
  color: var(--text-faint);
  cursor: default;
}

.dock-note {
  font-size: 11.5px;
  color: var(--text-faint);
  text-align: center;
  margin-top: 8px;
}

/* ---------- Mobile ---------- */

.tabbar {
  display: none;
}

@media (max-width: 820px) {
  .rail {
    display: none;
  }

  .scroll {
    padding: 26px 18px 210px;
  }

  .head-title {
    font-size: 27px;
  }

  .head-synth {
    font-size: 15.5px;
  }

  .dock {
    left: 0;
    padding: 12px 14px calc(12px + env(safe-area-inset-bottom));
  }

  .pole {
    flex-direction: column;
    gap: 10px;
    padding-left: 14px;
  }

  .pole-side {
    width: auto;
    display: flex;
    align-items: baseline;
    gap: 9px;
  }

  .pole-stamp {
    margin-top: 0;
  }

  .tabbar {
    display: flex;
    gap: 6px;
    margin-bottom: 22px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .tabbar::-webkit-scrollbar {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* ---------- Scene vocale ---------- */

.stage {
  position: fixed;
  inset: 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 26px;
  padding: 32px 24px 200px;
  background: radial-gradient(
      120% 80% at 50% 42%,
      rgba(76, 141, 255, 0.07),
      rgba(14, 17, 22, 0) 70%
    ),
    rgba(14, 17, 22, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.orb {
  width: min(58vw, 300px);
  height: min(58vw, 300px);
  display: block;
}

.stage-state {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-faint);
  transition: color 0.3s;
}

.stage-state.is-live {
  color: var(--text-dim);
}

.stage-text {
  font-size: 19px;
  line-height: 1.5;
  text-align: center;
  max-width: 30ch;
  min-height: 3em;
  color: var(--text);
  letter-spacing: -0.01em;
}

.stage-close {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 20px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text-dim);
}

.stage-close:hover {
  border-color: var(--text-faint);
  color: var(--text);
}

body.voice-on .dock {
  opacity: 0;
  pointer-events: none;
}
