/* ============================================================
   home. — Components layer (companion to tokens.css)
   Inputs, switches, alerts, tabs, modal, toast, sidebar.
   Extracted from internal UI Design System v1.0.
   ============================================================ */

/* ============================================================
   Inputs
   ============================================================ */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 240px; }
.field__label {
  font: 600 13px/1 var(--font-sans);
  color: var(--ink);
  letter-spacing: -0.003em;
}
.field__hint {
  font: 500 12px/1.4 var(--font-sans);
  color: var(--ink-4);
  letter-spacing: -0.003em;
}
.field__error {
  font: 600 12px/1.4 var(--font-sans);
  color: var(--c-error);
  display: flex; align-items: center; gap: 4px;
}

.input {
  appearance: none;
  height: 48px;
  border-radius: 12px;
  border: 1.5px solid var(--rule-2);
  background: #fff;
  padding: 0 14px;
  font: 500 15px/1 var(--font-sans);
  color: var(--ink);
  letter-spacing: -0.003em;
  width: 100%;
  transition: border-color var(--dur-1) var(--ease-std), box-shadow var(--dur-1) var(--ease-std);
}
.input::placeholder { color: var(--ink-4); }
.input:hover  { border-color: var(--ink-5); }
.input:focus  { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(176,163,255,0.35); }
.input--error { border-color: var(--c-error); }
.input--error:focus { box-shadow: 0 0 0 3px rgba(217,62,57,0.18); }
.input[disabled] { background: var(--page-3); color: var(--ink-4); cursor: not-allowed; }

.input-search { position: relative; }
.input-search .input { padding-left: 42px; }
.input-search svg {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  width: 18px; height: 18px;
  color: var(--ink-4);
  pointer-events: none;
}

textarea.input { height: auto; min-height: 120px; padding: 12px 14px; line-height: 1.5; resize: vertical; }

/* ============================================================
   Checkbox / radio / switch
   ============================================================ */
.check {
  position: relative;
  display: inline-flex; align-items: flex-start; gap: 10px;
  cursor: pointer;
  font: 500 14px/1.4 var(--font-sans);
  color: var(--ink);
  letter-spacing: -0.003em;
}
.check__box {
  width: 20px; height: 20px;
  border: 1.5px solid var(--ink-4);
  border-radius: 5px;
  background: #fff;
  display: grid; place-items: center;
  flex: none;
  transition: background var(--dur-1) var(--ease-std), border-color var(--dur-1) var(--ease-std);
  margin-top: 1px;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check input:checked + .check__box { background: var(--ink); border-color: var(--ink); }
.check input:checked + .check__box svg { opacity: 1; }
.check__box svg { width: 12px; height: 12px; color: #fff; opacity: 0; stroke-width: 3.5; }
.check--radio .check__box { border-radius: 9999px; }
.check--radio .check__box::after {
  content: ""; width: 8px; height: 8px; border-radius: 9999px;
  background: #fff; transform: scale(0);
  transition: transform var(--dur-1) var(--ease-std);
}
.check--radio input:checked + .check__box { background: var(--ink); border-color: var(--ink); }
.check--radio input:checked + .check__box::after { transform: scale(1); }

.switch {
  position: relative;
  width: 44px; height: 26px;
  background: var(--ink-5);
  border-radius: 9999px;
  transition: background var(--dur-2) var(--ease-std);
  cursor: pointer;
  flex: none;
  border: 0;
  padding: 0;
}
.switch::after {
  content: "";
  position: absolute; top: 3px; left: 3px;
  width: 20px; height: 20px;
  background: #fff;
  border-radius: 9999px;
  box-shadow: var(--sh-1);
  transition: transform var(--dur-2) var(--ease-out);
}
.switch.is-on { background: var(--ink); }
.switch.is-on::after { transform: translateX(18px); }

/* ============================================================
   Alerts / banners
   ============================================================ */
.alert {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid var(--rule);
  background: #fff;
}
.alert__icon {
  width: 32px; height: 32px;
  border-radius: 9999px;
  display: grid; place-items: center;
  flex: none;
}
.alert__icon svg { width: 18px; height: 18px; }
.alert__body { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.alert__title { font: 700 14px/1.3 var(--font-sans); color: var(--ink); letter-spacing: -0.005em; }
.alert__msg   { font: 400 13px/1.5 var(--font-sans); color: var(--ink-3); letter-spacing: -0.003em; }

.alert--success .alert__icon { background: var(--success-bg); color: var(--c-success); }
.alert--warning .alert__icon { background: var(--warning-bg); color: #a96b00; }
.alert--error   .alert__icon { background: var(--error-bg);   color: var(--c-error); }
.alert--info    .alert__icon { background: rgba(162,228,255,0.4); color: #0a4f6b; }

/* ============================================================
   Segmented + Tabs + Breadcrumb
   ============================================================ */
.seg {
  display: inline-flex;
  background: var(--page-3);
  border-radius: 9999px;
  padding: 4px;
  gap: 2px;
}
.seg__opt {
  padding: 8px 18px;
  border-radius: 9999px;
  font: 700 13px/1 var(--font-sans);
  color: var(--ink);
  cursor: pointer;
  border: 0;
  background: transparent;
  letter-spacing: -0.003em;
}
.seg__opt.is-on { background: #fff; box-shadow: var(--sh-1); }

.tabs { display: flex; gap: 0; border-bottom: 1px solid var(--rule); }
.tabs__opt {
  background: transparent; border: 0; cursor: pointer;
  padding: 14px 20px;
  font: 600 14px/1 var(--font-sans);
  color: var(--ink-3);
  letter-spacing: -0.005em;
  position: relative;
}
.tabs__opt:hover { color: var(--ink); }
.tabs__opt.is-on { color: var(--ink); }
.tabs__opt.is-on::after {
  content: ""; position: absolute;
  left: 16px; right: 16px; bottom: -1px;
  height: 2px; background: var(--ink);
  border-radius: 2px 2px 0 0;
}

.crumb {
  display: flex; align-items: center; gap: 8px;
  font: 500 13px/1 var(--font-sans);
  color: var(--ink-3);
  letter-spacing: -0.003em;
}
.crumb a { color: var(--ink-3); text-decoration: none; }
.crumb a:hover { color: var(--ink); }
.crumb .sep { color: var(--ink-5); }
.crumb b { color: var(--ink); font-weight: 600; }

/* ============================================================
   List items (line-item rows)
   ============================================================ */
.list {
  width: 100%;
  border: 1px solid var(--rule);
  border-radius: 16px;
  overflow: hidden;
}
.list-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 18px;
  border-top: 1px solid var(--rule);
  background: #fff;
}
.list-item:first-child { border-top: 0; }
.list-item__tile { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; flex: none; }
.list-item__tile svg { width: 18px; height: 18px; color: var(--ink); stroke-width: 1.8; }
.list-item__body { flex: 1; min-width: 0; }
.list-item__title { font: 600 14px/1.2 var(--font-sans); color: var(--ink); letter-spacing: -0.005em; }
.list-item__meta  { font: 500 12px/1.3 var(--font-sans); color: var(--ink-4); margin-top: 2px; }
.list-item__amt   { font: 700 15px/1 var(--font-sans); color: var(--ink); letter-spacing: -0.005em; }
.list-item__amt small { display: block; font: 600 11px/1 var(--font-sans); color: var(--c-success); margin-top: 3px; }

/* ============================================================
   Modal + Toast
   ============================================================ */
.modal {
  background: #fff;
  border-radius: 24px;
  border: 1px solid var(--rule);
  padding: 32px;
  box-shadow: var(--sh-5);
}
.modal h4 { font: 700 22px/1.2 var(--font-sans); color: var(--ink); letter-spacing: -0.012em; margin: 0 0 8px; }
.modal p  { font: 400 15px/1.5 var(--font-sans); color: var(--ink-3); margin: 0 0 24px; letter-spacing: -0.003em; }
.modal__row { display: flex; gap: 12px; justify-content: flex-end; }

.toast {
  background: var(--ink); color: #fff;
  padding: 12px 20px;
  border-radius: 9999px;
  font: 600 14px/1 var(--font-sans);
  letter-spacing: -0.005em;
  display: inline-flex; align-items: center; gap: 10px;
  box-shadow: var(--sh-5);
}
.toast svg { width: 16px; height: 16px; color: var(--c-mint); stroke-width: 3; }
.toast--error svg { color: var(--c-coral); }
.toast--warning svg { color: var(--c-yellow); }

/* ============================================================
   Sidebar pattern (app shell)
   ============================================================ */
.sidebar {
  position: sticky; top: 0;
  height: 100vh;
  overflow-y: auto;
  border-right: 1px solid var(--rule);
  padding: 32px 28px;
  background: var(--page);
}
.sidebar__brand {
  display: flex; align-items: center; gap: 12px;
  text-decoration: none; color: var(--ink);
  padding-bottom: 32px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 32px;
}
.sidebar__brand img { height: 24px; width: auto; display: block; }
.sidebar__brand .kind {
  font: 600 10px/1 var(--font-sans);
  color: var(--ink-4);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  padding: 5px 8px;
  border: 1px solid var(--rule);
  border-radius: 9999px;
}
.sidebar__group {
  font: 700 11px/1 var(--font-sans);
  color: var(--ink-4);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  margin: 24px 0 12px 8px;
}
.sidebar__group:first-of-type { margin-top: 0; }
.sidebar__nav { display: flex; flex-direction: column; }
.sidebar__nav a {
  font: 600 14px/1 var(--font-sans);
  color: var(--ink-3);
  letter-spacing: -0.005em;
  text-decoration: none;
  padding: 10px 12px;
  border-radius: 8px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar__nav a:hover, .sidebar__nav a.is-active { background: var(--page-3); color: var(--ink); }
.sidebar__nav a.is-active { background: var(--ink); color: #fff; }
.sidebar__nav a .dot {
  width: 6px; height: 6px; border-radius: 9999px;
  background: var(--ink-5);
}
.sidebar__nav a:hover .dot, .sidebar__nav a.is-active .dot { background: var(--c-pink); }

/* ============================================================
   Icons
   home. icon set lives in assets/icons/ — all use currentColor.
   Use as <img class="icon" src=".../icons/bolt.svg" alt="">
   or inside a category tile.
   ============================================================ */
.icon { width: 20px; height: 20px; display: inline-block; vertical-align: middle; color: currentColor; }
.icon--sm   { width: 16px; height: 16px; }
.icon--md   { width: 20px; height: 20px; }
.icon--lg   { width: 24px; height: 24px; }
.icon--xl   { width: 28px; height: 28px; }
/* When placed inside a category tile, default to 22px and inherit tile color */
.tile .icon,
.list-item__tile .icon { width: 22px; height: 22px; }
.tile--sm .icon,
.list-item__tile .icon { width: 18px; height: 18px; }

/* ============================================================
   Focus-visible (accessibility)
   ============================================================ */
.btn:focus-visible,
.seg__opt:focus-visible,
.tabs__opt:focus-visible,
.switch:focus-visible,
.input:focus-visible {
  outline: 3px solid var(--c-purple);
  outline-offset: 2px;
}
