/* ============================================================
   App UI Kit — component classes built on the design tokens.
   Brand-agnostic, general-purpose. Pairs with ../../colors_and_type.css
   ============================================================ */

.kit { color: var(--ink); font-family: var(--font-body); }
.kit *, .kit *::before, .kit *::after { box-sizing: border-box; }

/* ── Buttons ─────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 18px; border-radius: 8px; cursor: pointer;
  font-family: var(--font-mono); font-weight: 700; font-size: 11px;
  letter-spacing: 0.16em; text-transform: uppercase;
  border: 1.5px solid transparent; white-space: nowrap;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .08s ease;
}
.btn:active { transform: translateY(1px); }
.btn svg { width: 16px; height: 16px; stroke-width: 2; }
.btn--primary { background: var(--ink-2); color: var(--cream); }
.btn--primary:hover { background: var(--ink); }
.btn--secondary { background: var(--cream-raised); color: var(--ink-2); border-color: var(--border); }
.btn--secondary:hover { border-color: var(--ink-3); background: color-mix(in srgb, var(--cream-raised) 84%, var(--ink) 5%); }
.btn--accent { background: var(--accent); color: #fff; }
.btn--accent:hover { background: color-mix(in srgb, var(--accent) 88%, #000 12%); }
.btn--ghost { background: transparent; color: var(--ink-2); }
.btn--ghost:hover { background: color-mix(in srgb, var(--ink) 6%, transparent); }
.btn--sm { height: 32px; padding: 0 12px; font-size: 10px; }
.btn--icon { width: 40px; padding: 0; }
.btn--icon.btn--sm { width: 32px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

/* ── Inputs ──────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 7px; }
.field__label { font-family: var(--font-mono); font-weight: 500; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); }
.input, .select, .textarea {
  width: 100%; background: var(--cream); color: var(--ink);
  border: 1.5px solid var(--border); border-radius: 8px;
  font-family: var(--font-body); font-size: 15px; padding: 10px 13px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input::placeholder, .textarea::placeholder { color: var(--muted); }
.input:focus, .select:focus, .textarea:focus {
  outline: none; border-color: var(--ink-3);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent);
}
.textarea { resize: vertical; min-height: 84px; line-height: 1.5; }
.input-group { display: flex; align-items: center; gap: 9px; background: var(--cream); border: 1.5px solid var(--border); border-radius: 8px; padding: 0 13px; transition: border-color .15s, box-shadow .15s; }
.input-group:focus-within { border-color: var(--ink-3); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 14%, transparent); }
.input-group svg { width: 16px; height: 16px; color: var(--ink-3); flex: none; stroke-width: 2; }
.input-group input { flex: 1; border: none; background: none; outline: none; font-family: var(--font-body); font-size: 15px; color: var(--ink); padding: 10px 0; }

/* ── Toggle ──────────────────────────────────────────────── */
.toggle { position: relative; width: 44px; height: 26px; flex: none; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.toggle__track { position: absolute; inset: 0; border-radius: 999px; background: var(--muted-2); border: 1px solid var(--border); transition: background .18s ease; }
.toggle__thumb { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--cream); transition: transform .18s cubic-bezier(.3,.8,.4,1); box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.toggle input:checked + .toggle__track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle__track + .toggle__thumb { transform: translateX(18px); }

/* ── Checkbox / Radio ────────────────────────────────────── */
.check { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; font-family: var(--font-body); font-size: 15px; color: var(--ink-2); }
.check input { position: absolute; opacity: 0; }
.check__box { width: 20px; height: 20px; border: 1.5px solid var(--border); border-radius: 5px; display: inline-flex; align-items: center; justify-content: center; background: var(--cream); transition: background .15s, border-color .15s; }
.check__box svg { width: 13px; height: 13px; color: #fff; opacity: 0; stroke-width: 3; }
.check input:checked + .check__box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .check__box svg { opacity: 1; }
.check--radio .check__box { border-radius: 50%; }

/* ── Cards / surfaces ────────────────────────────────────── */
.card { background: var(--cream); border: 1px solid var(--border); border-radius: 10px; padding: 22px; transition: border-color .18s ease, transform .18s ease, background .18s ease; }
.card--hover { cursor: pointer; }
.card--hover:hover { border-color: var(--ink-3); transform: translateY(-2px); background: var(--cream-raised); }
.card--raised { background: var(--cream-raised); }
.panel { background: var(--cream-raised); border: 1px solid var(--border); border-radius: 12px; }

/* ── Badges ──────────────────────────────────────────────── */
.badge { display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px; border-radius: 6px; font-family: var(--font-mono); font-weight: 700; font-size: 9.5px; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap; }
.badge--neutral { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink-2); }
.badge--accent { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
.badge--success { background: color-mix(in srgb, var(--div-agree) 18%, transparent); color: #3f7a4b; }
.badge--dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ── Tabs ────────────────────────────────────────────────── */
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--border); }
.tab { appearance: none; border: none; background: none; cursor: pointer; padding: 11px 16px; font-family: var(--font-mono); font-weight: 500; font-size: 11px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color .15s; }
.tab:hover { color: var(--ink); }
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--accent); }

/* ── Avatar ──────────────────────────────────────────────── */
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--ink-2); color: var(--cream); display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 600; font-size: 15px; flex: none; }

/* ── List rows ───────────────────────────────────────────── */
.row { display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: none; }
.row__title { font-family: var(--font-display); font-weight: 500; font-size: 17px; color: var(--ink); }
.row__sub { font-family: var(--font-body); font-size: 13.5px; color: var(--ink-3); margin-top: 2px; }
.row__spacer { flex: 1; }

/* ── Overlays ────────────────────────────────────────────── */
.scrim { position: fixed; inset: 0; background: rgba(20,16,12,.42); backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 100; animation: fade .18s ease; }
.modal { width: min(440px, 92vw); background: var(--cream); border: 1px solid var(--border); border-radius: 14px; padding: 26px; box-shadow: 0 24px 60px -20px rgba(20,16,12,.4); animation: pop .2s cubic-bezier(.3,.8,.4,1); }
.modal__title { font-family: var(--font-display); font-weight: 500; font-size: 24px; letter-spacing: -.01em; margin: 0 0 10px; }
.modal__body { font-family: var(--font-body); font-size: 15.5px; line-height: 1.5; color: var(--ink-2); margin: 0 0 22px; }
.modal__actions { display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--cream); font-family: var(--font-body); font-size: 14.5px; padding: 13px 20px; border-radius: 10px; display: flex; align-items: center; gap: 10px; z-index: 110; box-shadow: 0 12px 32px -10px rgba(0,0,0,.5); animation: rise .22s cubic-bezier(.3,.8,.4,1); }
.toast svg { width: 17px; height: 17px; color: var(--div-agree); stroke-width: 2.4; }
.banner { display: flex; align-items: center; gap: 12px; padding: 13px 16px; border-radius: 10px; border: 1px solid var(--border); background: var(--cream-raised); font-family: var(--font-body); font-size: 14.5px; color: var(--ink-2); }
.banner svg { width: 18px; height: 18px; flex: none; stroke-width: 2; color: var(--accent); }
.banner--accent { border-color: color-mix(in srgb, var(--accent) 35%, var(--border)); background: color-mix(in srgb, var(--accent) 7%, var(--cream-raised)); }

@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: scale(.96) translateY(6px); } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 12px); } }
@media (prefers-reduced-motion: reduce) { .scrim,.modal,.toast { animation: none; } }

/* ── Breadcrumb ──────────────────────────────────────────── */
.crumbs { display: flex; align-items: center; gap: 7px; font-family: var(--font-mono); font-weight: 500; font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase; }
.crumbs a { color: var(--ink-3); cursor: pointer; transition: color .15s; }
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--muted-2); }
.crumbs .here { color: var(--accent); }

/* ── Data table ──────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; font-family: var(--font-body); }
.table thead th { text-align: left; font-family: var(--font-mono); font-weight: 500; font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--ink-3); padding: 11px 14px; border-bottom: 1.5px solid var(--border); white-space: nowrap; }
.table thead th.sortable { cursor: pointer; }
.table thead th .arr { opacity: .5; font-size: 9px; margin-left: 4px; }
.table tbody td { padding: 13px 14px; border-bottom: 1px solid var(--border); font-size: 14.5px; color: var(--ink-2); }
.table tbody tr { transition: background .12s; }
.table tbody tr:hover { background: var(--cream-raised); }
.table tbody tr:last-child td { border-bottom: none; }
.table .num { font-family: var(--font-num); font-weight: 500; }
.table-wrap { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }

/* ── Pagination ──────────────────────────────────────────── */
.pager { display: flex; align-items: center; gap: 4px; font-family: var(--font-num); }
.pager button { min-width: 34px; height: 34px; padding: 0 8px; border: 1.5px solid var(--border); background: var(--cream); border-radius: 8px; cursor: pointer; color: var(--ink-2); font-family: var(--font-num); font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; justify-content: center; transition: border-color .15s, background .15s, color .15s; }
.pager button:hover:not(:disabled) { border-color: var(--ink-3); }
.pager button[aria-current="true"] { background: var(--ink-2); color: var(--cream); border-color: var(--ink-2); }
.pager button:disabled { opacity: .4; cursor: not-allowed; }
.pager button svg { width: 15px; height: 15px; stroke-width: 2.2; }
.pager .gap { color: var(--muted); padding: 0 2px; }

/* ── Dropdown menu ───────────────────────────────────────── */
.menu-anchor { position: relative; display: inline-block; }
.menu { position: absolute; top: calc(100% + 6px); right: 0; min-width: 190px; background: var(--cream); border: 1px solid var(--border); border-radius: 10px; padding: 6px; z-index: 60; box-shadow: 0 16px 40px -16px rgba(20,16,12,.34); animation: pop .15s cubic-bezier(.3,.8,.4,1); }
.menu--left { right: auto; left: 0; }
.menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 11px; border: none; background: none; border-radius: 7px; cursor: pointer; text-align: left; font-family: var(--font-body); font-size: 14.5px; color: var(--ink-2); transition: background .12s, color .12s; }
.menu__item:hover { background: var(--cream-raised); color: var(--ink); }
.menu__item svg { width: 16px; height: 16px; color: var(--ink-3); stroke-width: 2; }
.menu__item--danger { color: var(--accent); }
.menu__item--danger svg { color: var(--accent); }
.menu__sep { height: 1px; background: var(--border); margin: 6px 4px; }

/* ── Date picker ─────────────────────────────────────────── */
.cal { position: absolute; top: calc(100% + 6px); left: 0; width: 270px; background: var(--cream); border: 1px solid var(--border); border-radius: 12px; padding: 14px; z-index: 60; box-shadow: 0 16px 40px -16px rgba(20,16,12,.34); animation: pop .15s cubic-bezier(.3,.8,.4,1); }
.cal__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.cal__title { font-family: var(--font-display); font-weight: 500; font-size: 16px; }
.cal__nav { width: 28px; height: 28px; border: 1.5px solid var(--border); background: var(--cream); border-radius: 7px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; color: var(--ink-2); }
.cal__nav:hover { border-color: var(--ink-3); }
.cal__nav svg { width: 14px; height: 14px; stroke-width: 2.2; }
.cal__grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.cal__dow { font-family: var(--font-mono); font-weight: 500; font-size: 9px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-align: center; padding: 4px 0; }
.cal__day { aspect-ratio: 1; border: none; background: none; border-radius: 7px; cursor: pointer; font-family: var(--font-num); font-size: 12.5px; color: var(--ink-2); transition: background .12s, color .12s; }
.cal__day:hover { background: var(--cream-raised); }
.cal__day--muted { color: var(--muted-2); }
.cal__day--today { box-shadow: inset 0 0 0 1.5px var(--border); }
.cal__day--sel { background: var(--accent); color: #fff; }
.cal__day--sel:hover { background: var(--accent); }

/* ── Empty state ─────────────────────────────────────────── */
.empty { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 48px 28px; border: 1px dashed var(--border); border-radius: 12px; }
.empty__icon { width: 52px; height: 52px; border-radius: 50%; background: var(--cream-raised); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; margin-bottom: 16px; }
.empty__icon svg { width: 24px; height: 24px; color: var(--ink-3); stroke-width: 1.75; }
.empty__title { font-family: var(--font-display); font-weight: 500; font-size: 20px; color: var(--ink); margin: 0 0 6px; }
.empty__body { font-family: var(--font-body); font-size: 14.5px; color: var(--ink-3); margin: 0 0 18px; max-width: 38ch; line-height: 1.5; }

/* ── Range slider ────────────────────────────────────────── */
.slider { display: flex; flex-direction: column; gap: 9px; }
.slider__top { display: flex; justify-content: space-between; align-items: baseline; }
.slider__val { font-family: var(--font-num); font-weight: 500; font-size: 14px; color: var(--ink); }
.slider input[type=range] { -webkit-appearance: none; appearance: none; width: 100%; height: 6px; border-radius: 999px; background: var(--muted-2); outline: none; cursor: pointer; accent-color: var(--accent); }
.slider input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; appearance: none; width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 3px solid var(--cream); box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: grab; transition: transform .1s; }
.slider input[type=range]::-webkit-slider-thumb:active { transform: scale(1.12); cursor: grabbing; }
.slider input[type=range]::-moz-range-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--accent); border: 3px solid var(--cream); box-shadow: 0 1px 4px rgba(0,0,0,.25); cursor: grab; }

/* ── File upload ─────────────────────────────────────────── */
.upload { display: flex; align-items: center; gap: 14px; padding: 18px; border: 1.5px dashed var(--border); border-radius: 10px; background: var(--cream); cursor: pointer; transition: border-color .15s, background .15s; }
.upload:hover, .upload.drag { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 5%, var(--cream)); }
.upload__icon { width: 42px; height: 42px; border-radius: 9px; background: var(--cream-raised); border: 1px solid var(--border); display: inline-flex; align-items: center; justify-content: center; flex: none; }
.upload__icon svg { width: 19px; height: 19px; color: var(--ink-3); stroke-width: 2; }
.upload__title { font-family: var(--font-body); font-size: 15px; color: var(--ink); }
.upload__title b { color: var(--accent); font-weight: 500; }
.upload__sub { font-family: var(--font-num); font-size: 11px; color: var(--ink-3); margin-top: 3px; }

/* ── Tooltip ─────────────────────────────────────────────── */
.tip { position: relative; display: inline-flex; }
.tip__bubble { position: absolute; bottom: calc(100% + 9px); left: 50%; transform: translateX(-50%); background: var(--ink); color: var(--cream); font-family: var(--font-body); font-size: 13px; line-height: 1.35; padding: 8px 11px; border-radius: 8px; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .14s ease, transform .14s ease; z-index: 70; box-shadow: 0 8px 22px -8px rgba(0,0,0,.4); }
.tip__bubble::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%); border: 5px solid transparent; border-top-color: var(--ink); }
.tip:hover .tip__bubble { opacity: 1; transform: translateX(-50%) translateY(-2px); }

/* ── Accordion ───────────────────────────────────────────── */
.acc { border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.acc__item + .acc__item { border-top: 1px solid var(--border); }
.acc__head { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 16px 18px; background: var(--cream); border: none; cursor: pointer; text-align: left; font-family: var(--font-display); font-weight: 500; font-size: 17px; color: var(--ink); transition: background .12s; }
.acc__head:hover { background: var(--cream-raised); }
.acc__head svg { width: 18px; height: 18px; color: var(--ink-3); flex: none; transition: transform .2s ease; stroke-width: 2; }
.acc__item.open .acc__head svg { transform: rotate(180deg); }
.acc__panel { max-height: 0; overflow: hidden; transition: max-height .26s ease; }
.acc__item.open .acc__panel { max-height: 320px; }
.acc__body { padding: 0 18px 18px; font-family: var(--font-body); font-size: 14.5px; line-height: 1.55; color: var(--ink-2); }

/* ── Stepper ─────────────────────────────────────────────── */
.stepper { display: flex; align-items: center; }
.stepper__step { display: flex; align-items: center; gap: 10px; }
.stepper__dot { width: 28px; height: 28px; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-num); font-weight: 600; font-size: 12px; border: 1.5px solid var(--border); background: var(--cream); color: var(--ink-3); transition: background .15s, border-color .15s, color .15s; }
.stepper__dot svg { width: 14px; height: 14px; stroke-width: 3; }
.stepper__label { font-family: var(--font-mono); font-weight: 500; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); }
.stepper__line { width: 38px; height: 1.5px; background: var(--border); margin: 0 12px; }
.stepper__step.done .stepper__dot { background: var(--accent); border-color: var(--accent); color: #fff; }
.stepper__step.active .stepper__dot { border-color: var(--accent); color: var(--accent); }
.stepper__step.active .stepper__label, .stepper__step.done .stepper__label { color: var(--ink); }

/* ── Vertical tabs ───────────────────────────────────────── */
.vtabs { display: flex; flex-direction: column; gap: 2px; }
.vtab { display: flex; align-items: center; gap: 10px; padding: 10px 13px; border: none; background: none; border-radius: 8px; border-left: 2px solid transparent; cursor: pointer; text-align: left; font-family: var(--font-mono); font-weight: 500; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--ink-3); transition: background .12s, color .12s, border-color .12s; }
.vtab:hover { color: var(--ink); background: var(--cream-raised); }
.vtab[aria-selected="true"] { color: var(--accent); border-left-color: var(--accent); background: color-mix(in srgb, var(--accent) 6%, transparent); }
.vtab svg { width: 16px; height: 16px; stroke-width: 2; }
