/* EC$ 360° Assistente — layout família (UI BANK 2026) */
:root {
  --navy: #0f172a;
  --navy-2: #1e293b;
  --navy-3: #334155;
  --gold: #d4af37;
  --gold-2: #f0d060;
  --gold-dark: #a68b2a;
  --cream: #faf8f3;
  --card: #ffffff;
  --line: rgba(212,175,55,.22);
  --muted: #94a3b8;
  --text: #f8fafc;
  --text-dark: #0f172a;
  --ok: #10b981;
  --bad: #ef4444;
  --warn: #f59e0b;
  --radius: 18px;
  --bottom-nav-h: 68px;
  --shadow: 0 8px 32px rgba(15,23,42,.35);
  --shadow-gold: 0 8px 28px rgba(212,175,55,.28);
  --font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  height: 100%;
  font-family: var(--font);
  background: var(--navy);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
}
body {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse 90% 50% at 50% -10%, rgba(212,175,55,.14), transparent 55%),
    linear-gradient(180deg, #0f172a 0%, #0b1220 100%);
  padding-bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
}
.hidden { display: none !important; }

/* Header */
.nx-top, .as-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px;
  background: linear-gradient(180deg, rgba(30,41,59,.95), rgba(15,23,42,.88));
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  position: sticky;
  top: 0;
  z-index: 30;
}
.nx-brand, .as-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.nx-logo, .as-logo {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  object-fit: contain;
  background: linear-gradient(145deg, #1e293b, #0f172a);
  border: 1px solid rgba(212,175,55,.4);
  box-shadow: 0 0 20px rgba(212,175,55,.2);
  padding: 4px;
}
.nx-brand strong, .as-brand strong {
  display: block;
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -.01em;
  background: linear-gradient(135deg, #f0d060, #d4af37);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.nx-sub, .as-sub {
  display: block;
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}
.nx-top-actions, .as-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
.badge {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(212,175,55,.35);
}
.badge.sim { background: rgba(212,175,55,.15); color: var(--gold-2); }
.badge.live { background: rgba(16,185,129,.15); color: var(--ok); border-color: rgba(16,185,129,.35); }
.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.06);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn:active { transform: scale(.96); }

/* Main */
.nx-main, .as-main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 14px 14px 24px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

/* Cards / feed */
.msg {
  background: rgba(30,41,59,.72);
  border: 1px solid rgba(255,255,255,.06);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
  box-shadow: var(--shadow);
}
.msg h4 {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 8px;
}
.msg p, .msg li { font-size: 14px; line-height: 1.5; color: #e2e8f0; }
.msg ul { margin: 8px 0 0 18px; }
.msg.user {
  border-left: 3px solid var(--gold);
  background: linear-gradient(135deg, rgba(212,175,55,.12), rgba(30,41,59,.8));
}
.msg.plan {
  border: 1px solid rgba(212,175,55,.28);
  background: linear-gradient(160deg, rgba(212,175,55,.1), rgba(15,23,42,.9));
}
.msg.system { border-left: 3px solid #60a5fa; }
.msg.result { border-left: 3px solid var(--ok); }
.msg.error {
  border-left: 3px solid var(--bad);
  background: rgba(239,68,68,.08);
}
.msg .meta { font-size: 12px; color: var(--muted); margin-top: 6px; }

.step-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.05);
}
.step-row:last-child { border-bottom: 0; }
.step-status {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
  background: rgba(255,255,255,.08);
  color: var(--muted);
}
.step-status.ok { background: rgba(16,185,129,.2); color: var(--ok); }
.step-status.run { background: rgba(212,175,55,.2); color: var(--gold-2); }
.step-status.fail { background: rgba(239,68,68,.2); color: var(--bad); }
.step-status.wait { background: rgba(245,158,11,.2); color: var(--warn); }

/* Quick actions grid (atalhos) */
.as-hero {
  background: linear-gradient(145deg, rgba(212,175,55,.18), rgba(30,41,59,.9));
  border: 1px solid rgba(212,175,55,.3);
  border-radius: 22px;
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-gold);
}
.as-hero h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold-2);
  margin-bottom: 6px;
}
.as-hero p { font-size: 13px; color: var(--muted); line-height: 1.45; }
.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 14px;
}
.quick-card {
  background: rgba(255,255,255,.04);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 14px 12px;
  cursor: pointer;
  text-align: left;
  color: var(--text);
  font: inherit;
  transition: border-color .15s, transform .1s;
}
.quick-card:active { transform: scale(.98); }
.quick-card:hover, .quick-card:focus {
  border-color: rgba(212,175,55,.45);
  outline: none;
}
.quick-card .qi {
  font-size: 22px;
  margin-bottom: 8px;
  display: block;
}
.quick-card strong {
  display: block;
  font-size: 13px;
  font-weight: 800;
  color: var(--gold-2);
  margin-bottom: 4px;
}
.quick-card span {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.35;
}

/* Artifacts */
.nx-artifacts, .as-artifacts {
  background: rgba(30,41,59,.6);
  border: 1px solid rgba(212,175,55,.2);
  border-radius: var(--radius);
  padding: 14px;
  margin-top: 8px;
}
.nx-artifacts h3, .as-artifacts h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--gold);
  margin-bottom: 10px;
}
.art-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,.06);
  font-size: 13px;
}
.art-item:last-child { border-bottom: 0; }
.art-item a {
  color: var(--gold-2);
  font-weight: 700;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 10px;
  background: rgba(212,175,55,.12);
  border: 1px solid rgba(212,175,55,.3);
  white-space: nowrap;
}

/* Approvals */
.nx-approvals .approve-box {
  background: rgba(245,158,11,.1);
  border: 1px solid rgba(245,158,11,.35);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}
.approve-actions { display: flex; gap: 8px; margin-top: 10px; }

/* Command bar */
.nx-cmd, .as-cmd {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  z-index: 25;
  padding: 8px 12px;
  background: linear-gradient(180deg, transparent, rgba(15,23,42,.98) 30%);
  max-width: 720px;
  margin: 0 auto;
}
.nx-cmd-inner, .as-cmd-inner {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  background: var(--navy-2);
  border: 1px solid rgba(212,175,55,.28);
  border-radius: 18px;
  padding: 8px 10px;
  box-shadow: var(--shadow);
}
.nx-cmd-tools { display: flex; gap: 4px; }
.chip {
  border: 0;
  background: rgba(255,255,255,.08);
  color: var(--text);
  border-radius: 10px;
  padding: 8px 10px;
  font-size: 14px;
  cursor: pointer;
}
#cmd-input {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 15px;
  resize: none;
  min-height: 24px;
  max-height: 100px;
  outline: none;
}
#cmd-input::placeholder { color: var(--muted); }
.btn-run {
  border: 0;
  background: linear-gradient(135deg, #f0d060, #d4af37);
  color: var(--navy);
  font-weight: 800;
  border-radius: 12px;
  padding: 10px 16px;
  cursor: pointer;
  font-size: 14px;
  box-shadow: var(--shadow-gold);
}
.btn-run:disabled { opacity: .5; cursor: not-allowed; }
.nx-hint, .as-hint {
  font-size: 11px;
  color: var(--muted);
  text-align: center;
  margin-top: 6px;
  padding: 0 8px;
}

/* Bottom nav — padrão EC$ */
.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  height: calc(var(--bottom-nav-h) + env(safe-area-inset-bottom, 0px));
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom, 0px));
  display: flex;
  justify-content: space-around;
  align-items: flex-start;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border-top: 1px solid rgba(212,175,55,.2);
  box-shadow: 0 -8px 32px rgba(0,0,0,.35);
}
.bottom-nav button {
  flex: 1;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 10px;
  font-weight: 700;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 4px;
  cursor: pointer;
  max-width: 80px;
}
.bottom-nav button .ico { font-size: 20px; line-height: 1; }
.bottom-nav button.active {
  color: var(--gold-2);
}
.bottom-nav button.active .ico {
  filter: drop-shadow(0 0 8px rgba(212,175,55,.5));
}

/* Modal settings — glass */
.modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(2,6,23,.72);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  backdrop-filter: blur(8px);
}
.modal.hidden { display: none !important; }
.modal-card {
  width: 100%;
  max-width: 480px;
  max-height: 88dvh;
  overflow-y: auto;
  background: linear-gradient(180deg, #1e293b, #0f172a);
  border: 1px solid rgba(212,175,55,.3);
  border-radius: 24px 24px 16px 16px;
  padding: 20px 18px 24px;
  box-shadow: var(--shadow);
}
.modal-card h2 {
  font-size: 18px;
  font-weight: 800;
  color: var(--gold-2);
  margin-bottom: 14px;
}
.modal-card label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin: 12px 0 4px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.modal-card input,
.modal-card select {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,.12);
  background: rgba(0,0,0,.25);
  color: var(--text);
  font: inherit;
  font-size: 15px;
}
.modal-card input:focus,
.modal-card select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(212,175,55,.2);
}
.modal-card .muted {
  font-size: 12px;
  color: var(--muted);
  margin: 8px 0;
  line-height: 1.4;
}
.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}
.btn {
  flex: 1;
  border: 0;
  border-radius: 14px;
  padding: 14px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  font-family: inherit;
}
.btn.primary {
  background: linear-gradient(135deg, #f0d060, #d4af37);
  color: var(--navy);
  box-shadow: var(--shadow-gold);
}
.btn.secondary {
  background: rgba(255,255,255,.08);
  color: var(--text);
  border: 1px solid rgba(255,255,255,.12);
}

/* Desktop */
@media (min-width: 900px) {
  body { padding-bottom: 24px; }
  .bottom-nav {
    left: 50%;
    transform: translateX(-50%);
    max-width: 520px;
    border-radius: 20px 20px 0 0;
  }
  .nx-cmd, .as-cmd {
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
  }
  .nx-main, .as-main { padding-bottom: 140px; }
}

/* Panel visibility */
[data-panel].panel-hidden { display: none !important; }
