:root {
  color-scheme: dark;
}

html, body { height: 100%; }

/* Smooth fade between routes */
#app > .view-enter {
  animation: viewIn .35s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes viewIn {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.08);
  border-radius: 8px;
  border: 2px solid transparent;
  background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.16); background-clip: padding-box; border: 2px solid transparent; }

/* Glass card */
.card {
  background: linear-gradient(180deg, rgba(255,255,255,.035), rgba(255,255,255,.015));
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 18px;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  box-shadow: 0 10px 30px -10px rgba(7,10,24,.55);
}

.card-hover { transition: transform .25s ease, border-color .25s ease, box-shadow .25s ease; }
.card-hover:hover {
  transform: translateY(-2px);
  border-color: rgba(91,136,255,.35);
  box-shadow: 0 20px 40px -20px rgba(58,100,255,.35), 0 0 0 1px rgba(91,136,255,.18);
}

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  padding: .55rem .95rem; border-radius: .65rem; font-weight: 600; font-size: .875rem;
  transition: all .18s ease; cursor: pointer; border: 1px solid transparent; white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: linear-gradient(180deg, #4f78ff, #2244ed);
  color: white;
  box-shadow: 0 8px 20px -8px rgba(34,68,237,.7), inset 0 1px 0 rgba(255,255,255,.18);
}
.btn-primary:hover:not(:disabled) { filter: brightness(1.08); transform: translateY(-1px); }
.btn-ghost {
  background: rgba(255,255,255,.04);
  color: #cbd3e6;
  border-color: rgba(255,255,255,.08);
}
.btn-ghost:hover:not(:disabled) { background: rgba(255,255,255,.08); color: #fff; }
.btn-danger {
  background: rgba(244, 63, 94, .15);
  color: #fecdd3;
  border-color: rgba(244, 63, 94, .35);
}
.btn-danger:hover:not(:disabled) { background: rgba(244, 63, 94, .25); }
.btn-success {
  background: rgba(16,185,129,.18);
  color: #a7f3d0;
  border-color: rgba(16,185,129,.4);
}
.btn-success:hover:not(:disabled) { background: rgba(16,185,129,.3); }

/* Inputs */
.input, .select, .textarea {
  width: 100%;
  background: rgba(13, 18, 38, .55);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: .6rem;
  padding: .6rem .8rem;
  color: #e8ecf6;
  font-size: .9rem;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: rgba(91,136,255,.7);
  box-shadow: 0 0 0 4px rgba(58,100,255,.18);
}
.input::placeholder, .textarea::placeholder { color: #6b7aa1; }
label.field-label {
  display: block; font-size: .72rem; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase; color: #9aa6c4; margin-bottom: .35rem;
}

/* Pills */
.pill {
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .2rem .55rem; border-radius: 999px; font-size: .7rem; font-weight: 600;
  letter-spacing: .02em; border: 1px solid transparent;
}
.pill-emerald { background: rgba(16,185,129,.12); color: #6ee7b7; border-color: rgba(16,185,129,.3); }
.pill-amber   { background: rgba(245,158,11,.12); color: #fcd34d; border-color: rgba(245,158,11,.35); }
.pill-rose    { background: rgba(244, 63, 94, .12); color: #fda4af; border-color: rgba(244, 63, 94, .35); }
.pill-sky     { background: rgba(56,189,248,.12); color: #7dd3fc; border-color: rgba(56,189,248,.35); }
.pill-slate   { background: rgba(148,163,184,.12); color: #cbd5e1; border-color: rgba(148,163,184,.3); }
.pill-brand   { background: rgba(58,100,255,.14); color: #bcd1ff; border-color: rgba(91,136,255,.35); }

/* Tables */
.tbl { width: 100%; border-collapse: separate; border-spacing: 0; font-size: .88rem; }
.tbl thead th {
  text-align: left; font-weight: 600; color: #9aa6c4;
  padding: .7rem .9rem; border-bottom: 1px solid rgba(255,255,255,.07);
  font-size: .7rem; text-transform: uppercase; letter-spacing: .06em;
}
.tbl tbody td {
  padding: .8rem .9rem; border-bottom: 1px solid rgba(255,255,255,.04);
  color: #e8ecf6;
}
.tbl tbody tr:hover td { background: rgba(255,255,255,.025); }
.tbl tbody tr:last-child td { border-bottom: none; }

/* Toasts */
.toast {
  display: flex; gap: .65rem; align-items: flex-start;
  background: rgba(13,18,38,.85); backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: .8rem; padding: .7rem .85rem;
  box-shadow: 0 18px 40px -15px rgba(7,10,24,.6);
  animation: toastIn .25s cubic-bezier(.2,.7,.2,1) both;
  font-size: .85rem;
}
.toast.toast-out { animation: toastOut .2s ease forwards; }
@keyframes toastIn { from { opacity: 0; transform: translateY(-8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateY(-6px) scale(.97); } }

/* Modal */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 90;
  background: rgba(7,10,24,.75); backdrop-filter: blur(6px);
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  animation: fadeIn .18s ease both;
}
.modal {
  width: 100%; max-width: 560px;
  background: linear-gradient(180deg, rgba(22,28,52,.95), rgba(13,18,38,.95));
  border: 1px solid rgba(255,255,255,.08); border-radius: 16px;
  box-shadow: 0 40px 80px -20px rgba(0,0,0,.7);
  animation: modalIn .22s cubic-bezier(.2,.7,.2,1) both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

/* QR fullscreen */
.qr-stage {
  background: radial-gradient(circle at 30% 20%, #1a2a7a33, transparent 60%),
              radial-gradient(circle at 80% 80%, #5b88ff22, transparent 60%),
              #070a18;
}

/* Signature canvas */
.sig-canvas {
  width: 100%; height: 220px; background: #f8fafc;
  border-radius: 14px; touch-action: none;
  box-shadow: inset 0 0 0 1px rgba(0,0,0,.05);
}

/* Nav tabs */
.nav-tab {
  position: relative;
  padding: .5rem .85rem;
  border-radius: .55rem;
  color: #9aa6c4;
  font-weight: 500;
  transition: color .15s ease, background .15s ease;
  display: inline-flex; align-items: center; gap: .4rem;
}
.nav-tab:hover { color: #e8ecf6; background: rgba(255,255,255,.04); }
.nav-tab.active { color: #fff; background: rgba(58,100,255,.12); }
.nav-tab.active::after {
  content: ''; position: absolute; left: 12%; right: 12%; bottom: -3px; height: 2px;
  background: linear-gradient(90deg, transparent, #5b88ff, transparent);
}

/* Stat cards accent line */
.stat::before {
  content: ''; position: absolute; inset: 0 auto 0 0; width: 3px;
  background: linear-gradient(180deg, #5b88ff, #1a34c4);
  border-radius: 18px 0 0 18px;
}

/* QR ring animation */
.qr-ring {
  background: conic-gradient(#3a64ff var(--p, 100%), rgba(255,255,255,.08) 0);
  border-radius: 50%;
  transition: background .6s linear;
}

/* Progressbar */
.bar { height: 6px; border-radius: 999px; background: rgba(255,255,255,.06); overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #5b88ff, #2244ed); transition: width .4s ease; }

/* Loading spinner */
.spinner {
  width: 18px; height: 18px;
  border: 2px solid rgba(255,255,255,.15);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Light gradient text */
.gradient-text {
  background: linear-gradient(90deg, #ffffff, #bcd1ff 60%, #8db1ff);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

/* Avatar */
.avatar {
  width: 32px; height: 32px; border-radius: 50%;
  display: grid; place-items: center; font-size: .72rem; font-weight: 700;
  background: linear-gradient(135deg, #3a64ff, #1a2d9b); color: white;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.2);
}

/* Print styles for PDF preview fallback */
@media print {
  body { background: white; color: black; }
  .no-print { display: none !important; }
}
