/* TrueScore — shell + components */

#app { position: relative; z-index: 1; min-height: 100vh; }

/* ============ CARDS ============ */
.card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--card-border);
  border-radius: 18px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  overflow: hidden;
}
.card > * { position: relative; z-index: 2; }
.card::after { /* corner dots */
  content: ''; position: absolute; z-index: 1; top: 0; right: 0; width: 160px; height: 120px;
  background-image: radial-gradient(circle, var(--dot) 1px, transparent 1.4px);
  background-size: 10px 10px;
  -webkit-mask-image: radial-gradient(120% 120% at 100% 0%, #000 0%, rgba(0,0,0,.5) 38%, transparent 72%);
  mask-image: radial-gradient(120% 120% at 100% 0%, #000 0%, rgba(0,0,0,.5) 38%, transparent 72%);
  pointer-events: none;
}
.card.no-dots::after { display: none; }
.card.spot::before {
  content: ''; position: absolute; z-index: 0; left: -200px; top: -170px; width: 560px; height: 320px;
  background: radial-gradient(50% 50% at 50% 50%, var(--blob-mint) 0%, transparent 70%);
  filter: blur(40px); pointer-events: none;
}
.card-pad { padding: 24px; }

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 46px; padding: 0 20px; border-radius: 10px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; cursor: pointer; user-select: none;
  transition: transform .12s ease, box-shadow .15s ease, background .15s ease, opacity .15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(.98); }
.btn:focus-visible, .input:focus-visible, .seg button:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--btn-fill); color: var(--btn-text); }
.btn-primary:hover { box-shadow: var(--shadow-pop); }
.btn-accent { background: var(--accent); color: var(--on-accent); }
.btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.btn-ghost:hover { background: var(--neutral-soft); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13px; border-radius: 9px; }
.btn-xs { height: 30px; padding: 0 11px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .45; pointer-events: none; }
.btn .spinner-slot { display: inline-flex; width: 16px; height: 16px; }

.icon-btn {
  position: relative; width: 38px; height: 38px; border-radius: 10px; display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer;
  background: var(--card); border: 1px solid var(--card-border); box-shadow: var(--shadow);
  color: var(--ink); transition: background .15s ease;
}
.icon-btn:hover { background: var(--neutral-soft); }
.icon-btn .dot {
  position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent); border: 2px solid var(--card-solid);
}

/* ============ CHIPS / PILLS ============ */
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; line-height: 16px; white-space: nowrap;
}
.chip.good { background: var(--accent-soft); color: var(--accent); }
.chip.bad { background: var(--danger-soft); color: var(--danger); }
.chip.warn { background: var(--warn-soft); color: var(--warn); }
.chip.neutral { background: var(--neutral-soft); color: var(--text); }

.pill {
  display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px;
  border-radius: 999px; border: 1px solid var(--card-border); background: var(--card);
  backdrop-filter: blur(28px); -webkit-backdrop-filter: blur(28px);
  font-size: 13px; font-weight: 500; color: var(--muted); cursor: pointer; box-shadow: var(--shadow);
  transition: background .15s ease;
}
.pill:hover { background: var(--neutral-soft); }
.pill b { color: var(--ink); font-weight: 600; }
.pill .x { display: inline-flex; color: var(--muted); }
.pill .x:hover { color: var(--danger); }

.bureau-chip {
  display: inline-flex; align-items: center; justify-content: center; padding: 5px 9px;
  border-radius: 8px; background: #FFFFFF; border: 1px solid rgba(0,0,0,.08);
  box-shadow: 0 1px 3px rgba(14,14,16,.05);
}
.bureau-chip img { height: 15px; width: auto; display: block; }
.bureau-chip img.eq { height: 12px; }
.bureau-chip img.ex { height: 16px; }

/* ============ INPUTS ============ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--muted); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .lead-ic { position: absolute; left: 14px; color: var(--muted); display: inline-flex; pointer-events: none; }
.input-wrap .trail-ic { position: absolute; right: 12px; color: var(--muted); display: inline-flex; cursor: pointer; background: none; border: 0; padding: 2px; }
.input {
  width: 100%; height: 46px; padding: 0 14px; border-radius: 10px;
  background: var(--input-bg); border: 1px solid var(--input-border); color: var(--ink);
  font-size: 15px; transition: border-color .15s ease, box-shadow .15s ease;
}
.input-wrap .lead-ic + .input { padding-left: 40px; }
.input::placeholder { color: var(--muted); }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.input.invalid { border-color: var(--danger); }
.field .err { font-size: 12px; color: var(--danger); display: none; }
.field.show-err .err { display: block; }
.field .help { font-size: 12px; color: var(--muted); }
textarea.input { height: auto; min-height: 96px; padding: 12px 14px; resize: vertical; }
select.input { appearance: none; cursor: pointer; }

.check { display: inline-flex; align-items: flex-start; gap: 10px; cursor: pointer; font-size: 13px; color: var(--text); }
.check input { display: none; }
.check .box {
  flex: 0 0 auto; width: 18px; height: 18px; border-radius: 5px; margin-top: 1px;
  border: 1.5px solid var(--input-border); display: inline-flex; align-items: center; justify-content: center;
  color: var(--on-accent); transition: background .12s ease, border-color .12s ease;
}
.check .box svg { opacity: 0; transform: scale(.5); transition: all .12s ease; }
.check input:checked + .box { background: var(--accent); border-color: var(--accent); }
.check input:checked + .box svg { opacity: 1; transform: scale(1); }

/* toggle switch */
.switch { position: relative; width: 40px; height: 24px; flex: 0 0 auto; cursor: pointer; }
.switch input { display: none; }
.switch .track { position: absolute; inset: 0; border-radius: 999px; background: var(--track); transition: background .18s ease; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #FFFFFF; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .18s ease; }
.switch input:checked ~ .track { background: var(--accent); }
.switch input:checked ~ .thumb { left: 19px; }

/* segmented control */
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 9px; background: var(--neutral-soft); border: 1px solid var(--border); }
.seg button {
  border: 0; background: transparent; padding: 4px 10px; border-radius: 7px;
  font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.seg button.on { background: var(--card-solid); color: var(--ink); box-shadow: 0 1px 3px rgba(14,14,16,.08); }

/* progress bar */
.bar { height: 6px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar > i { display: block; height: 100%; border-radius: 999px; background: var(--accent); transition: width .6s cubic-bezier(.22,.8,.36,1); }
.bar.warn > i { background: var(--warn); }

/* skeleton */
.sk { position: relative; overflow: hidden; border-radius: 6px; background: var(--neutral-soft); }
.sk::after { content: ''; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, color-mix(in srgb, var(--ink) 6%, transparent), transparent);
  animation: shimmer 1.4s infinite; }
@keyframes shimmer { 100% { transform: translateX(100%); } }

/* ============ AUTH SHELL ============ */
.auth { display: grid; grid-template-columns: 44.5% 1fr; min-height: 100vh; }
.auth-art { position: relative; background: #0E0E10 url('../assets/auth-art.jpg') center/cover no-repeat; overflow: hidden; }
.auth-art .veil { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(14,14,16,0) 40%, rgba(14,14,16,.9) 100%); }
.auth-art .lockup { position: absolute; top: 44px; left: 48px; }
.auth-art .copy { position: absolute; left: 48px; bottom: 56px; }
.auth-art .copy h1 { margin: 0 0 12px; font-size: 36px; line-height: 1.22; font-weight: 500; letter-spacing: -.02em; color: #ECECEC; }
.auth-art .copy p { margin: 0; font-size: 15px; color: #A6A6A6; }
.auth-panel { position: relative; display: flex; align-items: center; justify-content: center; padding: 48px 24px; }
.auth-top { position: absolute; top: 34px; right: 48px; display: flex; align-items: center; gap: 16px; font-size: 14px; font-weight: 500; color: var(--muted); }
.auth-card { width: min(472px, 100%); padding: 36px; border-radius: 24px; }
.auth-card .h-display { margin: 0 0 8px; }
.auth-card .sub { margin: 0 0 24px; font-size: 15px; color: var(--text); }
.lockup { display: inline-flex; align-items: center; gap: 10px; }
.lockup img { height: 28px; width: auto; }
.lockup b { font-size: 18px; font-weight: 600; letter-spacing: -.02em; color: #ECECEC; }
.lockup.on-page b { color: var(--ink); }
.divider { display: flex; align-items: center; gap: 12px; color: var(--muted); font-size: 12px; margin: 20px 0; }
.divider::before, .divider::after { content: ''; height: 1px; flex: 1; background: var(--border); }
.strength { display: flex; align-items: center; gap: 10px; margin-top: 8px; }
.strength .bars { display: flex; gap: 4px; flex: 1; }
.strength .bars i { height: 4px; flex: 1; border-radius: 2px; background: var(--track); transition: background .2s ease; }
.strength .bars i.on { background: var(--accent); }
.strength span { font-size: 12px; font-weight: 600; color: var(--muted); }
.code-row { display: flex; gap: 10px; justify-content: space-between; margin: 4px 0 8px; }
.code-box {
  width: 58px; height: 64px; border-radius: 12px; text-align: center; font-size: 26px; font-weight: 500;
  background: var(--input-bg); border: 1px solid var(--input-border); color: var(--ink);
}
.code-box:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }

/* ============ APP SHELL ============ */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; justify-content: space-between;
  padding: 20px 14px 16px; background: var(--sidebar); border-right: 1px solid var(--border);
  backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); z-index: 30;
}
.side .top { display: flex; flex-direction: column; gap: 24px; }
.side .lockup { padding: 6px 10px; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--text); transition: background .12s ease;
}
.nav a svg { color: var(--muted); flex: 0 0 auto; }
.nav a:hover { background: var(--neutral-soft); }
.nav a.on { background: var(--nav-active); color: var(--ink); font-weight: 600; }
.nav a.on svg { color: var(--ink); }
.nav .badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 7px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}
.side .bottom { display: flex; flex-direction: column; gap: 2px; }
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 8px;
  border-radius: 12px; background: var(--surface2); border: 1px solid var(--border); cursor: pointer;
}
.user-card .nm { font-size: 13px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.user-card .pl { font-size: 11px; color: var(--muted); }
.avatar { border-radius: 50%; object-fit: cover; background: var(--surface3); }
.avatar.initials { display: inline-flex; align-items: center; justify-content: center; color: var(--on-accent); background: var(--accent); font-weight: 700; }

.main { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px 32px 12px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
}
.topbar .t h1 { margin: 0; font-size: 18px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.topbar .t p { margin: 0; font-size: 12px; color: var(--muted); }
.topbar .tools { display: flex; align-items: center; gap: 12px; }
.searchbox {
  display: flex; align-items: center; gap: 8px; width: 250px; height: 38px; padding: 0 12px;
  border-radius: 10px; background: var(--input-bg); border: 1px solid var(--input-border);
  color: var(--muted); font-size: 13px; cursor: pointer;
}
.searchbox kbd {
  margin-left: auto; font-family: var(--font); font-size: 10px; font-weight: 700; color: var(--muted);
  border: 1px solid var(--border-strong); border-radius: 5px; padding: 2px 5px;
}
.content { flex: 1; padding: 8px 32px 40px; display: flex; flex-direction: column; gap: 20px; }
.row { display: grid; gap: 20px; }

/* ============ DROPDOWNS / MENUS ============ */
.menu {
  position: absolute; z-index: 60; min-width: 220px; padding: 6px; border-radius: 14px;
  background: var(--tooltip-bg); border: 1px solid var(--card-border); box-shadow: var(--shadow-pop);
  backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px);
}
.menu .mi {
  display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 9px 10px;
  border: 0; background: none; border-radius: 9px; font-size: 13px; font-weight: 500; color: var(--ink); cursor: pointer;
}
.menu .mi:hover { background: var(--neutral-soft); }
.menu .mi.danger { color: var(--danger); }
.menu .sep { height: 1px; margin: 6px 8px; background: var(--border); }
.menu .mh { padding: 8px 10px 4px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }

/* ============ MODAL ============ */
.modal-scrim { position: fixed; inset: 0; z-index: 90; background: var(--scrim); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fadeIn .18s ease; }
.modal {
  width: min(560px, 100%); max-height: 88vh; overflow: auto; border-radius: 20px; padding: 28px;
  background: var(--card-solid); border: 1px solid var(--card-border); box-shadow: var(--shadow-pop);
  animation: popIn .2s cubic-bezier(.22,.8,.36,1);
}
.modal.wide { width: min(720px, 100%); }
.modal h3 { margin: 0 0 6px; font-size: 20px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.modal .sub { margin: 0 0 20px; font-size: 14px; color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 24px; }
@keyframes fadeIn { from { opacity: 0; } }
@keyframes popIn { from { opacity: 0; transform: translateY(10px) scale(.98); } }

/* drawer */
.drawer-scrim { position: fixed; inset: 0; z-index: 90; background: var(--scrim); animation: fadeIn .18s ease; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 95; width: min(440px, 92vw);
  background: var(--card-solid); border-left: 1px solid var(--card-border); box-shadow: var(--shadow-pop);
  padding: 28px; overflow: auto; animation: slideIn .22s cubic-bezier(.22,.8,.36,1);
}
@keyframes slideIn { from { transform: translateX(40px); opacity: 0; } }

/* ============ TOASTS ============ */
#toasts { position: fixed; z-index: 120; bottom: 24px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 12px;
  background: var(--tooltip-bg); border: 1px solid var(--card-border); box-shadow: var(--shadow-pop);
  color: var(--ink); font-size: 13px; font-weight: 500;
  backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px);
  animation: toastIn .25s cubic-bezier(.22,.8,.36,1);
}
.toast.out { animation: toastOut .25s ease forwards; }
.toast .ic { display: inline-flex; color: var(--accent); }
.toast .ic.bad { color: var(--danger); }
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } }
@keyframes toastOut { to { opacity: 0; transform: translateY(12px); } }

/* ============ COMMAND PALETTE ============ */
.palette-scrim { position: fixed; inset: 0; z-index: 100; background: var(--scrim); display: flex; justify-content: center; align-items: flex-start; padding-top: 14vh; animation: fadeIn .15s ease; }
.palette { width: min(560px, 92vw); border-radius: 18px; overflow: hidden; background: var(--card-solid); border: 1px solid var(--card-border); box-shadow: var(--shadow-pop); animation: popIn .18s ease; }
.palette input { width: 100%; border: 0; background: transparent; padding: 18px 20px; font-size: 16px; color: var(--ink); outline: none; border-bottom: 1px solid var(--border); }
.palette .results { max-height: 46vh; overflow: auto; padding: 8px; }
.palette .pr { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 10px; cursor: pointer; font-size: 14px; color: var(--ink); }
.palette .pr .k { margin-left: auto; font-size: 11px; color: var(--muted); }
.palette .pr:hover, .palette .pr.sel { background: var(--neutral-soft); }
.palette .empty { padding: 28px; text-align: center; color: var(--muted); font-size: 14px; }

/* ============ MISC ============ */
.section-title { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.section-title h2 { margin: 0; font-size: 16px; font-weight: 600; color: var(--ink); }
.section-title p { margin: 0; font-size: 12px; color: var(--muted); }
.linklike { background: none; border: 0; padding: 0; font-size: 13px; font-weight: 600; color: var(--ink); cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.kv { display: flex; flex-direction: column; gap: 2px; }
.kv .l { font-size: 12px; color: var(--muted); }
.kv .v { font-size: 20px; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
.fade-in { animation: viewIn .28s cubic-bezier(.22,.8,.36,1); }
@keyframes viewIn { from { opacity: 0; transform: translateY(8px); } }
.tip { position: fixed; z-index: 80; padding: 6px 9px; border-radius: 8px; background: var(--tooltip-bg); border: 1px solid var(--card-border); box-shadow: var(--shadow-pop); font-size: 12px; color: var(--ink); pointer-events: none; }

/* responsive */
@media (max-width: 1180px) {
  .shell { grid-template-columns: 76px 1fr; }
  .side .lockup b, .nav a span, .nav .badge, .user-card .meta, .user-card .more { display: none; }
  .nav a { justify-content: center; }
  .user-card { justify-content: center; padding: 8px; }
}
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .content, .topbar { padding-left: 16px; padding-right: 16px; }
  .row { grid-template-columns: 1fr !important; }
  .searchbox { display: none; }
}
