/* ===== Noble Future — shared design system ===== */
:root {
  --indigo: #4f46e5;
  --indigo-dark: #3f37c9;
  --violet: #8b5cf6;
  --pink: #ec4899;
  --sky: #38bdf8;
  --emerald: #10b981;
  --amber: #f59e0b;
  --rose: #f43f5e;
  --ink: #1f1b3a;
  --muted: #635f82;
  --soft: #f3f0ff;
  --line: rgba(99, 95, 130, 0.13);
  --surface: rgba(255, 255, 255, 0.7);
  --surface-strong: rgba(255, 255, 255, 0.92);
  --grad: linear-gradient(135deg, #4f46e5 0%, #7c3aed 52%, #a855f7 100%);
  --grad-warm: linear-gradient(135deg, #f472b6 0%, #a855f7 100%);
  --grad-cool: linear-gradient(135deg, #38bdf8 0%, #4f46e5 100%);
  --shadow-sm: 0 4px 14px rgba(79, 70, 229, 0.08);
  --shadow: 0 16px 38px rgba(79, 70, 229, 0.13);
  --shadow-lg: 0 26px 60px rgba(58, 45, 130, 0.2);
  --radius: 18px;
  --radius-lg: 24px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  color: var(--ink);
  background: #f6f3ff;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
body::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 8% 4%, rgba(139, 92, 246, 0.28), transparent 42%),
    radial-gradient(circle at 92% 8%, rgba(236, 72, 153, 0.18), transparent 38%),
    radial-gradient(circle at 78% 82%, rgba(56, 189, 248, 0.22), transparent 45%),
    radial-gradient(circle at 18% 92%, rgba(79, 70, 229, 0.16), transparent 45%),
    linear-gradient(180deg, #f8f5ff 0%, #f2eeff 55%, #f7f4ff 100%);
}
h1, h2, h3, h4 { margin: 0; letter-spacing: -0.02em; line-height: 1.25; }
p { margin: 0; }
a { color: var(--indigo); text-decoration: none; }
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
::selection { background: rgba(139, 92, 246, 0.25); }

/* ---------- cards & surfaces ---------- */
.card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  padding: 20px;
}
.card-flat {
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.section-title {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; margin-bottom: 14px;
}
.section-title h2 { font-size: 16px; font-weight: 700; }
.section-title .sub { font-size: 12px; color: var(--muted); margin-top: 2px; }
.eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: 1.4px; text-transform: uppercase;
  color: var(--violet); margin-bottom: 4px;
}
.muted { color: var(--muted); }
.tiny { font-size: 11.5px; }
.stack-gap { display: grid; gap: 16px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 13px; padding: 11px 18px;
  font-size: 13.5px; font-weight: 600; line-height: 1.2;
  background: var(--grad); color: #fff;
  box-shadow: 0 10px 22px rgba(79, 70, 229, 0.26);
  transition: transform 0.16s ease, box-shadow 0.16s ease, opacity 0.16s;
  white-space: nowrap;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 14px 26px rgba(79, 70, 229, 0.3); }
.btn:active { transform: translateY(0) scale(0.99); }
.btn[disabled] { opacity: 0.55; pointer-events: none; }
.btn.ghost {
  background: rgba(255, 255, 255, 0.85); color: var(--indigo);
  border: 1px solid rgba(79, 70, 229, 0.2); box-shadow: var(--shadow-sm);
}
.btn.soft { background: rgba(79, 70, 229, 0.1); color: var(--indigo); box-shadow: none; }
.btn.danger { background: linear-gradient(135deg, #fb7185, #e11d48); box-shadow: 0 10px 22px rgba(225, 29, 72, 0.25); }
.btn.success { background: linear-gradient(135deg, #34d399, #059669); box-shadow: 0 10px 22px rgba(5, 150, 105, 0.25); }
.btn.sm { padding: 8px 13px; font-size: 12.5px; border-radius: 11px; }
.btn.block { width: 100%; }
.btn.icon { padding: 10px; width: 40px; height: 40px; border-radius: 12px; }
.icon-btn {
  border: 1px solid rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.72);
  width: 42px; height: 42px; border-radius: 14px;
  display: inline-flex; align-items: center; justify-content: center;
  box-shadow: var(--shadow-sm); color: var(--ink); flex: 0 0 auto;
  transition: transform 0.15s, background 0.15s;
}
.icon-btn:hover { transform: translateY(-1px); background: #fff; }
.icon-btn svg { width: 20px; height: 20px; }

/* ---------- forms ---------- */
.field { display: grid; gap: 6px; }
.field > label { font-size: 12.5px; font-weight: 600; color: #4b4770; }
.input, .select, .textarea {
  width: 100%; padding: 11px 14px; border-radius: 12px;
  border: 1px solid rgba(99, 95, 130, 0.18);
  background: rgba(255, 255, 255, 0.9);
  font-size: 14px; outline: none; transition: border 0.15s, box-shadow 0.15s;
}
.input:focus, .select:focus, .textarea:focus {
  border-color: rgba(99, 102, 241, 0.65);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.13);
}
.textarea { min-height: 96px; resize: vertical; line-height: 1.55; }
.form-grid { display: grid; gap: 14px; }
.form-row { display: grid; gap: 14px; grid-template-columns: 1fr 1fr; }
.hint { font-size: 11.5px; color: var(--muted); }

/* ---------- chips / badges ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  font-size: 11.5px; font-weight: 600;
  background: rgba(79, 70, 229, 0.1); color: var(--indigo);
  white-space: nowrap;
}
.chip.violet { background: rgba(139, 92, 246, 0.13); color: #6d28d9; }
.chip.emerald { background: rgba(16, 185, 129, 0.14); color: #047857; }
.chip.amber { background: rgba(245, 158, 11, 0.16); color: #b45309; }
.chip.rose { background: rgba(244, 63, 94, 0.13); color: #be123c; }
.chip.sky { background: rgba(56, 189, 248, 0.16); color: #0369a1; }
.chip.slate { background: rgba(99, 95, 130, 0.1); color: #4b4770; }
.badge-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.stat-badge {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  background: var(--grad-warm); color: #fff; font-size: 11px; font-weight: 700;
  display: inline-flex; align-items: center; justify-content: center;
}

/* ---------- avatar ---------- */
.avatar {
  width: 48px; height: 48px; border-radius: 16px; object-fit: cover;
  background: var(--grad); color: #fff; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 17px; letter-spacing: -0.02em; flex: 0 0 auto;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.24);
  overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- toast + modal + sheet ---------- */
#toasts {
  position: fixed; left: 50%; transform: translateX(-50%); bottom: 92px;
  display: grid; gap: 8px; z-index: 3000; width: min(94vw, 420px);
}
.toast {
  background: rgba(31, 27, 58, 0.94); color: #fff; padding: 12px 16px;
  border-radius: 13px; font-size: 13px; font-weight: 500;
  box-shadow: var(--shadow-lg); backdrop-filter: blur(12px);
  animation: toastIn 0.22s ease;
}
.toast.ok { background: linear-gradient(135deg, #10b981, #059669); }
.toast.err { background: linear-gradient(135deg, #f43f5e, #be123c); }
@keyframes toastIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

.modal-back {
  position: fixed; inset: 0; background: rgba(31, 27, 58, 0.42);
  backdrop-filter: blur(6px); z-index: 2000;
  display: flex; align-items: center; justify-content: center; padding: 18px;
  animation: fadeIn 0.18s ease;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.modal {
  background: #fff; border-radius: 22px; width: min(560px, 100%);
  max-height: 90vh; overflow: auto; box-shadow: var(--shadow-lg);
  padding: 22px; animation: popIn 0.2s ease;
}
@keyframes popIn { from { opacity: 0; transform: scale(0.97) translateY(8px); } to { opacity: 1; transform: none; } }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.modal-head h3 { font-size: 17px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; flex-wrap: wrap; }
.sheet-back {
  position: fixed; inset: 0; background: rgba(31, 27, 58, 0.38); backdrop-filter: blur(4px);
  z-index: 2100; display: flex; align-items: flex-end; justify-content: center;
  animation: fadeIn 0.16s ease;
}
.sheet {
  background: #fff; width: min(520px, 100%); border-radius: 24px 24px 0 0;
  padding: 12px 18px calc(20px + env(safe-area-inset-bottom));
  box-shadow: var(--shadow-lg); animation: slideUp 0.24s cubic-bezier(0.22, 1, 0.36, 1);
  max-height: 88vh; overflow: auto;
}
@keyframes slideUp { from { transform: translateY(100%); } to { transform: none; } }
.sheet-grip { width: 42px; height: 4px; border-radius: 999px; background: rgba(99, 95, 130, 0.22); margin: 2px auto 14px; }
.sheet-title { font-size: 16px; font-weight: 700; margin-bottom: 14px; }
.sheet-item {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 13px 12px; border-radius: 14px; border: 0; background: transparent;
  font-size: 14px; font-weight: 500; color: var(--ink);
}
.sheet-item:hover { background: rgba(79, 70, 229, 0.07); }
.sheet-item svg { width: 19px; height: 19px; color: var(--indigo); flex: 0 0 auto; }
.sheet-item.danger { color: #be123c; }
.sheet-item.danger svg { color: #be123c; }
.sheet-divider { height: 1px; background: var(--line); margin: 8px 0; }

/* ---------- empty / loading ---------- */
.empty {
  text-align: center; padding: 30px 16px; color: var(--muted); font-size: 13px;
  border: 1px dashed rgba(99, 95, 130, 0.25); border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.45);
}
.skeleton {
  border-radius: 14px; height: 74px;
  background: linear-gradient(90deg, rgba(255,255,255,.55), rgba(255,255,255,.9), rgba(255,255,255,.55));
  background-size: 220% 100%; animation: shimmer 1.2s infinite linear;
}
@keyframes shimmer { from { background-position: 120% 0; } to { background-position: -60% 0; } }

/* ---------- scrollbar ---------- */
::-webkit-scrollbar { width: 9px; height: 9px; }
::-webkit-scrollbar-thumb { background: rgba(99, 95, 130, 0.24); border-radius: 999px; }
::-webkit-scrollbar-track { background: transparent; }
