/* ===================================================================
   ICT TERMINAL PRO — AI INTELLIGENCE LAYER
   Chat assistant, knowledge section and shared AI components.
   Additive layer: loaded after style.css / effects.css.
   =================================================================== */

/* ------------------------------------------------------------------
   01. AI SECTION (in-page showcase)
   ------------------------------------------------------------------ */
.section-ai {
  position: relative;
  overflow: hidden;
}

.ai-section-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  gap: clamp(2rem, 5vw, 4.5rem);
  align-items: center;
  margin-top: clamp(2rem, 4vw, 3.5rem);
}

.ai-copy .section-title {
  margin-bottom: 1.1rem;
}

.ai-lead {
  color: var(--muted);
  font-size: 1.02rem;
  max-width: 54ch;
}

.ai-points {
  list-style: none;
  margin: 1.8rem 0 0;
  display: grid;
  gap: 0.85rem;
}

.ai-points li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 0.9rem;
  align-items: start;
  padding: 0.85rem 0.95rem;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: linear-gradient(150deg, rgba(20, 28, 42, 0.5), rgba(8, 11, 17, 0.32));
  transition: border-color 0.35s var(--ease), transform 0.35s var(--ease), background 0.35s var(--ease);
}

.ai-points li:hover {
  border-color: rgba(111, 242, 255, 0.32);
  transform: translateY(-2px);
  background: linear-gradient(150deg, rgba(24, 34, 50, 0.62), rgba(10, 14, 22, 0.4));
}

.ai-point-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 9px;
  border: 1px solid rgba(111, 242, 255, 0.28);
  background: radial-gradient(circle at 30% 20%, rgba(111, 242, 255, 0.18), transparent 70%);
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
}

.ai-points strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  margin-bottom: 0.15rem;
}

.ai-points p {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.55;
}

.ai-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.8rem;
  margin-top: 1.8rem;
  align-items: center;
}

.ai-mini-status {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.14em;
  color: var(--dim);
  text-transform: uppercase;
}

.ai-mini-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 0 4px rgba(255, 196, 107, 0.12);
}

.ai-mini-status[data-state="online"] i {
  background: var(--emerald);
  box-shadow: 0 0 0 4px rgba(69, 240, 165, 0.14), 0 0 14px rgba(69, 240, 165, 0.5);
}

.ai-mini-status[data-state="error"] i,
.ai-mini-status[data-state="offline"] i {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(255, 95, 122, 0.12);
}

/* Knowledge core visual */
.ai-core {
  position: relative;
  min-height: 430px;
  display: grid;
  place-items: center;
  isolation: isolate;
}

.ai-core-glow {
  position: absolute;
  inset: 12% 8%;
  border-radius: 50%;
  background:
    radial-gradient(circle at 50% 45%, rgba(111, 242, 255, 0.18), transparent 58%),
    radial-gradient(circle at 62% 62%, rgba(154, 123, 255, 0.16), transparent 60%);
  filter: blur(18px);
  z-index: -1;
}

.ai-core-ring {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(111, 242, 255, 0.16);
}

.ai-core-ring.r1 {
  width: 330px;
  height: 330px;
  animation: ai-spin 46s linear infinite;
}

.ai-core-ring.r2 {
  width: 260px;
  height: 260px;
  border-style: dashed;
  border-color: rgba(154, 123, 255, 0.22);
  animation: ai-spin 30s linear infinite reverse;
}

.ai-core-ring.r3 {
  width: 400px;
  height: 400px;
  border-color: rgba(255, 255, 255, 0.05);
}

.ai-core-ring::before,
.ai-core-ring::after {
  content: "";
  position: absolute;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 12px var(--cyan);
  top: -4px;
  left: 50%;
}

.ai-core-ring::after {
  top: auto;
  bottom: -4px;
  background: var(--violet);
  box-shadow: 0 0 12px var(--violet);
}

.ai-core-node {
  position: relative;
  width: 152px;
  height: 152px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  text-align: center;
  background:
    radial-gradient(circle at 38% 30%, rgba(111, 242, 255, 0.22), transparent 62%),
    linear-gradient(155deg, rgba(18, 27, 42, 0.96), rgba(7, 10, 16, 0.96));
  border: 1px solid rgba(111, 242, 255, 0.34);
  box-shadow:
    0 0 0 8px rgba(111, 242, 255, 0.04),
    0 0 60px rgba(58, 123, 255, 0.18),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
  animation: ai-breathe 6s ease-in-out infinite;
}

.ai-core-node span {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.22em;
  color: var(--dim);
}

.ai-core-node strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.ai-core-node em {
  display: block;
  font-style: normal;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.16em;
  color: var(--cyan);
  opacity: 0.8;
}

.ai-core-tag {
  position: absolute;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(8, 12, 19, 0.78);
  backdrop-filter: blur(10px);
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-transform: uppercase;
  white-space: nowrap;
  animation: ai-float 7s ease-in-out infinite;
}

.ai-core-tag.t1 { top: 14%; left: 2%; animation-delay: -1s; }
.ai-core-tag.t2 { top: 30%; right: 0; animation-delay: -3s; }
.ai-core-tag.t3 { bottom: 22%; left: 0; animation-delay: -2s; }
.ai-core-tag.t4 { bottom: 10%; right: 6%; animation-delay: -4.5s; }

.ai-core-tag b {
  color: var(--cyan);
  font-weight: 500;
}

@keyframes ai-spin {
  to { transform: rotate(360deg); }
}

@keyframes ai-breathe {
  0%, 100% { box-shadow: 0 0 0 8px rgba(111, 242, 255, 0.04), 0 0 50px rgba(58, 123, 255, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.08); }
  50% { box-shadow: 0 0 0 14px rgba(111, 242, 255, 0.035), 0 0 80px rgba(58, 123, 255, 0.26), inset 0 1px 0 rgba(255, 255, 255, 0.1); }
}

@keyframes ai-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

/* ------------------------------------------------------------------
   02. LAUNCHER
   ------------------------------------------------------------------ */
.ai-launcher {
  position: fixed;
  right: clamp(1rem, 2.4vw, 2.1rem);
  bottom: clamp(1rem, 2.4vw, 2.1rem);
  z-index: 9500;
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.62rem 1rem 0.62rem 0.62rem;
  border-radius: 999px;
  border: 1px solid rgba(111, 242, 255, 0.28);
  background: linear-gradient(150deg, rgba(17, 25, 39, 0.94), rgba(6, 9, 14, 0.94));
  color: var(--text);
  backdrop-filter: blur(16px);
  box-shadow: 0 18px 50px -20px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  transition: transform 0.4s var(--ease), border-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
  font-family: var(--font-mono);
  font-size: 0.66rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.ai-launcher:hover {
  transform: translateY(-3px);
  border-color: rgba(111, 242, 255, 0.55);
  box-shadow: 0 24px 60px -22px rgba(0, 0, 0, 0.95), 0 0 30px -8px rgba(111, 242, 255, 0.35);
}

.ai-launcher.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translateY(20px) scale(0.96);
}

.ai-launcher-orb {
  position: relative;
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, rgba(111, 242, 255, 0.9), rgba(58, 123, 255, 0.55) 48%, rgba(10, 16, 26, 0.2) 70%);
  box-shadow: 0 0 22px rgba(111, 242, 255, 0.4);
}

.ai-launcher-orb svg {
  width: 17px;
  height: 17px;
  color: #04121a;
}

.ai-launcher-orb::after {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  border: 1px solid rgba(111, 242, 255, 0.35);
  animation: ai-ping 2.8s cubic-bezier(0.2, 0.6, 0.3, 1) infinite;
}

.ai-launcher-label {
  display: flex;
  flex-direction: column;
  gap: 0.12rem;
  line-height: 1.1;
  text-align: left;
}

.ai-launcher-label small {
  font-size: 0.52rem;
  color: var(--dim);
  letter-spacing: 0.2em;
}

@keyframes ai-ping {
  0% { transform: scale(0.85); opacity: 0.8; }
  70%, 100% { transform: scale(1.45); opacity: 0; }
}

/* ------------------------------------------------------------------
   03. PANEL SHELL
   ------------------------------------------------------------------ */
.ai-panel {
  position: fixed;
  right: clamp(0.75rem, 2vw, 1.6rem);
  bottom: clamp(0.75rem, 2vw, 1.6rem);
  z-index: 9600;
  width: min(430px, calc(100vw - 1.5rem));
  height: min(700px, calc(100dvh - 1.75rem));
  display: flex;
  flex-direction: column;
  border-radius: 22px;
  border: 1px solid rgba(111, 242, 255, 0.2);
  background:
    radial-gradient(120% 90% at 80% 0%, rgba(111, 242, 255, 0.08), transparent 45%),
    radial-gradient(80% 60% at 0% 100%, rgba(154, 123, 255, 0.08), transparent 55%),
    linear-gradient(165deg, rgba(13, 18, 28, 0.97), rgba(5, 7, 11, 0.985));
  backdrop-filter: blur(24px) saturate(120%);
  box-shadow:
    0 40px 90px -30px rgba(0, 0, 0, 0.95),
    0 0 0 1px rgba(255, 255, 255, 0.035) inset,
    0 1px 0 rgba(255, 255, 255, 0.06) inset;
  overflow: hidden;
  opacity: 0;
  transform: translateY(24px) scale(0.97);
  transform-origin: bottom right;
  pointer-events: none;
  visibility: hidden;
  transition: opacity 0.4s var(--ease), transform 0.4s var(--ease), visibility 0.4s;
}

.ai-panel.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
  visibility: visible;
}

.ai-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(111, 242, 255, 0.55), transparent);
  pointer-events: none;
}

.ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.95rem 1rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(17, 24, 37, 0.8), rgba(9, 13, 20, 0.2));
}

.ai-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.ai-brand-orb {
  position: relative;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, rgba(111, 242, 255, 0.16), rgba(154, 123, 255, 0.1));
  border: 1px solid rgba(111, 242, 255, 0.28);
  flex: 0 0 auto;
  overflow: hidden;
}

.ai-brand-orb::before {
  content: "";
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, transparent 0 35%, rgba(111, 242, 255, 0.55) 45%, transparent 55% 100%);
  animation: ai-spin 4.5s linear infinite;
  opacity: 0.55;
}

.ai-brand-orb::after {
  content: "";
  position: absolute;
  inset: 3px;
  border-radius: 7px;
  background: #090d14;
}

.ai-brand-orb svg {
  position: relative;
  z-index: 1;
  width: 17px;
  height: 17px;
  color: var(--cyan);
}

.ai-brand strong {
  display: block;
  font-family: var(--font-display);
  font-size: 0.98rem;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.ai-brand small {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.14em;
  color: var(--dim);
  text-transform: uppercase;
  margin-top: 0.18rem;
}

.ai-head-actions {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex: 0 0 auto;
}

.ai-icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border: 1px solid transparent;
  transition: color 0.25s, background 0.25s, border-color 0.25s;
}

.ai-icon-btn:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--line);
}

.ai-icon-btn svg {
  width: 16px;
  height: 16px;
}

.ai-statusbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem 0.9rem;
  padding: 0.55rem 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(6, 9, 14, 0.5);
}

.ai-status {
  display: inline-flex;
  align-items: center;
  gap: 0.38rem;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  white-space: nowrap;
}

.ai-status i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
  flex: 0 0 auto;
  transition: background 0.3s, box-shadow 0.3s;
}

.ai-status[data-state="online"] {
  color: var(--emerald);
}

.ai-status[data-state="online"] i {
  background: var(--emerald);
  box-shadow: 0 0 0 3px rgba(69, 240, 165, 0.12), 0 0 10px rgba(69, 240, 165, 0.5);
}

.ai-status[data-state="ready"] {
  color: #9fe9ff;
}

.ai-status[data-state="ready"] i {
  background: var(--cyan);
  box-shadow: 0 0 0 3px rgba(111, 242, 255, 0.1), 0 0 10px rgba(111, 242, 255, 0.4);
}

.ai-status[data-state="checking"] i {
  background: var(--amber);
  animation: ai-blink 1.2s ease-in-out infinite;
}

.ai-status[data-state="error"],
.ai-status[data-state="offline"] {
  color: var(--danger);
}

.ai-status[data-state="error"] i,
.ai-status[data-state="offline"] i {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(255, 95, 122, 0.1);
}

@keyframes ai-blink {
  50% { opacity: 0.25; }
}

.ai-model-chip {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.06em;
  color: var(--dim);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.16rem 0.5rem;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ------------------------------------------------------------------
   04. MESSAGES
   ------------------------------------------------------------------ */
.ai-messages {
  flex: 1 1 auto;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding: 1rem 1rem 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  scrollbar-width: thin;
  scrollbar-color: rgba(111, 242, 255, 0.35) transparent;
  cursor: default;
}

.ai-messages.is-draggable {
  cursor: grab;
}

.ai-messages.is-dragging {
  cursor: grabbing !important;
  user-select: none !important;
}

.ai-messages.is-dragging * {
  user-select: none !important;
  pointer-events: none !important;
}

.ai-messages::-webkit-scrollbar {
  width: 8px;
}

.ai-messages::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 999px;
}

.ai-messages::-webkit-scrollbar-thumb {
  background: rgba(111, 242, 255, 0.3);
  border-radius: 999px;
  transition: background 0.2s;
}

.ai-messages::-webkit-scrollbar-thumb:hover {
  background: rgba(111, 242, 255, 0.65);
}

.ai-welcome {
  display: grid;
  gap: 0.9rem;
  padding: 0.4rem 0.1rem;
}

.ai-welcome-head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

.ai-welcome-orb {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 35% 30%, rgba(111, 242, 255, 0.22), transparent 65%), rgba(13, 19, 29, 0.9);
  border: 1px solid rgba(111, 242, 255, 0.25);
  flex: 0 0 auto;
}

.ai-welcome-orb svg {
  width: 20px;
  height: 20px;
  color: var(--cyan);
}

.ai-welcome-head strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.02rem;
  letter-spacing: -0.02em;
}

.ai-welcome-head span {
  display: block;
  font-size: 0.78rem;
  color: var(--muted);
  line-height: 1.4;
}

.ai-welcome-note {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
  padding: 0.7rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.ai-welcome-note b {
  color: var(--text);
  font-weight: 500;
}

.ai-suggest-title {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 0.2rem;
}

.ai-suggestions {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.ai-suggestion {
  text-align: left;
  padding: 0.62rem 0.8rem;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: linear-gradient(150deg, rgba(20, 28, 42, 0.55), rgba(8, 11, 17, 0.4));
  color: var(--text);
  font-size: 0.82rem;
  line-height: 1.4;
  transition: border-color 0.3s, background 0.3s, transform 0.3s var(--ease);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
}

.ai-suggestion:hover {
  border-color: rgba(111, 242, 255, 0.35);
  background: rgba(22, 32, 48, 0.6);
  transform: translateX(2px);
}

.ai-suggestion svg {
  width: 13px;
  height: 13px;
  color: var(--cyan);
  opacity: 0.6;
  flex: 0 0 auto;
}

.ai-msg {
  display: flex;
  gap: 0.6rem;
  align-items: flex-start;
  animation: ai-msg-in 0.35s var(--ease);
}

@keyframes ai-msg-in {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

.ai-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.ai-msg-assistant .ai-msg-avatar {
  background: linear-gradient(150deg, rgba(111, 242, 255, 0.18), rgba(58, 123, 255, 0.12));
  border: 1px solid rgba(111, 242, 255, 0.3);
  color: var(--cyan);
}

.ai-msg-user {
  flex-direction: row-reverse;
}

.ai-msg-user .ai-msg-avatar {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--line);
  color: var(--muted);
}

.ai-msg-body {
  max-width: calc(100% - 40px);
  min-width: 0;
}

.ai-msg-user .ai-msg-body {
  background: linear-gradient(150deg, rgba(58, 123, 255, 0.18), rgba(111, 242, 255, 0.08));
  border: 1px solid rgba(111, 242, 255, 0.18);
  border-radius: 14px 4px 14px 14px;
  padding: 0.6rem 0.8rem;
}

.ai-msg-assistant .ai-msg-body {
  border: 1px solid var(--line);
  border-radius: 4px 14px 14px 14px;
  background: linear-gradient(160deg, rgba(18, 25, 38, 0.72), rgba(8, 11, 17, 0.5));
  padding: 0.7rem 0.85rem;
}

.ai-msg-text {
  font-size: 0.87rem;
  line-height: 1.62;
  color: #dce5f2;
  overflow-wrap: anywhere;
}

.ai-msg-text > *:first-child { margin-top: 0; }
.ai-msg-text > *:last-child { margin-bottom: 0; }

.ai-msg-text p { margin: 0 0 0.6rem; }
.ai-msg-text h1,
.ai-msg-text h2,
.ai-msg-text h3,
.ai-msg-text h4 {
  font-family: var(--font-display);
  font-size: 0.98rem;
  line-height: 1.35;
  margin: 0.9rem 0 0.4rem;
  letter-spacing: -0.01em;
  color: #f2f7ff;
}

.ai-msg-text h1 { font-size: 1.08rem; }
.ai-msg-text h3 { font-size: 0.92rem; }

.ai-msg-text ul,
.ai-msg-text ol {
  margin: 0.35rem 0 0.7rem;
  padding-left: 1.1rem;
  display: grid;
  gap: 0.28rem;
}

.ai-msg-text li { line-height: 1.55; }

.ai-msg-text strong { color: #fff; font-weight: 600; }
.ai-msg-text em { color: #cfe3ff; }

.ai-msg-text a {
  color: var(--cyan);
  text-decoration: underline;
  text-decoration-color: rgba(111, 242, 255, 0.35);
  text-underline-offset: 2px;
}

.ai-msg-text blockquote {
  margin: 0.5rem 0;
  padding: 0.4rem 0.8rem;
  border-left: 2px solid rgba(111, 242, 255, 0.4);
  color: var(--muted);
  background: rgba(111, 242, 255, 0.04);
  border-radius: 0 8px 8px 0;
}

.ai-msg-text hr {
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0.9rem 0;
}

.ai-msg-text code:not(.ai-code-block code) {
  font-family: var(--font-mono);
  font-size: 0.78em;
  padding: 0.12em 0.38em;
  border-radius: 5px;
  background: rgba(111, 242, 255, 0.09);
  border: 1px solid rgba(111, 242, 255, 0.14);
  color: #a8ecff;
}

.ai-code-block {
  margin: 0.6rem 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
  background: #05080d;
}

.ai-code-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.35rem 0.6rem;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.ai-code-copy {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  padding: 0.15rem 0.4rem;
  border-radius: 5px;
  border: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
}

.ai-code-copy:hover {
  color: var(--cyan);
  border-color: rgba(111, 242, 255, 0.25);
  background: rgba(111, 242, 255, 0.06);
}

.ai-code-block pre {
  margin: 0;
  padding: 0.7rem 0.8rem;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.74rem;
  line-height: 1.55;
  color: #c7d6e8;
}

.ai-code-block .tok-key { color: #ff9ecb; }
.ai-code-block .tok-str { color: #9ff0b7; }
.ai-code-block .tok-num { color: #ffcf87; }
.ai-code-block .tok-com { color: #61708a; font-style: italic; }

/* sources */
.ai-sources {
  margin-top: 0.7rem;
  padding-top: 0.6rem;
  border-top: 1px dashed var(--line);
  display: grid;
  gap: 0.35rem;
}

.ai-sources-label {
  font-family: var(--font-mono);
  font-size: 0.53rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.ai-source {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  padding: 0.38rem 0.5rem;
  border-radius: 8px;
  border: 1px solid transparent;
  color: var(--muted);
  font-size: 0.76rem;
  line-height: 1.35;
  transition: border-color 0.25s, background 0.25s, color 0.25s;
}

.ai-source:hover {
  border-color: rgba(111, 242, 255, 0.24);
  background: rgba(111, 242, 255, 0.04);
  color: var(--text);
}

.ai-source-n {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  color: var(--cyan);
  border: 1px solid rgba(111, 242, 255, 0.28);
  border-radius: 5px;
  padding: 0.05rem 0.28rem;
  flex: 0 0 auto;
  margin-top: 1px;
}

.ai-source-title {
  min-width: 0;
}

.ai-source-title b {
  display: block;
  font-weight: 500;
  color: #cfe0f5;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ai-source-title small {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  color: var(--dim);
  margin-top: 0.1rem;
}

.ai-msg-actions {
  display: flex;
  gap: 0.3rem;
  margin-top: 0.45rem;
}

.ai-msg-action {
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 0.18rem 0.4rem;
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  transition: color 0.2s, border-color 0.2s;
}

.ai-msg-action:hover {
  color: var(--cyan);
  border-color: rgba(111, 242, 255, 0.2);
}

.ai-msg-action svg {
  width: 11px;
  height: 11px;
}

.ai-typing {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.35rem 0;
}

.ai-typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  opacity: 0.4;
  animation: ai-typing 1.2s ease-in-out infinite;
}

.ai-typing i:nth-child(2) { animation-delay: 0.16s; }
.ai-typing i:nth-child(3) { animation-delay: 0.32s; }

@keyframes ai-typing {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.35; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.ai-cursor::after {
  content: "▍";
  color: var(--cyan);
  animation: ai-blink 1s steps(2) infinite;
  margin-left: 1px;
}

.ai-error-box {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid rgba(255, 95, 122, 0.28);
  background: rgba(255, 95, 122, 0.06);
  display: grid;
  gap: 0.35rem;
}

.ai-error-box strong {
  color: #ffb3c0;
  font-family: var(--font-display);
  font-size: 0.86rem;
  letter-spacing: -0.01em;
}

.ai-error-box p {
  margin: 0;
  color: #e3c3ca;
  font-size: 0.78rem;
  line-height: 1.5;
}

.ai-error-box .ai-msg-action {
  justify-self: start;
  border-color: rgba(255, 95, 122, 0.3);
  color: #ffb3c0;
  margin-top: 0.15rem;
}

.ai-error-box.is-info {
  border-color: rgba(111, 242, 255, 0.24);
  background: rgba(111, 242, 255, 0.05);
}

.ai-error-box.is-info strong {
  color: var(--cyan);
}

.ai-error-box.is-info p {
  color: var(--text-soft, #c7d6e2);
}

.ai-error-box.is-info .ai-msg-action {
  border-color: rgba(111, 242, 255, 0.26);
  color: var(--cyan);
}

/* ------------------------------------------------------------------
   05. COMPOSER
   ------------------------------------------------------------------ */
.ai-composer {
  flex: 0 0 auto;
  border-top: 1px solid var(--line);
  padding: 0.7rem 0.8rem 0.6rem;
  background: linear-gradient(180deg, rgba(8, 11, 17, 0.4), rgba(6, 9, 14, 0.9));
}

.ai-form {
  display: flex;
  align-items: flex-end;
  gap: 0.45rem;
  padding: 0.4rem 0.4rem 0.4rem 0.7rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.025);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.ai-form:focus-within {
  border-color: rgba(111, 242, 255, 0.38);
  box-shadow: 0 0 0 3px rgba(111, 242, 255, 0.07), 0 0 30px -12px rgba(111, 242, 255, 0.3);
}

.ai-form.is-busy {
  opacity: 0.9;
}

.ai-input {
  flex: 1 1 auto;
  border: 0;
  background: none;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.87rem;
  line-height: 1.5;
  resize: none;
  max-height: 120px;
  padding: 0.35rem 0;
  outline: none;
  scrollbar-width: thin;
}

.ai-input::placeholder {
  color: var(--dim);
}

.ai-send {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  background: var(--grad-cyan);
  color: #04121a;
  box-shadow: 0 8px 20px -8px rgba(111, 242, 255, 0.55);
  transition: transform 0.25s var(--ease), box-shadow 0.25s, opacity 0.25s, background 0.25s;
}

.ai-send:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 26px -10px rgba(111, 242, 255, 0.65);
}

.ai-send:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.ai-send svg {
  width: 17px;
  height: 17px;
}

.ai-send.is-stop {
  background: rgba(255, 95, 122, 0.16);
  color: var(--danger);
  border: 1px solid rgba(255, 95, 122, 0.35);
  box-shadow: none;
}

.ai-composer-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.42rem;
  padding: 0 0.2rem;
  font-family: var(--font-mono);
  font-size: 0.52rem;
  letter-spacing: 0.04em;
  color: var(--dim);
}

.ai-composer-meta b {
  color: var(--muted);
  font-weight: 500;
}

/* ------------------------------------------------------------------
   06. ADMIN
   ------------------------------------------------------------------ */
.adm-body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1000px 600px at 85% -10%, rgba(111, 242, 255, 0.07), transparent 60%),
    radial-gradient(900px 700px at 0% 110%, rgba(154, 123, 255, 0.07), transparent 60%),
    var(--ink);
  color: var(--text);
  font-family: var(--font-body);
}

.adm-body [hidden] { display: none !important; }

.adm-shell {
  max-width: 1240px;
  margin: 0 auto;
  padding: clamp(1.2rem, 3vw, 2.4rem);
}

.adm-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding-bottom: 1.2rem;
  border-bottom: 1px solid var(--line);
}

.adm-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.adm-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(111, 242, 255, 0.3);
  background: linear-gradient(150deg, rgba(111, 242, 255, 0.16), rgba(58, 123, 255, 0.08));
  color: var(--cyan);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.05em;
}

.adm-brand h1 {
  font-family: var(--font-display);
  font-size: 1.12rem;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.adm-brand p {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin-top: 0.14rem;
}

.adm-top-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.adm-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.52rem 0.9rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  transition: border-color 0.25s, background 0.25s, color 0.25s, transform 0.25s;
  white-space: nowrap;
  cursor: pointer;
}

.adm-btn:hover {
  border-color: rgba(111, 242, 255, 0.35);
  background: rgba(111, 242, 255, 0.05);
  transform: translateY(-1px);
}

.adm-btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
}

.adm-btn-primary {
  background: var(--grad-cyan);
  border-color: transparent;
  color: #04121a;
  font-weight: 600;
}

.adm-btn-primary:hover {
  background: var(--grad-cyan);
  box-shadow: 0 10px 28px -12px rgba(111, 242, 255, 0.6);
}

.adm-btn-danger {
  border-color: rgba(255, 95, 122, 0.3);
  color: #ff9db0;
}

.adm-btn-danger:hover {
  background: rgba(255, 95, 122, 0.08);
  border-color: rgba(255, 95, 122, 0.5);
}

.adm-btn-sm {
  padding: 0.32rem 0.55rem;
  font-size: 0.56rem;
  letter-spacing: 0.06em;
}

/* login */
.adm-login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.2rem;
}

.adm-login {
  width: min(430px, 100%);
  padding: clamp(1.4rem, 4vw, 2.1rem);
  border-radius: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(160deg, rgba(16, 23, 36, 0.95), rgba(6, 9, 14, 0.96));
  box-shadow: 0 40px 90px -40px #000;
  position: relative;
  overflow: hidden;
}

.adm-login::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(111, 242, 255, 0.6), transparent);
}

.adm-login h2 {
  font-family: var(--font-display);
  font-size: 1.35rem;
  letter-spacing: -0.02em;
  margin: 0.9rem 0 0.3rem;
}

.adm-login p {
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.adm-label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 1rem 0 0.35rem;
}

.adm-input,
.adm-select,
.adm-textarea {
  width: 100%;
  padding: 0.6rem 0.7rem;
  border-radius: 9px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.86rem;
  outline: none;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.adm-input:focus,
.adm-select:focus,
.adm-textarea:focus {
  border-color: rgba(111, 242, 255, 0.4);
  box-shadow: 0 0 0 3px rgba(111, 242, 255, 0.07);
}

.adm-input::placeholder,
.adm-textarea::placeholder {
  color: var(--dim);
}

.adm-textarea {
  min-height: 110px;
  resize: vertical;
  line-height: 1.55;
  font-family: var(--font-mono);
  font-size: 0.74rem;
}

.adm-select option {
  background: #0b0f18;
  color: var(--text);
}

.adm-hint {
  font-size: 0.72rem;
  color: var(--dim);
  line-height: 1.5;
  margin-top: 0.35rem;
}

.adm-error {
  margin-top: 0.8rem;
  padding: 0.6rem 0.75rem;
  border-radius: 9px;
  border: 1px solid rgba(255, 95, 122, 0.3);
  background: rgba(255, 95, 122, 0.07);
  color: #ffb3c0;
  font-size: 0.8rem;
  line-height: 1.45;
  display: none;
}

.adm-error.is-visible {
  display: block;
}

/* tabs */
.adm-tabs {
  display: flex;
  gap: 0.25rem;
  margin: 1.2rem 0 1.4rem;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
  scrollbar-width: none;
}

.adm-tabs::-webkit-scrollbar { display: none; }

.adm-tab {
  padding: 0.55rem 0.85rem;
  font-family: var(--font-mono);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.25s, border-color 0.25s;
}

.adm-tab:hover { color: var(--muted); }

.adm-tab.active {
  color: var(--cyan);
  border-bottom-color: var(--cyan);
}

.adm-pane { display: none; }
.adm-pane.active { display: block; animation: adm-fade 0.3s var(--ease); }

@keyframes adm-fade {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.adm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 0.8rem;
}

.adm-card {
  padding: 1rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: linear-gradient(155deg, rgba(18, 26, 39, 0.65), rgba(8, 11, 17, 0.45));
  min-width: 0;
}

.adm-card-label {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.adm-card-value {
  font-family: var(--font-display);
  font-size: 1.65rem;
  letter-spacing: -0.03em;
  line-height: 1.15;
  margin-top: 0.45rem;
  color: #f2f7ff;
}

.adm-card-value small {
  font-family: var(--font-mono);
  font-size: 0.58rem;
  letter-spacing: 0.06em;
  color: var(--dim);
  font-weight: 400;
}

/* Dates and other long strings: keep the card from overflowing. */
.adm-card-value--text {
  font-size: 0.95rem;
  letter-spacing: 0;
  line-height: 1.35;
}

/* Native file inputs need a little help to sit next to the other fields. */
.adm-input[type="file"] {
  padding: 0.5rem 0.6rem;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
}

.adm-panel {
  margin-top: 1rem;
  padding: 1.1rem;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(13, 18, 28, 0.45);
}

.adm-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  flex-wrap: wrap;
  margin-bottom: 0.9rem;
}

.adm-panel-head h3 {
  font-family: var(--font-display);
  font-size: 0.98rem;
  letter-spacing: -0.01em;
}

.adm-panel-head p {
  color: var(--dim);
  font-size: 0.75rem;
  margin-top: 0.12rem;
}

.adm-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 0.8rem;
}

.adm-field { min-width: 0; }

.adm-field .adm-label { margin-top: 0; }

.adm-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1rem;
}

.adm-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.adm-pill i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
}

.adm-pill.ok { color: var(--emerald); border-color: rgba(69, 240, 165, 0.25); }
.adm-pill.ok i { background: var(--emerald); box-shadow: 0 0 8px rgba(69, 240, 165, 0.5); }
.adm-pill.warn { color: var(--amber); border-color: rgba(255, 196, 107, 0.25); }
.adm-pill.warn i { background: var(--amber); }
.adm-pill.bad { color: var(--danger); border-color: rgba(255, 95, 122, 0.25); }
.adm-pill.bad i { background: var(--danger); }

/* tables */
.adm-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  max-height: 540px;
}

.adm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
  min-width: 680px;
}

.adm-table th {
  position: sticky;
  top: 0;
  background: #0a0e16;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.54rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid var(--line);
  z-index: 1;
  white-space: nowrap;
}

.adm-table td {
  padding: 0.55rem 0.7rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.045);
  vertical-align: top;
  color: #b9c5d8;
}

.adm-table tr:hover td {
  background: rgba(111, 242, 255, 0.025);
}

.adm-table td b {
  color: #e8effa;
  font-weight: 500;
  display: block;
}

.adm-table small {
  font-family: var(--font-mono);
  font-size: 0.54rem;
  color: var(--dim);
  display: block;
  margin-top: 0.12rem;
}

.adm-table-actions {
  display: flex;
  gap: 0.25rem;
  flex-wrap: wrap;
}

.adm-tag {
  display: inline-block;
  padding: 0.08rem 0.34rem;
  border-radius: 4px;
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.5rem;
  letter-spacing: 0.06em;
  color: var(--dim);
  text-transform: uppercase;
}

.adm-tag.en { color: #9fe9ff; border-color: rgba(111, 242, 255, 0.2); }
.adm-tag.id { color: #d6c2ff; border-color: rgba(154, 123, 255, 0.24); }

/* checkboxes */
.adm-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 0;
  font-size: 0.78rem;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  line-height: 1.4;
}

.adm-check input {
  appearance: none;
  -webkit-appearance: none;
  flex: none;
  width: 17px;
  height: 17px;
  margin: 0;
  border-radius: 5px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.03);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, box-shadow 0.2s;
}

.adm-check input::after {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 2px;
  background: var(--cyan);
  transform: scale(0);
  transition: transform 0.16s var(--ease);
}

.adm-check input:checked {
  border-color: rgba(111, 242, 255, 0.55);
  background: rgba(111, 242, 255, 0.1);
  box-shadow: 0 0 12px -4px rgba(111, 242, 255, 0.6);
}

.adm-check input:checked::after { transform: scale(1); }

.adm-check input:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(111, 242, 255, 0.14);
}

.adm-check:hover { color: var(--text); }

.adm-check-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem 1.4rem;
  padding: 0.5rem 0;
}

/* search results */
.adm-result {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
}

.adm-result header {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
}

.adm-result header > div { flex: 1; min-width: 0; }

.adm-result header b {
  display: block;
  color: #e8effa;
  font-weight: 500;
  font-family: var(--font-body);
  font-size: 0.82rem;
}

.adm-result header span {
  font-size: 0.55rem;
  color: var(--dim);
  letter-spacing: 0.04em;
}

.adm-result header a {
  font-size: 0.58rem;
  color: var(--cyan);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  white-space: nowrap;
}

.adm-result-rank {
  width: 20px;
  height: 20px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 6px;
  border: 1px solid rgba(111, 242, 255, 0.22);
  color: var(--cyan);
  font-size: 0.55rem;
}

.adm-result p {
  margin-top: 0.45rem;
  font-size: 0.68rem;
  line-height: 1.6;
  color: #9fb0c7;
}

/* conversations */
.adm-conv {
  padding: 0.65rem 0.75rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 0.25rem;
}

.adm-conv > span {
  font-size: 0.54rem;
  color: var(--dim);
  letter-spacing: 0.04em;
}

.adm-conv b {
  font-family: var(--font-body);
  font-size: 0.78rem;
  color: #e8effa;
  font-weight: 500;
}

.adm-conv p {
  font-size: 0.66rem;
  line-height: 1.55;
  color: #9fb0c7;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.adm-conv-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-top: 0.2rem;
}

.adm-conv-sources a {
  font-size: 0.55rem;
  color: var(--cyan);
  border: 1px solid rgba(111, 242, 255, 0.18);
  border-radius: 5px;
  padding: 0.1rem 0.3rem;
}

/* preview modal */
.adm-modal-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.35rem 1rem;
  padding: 0.7rem 0.8rem;
  margin-bottom: 0.9rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  font-size: 0.62rem;
  color: #9fb0c7;
  word-break: break-word;
}

.adm-modal-meta b {
  display: block;
  font-size: 0.5rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  font-weight: 500;
}

.adm-chunk {
  padding: 0.7rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 0.5rem;
}

.adm-chunk h4 {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 0.35rem;
}

.adm-chunk h4 small {
  color: var(--dim);
  margin-left: 0.35rem;
  text-transform: none;
  letter-spacing: 0.02em;
}

.adm-chunk p {
  font-size: 0.7rem;
  line-height: 1.65;
  color: #b9c5d8;
  white-space: pre-wrap;
}

/* table links */
.adm-table a {
  color: var(--cyan);
  word-break: break-word;
}

.adm-log-item b {
  color: #e8effa;
  font-weight: 500;
}

.adm-log {
  display: grid;
  gap: 0.35rem;
  max-height: 420px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.5;
}

.adm-log-item {
  padding: 0.45rem 0.6rem;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.02);
  display: grid;
  gap: 0.15rem;
}

.adm-log-item span {
  color: var(--dim);
  font-size: 0.55rem;
  letter-spacing: 0.04em;
}

.adm-log-item.error { border-color: rgba(255, 95, 122, 0.25); }

.adm-empty {
  padding: 1.2rem;
  text-align: center;
  color: var(--dim);
  font-size: 0.78rem;
  font-family: var(--font-mono);
}

/* modal */
.adm-modal {
  position: fixed;
  inset: 0;
  z-index: 9900;
  display: none;
  place-items: center;
  padding: 1.2rem;
  background: rgba(2, 4, 8, 0.78);
  backdrop-filter: blur(8px);
}

.adm-modal.is-open { display: grid; }

.adm-modal-card {
  width: min(780px, 100%);
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid rgba(111, 242, 255, 0.2);
  background: #080c13;
  overflow: hidden;
  box-shadow: 0 40px 100px -30px #000;
}

.adm-modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--line);
}

.adm-modal-head h3 {
  font-family: var(--font-display);
  font-size: 0.95rem;
}

.adm-modal-body {
  padding: 1rem;
  overflow: auto;
  font-size: 0.8rem;
  color: #b9c5d8;
  line-height: 1.65;
}

.adm-modal-body h4 {
  font-family: var(--font-mono);
  font-size: 0.56rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 1rem 0 0.35rem;
}

.adm-preview-chunk {
  padding: 0.7rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.02);
  margin-bottom: 0.5rem;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  line-height: 1.55;
  color: #b9c5d8;
}

.adm-search-result {
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 9px;
  margin-bottom: 0.45rem;
  background: rgba(255, 255, 255, 0.02);
}

.adm-search-result header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.2rem;
}

.adm-search-result header b {
  font-size: 0.8rem;
  color: #e8effa;
  font-weight: 500;
}

.adm-search-result header span {
  font-family: var(--font-mono);
  font-size: 0.55rem;
  color: var(--cyan);
  white-space: nowrap;
}

.adm-search-result p {
  font-size: 0.74rem;
  color: var(--muted);
  line-height: 1.5;
}

.adm-search-result small {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.53rem;
  color: var(--dim);
  margin-top: 0.2rem;
}

/* toasts */
.adm-toast {
  position: fixed;
  right: 1.1rem;
  bottom: 1.1rem;
  z-index: 10050;
  padding: 0.65rem 0.9rem;
  border-radius: 10px;
  border: 1px solid rgba(111, 242, 255, 0.3);
  background: rgba(8, 13, 21, 0.96);
  color: var(--text);
  font-size: 0.78rem;
  line-height: 1.4;
  box-shadow: 0 20px 50px -20px #000;
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.3s, transform 0.3s;
  pointer-events: none;
  max-width: min(380px, calc(100vw - 2rem));
}

.adm-toast.show {
  opacity: 1;
  transform: none;
}

.adm-toast.ok { border-color: rgba(69, 240, 165, 0.35); }
.adm-toast.bad { border-color: rgba(255, 95, 122, 0.4); }

/* ------------------------------------------------------------------
   07. RESPONSIVE
   ------------------------------------------------------------------ */
@media (max-width: 960px) {
  .ai-section-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .ai-core {
    min-height: 360px;
    order: -1;
  }

  .ai-core-node {
    width: 126px;
    height: 126px;
  }

  .ai-core-node strong {
    font-size: 1.3rem;
  }

  .ai-core-ring.r1 { width: min(280px, 84vw); height: min(280px, 84vw); }
  .ai-core-ring.r2 { width: min(220px, 66vw); height: min(220px, 66vw); }
  .ai-core-ring.r3 { width: min(330px, 88vw); height: min(330px, 88vw); }
}

@media (max-width: 560px) {
  .ai-launcher {
    padding: 0.55rem;
  }

  /* Keep iOS from zooming the page when the composer gets focus. */
  .ai-input,
  .ai-composer textarea {
    font-size: 16px;
  }

  .ai-launcher-label {
    display: none;
  }

  .ai-panel {
    right: 0.5rem;
    left: 0.5rem;
    bottom: 0.5rem;
    width: auto;
    height: calc(100dvh - 1rem);
    max-height: 780px;
    border-radius: 18px;
  }

  .ai-messages {
    padding: 0.85rem 0.8rem 0.5rem;
  }

  .ai-statusbar {
    padding: 0.5rem 0.8rem;
  }

  .ai-model-chip {
    display: none;
  }

  .ai-core-tag {
    font-size: 0.52rem;
    padding: 0.3rem 0.5rem;
  }

  .ai-core-tag.t1 { left: -2%; }
  .ai-core-tag.t4 { right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ai-core-ring,
  .ai-core-node,
  .ai-core-tag,
  .ai-launcher-orb::after,
  .ai-brand-orb::before {
    animation: none !important;
  }

  .ai-panel,
  .ai-launcher,
  .ai-msg {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* When the OS is in light mode the site still stays dark; keep scrollbars dark. */
@supports (color: color(display-p3 1 1 1)) {
  .ai-brand-orb svg,
  .ai-welcome-orb svg {
    color: #8ff5ff;
  }
}
