/* ============================================================
   posto — component library
   Depends on tokens.css. Shared across all portal screens.
   ============================================================ */

/* ---------- Reset-ish ---------- */
h1,h2,h3,h4,h5,p { margin: 0; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
input, textarea, select { font-family: inherit; }

/* ---------- Typography helpers ---------- */
.t-display { font-size: var(--fs-3xl); font-weight: 600; letter-spacing: -0.025em; line-height: 1.08; }
.t-title   { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.02em; line-height: 1.12; }
.t-h       { font-size: var(--fs-xl); font-weight: 600; letter-spacing: -0.015em; line-height: 1.2; }
.t-sub     { font-size: var(--fs-lg); font-weight: 550; letter-spacing: -0.01em; }
.t-body    { font-size: var(--fs-base); color: var(--text-2); line-height: 1.55; }
.t-sm      { font-size: var(--fs-sm); color: var(--text-2); }
.t-dim     { color: var(--text-3); }

.mono { font-family: var(--font-mono); font-feature-settings: 'zero' 1; }
.eyebrow {
  font-family: var(--font-mono);
  font-size: var(--fs-micro);
  font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ---------- Logo mark ---------- */
.logo { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; letter-spacing: -0.03em; font-size: var(--fs-lg); color: var(--text); }
.logo-mark {
  width: 24px; height: 24px; border-radius: 7px;
  background: var(--gray-900);
  position: relative; flex: none;
  display: inline-flex; align-items: center; justify-content: center;
}
.logo-mark::after {
  content: ""; position: absolute;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--blue-500);
  top: 5px; right: 5px;
}
.logo-mark.lg { width: 34px; height: 34px; border-radius: 9px; }
.logo-mark.lg::after { width: 11px; height: 11px; top: 7px; right: 7px; }
.logo .tag-role { font-family: var(--font-mono); font-size: 9px; letter-spacing: .08em; background: var(--gray-900); color: #fff; padding: 2px 5px; border-radius: 4px; margin-left: 2px; vertical-align: 2px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: 36px; padding: 0 14px;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 500;
  border: 1px solid transparent;
  background: var(--gray-100); color: var(--text);
  transition: background .14s ease, border-color .14s ease, box-shadow .14s ease, transform .05s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(0.5px); }
.btn .ico { width: 15px; height: 15px; }
.btn-primary { background: var(--blue-500); color: #fff; box-shadow: var(--sh-xs); }
.btn-primary:hover { background: var(--blue-600); }
.btn-dark { background: var(--gray-900); color: #fff; }
.btn-dark:hover { background: var(--gray-800); }
.btn-secondary { background: var(--surface); border-color: var(--border-strong); color: var(--text); box-shadow: var(--sh-xs); }
.btn-secondary:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover { background: var(--gray-100); color: var(--text); }
.btn-sm { height: 30px; padding: 0 10px; font-size: var(--fs-xs); border-radius: var(--r-xs); }
.btn-lg { height: 44px; padding: 0 20px; font-size: var(--fs-base); border-radius: var(--r-md); }
.btn-icon { width: 32px; padding: 0; }
.btn-block { width: 100%; }

/* ---------- Inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.label { font-size: var(--fs-xs); font-weight: 500; color: var(--text-2); }
.input, .textarea, .select {
  height: 38px; padding: 0 12px;
  border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--surface); color: var(--text);
  font-size: var(--fs-sm); width: 100%;
  transition: border-color .14s, box-shadow .14s;
}
.textarea { height: auto; padding: 10px 12px; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input:focus, .textarea:focus, .select:focus { outline: none; border-color: var(--blue-400); box-shadow: var(--ring); }
.input-group { position: relative; display: flex; align-items: center; }
.input-group .input { padding-left: 36px; }
.input-group .lead { position: absolute; left: 12px; color: var(--text-faint); display: flex; }
.hint { font-size: var(--fs-xs); color: var(--text-3); }

/* ---------- Select (native) ---------- */
.select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 32px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a8a8b3' stroke-width='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 10px center;
  background-size: 16px 16px;
  cursor: pointer;
}
.select:hover { border-color: var(--gray-300); }
.select:disabled { color: var(--text-faint); background-color: var(--gray-50); cursor: not-allowed; }
.select.is-placeholder { color: var(--text-faint); }
.select option { color: var(--text); }
.select option:disabled { color: var(--text-faint); }
.select.is-invalid, .input.is-invalid, .textarea.is-invalid { border-color: var(--red-500); box-shadow: var(--ring-error); }

/* ---------- Enhanced select menu (static/select-menu.js) ---------- */
.select-menu { position: relative; }
.select-menu-native { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.select-menu-trigger { display: flex; align-items: center; gap: 8px; text-align: left; }
.select-menu-trigger:hover { background-color: var(--gray-25); }
.select-menu.open .select-menu-trigger { border-color: var(--blue-400); box-shadow: var(--ring); }
.select-menu-trigger .select-menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-menu-icon { flex: none; }
.select-menu-list { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 50; max-height: 280px; overflow: auto; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-pop); }
.select-menu-list[hidden] { display: none; }
.select-menu-list.static { max-height: none; overflow: visible; }
.select-menu-item { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 34px; padding: 7px 10px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text); font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer; }
.select-menu-item:hover, .select-menu-item:focus-visible { background: var(--gray-50); outline: none; }
.select-menu-item[aria-selected="true"] { background: var(--blue-50); color: var(--blue-700); }
.select-menu-detail { margin-left: auto; flex: none; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap; }
.select-menu-item.is-disabled { color: var(--text-faint); cursor: help; }
.select-menu-item.is-disabled .select-menu-detail { color: var(--text-faint); }
.select-menu-item.is-disabled::after { content: attr(data-tooltip); position: absolute; left: 8px; bottom: calc(100% + 7px); width: max-content; max-width: min(320px, calc(100vw - 56px)); padding: 7px 9px; border-radius: var(--r-xs); background: var(--gray-950); color: #fff; font-size: var(--fs-xs); font-weight: 500; line-height: 1.35; box-shadow: var(--sh-sm); opacity: 0; transform: translateY(4px); pointer-events: none; transition: opacity .15s ease, transform .15s ease; z-index: 45; white-space: normal; }
.select-menu-item.is-disabled::before { content: ""; position: absolute; left: 22px; bottom: calc(100% + 2px); border: 5px solid transparent; border-top-color: var(--gray-950); opacity: 0; pointer-events: none; transition: opacity .15s ease, transform .15s ease; transform: translateY(4px); z-index: 45; }
.select-menu-item.is-disabled:hover::after, .select-menu-item.is-disabled:focus-visible::after, .select-menu-item.is-disabled:hover::before, .select-menu-item.is-disabled:focus-visible::before { opacity: 1; transform: translateY(0); }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--sh-sm);
}
.card-pad { padding: var(--sp-5); }
.card-head { padding: 16px 20px; border-bottom: 1px solid var(--border-hair); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-body { padding: 20px; }

/* ---------- Badges / tags / pills ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px; border-radius: var(--r-xs);
  font-size: var(--fs-micro); font-weight: 500; line-height: 1;
  font-family: var(--font-mono); letter-spacing: 0.02em;
  background: var(--gray-100); color: var(--text-2);
  border: 1px solid var(--border);
}
.badge-blue   { background: var(--blue-50);   color: var(--blue-700);  border-color: var(--blue-100); }
.badge-violet { background: var(--violet-50); color: var(--violet-600);border-color: var(--violet-100); }
.badge-green  { background: var(--green-50);  color: var(--green-600); border-color: #cdeede; }
.badge-amber  { background: var(--amber-50);  color: var(--amber-600); border-color: #f5e2bd; }
.badge-red    { background: var(--red-50);    color: var(--red-600);   border-color: #f6cfca; }
.badge-solid  { background: var(--gray-900);  color: #fff; border-color: transparent; }

.dot { width: 7px; height: 7px; border-radius: 50%; flex: none; }
.dot-green { background: var(--green-500); box-shadow: 0 0 0 3px var(--green-50); }
.dot-amber { background: var(--amber-500); box-shadow: 0 0 0 3px var(--amber-50); }
.dot-blue  { background: var(--blue-500);  box-shadow: 0 0 0 3px var(--blue-50); }
.dot-gray  { background: var(--gray-400); }

/* ---------- Chips (removable / selectable) ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 9px; border-radius: var(--r-sm);
  font-size: var(--fs-xs); font-weight: 450;
  background: var(--surface); border: 1px solid var(--border-strong); color: var(--text);
}
.chip .x { color: var(--text-faint); display: inline-flex; }
.chip.sel { background: var(--blue-50); border-color: var(--blue-200); color: var(--blue-700); }

/* ---------- Key cap ---------- */
.kbd {
  font-family: var(--font-mono); font-size: var(--fs-micro);
  padding: 2px 6px; border-radius: var(--r-xs);
  background: var(--gray-50); border: 1px solid var(--border-strong);
  box-shadow: 0 1px 0 var(--border-strong); color: var(--text-2);
}

/* ---------- Toggle ---------- */
.toggle { width: 34px; height: 20px; border-radius: 999px; background: var(--gray-300); position: relative; transition: background .16s; flex: none; }
.toggle::after { content:""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: var(--sh-xs); transition: left .16s; }
.toggle.on { background: var(--blue-500); }
.toggle.on::after { left: 16px; }

/* ---------- Range / slider (visual) ---------- */
.range { position: relative; height: 6px; border-radius: 999px; background: var(--gray-200); }
.range .fill { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 999px; background: var(--blue-500); }
.range .knob { position: absolute; top: 50%; width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 1.5px solid var(--blue-500); transform: translate(-50%,-50%); box-shadow: var(--sh-sm); }

/* ---------- Table ---------- */
.table { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.table th {
  text-align: left; font-family: var(--font-mono); font-weight: 500;
  font-size: var(--fs-micro); letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3); padding: 10px 16px; border-bottom: 1px solid var(--border);
  background: var(--gray-25);
}
.table td { padding: 13px 16px; border-bottom: 1px solid var(--border-hair); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--gray-25); }

/* ---------- App shell ---------- */
.app { display: flex; height: 100%; min-height: 100vh; background: var(--bg-subtle); }
.sidebar {
  width: 232px; flex: none; background: var(--surface);
  border-right: 1px solid var(--border); display: flex; flex-direction: column;
  padding: 16px 12px;
}
.side-top { padding: 6px 8px 16px; display:flex; align-items:center; justify-content: space-between; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-label { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .1em; text-transform: uppercase; color: var(--text-faint); padding: 14px 10px 6px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  height: 34px; padding: 0 10px; border-radius: var(--r-sm);
  font-size: var(--fs-sm); font-weight: 450; color: var(--text-2);
}
.nav-item .ico { width: 17px; height: 17px; color: var(--text-3); }
.nav-item:hover { background: var(--gray-50); color: var(--text); }
.nav-item.active { background: var(--gray-100); color: var(--text); font-weight: 500; }
.nav-item.active .ico { color: var(--blue-500); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.topbar {
  height: 56px; flex: none; background: rgba(255,255,255,0.8); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border); display: flex; align-items: center;
  justify-content: space-between; padding: 0 24px; gap: 16px;
}
.crumbs { display:flex; align-items:center; gap: 8px; font-size: var(--fs-sm); color: var(--text-3); }
.crumbs .cur { color: var(--text); font-weight: 500; }
.content { flex: 1; padding: 28px 32px; overflow: auto; }

.avatar { width: 28px; height: 28px; border-radius: 50%; background: linear-gradient(140deg, var(--blue-400), var(--violet-500)); color:#fff; display:flex; align-items:center; justify-content:center; font-size: 11px; font-weight: 600; }

/* workspace switcher */
.ws { display:flex; align-items:center; gap: 10px; width:100%; padding: 8px 10px; margin: 4px 0 6px; border:1px solid var(--border); border-radius: var(--r-md); background: var(--surface); box-shadow: var(--sh-xs); }
.ws .mk { width: 26px; height: 26px; border-radius: 7px; background: linear-gradient(140deg, var(--gray-800), var(--gray-950)); color:#fff; display:flex;align-items:center;justify-content:center; font-size: 12px; font-weight: 600; flex:none; }
.ws .nm { flex:1; text-align:left; min-width:0; }
.ws .nm b { display:block; font-size: var(--fs-sm); font-weight:550; line-height:1.2; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.ws .nm span { font-size: var(--fs-micro); color: var(--text-3); font-family: var(--font-mono); }
.ws svg { color: var(--text-faint); flex:none; }

.side-foot { border-top: 1px solid var(--border-hair); padding-top: 8px; margin-top: 6px; }
.usercard { display:flex; align-items:center; gap: 10px; padding: 8px 10px; border-radius: var(--r-sm); }
.usercard .nm { flex:1; min-width:0; }
.usercard .nm b { display:block; font-size: var(--fs-sm); font-weight:500; line-height:1.25; }
.usercard .nm span { font-size: var(--fs-micro); color: var(--text-3); }
.logout-link { color: var(--text-3); }
.logout-link:hover { color: var(--text); }

/* segmented control */
.segctl { display:inline-flex; padding: 3px; background: var(--gray-100); border-radius: var(--r-md); gap: 2px; }
.segctl button { height: 30px; padding: 0 12px; border:none; background:transparent; border-radius: var(--r-sm); font-size: var(--fs-xs); font-weight: 500; color: var(--text-3); }
.segctl button.on { background: var(--surface); color: var(--text); box-shadow: var(--sh-xs); }

/* page header */
.page-head { display:flex; align-items:flex-start; justify-content:space-between; gap: 20px; margin-bottom: 24px; }
.page-head h1 { font-size: var(--fs-2xl); font-weight: 600; letter-spacing: -0.02em; }
.page-head p { color: var(--text-2); font-size: var(--fs-sm); margin-top: 6px; }

/* ---------- Stat tile ---------- */
.stat { display: flex; flex-direction: column; gap: 8px; padding: 18px 20px; }
.stat .k { font-family: var(--font-mono); font-size: var(--fs-micro); letter-spacing: .06em; text-transform: uppercase; color: var(--text-3); }
.stat .v { font-size: var(--fs-3xl); font-weight: 600; letter-spacing: -0.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.stat .d { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-xs); font-weight: 500; }
.up { color: var(--green-600); } .down { color: var(--red-600); }

/* ---------- Utility ---------- */
.row { display: flex; align-items: center; }
.col { display: flex; flex-direction: column; }
.gap-1{gap:4px}.gap-2{gap:8px}.gap-3{gap:12px}.gap-4{gap:16px}.gap-5{gap:20px}.gap-6{gap:24px}
.grow { flex: 1; } .wrap { flex-wrap: wrap; }
.between { justify-content: space-between; } .center { justify-content: center; } .end { justify-content:flex-end; }
.items-start { align-items: flex-start; } .items-end{align-items:flex-end;}
.divider { height: 1px; background: var(--border); }
.tnum { font-variant-numeric: tabular-nums; }
.icon { width: 18px; height: 18px; stroke: currentColor; stroke-width: 1.6; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.icon-sm { width: 15px; height: 15px; }

/* ---------- Marketing nav (shared pre-sign-in top bar, _marketing_nav.html) ---------- */
.mnav { position: sticky; top: 0; z-index: 10; background: rgba(252,252,253,0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--border); }
.mnav .in { max-width: 1180px; margin: 0 auto; padding: 0 32px; display: flex; align-items: center; justify-content: space-between; height: 64px; }
.mnav nav { display: flex; align-items: center; gap: 24px; font-size: var(--fs-sm); }
.mnav nav a { color: var(--text-3); transition: color .15s; }
.mnav nav a:hover, .mnav nav a.on { color: var(--text); }
.mnav .navbtn { display: inline-flex; align-items: center; height: 34px; padding: 0 14px; border-radius: var(--r-md); background: var(--gray-950); color: #fff; font-weight: 550; }
.mnav .navbtn:hover { background: var(--gray-800); color: #fff; }
.navdrop { position: relative; }
.navdrop-btn { display: inline-flex; align-items: center; gap: 5px; border: 0; padding: 0; background: transparent; font: inherit; color: var(--text-3); cursor: pointer; transition: color .15s; }
.navdrop-btn:hover, .navdrop-btn[aria-expanded="true"] { color: var(--text); }
.navdrop-btn svg { transition: transform .15s; }
.navdrop-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.navdrop-menu { position: absolute; top: calc(100% + 14px); right: 0; min-width: 210px; padding: 5px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); box-shadow: var(--sh-pop); text-align: left; }
.navdrop.up .navdrop-menu { top: auto; bottom: calc(100% + 14px); }
.navdrop-menu a { display: block; padding: 8px 11px; border-radius: var(--r-sm); }
.navdrop-menu a:hover { background: var(--gray-50); }
.navdrop-menu b { display: block; font-weight: 550; font-size: var(--fs-sm); color: var(--text); }
.navdrop-menu span { display: block; margin-top: 1px; font-size: var(--fs-xs); color: var(--text-3); }
.mnav.dark .navdrop-btn { color: rgba(255,255,255,0.55); }
.mnav.dark .navdrop-btn:hover, .mnav.dark .navdrop-btn[aria-expanded="true"] { color: #fff; }
.mnav.dark { background: rgba(11,11,14,0.82); border-bottom-color: rgba(255,255,255,0.08); }
.mnav.dark .logo { color: #fff; }
.mnav.dark .logo-mark { background: #fff; }
.mnav.dark .logo-mark::after { background: var(--blue-400); }
.mnav.dark nav a { color: rgba(255,255,255,0.55); }
.mnav.dark nav a:hover, .mnav.dark nav a.on { color: #fff; }
.mnav.dark .navbtn { background: #fff; color: var(--gray-950); }
.mnav.dark .navbtn:hover { background: var(--gray-100); color: var(--gray-950); }
@media (max-width: 720px) {
  .mnav .in { padding: 0 18px; }
  .mnav nav { gap: 16px; }
  .mnav nav .hide-sm { display: none; }
}
