/* ── Versium License Hub — premium dark UI ─────────────────────────────── */

:root {
  --bg: #0a0d14;
  --bg-soft: #0e1220;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-hover: rgba(255, 255, 255, 0.06);
  --border: rgba(255, 255, 255, 0.09);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #e8eaf2;
  --text-dim: #9aa1b5;
  --text-faint: #626a80;
  --accent: #6d6ffa;
  --accent-2: #a855f7;
  --accent-soft: rgba(109, 111, 250, 0.14);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --warn: #fbbf24;
  --warn-soft: rgba(251, 191, 36, 0.12);
  --bad: #fb7185;
  --bad-soft: rgba(251, 113, 133, 0.12);
  --mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --shadow-lg: 0 24px 60px -12px rgba(0, 0, 0, 0.55);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html { color-scheme: dark; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(900px 500px at 15% -10%, rgba(109, 111, 250, 0.14), transparent 60%),
    radial-gradient(800px 500px at 90% -20%, rgba(168, 85, 247, 0.10), transparent 60%),
    radial-gradient(700px 600px at 50% 120%, rgba(52, 211, 153, 0.05), transparent 60%);
  pointer-events: none;
  z-index: 0;
}

#app { position: relative; z-index: 1; }

::selection { background: rgba(109, 111, 250, 0.35); }

h1, h2, h3 { font-weight: 650; letter-spacing: -0.02em; }

button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }

input, textarea, select { font: inherit; color: inherit; }

/* ── generic ─────────────────────────────────────────────────────────── */

.hidden { display: none !important; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 18px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}

.mono { font-family: var(--mono); font-size: 0.85em; }

.fade-rise { animation: rise 0.5s var(--ease) both; }

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes pop {
  0% { transform: scale(0.6); opacity: 0; }
  70% { transform: scale(1.06); }
  100% { transform: scale(1); opacity: 1; }
}

@keyframes shake {
  10%, 90% { transform: translateX(-2px); }
  20%, 80% { transform: translateX(4px); }
  30%, 50%, 70% { transform: translateX(-7px); }
  40%, 60% { transform: translateX(7px); }
}

@keyframes shimmer {
  from { background-position: -400px 0; }
  to { background-position: 400px 0; }
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ── buttons ─────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 12px;
  font-weight: 560;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--surface);
  transition: transform 0.15s var(--ease), box-shadow 0.2s, background 0.2s, border-color 0.2s, opacity 0.2s;
  user-select: none;
  white-space: nowrap;
}

.btn:hover { background: var(--surface-hover); border-color: var(--border-strong); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(0.98); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--accent-soft), 0 0 0 1px var(--accent); }
.btn:disabled { opacity: 0.55; pointer-events: none; }

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: none;
  color: #fff;
  box-shadow: 0 8px 24px -8px rgba(109, 111, 250, 0.55);
}
.btn-primary:hover {
  background: linear-gradient(135deg, #7d7ffb, #b56bf8);
  box-shadow: 0 12px 30px -8px rgba(109, 111, 250, 0.7);
}

.btn-ghost { border-color: transparent; background: transparent; color: var(--text-dim); }
.btn-ghost:hover { color: var(--text); background: var(--surface-hover); }

.btn-icon { padding: 8px; border-radius: 10px; }

.btn .spinner { display: none; }
.btn.loading .spinner { display: inline-block; }
.btn.loading .btn-label { opacity: 0.7; }

.spinner {
  width: 15px;
  height: 15px;
  border: 2px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

/* ── inputs ──────────────────────────────────────────────────────────── */

.field { display: flex; flex-direction: column; gap: 6px; }

.field label { font-size: 13px; font-weight: 560; color: var(--text-dim); }

.field .hint { font-size: 12px; color: var(--text-faint); }

.input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.045);
  border: 1px solid var(--border);
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
  font-size: 14.5px;
}

.input::placeholder { color: var(--text-faint); }

.input:hover { border-color: var(--border-strong); }

.input:focus {
  outline: none;
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

textarea.input { resize: vertical; min-height: 64px; }

input[type="date"].input::-webkit-calendar-picker-indicator { filter: invert(0.7); cursor: pointer; }

input[type="number"].input { -moz-appearance: textfield; appearance: textfield; }

/* ── login ───────────────────────────────────────────────────────────── */

.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.login-card {
  width: 400px;
  max-width: 100%;
  padding: 40px 36px 32px;
  display: flex;
  flex-direction: column;
  gap: 22px;
  box-shadow: var(--shadow-lg);
}

.login-card.error-shake { animation: shake 0.5s; }

.brand { display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }

.brand-mark {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.03em;
  box-shadow: 0 14px 34px -10px rgba(109, 111, 250, 0.65);
}

.brand h1 { font-size: 21px; }

.brand p { font-size: 13.5px; color: var(--text-dim); }

.login-form { display: flex; flex-direction: column; gap: 14px; }

.login-error {
  font-size: 13px;
  color: var(--bad);
  background: var(--bad-soft);
  border: 1px solid rgba(251, 113, 133, 0.25);
  padding: 9px 12px;
  border-radius: 10px;
  animation: rise 0.3s var(--ease);
}

/* ── shell ───────────────────────────────────────────────────────────── */

.shell { max-width: 1060px; margin: 0 auto; padding: 0 24px 80px; }

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 0 14px;
}

.topbar .brand-mini { display: flex; align-items: center; gap: 12px; margin-right: auto; }

.topbar .brand-mark { width: 38px; height: 38px; border-radius: 11px; font-size: 18px; }

.topbar .brand-title { font-size: 15.5px; font-weight: 650; letter-spacing: -0.01em; }

.topbar .brand-sub { font-size: 12px; color: var(--text-faint); margin-top: -2px; }

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13.5px;
  color: var(--text-dim);
}

.user-chip .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); box-shadow: 0 0 8px var(--ok); }

/* ── nav tabs ────────────────────────────────────────────────────────── */

.nav {
  position: relative;
  display: inline-flex;
  gap: 4px;
  padding: 5px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin: 10px 0 26px;
}

.nav-btn {
  position: relative;
  z-index: 1;
  padding: 8px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 560;
  color: var(--text-dim);
  transition: color 0.2s;
}

.nav-btn.active { color: #fff; }

.nav-indicator {
  position: absolute;
  top: 5px;
  bottom: 5px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 6px 18px -6px rgba(109, 111, 250, 0.6);
  transition: left 0.3s var(--ease), width 0.3s var(--ease);
}

/* ── issue view ──────────────────────────────────────────────────────── */

.view { animation: rise 0.4s var(--ease); }

.issue-grid { display: grid; grid-template-columns: 1fr; gap: 20px; }

.panel { padding: 28px; }

.panel-title { font-size: 16px; margin-bottom: 4px; }

.panel-sub { font-size: 13px; color: var(--text-dim); margin-bottom: 20px; }

.segmented {
  position: relative;
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 4px;
  border-radius: 13px;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border);
  margin-bottom: 24px;
}

.segmented-btn {
  position: relative;
  z-index: 1;
  padding: 10px 12px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  color: var(--text-dim);
  transition: color 0.2s;
}

.segmented-btn .seg-title { font-size: 14px; font-weight: 600; }

.segmented-btn .seg-sub { font-size: 11.5px; opacity: 0.75; }

.segmented-btn.active { color: #fff; }

.segmented-thumb {
  position: absolute;
  top: 4px;
  bottom: 4px;
  width: calc(50% - 4px);
  left: 4px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  transition: transform 0.3s var(--ease);
  box-shadow: 0 6px 18px -6px rgba(109, 111, 250, 0.55);
}

.segmented[data-active="1"] .segmented-thumb { transform: translateX(100%); }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.form-grid .full { grid-column: 1 / -1; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }

.chip {
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-dim);
  background: var(--surface);
  border: 1px solid var(--border);
  transition: all 0.18s var(--ease);
}

.chip:hover { color: var(--text); border-color: var(--accent); background: var(--accent-soft); transform: translateY(-1px); }

.form-actions { display: flex; align-items: center; gap: 14px; margin-top: 22px; }

/* ── result panel ────────────────────────────────────────────────────── */

.result-panel {
  margin-top: 20px;
  padding: 26px 28px;
  border: 1px solid rgba(52, 211, 153, 0.25);
  background: linear-gradient(180deg, rgba(52, 211, 153, 0.07), rgba(52, 211, 153, 0.02));
  border-radius: 18px;
  animation: rise 0.45s var(--ease);
}

.result-head { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }

.check-badge {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--ok-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pop 0.5s var(--ease);
}

.check-badge svg { width: 22px; height: 22px; }

.check-badge .check-path {
  stroke: var(--ok);
  stroke-dasharray: 26;
  stroke-dashoffset: 26;
  animation: draw 0.5s 0.15s var(--ease) forwards;
}

@keyframes draw { to { stroke-dashoffset: 0; } }

.result-title { font-size: 16px; font-weight: 650; }

.result-sub { font-size: 13px; color: var(--text-dim); }

.kv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px 20px;
  margin-bottom: 20px;
}

.kv { display: flex; flex-direction: column; gap: 2px; min-width: 0; }

.kv dt { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-faint); }

.kv dd { font-size: 14px; overflow-wrap: anywhere; }

/* ── verify view ─────────────────────────────────────────────────────── */

.dropzone {
  padding: 48px 24px;
  border: 1.5px dashed var(--border-strong);
  border-radius: 18px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  text-align: center;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.22s var(--ease);
  background: var(--surface);
}

.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }

.dropzone.dragover {
  border-color: var(--accent);
  background: var(--accent-soft);
  transform: scale(1.012);
  box-shadow: 0 0 0 4px var(--accent-soft);
}

.dropzone .dz-icon {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.25s var(--ease);
}

.dropzone:hover .dz-icon, .dropzone.dragover .dz-icon { transform: translateY(-3px) scale(1.05); }

.dropzone strong { color: var(--text); font-weight: 600; }

.verify-result { margin-top: 20px; padding: 26px 28px; border-radius: 18px; animation: rise 0.45s var(--ease); }

.verify-result.ok { border: 1px solid rgba(52, 211, 153, 0.3); background: linear-gradient(180deg, rgba(52, 211, 153, 0.07), transparent); }

.verify-result.bad { border: 1px solid rgba(251, 113, 133, 0.3); background: linear-gradient(180deg, rgba(251, 113, 133, 0.07), transparent); }

.verify-result.warn { border: 1px solid rgba(251, 191, 36, 0.3); background: linear-gradient(180deg, rgba(251, 191, 36, 0.07), transparent); }

.x-badge { background: var(--bad-soft); }
.x-badge svg { stroke: var(--bad); }
.w-badge { background: var(--warn-soft); }
.w-badge svg { stroke: var(--warn); }

.ledger-note {
  margin-top: 16px;
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13.5px;
  color: var(--text-dim);
}

.ledger-note b { color: var(--text); font-weight: 600; }

/* ── badges & pills ──────────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 620;
  letter-spacing: 0.01em;
}

.badge-ai { background: var(--accent-soft); color: #a5a7ff; border: 1px solid rgba(109, 111, 250, 0.3); }

.badge-versium { background: rgba(56, 189, 248, 0.12); color: #7dd3fc; border: 1px solid rgba(56, 189, 248, 0.28); }

.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; }

.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-bad { background: var(--bad-soft); color: var(--bad); }

/* ── ledger ──────────────────────────────────────────────────────────── */

.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }

.search-wrap { position: relative; flex: 1; min-width: 220px; }

.search-wrap svg {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  width: 15px;
  height: 15px;
  color: var(--text-faint);
  pointer-events: none;
}

.search-wrap .input { padding-left: 38px; }

.count-chip { font-size: 12.5px; color: var(--text-faint); white-space: nowrap; }

.chip.active { color: #fff; background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: transparent; }

.table-card { overflow: hidden; }

.table-scroll { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: 13.5px; min-width: 760px; }

thead th {
  text-align: left;
  padding: 13px 16px;
  font-size: 11.5px;
  font-weight: 620;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--text-faint);
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

tbody td { padding: 13px 16px; border-bottom: 1px solid rgba(255, 255, 255, 0.05); vertical-align: middle; }

tbody tr { transition: background 0.15s; animation: rise 0.35s var(--ease) both; animation-delay: calc(var(--i) * 30ms); }

tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

tbody tr:last-child td { border-bottom: none; }

.cell-target { font-weight: 560; overflow-wrap: anywhere; }

.cell-sub { font-size: 12px; color: var(--text-faint); margin-top: 1px; overflow-wrap: anywhere; }

.comment-view {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--text-dim);
  cursor: pointer;
  border-radius: 8px;
  padding: 4px 8px;
  margin: -4px -8px;
  transition: background 0.15s, color 0.15s;
  max-width: 240px;
  font-size: inherit;
  text-align: left;
}

.comment-view:hover, .comment-view:focus-visible { background: var(--surface-hover); color: var(--text); }

.comment-view:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--accent-soft), 0 0 0 1px var(--accent); }

.comment-view .edit-ic { opacity: 0; transition: opacity 0.15s; flex: none; }

.comment-view:hover .edit-ic, .comment-view:focus-visible .edit-ic { opacity: 0.7; }

@media (hover: none) {
  .comment-view .edit-ic { opacity: 0.55; }
}

.comment-view span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.comment-view.empty { color: var(--text-faint); font-style: italic; }

.comment-edit { display: flex; gap: 6px; align-items: center; }

.comment-edit .input { padding: 6px 10px; font-size: 13px; }

.empty-state {
  padding: 70px 24px;
  text-align: center;
  color: var(--text-faint);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.empty-state .dz-icon { width: 46px; height: 46px; border-radius: 14px; background: var(--surface-hover); color: var(--text-faint); display: flex; align-items: center; justify-content: center; }

.skeleton-row td > div {
  height: 14px;
  border-radius: 7px;
  background: linear-gradient(90deg, rgba(255,255,255,0.05) 25%, rgba(255,255,255,0.1) 40%, rgba(255,255,255,0.05) 55%);
  background-size: 800px 100%;
  animation: shimmer 1.4s linear infinite;
}

/* ── toast ───────────────────────────────────────────────────────────── */

#toasts {
  position: fixed;
  bottom: 24px;
  right: 24px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: 13px;
  background: #171b28;
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow-lg);
  font-size: 13.5px;
  animation: toast-in 0.35s var(--ease);
  max-width: min(380px, calc(100vw - 48px));
  overflow-wrap: anywhere;
}

.toast.out { animation: toast-out 0.3s var(--ease) forwards; }

.toast.error { border-color: rgba(251, 113, 133, 0.4); }

.toast.success { border-color: rgba(52, 211, 153, 0.4); }

.toast .t-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }

.toast.error .t-dot { background: var(--bad); box-shadow: 0 0 10px var(--bad); }

.toast.success .t-dot { background: var(--ok); box-shadow: 0 0 10px var(--ok); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(16px) scale(0.97); }
  to { opacity: 1; transform: none; }
}

@keyframes toast-out {
  to { opacity: 0; transform: translateY(10px) scale(0.97); }
}

/* ── key status banner ───────────────────────────────────────────────── */

.key-warning {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 16px;
  border-radius: 13px;
  background: var(--warn-soft);
  border: 1px solid rgba(251, 191, 36, 0.3);
  color: var(--warn);
  font-size: 13.5px;
  margin-bottom: 20px;
  animation: rise 0.4s var(--ease);
}

/* ── responsive ──────────────────────────────────────────────────────── */

@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .panel { padding: 20px; }
  .topbar { flex-wrap: wrap; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
