/* ===== Vezeti WorkOS ===== */
:root {
  /* Vezeti brand palette — glossy blue sphere logo on black */
  --bg: #f3f7fb;
  --panel: #ffffff;
  --sidebar: #04090f;
  --sidebar-hover: #0f2233;
  --primary: #189ae8;
  --primary-dark: #0f7fc4;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --purple: #7c3aed;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16,24,40,.08), 0 1px 2px rgba(16,24,40,.06);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px;
}
#app { display: flex; height: 100vh; overflow: hidden; }

/* ===== Sidebar ===== */
.sidebar {
  width: 250px; min-width: 250px; background: var(--sidebar); color: #cbd5e1;
  display: flex; flex-direction: column; overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 16px 14px 12px; }
.brand-img { height: 44px; width: auto; max-width: 90px; object-fit: contain; }
.brand-name { color: #fff; font-weight: 700; font-size: 15px; }
.brand-sub { font-size: 10.5px; color: #94a3b8; }
.global-search { padding: 0 12px 10px; }
.global-search input {
  width: 100%; padding: 8px 10px; border-radius: 8px; border: 1px solid #1b3346;
  background: #0b1926; color: #e2e8f0; font-size: 13px; outline: none;
}
.global-search input::placeholder { color: #64748b; }
.nav { flex: 1; padding: 4px 8px 12px; }
.nav-section {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #64748b;
  padding: 14px 8px 5px;
}
.nav-item {
  display: flex; align-items: center; gap: 8px; padding: 7px 10px; border-radius: 8px;
  cursor: pointer; color: #cbd5e1; font-size: 13.5px; user-select: none;
}
.nav-item:hover { background: var(--sidebar-hover); color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.badge {
  margin-left: auto; background: var(--red); color: #fff; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; padding: 1px 7px; display: none;
}
.badge.show { display: inline-block; }
.role-switcher { padding: 12px 14px 16px; border-top: 1px solid #122636; }
.role-switcher label { font-size: 10.5px; color: #64748b; display: block; margin-bottom: 6px; }
.role-switcher select {
  width: 100%; padding: 7px 8px; border-radius: 8px; background: #0b1926; color: #e2e8f0;
  border: 1px solid #1b3346; font-size: 13px;
}

/* ===== Main ===== */
.main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 24px; background: var(--panel); border-bottom: 1px solid var(--border);
}
.topbar h1 { font-size: 18px; font-weight: 700; }
.content { flex: 1; overflow-y: auto; padding: 20px 24px 40px; }

/* ===== Buttons ===== */
.btn {
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 7px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.btn:hover { background: #f9fafb; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-green { background: var(--green); border-color: var(--green); color: #fff; }
.btn-red { background: var(--red); border-color: var(--red); color: #fff; }
.btn-sm { padding: 4px 10px; font-size: 12px; }
.btn-ghost { border: none; background: transparent; color: var(--primary); }

/* ===== Cards / grids ===== */
.grid { display: grid; gap: 14px; }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); }
.card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px; box-shadow: var(--shadow);
}
.card h3 { font-size: 13.5px; margin-bottom: 10px; color: var(--text); }
.kpi-label { font-size: 12px; color: var(--muted); }
.kpi-value { font-size: 26px; font-weight: 800; margin-top: 4px; }
.kpi-sub { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.kpi-value.green { color: var(--green); }
.kpi-value.red { color: var(--red); }
.kpi-value.amber { color: var(--amber); }

/* ===== Tables ===== */
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em;
  color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--border);
}
td { padding: 9px 10px; border-bottom: 1px solid #f1f3f7; vertical-align: middle; }
tr:hover td { background: #f8fafc; }

/* ===== Pills / status ===== */
.pill {
  display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700;
}
.pill.blue { background: #dbeafe; color: #1d4ed8; }
.pill.green { background: #dcfce7; color: #15803d; }
.pill.amber { background: #fef3c7; color: #b45309; }
.pill.red { background: #fee2e2; color: #b91c1c; }
.pill.gray { background: #f1f5f9; color: #475569; }
.pill.purple { background: #ede9fe; color: #6d28d9; }

/* ===== Kanban ===== */
.kanban { display: flex; gap: 12px; overflow-x: auto; padding-bottom: 12px; align-items: flex-start; }
.kanban-col {
  min-width: 235px; width: 235px; background: #eef1f6; border-radius: var(--radius); padding: 10px;
  flex-shrink: 0;
}
.kanban-col.dragover { outline: 2px dashed var(--primary); outline-offset: -2px; }
.kanban-col-header {
  display: flex; justify-content: space-between; font-size: 12px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 2px 4px 10px;
}
.kcard {
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 10px;
  margin-bottom: 8px; cursor: grab; box-shadow: var(--shadow);
}
.kcard:active { cursor: grabbing; }
.kcard-title { font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.kcard-meta { display: flex; justify-content: space-between; align-items: center; font-size: 11.5px; color: var(--muted); }
.kcard.dragging { opacity: .4; }
.avatar {
  width: 22px; height: 22px; border-radius: 50%; background: var(--primary); color: #fff;
  font-size: 10px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center;
}

/* ===== Tabs ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; flex-wrap: wrap; }
.tab {
  padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }

/* ===== Forms ===== */
.form-row { margin-bottom: 12px; }
.form-row label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 5px; color: #374151; }
.form-row input, .form-row select, .form-row textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13px; font-family: inherit; outline: none;
}
.form-row input:focus, .form-row select:focus, .form-row textarea:focus { border-color: var(--primary); }
.form-row textarea { min-height: 70px; resize: vertical; }
.req { color: var(--red); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(16,24,40,.5); display: none;
  align-items: flex-start; justify-content: center; z-index: 100; padding: 48px 16px;
  overflow-y: auto;
}
.modal-overlay.show { display: flex; }
.modal {
  background: #fff; border-radius: 14px; width: 100%; max-width: 620px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.modal-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.modal-header h2 { font-size: 16px; }
.modal-close { border: none; background: none; font-size: 16px; cursor: pointer; color: var(--muted); }
.modal-body { padding: 20px; max-height: 70vh; overflow-y: auto; }

/* ===== Toast ===== */
.toast {
  position: fixed; bottom: 24px; right: 24px; background: #111827; color: #fff;
  padding: 11px 18px; border-radius: 10px; font-size: 13px; z-index: 200;
  opacity: 0; transform: translateY(10px); transition: all .25s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }

/* ===== Form builder ===== */
.fb-layout { display: grid; grid-template-columns: 200px 1fr 260px; gap: 14px; align-items: start; }
.fb-palette-item {
  background: #fff; border: 1px solid var(--border); border-radius: 8px; padding: 9px 10px;
  margin-bottom: 8px; font-size: 13px; cursor: grab; box-shadow: var(--shadow);
}
.fb-canvas { min-height: 340px; }
.fb-canvas.dragover { outline: 2px dashed var(--primary); outline-offset: -2px; }
.fb-field {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px; margin-bottom: 10px;
  background: #fafbfd; display: flex; justify-content: space-between; align-items: center; cursor: grab;
}
.fb-field small { color: var(--muted); }
.fb-empty { color: var(--muted); text-align: center; padding: 60px 10px; font-size: 13px; }

/* ===== Workflow builder ===== */
.wf-stage-chain { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.wf-stage {
  background: #eef2ff; border: 1px solid #c7d2fe; color: #3730a3; padding: 7px 13px;
  border-radius: 999px; font-size: 12.5px; font-weight: 600; display: flex; align-items: center; gap: 7px;
}
.wf-stage .x { cursor: pointer; color: #818cf8; font-weight: 700; }
.wf-arrow { color: var(--muted); }

/* ===== AI chat ===== */
.chat-box { display: flex; flex-direction: column; height: calc(100vh - 210px); }
.chat-messages { flex: 1; overflow-y: auto; padding: 8px 4px; }
.chat-msg { max-width: 78%; padding: 10px 14px; border-radius: 14px; margin-bottom: 10px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.chat-msg.user { background: var(--primary); color: #fff; margin-left: auto; border-bottom-right-radius: 4px; }
.chat-msg.ai { background: #fff; border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.chat-input { display: flex; gap: 8px; padding-top: 10px; }
.chat-input input { flex: 1; padding: 10px 14px; border: 1px solid var(--border); border-radius: 10px; font-size: 13.5px; outline: none; }
.chip-row { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.chip {
  background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; border-radius: 999px;
  padding: 5px 12px; font-size: 12px; cursor: pointer;
}
.chip:hover { background: #e0e7ff; }

/* ===== Misc ===== */
.section-title { font-size: 15px; font-weight: 700; margin: 22px 0 10px; }
.muted { color: var(--muted); }
.mb { margin-bottom: 14px; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.bar-row { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; font-size: 12.5px; }
.bar-label { width: 140px; color: var(--muted); }
.bar-track { flex: 1; height: 10px; background: #eef1f6; border-radius: 999px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 999px; background: var(--primary); }
.rule-card { border-left: 4px solid var(--purple); }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }
.timeline-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid #f1f3f7; font-size: 12.5px; }
.timeline-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--primary); margin-top: 5px; flex-shrink: 0; }
.approval-steps { display: flex; align-items: center; flex-wrap: wrap; gap: 5px; font-size: 12px; margin: 8px 0; }
.astep { padding: 4px 10px; border-radius: 999px; background: #f1f5f9; color: #475569; font-weight: 600; }
.astep.done { background: #dcfce7; color: #15803d; }
.astep.current { background: #fef3c7; color: #b45309; }
.link { color: var(--primary); cursor: pointer; font-weight: 600; }
.int-card { display: flex; gap: 12px; align-items: center; }
.int-icon { font-size: 26px; }
.empty-state { text-align: center; color: var(--muted); padding: 50px 20px; }

/* ===== Login screen ===== */
.login-wrap {
  position: fixed; inset: 0; background: #04090f; display: none;
  align-items: center; justify-content: center; z-index: 500;
}
.login-wrap.show { display: flex; }
.login-card {
  background: #fff; border-radius: 16px; padding: 34px 32px; width: 100%; max-width: 380px;
  box-shadow: 0 24px 80px rgba(0,0,0,.5);
}
.login-card img { height: 56px; display: block; margin: 0 auto 6px; }
.login-card h1 { font-size: 19px; text-align: center; margin-bottom: 2px; }
.login-card .muted { text-align: center; display: block; margin-bottom: 20px; font-size: 12.5px; }
.login-error {
  background: #fee2e2; color: #b91c1c; border-radius: 8px; padding: 8px 12px;
  font-size: 12.5px; margin-bottom: 12px; display: none;
}
.login-error.show { display: block; }
.userbox { padding: 12px 14px 16px; border-top: 1px solid #122636; }
.userbox .u-name { color: #fff; font-weight: 700; font-size: 13px; }
.userbox .u-role { color: #64748b; font-size: 11px; margin-bottom: 8px; }
.userbox .btn { width: 100%; margin-top: 6px; background: #0b1926; border-color: #1b3346; color: #cbd5e1; }
