/* ============================================================
   Vaultboard — Claymorphism design system
   Palette: #E7ECF6 (bg), #EFF3FA (clay surface), #6C63FF (primary),
            #33354A (ink), #8B90A8 (muted), #4ECDC4 (mint/success),
            #F5A623 (amber/warning), #FF6B6B (coral/danger)
   Type: 'Outfit' (display, rounded/friendly) + 'Inter' (body/data)
   ============================================================ */

:root {
  --bg: #E7ECF6;
  --clay: #EFF3FA;
  --clay-deep: #E3E8F3;
  --ink: #33354A;
  --muted: #8B90A8;
  --primary: #6C63FF;
  --primary-deep: #574FDB;
  --mint: #2FBFAE;
  --mint-bg: #DFF7F3;
  --amber: #E8960C;
  --amber-bg: #FCEFD7;
  --coral: #EF5B5B;
  --coral-bg: #FCE3E3;

  --shadow-out: 9px 9px 18px rgba(163, 177, 198, 0.55), -9px -9px 18px rgba(255, 255, 255, 0.85);
  --shadow-out-sm: 5px 5px 10px rgba(163, 177, 198, 0.5), -5px -5px 10px rgba(255, 255, 255, 0.8);
  --shadow-in: inset 5px 5px 10px rgba(163, 177, 198, 0.45), inset -5px -5px 10px rgba(255, 255, 255, 0.75);
  --shadow-in-deep: inset 6px 6px 12px rgba(151, 164, 185, 0.55), inset -6px -6px 12px rgba(255, 255, 255, 0.7);

  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .display {
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  letter-spacing: -0.01em;
}

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

/* ---- Clay primitives ---- */
.clay {
  background: var(--clay);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-out);
  border: none;
}

.clay-sm {
  background: var(--clay);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-out-sm);
}

.clay-pressed {
  background: var(--clay);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-in);
}

.clay-input, select.clay-input, textarea.clay-input {
  width: 100%;
  padding: 13px 16px;
  border: none;
  border-radius: var(--radius-sm);
  background: var(--clay);
  box-shadow: var(--shadow-in);
  font-family: 'Inter', sans-serif;
  font-size: 0.94rem;
  color: var(--ink);
  outline: none;
  transition: box-shadow 0.15s ease;
  appearance: none;
}
.clay-input:focus {
  box-shadow: var(--shadow-in-deep), 0 0 0 3px rgba(108, 99, 255, 0.25);
}
textarea.clay-input { resize: vertical; min-height: 80px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 7px;
}
.field .errorlist { list-style: none; padding: 0; margin: 6px 0 0; color: var(--coral); font-size: 0.8rem; }

/* ---- Buttons ---- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 22px;
  border-radius: var(--radius-sm);
  border: none;
  font-family: 'Outfit', sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  background: var(--clay);
  box-shadow: var(--shadow-out-sm);
  color: var(--ink);
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { box-shadow: var(--shadow-in); transform: translateY(0); }

.btn-primary {
  background: linear-gradient(145deg, var(--primary), var(--primary-deep));
  color: #fff;
  box-shadow: 6px 6px 14px rgba(87, 79, 219, 0.4), -4px -4px 10px rgba(255, 255, 255, 0.5);
}
.btn-primary:hover { box-shadow: 8px 8px 18px rgba(87, 79, 219, 0.45); }

.btn-danger { color: var(--coral); }
.btn-sm { padding: 8px 16px; font-size: 0.82rem; border-radius: 12px; }
.btn-icon { padding: 10px; border-radius: 14px; }

/* ---- Layout ---- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 250px;
  flex-shrink: 0;
  padding: 26px 18px;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 10px 18px; }
.brand-mark {
  width: 40px; height: 40px; border-radius: 14px;
  background: linear-gradient(145deg, var(--primary), var(--primary-deep));
  box-shadow: var(--shadow-out-sm);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.1rem;
}
.brand-name { font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.05rem; }
.brand-sub { font-size: 0.68rem; color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 16px; border-radius: var(--radius-sm);
  font-weight: 500; font-size: 0.92rem; color: var(--muted);
}
.nav-item svg { width: 19px; height: 19px; flex-shrink: 0; }
.nav-item.active {
  background: var(--clay);
  box-shadow: var(--shadow-out-sm);
  color: var(--primary-deep);
  font-weight: 600;
}
.nav-item:not(.active):hover { color: var(--ink); }

.nav-badge {
  background: var(--coral); color: #fff; font-size: 0.7rem; font-weight: 700;
  min-width: 18px; height: 18px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center; padding: 0 5px;
}

.main {
  flex: 1;
  padding: 30px 34px 60px;
  min-width: 0;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 26px; gap: 16px; flex-wrap: wrap;
}
.page-title { font-size: 1.5rem; margin: 0; }
.page-sub { color: var(--muted); font-size: 0.88rem; margin-top: 4px; }

/* ---- Mobile topbar (hidden on desktop) ---- */
.mobile-topbar { display: none; }

/* ---- Cards / stats ---- */
.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: repeat(2, 1fr); }

.stat-card { padding: 22px; }
.stat-icon {
  width: 42px; height: 42px; border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  margin-bottom: 14px;
}
.stat-value { font-family: 'Outfit', sans-serif; font-size: 1.7rem; font-weight: 700; line-height: 1; }
.stat-label { color: var(--muted); font-size: 0.82rem; margin-top: 6px; }

.card { padding: 22px; margin-bottom: 20px; }
.card-title { font-size: 1.05rem; margin: 0 0 16px; }

/* ---- Table-like list rows ---- */
.row-list { display: flex; flex-direction: column; gap: 12px; }
.row-item {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  padding: 16px 18px; border-radius: var(--radius-sm);
  background: var(--clay);
  box-shadow: var(--shadow-out-sm);
  flex-wrap: wrap;
}
.row-item:hover { box-shadow: var(--shadow-out); }
.row-main { min-width: 0; color: inherit; text-decoration: none; display: block; }
.row-title { font-weight: 600; font-size: 0.95rem; }
.row-sub { color: var(--muted); font-size: 0.8rem; margin-top: 3px; }
.row-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.row-controls { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; flex-shrink: 0; }

/* ---- Badges ---- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 12px; border-radius: 20px;
  font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-active { background: var(--mint-bg); color: #1F8A7C; }
.badge-inactive { background: #E9EAF0; color: var(--muted); }
.badge-in_development { background: #E4E1FF; color: var(--primary-deep); }
.badge-discussing { background: var(--amber-bg); color: #A8690A; }
.badge-rejected { background: var(--coral-bg); color: #C23D3D; }
.badge-on_hold { background: #E9EAF0; color: var(--muted); }

/* ---- Progress bar ---- */
.progress-track {
  height: 10px; border-radius: 6px; background: var(--clay);
  box-shadow: var(--shadow-in); overflow: hidden; margin-top: 8px;
}
.progress-fill {
  height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--mint), #4ECDC4);
}

/* ---- Password field w/ reveal ---- */
.pw-field { position: relative; display: flex; align-items: center; }
.pw-field .clay-input { padding-right: 44px; font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; }
.pw-toggle {
  position: absolute; right: 6px; background: none; border: none; cursor: pointer;
  color: var(--muted); padding: 8px; border-radius: 10px;
}
.pw-toggle:hover { color: var(--primary); }

.copy-btn { background: none; border: none; cursor: pointer; color: var(--muted); padding: 6px; border-radius: 8px; }
.copy-btn:hover { color: var(--primary); background: var(--clay-deep); }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; }
.form-grid .field-full { grid-column: 1 / -1; }

/* ---- Login page ---- */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.login-card { width: 100%; max-width: 380px; padding: 38px 32px; text-align: center; }
.login-mark {
  width: 62px; height: 62px; border-radius: 20px; margin: 0 auto 18px;
  background: linear-gradient(145deg, var(--primary), var(--primary-deep));
  box-shadow: var(--shadow-out);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-family: 'Outfit', sans-serif; font-weight: 700; font-size: 1.5rem;
}
.login-card h1 { font-size: 1.3rem; margin: 0 0 6px; }
.login-card p.sub { color: var(--muted); font-size: 0.85rem; margin: 0 0 26px; }
.login-card form { text-align: left; }
.login-card .btn-primary { width: 100%; justify-content: center; margin-top: 8px; }

/* ---- Messages ---- */
.messages { list-style: none; padding: 0; margin: 0 0 20px; display: flex; flex-direction: column; gap: 10px; }
.messages li {
  padding: 13px 18px; border-radius: var(--radius-sm);
  background: var(--mint-bg); color: #1F8A7C; font-size: 0.88rem; font-weight: 500;
  box-shadow: var(--shadow-out-sm);
}
.messages li.error { background: var(--coral-bg); color: #C23D3D; }

.empty-state {
  text-align: center; padding: 50px 20px; color: var(--muted);
}
.empty-state svg { width: 48px; height: 48px; margin-bottom: 14px; opacity: 0.5; }

.text-danger { color: var(--coral); }
.text-mint { color: #1F8A7C; }
.text-amber { color: var(--amber); }
.text-muted { color: var(--muted); }

.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 20px; }
.filters .clay-input { width: auto; min-width: 150px; }
.filters .search-input { flex: 1; min-width: 220px; }

.pagination { display: flex; gap: 8px; justify-content: center; margin-top: 26px; }

.mono { font-family: 'JetBrains Mono', monospace; font-size: 0.85rem; }

/* ============ Mobile ============ */
@media (max-width: 900px) {
  .app-shell { flex-direction: column; }
  .sidebar {
    display: none;
  }
  .sidebar.open { display: flex; position: fixed; inset: 0; z-index: 40; width: 100%; height: 100%; background: var(--bg); overflow-y: auto; }
  .sidebar.open #sidebarClose { display: inline-flex !important; }
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    padding: 16px 18px; position: sticky; top: 0; z-index: 30;
    background: var(--bg);
  }
  .mobile-topbar .brand { padding: 0; text-align: left; }
  .mobile-topbar .brand-sub { display: block; font-size: 0.62rem; }
  .main { padding: 16px 16px 90px; }
  .grid-4, .grid-3, .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: stretch; }
  .topbar .row-actions { width: 100%; flex-wrap: wrap; }
  .topbar .btn { flex: 1 1 140px; justify-content: center; }
  .row-item { flex-direction: column; align-items: flex-start; }
  .row-actions { width: 100%; justify-content: flex-end; flex-wrap: wrap; }
  .filters { flex-direction: column; align-items: stretch; }
  .filters .clay-input, .filters .search-input { width: 100%; min-width: 0; }
  .filters .btn { width: 100%; justify-content: center; }
  .pw-field { width: 100% !important; }
}

@media (max-width: 560px) {
  .stat-card { padding: 18px; }
}
