/* Papeloops — corporate design system v2
   Palette: deep corporate indigo #1E2A5A on cool slate #EEF1F7, action
   blue #2F5FE3, success teal #0E8A7B, soft line #DEE4F0, surface white.
   Geometry: 14px radii, layered floating shadows, generous whitespace.
   Motion: one orchestrated page-load rise, hover lifts, focus rings;
   everything honors prefers-reduced-motion. */

:root {
  --bg: #eef1f7;
  --surface: #ffffff;
  --ink: #1c2333;
  --brand: #1e2a5a;
  --action: #2f5fe3;
  --action-hover: #244ec2;
  --teal: #0e8a7b;
  --line: #dee4f0;
  --muted: #5b6478;
  --danger: #c0392b;
  --radius: 14px;
  --shadow-rest: 0 1px 2px rgba(28, 35, 51, 0.06), 0 8px 24px rgba(30, 42, 90, 0.08);
  --shadow-lift: 0 2px 4px rgba(28, 35, 51, 0.08), 0 16px 40px rgba(30, 42, 90, 0.16);
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--sans);
  background:
    radial-gradient(900px 420px at 85% -10%, rgba(47, 95, 227, 0.10), transparent 60%),
    radial-gradient(700px 380px at -10% 25%, rgba(14, 138, 123, 0.07), transparent 55%),
    var(--bg);
  color: var(--ink);
  line-height: 1.55;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ------------------------------- header -------------------------------- */

.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0.85rem 1.5rem;
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em; text-decoration: none; color: var(--brand); }
.brand span { color: var(--action); }
nav { display: flex; gap: 1.1rem; align-items: center; }
nav a { color: var(--ink); text-decoration: none; font-size: 0.95rem; font-weight: 500; position: relative; }
nav a::after {
  content: ""; position: absolute; left: 0; right: 100%; bottom: -4px; height: 2px;
  background: var(--action); transition: right 180ms ease;
}
nav a:hover::after { right: 0; }

main { flex: 1; width: min(960px, 100% - 2.5rem); margin: 0 auto; padding: 2.5rem 0 4rem; }

/* -------------------------- page-load motion ---------------------------- */

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}
.view > * { animation: rise 420ms cubic-bezier(0.22, 0.8, 0.3, 1) both; }
.view > *:nth-child(2) { animation-delay: 60ms; }
.view > *:nth-child(3) { animation-delay: 120ms; }
.view > *:nth-child(4) { animation-delay: 180ms; }
.view > *:nth-child(n + 5) { animation-delay: 240ms; }

/* -------------------------------- hero ---------------------------------- */

.hero { position: relative; padding: 3rem 0 1.5rem; }
.eyebrow {
  display: inline-block; font-size: 0.75rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.12em; color: var(--teal);
  background: rgba(14, 138, 123, 0.09); border-radius: 999px;
  padding: 0.3rem 0.85rem; margin: 0 0 1rem;
}
h1 { font-size: clamp(2.3rem, 6vw, 3.7rem); line-height: 1.06; letter-spacing: -0.03em; margin: 0 0 1rem; font-weight: 800; color: var(--brand); }
.lede { max-width: 34rem; font-size: 1.1rem; color: var(--muted); }
.cta-row { display: flex; gap: 0.85rem; margin-top: 1.75rem; flex-wrap: wrap; }

.stamp {
  position: absolute; top: 1rem; right: 0;
  font-family: var(--mono); font-weight: 700; font-size: 0.95rem;
  color: var(--teal); border: 2.5px solid var(--teal); border-radius: 10px;
  padding: 0.35rem 0.8rem; transform: rotate(-7deg);
  letter-spacing: 0.1em; user-select: none;
  background: var(--surface); box-shadow: var(--shadow-rest);
  animation: stampIn 500ms cubic-bezier(0.34, 1.56, 0.64, 1) 350ms both;
}
@keyframes stampIn {
  from { opacity: 0; transform: rotate(-7deg) scale(1.6); }
  to { opacity: 1; transform: rotate(-7deg) scale(1); }
}
@media (max-width: 640px) { .stamp { display: none; } }

h2 { letter-spacing: -0.02em; color: var(--brand); }
h3 { color: var(--brand); }

/* ------------------------------- buttons -------------------------------- */

.btn {
  display: inline-block; padding: 0.65rem 1.25rem; border: 1px solid var(--line);
  border-radius: 12px; background: var(--surface); color: var(--ink);
  font: inherit; font-weight: 600; text-decoration: none; cursor: pointer;
  box-shadow: var(--shadow-rest);
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lift); }
.btn:active { transform: translateY(0); box-shadow: var(--shadow-rest); }
.btn.primary { background: var(--action); border-color: var(--action); color: #fff; }
.btn.primary:hover { background: var(--action-hover); }
.btn.quiet { box-shadow: none; border-color: transparent; background: transparent; color: var(--action); }
.btn:focus-visible { outline: 3px solid rgba(47, 95, 227, 0.45); outline-offset: 2px; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: wait; transform: none; }
.btn.danger { color: var(--danger); border-color: rgba(192, 57, 43, 0.35); }

/* ----------------------------- cards & grid ----------------------------- */

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 1.1rem; margin-top: 2rem; }
.tool-card {
  position: relative; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.25rem 1.25rem 1.1rem;
  text-decoration: none; color: var(--ink);
  box-shadow: var(--shadow-rest);
  transition: transform 180ms cubic-bezier(0.22, 0.8, 0.3, 1), box-shadow 180ms ease, border-color 180ms ease;
}
.tool-card:hover { transform: translateY(-5px); box-shadow: var(--shadow-lift); border-color: rgba(47, 95, 227, 0.4); }
.tool-card h3 { margin: 0.15rem 0 0.35rem; font-size: 1.05rem; }
.tool-card p { margin: 0; font-size: 0.9rem; color: var(--muted); }
.tool-card .tag {
  font-size: 0.68rem; font-weight: 700; color: var(--action);
  text-transform: uppercase; letter-spacing: 0.1em;
  background: rgba(47, 95, 227, 0.08); border-radius: 999px; padding: 0.15rem 0.6rem;
}

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.75rem; margin-top: 1.25rem; box-shadow: var(--shadow-rest);
}
.card.narrow { max-width: 27rem; margin: 3rem auto; }

/* -------------------------------- forms --------------------------------- */

.field { margin-bottom: 1.1rem; }
.field label { display: block; font-weight: 600; font-size: 0.9rem; margin-bottom: 0.35rem; color: var(--brand); }
.field input, .field select, .field textarea {
  width: 100%; padding: 0.65rem 0.85rem; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; background: #fbfcfe; color: var(--ink);
  transition: border-color 140ms ease, box-shadow 140ms ease;
}
.field input:focus-visible, .field select:focus-visible, .field textarea:focus-visible {
  outline: none; border-color: var(--action); box-shadow: 0 0 0 3px rgba(47, 95, 227, 0.18);
}
.field small { color: var(--muted); }

.error { color: var(--danger); font-weight: 600; }
.success { color: var(--teal); font-weight: 600; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.pill {
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase;
  border: 1px solid var(--teal); color: var(--teal); border-radius: 999px;
  padding: 0.12rem 0.6rem; letter-spacing: 0.08em;
}
.swap { font-size: 0.9rem; }
.swap a, .foot a { color: var(--action); }
.back { font-size: 0.88rem; font-weight: 600; color: var(--action); text-decoration: none; }

/* ------------------------------ dashboard ------------------------------- */

.jobs { list-style: none; padding: 0; margin: 0 0 1.5rem; }
.jobs li {
  font-family: var(--mono); font-size: 0.84rem;
  display: flex; justify-content: space-between; gap: 1rem;
  background: var(--surface); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.6rem 0.9rem; margin-bottom: 0.5rem; box-shadow: var(--shadow-rest);
}

.profile-head { display: flex; align-items: center; gap: 1rem; }
.avatar {
  width: 72px; height: 72px; border-radius: 50%; object-fit: cover;
  border: 2px solid var(--surface); box-shadow: var(--shadow-rest); background: var(--line);
}
.avatar.placeholder {
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 1.6rem; color: var(--brand);
}

.qr-wrap { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: flex-start; margin: 1rem 0; }
.qr-wrap svg { border: 1px solid var(--line); border-radius: 10px; background: #fff; box-shadow: var(--shadow-rest); }
.secret-code {
  font-family: var(--mono); font-size: 0.9rem; letter-spacing: 0.06em;
  background: #fbfcfe; border: 1px dashed var(--line); border-radius: 8px;
  padding: 0.5rem 0.75rem; word-break: break-all; max-width: 22rem;
}

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1.25rem; }
@media (max-width: 640px) { .grid-2 { grid-template-columns: 1fr; } }

.foot { border-top: 1px solid var(--line); padding: 1.1rem 1.5rem; font-size: 0.85rem; color: var(--muted); background: rgba(255,255,255,0.6); }

button#logout-btn { background: none; border: none; font: inherit; cursor: pointer; color: var(--action); font-weight: 500; }
button#logout-btn:hover { text-decoration: underline; }

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