/* ==========================================================================
   EliteCraft Client Vault — Design System
   Palette: deep charcoal + antique gold + soft paper white
   Display: Fraunces  |  Body: Inter  |  Utility: JetBrains Mono
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,400;9..144,500;9..144,600&family=Inter:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

:root {
  /* Color */
  --ink: #0c0c0e;
  --charcoal: #17171b;
  --charcoal-2: #1f1f24;
  --charcoal-3: #29292f;
  --line: rgba(255, 255, 255, 0.08);
  --line-strong: rgba(255, 255, 255, 0.14);
  --gold: #c6a15b;
  --gold-bright: #e3c077;
  --gold-dim: rgba(198, 161, 91, 0.14);
  --paper: #f3f1ec;
  --paper-dim: rgba(243, 241, 236, 0.62);
  --ash: #8c8b92;
  --ash-dim: #5c5c63;
  --green: #7fae7c;
  --green-dim: rgba(127, 174, 124, 0.14);
  --amber: #d3a24c;
  --amber-dim: rgba(211, 162, 76, 0.14);
  --red: #c1665f;
  --red-dim: rgba(193, 102, 95, 0.14);

  /* Type */
  --f-display: 'Fraunces', serif;
  --f-body: 'Inter', -apple-system, sans-serif;
  --f-mono: 'JetBrains Mono', monospace;

  /* Layout */
  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow-card: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -16px rgba(0, 0, 0, 0.5);
  --shadow-pop: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }
html { -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--f-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 500;
  letter-spacing: -0.01em;
  margin: 0;
  color: var(--paper);
}

a { color: inherit; text-decoration: none; }

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

::selection { background: var(--gold-dim); color: var(--gold-bright); }

/* Focus visibility */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 2px;
  border-radius: 6px;
}

/* ---------- Vault Mark (signature element) ----------
   Hexagonal seal used as the brand mark. Outline + hollow center = locked.
   Solid fill + shimmer sweep = unlocked. Reused across admin + client view. */
.vault-mark {
  --size: 34px;
  width: var(--size);
  height: var(--size);
  position: relative;
  flex-shrink: 0;
}
.vault-mark svg { width: 100%; height: 100%; display: block; }
.vault-mark .vm-hex {
  fill: none;
  stroke: var(--gold);
  stroke-width: 1.4;
  transition: fill 0.6s var(--ease), stroke 0.6s var(--ease);
}
.vault-mark .vm-diamond {
  fill: var(--gold);
  transition: opacity 0.4s var(--ease);
}
.vault-mark.locked .vm-diamond { opacity: 0.35; }
.vault-mark.unlocked .vm-hex { fill: var(--gold-dim); stroke: var(--gold-bright); }
.vault-mark.unlocked .vm-diamond { opacity: 1; }
.vault-mark.shimmer .vm-hex { animation: vm-shimmer 1.4s var(--ease); }
@keyframes vm-shimmer {
  0% { filter: drop-shadow(0 0 0 rgba(230, 195, 120, 0)); }
  40% { filter: drop-shadow(0 0 10px rgba(230, 195, 120, 0.75)); }
  100% { filter: drop-shadow(0 0 0 rgba(230, 195, 120, 0)); }
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-word {
  font-family: var(--f-display);
  font-size: 17px;
  letter-spacing: 0.01em;
}
.brand-word b { color: var(--gold); font-weight: 500; }
.brand-sub {
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ash);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: var(--f-body);
  font-weight: 600;
  font-size: 14px;
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.15s var(--ease), background 0.2s var(--ease), border-color 0.2s var(--ease), opacity 0.2s;
  white-space: nowrap;
}
.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn svg { width: 16px; height: 16px; }

.btn-gold {
  background: linear-gradient(180deg, var(--gold-bright), var(--gold));
  color: #17140c;
}
.btn-gold:hover { filter: brightness(1.06); }

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--paper);
}
.btn-ghost:hover { background: var(--charcoal-2); }

.btn-subtle {
  background: var(--charcoal-2);
  color: var(--paper-dim);
  border-color: var(--line);
}
.btn-subtle:hover { color: var(--paper); background: var(--charcoal-3); }

.btn-danger {
  background: var(--red-dim);
  color: #e3a9a4;
  border-color: rgba(193, 102, 95, 0.3);
}

.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 10px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--charcoal-2); border: 1px solid var(--line); color: var(--paper-dim);
  cursor: pointer; transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--charcoal-3); color: var(--paper); }
.icon-btn svg { width: 17px; height: 17px; }

/* ---------- Cards & Surfaces ---------- */
.card {
  background: var(--charcoal);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-card);
}
.card-pad { padding: 22px; }

.surface-inset {
  background: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
}

/* ---------- Forms ---------- */
.field { margin-bottom: 18px; }
.field label {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ash);
  margin-bottom: 7px;
  text-transform: uppercase;
  font-size: 11px;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  background: var(--ink);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  color: var(--paper);
  font-family: var(--f-body);
  font-size: 14.5px;
  transition: border-color 0.2s var(--ease), background 0.2s;
}
.field input::placeholder, .field textarea::placeholder { color: var(--ash-dim); }
.field input:focus, .field textarea:focus, .field select:focus {
  outline: none;
  border-color: var(--gold);
  background: #0f0f11;
}
.field textarea { resize: vertical; min-height: 90px; font-family: var(--f-body); }
.field-hint { font-size: 12px; color: var(--ash-dim); margin-top: 6px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

.input-prefix { position: relative; }
.input-prefix span {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  color: var(--ash); font-family: var(--f-mono); font-size: 13px; pointer-events: none;
}
.input-prefix input { padding-left: 46px; }

/* ---------- File dropzone ---------- */
.dropzone {
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  padding: 26px 18px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
  background: var(--ink);
}
.dropzone:hover, .dropzone.drag-over { border-color: var(--gold); background: var(--gold-dim); }
.dropzone svg { width: 26px; height: 26px; color: var(--gold); margin-bottom: 10px; }
.dropzone-title { font-size: 13.5px; font-weight: 600; color: var(--paper); }
.dropzone-sub { font-size: 12px; color: var(--ash); margin-top: 4px; }
.dropzone input[type="file"] { display: none; }
.file-chip {
  display: flex; align-items: center; gap: 10px;
  background: var(--charcoal-2); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 10px; font-size: 13px;
}
.file-chip svg { width: 15px; height: 15px; color: var(--gold); flex-shrink: 0; }
.file-chip .fc-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-chip .fc-remove { cursor: pointer; color: var(--ash); }

/* ---------- Status badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--f-mono);
  font-size: 10.5px; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 5px 10px; border-radius: 999px; font-weight: 500;
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge-pending { background: var(--amber-dim); color: var(--amber); }
.badge-confirmed { background: var(--green-dim); color: var(--green); }
.badge-delivered { background: var(--gold-dim); color: var(--gold-bright); }

/* ---------- Top bar (admin) ---------- */
.topbar {
  height: 66px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(12, 12, 14, 0.85);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 40;
}
.topbar-right { display: flex; align-items: center; gap: 14px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--charcoal-2); border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center;
  font-family: var(--f-mono); font-size: 12px; color: var(--gold);
}

/* ---------- App shell / bottom nav (mobile-first) ---------- */
.app-shell { max-width: 1180px; margin: 0 auto; padding: 22px 18px 96px; }
.page-head { margin-bottom: 22px; }
.page-eyebrow {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--gold); margin-bottom: 6px;
}
.page-title { font-size: 26px; }
.page-sub { color: var(--ash); font-size: 13.5px; margin-top: 6px; }

.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; justify-content: space-around;
  background: rgba(17, 17, 20, 0.92);
  backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding: 10px 6px calc(10px + env(safe-area-inset-bottom));
  z-index: 40;
}
.bottom-nav a {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  font-size: 10.5px; color: var(--ash); padding: 4px 14px; border-radius: 10px;
  transition: color 0.2s;
}
.bottom-nav a svg { width: 20px; height: 20px; }
.bottom-nav a.active { color: var(--gold); }

/* ---------- Overview stat cards ---------- */
.stat-grid {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 26px;
}
@media (max-width: 900px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }
.stat-card { padding: 18px; }
.stat-label {
  font-family: var(--f-mono); font-size: 10.5px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--ash); margin-bottom: 10px;
}
.stat-value { font-family: var(--f-display); font-size: 28px; color: var(--paper); }
.stat-value.gold { color: var(--gold-bright); }

/* ---------- Project cards ---------- */
.project-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
@media (max-width: 980px) { .project-grid { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 640px) { .project-grid { grid-template-columns: 1fr; } }

.project-card { overflow: hidden; transition: transform 0.25s var(--ease), border-color 0.25s; }
.project-card:hover { transform: translateY(-3px); border-color: var(--line-strong); }
.pc-thumb {
  height: 150px; background: linear-gradient(135deg, var(--charcoal-2), var(--charcoal-3));
  position: relative; overflow: hidden;
}
.pc-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pc-thumb .pc-placeholder {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; color: var(--ash-dim);
}
.pc-thumb .pc-placeholder svg { width: 30px; height: 30px; }
.pc-body { padding: 16px; }
.pc-title { font-size: 15.5px; font-weight: 600; margin-bottom: 3px; }
.pc-client { font-size: 12.5px; color: var(--ash); margin-bottom: 12px; }
.pc-meta { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pc-amount { font-family: var(--f-mono); font-size: 13px; color: var(--gold-bright); }
.pc-actions { display: flex; gap: 8px; }
.pc-actions .btn { flex: 1; }

/* ---------- Toast ---------- */
.toast-stack {
  position: fixed; top: 18px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 100; width: min(360px, 90vw);
}
.toast {
  background: var(--charcoal-3); border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm); padding: 12px 14px;
  display: flex; align-items: center; gap: 10px;
  font-size: 13.5px; box-shadow: var(--shadow-pop);
  animation: toast-in 0.35s var(--ease);
}
.toast svg { width: 16px; height: 16px; flex-shrink: 0; }
.toast.success { border-left: 3px solid var(--green); }
.toast.success svg { color: var(--green); }
.toast.error { border-left: 3px solid var(--red); }
.toast.error svg { color: var(--red); }
.toast.info { border-left: 3px solid var(--gold); }
.toast.info svg { color: var(--gold); }
.toast.leaving { animation: toast-out 0.25s var(--ease) forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px); } to { opacity: 1; transform: translateY(0); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(-8px); } }

/* ---------- Empty / loading states ---------- */
.empty-state { text-align: center; padding: 56px 20px; color: var(--ash); }
.empty-state svg { width: 34px; height: 34px; color: var(--ash-dim); margin-bottom: 14px; }
.empty-state h3 { font-size: 16px; color: var(--paper); margin-bottom: 6px; }
.empty-state p { font-size: 13px; max-width: 320px; margin: 0 auto; }

.skeleton {
  background: linear-gradient(90deg, var(--charcoal) 25%, var(--charcoal-2) 37%, var(--charcoal) 63%);
  background-size: 400% 100%;
  animation: skeleton-sweep 1.4s ease infinite;
  border-radius: var(--radius-sm);
}
@keyframes skeleton-sweep { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(6, 6, 7, 0.72);
  backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 90; opacity: 0; pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.modal-overlay.open { opacity: 1; pointer-events: all; }
.modal-box {
  background: var(--charcoal); border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg); padding: 26px; width: 100%; max-width: 420px;
  transform: translateY(10px) scale(0.98); transition: transform 0.25s var(--ease);
  box-shadow: var(--shadow-pop);
}
.modal-overlay.open .modal-box { transform: translateY(0) scale(1); }
.modal-title { font-size: 18px; margin-bottom: 8px; }
.modal-text { color: var(--ash); font-size: 13.5px; margin-bottom: 20px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; }

/* ---------- Page transition ---------- */
.page-fade { animation: page-fade-in 0.4s var(--ease); }
@keyframes page-fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ---------- Utility ---------- */
.text-ash { color: var(--ash); }
.text-gold { color: var(--gold-bright); }
.mono { font-family: var(--f-mono); }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-8 { gap: 8px; }
.hr { border: none; border-top: 1px solid var(--line); margin: 18px 0; }
