/* Menthe: the look of this app, laid over the shared base. Soft water greens, a mint to
   turquoise card for what matters most, honey for what waits, everything rounded. The app
   speaks to its owner; it should feel calm, never like a ledger. Light only. */

:root {
  --paper: #eef8f3;
  --sheet: #ffffff;
  --sheet-2: #f1f9f5;
  --ink: #12362c;
  --ink-2: #2b5548;
  --muted: #5b7f73;
  --faint: #8fb0a5;
  --rule: #dcefe6;
  --rule-strong: #c5e2d6;
  --seal: #0c7a66;
  --seal-strong: #09604f;
  --on-seal: #ffffff;
  --seal-soft: #d9efe6;
  --ochre: #946a00;
  --ochre-soft: #fdf2cf;
  --jade: #0c7a66;
  --jade-soft: #d9efe6;
  --bar-rev: #1fb58f;
  --bar-chg: #e0a100;
  --hover: #e6f4ee;
  --alert: #c2413a;
  --alert-soft: #fbe4e2;
  --honey: #e0a100;
  --hero: linear-gradient(145deg, #1fb58f, #0f8f9a);
  --shadow: 0 12px 28px -20px rgba(20, 110, 90, 0.55);
  --sans: ui-rounded, "SF Pro Rounded", "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --radius: 24px;
}

body { font-size: 15.5px; }
h1, h2, h3, h4 { font-weight: 800; letter-spacing: -0.02em; }
.page-head h1 { font-size: clamp(27px, 3.2vw, 36px); }

/* What goes wrong is red, never the green of the brand. */
.neg, .form-error { color: var(--alert); }
.pill.s-en_retard, .badge.late, .toast[data-tone="error"], .due-days.is-late { background: var(--alert); color: #fff; border-color: var(--alert); }
.gauge.is-depasse .gauge-word { color: var(--alert); }
.gauge.is-depasse .meter i { background: var(--alert); }
.btn.danger { color: var(--alert); }
.btn.danger:hover { border-color: var(--alert); color: var(--alert); background: var(--alert-soft); }
.btn.armed { background: var(--alert); border-color: var(--alert); color: #fff; }

/* Header and navigation */
.top { border-bottom: 0; background: color-mix(in srgb, var(--paper) 92%, transparent); }
.brand img { transform: none; border-radius: 11px; }
.brand-name { font-weight: 800; font-size: 20px; }
.nav { gap: 4px; }
.nav a { border-radius: 999px; font-weight: 700; padding: 9px 16px; }
.nav a:hover { background: var(--hover); }
.nav a[aria-current="page"] { background: var(--ink); color: #fff; }
.badge { background: var(--honey); color: #fff; }
.nav a[aria-current="page"] .badge { background: #fff; color: var(--ink); }

/* Controls */
select, input[type="text"], input[type="date"], input[type="search"], textarea { border-radius: 14px; min-height: 42px; padding: 9px 13px; }
.btn { border-radius: 999px; font-weight: 700; min-height: 44px; padding: 9px 20px; }
.btn.small { min-height: 36px; padding: 5px 14px; }
.btn.ghost { background: var(--sheet); border-color: var(--rule-strong); }
.btn.ghost:hover { background: var(--hover); border-color: var(--seal); color: var(--seal-strong); }

/* Cards */
.sheet { border: 0; border-radius: var(--radius); padding: 22px; }
.sheet h2 { font-size: 16.5px; }
.pill { font-weight: 700; }
.pill.s-a_faire { background: var(--ochre-soft); color: var(--ochre); border-color: transparent; }
.pill.s-a_venir { background: var(--sheet-2); border-color: transparent; color: var(--ink-2); }
.pill.s-non_due { background: #e9f1ee; color: var(--muted); }
.figure { font-weight: 800; }
.figure-alert, .notice { border-radius: 14px; }
.tag { font-weight: 700; }

/* Home: a greeting, then the one thing that matters most on a mint card */
.hello { margin-bottom: 18px; }
.hello h1 { font-size: clamp(27px, 3.2vw, 36px); line-height: 1.15; }
.hero { background: var(--hero); color: #fff; border-radius: 28px; padding: 24px; box-shadow: 0 18px 36px -24px rgba(15, 143, 154, 0.9); margin-bottom: 16px; display: grid; gap: 4px; }
.hero-kicker { font-size: 14px; font-weight: 700; opacity: 0.9; display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.hero-figure { font-size: clamp(40px, 6vw, 56px); font-weight: 800; line-height: 1.05; letter-spacing: -0.03em; margin: 6px 0 2px; }
.hero-sub { font-size: 14.5px; opacity: 0.94; max-width: 58ch; }
.hero .pill { background: rgba(255, 255, 255, 0.22); color: #fff; }
.hero .pill.is-late { background: #fff; color: var(--alert); }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.hero .btn { background: #fff; color: var(--seal); border-color: #fff; }
.hero .btn:hover { background: var(--seal-soft); border-color: var(--seal-soft); }
.hero .btn.quiet-link { background: transparent; color: #fff; border-color: rgba(255, 255, 255, 0.55); }
.hero-note { margin-top: 12px; font-size: 13.5px; background: rgba(255, 255, 255, 0.18); border-radius: 14px; padding: 9px 12px; }
.hero-note a { color: #fff; font-weight: 700; }

.todo { margin: 0 0 16px; }
.todo-title { display: none; }
.todo-item { border: 0; border-radius: 999px; background: var(--sheet); box-shadow: 0 8px 18px -14px rgba(20, 110, 90, 0.7); font-weight: 700; padding: 10px 16px; }
.todo-item:hover { background: var(--hover); }
.todo-count { color: var(--honey); font-weight: 800; }
.todo-item.is-zero { background: transparent; box-shadow: none; color: var(--muted); font-weight: 600; }
.todo-item.is-zero .todo-count { color: var(--faint); }

.home-cards { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; align-items: start; }
.home-cards .row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.home-cards .label { font-size: 14px; font-weight: 700; color: var(--muted); }
.home-cards .value { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.softline { color: var(--muted); font-size: 13.5px; margin-top: 10px; }
.softline a { color: var(--seal); font-weight: 700; text-underline-offset: 3px; }

.meter { height: 12px; border-radius: 999px; background: var(--seal-soft); }
.meter i { border-radius: 999px; }
.gauge .meter i, .home-cards .meter i { background: linear-gradient(90deg, #1fb58f, #0f8f9a); }
.gauge.is-proche .meter i { background: var(--honey); }
.gauge-word { font-weight: 800; }
.bars .bar { border-radius: 6px 6px 2px 2px; background: linear-gradient(180deg, #1fb58f, #0f8f9a); }

/* Lists */
.counter { border-radius: 999px; border-color: transparent; background: var(--sheet); box-shadow: 0 8px 18px -14px rgba(20, 110, 90, 0.7); font-weight: 700; }
.counter[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); }
.counter.has .num { color: var(--honey); }
.op-rows { border: 0; border-radius: var(--radius); box-shadow: var(--shadow); }
.op-row { padding: 13px 16px; }
.op-month h2 { font-size: 16px; padding: 0 4px; }
dialog.edit { border: 0; border-radius: 28px; box-shadow: 0 30px 80px -30px rgba(15, 80, 65, 0.6); }
dialog.edit::backdrop, .capture::backdrop { background: rgba(18, 54, 44, 0.32); }
fieldset.segmented span, .segmented .seg { border-radius: 999px; font-weight: 700; }
.period[data-open] { box-shadow: 0 0 0 2px var(--seal), var(--shadow); }
.toast { border-radius: 999px; padding: 11px 20px; font-weight: 700; background: var(--ink); }
.fab { background: var(--ink); box-shadow: 0 14px 28px -14px rgba(18, 54, 44, 0.8); font-weight: 700; }
.fab:hover { background: #0b2a22; }

/* Phone: the sections move to a rounded bar at the bottom, under the thumb */
@media (max-width: 860px) {
  /* No backdrop filter here: it would anchor the fixed bar to the header instead of the screen. */
  .top { padding-bottom: 10px; background: var(--paper); backdrop-filter: none; -webkit-backdrop-filter: none; }
  .nav { position: fixed; left: 12px; right: 12px; bottom: calc(10px + env(safe-area-inset-bottom)); z-index: 25; width: auto; margin: 0; padding: 6px; gap: 2px; background: var(--sheet); border-radius: 999px; box-shadow: 0 14px 30px -16px rgba(18, 54, 44, 0.65); order: 0; }
  .nav a { padding: 11px 4px; border-radius: 999px; font-size: 13px; }
  .nav a[aria-current="page"] { background: var(--ink); color: #fff; box-shadow: none; }
  main { padding-bottom: calc(170px + env(safe-area-inset-bottom)); }
  .fab { bottom: calc(82px + env(safe-area-inset-bottom)); width: 56px; min-height: 56px; padding: 0; justify-content: center; }
  .fab span { display: none; }
  .toast { bottom: calc(150px + env(safe-area-inset-bottom)); }
  body:has(dialog[open]) .nav, body:has(dialog[open]) .fab { display: none; }
}
@media (max-width: 680px) {
  .home-cards { grid-template-columns: minmax(0, 1fr); }
  .hero { padding: 20px; border-radius: 26px; }
  .hero-actions .btn { width: 100%; }
  .todo-list { display: flex; flex-wrap: wrap; gap: 8px; }
  .todo-item { width: auto; min-height: 42px; }
  .todo-count { min-width: 0; font-size: inherit; }
  .todo-list li:has(.is-zero) { display: none; }
  .sheet { padding: 18px; }
}

/* Clients and invoices */
.docs-block { margin-bottom: 26px; }
.clients-block h2 { font-size: 18px; margin: 0 0 12px; padding: 0 4px; }
.client-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 12px; }
.client-card { width: 100%; display: grid; gap: 4px; text-align: left; padding: 16px 18px; border: 0; border-radius: var(--radius); background: var(--sheet); box-shadow: var(--shadow); color: inherit; font: inherit; cursor: pointer; transition: background-color 0.15s ease; }
.client-card:hover { background: var(--hover); }
.client-card .who { font-weight: 800; font-size: 16px; overflow-wrap: anywhere; }
.client-figures { display: flex; flex-wrap: wrap; gap: 4px 14px; margin-top: 6px; font-size: 13.5px; color: var(--muted); }
.client-figures b { color: var(--ink); }
.client-figures .due b { color: var(--ochre); }
.lines-edit { display: grid; gap: 10px; }
.line-row { display: grid; grid-template-columns: minmax(0, 1fr) 90px 130px auto; gap: 8px; align-items: end; }
.line-row .icon-x { min-height: 42px; }
.doc-total { display: flex; align-items: baseline; gap: 10px; justify-content: flex-end; font-size: 15px; }
.doc-total b { font-size: 22px; font-weight: 800; }
.doc-lines { list-style: none; margin: 0; padding: 0; }
.doc-lines li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--rule); }
.pay-list { list-style: none; margin: 8px 0 0; padding: 0; display: grid; gap: 8px; }
.pay-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 14px; background: var(--sheet-2); overflow-wrap: anywhere; }
.edit-form textarea { border-radius: 14px; }
@media (max-width: 680px) {
  .line-row { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .line-row .grow { grid-column: 1 / -1; }
  .line-row .icon-x { grid-column: 1 / -1; justify-self: start; min-height: 32px; }
  .doc-total { justify-content: flex-start; }
  .nav a { font-size: 12px; padding: 11px 2px; }
}

/* URSSAF, Mon argent, Mes justificatifs */
.urssaf-hero .hero-figure, .quick .hero-figure { margin-top: 4px; }
.hero-split { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; max-width: 420px; }
.hero-split li { display: flex; justify-content: space-between; gap: 12px; background: rgba(255, 255, 255, 0.16); border-radius: 12px; padding: 7px 12px; }
.hero .declare { margin-top: 14px; padding: 14px; border: 0; border-radius: 18px; background: rgba(255, 255, 255, 0.96); color: var(--ink); max-width: 520px; }
.hero .declare .btn { background: var(--seal); color: #fff; border-color: var(--seal); }
.steps-card { margin-bottom: 18px; }
.how { margin: 0; padding: 0; list-style: none; counter-reset: step; display: grid; gap: 12px; }
.how li { counter-increment: step; display: grid; grid-template-columns: 34px minmax(0, 1fr); gap: 12px; align-items: start; line-height: 1.5; }
.how li::before { content: counter(step); display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--seal-soft); color: var(--seal); font-weight: 800; }
.periods-block h2 { font-size: 18px; margin: 4px 0 12px; padding: 0 4px; }
.periods-block { margin-bottom: 18px; }
.period-row summary { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 14px; align-items: center; padding: 13px 16px; cursor: pointer; }
.period-row summary::-webkit-details-marker { display: none; }
.period-row summary:hover { background: var(--hover); }
.period-row[open] summary { background: var(--sheet-2); }
.period-detail { padding: 6px 16px 16px; display: grid; gap: 10px; }
.period-detail .period-grid { margin: 4px 0; }
.period-detail .declare { padding: 0; border: 0; margin: 0; }
.quick { margin-bottom: 18px; }
.quick .hero-sub b { font-weight: 800; }
.snap { margin-bottom: 18px; }
.snap .hero-figure { font-size: clamp(30px, 4.4vw, 42px); }
.inbox-item { border: 0; border-radius: 20px; background: var(--sheet-2); }
.inbox-thumb, .thumb { border-radius: 14px; }
.file { border: 0; border-radius: 18px; box-shadow: var(--shadow); }
.missing-list a { border-radius: 14px; }
@media (max-width: 680px) {
  .period-row summary { grid-template-columns: minmax(0, 1fr) auto; }
  .period-row summary .op-kind { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; }
  .how li { grid-template-columns: 28px minmax(0, 1fr); }
  .how li::before { width: 28px; height: 28px; }
}
/* The receipts page has its own big photo button. */
body[data-page="pieces"] .fab { display: none; }
