/* DIGITZ Workbench: locked layout and brand (matches the DIGITZ workbench demo).
   Employees cannot change anything in this file; they only choose
   which fields and agents appear. */

:root {
  --gold: #3BADEA;
  --brand: #1F7BB8;
  --brand-dark: #155A8A;
  --glean: #1F7BB8;
  --glean-dark: #155A8A;
  --glean-tint: #EAF2FD;
  --glean-tint-2: #D7E8FB;
  --ink: #1E1E1E;
  --bg-app: #EDF1F7;
  --bg-card: #FFFFFF;
  --bg-subtle: #FAFAFA;
  --bg-hover: #F4F4F5;
  --border: #E4E4E7;
  --border-strong: #D4D4D8;
  --text: #18181B;
  --text-muted: #52525B;
  --text-subtle: #71717A;
  --text-faint: #A1A1AA;
  --success: #16A34A;
  --warning: #92400E;
  --warning-tint: #FEF3C7;
  --error: #991B1B;
  --error-tint: #FEE2E2;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow: 0 1px 3px rgba(0,0,0,.06), 0 1px 2px rgba(0,0,0,.04);
  --shadow-md: 0 4px 12px rgba(0,0,0,.06), 0 2px 4px rgba(0,0,0,.04);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.08), 0 4px 8px rgba(0,0,0,.04);
  --shadow-glean: 0 4px 16px rgba(31,123,184,.18);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }
body {
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg-app);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, select { font: inherit; color: inherit; cursor: pointer; }
button { border: none; background: none; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  display: flex; align-items: center; gap: 18px;
  padding: 9px 20px;
  background: #fff;
  border-bottom: 3px solid var(--gold);
  box-shadow: 0 1px 0 var(--border);
}
.brand { display: flex; align-items: center; gap: 13px; flex-shrink: 0; }
.brand-logo { height: 38px; width: auto; display: block; object-fit: contain; }
.brand-divider { width: 1px; height: 24px; background: var(--border-strong); flex-shrink: 0; }
.brand-text { font-weight: 600; font-size: 15px; letter-spacing: .005em; white-space: nowrap; color: var(--text); }
.brand-text .accent { color: var(--brand); font-weight: 600; }

/* Glean draws the search pill itself (colors set in js/app.js). This is only the slot.
   Glean requires position:relative + display:block. */
.search-slot {
  position: relative; display: block;
  flex: 1; max-width: 680px; height: 44px; margin: 0 auto;
}

.topbar-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.glean-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--glean-tint); color: var(--glean-dark);
  border: 1px solid var(--glean-tint-2);
  padding: 5px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.glean-pill::before {
  content: ""; width: 6px; height: 6px; border-radius: 50%;
  background: var(--gold); animation: pulse 2s infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.btn-customize {
  font-size: 12px; font-weight: 600;
  padding: 5px 12px; border-radius: 999px;
  border: 1px solid var(--border); background: #fff; color: var(--text-muted);
  transition: all .15s;
}
.btn-customize:hover { border-color: var(--glean); color: var(--glean-dark); background: var(--glean-tint); }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: linear-gradient(135deg, var(--ink), #3a3a3a); color: var(--gold);
  display: grid; place-items: center;
  font-size: 13px; font-weight: 700; flex-shrink: 0;
}

/* ---------- notice ---------- */
.notice {
  margin: 12px 16px 0; padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--warning-tint); color: var(--warning);
  font-size: 14px; font-weight: 500;
}
.notice.is-error { background: var(--error-tint); color: var(--error); }

/* ---------- stage (fixed two-pane layout) ---------- */
.stage {
  display: grid; grid-template-columns: 1fr; gap: 0;
  max-width: 1680px; margin: 0 auto; width: 100%;
}
.host-pane, .glean-pane { background: var(--bg-card); overflow: hidden; }
.host-pane { display: flex; flex-direction: column; min-height: 0; }

.host-header { padding: 18px 20px 14px; border-bottom: 1px solid var(--border); flex-shrink: 0; }
.host-eyebrow {
  font-size: 11px; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-faint);
}
.host-title { font-size: 22px; font-weight: 700; letter-spacing: -.02em; margin-top: 4px; line-height: 1.2; }
.host-subtitle { font-size: 14px; color: var(--text-muted); margin-top: 4px; }
.host-body { padding: 4px 20px 24px; overflow-y: auto; flex: 1; }

.section-h {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint); margin: 16px 0 10px;
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
}
.section-h .meta { font-size: 11px; font-weight: 500; text-transform: none; letter-spacing: 0; }
.empty { color: var(--text-faint); padding: 24px 0; font-size: 14px; }

/* ---------- header Go button (sits where the demo's "Next call" pill was) ---------- */
.host-header-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.go-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; flex-shrink: 0; }
.go-btn {
  display: inline-flex; align-items: center; gap: 7px;
  background: var(--glean); color: #fff;
  border-radius: 999px; padding: 7px 16px 7px 13px;
  font-size: 13px; font-weight: 700; letter-spacing: .01em;
  box-shadow: var(--shadow-glean); transition: background .15s, transform .1s;
}
.go-btn:hover { background: var(--glean-dark); }
.go-btn:active { transform: scale(.97); }
.go-btn:disabled { opacity: .7; cursor: progress; }
.go-btn svg { width: 14px; height: 14px; }
.go-status {
  font-size: 11px; font-weight: 600; color: var(--text-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

/* ---------- sections (Glean answers inside demo-style cards) ---------- */
.glean-section {
  position: relative; display: block;
  background: #fff; border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; transition: border-color .15s, box-shadow .15s;
}
.glean-section:hover { border-color: var(--glean); box-shadow: var(--shadow-md); }
.glean-section.is-short { height: 280px; }
.glean-section.is-medium { height: 400px; }
.glean-section.is-tall { height: 540px; }
.waiting-card {
  height: 100%; background: var(--bg-subtle);
  padding: 14px; display: flex; flex-direction: column; justify-content: center; align-items: flex-start;
}
.waiting-val {
  font-size: 22px; font-weight: 800; letter-spacing: -.02em; color: var(--text-faint);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.waiting-line { font-size: 12px; font-weight: 600; color: var(--glean-dark); margin-top: 4px; }
.waiting-sub { font-size: 12px; color: var(--text-faint); margin-top: 2px; }
.glean-body .waiting-card { align-items: center; text-align: center; background: #fff; }
.glean-section.is-waiting { height: auto; }
.glean-section.is-waiting .waiting-card { min-height: 92px; }

/* ---------- buttons ---------- */
.chip-btn {
  font-size: 12px; font-weight: 600; white-space: nowrap;
  padding: 5px 11px; border-radius: 999px;
  background: var(--glean-tint); color: var(--glean-dark);
  border: 1px solid transparent; transition: all .12s; flex-shrink: 0;
}
.chip-btn:hover { background: var(--glean); color: #fff; }
.btn {
  border: 1px solid transparent; border-radius: 999px;
  padding: 8px 16px; font-weight: 600; font-size: 14px;
  transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { border-color: var(--border); background: #fff; }
.btn-ghost:hover { background: var(--glean-tint); border-color: var(--glean-tint-2); }

/* ---------- Glean pane ---------- */
.glean-pane { display: none; flex-direction: column; }
.sheet-handle {
  display: none; width: 40px; height: 4px; flex-shrink: 0;
  background: var(--border-strong); border-radius: 999px; margin: 10px auto 0;
}
.agent-rail {
  display: flex; gap: 6px; padding: 10px; flex-shrink: 0;
  background: linear-gradient(180deg, var(--glean-tint) 0%, #fff 100%);
  border-bottom: 1px solid var(--border);
  overflow-x: auto; scrollbar-width: none;
}
.agent-rail::-webkit-scrollbar { display: none; }
.agent-btn {
  flex: 1 1 0; min-width: 72px;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 9px 4px; border-radius: 10px;
  border: 1.5px solid transparent; background: rgba(255,255,255,.6);
  color: var(--text-muted); transition: all .15s;
}
.agent-btn:hover { background: #fff; color: var(--text); border-color: var(--border); }
.agent-btn[aria-pressed="true"] {
  background: #fff; border-color: var(--glean); color: var(--glean-dark);
  box-shadow: var(--shadow-glean);
}
.agent-icon {
  width: 30px; height: 30px; border-radius: 8px;
  background: var(--bg-app); color: var(--text-muted);
  display: grid; place-items: center; transition: all .15s;
}
.agent-btn:hover .agent-icon { background: var(--glean-tint); color: var(--glean); }
.agent-btn[aria-pressed="true"] .agent-icon { background: var(--glean); color: #fff; box-shadow: var(--shadow-glean); }
.agent-icon svg { width: 16px; height: 16px; }
.agent-name {
  font-size: 11px; font-weight: 600; line-height: 1.2; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}

.glean-active-header {
  padding: 14px 18px 10px; border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; flex-shrink: 0;
}
.glean-active-title { font-weight: 700; font-size: 16px; letter-spacing: -.01em; line-height: 1.25; }
.glean-active-sub { font-size: 12px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.glean-active-meta {
  font-size: 11px; color: var(--text-faint); font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; margin-top: 4px;
  display: flex; align-items: center; gap: 6px;
}
.glean-active-meta::before { content: ""; width: 6px; height: 6px; background: var(--success); border-radius: 50%; }
.head-actions { display: flex; align-items: center; gap: 8px; }
.close-sheet {
  display: none; width: 30px; height: 30px; border-radius: 50%;
  background: var(--bg-hover); color: var(--text-muted);
  place-items: center; font-size: 13px;
}

/* Glean chat / search frame. Needs position:relative + display:block. */
.glean-body { position: relative; display: block; flex: 1; min-height: 360px; background: #fff; }

.quick-prompts {
  display: flex; gap: 6px; flex-wrap: wrap; flex-shrink: 0;
  padding: 10px 18px 12px; border-top: 1px solid var(--border); background: var(--bg-card);
}
.quick-prompts:empty { display: none; }
.quick-prompt {
  font-size: 12px; padding: 5px 10px; border-radius: 999px;
  background: var(--glean-tint); color: var(--glean-dark);
  border: 1px solid transparent; transition: all .12s; text-align: left;
}
.quick-prompt:hover { background: var(--glean); color: #fff; }

/* ---------- mobile: Glean opens as a bottom sheet ---------- */
.mobile-fab {
  position: fixed; right: 14px; bottom: 14px; z-index: 100;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--glean); color: #fff;
  box-shadow: var(--shadow-glean), var(--shadow-md);
  display: grid; place-items: center; transition: transform .2s;
}
.mobile-fab:active { transform: scale(.94); }
.mobile-fab .pulse-ring {
  position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--glean); animation: ring 2s infinite;
}
.fab-icon svg { width: 22px; height: 22px; }
@keyframes ring { 0% { transform: scale(1); opacity: .6; } 100% { transform: scale(1.4); opacity: 0; } }
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 190;
  background: rgba(0,0,0,.4); animation: fadeIn .2s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

@media (max-width: 879px) {
  body.sheet-open { overflow: hidden; }
  .glean-pane {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 200;
    height: 90vh; height: 90dvh; border-radius: 24px 24px 0 0;
    transform: translateY(105%); visibility: hidden;
    transition: transform .25s cubic-bezier(.32,.72,0,1), visibility 0s linear .25s;
  }
  body.sheet-open .glean-pane {
    transform: translateY(0); visibility: visible;
    transition: transform .25s cubic-bezier(.32,.72,0,1);
  }
  .sheet-handle { display: block; }
  .close-sheet { display: grid; }
  .glean-body { min-height: 0; }
  .host-pane { min-height: calc(100vh - 120px); }
}

@media (min-width: 880px) {
  .stage { padding: 14px 16px; grid-template-columns: minmax(0, 1.25fr) minmax(440px, .95fr); gap: 14px; align-items: start; }
  .host-pane, .glean-pane {
    border-radius: var(--radius-lg); border: 1px solid var(--border); box-shadow: var(--shadow);
  }
  .host-pane { max-height: calc(100vh - 110px); }
  .glean-pane { display: flex; position: sticky; top: 76px; height: calc(100vh - 110px); min-height: 560px; }
  .mobile-fab, .sheet-backdrop { display: none !important; }
}
@media (min-width: 1280px) {
  .stage { grid-template-columns: minmax(0, 1.4fr) minmax(500px, .85fr); }
}
@media (max-width: 1099px) { .glean-pill { display: none; } }
@media (max-width: 767px) {
  .brand-divider, .brand-text { display: none; }
  .topbar { flex-wrap: wrap; padding: 9px 16px; gap: 10px; }
  .topbar-right { margin-left: auto; }
  .search-slot { order: 3; flex-basis: 100%; max-width: none; }
  .host-header, .host-body { padding-left: 16px; padding-right: 16px; }
  .go-wrap { flex-direction: row; align-items: center; gap: 10px; width: 100%; }
}

/* ---------- customize dialog ---------- */
.customize {
  border: none; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: min(560px, calc(100vw - 32px)); max-height: calc(100vh - 48px);
  margin: auto; padding: 0;
}
.customize::backdrop { background: rgba(15, 23, 42, .45); }
.customize-form { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.customize h2 { font-size: 18px; letter-spacing: -.01em; }
.dialog-sub { color: var(--text-muted); font-size: 14px; }
.preset-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--text-faint); }
.preset-row { display: flex; gap: 8px; align-items: center; }
.preset-row select {
  flex: 1; padding: 7px 10px; font-size: 14px;
  border: 1px solid var(--border); border-radius: 8px; background: #fff;
}
.choice-group { border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px 12px; }
.choice-group legend {
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--text-faint); padding: 0 6px;
}
.choice { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; cursor: pointer; }
.choice input { margin-top: 4px; width: 16px; height: 16px; accent-color: var(--brand); flex-shrink: 0; }
.choice-name { font-weight: 600; font-size: 14px; }
.choice-desc { font-size: 13px; color: var(--text-muted); }
.dialog-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.spacer { flex: 1; }
