/* ==========================================================================
   MyBizBOSS Design Components — v1
   Reusable UI primitives built on tokens.css. Requires tokens.css loaded
   first (relies on its custom properties).

   Scope, deliberately: this file holds atomic, ship-worthy pieces that
   appear identically across multiple real screens — buttons, form fields,
   status badges, tabs, toggle switches, checkboxes, list rows. It does NOT
   include per-screen review scaffolding (browser-chrome mockup frames,
   reviewer annotation callouts, table-of-contents nav, doc headers) — that
   presentation layer exists only in Web's review mockups and was never
   meant to ship. It also does not include full page compositions (a client
   card grid, a relationship list) — those are built FROM these primitives
   per screen, not shared components themselves; forcing every layout into
   one shared class would fight real per-screen differences.

   Usage:
     <link rel="stylesheet" href="tokens.css">
     <link rel="stylesheet" href="components.css">
   ========================================================================== */

/* ===== Buttons ===== */
.btn {
  font-family: var(--font-ui); font-size: 12px; font-weight: 500; padding: 6px 12px;
  border-radius: var(--radius-btn); border: 1px solid var(--line-strong); background: var(--surface);
  color: var(--ink); cursor: pointer;
}
.btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.btn.primary { background: var(--navy); border: 1.5px solid var(--navy-border); color: #FEFEFE; font-weight: 700; }
.btn.secondary { background: transparent; border: 1.5px solid var(--navy-border); color: var(--ink); font-weight: 700; }
.btn.danger { background: transparent; border: 1.5px solid var(--red); color: var(--red); font-weight: 700; }
.btn.small { padding: 4px 10px; font-size: 11px; border-radius: 6px; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

/* ===== Form fields ===== */
.field { margin-bottom: 14px; }
.field label {
  display: block; font-family: var(--font-ui); font-weight: 600; font-size: 12px;
  color: var(--ink); margin-bottom: 6px;
}
.field .hint { font-family: var(--font-body); font-weight: 400; font-size: 11px; color: var(--ink-faint); margin-left: 4px; }
.input-wrap { position: relative; }
.input-wrap input, .field select {
  width: 100%; font-family: var(--font-body); font-size: 13.5px; color: var(--ink);
  padding: 9px 11px; border: 1.5px solid var(--line-strong); border-radius: var(--radius-control);
  background: var(--surface); outline: none;
}
.input-wrap input:focus, .field select:focus { border-color: var(--focus); box-shadow: 0 0 0 3px rgba(4,46,79,0.10); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .input-wrap input:focus,
  :root:not([data-theme="light"]) .field select:focus { box-shadow: 0 0 0 3px rgba(232,236,238,0.12); }
}
:root[data-theme="dark"] .input-wrap input:focus,
:root[data-theme="dark"] .field select:focus { box-shadow: 0 0 0 3px rgba(232,236,238,0.12); }
.input-wrap.has-toggle input { padding-right: 40px; }
.pin-toggle {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  width: 28px; height: 28px; border: none; background: transparent; cursor: pointer;
  color: var(--ink-faint); display: flex; align-items: center; justify-content: center; border-radius: 5px;
}
.pin-toggle:hover { background: var(--panel); color: var(--ink-soft); }
.pin-toggle:focus-visible { outline: 2px solid var(--focus); outline-offset: 1px; }
.field-error { font-family: var(--font-body); font-size: 11.5px; color: var(--red); margin-top: 6px; }
.field.has-error .input-wrap input { border-color: var(--red); }
.form-row { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.form-row .field { flex: 1 1 220px; margin-bottom: 0; }

.check-row { display: flex; align-items: center; gap: 7px; }
.check-row input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); cursor: pointer; margin: 0; }
.check-row label { font-family: var(--font-body); font-size: 12.5px; color: var(--ink-soft); cursor: pointer; }

.helper-link {
  font-family: var(--font-body); font-size: 12.5px; color: var(--ink-soft); text-decoration: underline;
  text-decoration-color: var(--line-strong); text-underline-offset: 2px;
}
.helper-link:hover { color: var(--ink); text-decoration-color: var(--accent); }

/* ===== Status badges ===== */
.status-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 500; }
.status-badge.active { background: var(--green-bg); color: var(--green); }
.status-badge.pending { background: var(--yellow-bg); color: var(--yellow); }
.status-badge.declined,
.status-badge.suspended { background: var(--red-bg); color: var(--red); }
.status-badge.unavailable { background: var(--panel); color: var(--ink-faint); border: 1px solid var(--line-strong); }

.admin-only-badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 700; color: var(--ink); background: var(--panel);
  padding: 5px 11px; border-radius: 999px;
}

/* ===== Toggle switch ===== */
.switch { width: 36px; height: 20px; border-radius: 999px; background: var(--grey); position: relative; flex: none; cursor: pointer; }
.switch.on { background: var(--accent); }
.switch.computed-on { background: var(--ink-faint); }
.switch.readonly { opacity: 0.55; cursor: not-allowed; }
.switch::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; }
.switch.on::after, .switch.computed-on::after { left: 18px; }

/* ===== Tab strip ===== */
.tab-strip { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 7px; overflow: hidden; }
.tab-strip button {
  font-family: var(--font-ui); font-size: 12.5px; font-weight: 500; padding: 9px 16px; border: none;
  border-right: 1px solid var(--line-strong); background: var(--surface); color: var(--ink-soft); cursor: pointer;
}
.tab-strip button:last-child { border-right: none; }
.tab-strip button.active { background: var(--navy); color: #FEFEFE; box-shadow: inset 0 0 0 1.5px var(--navy-border); }
.tab-strip button.locked { opacity: 0.5; cursor: not-allowed; display: inline-flex; align-items: center; gap: 5px; }

/* ===== Raised surface (card / modal / panel) ===== */
.surface-card {
  border: 1px solid var(--line-strong); border-radius: var(--radius-card); overflow: hidden;
  background: var(--panel-raised); box-shadow: var(--shadow-card);
}
.surface-card-tight { box-shadow: var(--shadow-card-tight); }

/* ===== List / row pattern (used by relationship lists, grant lists,
   entitlement rows, log rows, contact rows — one shared row rhythm,
   per-screen content) ===== */
.list { display: flex; flex-direction: column; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.list-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--surface); }
.list-row:last-child { border-bottom: none; }

/* ===== Small pill chip (flags, tags) ===== */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 500; background: var(--yellow-bg); color: var(--yellow); border: 1px solid transparent; }
.chip.add { background: var(--surface); color: var(--ink); border: 1px dashed var(--line-strong); cursor: pointer; }
