/* ============================================================
   COMPONENTS — Minimalist
   ============================================================ */

/* ---------- BUTTONS ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  height: 40px;
  padding: 0 18px;
  border-radius: var(--r-sm);
  font-weight: 600;
  font-size: 13px;
  transition: background var(--dur-sm) var(--ease), border var(--dur-sm) var(--ease),
              color var(--dur-sm) var(--ease), transform var(--dur-sm) var(--ease);
  user-select: none;
  position: relative;
  overflow: hidden;
  white-space: nowrap;
}
.btn:active { transform: translateY(0.5px); }
.btn .spin { display: none; }
.btn.loading .spin { display: inline-block; }
.btn.loading .label { opacity: 0; }
.btn[disabled], .btn.disabled { opacity: 0.5; pointer-events: none; }

.btn-primary {
  background: var(--navy-800);
  color: #fff;
}
.btn-primary:hover { background: var(--navy-700); }

.btn-gold {
  background: var(--gold-500);
  color: var(--navy-900);
}
.btn-gold:hover { background: var(--gold-400); }

.btn-ghost {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}
.btn-ghost:hover { border-color: var(--muted-2); background: var(--bg-soft); }

.btn-soft {
  background: var(--bg-soft);
  color: var(--navy-800);
}
.btn-soft:hover { background: var(--cream-300); }

.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: #dc2626; }

.btn-sm { height: 34px; padding: 0 14px; font-size: 12.5px; }
.btn-lg { height: 46px; padding: 0 24px; font-size: 14px; }
.btn-block { width: 100%; }

/* ripple (kept but subtler) */
.ripple {
  position: absolute;
  border-radius: 50%;
  transform: scale(0);
  background: rgba(255, 255, 255, 0.35);
  animation: ripple var(--dur-lg) var(--ease-out);
  pointer-events: none;
}
.btn-gold .ripple, .btn-ghost .ripple, .btn-soft .ripple { background: rgba(0, 31, 69, 0.1); }

/* ---------- CARDS ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 22px;
  transition: border-color var(--dur-sm) var(--ease);
}
.card.interactive { cursor: pointer; }
.card.interactive:hover { border-color: var(--muted-2); }

.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.card-title { font-weight: 600; font-size: 14px; color: var(--ink); }
.card-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ---------- FEATURE CARD (minimalist, no gradient top) ---------- */
.card-feature {
  padding: 22px;
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  transition: border var(--dur-sm) var(--ease);
  display: block;
}
.card-feature:hover { border-color: var(--navy-800); }
.card-feature .cf-ic {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--bg-soft);
  color: var(--navy-800);
  display: grid;
  place-items: center;
  font-size: 18px;
  margin-bottom: 14px;
  transition: background var(--dur-sm) var(--ease), color var(--dur-sm) var(--ease);
}
.card-feature:hover .cf-ic { background: var(--navy-800); color: var(--gold-400); }
.card-feature .cf-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; color: var(--ink); }
.card-feature .cf-desc { font-size: 12.5px; color: var(--muted); line-height: 1.6; min-height: 38px; }
.card-feature .cf-cta {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy-700);
  transition: gap var(--dur-sm) var(--ease);
}
.card-feature:hover .cf-cta { gap: 9px; color: var(--navy-800); }

/* legacy gradient classes kept as no-op (safe) — actual feature cards now plain */
.cf-grad-1, .cf-grad-2, .cf-grad-3, .cf-grad-4, .cf-grad-5, .cf-grad-6 { background: var(--bg-soft); }

/* ---------- INPUTS ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--ink-2);
  display: flex;
  align-items: center;
  gap: 6px;
}
.field-label .optional { color: var(--muted-2); font-weight: 400; font-size: 11px; }
.field-hint { font-size: 11.5px; color: var(--muted); margin-top: 2px; }
.field-error { font-size: 11.5px; color: var(--danger); margin-top: 2px; }

.input, .textarea, .select {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  font-size: 13.5px;
  color: var(--ink);
  transition: border var(--dur-sm) var(--ease);
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--navy-700);
}
.input::placeholder, .textarea::placeholder { color: var(--muted-2); }
.textarea { resize: vertical; line-height: 1.7; min-height: 90px; }

.input-group { position: relative; }
.input-group .input { padding-inline-start: 38px; }
.input-group .ig-ic {
  position: absolute;
  inset-inline-start: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted-2);
  pointer-events: none;
  font-size: 13px;
}
.input-group .ig-action {
  position: absolute;
  inset-inline-end: 8px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  padding: 6px;
  border-radius: 6px;
  transition: background var(--dur-sm) var(--ease), color var(--dur-sm) var(--ease);
}
.input-group .ig-action:hover { background: var(--bg-soft); color: var(--navy-700); }

/* ---------- CHIPS ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  padding: 6px 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  cursor: pointer;
  transition: border var(--dur-sm) var(--ease), background var(--dur-sm) var(--ease), color var(--dur-sm) var(--ease);
  user-select: none;
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.chip:hover { border-color: var(--muted-2); }
.chip.on {
  background: var(--navy-800);
  color: #fff;
  border-color: var(--navy-800);
}
.chip.gold.on {
  background: var(--gold-500);
  color: var(--navy-900);
  border-color: var(--gold-500);
}

/* ---------- TILES ---------- */
.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 8px;
}
.tile {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: var(--r-sm);
  padding: 14px 12px;
  cursor: pointer;
  transition: border var(--dur-sm) var(--ease), background var(--dur-sm) var(--ease);
  position: relative;
}
.tile:hover { border-color: var(--muted-2); }
.tile.on {
  border-color: var(--navy-800);
  background: var(--bg-soft);
}
.tile .tile-ic { font-size: 20px; margin-bottom: 6px; }
.tile .tile-title { font-size: 12.5px; font-weight: 600; color: var(--ink); margin-bottom: 2px; }
.tile .tile-desc { font-size: 11px; color: var(--muted); line-height: 1.45; }
.tile.on::before {
  content: '✓';
  position: absolute;
  top: 8px;
  inset-inline-start: 8px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--navy-800);
  color: var(--gold-400);
  font-size: 10px;
  font-weight: 700;
  display: grid; place-items: center;
}

/* ---------- UPLOAD ---------- */
.upload {
  border: 1px dashed var(--line);
  background: var(--bg-soft);
  border-radius: var(--r-sm);
  padding: 28px 18px;
  text-align: center;
  cursor: pointer;
  transition: border var(--dur-sm) var(--ease), background var(--dur-sm) var(--ease);
  position: relative;
}
.upload:hover { border-color: var(--navy-700); background: var(--cream-200); }
.upload.drag { border-color: var(--gold-500); background: rgba(255, 195, 0, 0.05); }
.upload .up-ic { font-size: 22px; margin-bottom: 6px; color: var(--muted); }
.upload .up-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.upload .up-desc { font-size: 11.5px; color: var(--muted); margin-top: 3px; }

.preview {
  position: relative;
  border-radius: var(--r-sm);
  overflow: hidden;
  margin-top: 10px;
  width: fit-content;
  border: 1px solid var(--line);
}
.preview img { width: 180px; height: 120px; object-fit: cover; display: block; }
.preview .clear {
  position: absolute;
  top: 6px;
  inset-inline-start: 6px;
  width: 24px; height: 24px;
  background: rgba(10, 22, 40, 0.75);
  color: #fff;
  border-radius: 50%;
  display: grid; place-items: center;
  transition: background var(--dur-sm) var(--ease);
  font-size: 14px;
  line-height: 1;
}
.preview .clear:hover { background: var(--danger); }

/* ---------- OUTPUT BOX — now ink on cream, not navy glow ---------- */
.output {
  margin-top: 16px;
  border-radius: var(--r-lg);
  background: var(--navy-900);
  color: #e6edf8;
  padding: 18px;
  animation: pageIn var(--dur-md) var(--ease-out);
}
.output-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.output-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--gold-400);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  display: flex; align-items: center; gap: 7px;
}
.output-label::before {
  content: '';
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--gold-500);
}
.output-actions { display: flex; gap: 4px; }
.output-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
  font-size: 11px;
  font-weight: 500;
  transition: background var(--dur-sm) var(--ease);
}
.output-btn:hover { background: rgba(255, 195, 0, 0.15); color: var(--gold-400); }
.output-body {
  font-size: 13px;
  line-height: 1.85;
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 80px;
}

/* ---------- LOADER ---------- */
.loader {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 28px;
  text-align: center;
}
.spin {
  width: 32px; height: 32px;
  border: 2px solid var(--line);
  border-top-color: var(--navy-700);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-soft) 0%, var(--line-2) 50%, var(--bg-soft) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--r-xs);
}
.skeleton-line { height: 10px; }
.skeleton-block { height: 120px; }

/* ---------- TABS (seg) ---------- */
.seg {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.seg button {
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--muted);
  transition: background var(--dur-sm) var(--ease), color var(--dur-sm) var(--ease);
}
.seg button.on {
  background: var(--surface);
  color: var(--ink);
  font-weight: 600;
}

/* ---------- BADGES — flatter, no gradient ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.badge-gold { background: rgba(255, 195, 0, 0.12); color: #a97d00; }
.badge-navy { background: rgba(0, 31, 69, 0.06); color: var(--navy-800); }
.badge-green { background: var(--success-soft); color: #065f46; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-purple { background: #ede9fe; color: #6d28d9; }
.badge-rose { background: #ffe4e6; color: #9f1239; }

/* ---------- CALLOUT ---------- */
.callout {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  background: var(--cream-200);
  border: 1px solid var(--line);
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.65;
}
.callout .c-ic { flex-shrink: 0; color: var(--gold-600); }
.callout-info {
  background: #f0f6ff;
  border-color: #d4e5ff;
  color: #1e40af;
}
.callout-info .c-ic { color: var(--info); }

/* ---------- TOAST ---------- */
#toast-root {
  position: fixed;
  top: 76px;
  inset-inline-start: 50%;
  transform: translateX(-50%);
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  min-width: 240px;
  max-width: 360px;
  padding: 11px 14px;
  border-radius: var(--r-sm);
  background: var(--navy-900);
  color: #fff;
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 12.5px;
  animation: toastIn var(--dur-md) var(--ease-out);
}
.toast.out { animation: toastOut var(--dur-md) var(--ease-in) forwards; }
.toast-ic {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  font-size: 11px;
  font-weight: 700;
}
.toast-success .toast-ic { background: var(--success); color: #fff; }
.toast-error .toast-ic { background: var(--danger); color: #fff; }
.toast-info .toast-ic { background: var(--info); color: #fff; }
.toast-gold .toast-ic { background: var(--gold-500); color: var(--navy-900); }

/* ---------- MODAL ---------- */
.modal-bg {
  position: fixed;
  inset: 0;
  background: rgba(0, 17, 41, 0.45);
  backdrop-filter: blur(3px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 80;
  padding: 20px;
  animation: modalBg var(--dur-md) var(--ease-out);
}
.modal-bg.show { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--r-lg);
  padding: 24px;
  max-width: 440px;
  width: 100%;
  box-shadow: var(--shadow-xl);
  animation: modalIn var(--dur-md) var(--ease-out);
  border: 1px solid var(--line);
}
.modal-head { margin-bottom: 4px; }
.modal-title { font-size: 16px; font-weight: 600; }
.modal-desc { font-size: 13px; color: var(--muted); margin-top: 3px; margin-bottom: 16px; line-height: 1.6; }
.modal-actions { display: flex; gap: 8px; margin-top: 20px; }
.modal-actions .btn { flex: 1; }

/* ---------- STATS — flat ---------- */
.stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  position: relative;
  transition: border var(--dur-sm) var(--ease);
}
.stat:hover { border-color: var(--muted-2); }
.stat .s-label { font-size: 11.5px; color: var(--muted); font-weight: 500; }
.stat .s-value { font-size: 22px; font-weight: 700; color: var(--ink); letter-spacing: -0.02em; line-height: 1.2; margin-top: 4px; }
.stat .s-delta { font-size: 11px; margin-top: 3px; color: var(--success); font-weight: 600; }
.stat .s-delta.down { color: var(--danger); }
.stat .s-ic {
  position: absolute;
  top: 14px;
  inset-inline-start: 14px;
  width: 30px; height: 30px;
  border-radius: 8px;
  display: grid; place-items: center;
  font-size: 14px;
  background: var(--bg-soft);
  color: var(--navy-800);
}

/* ---------- AVATAR — square, flat ---------- */
.av {
  width: 34px; height: 34px;
  border-radius: 8px;
  background: var(--navy-800);
  color: var(--gold-400);
  display: grid; place-items: center;
  font-weight: 600;
  font-size: 12px;
  flex-shrink: 0;
}
.av-lg { width: 68px; height: 68px; font-size: 22px; border-radius: 14px; }
.av-xl { width: 92px; height: 92px; font-size: 30px; border-radius: 16px; }

/* ---------- DIVIDER ---------- */
.hr { height: 1px; background: var(--line); margin: 16px 0; border: 0; }

/* ---------- LIST ---------- */
.list { display: flex; flex-direction: column; gap: 6px; }
.list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--surface);
  transition: border var(--dur-sm) var(--ease);
}
.list-item:hover { border-color: var(--muted-2); }
.list-item .li-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.list-item .li-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }

/* ---------- DROPDOWN ---------- */
.dropdown { position: relative; }
.dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  inset-inline-end: 0;
  min-width: 200px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 4px;
  box-shadow: var(--shadow-md);
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: all var(--dur-sm) var(--ease);
  z-index: 30;
}
.dropdown.open .dropdown-menu { opacity: 1; pointer-events: auto; transform: translateY(0); }
.dropdown-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 12.5px;
  color: var(--ink);
  cursor: pointer;
  transition: background var(--dur-sm) var(--ease);
}
.dropdown-item:hover { background: var(--bg-soft); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-soft); }
.dropdown-item svg { width: 14px; height: 14px; }
.dropdown-sep { height: 1px; background: var(--line); margin: 4px 2px; }

/* ---------- PROGRESS ---------- */
.progress {
  height: 6px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  background: var(--navy-800);
  border-radius: 999px;
  transition: width var(--dur-lg) var(--ease-out);
}
