/* MECOFOX web client */
:root {
  --bg: #0c0e14;
  --panel: #151823;
  --panel-2: #1c2030;
  --line: #262b3d;
  --text: #e8eaf2;
  --muted: #8b91a7;
  --accent: #6c5ce7;
  --accent-2: #8e7bff;
  --green: #2ecc71;
  --red: #ff6b6b;
  --radius: 14px;
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.hidden { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; }
.error { color: var(--red); font-size: 0.9rem; margin-top: 0.6rem; }

/* ---------- auth ---------- */
.auth-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(600px 400px at 20% 10%, rgba(108, 92, 231, 0.18), transparent),
    radial-gradient(500px 350px at 85% 85%, rgba(46, 204, 113, 0.08), transparent),
    var(--bg);
  padding: 1rem;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
}

.brand { display: flex; align-items: center; gap: 0.6rem; }
.brand h1 { font-size: 1.5rem; letter-spacing: 0.12em; }
.brand.small strong { letter-spacing: 0.12em; }

.brand-mark {
  display: inline-flex;
  width: 34px; height: 34px;
  border-radius: 9px;
  object-fit: cover;   /* it's an <img> now — the emblem replaced the letter plate */
}

.tagline { color: var(--muted); margin: 0.5rem 0 1.4rem; }

.tabs { display: flex; gap: 0.4rem; margin-bottom: 1.2rem; }
.tab {
  flex: 1;
  padding: 0.55rem;
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}
.tab.active { background: var(--panel-2); color: var(--text); border-color: var(--accent); }

label { display: block; font-size: 0.85rem; color: var(--muted); margin-bottom: 0.9rem; }
input, textarea {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.75rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.95rem;
  font-family: inherit;
}
input:focus, textarea:focus { outline: none; border-color: var(--accent); }

.btn {
  padding: 0.6rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
  color: var(--text);
  font-size: 0.92rem;
  cursor: pointer;
}
.btn:hover { border-color: var(--accent); }
.btn.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  font-weight: 600;
}
.btn.primary:disabled { opacity: 0.6; cursor: wait; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }

/* ---------- app shell ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.4rem;
  border-bottom: 1px solid var(--line);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 5;
}
.top-right { display: flex; align-items: center; gap: 0.8rem; }
.org-label { color: var(--muted); font-size: 0.9rem; }
.badge {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background: rgba(108, 92, 231, 0.18);
  color: var(--accent-2);
  border: 1px solid rgba(108, 92, 231, 0.4);
  text-transform: capitalize;
}

.layout { max-width: 1080px; margin: 0 auto; padding: 1.4rem; }
.layout h2 { font-size: 1.05rem; margin: 1.6rem 0 0.9rem; }

/* ---------- usage ---------- */
.usage-strip {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.8rem;
}
.usage-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 0.9rem 1rem;
}
.usage-card .num { font-size: 1.25rem; font-weight: 700; }
.usage-card .cap { color: var(--muted); font-size: 0.8rem; margin-top: 0.15rem; }
.meter {
  height: 5px;
  border-radius: 999px;
  background: var(--panel-2);
  margin-top: 0.6rem;
  overflow: hidden;
}
.meter > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
}

/* ---------- employee cards ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.9rem;
}
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.1rem;
  text-align: center;
  transition: border-color 0.15s;
}
.card:hover { border-color: var(--accent); }
.card .avatar { width: 84px; height: 84px; border-radius: 24px; margin-bottom: 0.7rem;
                object-fit: cover; object-position: center top; background:#0d1020; }
.card strong { display: block; }
.card .role { color: var(--muted); font-size: 0.82rem; margin: 0.25rem 0 0.8rem; }
.avatar.sm { width: 46px; height: 46px; border-radius: 14px;
             object-fit: cover; object-position: center top; background:#0d1020; }

/* ---------- drawer ---------- */
.backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.55);
  z-index: 9;
}
.drawer {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: min(480px, 100vw);
  background: var(--panel);
  border-left: 1px solid var(--line);
  padding: 1.2rem 1.3rem;
  overflow-y: auto;
  z-index: 10;
}
.drawer-head {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1.1rem;
}
.drawer-head > div { flex: 1; }
.drawer h3 { font-size: 0.95rem; margin: 1.4rem 0 0.7rem; }

.runs { display: flex; flex-direction: column; gap: 0.7rem; }
.run-item {
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.8rem 0.9rem;
  font-size: 0.88rem;
}
.run-item .run-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.4rem;
}
.run-item .status { text-transform: capitalize; }
.run-item .status.succeeded { color: var(--green); }
.run-item .status.failed { color: var(--red); }
.run-item .status.running { color: var(--accent-2); }
.run-item pre {
  white-space: pre-wrap;
  font-family: inherit;
  color: var(--text);
  max-height: 300px;
  overflow-y: auto;
}

/* Legal links under the auth card. Small but must stay legible — an agreement the
   user cannot read is not an agreement they can meaningfully give. */
.legal-links {
  margin: 1rem 0 0;
  font-size: 0.78rem;
  line-height: 1.5;
  color: var(--muted);
  text-align: center;
}
.legal-links a { color: var(--accent-2); text-decoration: underline; }

/* ---------- plans ---------- */
.grid.plans { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.card.plan .price { font-size: 1.6rem; font-weight: 700; margin: 0.5rem 0 0.2rem; }
.card.plan .price .muted { font-size: 0.85rem; font-weight: 400; }
.card.plan.current { border-color: var(--accent); }
.card.plan .btn { margin-top: 0.8rem; width: 100%; }

/* ---------- onboarding interview ---------- */
.onboard-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(600px 400px at 20% 10%, rgba(108, 92, 231, 0.18), transparent),
    radial-gradient(500px 350px at 85% 85%, rgba(46, 204, 113, 0.08), transparent),
    var(--bg);
  padding: 1rem;
}
.onboard-card {
  width: 100%;
  max-width: 480px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 2rem;
}
.onboard-progress {
  height: 5px;
  border-radius: 999px;
  background: var(--panel-2);
  overflow: hidden;
  margin-bottom: 1.6rem;
}
.onboard-progress > i {
  display: block;
  height: 100%;
  width: 20%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 0.25s;
}
.onboard-step h2 { font-size: 1.3rem; margin-bottom: 0.8rem; }
.onboard-step p { color: var(--muted); margin-bottom: 0.9rem; line-height: 1.55; }
.onboard-step p strong, .onboard-step p em { color: var(--text); }
.onboard-step .btn.wide { margin-top: 0.5rem; }
.brand-mark.lg { width: 52px; height: 52px; border-radius: 14px; margin-bottom: 0.9rem; }
.onboard-choices { display: flex; flex-direction: column; gap: 0.6rem; margin-bottom: 0.6rem; }
.choice {
  text-align: left;
  padding: 0.85rem 1rem;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
}
.choice:hover { border-color: var(--accent); }
.choice span { display: block; font-weight: 400; color: var(--muted); font-size: 0.82rem; margin-top: 0.2rem; }
.onboard-hire { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1rem; }
.onboard-hire .avatar { width: 64px; height: 64px; border-radius: 18px;
                        object-fit: cover; object-position: center top; background:#0d1020; }
.onboard-examples { margin: 0 0 1rem 1.1rem; color: var(--text); line-height: 1.7; font-size: 0.92rem; }

/* ---------- chat ---------- */
.drawer.chat { display: flex; flex-direction: column; }
.chat-scroll { flex: 1; overflow-y: auto; margin: 0 -0.3rem; padding: 0 0.3rem; }
.chat-list { display: flex; flex-direction: column; gap: 0.6rem; padding-bottom: 0.8rem; }
.chat-hello { text-align: center; padding: 2rem 0.5rem; }
.bubble {
  max-width: 88%;
  padding: 0.65rem 0.85rem;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-bottom-right-radius: 4px;
}
.bubble.bot {
  align-self: flex-start;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.bubble.bot.error-b { color: var(--red); }
.bubble.typing span {
  display: inline-block;
  width: 6px; height: 6px;
  margin: 0 1.5px;
  border-radius: 50%;
  background: var(--muted);
  animation: blink 1.2s infinite both;
}
.bubble.typing span:nth-child(2) { animation-delay: 0.2s; }
.bubble.typing span:nth-child(3) { animation-delay: 0.4s; }
@keyframes blink { 0%, 80%, 100% { opacity: 0.25; } 40% { opacity: 1; } }
.chat-compose {
  display: flex;
  gap: 0.5rem;
  align-items: flex-end;
  border-top: 1px solid var(--line);
  padding-top: 0.8rem;
}
.chat-compose textarea { flex: 1; margin-top: 0; resize: none; }
.chat-compose .btn { padding: 0.65rem 1.1rem; }
.compose-main { flex: 1; display: flex; flex-direction: column; gap: 0.4rem; min-width: 0; }
.compose-main textarea { width: 100%; }
.compose-icon {
  padding: 0.55rem 0.75rem;
  font-size: 1.15rem;
  line-height: 1;
  border-radius: 12px;
  flex-shrink: 0;
}
.compose-icon.recording {
  background: var(--red, #e5484d);
  color: #fff;
  animation: pulse 1.2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.6; } }
.mic-hint { margin: 0.3rem 0 0; font-size: 0.85rem; }
.attach-strip { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.attach-chip {
  position: relative;
  display: inline-block;
}
.attach-chip img {
  width: 52px; height: 52px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid var(--line);
  display: block;
}
.attach-chip button {
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  border: none;
  background: var(--red, #e5484d);
  color: #fff;
  font-size: 0.7rem;
  line-height: 1;
  cursor: pointer;
  padding: 0;
}
.bubble-img {
  display: block;
  max-width: 220px;
  max-height: 220px;
  border-radius: 10px;
  margin-bottom: 0.4rem;
}
