/* ============================================================
   FLOW — "Calm intelligence" design system
   The Company Brain · v2
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Hanken+Grotesk:wght@400;500;600;700;800&family=Geist+Mono:wght@400;500&display=swap');

:root {
  /* ---- Teal scale ---- */
  --teal-900: #06363c;
  --teal-800: #0a474e;
  --teal-700: #045a63;
  --teal-600: #006d77;   /* primary */
  --teal-500: #1c8b95;
  --teal-400: #4fbfc9;
  --teal-300: #8ad7dd;
  --teal-200: #b0e1e6;
  --teal-100: #d6eff1;
  --teal-50:  #eef8f9;

  /* ---- Warm neutrals ---- */
  --paper:     #f1efe8;   /* app canvas */
  --paper-2:   #f7f6f1;   /* subtle raised */
  --card:      #ffffff;
  --ink:       #1b2a2c;   /* primary text, teal-tinted near-black */
  --ink-2:     #3d4f50;   /* secondary */
  --muted:     #6b7674;   /* tertiary */
  --faint:     #98a09d;
  --line:      #e6e3d9;   /* warm hairline */
  --line-2:    #efece3;

  /* ---- Semantic ---- */
  --success:   #1f8a5b;
  --success-bg:#e4f4ec;
  --warn:      #b45309;
  --warn-bg:   #fbf0e2;
  --danger:    #c0392f;
  --info:      var(--teal-600);

  /* ---- Radii ---- */
  --r-card: 18px;
  --r-ctrl: 11px;
  --r-sm:   8px;
  --r-pill: 999px;

  /* ---- Shadow ---- */
  --sh-sm: 0 1px 2px rgba(27,42,44,.05);
  --sh-md: 0 1px 2px rgba(27,42,44,.04), 0 10px 24px -14px rgba(6,54,60,.28);
  --sh-lg: 0 1px 2px rgba(27,42,44,.04), 0 24px 56px -28px rgba(6,54,60,.40);

  --ease: cubic-bezier(.4,.1,.2,1);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  min-height: 100%;
}

body {
  font-family: 'Hanken Grotesk', system-ui, -apple-system, sans-serif;
  background: var(--paper);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  font-size: 15px;
  line-height: 1.5;
}

::selection { background: var(--teal-100); color: var(--teal-800); }

a { color: inherit; text-decoration: none; }

/* ============================================================
   Brand lockup
   ============================================================ */
.flow-lockup { display: inline-flex; align-items: center; gap: 11px; }
.flow-mark {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border-radius: 12px;
  background: var(--teal-600);
  box-shadow: 0 6px 16px -8px rgba(0,109,119,.7);
  flex: none;
}
.flow-mark svg { width: 26px; height: 26px; }
.flow-mark path { stroke: #fff; }
.flow-word {
  font-weight: 800;
  font-size: 30px;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1;
}
/* on dark surfaces */
.on-dark .flow-word { color: #fff; }
.on-dark .flow-mark { background: rgba(255,255,255,.10); box-shadow: none; }

/* ============================================================
   Typography helpers
   ============================================================ */
.h1 { font-size: 30px; font-weight: 700; letter-spacing: -0.025em; line-height: 1.12; margin: 0; }
.h2 { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.18; margin: 0; }
.h3 { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.sub { color: var(--muted); font-size: 15px; margin: 0; }
.eyebrow {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--teal-600);
}
.mono { font-family: 'Geist Mono', ui-monospace, monospace; font-feature-settings: "tnum"; }

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  font-family: inherit;
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-size: 14.5px; font-weight: 600;
  border: 1px solid transparent;
  border-radius: var(--r-ctrl);
  padding: 0 18px; height: 46px;
  cursor: pointer;
  transition: background .18s var(--ease), border-color .18s var(--ease),
              transform .12s var(--ease), box-shadow .18s var(--ease), color .18s var(--ease);
  white-space: nowrap;
}
.btn svg { width: 18px; height: 18px; }
.btn-block { width: 100%; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--teal-600); color: #fff;
  box-shadow: 0 10px 22px -12px rgba(0,109,119,.8);
}
.btn-primary:hover { background: var(--teal-700); }

.btn-ghost {
  background: var(--card); color: var(--ink);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--teal-300); background: var(--teal-50); }

.btn-subtle {
  background: var(--teal-50); color: var(--teal-700);
}
.btn-subtle:hover { background: var(--teal-100); }

.btn-danger {
  background: var(--card); color: var(--danger);
  border-color: var(--line);
}
.btn-danger:hover { border-color: var(--danger); background: #fdeceb; }

/* ============================================================
   Form controls
   ============================================================ */
.field { display: block; margin-bottom: 18px; }
.field > label,
.label {
  display: block;
  font-size: 12.5px; font-weight: 600; letter-spacing: .005em;
  color: var(--ink-2); margin-bottom: 7px;
}
.hint { font-size: 11.5px; color: var(--faint); margin: 7px 0 0; }

.input, .select, textarea.input {
  width: 100%;
  font-family: inherit; font-size: 14.5px; color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: var(--r-ctrl);
  padding: 0 14px; height: 48px;
  transition: border-color .18s var(--ease), box-shadow .18s var(--ease), background .18s var(--ease);
}
textarea.input { height: auto; padding: 13px 14px; resize: vertical; }
.input::placeholder { color: var(--faint); }
.input:focus, .select:focus, textarea.input:focus {
  outline: none; background: var(--card);
  border-color: var(--teal-400);
  box-shadow: 0 0 0 3.5px rgba(79,191,201,.22);
}
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7674' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 40px;
}

.input-wrap { position: relative; }
.input-wrap .trail {
  position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  color: var(--faint); cursor: pointer; display: grid; place-items: center;
  width: 30px; height: 30px; border-radius: 8px;
}
.input-wrap .trail:hover { color: var(--ink-2); background: var(--line-2); }
.input-wrap .input { padding-right: 46px; }

.check {
  display: inline-flex; align-items: center; gap: 9px;
  font-size: 13.5px; color: var(--muted); cursor: pointer; user-select: none;
  white-space: nowrap;
}
.check input { width: 17px; height: 17px; accent-color: var(--teal-600); cursor: pointer; }

.link-teal { color: var(--teal-600); font-weight: 600; }
.link-teal:hover { color: var(--teal-700); text-decoration: underline; }

.divider-or {
  display: flex; align-items: center; gap: 14px;
  color: var(--faint); font-size: 12.5px; margin: 22px 0;
}
.divider-or::before, .divider-or::after {
  content: ""; flex: 1; height: 1px; background: var(--line);
}

/* ============================================================
   Cards
   ============================================================ */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--sh-md);
}
.card-pad { padding: 26px; }

/* ============================================================
   Badges
   ============================================================ */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em;
  padding: 3px 9px; border-radius: var(--r-pill);
  border: 1px solid transparent; white-space: nowrap;
}
.badge-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

.badge-teal   { background: var(--teal-50);  color: var(--teal-700); border-color: var(--teal-100); }
.badge-slate  { background: #eef1f1;          color: #41575a;          border-color: #e0e6e6; }
.badge-amber  { background: var(--warn-bg);   color: var(--warn);      border-color: #f3e2cb; }
.badge-violet { background: #efecf9;          color: #5b4a9e;          border-color: #e4def4; }
.badge-success{ background: var(--success-bg);color: var(--success);   border-color: #cfe9da; }

.status { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); }
.status .badge-dot { width: 7px; height: 7px; }
.status.active   .badge-dot { background: var(--success); box-shadow: 0 0 0 3px rgba(31,138,91,.16); }
.status.pending  .badge-dot { background: var(--warn);    box-shadow: 0 0 0 3px rgba(180,83,9,.14); }
.status.inactive .badge-dot { background: var(--faint); }

/* ============================================================
   App shell (sidebar + content)
   ============================================================ */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: 264px; flex: none;
  background: var(--teal-900);
  color: rgba(255,255,255,.72);
  display: flex; flex-direction: column;
  padding: 22px 16px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand-row { padding: 6px 8px 24px; }
.nav-group-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase;
  color: rgba(255,255,255,.40); padding: 0 12px; margin: 8px 0 10px;
}
.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: var(--r-ctrl);
  font-size: 14.5px; font-weight: 500; color: rgba(255,255,255,.72);
  transition: background .16s var(--ease), color .16s var(--ease);
}
.nav-item svg { width: 19px; height: 19px; flex: none; opacity: .9; }
.nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.nav-item.active {
  background: rgba(255,255,255,.12); color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06);
}
.nav-item.active svg { color: var(--teal-300); opacity: 1; }

.sidebar .spacer { flex: 1; }
.side-user {
  display: flex; align-items: center; gap: 11px;
  padding: 12px; border-radius: var(--r-ctrl);
  background: rgba(255,255,255,.05);
  border: 1px solid rgba(255,255,255,.07);
}
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-weight: 700; font-size: 14px; color: #fff;
  background: linear-gradient(135deg, var(--teal-500), var(--teal-700));
  letter-spacing: .02em;
}
.side-user .nm { color: #fff; font-weight: 600; font-size: 13.5px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-user .rl { color: rgba(255,255,255,.55); font-size: 11.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side-logout {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; margin-top: 4px; border-radius: var(--r-ctrl);
  font-size: 14px; color: rgba(255,255,255,.62); cursor: pointer;
  transition: background .16s var(--ease), color .16s var(--ease);
}
.side-logout svg { width: 18px; height: 18px; }
.side-logout:hover { background: rgba(255,255,255,.07); color: #fff; }

/* content */
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topline {
  height: 72px; flex: none;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 34px; border-bottom: 1px solid var(--line);
  background: rgba(247,246,241,.8); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 20;
}
.topline .crumbs { font-size: 13.5px; color: var(--muted); display: flex; align-items: center; gap: 9px; }
.topline .crumbs b { color: var(--ink); font-weight: 600; }
.topline-actions { display: flex; align-items: center; gap: 10px; }

.icon-btn {
  width: 42px; height: 42px; border-radius: var(--r-ctrl);
  display: grid; place-items: center; cursor: pointer; position: relative;
  color: var(--muted); background: transparent; border: 1px solid transparent;
  transition: background .16s var(--ease), color .16s var(--ease), border-color .16s;
}
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn:hover { background: var(--card); color: var(--ink); border-color: var(--line); }
.icon-btn .dot {
  position: absolute; top: 9px; right: 10px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--danger); border: 2px solid var(--paper-2);
}

.search {
  display: flex; align-items: center; gap: 9px;
  height: 42px; padding: 0 14px; min-width: 280px;
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-ctrl);
  color: var(--faint);
}
.search svg { width: 17px; height: 17px; }
.search input {
  border: none; outline: none; background: transparent; font-family: inherit;
  font-size: 14px; color: var(--ink); width: 100%;
}

.page { padding: 34px; flex: 1; }
.page-inner { max-width: 1180px; margin: 0 auto; }
.page-wide { max-width: 1480px; }
.page-narrow { max-width: 760px; }

.page-head { margin-bottom: 26px; }
.page-head .h1 { margin-bottom: 7px; }

/* ============================================================
   Table
   ============================================================ */
.table-wrap { border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; background: var(--card); }
.tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tbl thead th {
  text-align: left; font-weight: 600; font-size: 11.5px; letter-spacing: .04em;
  text-transform: uppercase; color: var(--muted);
  padding: 14px 18px; background: var(--paper-2);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 1;
}
.tbl tbody td { padding: 14px 18px; border-bottom: 1px solid var(--line-2); color: var(--ink-2); }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr { transition: background .14s var(--ease); }
.tbl tbody tr:hover { background: var(--teal-50); }
.tbl .nm { font-weight: 600; color: var(--ink); }
.tbl .center { text-align: center; }
.cell-user { display: flex; align-items: center; gap: 11px; }
.cell-user .avatar { width: 32px; height: 32px; font-size: 12px; }

/* ============================================================
   Misc
   ============================================================ */
.kv { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line-2); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--muted); font-size: 13.5px; }
.kv .v { font-weight: 600; color: var(--ink); font-size: 13.5px; }

.tabs { display: flex; gap: 4px; padding: 5px; background: var(--paper-2); border: 1px solid var(--line); border-radius: var(--r-ctrl); width: fit-content; }
.tab {
  padding: 8px 18px; border-radius: 8px; font-size: 13.5px; font-weight: 600;
  color: var(--muted); cursor: pointer; transition: all .16s var(--ease);
}
.tab.active { background: var(--card); color: var(--teal-700); box-shadow: var(--sh-sm); }

.dropzone {
  border: 1.5px dashed var(--teal-300); border-radius: var(--r-card);
  background: var(--teal-50); padding: 40px 24px; text-align: center;
  transition: background .18s var(--ease), border-color .18s var(--ease);
  cursor: pointer;
}
.dropzone:hover { background: var(--teal-100); border-color: var(--teal-400); }
.dropzone .ic {
  width: 52px; height: 52px; border-radius: 14px; margin: 0 auto 14px;
  display: grid; place-items: center; background: var(--card); color: var(--teal-600);
  box-shadow: var(--sh-sm);
}
.dropzone .ic svg { width: 24px; height: 24px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.stat {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--r-card);
  padding: 20px; box-shadow: var(--sh-sm);
}
.stat .lbl { font-size: 12.5px; color: var(--muted); display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.stat .lbl svg { width: 16px; height: 16px; color: var(--teal-500); }
.stat .num { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; color: var(--ink); line-height: 1; }
.stat .meta { font-size: 12px; color: var(--faint); margin-top: 8px; }

/* ============================================================
   Auth split layout
   ============================================================ */
.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-brand {
  position: relative; overflow: hidden;
  background: var(--teal-900); color: #fff;
  padding: 48px 56px; display: flex; flex-direction: column;
}
.auth-brand .tagline {
  margin-top: auto; max-width: 440px;
}
.auth-brand .tagline .eyebrow { color: var(--teal-300); }
.auth-brand .tagline h2 {
  font-size: 38px; font-weight: 700; letter-spacing: -0.03em; line-height: 1.1;
  margin: 16px 0 0;
}
.auth-brand .tagline p { color: rgba(255,255,255,.62); font-size: 15.5px; margin: 18px 0 0; max-width: 400px; }
.auth-brand .flow-curves { position: absolute; inset: 0; pointer-events: none; opacity: .9; }
.auth-glow {
  position: absolute; width: 460px; height: 460px; border-radius: 50%;
  filter: blur(80px); pointer-events: none;
}
.auth-glow.g1 { top: -160px; right: -120px; background: radial-gradient(circle, rgba(79,191,201,.4), transparent 70%); }
.auth-glow.g2 { bottom: -180px; left: -120px; background: radial-gradient(circle, rgba(0,109,119,.5), transparent 70%); }

.auth-form-side { display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--paper); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card .lede { margin-bottom: 28px; }
.auth-card .lede h1 { font-size: 27px; font-weight: 700; letter-spacing: -0.02em; margin: 0 0 7px; }
.auth-card .lede p { color: var(--muted); margin: 0; }
.auth-foot { margin-top: 26px; text-align: center; font-size: 13.5px; color: var(--muted); }

@media (max-width: 880px) {
  .auth { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
}

/* progress (password strength) */
.meter { display: flex; gap: 5px; margin-top: 10px; }
.meter span { flex: 1; height: 4px; border-radius: 3px; background: var(--line); transition: background .2s var(--ease); }
.meter.s1 span:nth-child(1){ background: var(--warn); }
.meter.s2 span:nth-child(-n+2){ background: var(--warn); }
.meter.s3 span:nth-child(-n+3){ background: var(--teal-500); }
.meter.s4 span { background: var(--success); }

/* requirement list */
.reqs { list-style: none; padding: 0; margin: 14px 0 0; display: grid; gap: 7px; }
.reqs li { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--muted); }
.reqs li svg { width: 15px; height: 15px; color: var(--faint); flex: none; }
.reqs li.ok { color: var(--ink-2); }
.reqs li.ok svg { color: var(--success); }

/* ---- Organization header: view toggle + add-users dropdown (shared) ---- */
.view-seg { display:inline-flex; background:#f0efe9; border:1px solid #e6e3d9; border-radius:10px; padding:3px; gap:2px; height:44px; box-sizing:border-box; align-items:center; }
.view-seg a { display:inline-flex; align-items:center; gap:6px; padding:0 14px; height:100%; border-radius:7px; font-size:13px; font-weight:600; color:#6b7674; text-decoration:none; }
.view-seg a svg { width:15px; height:15px; }
.view-seg a.on { background:#fff; color:#045a63; box-shadow:0 1px 2px rgba(0,0,0,.06); }
.add-users-dd { position:relative; }
.add-users-dd > summary { list-style:none; cursor:pointer; }
.add-users-dd > summary::-webkit-details-marker { display:none; }
.add-users-dd .dd-menu { position:absolute; right:0; top:calc(100% + 6px); z-index:50; min-width:210px; background:#fff; border:1px solid #e6e3d9; border-radius:12px; box-shadow:0 12px 28px -10px rgba(6,54,60,.28); padding:6px; }
.add-users-dd .dd-menu a { display:flex; align-items:center; gap:9px; padding:9px 11px; border-radius:8px; font-size:13.5px; color:#1b2a2c; text-decoration:none; }
.add-users-dd .dd-menu a:hover { background:#eef8f9; }
.add-users-dd .dd-menu a svg { width:16px; height:16px; color:#6b7674; flex:none; }

/* full-width content variant (Option B — revert by swapping page-full back to page-wide in the HTML) */
.page-full { max-width: none; }
