/* ============================================================
   oneem bots — design system (dark console / control-panel)
   Shared tokens + component library. App-specific layout
   (sidebar, dashboard grid, wizard, auth screens) lives in
   /style.css, layered on top of this file.

   Direction: an operations console for bot processes — LED-style
   status indicators, monospace data readouts, a warm amber signal
   color borrowed from rack/panel hardware. Distinct from the
   cyan/indigo "aurora" theme used by sibling platforms.
   ============================================================ */

:root {
  /* -- surfaces -- */
  --bg: #0a0d13;
  --panel: #12161f;
  --panel-2: #171b26;
  --line: #232838;
  --line-soft: rgba(131, 140, 156, .14);

  /* -- text -- */
  --text: #e7e9ee;
  --muted: #838c9c;
  --dim: #565f70;

  /* -- brand accent: warm amber, the panel's one signal color -- */
  --accent: #e7a33e;
  --accent-2: #c6802a;
  --accent-soft: rgba(231, 163, 62, .14);
  --grad: linear-gradient(135deg, #f3b95a, #d4832c);

  /* -- status semantics (bot lifecycle) -- */
  --ok: #3ecf8e;
  --err: #f2545b;
  --warn: #fdb44b;
  --idle: #5b6472;
  --ok-soft: rgba(62, 207, 142, .13);
  --err-soft: rgba(242, 84, 91, .13);
  --warn-soft: rgba(253, 180, 75, .15);
  --idle-soft: rgba(91, 100, 114, .16);

  /* -- shape / motion -- */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;
  --shadow: 0 10px 34px rgba(0, 0, 0, .38);
  --shadow-lg: 0 24px 64px rgba(0, 0, 0, .5);
  --speed: 160ms;

  /* -- type -- */
  --font-display: 'Space Grotesk', ui-sans-serif, system-ui, sans-serif;
  --font: 'IBM Plex Sans', ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- reset / base ---------- */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scrollbar-width: thin; scrollbar-color: #2a3040 transparent; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 1px 1px, rgba(231, 163, 62, .05) 1px, transparent 0) 0 0/28px 28px,
    var(--bg);
  color: var(--text);
  font: 400 14.5px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1, h2, h3, h4 {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-weight: 600;
  letter-spacing: -.01em;
  line-height: 1.2;
  color: var(--text);
}
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
h4 { font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
p { margin: 0 0 12px; }
small { font-size: 12px; }
img, svg { max-width: 100%; vertical-align: middle; }
code, kbd { font-family: var(--mono); font-size: .92em; }
hr { border: none; border-top: 1px solid var(--line); margin: 20px 0; }

a { color: var(--accent); text-decoration: none; transition: color var(--speed) ease; }
a:hover { color: #f3bd6b; text-decoration: underline; }

::selection { background: rgba(231, 163, 62, .3); color: var(--text); }

:focus { outline: none; }
:focus-visible {
  outline: 2px solid rgba(231, 163, 62, .8);
  outline-offset: 2px;
  border-radius: 4px;
}

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #232838; border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: #333c52; background-clip: content-box; }

/* ---------- buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--panel-2);
  color: var(--text);
  font: 600 13.5px/1 var(--font);
  letter-spacing: .01em;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
  transition: background var(--speed) ease, border-color var(--speed) ease,
              box-shadow var(--speed) ease, transform var(--speed) ease, opacity var(--speed) ease;
}
.btn:hover:not(:disabled) { background: #1d2231; border-color: #333c52; text-decoration: none; color: var(--text); }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn svg { width: 15px; height: 15px; flex: none; }

.btn-primary {
  background: var(--grad);
  border-color: transparent;
  color: #201202;
  font-weight: 700;
  box-shadow: 0 4px 16px rgba(231, 163, 62, .28), inset 0 1px 0 rgba(255, 255, 255, .3);
}
.btn-primary:hover:not(:disabled) {
  filter: brightness(1.08);
  color: #201202;
  box-shadow: 0 6px 22px rgba(231, 163, 62, .4), inset 0 1px 0 rgba(255, 255, 255, .3);
}

.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-ghost:hover:not(:disabled) { background: rgba(131, 140, 156, .1); color: var(--text); }

.btn-danger { background: var(--err-soft); border-color: rgba(242, 84, 91, .35); color: var(--err); }
.btn-danger:hover:not(:disabled) { background: rgba(242, 84, 91, .2); border-color: rgba(242, 84, 91, .55); color: #fca5aa; }

.btn-sm { padding: 6px 10px; font-size: 12px; border-radius: 7px; }
.btn-block { display: flex; width: 100%; }
.btn-icon { padding: 8px; width: 34px; height: 34px; }

/* spinner shown inside a busy button */
.btn.is-busy { color: transparent !important; position: relative; pointer-events: none; }
.btn.is-busy::after {
  content: "";
  position: absolute;
  width: 15px; height: 15px;
  border-radius: 50%;
  border: 2px solid currentColor;
  border-color: rgba(255, 255, 255, .35);
  border-top-color: #fff;
  color: #fff;
  animation: spin .7s linear infinite;
}
.btn-ghost.is-busy::after, .btn-danger.is-busy::after {
  border-color: rgba(231, 163, 62, .25);
  border-top-color: var(--text);
}

/* ---------- card ---------- */

.card {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(231, 163, 62, .03);
}

/* ---------- forms ---------- */

.field { margin-bottom: 16px; }
.label {
  display: block;
  margin: 0 0 7px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.hint { margin-top: 6px; font-size: 12px; color: var(--dim); }
.error-text { margin-top: 6px; font-size: 12.5px; color: var(--err); }

.input {
  display: block;
  width: 100%;
  padding: 10px 13px;
  background: #0d1017;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: 400 14px/1.4 var(--font);
  transition: border-color var(--speed) ease, box-shadow var(--speed) ease;
  appearance: none;
}
.input::placeholder { color: var(--dim); }
.input:hover:not(:disabled) { border-color: #333c52; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input:disabled { opacity: .5; cursor: not-allowed; }
textarea.input { min-height: 90px; resize: vertical; line-height: 1.55; font-family: var(--mono); font-size: 13px; }
select.input {
  padding-right: 34px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%23838c9c' stroke-width='2' stroke-linecap='round' d='m1.5 1.75 4.5 4.5 4.5-4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  cursor: pointer;
}
select.input option { background: #12161f; color: var(--text); }

.checkline { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); }
.checkline input { accent-color: var(--accent); width: 15px; height: 15px; }

input[type="range"].slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  background: var(--line);
  outline: none;
}
input[type="range"].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--grad);
  border: 2px solid #0d1017;
  box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
  cursor: pointer;
}
input[type="range"].slider::-moz-range-thumb {
  width: 17px; height: 17px;
  border-radius: 50%;
  background: var(--grad);
  border: 2px solid #0d1017;
  cursor: pointer;
}

/* ---------- badges / chips ---------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.6;
  white-space: nowrap;
  color: var(--muted);
  background: rgba(131, 140, 156, .08);
}
.badge-green  { color: var(--ok);   background: var(--ok-soft);   border-color: rgba(62, 207, 142, .3); }
.badge-red    { color: var(--err);  background: var(--err-soft);  border-color: rgba(242, 84, 91, .3); }
.badge-yellow { color: var(--warn); background: var(--warn-soft); border-color: rgba(253, 180, 75, .3); }
.badge-amber  { color: var(--accent); background: var(--accent-soft); border-color: rgba(231, 163, 62, .32); }
.badge-gray   { color: var(--muted); background: rgba(131, 140, 156, .1); border-color: rgba(131, 140, 156, .25); }

.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font: 500 11.5px/1.6 var(--mono);
  white-space: nowrap;
}

/* ---------- LED status indicator (signature element) ---------- */

.led {
  --led-color: var(--idle);
  --led-soft: var(--idle-soft);
  position: relative;
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--led-color);
  box-shadow:
    0 0 0 3px var(--led-soft),
    0 0 8px 1px var(--led-color),
    inset 0 -1px 1px rgba(0, 0, 0, .35),
    inset 0 1px 1px rgba(255, 255, 255, .4);
  flex: none;
}
.led-ok   { --led-color: var(--ok);   --led-soft: var(--ok-soft); }
.led-err  { --led-color: var(--err);  --led-soft: var(--err-soft); }
.led-warn { --led-color: var(--warn); --led-soft: var(--warn-soft); animation: led-pulse 1.4s ease-in-out infinite; }
.led-idle { --led-color: var(--idle); --led-soft: var(--idle-soft); }
/* live-streaming variant (log tail's Follow toggle) — same green as led-ok
   but pulsing, faster than led-warn's pulse: a live feed reads as more
   "active" than a slow deploy spinner. */
.led-live { --led-color: var(--ok); --led-soft: var(--ok-soft); animation: led-pulse 1s ease-in-out infinite; }

@keyframes led-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .55; transform: scale(.82); }
}

/* ---------- stat readout (mono data) ---------- */

.stat { font-family: var(--mono); }
.stat-num { font-size: 15px; font-weight: 600; color: var(--text); }
.stat-num .unit { font-size: 11px; font-weight: 500; color: var(--muted); margin-left: 2px; }
.meter {
  position: relative;
  height: 5px;
  border-radius: 999px;
  background: var(--line);
  overflow: hidden;
  margin-top: 6px;
}
.meter > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--grad);
  transition: width .4s ease;
}
.meter.meter-danger > span { background: linear-gradient(135deg, #f88b90, var(--err)); }

/* ---------- tabs ---------- */

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 22px;
  overflow-x: auto;
}
.tab {
  padding: 9px 14px;
  margin-bottom: -1px;
  border: none;
  border-bottom: 2px solid transparent;
  background: none;
  color: var(--muted);
  font: 600 13.5px/1.4 var(--font);
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: color var(--speed) ease, border-color var(--speed) ease;
}
.tab:hover { color: var(--text); text-decoration: none; }
.tab.active { color: var(--text); border-bottom-color: var(--accent); }

/* ---------- table ---------- */

.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th {
  padding: 9px 10px;
  text-align: left;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
.table td { padding: 11px 10px; border-bottom: 1px solid rgba(35, 40, 56, .7); vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: rgba(231, 163, 62, .03); }
.table-wrap { overflow-x: auto; }

/* ---------- modal ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(5, 7, 12, .72);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: fadeIn .15s ease;
}
.modal-backdrop.closing { opacity: 0; transition: opacity .15s ease; }

.modal {
  width: min(480px, 100%);
  max-height: min(86vh, 720px);
  display: flex;
  flex-direction: column;
  background: #10141d;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  animation: fadeUp .2s ease;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 22px;
  border-bottom: 1px solid var(--line);
}
.modal-title { font-family: var(--font-display); font-size: 16px; font-weight: 700; }
.modal-x {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px; height: 30px;
  padding: 0;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: background var(--speed) ease, color var(--speed) ease;
}
.modal-x:hover { background: rgba(131, 140, 156, .12); color: var(--text); }
.modal-body { padding: 22px; overflow-y: auto; }
.modal-body > :last-child { margin-bottom: 0; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; padding: 14px 22px; border-top: 1px solid var(--line); }

/* ---------- toast ---------- */

.toast-stack {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
  pointer-events: none;
}
.toast {
  max-width: min(360px, calc(100vw - 32px));
  padding: 12px 15px;
  background: #10141d;
  border: 1px solid var(--line-soft);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  color: var(--text);
  font-size: 13.5px;
  pointer-events: auto;
  animation: fadeUp .25s ease;
  transition: opacity .3s ease, transform .3s ease;
}
.toast.hide { opacity: 0; transform: translateY(8px); }
.toast-ok    { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--err); }
.toast-info  { border-left-color: var(--accent); }

/* ---------- skeleton ---------- */

.skeleton {
  height: 13px;
  border-radius: 6px;
  background: linear-gradient(90deg, rgba(131, 140, 156, .08) 25%, rgba(131, 140, 156, .17) 50%, rgba(131, 140, 156, .08) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}
.skeleton-group { display: flex; flex-direction: column; gap: 10px; padding: 4px 0; }

/* ---------- helpers ---------- */

.muted { color: var(--muted); }
.dim { color: var(--dim); }
.mono { font-family: var(--mono); }
.row { display: flex; align-items: center; gap: 10px; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.col { display: flex; flex-direction: column; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.empty { padding: 44px 20px; text-align: center; color: var(--muted); border: 1px dashed var(--line); border-radius: var(--radius); }
.divider { height: 1px; background: var(--line); margin: 18px 0; border: none; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-2);
  font-size: 13.5px;
  margin-bottom: 18px;
}
.banner-warn { border-color: rgba(253, 180, 75, .35); background: var(--warn-soft); color: #ffd9a0; }
.banner-err  { border-color: rgba(242, 84, 91, .35);  background: var(--err-soft);  color: #ffb3b7; }
.banner-ok   { border-color: rgba(62, 207, 142, .35); background: var(--ok-soft);   color: #b8f3d6; }

/* ---------- keyframes ---------- */

@keyframes fadeUp { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- reduced motion ---------- */

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