:root {
  --bg: #f4f2ec;
  --surface: #ffffff;
  --ink: #17150f;
  --ink-soft: #5b564c;
  --line: #e4e0d6;
  --accent: #2f2a6b;
  --radius: 18px;
  --shadow: 0 1px 2px rgba(23, 21, 15, .04), 0 12px 32px -18px rgba(23, 21, 15, .35);
  --font-display: "Bricolage Grotesque", system-ui, sans-serif;
  --font-body: "Instrument Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

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

/* Header ------------------------------------------------------------------ */
.site-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.4rem clamp(1rem, 4vw, 3rem);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: .6rem; font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; font-size: 1.05rem; }
.brand-dot { width: 12px; height: 12px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 18%, transparent); }
.brand-sep { color: var(--ink-soft); }

.site-main { flex: 1; width: 100%; max-width: 1120px; margin: 0 auto; padding: clamp(1.5rem, 5vw, 4rem) clamp(1rem, 4vw, 3rem); }
.site-footer { padding: 1.5rem clamp(1rem, 4vw, 3rem); color: var(--ink-soft); font-size: .85rem; border-top: 1px solid var(--line); }

/* Dashboard --------------------------------------------------------------- */
.dash-hero { max-width: 620px; margin-bottom: clamp(2rem, 6vw, 4rem); }
.eyebrow { text-transform: uppercase; letter-spacing: .18em; font-size: .72rem; font-weight: 600; color: var(--accent); margin: 0 0 1rem; }
.dash-hero h1 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.03em; line-height: 1.02; font-size: clamp(2.4rem, 6vw, 4rem); margin: 0 0 1.2rem; }
.lede { font-size: 1.1rem; color: var(--ink-soft); margin: 0; max-width: 46ch; }

.tool-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1.2rem; }
.tool-card {
  position: relative;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 1.6rem 1.6rem 1.4rem;
  box-shadow: var(--shadow);
  transition: transform .25s cubic-bezier(.2,.7,.3,1), box-shadow .25s, border-color .25s;
  overflow: hidden;
}
.tool-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 5px; background: var(--accent); transform: scaleY(0); transform-origin: bottom; transition: transform .3s cubic-bezier(.2,.7,.3,1); }
.tool-card:hover { transform: translateY(-4px); box-shadow: 0 24px 48px -24px rgba(23,21,15,.45); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); }
.tool-card:hover::before { transform: scaleY(1); }
.tool-icon { display: inline-flex; align-items: center; justify-content: center; width: 46px; height: 46px; border-radius: 13px; background: color-mix(in srgb, var(--accent) 12%, transparent); color: var(--accent); margin-bottom: 1.1rem; }
.tool-icon svg { width: 22px; height: 22px; }
.tool-label { font-family: var(--font-display); font-weight: 700; font-size: 1.3rem; margin: 0 0 .5rem; letter-spacing: -.01em; }
.tool-desc { color: var(--ink-soft); font-size: .95rem; margin: 0 0 1.4rem; flex: 1; }
.tool-open { display: inline-flex; align-items: center; gap: .4rem; font-weight: 600; color: var(--accent); font-size: .95rem; }
.tool-open svg { width: 16px; height: 16px; transition: transform .25s; }
.tool-card:hover .tool-open svg { transform: translateX(4px); }
.tool-card--ghost { background: transparent; border-style: dashed; box-shadow: none; color: var(--ink-soft); }
.tool-card--ghost .tool-icon { background: transparent; border: 1px dashed var(--line); color: var(--ink-soft); }
.tool-card--ghost:hover { transform: none; box-shadow: none; }
.tool-card--ghost::before { display: none; }

/* header right + logout */
.header-right { display: flex; align-items: center; gap: 1rem; }
.logout-link { display: inline-flex; align-items: center; gap: .4rem; font-size: .9rem; font-weight: 600; color: var(--ink-soft); padding: .4rem .8rem; border-radius: 999px; border: 1px solid var(--line); transition: color .2s, border-color .2s, background .2s; }
.logout-link:hover { color: var(--ink); border-color: var(--ink-soft); }
.logout-link svg { width: 15px; height: 15px; }

/* compact dashboard head */
.dash-head { margin-bottom: 2rem; }
.dash-head h1 { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; font-size: clamp(1.8rem, 4vw, 2.4rem); margin: 0 0 .3rem; }
.dash-sub { color: var(--ink-soft); margin: 0; font-size: 1rem; }

/* breadcrumb */
.breadcrumb { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; font-size: .88rem; color: var(--ink-soft); margin-bottom: 1.6rem; }
.breadcrumb a { color: var(--ink-soft); transition: color .2s; }
.breadcrumb a:hover { color: var(--accent); }
.breadcrumb .sep { color: var(--line); }
.breadcrumb .current { color: var(--ink); font-weight: 600; }

/* shared button + message (used by auth pages that don't load fiches.css) */
.btn-primary { font: inherit; font-weight: 700; font-size: 1rem; display: inline-flex; align-items: center; justify-content: center; gap: .5rem; padding: .8rem 1.1rem; border: none; border-radius: 12px; cursor: pointer; color: #fff; background: var(--accent); transition: transform .15s, opacity .2s, box-shadow .2s; box-shadow: 0 12px 24px -14px var(--accent); }
.btn-primary:hover { transform: translateY(-2px); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; transform: none; }
.form-message { font-size: .92rem; min-height: 1em; }
.form-message.is-error { color: #d1495b; font-weight: 600; }

/* auth pages */
.page-auth .site-main { display: flex; align-items: center; justify-content: center; min-height: 60vh; }
.auth-card { background: var(--surface); border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 2.4rem; width: 100%; max-width: 380px; text-align: center; }
.auth-brand { font-family: var(--font-display); font-weight: 700; letter-spacing: -.02em; font-size: 1.4rem; margin: 0 0 .3rem; }
.auth-sub { color: var(--ink-soft); margin: 0 0 1.4rem; }
.auth-hint { color: var(--ink-soft); font-size: .85rem; margin: -.6rem 0 1.4rem; }
.auth-form { display: flex; flex-direction: column; gap: .8rem; }
.auth-form input { font: inherit; padding: .8rem .9rem; border-radius: 12px; border: 1.5px solid var(--line); background: #fff; transition: border-color .2s, box-shadow .2s; }
.auth-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent); }
