:root {
  --bg: #f4f8fb;
  --bg-2: #eaf3f8;
  --surface: rgba(255, 255, 255, 0.82);
  --surface-solid: #ffffff;
  --ink: #0f1c24;
  --muted: #5b6b76;
  --line: rgba(15, 28, 36, 0.08);
  --teal: #0f766e;
  --teal-deep: #0b4f4a;
  --sky: #0284c7;
  --warn: #b45309;
  --danger: #be123c;
  --ok: #15803d;
  --shadow: 0 18px 50px rgba(15, 61, 75, 0.12);
  --radius: 22px;
  --font: "Sora", system-ui, sans-serif;
  --display: "Fraunces", Georgia, serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #d9f0f3 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #ffe8d6 0%, transparent 45%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-2) 100%);
  line-height: 1.5;
}
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; }

.bg-glow {
  position: fixed; inset: 0; pointer-events: none; z-index: -1;
  background-image:
    linear-gradient(rgba(15, 28, 36, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 28, 36, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse at center, black 30%, transparent 75%);
}

.topbar {
  position: sticky; top: 0; z-index: 20;
  backdrop-filter: blur(14px);
  background: rgba(244, 248, 251, 0.75);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 0.9rem 1.25rem;
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
}
.brand { display: inline-flex; align-items: center; gap: 0.7rem; font-weight: 700; }
.brand-mark {
  width: 1.1rem; height: 1.1rem; border-radius: 0.35rem;
  background: linear-gradient(135deg, var(--teal), var(--sky));
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}
.brand-text { letter-spacing: -0.02em; }
.topnav { display: flex; align-items: center; gap: 0.85rem; flex-wrap: wrap; }
.topnav a { color: var(--muted); font-weight: 500; }
.topnav a:hover { color: var(--ink); }
.user-chip {
  background: #fff; border: 1px solid var(--line); border-radius: 999px;
  padding: 0.35rem 0.75rem; font-size: 0.85rem; color: var(--muted);
}

.shell { max-width: 1120px; margin: 0 auto; padding: 2rem 1.25rem 4rem; }
.hero {
  display: grid; gap: 0.75rem; margin-bottom: 1.75rem;
  animation: rise 0.7s ease both;
}
.hero h1 {
  margin: 0; font-family: var(--display); font-size: clamp(2rem, 4vw, 3rem);
  letter-spacing: -0.03em; line-height: 1.1;
}
.hero p { margin: 0; color: var(--muted); max-width: 42rem; }

.stats {
  display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.85rem;
  margin-bottom: 1.5rem;
}
.stat {
  background: var(--surface); border: 1px solid var(--line); border-radius: 18px;
  padding: 1rem 1.1rem; box-shadow: var(--shadow);
  animation: rise 0.8s ease both;
}
.stat strong { display: block; font-size: 1.55rem; letter-spacing: -0.03em; }
.stat span { color: var(--muted); font-size: 0.85rem; }

.panel {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 1.25rem; backdrop-filter: blur(10px);
}
.panel + .panel { margin-top: 1rem; }

.toolbar {
  display: flex; justify-content: space-between; gap: 1rem; align-items: center;
  flex-wrap: wrap; margin-bottom: 1rem;
}
.filters { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--line); background: #fff; color: var(--muted);
  border-radius: 999px; padding: 0.4rem 0.8rem; font-size: 0.85rem; font-weight: 500;
}
.chip.is-active { background: var(--teal); border-color: var(--teal); color: #fff; }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 1rem;
}
.project-card {
  position: relative; overflow: hidden; border-radius: 20px; border: 1px solid var(--line);
  background: var(--surface-solid); padding: 1.15rem; min-height: 180px;
  display: flex; flex-direction: column; gap: 0.7rem;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: rise 0.85s ease both;
}
.project-card:hover { transform: translateY(-4px); box-shadow: var(--shadow); }
.project-card::before {
  content: ""; position: absolute; inset: 0 auto auto 0; width: 100%; height: 5px;
  background: var(--accent, var(--teal));
}
.project-card h3 { margin: 0.4rem 0 0; font-size: 1.15rem; letter-spacing: -0.02em; }
.project-card p { margin: 0; color: var(--muted); font-size: 0.92rem; flex: 1; }
.meta { display: flex; gap: 0.45rem; flex-wrap: wrap; align-items: center; }
.badge {
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  border-radius: 999px; padding: 0.28rem 0.55rem; background: #eef6f5; color: var(--teal-deep);
}
.badge.draft { background: #fff4e7; color: var(--warn); }
.badge.archived { background: #f1f3f5; color: #64748b; }
.badge.active { background: #e7f7ee; color: var(--ok); }
.card-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; margin-top: 0.35rem; }

.btn {
  appearance: none; border: 0; cursor: pointer; border-radius: 14px;
  padding: 0.7rem 1.05rem; font-weight: 600; display: inline-flex; align-items: center;
  justify-content: center; gap: 0.4rem; transition: transform 0.15s ease, opacity 0.15s ease;
}
.btn:hover { transform: translateY(-1px); }
.btn:active { transform: translateY(0); }
.btn-primary { background: linear-gradient(135deg, var(--teal), #0e8f85); color: #fff; }
.btn-secondary { background: #fff; border: 1px solid var(--line); color: var(--ink); }
.btn-ghost { background: transparent; color: var(--muted); padding-inline: 0.6rem; }
.btn-danger { background: #fff1f4; color: var(--danger); border: 1px solid #ffd0db; }
.btn-sm { padding: 0.45rem 0.7rem; border-radius: 11px; font-size: 0.85rem; }

.form-grid { display: grid; gap: 0.9rem; }
.form-row { display: grid; gap: 0.35rem; }
.form-row.two { grid-template-columns: 1fr 1fr; gap: 0.9rem; }
label { font-size: 0.85rem; font-weight: 600; color: var(--ink); }
input, textarea, select {
  width: 100%; border: 1px solid var(--line); border-radius: 14px; padding: 0.75rem 0.9rem;
  background: #fff; color: var(--ink); outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: rgba(15, 118, 110, 0.45);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
}
textarea { min-height: 110px; resize: vertical; }
.help { color: var(--muted); font-size: 0.8rem; }
.swatches { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.swatch {
  width: 2rem; height: 2rem; border-radius: 999px; border: 2px solid #fff;
  box-shadow: 0 0 0 1px var(--line); cursor: pointer;
}
.swatch input { display: none; }
.swatch:has(input:checked) { box-shadow: 0 0 0 2px var(--ink); }

.alert {
  border-radius: 14px; padding: 0.85rem 1rem; margin-bottom: 1rem; font-weight: 500;
  animation: rise 0.4s ease both;
}
.alert-error { background: #fff1f4; color: var(--danger); border: 1px solid #ffd0db; }
.alert-ok { background: #e7f7ee; color: var(--ok); border: 1px solid #b9ebcb; }

.empty {
  text-align: center; padding: 2.5rem 1rem; color: var(--muted);
  border: 1px dashed rgba(15, 28, 36, 0.15); border-radius: 18px;
}

/* Login */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 1.5rem; }
.auth-shell {
  width: min(980px, 100%); display: grid; grid-template-columns: 1.05fr 0.95fr;
  overflow: hidden; border-radius: 28px; border: 1px solid var(--line);
  background: rgba(255,255,255,0.7); box-shadow: var(--shadow);
  animation: rise 0.75s ease both;
}
.auth-visual {
  padding: 2.4rem; color: #073b3a;
  background:
    linear-gradient(160deg, rgba(255,255,255,0.2), transparent 40%),
    linear-gradient(145deg, #b8e4df 0%, #d9f0ff 48%, #ffe6d2 100%);
  position: relative; overflow: hidden;
}
.auth-visual h1 {
  font-family: var(--display); font-size: clamp(2.2rem, 4vw, 3.2rem);
  margin: 1.5rem 0 0.6rem; letter-spacing: -0.03em; line-height: 1.05;
}
.auth-visual p { margin: 0; max-width: 22rem; color: rgba(15, 28, 36, 0.72); }
.auth-visual .brand { margin-bottom: 2rem; }
.orb {
  position: absolute; border-radius: 50%; filter: blur(2px); opacity: 0.55;
  animation: float 8s ease-in-out infinite;
}
.orb-a { width: 180px; height: 180px; right: -40px; bottom: -30px; background: #7dd3c7; }
.orb-b { width: 110px; height: 110px; right: 70px; top: 40px; background: #f8c39a; animation-delay: -2s; }
.auth-form { padding: 2.3rem; background: rgba(255,255,255,0.88); }
.auth-form h2 { margin: 0 0 0.35rem; font-size: 1.45rem; letter-spacing: -0.02em; }
.auth-form .lead { margin: 0 0 1.4rem; color: var(--muted); }
.auth-form .btn { width: 100%; margin-top: 0.4rem; }
.secure-list { margin: 1.4rem 0 0; padding: 0; list-style: none; display: grid; gap: 0.45rem; }
.secure-list li {
  display: flex; gap: 0.55rem; align-items: flex-start; color: var(--muted); font-size: 0.88rem;
}
.secure-list li::before {
  content: ""; width: 0.55rem; height: 0.55rem; margin-top: 0.4rem; border-radius: 50%;
  background: var(--teal); flex: 0 0 auto;
}
.honeypot { position: absolute; left: -10000px; opacity: 0; height: 0; width: 0; overflow: hidden; }

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 28, 36, 0.35);
  display: none; align-items: center; justify-content: center; padding: 1rem; z-index: 40;
}
.modal-backdrop.is-open { display: flex; }
.modal {
  width: min(560px, 100%); background: #fff; border-radius: 22px; padding: 1.25rem;
  border: 1px solid var(--line); box-shadow: var(--shadow);
  animation: rise 0.35s ease both;
}
.modal header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.modal h2 { margin: 0; font-size: 1.2rem; }

@keyframes rise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@media (max-width: 860px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-visual { min-height: 220px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .form-row.two { grid-template-columns: 1fr; }
}
