/* Orbe — reskin com Astryx (design system open-source da Meta)
   Tema: Astryx Neutral (tokens oficiais) + acento violeta da marca Orbe.
   Tipografia Figtree (fontes do pacote @astryxdesign/theme-neutral). */

:root {
  /* superfícies e texto — Astryx Neutral (light) */
  --bg: #f1f1f1;               /* --color-background-body   */
  --surface: #ffffff;          /* --color-background-surface */
  --ink: #000000;              /* --color-text-primary      */
  --ink-2: #474747;            /* --color-text-secondary    */
  --ink-3: #6a6a6a;            /* --color-icon-secondary    */
  --ink-4: #919191;            /* --color-text-disabled     */
  --line: rgba(0,0,0,.08);     /* --color-border            */
  --line-2: rgba(0,0,0,.045);  /* divisores internos        */
  --line-strong: #d4d4d4;      /* --color-border-emphasized */

  /* acento da marca Orbe (theming em nível de marca, como o Astryx prevê) */
  --accent: #5b4fd8;
  --accent-ink: #4638c2;
  --accent-soft: #ede9fd;
  --accent-soft-2: #e2dbfc;

  /* status — paleta Astryx Neutral */
  --green: #198100;  --green-soft: #bce0bb;  --green-ink: #00490b;
  --amber: #836700;  --amber-soft: #fae19e;  --amber-ink: #4b3900;
  --red: #c9303a;    --red-soft: #ffc4be;    --red-ink: #76000c;
  --blue: #0074e2;   --blue-soft: #b9d7ff;   --blue-ink: #003978;

  /* raios — Astryx Neutral */
  --radius-inner: 6px;
  --radius: 10px;              /* --radius-element   */
  --radius-lg: 12px;           /* --radius-container */

  /* elevação — Astryx Neutral shadows */
  --shadow: 0 2px 4px rgba(0,0,0,.05), 0 4px 8px rgba(0,0,0,.10);
  --shadow-med: 0 2px 4px rgba(0,0,0,.05), 0 4px 12px rgba(0,0,0,.10);
  --shadow-high: 0 4px 6px rgba(0,0,0,.10), 0 12px 24px rgba(0,0,0,.15);

  /* interação — Astryx overlay + focus ring + motion */
  --hover: rgba(0,0,0,.05);    /* --color-overlay-hover   */
  --pressed: rgba(0,0,0,.10);  /* --color-overlay-pressed */
  --ring: 0 0 0 2px var(--surface), 0 0 0 4px var(--accent);
  --t: 125ms cubic-bezier(.2,0,.38,.9);

  --sidebar-w: 240px;
  font-family: "Figtree", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.45; -webkit-font-smoothing: antialiased; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; }
:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--radius-inner); }
::selection { background: var(--accent-soft-2); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: rgba(0,0,0,.18); border-radius: 6px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(0,0,0,.28); background-clip: content-box; border: 2px solid transparent; }

/* ===== layout ===== */
#shell { display: flex; height: 100vh; overflow: hidden; }
aside {
  width: var(--sidebar-w); min-width: var(--sidebar-w); background: var(--surface);
  border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto;
}
main { flex: 1; overflow-y: auto; }
.page { max-width: 1180px; margin: 0 auto; padding: 24px 32px 80px; }

/* ===== sidebar ===== */
.brand { display: flex; align-items: center; gap: 9px; padding: 16px 16px 12px; font-weight: 700; font-size: 15.5px; letter-spacing: -.01em; }
.brand .dot { width: 24px; height: 24px; border-radius: 8px; background: linear-gradient(135deg, var(--accent), #9a4fd8); display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 12.5px; font-weight: 700; box-shadow: var(--shadow); }
.brand small { color: var(--ink-4); font-weight: 500; font-size: 11px; margin-left: auto; }
.nav-sec { padding: 12px 18px 4px; font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--ink-4); font-weight: 700; }
.nav-item { display: flex; align-items: center; gap: 9px; margin: 1px 8px; padding: 6px 10px; color: var(--ink-2); cursor: pointer; font-size: 13.5px; font-weight: 500; border-radius: 8px; transition: background var(--t), color var(--t); }
.nav-item:hover { background: var(--hover); color: var(--ink); }
.nav-item.active { color: var(--accent-ink); font-weight: 650; background: var(--accent-soft); }
.nav-item .ic { width: 16px; text-align: center; opacity: .7; font-size: 12.5px; }
.nav-item.active .ic { opacity: 1; }
.nav-item .badge { margin-left: auto; background: var(--red); color: #fff; border-radius: 999px; font-size: 10.5px; font-weight: 700; padding: 0 6px; line-height: 17px; }
.nav-item .count { margin-left: auto; color: var(--ink-4); font-size: 11.5px; font-weight: 500; }
.side-foot { margin: 8px; margin-top: auto; padding: 10px; border-top: 1px solid var(--line-2); color: var(--ink-3); font-size: 12.5px; font-weight: 500; display: flex; gap: 8px; align-items: center; }
.avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; }

/* ===== generic ===== */
h1 { font-size: 21px; font-weight: 700; letter-spacing: -.02em; }
h2 { font-size: 16px; font-weight: 700; letter-spacing: -.01em; }
h3 { font-size: 14px; font-weight: 700; }
.page-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.page-head .sub { color: var(--ink-3); font-size: 13px; margin-top: 3px; }
.page-head .spacer { flex: 1; }

/* botões — alturas Astryx (md 32 / sm 28), raio element 10px */
.btn { height: 32px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 0 12px; font-size: 13px; font-weight: 600; color: var(--ink-2); display: inline-flex; align-items: center; justify-content: center; gap: 6px; transition: background var(--t), border-color var(--t), color var(--t), box-shadow var(--t); }
.btn:hover { background: var(--hover); color: var(--ink); }
.btn:active { background: var(--pressed); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; box-shadow: var(--shadow); }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); color: #fff; }
.btn.small { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 8px; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); }
.card-pad { padding: 16px 18px; }
.grid { display: grid; gap: 14px; }
.muted { color: var(--ink-3); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, "SF Mono", Monaco, Consolas, "Liberation Mono", "Courier New", monospace; font-size: 12.5px; }

/* badges — pares bg/texto da paleta Astryx */
.tag { display: inline-flex; align-items: center; background: #e2e2e2; color: #1b1b1b; border-radius: var(--radius-inner); padding: 2px 8px; font-size: 11.5px; font-weight: 650; line-height: 16px; }
.tag.violet { background: var(--accent-soft); color: var(--accent-ink); }
.tag.green { background: var(--green-soft); color: var(--green-ink); }
.tag.amber { background: var(--amber-soft); color: var(--amber-ink); }
.tag.red { background: var(--red-soft); color: var(--red-ink); }
.tag.blue { background: var(--blue-soft); color: var(--blue-ink); }
.kbd { border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 6px; padding: 0 5px; font-size: 11px; background: var(--surface); color: var(--ink-3); }

/* tables */
table.tbl { width: 100%; border-collapse: collapse; background: var(--surface); }
.tbl th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); font-weight: 700; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.tbl td { padding: 10px 14px; border-bottom: 1px solid var(--line-2); vertical-align: middle; }
.tbl tr.row { cursor: pointer; transition: background var(--t); }
.tbl tr.row:hover { background: var(--hover); }
.tbl tr.row:last-child td { border-bottom: none; }
.cell-main { font-weight: 650; }
.cell-sub { color: var(--ink-3); font-size: 12px; }

/* views bar — segmented control Astryx: trilha cinza, item ativo branco */
.views { display: inline-flex; gap: 2px; margin-bottom: 12px; align-items: center; background: rgba(0,0,0,.05); border-radius: 10px; padding: 3px; }
.view-pill { height: 28px; display: inline-flex; align-items: center; padding: 0 12px; border-radius: 8px; font-size: 13px; font-weight: 500; color: var(--ink-2); cursor: pointer; border: none; background: transparent; transition: background var(--t), color var(--t); }
.view-pill:hover { color: var(--ink); }
.view-pill.active { background: var(--surface); color: var(--ink); font-weight: 650; box-shadow: var(--shadow); }

/* health bar */
.health { display: inline-flex; align-items: center; gap: 7px; }
.health .bar { width: 46px; height: 5px; border-radius: 3px; background: rgba(0,0,0,.10); overflow: hidden; }
.health .bar i { display: block; height: 100%; border-radius: 3px; }
.health b { font-size: 12.5px; font-weight: 650; }

/* AI badge */
.ai { display: inline-flex; align-items: center; gap: 4px; color: var(--accent-ink); font-size: 11px; font-weight: 700; background: var(--accent-soft); border-radius: var(--radius-inner); padding: 2px 7px; }
.ai::before { content: "✦"; }

/* detail layout */
.detail-head { margin-bottom: 16px; }
.detail-grid { display: grid; grid-template-columns: 1fr 330px; gap: 16px; align-items: start; }
.field-row { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.field-row:last-child { border-bottom: none; }
.field-row .k { color: var(--ink-3); }
.field-row .v { text-align: right; font-weight: 550; }

/* timeline */
.tl-item { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.tl-item:last-child { border-bottom: none; }
.tl-ic { width: 32px; height: 32px; min-width: 32px; border-radius: 9px; display: flex; align-items: center; justify-content: center; font-size: 13.5px; }
.tl-ic.email { background: var(--blue-soft); } .tl-ic.meeting { background: var(--accent-soft); }
.tl-ic.note { background: var(--amber-soft); } .tl-ic.task { background: var(--green-soft); }
.tl-item .when { margin-left: auto; color: var(--ink-4); font-size: 12px; white-space: nowrap; }
.tl-body { color: var(--ink-2); font-size: 13px; margin-top: 3px; white-space: pre-wrap; }

/* kanban */
.board { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; }
.col { min-width: 244px; width: 244px; background: rgba(0,0,0,.04); border-radius: var(--radius-lg); padding: 10px; }
.col-head { display: flex; align-items: baseline; gap: 7px; padding: 3px 6px 10px; font-weight: 700; font-size: 13px; }
.col-head .n { color: var(--ink-3); font-weight: 500; font-size: 12px; }
.col-head .sum { margin-left: auto; color: var(--ink-3); font-size: 11.5px; font-weight: 500; }
.deal { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 11px 12px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow); transition: box-shadow var(--t), transform var(--t); }
.deal:hover { box-shadow: var(--shadow-med); transform: translateY(-1px); }
.deal .v { font-weight: 700; font-size: 13.5px; margin-top: 4px; letter-spacing: -.01em; }
.deal .meta { display: flex; gap: 8px; color: var(--ink-3); font-size: 11.5px; margin-top: 5px; }
.deal .risk { margin-top: 8px; font-size: 11.5px; font-weight: 500; color: var(--red-ink); background: var(--red-soft); border-radius: var(--radius-inner); padding: 5px 8px; }
.stage-desc { font-size: 11.5px; color: var(--ink-3); padding: 0 6px 8px; line-height: 1.4; }

/* chat */
.chat-wrap { display: grid; grid-template-columns: 250px 1fr; height: calc(100vh - 0px); }
.chat-side { border-right: 1px solid var(--line); background: var(--surface); padding: 14px 10px; overflow-y: auto; }
.chat-main { display: flex; flex-direction: column; height: 100vh; }
.chat-scroll { flex: 1; overflow-y: auto; padding: 26px 0 12px; }
.chat-inner { max-width: 760px; margin: 0 auto; padding: 0 28px; }
.msg { margin-bottom: 22px; }
.msg .who { font-size: 11.5px; font-weight: 700; color: var(--ink-3); margin-bottom: 5px; display: flex; gap: 6px; align-items: center; text-transform: uppercase; letter-spacing: .05em; }
.msg .body { white-space: pre-wrap; }
.msg.user .body { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 10px 14px; display: inline-block; box-shadow: var(--shadow); }
.chat-input-bar { border-top: 1px solid var(--line); padding: 14px 28px 18px; background: var(--bg); }
.chat-box { max-width: 760px; margin: 0 auto; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; padding: 10px 14px; box-shadow: var(--shadow); transition: box-shadow var(--t), border-color var(--t); }
.chat-box:focus-within { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent), var(--shadow); }
.chat-box textarea { width: 100%; border: none; outline: none; resize: none; background: transparent; font-size: 14px; box-shadow: none !important; }
.chat-box .row { display: flex; align-items: center; margin-top: 6px; gap: 8px; }
.chat-box .hint { color: var(--ink-4); font-size: 11.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0 4px; }
.chip { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; height: 30px; display: inline-flex; align-items: center; padding: 0 13px; font-size: 12.5px; font-weight: 550; color: var(--ink-2); cursor: pointer; transition: border-color var(--t), color var(--t), background var(--t); }
.chip:hover { border-color: var(--accent); color: var(--accent-ink); background: var(--accent-soft); }
.agent-steps { color: var(--ink-3); font-size: 12.5px; margin: 6px 0 10px; }
.agent-steps div { padding: 2px 0; }
.report-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; margin-top: 10px; box-shadow: var(--shadow); }
.queued-card { background: var(--amber-soft); border: 1px solid rgba(0,0,0,.06); border-radius: var(--radius); padding: 9px 12px; margin-bottom: 8px; font-size: 13px; color: var(--amber-ink); display: flex; gap: 10px; align-items: center; }

/* signals */
.signal { display: flex; gap: 12px; align-items: flex-start; padding: 13px 16px; border-bottom: 1px solid var(--line-2); transition: background var(--t); }
.signal:hover { background: var(--hover); }
.signal:last-child { border-bottom: none; }
.score { min-width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 14px; background: var(--accent-soft); color: var(--accent-ink); }

/* sequences */
.step { display: flex; gap: 12px; padding: 11px 0; border-bottom: 1px solid var(--line-2); }
.step:last-child { border-bottom: none; }
.step .n { width: 26px; height: 26px; border-radius: 50%; background: rgba(0,0,0,.06); color: var(--ink-2); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; }
.metric { text-align: center; padding: 12px 6px; }
.metric b { display: block; font-size: 20px; font-weight: 700; letter-spacing: -.02em; }
.metric span { font-size: 11.5px; color: var(--ink-3); }

/* dashboard charts */
.chart-box { padding: 14px 16px; }
.chart-box h3 { margin-bottom: 10px; display: flex; }
.chart-box h3 .val { margin-left: auto; font-size: 13.5px; }
canvas.chart { width: 100%; height: 180px; }

/* review queue */
.rv { display: flex; gap: 14px; align-items: flex-start; padding: 15px 16px; border-bottom: 1px solid var(--line-2); transition: background var(--t); }
.rv:hover { background: var(--hover); }
.rv:last-child { border-bottom: none; }
.rv .actions { margin-left: auto; display: flex; gap: 8px; }

/* knowledge */
.kn-card { padding: 15px 17px; }

/* settings */
.set-nav { display: flex; gap: 3px; flex-direction: column; }
.set-item { padding: 7px 12px; border-radius: 8px; cursor: pointer; color: var(--ink-2); font-size: 13.5px; font-weight: 500; transition: background var(--t), color var(--t); }
.set-item:hover { background: var(--hover); }
.set-item.active { background: var(--accent-soft); color: var(--accent-ink); font-weight: 650; }
.conn { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line-2); }
.conn:last-child { border-bottom: none; }
.toggle { width: 36px; height: 22px; border-radius: 999px; background: var(--line-strong); position: relative; cursor: pointer; border: none; transition: background var(--t); }
.toggle.on { background: var(--green); }
.toggle::after { content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: left var(--t); box-shadow: 0 1px 2px rgba(0,0,0,.25); }
.toggle.on::after { left: 16px; }

/* command palette */
#cmdk { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: flex-start; justify-content: center; padding-top: 14vh; z-index: 50; }
#cmdk.open { display: flex; }
.cmdk-box { width: 560px; max-width: 92vw; background: var(--surface); border-radius: 16px; box-shadow: var(--shadow-high); overflow: hidden; }
.cmdk-box input { width: 100%; border: none; outline: none; padding: 16px 18px; font-size: 15px; border-bottom: 1px solid var(--line); box-shadow: none !important; }
.cmdk-res { max-height: 320px; overflow-y: auto; padding: 6px; }
.cmdk-item { padding: 9px 12px; border-radius: 10px; cursor: pointer; display: flex; gap: 10px; align-items: center; transition: background var(--t); }
.cmdk-item:hover, .cmdk-item.sel { background: var(--accent-soft); }

/* modal */
#modal { position: fixed; inset: 0; background: rgba(0,0,0,.5); display: none; align-items: center; justify-content: center; z-index: 60; }
#modal.open { display: flex; }
.modal-box { width: 640px; max-width: 94vw; max-height: 82vh; overflow-y: auto; background: var(--surface); border-radius: 16px; padding: 22px 24px; box-shadow: var(--shadow-high); }
.modal-box h2 { margin-bottom: 12px; }

/* toast */
#toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: #1b1b1b; color: #fff; padding: 10px 16px; border-radius: 10px; font-size: 13px; font-weight: 500; opacity: 0; transition: opacity 225ms; z-index: 80; pointer-events: none; box-shadow: var(--shadow-high); }
#toast.show { opacity: 1; }

/* transcript */
.tr-line { padding: 5px 0; border-bottom: 1px solid var(--line-2); font-size: 13px; }
.tr-line b { color: var(--accent-ink); font-weight: 650; }

/* meeting detail */
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }

@media (max-width: 900px) {
  aside { display: none; }
  .detail-grid, .two-col { grid-template-columns: 1fr; }
  .chat-wrap { grid-template-columns: 1fr; }
  .chat-side { display: none; }
  .page { padding: 18px 16px 60px; }
}
