/* NormArchAI — stiluri aplicație. Tokens de brand: vezi docs/brand.md */
:root {
  /* Paletă principală brand (strictă conform brand book) */
  --c-indigo:  #162136;   /* Font principal, fundal dark */
  --c-smarald: #2A6054;   /* Accent pozitiv, butoane, success */
  --c-lavanda: #826D8E;   /* Ton secundar elegant */
  --c-gri:     #929FB2;   /* Fundal calm, neutralizare UI */
  --c-ocru:    #E4B30E;   /* Accent cald, luxury, warning */
  
  /* Culori auxiliare (derivate din paletă) */
  --c-white:   #FFFFFF;   /* Alb pur pentru carduri, fonduri curate */
  --c-error:   #8a1c1c;   /* Error (ton roșu închis) */
  --c-success: #2A6054;   /* Success (verde smarald) */
  --c-warning: #E4B30E;   /* Warning (ocru urban) */

  /* Variabile de temă (light mode) */
  --bg:        #F7F8FA;
  --card:      var(--c-white);
  --text:      var(--c-indigo);
  --muted:     #5b6678;
  --line:      #e6e9ef;
  --bubble:    #eef0f5;   /* fundal mesaj asistent / hașuri UI */
  --input-bg:  var(--c-white);

  --radius: 12px;
  --shadow: 0 1px 3px rgba(22,33,54,.08), 0 8px 24px rgba(22,33,54,.06);
  --font: "Satoshi", "Inter", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --logo-gradient: linear-gradient(135deg, var(--c-indigo) 0%, var(--c-smarald) 100%);
}

/* Temă întunecată — (1) preferință OS fără toggle explicit */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg:       #0f1626;
    --card:     #18233b;
    --text:     #e8ecf3;
    --muted:    #97a3bb;
    --line:     #2a3650;
    --bubble:   #20304e;
    --input-bg: #131d31;
    --shadow:   0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
  }
}
/* Temă întunecată — (2) toggle explicit [data-theme="dark"] câștigă întotdeauna */
[data-theme="dark"] {
  --bg:       #0f1626;
  --card:     #18233b;
  --text:     #e8ecf3;
  --muted:    #97a3bb;
  --line:     #2a3650;
  --bubble:   #20304e;
  --input-bg: #131d31;
  --shadow:   0 1px 3px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.3);
}

* { box-sizing: border-box; }
body {
  margin: 0; font-family: var(--font); color: var(--text);
  background: var(--bg); line-height: 1.55;
}
a { color: var(--c-smarald); text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.nav {
  display: flex; align-items: center; gap: 20px;
  padding: 14px 28px; background: var(--card); border-bottom: 1px solid var(--line);
}
.nav .spacer { flex: 1; }
.nav a { color: var(--muted); font-weight: 500; }
.nav a:hover { color: var(--text); text-decoration: none; }
.container { max-width: 960px; margin: 0 auto; padding: 32px 24px; }
.narrow { max-width: 420px; }

/* Brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; color: var(--text); }
.brand img { height: 30px; width: auto; }
.brand .arch { color: var(--c-smarald); }
.tagline { color: var(--muted); font-style: italic; }

/* Cards */
.card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 24px; margin-bottom: 20px;
}
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

/* Forms */
label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: var(--input-bg); color: var(--text);
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--c-smarald); border-color: transparent; }

/* Buttons */
.btn {
  display: inline-block; padding: 11px 18px; border: 0; border-radius: 8px;
  font: inherit; font-weight: 600; cursor: pointer; color: var(--c-white);
  background: var(--c-smarald); transition: filter .15s;
}
.btn:hover { filter: brightness(1.08); text-decoration: none; }
.btn.accent { background: var(--c-ocru); color: var(--c-indigo); }
.btn.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
.btn.block { display: block; width: 100%; text-align: center; }
.nav a.btn,
.nav a.btn:hover {
  color: var(--c-white);
}
.nav a.btn.accent,
.nav a.btn.accent:hover {
  color: var(--c-indigo);
}

/* Banners */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 16px; font-size: 14px; }
.alert.err { background: rgba(138, 28, 28, 0.1); color: var(--c-error); border: 1px solid rgba(138, 28, 28, 0.2); }
.alert.ok  { background: rgba(42, 96, 84, 0.1); color: var(--c-success); border: 1px solid rgba(42, 96, 84, 0.2); }

/* Misc */
h1 { font-size: 26px; margin: 0 0 6px; }
h2 { font-size: 19px; margin: 0 0 12px; }
.muted { color: var(--muted); }
.price { font-size: 30px; font-weight: 700; color: var(--text); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px;
         font-weight: 600; background: var(--bubble); color: var(--muted); }
.badge.curent { background: var(--c-smarald); color: var(--c-white); }
.usage-bar { height: 8px; background: var(--bubble); border-radius: 999px; overflow: hidden; margin-top: 6px; }
.usage-bar > span { display: block; height: 100%; background: var(--c-smarald); }

/* ── Utilitare (înlocuiesc stilurile inline din template-uri) ── */
.mt-s { margin-top: 8px; }
.mt   { margin-top: 12px; }
.mt-l { margin-top: 16px; }
.nowrap { white-space: nowrap; }
.mr { margin-right: 12px; }
.right { text-align: right; }
summary { cursor: pointer; }

/* Tabel listă (lucrări, istoric, șabloane) */
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); padding: 8px 6px; font-weight: 600; }
.tbl td { padding: 9px 6px; vertical-align: top; }
.tbl tr { border-top: 1px solid var(--line); }

/* Bara de consum (element <progress>, fără inline style) */
progress.usage { -webkit-appearance: none; appearance: none; width: 100%; height: 8px;
  border: 0; border-radius: 999px; background: var(--bubble); margin-top: 6px; }
progress.usage::-webkit-progress-bar { background: var(--bubble); border-radius: 999px; }
progress.usage::-webkit-progress-value { background: var(--c-smarald); border-radius: 999px; }
progress.usage::-moz-progress-bar { background: var(--c-smarald); border-radius: 999px; }

/* Badge-uri de status lucrare */
.badge-pending { background: var(--c-gri); color: var(--c-white); }
.badge-running { background: var(--c-ocru); color: var(--c-white); }
.badge-done    { background: var(--c-smarald); color: var(--c-white); }
.badge-error   { background: var(--c-error); color: var(--c-white); }

/* Listă ghid export + card cu checkbox (batch) */
.guide-list { font-size: 13px; }
.check-card { margin: 0; display: flex; gap: 8px; align-items: flex-start; cursor: pointer; }
.check-card input { width: auto; margin-top: 3px; }

/* Utilitare suplimentare */
.mt-xl { margin-top: 18px; }
.ml-s { margin-left: 8px; }
.inline { display: inline; }
.center { text-align: center; }
.small { font-size: 14px; }
.lead { font-size: 18px; }
.smarald { color: var(--c-smarald); }
.min-h { min-height: 42px; }
.mono { font-family: monospace; font-size: 13px; }
.btn.sm { padding: 4px 10px; }
.hero { text-align: center; padding: 48px 24px; }
.hero img { height: 72px; }
.hero-text { max-width: 560px; margin: 14px auto 22px; }

/* Dashboard super-admin */
.superadmin-page { max-width: 1280px; }
.admin-heading {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--c-ocru) 12%, transparent), transparent 30%),
    var(--card);
}
.admin-heading p { margin: 4px 0 0; }
.admin-kpis { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 12px; margin-bottom: 18px; }
.admin-kpi {
  position: relative; overflow: hidden; padding: 16px; margin: 0;
  border-radius: 14px; background: linear-gradient(180deg, var(--card), color-mix(in srgb, var(--bubble) 38%, var(--card)));
}
.admin-kpi::after {
  content: ''; position: absolute; inset: auto 14px 0 14px; height: 3px; border-radius: 999px 999px 0 0;
  background: var(--c-smarald); opacity: .65;
}
.admin-kpi--warn::after { background: var(--c-ocru); }
.admin-kpi--cost::after { background: var(--c-lavanda); }
.admin-kpis strong { display: block; font-size: 26px; line-height: 1.1; margin-top: 6px; letter-spacing: -.02em; }
.admin-table-wrap { overflow-x: auto; padding: 18px; border-radius: 16px; }
.admin-section-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem;
  margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px solid var(--line);
}
.admin-section-head h2 { margin: 0 0 4px; }
.admin-section-head p { margin: 0; }
.admin-table { min-width: 900px; border-collapse: separate; border-spacing: 0; }
.admin-table th {
  padding: 10px 10px; font-size: 11px; text-transform: uppercase; letter-spacing: .06em;
  background: color-mix(in srgb, var(--bubble) 72%, var(--card)); border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.admin-table td { vertical-align: middle; padding: 12px 10px; }
.admin-table tbody tr { transition: background .15s; }
.admin-table tbody tr:hover { background: color-mix(in srgb, var(--c-smarald) 4%, transparent); }
.admin-budget { min-width: 220px; }
.admin-email { overflow-wrap: anywhere; }
@media (max-width: 1100px) { .admin-kpis { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 760px) {
  .admin-heading { align-items: flex-start; flex-direction: column; }
  .admin-kpis { grid-template-columns: repeat(2, 1fr); }
  .admin-table-wrap { padding: 14px; }
}
@media (max-width: 460px) { .admin-kpis { grid-template-columns: 1fr; } }

/* Studio: chat + vizualizator DXF */
.container.wide { max-width: 1400px; }
.studio { display: grid; grid-template-columns: 380px 1fr; gap: 18px; height: 76vh; }
.studio .card { display: flex; flex-direction: column; margin: 0; min-height: 0; }
.chat-msgs { flex: 1; overflow-y: auto; padding: 4px; display: flex; flex-direction: column; gap: 8px; }
.msg { padding: 8px 12px; border-radius: 10px; max-width: 92%; white-space: pre-wrap; font-size: 14px; line-height: 1.45; }
.msg.user { background: var(--c-smarald); color: var(--c-white); align-self: flex-end; }
.msg.assistant { background: var(--bubble); color: var(--text); align-self: flex-start; }
.chat-input { display: flex; gap: 8px; margin-top: 10px; }
.chat-input input { flex: 1; }
.viewer-bar { display: flex; gap: 8px; align-items: center; margin-bottom: 8px; }
.viewer-bar select { flex: 1; }
.viewer-frame { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: var(--c-white); }
@media (max-width: 820px) {
  .studio { grid-template-columns: 1fr; height: auto; }
  .viewer-frame { height: 60vh; }
}

/* Tab-uri Studio */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; }
.tab-btn { padding: 10px 18px; border: 0; background: transparent; font: inherit; font-weight: 600;
  color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; }
.tab-btn.active { color: var(--text); border-bottom-color: var(--c-smarald); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* Tab Generare: viewer mare + bară de generare jos */
.gen-frame { width: 100%; height: 72vh; border: 1px solid var(--line); border-radius: 8px; background: var(--c-white); }
.gen-bar { margin-top: 14px; }
.gen-row { display: flex; gap: 8px; align-items: center; }
.gen-row input[type="text"] { flex: 1; }
.gen-uploads { display: flex; gap: 18px; flex-wrap: wrap; margin-top: 12px; }
.gen-uploads .gen-row { flex: 1; min-width: 260px; }

/* Chat „Asistent" pe lățime mare */
.chat-full { height: 64vh; }

/* ── Comutator temă ── */
.theme-toggle { border: 0; background: transparent; color: var(--muted); font-size: 20px;
  cursor: pointer; line-height: 1; padding: 4px 8px; }
.theme-toggle:hover { color: var(--text); }

/* ── App chat ── */
.container.app { max-width: none; padding: 0; }
.chatapp { display: grid; grid-template-columns: 1fr; height: calc(100vh - 61px); }
.chatapp.with-viewer { grid-template-columns: 1fr minmax(420px, 46%); }
.chat-col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.conv { flex: 1; overflow-y: auto; padding: 26px 16px; }
.conv-inner { max-width: 760px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.turn { display: flex; }
.turn.user { justify-content: flex-end; }
.turn .bubble { padding: 12px 16px; border-radius: 14px; max-width: 86%; white-space: pre-wrap; line-height: 1.55; font-size: 15px; }
.turn.user .bubble { background: var(--c-smarald); color: var(--c-white); border-bottom-right-radius: 4px; }
.turn.assistant .bubble { background: var(--bubble); color: var(--text); border-bottom-left-radius: 4px; }
.turn.assistant .bubble.thinking-bubble {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: color-mix(in srgb, var(--text) 78%, var(--muted));
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--c-smarald) 10%, var(--bubble)), var(--bubble));
  white-space: normal;
}
.thinking-mark {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  flex: none;
}
.thinking-mark i {
  display: block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--c-smarald);
  opacity: .45;
  animation: normPulse 1.15s ease-in-out infinite;
}
.thinking-mark i:nth-child(2) { animation-delay: .16s; }
.thinking-mark i:nth-child(3) { animation-delay: .32s; }
@keyframes normPulse {
  0%, 80%, 100% { transform: translateY(0); opacity: .35; }
  40% { transform: translateY(-3px); opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .thinking-mark i { animation: none; opacity: .7; }
  .btn, .ws-composer .send, .attach-btn { transition: none; }
}
.ws-composer .send { border: 0; border-radius: 50%; width: 36px; height: 36px; background: var(--c-smarald);
  color: var(--c-white); font-size: 16px; font-weight: 700; cursor: pointer; flex: none;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  transition: filter .15s, transform .1s, box-shadow .15s; }
.ws-composer .send:hover { filter: brightness(1.1); box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.ws-composer .send:active { transform: scale(0.92); filter: brightness(0.95); }
.ws-composer .send:focus-visible { outline: 2px solid var(--c-smarald); outline-offset: 2px; }
.ws-composer .send:disabled { background: var(--muted); box-shadow: none; cursor: not-allowed; }
.result-card { margin-top: 10px; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; background: var(--card); }
.result-card .ttl { font-weight: 600; margin-bottom: 8px; }
.hint { color: var(--muted); font-size: 13px; }

/* Panou vizualizator (slide-in dreapta) */
.viewer-panel { display: none; flex-direction: column; border-left: 1px solid var(--line); background: var(--card); min-width: 0; }
.chatapp.with-viewer .viewer-panel { display: flex; }
.vp-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px;
  border-bottom: 1px solid var(--line); font-weight: 600; }
.vp-head button { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.vp-frame { flex: 1; border: 0; width: 100%; background: var(--c-white); }
@media (max-width: 900px) {
  .chatapp.with-viewer { grid-template-columns: 1fr; }
  .viewer-panel { display: none !important; }
}

/* ════════════════════════════════════════════════════════════════════════
   Studio SPA — shell 3 coloane (rail / chat / artefact)
   Reutilizează .turn .bubble .composer-inner .send din blocul de mai sus.
   ════════════════════════════════════════════════════════════════════════ */
.ws-body { margin: 0; overflow: hidden; height: 100vh; display: flex; flex-direction: column; }
.ws { flex: 1; min-height: 0; display: grid; grid-template-columns: 268px 1fr; position: relative; }
.ws.with-artifact { grid-template-columns: 268px 1fr minmax(420px, 44%); }

/* footer legal — bandă subțire pe toată lățimea, sub interfață (nu peste composer) */
.ws-footer { flex: none; display: flex; flex-wrap: wrap; gap: 4px 18px;
  justify-content: space-between; align-items: center; padding: 6px 16px;
  font-size: 11px; color: var(--muted); background: var(--card); border-top: 1px solid var(--line);
  opacity: 0.85; transition: opacity 0.2s; }
.ws-footer:hover { opacity: 1; }
.ws-footer a { color: var(--c-smarald); text-decoration: none; }
.ws-footer a:hover { text-decoration: underline; }
.wf-warn { color: var(--c-smarald); font-weight: 500; }
@media (max-width: 700px) { .ws-footer { justify-content: center; text-align: center; } }

/* STÂNGA */
.ws-rail { background: var(--card); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0; }
.rail-top { padding: 14px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.rail-top .brand { margin-bottom: 4px; }
.rail-list { flex: 1; overflow-y: auto; padding: 8px; }
.rail-sec { font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 12px 8px 4px; }
.rail-proj { margin-bottom: 4px; }
.rp-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-radius: 8px; }
.rp-head:hover { background: var(--bubble); }
.rp-name { flex: 1; font-weight: 600; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rp-new { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 4px; }
.rp-new:hover { color: var(--text); }
.rp-convs { margin-left: 4px; }
.rail-conv { padding: 7px 10px 7px 22px; border-radius: 8px; font-size: 14px; color: var(--muted);
  cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-conv:hover { background: var(--bubble); color: var(--text); }
.rail-conv.active { background: var(--bubble); color: var(--text); font-weight: 600; }
.rail-bottom { border-top: 1px solid var(--line); padding: 12px 14px; }
.storage { margin-bottom: 10px; }
.st-bar { height: 6px; border-radius: 99px; background: var(--bubble); overflow: hidden; }
.st-bar i { display: block; height: 100%; background: var(--c-smarald); }
.st-txt { font-size: 12px; color: var(--muted); margin-top: 4px; }
.rail-menu { display: flex; align-items: center; gap: 14px; font-size: 13px; }
.rail-menu a { color: var(--muted); } .rail-menu a:hover { color: var(--text); text-decoration: none; }
.rail-menu .theme-toggle { margin-left: auto; font-size: 18px; padding: 0; }

/* CENTRU */
.ws-main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.ws-topbar { display: flex; align-items: baseline; gap: 12px; padding: 14px 20px;
  border-bottom: 1px solid var(--line); background: var(--card); }
.ws-title { font-weight: 600; }
.ws-proj { color: var(--muted); font-size: 13px; }
.ws-conv { flex: 1; overflow-y: auto; padding: 26px 16px; }
.ws-conv-inner { width: 100%; display: flex; flex-direction: column; gap: 18px; }
.ws-empty { display: none; }
.ws-suggest { display: flex; flex-direction: column; gap: 8px; margin-top: 20px; }
.ws-suggest button { border: 1px solid var(--line); background: var(--card); color: var(--text);
  border-radius: 10px; padding: 11px 14px; cursor: pointer; text-align: left; font-size: 14px; }
.ws-suggest button:hover { border-color: var(--c-smarald); }
.ws-composer {
  border-top: 1px solid var(--line); background:
    linear-gradient(180deg, color-mix(in srgb, var(--card) 86%, transparent), var(--card));
  padding: 14px 16px;
}
.agent-starters { width: 100%; margin: 0 0 10px; display: flex; gap: 8px; overflow-x: auto;
  padding: 1px 1px 4px; scrollbar-width: thin; }
.agent-starters.hidden { display: none; }
.agent-starter { flex: 0 0 auto; border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  color: var(--text); padding: 7px 11px; font: 500 12px/1.2 var(--font); cursor: pointer; white-space: nowrap; }
.agent-starter:hover, .agent-starter:focus-visible { border-color: var(--agent-color, var(--c-smarald));
  background: var(--bubble); outline: none; }
.ws-composer .composer-inner { width: 100%; margin: 0; display: flex; gap: 8px; align-items: flex-end;
  border: 1px solid var(--line); border-radius: 20px; padding: 9px; background: var(--input-bg);
  box-shadow: 0 10px 34px rgba(22,33,54,.07); transition: border-color .18s, box-shadow .18s; }
.ws-composer .composer-inner:focus-within {
  border-color: color-mix(in srgb, var(--c-smarald) 62%, var(--line));
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--c-smarald) 12%, transparent), 0 16px 42px rgba(22,33,54,.10);
}
.ws-composer textarea { flex: 1; border: 0; background: transparent; resize: none; max-height: 200px;
  padding: 7px 4px; color: var(--text); font-family: var(--font); font-size: 15px; }
.ws-composer textarea:focus { outline: none; }
/* sr-only — input fișier ascuns accesibil */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Wrapper meniu ＋ atașament */
.attach-wrap { position: relative; flex: none; }
.attach-btn { width: 36px; height: 36px; border-radius: 12px; border: 1px solid transparent; background: transparent;
  cursor: pointer; display: flex; align-items: center; justify-content: center; color: var(--muted); transition: background .15s, color .15s, border-color .15s; }
.attach-btn:hover { background: var(--bubble); color: var(--text); border-color: var(--line); }

/* Popup meniu */
.attach-menu { position: absolute; bottom: calc(100% + 10px); left: 0; min-width: 230px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 18px 46px rgba(22,33,54,.18); padding: 7px; z-index: 200; }
.attach-menu.hidden { display: none; }
.attach-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 0; background: transparent; cursor: pointer; border-radius: 8px;
  font-size: 13px; font-weight: 500; color: var(--text); text-align: left; }
.attach-item:hover { background: color-mix(in srgb, var(--c-smarald) 8%, var(--bubble)); }
.attach-item svg { color: var(--muted); flex-shrink: 0; }
.attach-sep { height: 1px; background: var(--line); margin: 4px 0; }
/* toggle item — web search */
.attach-item--toggle { justify-content: space-between; }
.toggle-pill { width: 28px; height: 16px; border-radius: 8px; background: var(--line); position: relative;
  transition: background .2s; flex-shrink: 0; }
.toggle-pill::after { content: ''; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: white; transition: transform .2s; }
.toggle-pill.on { background: var(--c-smarald); }
.toggle-pill.on::after { transform: translateX(12px); }

/* Textarea web search activ — bordură subtilă */
.ws-composer textarea.ws-active { box-shadow: 0 0 0 2px color-mix(in srgb, var(--c-smarald) 30%, transparent); }

/* Buton STOP */
.btn-stop { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); cursor: pointer; display: flex; align-items: center; justify-content: center;
  color: var(--text); flex: none; }
.btn-stop:hover { background: #fee2e2; border-color: #fca5a5; color: #b91c1c; }
.btn-stop.hidden { display: none; }
.send.hidden { display: none; }

/* carduri artefact în chat */
.art-card { display: inline-flex; align-items: center; gap: 10px; margin-top: 10px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--card); cursor: pointer; max-width: 100%; }
.art-card:hover { border-color: var(--c-smarald); }
.ac-icon { font-size: 20px; flex: none; }
.ac-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-err { margin-top: 10px; padding: 10px 12px; border-radius: 10px;
  background: rgba(228, 179, 14, 0.12); color: var(--text); font-size: 13px; border: 1px solid rgba(228, 179, 14, 0.25); }

/* DREAPTA: panou artefact */
.ws-artifact { display: none; flex-direction: column; border-left: 1px solid var(--line); background: var(--card); min-width: 0; }
.ws.with-artifact .ws-artifact { display: flex; }
.art-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.art-head #art-title { flex: 1; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.art-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.icon-btn { border: 0; background: transparent; color: var(--muted); font-size: 18px; cursor: pointer; }
.icon-btn:hover { color: var(--text); }
.art-body { flex: 1; min-height: 0; }
.art-frame { width: 100%; height: 100%; border: 0; background: transparent; }
.art-doc { text-align: center; padding: 44px 24px; color: var(--muted); }
.ad-icon { font-size: 48px; }
.ad-name { font-weight: 600; color: var(--text); margin: 10px 0 16px; word-break: break-all; }
.ad-hint { font-size: 12px; margin-top: 12px; }

@media (max-width: 980px) {
  .ws, .ws.with-artifact { grid-template-columns: 1fr; }
  .ws.with-artifact .ws-artifact { position: fixed; inset: 0; z-index: 50; }
}

@media (max-width: 640px) {
  .ws-body { height: 100dvh; }
  .ws { grid-template-columns: 1fr; }
  .ws-topbar {
    align-items: center;
    gap: 8px;
    padding: 10px 12px;
  }
  .ws-title {
    min-width: 0;
    max-width: 42vw;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
  }
  .ws-proj { display: none; }
  .effort { gap: 4px; }
  .effort span { display: none; }
  .effort select { max-width: 92px; padding: 5px 7px; }
  #btn-gen-dxf { display: none; }
  .ws-conv { padding: 18px 10px; }
  .ws-conv-inner { gap: 14px; }
  .turn .bubble {
    max-width: 94%;
    padding: 11px 13px;
    font-size: 14px;
  }
  .ws-composer {
    padding: 10px 10px calc(10px + env(safe-area-inset-bottom));
  }
  .ws-composer .composer-inner {
    border-radius: 18px;
    padding: 7px;
    gap: 6px;
  }
  .ws-composer textarea { font-size: 16px; max-height: 128px; }
  .attach-btn, .btn-stop, .ws-composer .send {
    width: 38px;
    height: 38px;
  }
  .attach-menu {
    min-width: min(260px, calc(100vw - 28px));
    max-width: calc(100vw - 28px);
  }
  .agents-sidebar.mobile-open, .ws-rail.mobile-open {
    inset: 0 12% 0 0;
  }
  .art-toolbar { overflow-x: auto; }
  .ws-footer {
    justify-content: flex-start;
    text-align: left;
    padding: 5px 96px 5px 10px;
    font-size: 10px;
    line-height: 1.35;
  }
  .ws-footer span:nth-child(2) { display: none; }
  .token-bar { right: 6px; bottom: env(safe-area-inset-bottom); }
  .token-bar-toggle { padding: 4px 8px; font-size: 10px; }
}

/* Footer cu disclaimer și copyright */
.footer { border-top: 1px solid var(--line); padding: 24px 28px; margin-top: 40px;
  background: var(--card); font-size: 13px; color: var(--muted); }
.footer-content { max-width: 960px; margin: 0 auto; }
.disclaimer { padding: 12px 16px; border-radius: 8px; background: rgba(42, 96, 84, 0.06);
  border: 1px solid rgba(42, 96, 84, 0.15); margin-bottom: 16px; line-height: 1.6; }
.disclaimer strong { color: var(--c-smarald); font-weight: 600; }
.copyright { text-align: center; color: var(--muted); font-size: 12px; }
.copyright a { color: var(--c-smarald); text-decoration: none; }
.copyright a:hover { text-decoration: underline; }

/* buton hamburger — deschide sidebar-ul de asistenți pe mobil (ascuns pe desktop) */
.ws-mobile-agents-btn {
  display: none;
  align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--card); color: var(--text); cursor: pointer;
}
.agents-backdrop { display: none; }

/* selector efort în topbar */
.ws-spacer { flex: 1; }
.effort { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.effort select { width: auto; padding: 4px 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--input-bg); color: var(--text); font-size: 12px; }

/* panou parametri pentru planuri de cameră (editare instant) */
.art-body { display: flex; flex-direction: column; }
.art-frame { flex: 1; min-height: 0; }
.art-params { flex: none; padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--card); }
.art-params.busy { opacity: .55; pointer-events: none; }
.ap-row { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; }
.ap-f { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); margin: 0; }
.ap-f > span { white-space: nowrap; }
.ap-f input[type="number"], .ap-f select { width: auto; min-width: 72px; padding: 4px 6px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--input-bg); color: var(--text); }
.ap-bool { flex-direction: row; align-items: center; gap: 5px; }
.ap-bool input { width: auto; }

/* ── editorul graficului de execuție MAN (plan 049) ───────────────────────
   Panou de APLICAȚIE, nu iframe: artefactul HTML e servit cu CSP `sandbox`
   (origine opacă, fără sesiune), deci n-ar putea chema API-ul. Vezi comentariul
   lung din app.js::openPlanificareEditor. Culorile barelor vin din SVG-ul
   generat de server (`planificare_cpm._CULORI_CATEGORII`) — aici stilăm doar
   cromul din jur și afordanțele de editare.                                */
.pl-editor { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.pl-top { flex: none; display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 8px 12px; border-bottom: 1px solid var(--line); background: var(--card); }
.pl-rezumat { flex: 1; min-width: 180px; font-size: 12px; color: var(--muted); }
.pl-rezumat b { color: var(--text); }
.pl-actiuni { display: flex; align-items: center; gap: 8px; flex: none; }
.pl-stare { font-size: 11px; color: var(--muted); max-width: 260px; }
.pl-stare.eroare { color: #c0392b; font-weight: 600; }
.pl-canvas { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px; background: var(--bg); }
.pl-canvas.busy { opacity: .6; pointer-events: none; }
.pl-canvas svg { display: block; }
.pl-canvas .grila { stroke: var(--line); stroke-width: 1; }
.pl-canvas .axa, .pl-canvas .axa-titlu { font-size: 10px; fill: var(--muted); }
.pl-canvas .axa { text-anchor: middle; }
.pl-canvas .eticheta { font-size: 12px; fill: var(--text); text-anchor: end; }
.pl-canvas .critic-txt { font-weight: 600; fill: #C00000; }
.pl-canvas .dep { fill: none; stroke: var(--muted); stroke-width: 1.2; opacity: .75; }
.pl-canvas .dep-varf { fill: var(--muted); opacity: .75; }
.pl-canvas .bara { cursor: pointer; }
.pl-canvas .bara:hover { stroke: var(--text); stroke-width: 1.5; }
.pl-canvas .bara.sel { stroke: var(--text); stroke-width: 2; }
/* mânerul de durată: invizibil până la hover, dar mereu apucabil */
.pl-canvas .maner { fill: transparent; cursor: ew-resize; }
.pl-canvas .maner:hover { fill: var(--text); fill-opacity: .35; }
.pl-canvas svg.trage { cursor: ew-resize; }
.pl-legenda { flex: none; display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 6px 12px;
  font-size: 11px; color: var(--muted); border-top: 1px solid var(--line); }
.pl-leg i { display: inline-block; width: 10px; height: 10px; border-radius: 3px;
  margin-right: 4px; vertical-align: -1px; }
.pl-form { flex: none; max-height: 46%; overflow-y: auto; padding: 8px 12px;
  border-top: 1px solid var(--line); background: var(--card); }
.pl-form-cap { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.pl-form-cap strong { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pl-grid { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: flex-end; }
.pl-f { display: flex; flex-direction: column; gap: 3px; font-size: 11px;
  color: var(--muted); margin: 6px 0 0; }
.pl-f > span { white-space: nowrap; }
.pl-f input, .pl-f select { width: auto; min-width: 120px; padding: 4px 6px; font-size: 13px;
  border: 1px solid var(--line); border-radius: 6px; background: var(--input-bg); color: var(--text); }
.pl-f input[type="number"] { min-width: 76px; }
.pl-preds { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.pl-pred { display: flex; align-items: center; gap: 4px; margin: 0; font-size: 12px;
  color: var(--text); }
.pl-pred input { width: auto; }
/* ES/EF/LS/LF: calculate de motor → AFIȘATE, nu editabile (fără câmpuri) */
.pl-calc { margin-top: 8px; font-size: 11px; color: var(--muted); }
.pl-hint { font-size: 12px; color: var(--muted); }
.pl-fara-spec { flex: none; padding: 10px 12px; font-size: 12px; color: var(--muted);
  border-bottom: 1px solid var(--line); background: var(--card); }

/* Buton NormArchAI Editor 2D DXF (Premium Feature) */
.btn-dxf-editor {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  margin-left: 12px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--c-smarald) 0%, #1d4a42 100%);
  color: var(--c-white);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  box-shadow: 0 2px 8px rgba(42, 96, 84, 0.2);
  transition: all 0.25s ease;
  position: relative;
}

.btn-dxf-editor:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(42, 96, 84, 0.35);
  text-decoration: none;
}

.btn-dxf-editor svg {
  flex-shrink: 0;
}

.premium-badge {
  display: inline-block;
  padding: 2px 6px;
  margin-left: 4px;
  border-radius: 4px;
  background: var(--c-ocru);
  color: var(--c-indigo);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* Dark mode adjustments */
[data-theme="dark"] .btn-dxf-editor {
  background: linear-gradient(135deg, #2d7a6d 0%, var(--c-smarald) 100%);
  box-shadow: 0 2px 8px rgba(42, 96, 84, 0.4);
}

[data-theme="dark"] .btn-dxf-editor:hover {
  box-shadow: 0 4px 12px rgba(42, 96, 84, 0.6);
}

/* preview DXF full-fidelity (imagine) + comutare la interactiv */
.art-dxf { flex: 1; min-height: 0; overflow: auto; display: flex; align-items: center;
  justify-content: center; background: var(--bg); }
.art-png { max-width: 100%; max-height: 100%; object-fit: contain; display: block; cursor: zoom-in; }
.art-dxf iframe { width: 100%; height: 100%; border: 0; background: transparent; }
.art-toolbar { flex: none; padding: 6px 12px; border-top: 1px solid var(--line);
  display: flex; gap: 8px; background: var(--card); }

.zoom-modal {
  position: fixed;
  inset: 0;
  z-index: 1400;
  display: flex;
  align-items: center;
  justify-content: center;
}

.zoom-modal.hidden { display: none; }

.zoom-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(8, 15, 22, 0.75);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.zoom-shell {
  position: relative;
  z-index: 1;
  width: min(94vw, 1480px);
  height: min(92vh, 980px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

.zoom-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}

.zoom-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.zoom-badge {
  min-width: 62px;
  padding: 6px 10px;
  border-radius: 999px;
  background: var(--bubble);
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  text-align: center;
}

.zoom-stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(255,255,255,0.03) 1px, transparent 1px),
    linear-gradient(rgba(255,255,255,0.03) 1px, transparent 1px),
    var(--bg);
  background-size: 24px 24px, 24px 24px, auto;
  cursor: grab;
  touch-action: none;
}

.zoom-stage.dragging { cursor: grabbing; }

.zoom-image {
  position: absolute;
  top: 50%;
  left: 50%;
  max-width: 92%;
  max-height: 92%;
  user-select: none;
  -webkit-user-drag: none;
  transform: translate(-50%, -50%) scale(1);
  transform-origin: center center;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.24);
}

/* ── GENERARE DXF AI —————————————————————————————————————————————————— */

.btn-gen-dxf {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--c-lavanda) 0%, #9c85a8 100%);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(130, 109, 142, 0.3);
}

.btn-gen-dxf:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(130, 109, 142, 0.5);
}

.btn-gen-dxf svg {
  flex-shrink: 0;
}

[data-theme="dark"] .btn-gen-dxf {
  background: linear-gradient(135deg, #9c85a8 0%, var(--c-lavanda) 100%);
}

/* Upload Image button */
.btn-upload-img {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--c-smarald) 0%, #3a8074 100%);
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(42, 96, 84, 0.3);
}

.btn-upload-img:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(42, 96, 84, 0.5);
}

.btn-upload-img svg {
  flex-shrink: 0;
}

[data-theme="dark"] .btn-upload-img {
  background: linear-gradient(135deg, #3a8074 0%, var(--c-smarald) 100%);
}

/* Modal styles */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  width: 90%;
  max-width: 700px;
  max-height: 90vh;
  overflow: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: 0 24px 70px rgba(22, 33, 54, 0.28);
  z-index: 1;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c-smarald) 7%, transparent), transparent);
}

.modal-header h2,
.modal-header h3 {
  margin: 0;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
}

.modal-body { padding: 22px; }

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  color: var(--text);
}

.form-group label .muted {
  font-weight: 400;
  color: var(--muted);
  font-size: 13px;
}

.form-group textarea,
.form-group select {
  width: 100%;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  transition: border-color 0.2s ease;
}

.form-group textarea:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--c-smarald);
  box-shadow: 0 0 0 3px rgba(42, 96, 84, 0.1);
}

.form-hint {
  margin-top: 6px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.4;
}

.form-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

.form-actions button[type="submit"] {
  background: linear-gradient(135deg, var(--c-smarald) 0%, #347060 100%);
  padding: 12px 24px;
}

.form-actions button[type="submit"]:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(42, 96, 84, 0.4);
}

/* Dark mode modal */
[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.8);
}

[data-theme="dark"] .modal-content {
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
}

/* ── Utility classes (înlocuiesc inline styles) ───────────────────── */
.hidden { display: none; }
.modal--sm .modal-content { max-width: 520px; }
.btn--danger { color: var(--ui-error-text, #dc3545); }
.alert--mt { margin-top: 1rem; }
.upload-form-group { margin-bottom: 1rem; }
.upload-form-label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
}
.upload-file-input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--input-bg);
  color: var(--text);
}
.upload-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  color: var(--text);
  margin: 0.35rem 0;
}
.upload-checkbox-label input[type="checkbox"], .upload-checkbox-label input[type="radio"] { width: auto; margin: 0; }
.upload-checkbox-label span { font-weight: 500; }
.upload-hint {
  margin: 0.7rem 0 0;
  padding: 0.75rem 0.85rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: color-mix(in srgb, var(--c-smarald) 5%, var(--bubble));
  font-size: 0.875rem;
  color: var(--text-secondary, var(--muted));
}
.upload-hint--no-indent { margin-left: 0; }
.upload-hint-json { margin: 0; }
.upload-opts { border-top: 1px solid var(--line, #e5e7eb); padding-top: 0.75rem; margin-top: 0.5rem; }
.upload-opts-title { margin-bottom: 0.375rem; }
.upload-intrebare { margin-top: 0.5rem; width: 100%; box-sizing: border-box; }
.upload-cleanup-lbl { margin-top: 0.5rem; }
.upload-select-model { margin-top: 0.25rem; width: 100%; }

.modal-content--phase1 { max-width: 680px; }
.phase1-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 16px;
}
.phase1-wide { grid-column: 1 / -1; }
@media (max-width: 640px) {
  .phase1-grid { grid-template-columns: 1fr; }
  .phase1-wide { grid-column: auto; }
}
.analiza-raspuns { white-space: pre-wrap; line-height: 1.6; font-size: 0.95rem; }
.job-meta { margin-top: 0.4rem; font-size: 0.78rem; color: var(--muted); }
.job-nota-fallback {
  margin: 0.5rem 0; padding: 0.6rem 0.8rem; border-radius: 8px;
  background: color-mix(in srgb, #F9C74F 18%, transparent);
  border: 1px solid color-mix(in srgb, #F9C74F 45%, transparent);
  font-size: 0.85rem; line-height: 1.5;
}
.job-assumptions {
  margin: 0.5rem 0; padding: 0.6rem 0.8rem; border-radius: 8px;
  background: color-mix(in srgb, #6c8ebf 14%, transparent);
  border: 1px solid color-mix(in srgb, #6c8ebf 40%, transparent);
  font-size: 0.82rem; line-height: 1.5;
}
.job-assumptions-titlu { font-weight: 600; margin-bottom: 0.25rem; }
.job-assumptions ul { margin: 0; padding-left: 1.1rem; }
.hr-light { border: 0; border-top: 1px solid var(--line, #e5e7eb); }

/* ── Sidebar agenți specializați ─────────────────────────────────────── */
/* ── Sidebar asistenți ───────────────────────────────────────────────── */
.agents-sidebar {
  background: var(--card);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  align-items: stretch;
  padding: 0 0 14px;
  overflow-y: auto;
  overflow-x: hidden;
  gap: 0;
  scrollbar-width: none;
  width: 196px;
  min-width: 196px;
  transition: width .25s ease, min-width .25s ease, opacity .2s ease;
  position: relative;
}
.agents-sidebar::-webkit-scrollbar { display: none; }

.agents-sidebar.collapsed {
  width: 0;
  min-width: 0;
  opacity: 0;
  pointer-events: none;
}

/* Mobil: sidebar-ul e ascuns implicit; butonul hamburger îl deschide ca overlay
   peste tot ecranul, cu fundal de închidere la tap. Trebuie declarat AICI (după
   regulile de bază .agents-sidebar/.collapsed de mai sus), nu într-un @media
   plasat mai devreme în fișier — altfel regula de bază (aceeași specificitate,
   declarată mai târziu) câștigă cascada și sidebar-ul rămâne vizibil pe mobil. */
@media (max-width: 980px) {
  .ws-rail, .agents-sidebar { display: none; }
  .sidebar-tab { display: none !important; }
  .ws-mobile-agents-btn { display: inline-flex; }
  .agents-sidebar.mobile-open, .ws-rail.mobile-open {
    display: flex;
    position: fixed; inset: 0 20% 0 0;
    z-index: 60;
    width: auto; min-width: 0; opacity: 1; pointer-events: auto;
    box-shadow: 4px 0 24px rgba(0,0,0,.25);
  }
  .agents-backdrop.mobile-open {
    display: block;
    position: fixed; inset: 0;
    background: rgba(0,0,0,.4);
    z-index: 55;
  }
}

/* Header cu buton toggle */
.agents-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 10px 4px 12px;
  position: sticky;
  top: 0;
  background: var(--card);
  z-index: 1;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
}
.agents-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--muted);
}
.sidebar-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  padding: 4px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.sidebar-toggle:hover { color: var(--text); background: var(--bubble); }

/* Tab vizibil când sidebar e închis — plasat în .ws (position:relative) */
.sidebar-tab {
  position: absolute;
  left: 268px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 52px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: none;
  border-radius: 0 6px 6px 0;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  z-index: 10;
  transition: color .15s, background .15s;
}
.sidebar-tab:hover { color: var(--text); background: var(--bubble); }

/* Grup label */
.agents-group-label {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .07em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 10px 12px 3px;
}

/* Butoane agenți — orizontal: icon + text */
.agent-btn {
  width: 100%;
  padding: 7px 10px 7px 12px;
  background: transparent;
  border: none;
  border-left: 2px solid transparent;
  border-radius: 0;
  cursor: pointer;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 9px;
  transition: background .12s, border-color .12s;
  color: var(--text);
  text-align: left;
}
.agent-btn:hover {
  background: var(--bubble);
  border-left-color: var(--line);
}
.agent-btn.active {
  background: color-mix(in srgb, var(--agent-color, var(--c-smarald)) 10%, transparent);
  border-left-color: var(--agent-color, var(--c-smarald));
}

/* Icon SVG */
.agent-icon {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  transition: color .12s;
}
.agent-icon svg { width: 16px; height: 16px; }
.agent-btn:hover .agent-icon { color: var(--text); }
.agent-btn.active .agent-icon { color: var(--agent-color, var(--c-smarald)); }

/* Denumire asistent */
.agent-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex: 1;
  transition: color .12s;
}
.agent-btn:hover .agent-name { color: var(--text); }
.agent-btn.active .agent-name { color: var(--text); font-weight: 600; }

/* ── Attachment preview în composer ─────────────────────────────────── */
.attachment-preview {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  background: var(--bubble);
  border-radius: 8px;
  margin-bottom: 6px;
  border: 1px solid var(--line);
}
.attach-thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.attach-name {
  font-size: 12px;
  color: var(--muted);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attach-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  transition: color .15s, background .15s;
}
.attach-remove:hover { color: var(--text); background: var(--line); }

/* ── Bară tokeni ─────────────────────────────────────────────────────── */
.token-bar {
  position: fixed;
  bottom: 0;
  right: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}
.token-bar-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
  font-size: 11px;
  color: var(--muted);
  transition: color .15s, background .15s;
  white-space: nowrap;
}
.token-bar-toggle:hover { color: var(--text); background: var(--bubble); }
.token-bar-toggle svg { opacity: .7; }

/* Panel desfăcut */
.token-bar-panel {
  width: 560px;
  max-width: calc(100vw - 32px);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 10px 0 0 0;
  box-shadow: 0 -4px 24px rgba(0,0,0,.10);
  overflow: hidden;
}
.token-bar-panel.hidden { display: none; }

.tbp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px 8px;
  border-bottom: 1px solid var(--line);
}
.tbp-title { font-size: 13px; font-weight: 700; color: var(--text); }
.tbp-close {
  background: transparent; border: none; cursor: pointer;
  color: var(--muted); font-size: 16px; padding: 2px 6px; border-radius: 4px;
}
.tbp-close:hover { color: var(--text); background: var(--bubble); }

.tbp-body { padding: 14px 16px 16px; overflow-y: auto; max-height: 360px; }
.tbp-loading { color: var(--muted); font-size: 12px; text-align: center; padding: 20px; }
.tbp-empty { color: var(--muted); font-size: 12px; text-align: center; padding: 24px; }

/* Carduri sumar */
.tbp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 16px; }
.tbp-card {
  background: var(--bubble);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.tbp-card-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-bottom: 4px; }
.tbp-big { font-size: 22px; font-weight: 700; color: var(--text); }
.tbp-sub { font-size: 10px; color: var(--muted); margin-top: 2px; }
.tbp-cost { font-size: 11px; color: var(--c-smarald); margin-top: 4px; font-weight: 600; }

/* Grafic săptămânal */
.tbp-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 12px 0 8px; }
.tbp-weeks { display: flex; gap: 8px; align-items: flex-end; height: 70px; }
.tbp-week { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: 1; height: 100%; justify-content: flex-end; }
.tbp-week-bar { width: 100%; flex: 1; background: var(--bubble); border-radius: 3px 3px 0 0; position: relative; overflow: hidden; }
.tbp-week-fill { position: absolute; bottom: 0; left: 0; right: 0; background: var(--c-smarald); border-radius: 3px 3px 0 0; transition: height .4s ease; opacity: .7; }
.tbp-week-val { font-size: 9px; color: var(--text); font-weight: 600; }
.tbp-week-label { font-size: 9px; color: var(--muted); }

/* Tabel modele */
.tbp-table { width: 100%; border-collapse: collapse; font-size: 11px; margin-top: 6px; }
.tbp-table th { text-align: left; padding: 4px 6px; font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--line); }
.tbp-table td { padding: 5px 6px; border-bottom: 1px solid var(--bubble); color: var(--text); }
.tbp-table tr:last-child td { border-bottom: none; }
.tbp-model-name { font-weight: 600; color: var(--c-smarald); }

/* ── Landing page ───────────────────────────────────────────────────────── */
.landing-page { max-width: 1100px; margin: 0 auto; padding: 0 1.5rem; }

.hero-section { text-align: center; padding: 4rem 0 3rem; }
.hero-badge {
  display: inline-block; background: color-mix(in srgb, var(--c-smarald) 15%, transparent);
  color: var(--c-smarald); border: 1px solid color-mix(in srgb, var(--c-smarald) 30%, transparent);
  border-radius: 2rem; padding: .35rem 1rem; font-size: .8rem; font-weight: 600;
  letter-spacing: .03em; margin-bottom: 1.5rem;
}
.hero-title { font-size: clamp(2rem, 5vw, 3.2rem); font-weight: 800; line-height: 1.15; margin: 0 0 1.2rem; }
.accent-gradient {
  background: linear-gradient(135deg, #2a6054, #4da898);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
}
.hero-sub { font-size: 1.15rem; max-width: 640px; margin: 0 auto 2rem; color: var(--muted); line-height: 1.6; }
.hero-actions { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.btn-lg { padding: .75rem 2rem; font-size: 1rem; }
.hero-note { font-size: .85rem; margin-top: 1rem; }

.stats-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1px;
  background: var(--line); border: 1px solid var(--line); border-radius: 1rem;
  overflow: hidden; margin: 2rem 0 3rem;
}
.stat-item { background: var(--card); padding: 1.5rem 1rem; text-align: center; }
.stat-num { display: block; font-size: 1.55rem; font-weight: 800; color: var(--c-smarald); }
.stat-lbl { font-size: .8rem; color: var(--muted); }

.section-title { text-align: center; font-size: 1.8rem; font-weight: 700; margin: 0 0 .5rem; }
.section-sub { text-align: center; margin-bottom: 2.5rem; }

.features-section, .examples-section, .how-section, .pricing-section, .norms-section { margin: 3rem 0; }
.features-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 1.2rem;
}
.features-grid--core { grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); }
.feature-card {
  background: var(--card); border: 1px solid var(--line); border-radius: .75rem;
  padding: 1.5rem; transition: box-shadow .2s, transform .2s;
}
.feature-card:hover { box-shadow: 0 4px 20px rgba(0,0,0,.08); transform: translateY(-1px); }
.feature-icon {
  width: 2rem; height: 2rem; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: .75rem; color: var(--c-smarald); border: 1px solid color-mix(in srgb, var(--c-smarald) 30%, transparent);
  background: color-mix(in srgb, var(--c-smarald) 8%, transparent); font-weight: 800;
}
.feature-card h3 { font-size: 1rem; font-weight: 700; margin: 0 0 .5rem; }

.examples-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; margin-top: 1.5rem; }
.example-card {
  background: var(--card); border: 1px solid var(--line); border-radius: .85rem; padding: 1rem 1.1rem;
  color: var(--text); box-shadow: 0 1px 0 rgba(22,33,54,.02);
}

.steps { display: flex; align-items: flex-start; gap: 1rem; justify-content: center; flex-wrap: wrap; }
.step { max-width: 240px; text-align: center; }
.step-num {
  width: 2.5rem; height: 2.5rem; border-radius: 50%; background: var(--c-smarald); color: #fff;
  font-size: 1.1rem; font-weight: 800; display: inline-flex; align-items: center; justify-content: center; margin-bottom: .75rem;
}
.step h3 { font-size: 1rem; font-weight: 700; margin: 0 0 .4rem; }
.step-arrow { font-size: 1.5rem; color: var(--muted); align-self: center; margin-top: -1rem; }

.pricing-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1.2rem; justify-content: center; }
.pricing-card { background: var(--card); border: 1px solid var(--line); border-radius: 1rem; padding: 2rem 1.5rem; position: relative; text-align: center; }
.pricing-featured { border-color: var(--c-smarald); border-width: 2px; box-shadow: 0 4px 24px rgba(42,96,84,.15); }
.pricing-badge {
  position: absolute; top: -1px; left: 50%; transform: translateX(-50%); background: var(--c-smarald); color: #fff;
  font-size: .75rem; font-weight: 700; padding: .25rem .9rem; border-radius: 0 0 .5rem .5rem; white-space: nowrap;
}
.pricing-name { font-weight: 700; font-size: 1.1rem; margin-bottom: .5rem; }
.price-amount { font-size: 2rem; font-weight: 800; color: var(--c-smarald); }
.pricing-desc { font-size: .9rem; margin: .75rem 0 .5rem; }
.pricing-limit { font-size: .8rem; }

.norms-columns { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 2rem; margin-top: 2rem; }
.norms-col-title { font-size: .95rem; font-weight: 700; margin-bottom: .75rem; color: var(--text, #111); }
.norms-grid { display: flex; flex-wrap: wrap; gap: .6rem; }
.norm-chip { background: var(--card); border: 1px solid var(--line); border-radius: 2rem; padding: .35rem .9rem; font-size: .82rem; font-weight: 500; white-space: nowrap; }
.norms-note { text-align: center; margin-top: 1.5rem; max-width: 600px; margin-left: auto; margin-right: auto; }
.pricing-note-free { margin: .5rem 0; font-size: .78rem; line-height: 1.5; }

.cta-section {
  text-align: center; background: linear-gradient(135deg, #162136, #2a6054); color: #fff;
  border-radius: 1.2rem; padding: 3.5rem 2rem; margin: 3rem 0 2rem;
}
.cta-section h2 { font-size: 1.8rem; font-weight: 800; color: #fff; margin-bottom: .75rem; }
.cta-section p { color: rgba(255,255,255,.75); margin-bottom: 1.5rem; }
.cta-section .btn-lg { background: #fff; color: #162136; font-weight: 700; }
.cta-section .btn-lg:hover { background: #e8f4f2; }

/* ── Auth pages ──────────────────────────────────────────────────────────── */
.auth-page { max-width: 980px; }
.auth-shell { display: grid; grid-template-columns: minmax(320px, 430px) 1fr; gap: 1.5rem; align-items: stretch; }
.auth-card { margin: 0; }
.auth-kicker {
  margin: 0 0 .4rem; color: var(--c-smarald); font-size: .78rem; font-weight: 800;
  letter-spacing: .08em; text-transform: uppercase;
}
.form-hint { margin: .45rem 0 0; color: var(--muted); font-size: .82rem; }
.auth-aside {
  border: 1px solid var(--line); border-radius: var(--radius); padding: 1.6rem;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--c-smarald) 22%, transparent), transparent 32%),
    linear-gradient(135deg, color-mix(in srgb, var(--c-indigo) 98%, #fff), color-mix(in srgb, var(--c-smarald) 72%, var(--c-indigo)));
  color: #fff; box-shadow: var(--shadow); display: flex; flex-direction: column; justify-content: center;
}
.auth-aside h2 { color: #fff; font-size: 1.55rem; line-height: 1.25; margin: .9rem 0 1rem; }
.auth-badge {
  align-self: flex-start; border: 1px solid rgba(255,255,255,.24); border-radius: 999px;
  padding: .28rem .75rem; color: rgba(255,255,255,.86); font-size: .78rem; font-weight: 700;
}
.auth-points { margin: 0; padding-left: 1.15rem; color: rgba(255,255,255,.86); }
.auth-points li { margin: .45rem 0; }
.auth-note { margin: 1.2rem 0 0; color: rgba(255,255,255,.72); font-size: .9rem; }

@media (max-width: 760px) {
  .auth-page { max-width: 460px; }
  .auth-shell { grid-template-columns: 1fr; }
  .auth-aside { display: none; }
  .hero-section { padding-top: 2.5rem; }
  .step-arrow { display: none; }
}

/* ── Billing page ─────────────────────────────────────────────────────────── */
.billing-page { max-width: 1080px; }
.billing-hero {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 1.5rem;
  margin: 1.5rem 0 1.75rem; padding: 2rem;
  border: 1px solid var(--line); border-radius: 1.2rem;
  background:
    radial-gradient(circle at top right, color-mix(in srgb, var(--c-smarald) 14%, transparent), transparent 34%),
    var(--card);
  box-shadow: var(--shadow);
}
.billing-hero h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); line-height: 1.12; margin: 0 0 .65rem; }
.billing-hero p { max-width: 650px; margin: 0; }
.billing-current {
  min-width: 160px; display: grid; gap: .45rem; justify-items: end;
  padding: .9rem 1rem; border: 1px solid var(--line); border-radius: .9rem; background: var(--bg);
}
.billing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.15rem; align-items: stretch; }
.billing-card {
  position: relative; margin: 0; display: flex; flex-direction: column; gap: .9rem;
  padding: 1.55rem; border-radius: 1rem;
}
.billing-card--featured {
  border-color: var(--c-smarald); border-width: 2px;
  box-shadow: 0 18px 44px rgba(42,96,84,.16);
}
.billing-plan-name { font-size: 1.05rem; font-weight: 800; letter-spacing: .01em; }
.billing-included {
  display: flex; align-items: center; gap: .75rem; padding: .85rem .95rem;
  border: 1px solid var(--line); border-radius: .9rem;
  background: color-mix(in srgb, var(--c-smarald) 6%, var(--bubble));
}
.billing-included strong { color: var(--c-smarald); font-size: 1.45rem; line-height: 1; }
.billing-included span { color: var(--muted); font-size: .82rem; line-height: 1.35; }
.billing-points {
  margin: 0 0 .35rem; padding-left: 1.1rem; color: var(--muted); font-size: .9rem;
  flex: 1;
}
.billing-points li { margin: .4rem 0; }
.billing-card form { margin-top: auto; }

@media (max-width: 900px) {
  .billing-grid { grid-template-columns: 1fr; }
  .billing-hero { align-items: flex-start; flex-direction: column; padding: 1.5rem; }
  .billing-current { justify-items: start; }
}

/* ── Shared inner pages ───────────────────────────────────────────────────── */
.page-hero {
  margin: 1.5rem 0 1.25rem; padding: 1.65rem 1.8rem;
  border: 1px solid var(--line); border-radius: 1.1rem; background: var(--card);
  box-shadow: var(--shadow);
}
.page-hero.compact h1 { font-size: clamp(1.7rem, 3.4vw, 2.35rem); line-height: 1.15; }
.page-hero.compact p:last-child { margin-bottom: 0; }
.page-hero--actions { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.account-page, .templates-page, .template-edit-page { max-width: 980px; }
.account-grid { display: grid; grid-template-columns: minmax(280px, .9fr) minmax(320px, 1.1fr); gap: 1rem; }
.account-card { margin: 0; }
.account-meta { margin: 0; display: grid; gap: .75rem; }
.account-meta div {
  display: grid; grid-template-columns: 90px 1fr; gap: .75rem; padding-bottom: .75rem;
  border-bottom: 1px solid var(--line);
}
.account-meta div:last-child { border-bottom: 0; padding-bottom: 0; }
.account-meta dt { color: var(--muted); font-size: .82rem; }
.account-meta dd { margin: 0; font-weight: 700; overflow-wrap: anywhere; }
.templates-card, .editor-card { margin-top: 0; }
.empty-card { text-align: center; padding: 2.4rem 1rem; }
.empty-card h2 { margin-bottom: .4rem; }
.editor-card textarea {
  min-height: 420px; line-height: 1.55; border-radius: 12px;
  background: color-mix(in srgb, var(--input-bg) 92%, var(--bubble));
}

@media (max-width: 760px) {
  .page-hero--actions { align-items: flex-start; flex-direction: column; }
  .account-grid { grid-template-columns: 1fr; }
  .account-meta div { grid-template-columns: 1fr; gap: .2rem; }
}

/* Din Proiect — picker artefacte */
.fp-list { max-height: 380px; overflow-y: auto; padding: 4px 0; }
.fp-item { width: 100%; display: flex; align-items: center; gap: 10px; padding: 10px 16px;
  border: 0; background: transparent; cursor: pointer; text-align: left; border-radius: 8px; }
.fp-item:hover { background: var(--bubble); }
.fp-icon { font-size: 18px; flex-shrink: 0; }
.fp-name { font-size: 13px; font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fp-conv { font-size: 11px; color: var(--muted); white-space: nowrap; flex-shrink: 0; max-width: 100px; overflow: hidden; text-overflow: ellipsis; }
.fp-empty { padding: 20px 16px; color: var(--muted); font-size: 14px; text-align: center; }
