/* ══════════════════════════════════════════════════════
   PICFACTORY — Design System v3
   Glass Light — DM Serif Display + DM Sans
   ══════════════════════════════════════════════════════ */

@import url("https://fonts.googleapis.com/css2?family=DM+Serif+Display:ital@1&family=DM+Sans:wght@300;400;500;600&display=swap");

/* ── Tokens ──────────────────────────────────────────── */
:root {
  /* Texte */
  --ink:       rgba(20,40,60,0.9);
  --ink-2:     rgba(30,50,70,0.45);
  --muted:     rgba(30,50,70,0.35);

  /* Sémantique */
  --accent:    #D4700A;
  --profit:    #2E7D52;
  --warning:   #D4700A;
  --loss:      #C03030;

  /* Legacy aliases (utilisés par les classes générées en JS) */
  --blue:      #D4700A;
  --green:     #2E7D52;
  --orange:    #D4700A;
  --red:       #C03030;
  --soft:      rgba(255,255,255,0.4);
  --shadow:    0 6px 20px rgba(213,112,10,0.35);
  --shadow-soft: 0 4px 16px rgba(100,130,160,0.15);
  --radius:    14px;

  /* Layout */
  --tab-h:         64px;
  --topbar-h:      60px;
  --content-max:   430px;

  /* Border-radius sémantique */
  --btn-radius-action:      14px;
  --btn-radius-destructive:  8px;

  font-family: "DM Sans", -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.4;
}

/* ── Reset ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  height: 100%;
  overflow: hidden;
}

/* Fond dégradé fixé — couvre tout l'écran en permanence */
body {
  height: 100%;
  margin: 0;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;
  background: linear-gradient(160deg, #C9D6E3 0%, #B8CADB 40%, #A8BDD0 100%);
  background-attachment: fixed;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: linear-gradient(160deg, #C9D6E3 0%, #B8CADB 40%, #A8BDD0 100%);
  z-index: -1;
}

h1, h2, h3, p {
  margin: 0;
}

h1, h2, h3 {
  font-family: "DM Serif Display", serif;
  font-style: italic;
  font-weight: 400;
  line-height: 1;
}

h1 { font-size: clamp(1.8rem, 7vw, 2.2rem); }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.1rem; }

strong {
  letter-spacing: 0;
}

button, input, select, textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all 0.2s ease;
}

button:focus {
  outline: none;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 2px solid rgba(213,112,10,0.5);
  outline-offset: 2px;
}

img {
  display: block;
}

/* ════════════════════════════════════════════════════════
   AUTH
   ════════════════════════════════════════════════════════ */

.auth-screen {
  display: grid;
  min-height: 100svh;
  place-items: center;
  padding: 24px 16px;
}

.auth-card {
  display: grid;
  width: min(100%, 380px);
  gap: 20px;
  padding: 32px 24px;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 14px;
}

.auth-card .brand-mark {
  width: 44px;
  height: 44px;
  flex-basis: 44px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  object-fit: contain;
}

.auth-copy {
  color: var(--ink-2);
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.55;
}

.auth-message {
  min-height: 1.4em;
  color: var(--warning);
  font-size: 0.82rem;
  font-weight: 500;
}

/* ════════════════════════════════════════════════════════
   SHELL — structure principale
   ════════════════════════════════════════════════════════ */

.app-shell {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: rgba(255,255,255,0.45);
  backdrop-filter: blur(30px);
  -webkit-backdrop-filter: blur(30px);
  border: 1px solid rgba(255,255,255,0.7);
  box-shadow: 0 20px 60px rgba(100,130,160,0.25),
              inset 0 1px 0 rgba(255,255,255,0.8);
}

main {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: none;
}

/* ════════════════════════════════════════════════════════
   TOPBAR
   ════════════════════════════════════════════════════════ */

.topbar {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  height: var(--topbar-h);
  padding: 0 18px;
  padding-top: env(safe-area-inset-top);
  background: rgba(255,255,255,0.3);
  border-bottom: 1px solid rgba(255,255,255,0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.brand-mark {
  width: 30px;
  height: 30px;
  flex: 0 0 30px;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  object-fit: contain;
}

.eyebrow {
  margin: 0 0 2px;
  color: rgba(30,50,70,0.4);
  font-family: "DM Sans", sans-serif;
  font-style: normal;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  line-height: 1;
}

.brand-lockup h1 {
  font-size: 1.3rem;
  color: var(--ink);
}

/* Bouton "Nouveau client" masqué (non utilisé en V1) */
#openClientDialog { display: none !important; }

/* ════════════════════════════════════════════════════════
   VIEW TABS  (En cours / Terminés)
   ════════════════════════════════════════════════════════ */

.view-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 0;
  margin: 0;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.2);
}

.view-tab {
  position: relative;
  min-height: 40px;
  padding: 0 16px;
  background: transparent;
  color: rgba(30,50,70,0.35);
  font-family: "DM Sans", sans-serif;
  font-style: normal;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: color 0.2s ease;
}

.view-tab::after {
  content: "";
  display: block;
  position: absolute;
  bottom: -1px;
  left: 0;
  width: 0;
  height: 2px;
  background: linear-gradient(135deg, #F59332, #D4700A);
  border-radius: 99px;
  transition: width 0.2s ease;
}

.view-tab.is-active {
  color: var(--ink);
  background: transparent;
}

.view-tab.is-active::after {
  width: 100%;
}

/* ════════════════════════════════════════════════════════
   MODULE TABS — tab bar fixe en bas (5 onglets)
   ════════════════════════════════════════════════════════ */

.module-tabs {
  position: relative;
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
  gap: 0;
  padding: 8px 0;
  padding-bottom: env(safe-area-inset-bottom, 16px);
  background: rgba(255,255,255,0.3);
  border-top: 1px solid rgba(255,255,255,0.5);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

.module-tab {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: var(--tab-h);
  padding: 0 2px;
  background: transparent;
  color: rgba(30,50,70,0.25);
  font-family: "DM Sans", sans-serif;
  font-size: 7px;
  font-weight: 500;
  gap: 3px;
  transition: color 0.2s ease;
}

.module-tab.is-active {
  color: rgba(20,40,60,0.85);
}

/* ════════════════════════════════════════════════════════
   SECTIONS — base commune
   ════════════════════════════════════════════════════════ */

.project-strip,
.timer-panel,
.summary-panel,
.history-panel,
.expenses-panel,
.analysis-panel {
  display: grid;
  gap: 0;
  padding: 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

/* En-tête de section standardisé */
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.5);
}

.section-head h2 {
  font-size: 1.2rem;
}

.section-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

/* Total en haut à droite des sections */
.total-stack {
  display: grid;
  justify-items: end;
  gap: 2px;
}

.total-stack strong {
  font-family: "DM Sans", sans-serif;
  font-style: normal;
  font-size: 1.6rem;
  font-weight: 300;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.5px;
  line-height: 1;
  color: var(--ink);
}

.total-stack span,
.total-stack em {
  color: var(--muted);
  font-size: 8px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════
   PROJECT STRIP & CLIENT GROUPS
   ════════════════════════════════════════════════════════ */

.project-list {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
}

.client-project-group {
  display: grid;
  gap: 0;
  border-bottom: 1px solid rgba(255,255,255,0.4);
}

/* En-tête client */
.client-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 18px;
  background: rgba(255,255,255,0.25);
  border-bottom: 1px solid rgba(255,255,255,0.4);
}

.client-group-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-family: "DM Sans", sans-serif;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.client-group-head span {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 500;
}

/* Carrousel horizontal de projets */
.client-project-row {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 12px 18px;
  scroll-padding-inline: 18px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
}

.client-project-row::-webkit-scrollbar {
  display: none;
}

/* Carte projet */
.project-card {
  display: grid;
  width: min(72vw, 260px);
  min-width: min(72vw, 260px);
  gap: 10px;
  padding: 14px;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 14px;
  text-align: left;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  transition: all 0.2s ease;
}

.project-card.is-active {
  background: rgba(255,255,255,0.80);
  border-color: rgba(213,112,10,0.35);
  box-shadow: 0 4px 16px rgba(213,112,10,0.15);
}

.project-card.quota-loss {
  border-color: rgba(192,48,48,0.3);
}

.project-card.quota-loss .project-card-time,
.project-card.quota-loss .project-card-top em {
  color: var(--loss);
}

.project-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.project-card-top strong {
  overflow-wrap: anywhere;
  font-family: "DM Sans", sans-serif;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.3;
  color: var(--ink);
}

.project-card-top em {
  min-width: max-content;
  color: var(--muted);
  font-size: 8px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.project-card-time {
  color: var(--ink-2);
  font-size: 0.78rem;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}

/* Barre de progression */
.project-mini-meter,
.project-mini-meter span {
  display: block;
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
}

.project-mini-meter {
  background: rgba(30,50,70,0.08);
}

.project-mini-meter span {
  width: var(--fill);
  background: linear-gradient(90deg, #4CAF80, #2E7D52);
  transition: width 300ms ease;
}

.project-mini-meter span.quota-warning,
.meter-fill.quota-warning { background: linear-gradient(90deg, #F59332, #D4700A); }

.project-mini-meter span.quota-loss,
.meter-fill.quota-loss    { background: linear-gradient(90deg, #E05555, #C03030); }

.project-mini-meter span.quota-profit,
.meter-fill.quota-profit  { background: linear-gradient(90deg, #4CAF80, #2E7D52); }

.project-mini-meter span.quota-neutral,
.meter-fill.quota-neutral { background: rgba(30,50,70,0.15); }

/* ════════════════════════════════════════════════════════
   HERO PANEL — projet actif
   ════════════════════════════════════════════════════════ */

.hero-panel {
  display: grid;
  min-height: 160px;
  align-content: space-between;
  gap: 14px;
  overflow: hidden;
  margin: 12px 12px 0;
  padding: 16px;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 14px;
}

.project-meta {
  min-width: 0;
}

.project-meta .eyebrow {
  margin-bottom: 4px;
}

.project-meta h2 {
  overflow-wrap: anywhere;
  font-size: clamp(2rem, 11vw, 3.2rem);
  line-height: 0.95;
  color: var(--ink);
}

.hero-content {
  display: grid;
  gap: 10px;
}

/* Grilles de métriques */
.hero-metrics,
.business-summary,
.analysis-grid,
.score-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.hero-metrics span,
.business-summary div,
.analysis-card,
.trend-block,
.score-item {
  display: grid;
  gap: 4px;
  min-width: 0;
  padding: 10px 12px;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 10px;
}

/* Labels de métriques */
.hero-metrics em,
.business-summary span,
.business-summary em,
.analysis-card span,
.analysis-card em,
.trend-block span,
.analysis-row em,
.score-item span,
.total-stack span,
.total-stack em {
  color: var(--muted);
  font-size: 8px;
  font-style: normal;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* Valeurs de métriques */
.hero-metrics strong,
.business-summary strong,
.analysis-card strong,
.score-item strong {
  overflow-wrap: anywhere;
  font-family: "DM Sans", sans-serif;
  font-style: normal;
  font-size: 1.2rem;
  font-weight: 300;
  letter-spacing: -0.3px;
  line-height: 1;
  color: var(--ink);
}

/* ════════════════════════════════════════════════════════
   STATUS — pill & balance line
   ════════════════════════════════════════════════════════ */

.status-pill {
  width: fit-content;
  min-width: max-content;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(30,50,70,0.08);
  border: 1px solid rgba(30,50,70,0.12);
  color: var(--ink-2);
  font-family: "DM Sans", sans-serif;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.status-pill.profit  {
  color: #2E7D52;
  background: rgba(46,125,82,0.12);
  border-color: rgba(46,125,82,0.25);
}
.status-pill.warning {
  color: #D4700A;
  background: rgba(213,112,10,0.12);
  border-color: rgba(213,112,10,0.25);
}
.status-pill.loss    {
  color: #C03030;
  background: rgba(192,48,48,0.1);
  border-color: rgba(192,48,48,0.2);
}
.status-pill.neutral {
  color: var(--muted);
  background: rgba(30,50,70,0.06);
  border-color: rgba(30,50,70,0.1);
}

.balance-line {
  min-height: 20px;
  padding: 0 18px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 500;
}

.balance-line.profit  { color: #2E7D52; }
.balance-line.warning { color: #D4700A; }
.balance-line.loss    { color: #C03030; }

.business-summary .profit strong,
.business-summary .profit em,
.analysis-row.profit em  { color: #2E7D52; }

.business-summary .warning strong,
.business-summary .warning em,
.analysis-row.warning em { color: #D4700A; }

.business-summary .loss strong,
.business-summary .loss em,
.analysis-row.loss em    { color: #C03030; }

.business-summary .neutral strong,
.business-summary .neutral em { color: var(--muted); }

/* ════════════════════════════════════════════════════════
   TIMER PANEL
   ════════════════════════════════════════════════════════ */

.timer-panel {
  display: grid;
  gap: 0;
  padding: 0;
  background: transparent;
}

/* Face du chronomètre */
.timer-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 160px;
  margin: 12px;
  padding: 18px 14px;
  text-align: center;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 14px;
  transition: all 0.2s ease;
}

.timer-panel.is-running .timer-face,
.timer-panel.is-imputed .timer-face {
  background: rgba(245,147,50,0.08);
  border-color: rgba(213,112,10,0.3);
}

/* Label catégorie active — au-dessus du chiffre */
.timer-face span {
  order: -1;
  font-size: 9px;
  font-weight: 600;
  color: #D4700A;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

/* Grand chiffre hh:mm:ss */
.timer-face strong {
  font-family: "DM Sans", sans-serif;
  font-style: normal;
  font-size: 52px;
  font-weight: 200;
  font-variant-numeric: tabular-nums;
  letter-spacing: -2px;
  line-height: 1;
  color: var(--ink);
  transition: color 0.2s ease;
}

.timer-panel.is-running .timer-face strong {
  color: #D4700A;
}

/* ════════════════════════════════════════════════════════
   CHIPS CATÉGORIES — sélecteur horizontal scrollable
   ════════════════════════════════════════════════════════ */

.category-grid {
  display: flex;
  overflow-x: auto;
  scrollbar-width: none;
  touch-action: pan-x;
  -webkit-overflow-scrolling: touch;
  gap: 7px;
  padding: 4px 18px;
  background: transparent;
}

.category-grid::-webkit-scrollbar {
  display: none;
}

/* Chip catégorie inactive */
.category-button {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  padding: 9px 14px;
  border-radius: 99px;
  background: rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.6);
  color: rgba(30,50,70,0.45);
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.category-button .dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--category-color, rgba(30,50,70,0.3));
  flex: 0 0 7px;
}

.category-button strong {
  color: inherit;
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  font-weight: 500;
}

/* Quota masqué dans le chip */
.category-button span:last-child {
  display: none;
}

/* Chip sélectionnée — accent orange */
.category-button.is-selected {
  padding: 9px 16px;
  background: linear-gradient(135deg, #F59332, #D4700A);
  border-color: rgba(213,112,10,0.3);
  box-shadow: 0 4px 16px rgba(213,112,10,0.35);
  color: #fff;
  font-weight: 600;
}

.category-button.is-selected .dot {
  background: rgba(255,255,255,0.8);
}

.category-button.is-selected strong {
  color: #fff;
  font-weight: 600;
}

/* ════════════════════════════════════════════════════════
   BOUTONS PRINCIPAUX
   ════════════════════════════════════════════════════════ */

.primary-actions {
  display: flex;
  gap: 8px;
  padding: 12px;
  background: transparent;
}

/* Bouton action principale */
.start-button,
.save-button {
  flex: 1;
  min-height: 52px;
  border-radius: var(--btn-radius-action);
  background: linear-gradient(135deg, #F59332, #D4700A);
  color: #fff;
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  box-shadow: 0 6px 20px rgba(213,112,10,0.35);
  border: none;
  transition: all 0.2s ease;
}

/* Bouton Démarrer — plus grand, friction zéro */
.start-button {
  min-height: 60px;
  font-size: 15px;
}

.start-button.is-running {
  background: linear-gradient(135deg, #F59332, #D4700A);
  color: #fff;
}

.timer-panel.is-imputed .start-button {
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.75);
  color: var(--ink-2);
  box-shadow: none;
}

/* Feedback tactile */
.start-button:active,
.save-button:active,
.manual-button:active,
.icon-button:active,
.project-card:active,
.category-button:active {
  opacity: 0.82;
  transform: scale(0.97);
}

/* Bouton ajout manuel de temps — secondaire glass */
.manual-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 52px;
  padding: 0 16px;
  border-radius: var(--btn-radius-action);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.75);
  color: rgba(30,50,70,0.45);
  font-family: "DM Sans", sans-serif;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.02em;
  line-height: 1.2;
  transition: all 0.2s ease;
}

.manual-button svg {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.manual-button span {
  max-width: 80px;
}

/* Bouton icône (header) */
.icon-button {
  display: grid;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  place-items: center;
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: var(--btn-radius-action);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  transition: all 0.2s ease;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.icon-button.secondary {
  background: linear-gradient(135deg, #F59332, #D4700A);
  color: #ffffff;
  border-color: transparent;
  box-shadow: 0 4px 12px rgba(213,112,10,0.3);
}

.icon-button.ghost {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

/* Bouton texte */
.text-button {
  min-height: 36px;
  padding: 0 4px;
  background: transparent;
  color: #D4700A;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.text-button.danger {
  color: var(--loss);
}

/* Déconnexion */
.sign-out-button {
  font-family: "DM Sans", sans-serif;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  color: var(--muted);
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════
   SUMMARY — bilan des temps
   ════════════════════════════════════════════════════════ */

.category-summary,
.session-list,
.expense-list,
.analysis-list {
  display: grid;
  gap: 0;
}

.summary-item {
  display: grid;
  gap: 8px;
  padding: 12px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.4);
}

.summary-item:last-child {
  border-bottom: 0;
}

.summary-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.84rem;
  font-weight: 500;
}

.summary-label span:last-child {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
}

/* Barre de quota */
.meter {
  height: 3px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(30,50,70,0.08);
}

.meter-fill {
  width: var(--fill);
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, #4CAF80, #2E7D52);
  transition: width 260ms ease;
}

/* ════════════════════════════════════════════════════════
   SESSIONS — historique
   ════════════════════════════════════════════════════════ */

.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-height: 50px;
  padding: 11px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.4);
}

.session-row:last-child {
  border-bottom: 0;
}

.session-category {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 2px 10px;
  min-width: 0;
  font-weight: 500;
}

/* Trait vertical coloré à gauche */
.session-category::before {
  width: 3px;
  height: 24px;
  border-radius: 99px;
  background: currentColor;
  content: "";
  grid-row: span 2;
  opacity: 0.5;
}

.session-category span,
.session-category em {
  grid-column: 2;
}

.session-category span {
  font-size: 0.84rem;
  font-weight: 500;
}

.session-category em {
  color: var(--muted);
  font-size: 0.7rem;
  font-style: normal;
  font-weight: 400;
}

.session-time {
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  font-size: 0.84rem;
  white-space: nowrap;
}

/* ════════════════════════════════════════════════════════
   EMPTY STATE
   ════════════════════════════════════════════════════════ */

.empty-state {
  display: grid;
  min-height: 70px;
  place-items: center;
  margin: 14px;
  border: 1px dashed rgba(30,50,70,0.2);
  border-radius: 10px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 400;
  text-align: center;
}

.empty-state.wide {
  min-width: min(70vw, 250px);
  padding: 0 14px;
  background: transparent;
  margin: 0;
  border: none;
  border-right: 1px dashed rgba(30,50,70,0.2);
}

/* ════════════════════════════════════════════════════════
   EXPENSES — frais
   ════════════════════════════════════════════════════════ */

.expense-add-button {
  display: block;
  width: calc(100% - 28px);
  margin: 14px;
  min-height: 46px;
  border-radius: var(--btn-radius-action);
  background: linear-gradient(135deg, #F59332, #D4700A);
  color: #ffffff;
  font-family: "DM Sans", sans-serif;
  font-weight: 600;
  font-size: 13px;
  box-shadow: 0 6px 20px rgba(213,112,10,0.35);
  border: none;
}

.expense-row {
  display: flex;
  min-height: 56px;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 18px;
  border: none;
  border-bottom: 1px solid rgba(255,255,255,0.4);
  background: transparent;
}

.expense-main {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.expense-main strong {
  font-size: 0.86rem;
  font-weight: 500;
}

.expense-main span {
  overflow-wrap: anywhere;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 400;
}

.expense-side {
  display: grid;
  justify-items: end;
  gap: 4px;
  min-width: max-content;
}

.expense-side span {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.expense-delete {
  min-height: 24px;
  padding: 2px 8px;
  border-radius: var(--btn-radius-destructive);
  background: rgba(192,48,48,0.1);
  border: 1px solid rgba(192,48,48,0.2);
  color: #C03030;
  font-size: 0.65rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════
   PROJECT ACTIONS (export, terminer, supprimer)
   ════════════════════════════════════════════════════════ */

.project-actions {
  display: grid;
  gap: 10px;
  padding: 14px;
  background: transparent;
}

.export-button {
  min-height: 48px;
  border-radius: var(--btn-radius-action);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,0.75);
  color: var(--ink);
  font-family: "DM Sans", sans-serif;
  font-size: 13px;
  font-weight: 500;
}

.finish-button {
  min-height: 52px;
  border-radius: var(--btn-radius-action);
  background: rgba(46,125,82,0.1);
  border: 1px solid rgba(46,125,82,0.25);
  color: #2E7D52;
  font-family: "DM Sans", sans-serif;
  font-size: 14px;
  font-weight: 600;
}

.finish-button:disabled {
  opacity: 0.28;
  cursor: not-allowed;
}

.delete-project-button {
  min-height: 44px;
  border-radius: var(--btn-radius-destructive);
  background: rgba(192,48,48,0.1);
  border: 1px solid rgba(192,48,48,0.2);
  color: #C03030;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ════════════════════════════════════════════════════════
   ANALYSIS — insights
   ════════════════════════════════════════════════════════ */

.analysis-card strong {
  font-size: 1.3rem;
}

.score-item {
  gap: 8px;
  padding: 10px 12px;
}

.score-item input[type="range"] {
  min-height: 22px;
  padding: 0;
  accent-color: #D4700A;
  background: transparent;
  border: none;
}

.analysis-block {
  display: grid;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.4);
}

.analysis-block h3 {
  color: var(--muted);
  font-family: "DM Sans", sans-serif;
  font-style: normal;
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.analysis-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) max-content;
  gap: 4px 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.4);
}

.analysis-row:last-child {
  border-bottom: 0;
}

.analysis-row span,
.analysis-row strong {
  font-size: 0.84rem;
  font-weight: 500;
}

.analysis-row em {
  grid-column: 1 / -1;
}

.trend-block strong {
  font-family: "DM Sans", sans-serif;
  font-style: normal;
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0.04em;
}

.trend-block span {
  line-height: 1.45;
  font-size: 0.82rem;
  text-transform: none;
}

.tips-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.tips-list li {
  color: var(--ink-2);
  font-size: 0.84rem;
  font-weight: 400;
  line-height: 1.5;
}

/* ════════════════════════════════════════════════════════
   DIALOGS
   ════════════════════════════════════════════════════════ */

dialog {
  width: min(96vw, 420px);
  margin: auto;
  padding: 0;
  background: rgba(255,255,255,0.75);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255,255,255,0.9);
  border-radius: var(--btn-radius-action);
  color: var(--ink);
  box-shadow: 0 24px 72px rgba(100,130,160,0.35);
}

dialog::backdrop {
  background: rgba(20,40,60,0.35);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.dialog-body {
  display: grid;
  gap: 18px;
  padding: 20px;
}

.dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid rgba(255,255,255,0.5);
}

.dialog-head h2 {
  font-size: 1.4rem;
}

.confirm-dialog p {
  margin: 0;
  color: var(--ink-2);
  font-size: 0.9rem;
  font-weight: 400;
  line-height: 1.5;
}

.dialog-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 10px;
}

/* ════════════════════════════════════════════════════════
   FORMULAIRES
   ════════════════════════════════════════════════════════ */

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 8px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid rgba(255,255,255,0.75);
  border-radius: 10px;
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: var(--ink);
  outline: none;
}

input:focus,
select:focus {
  border-color: rgba(213,112,10,0.5);
  background: rgba(255,255,255,0.8);
}

select option {
  background: #ffffff;
  color: #14283C;
}

.duration-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.12fr);
  gap: 10px;
}

/* ════════════════════════════════════════════════════════
   QUOTA EDITOR
   ════════════════════════════════════════════════════════ */

.quota-editor {
  display: grid;
  gap: 8px;
  padding: 8px 0;
}

.quota-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.6);
  border-radius: 10px;
}

.quota-name {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 0.86rem;
  font-weight: 500;
}

/* Trait vertical couleur catégorie */
.quota-name::before {
  width: 3px;
  height: 18px;
  border-radius: 99px;
  background: currentColor;
  content: "";
  opacity: 0.5;
}

.quota-duration {
  display: grid;
  width: min(50%, 210px);
  grid-template-columns: minmax(0, 0.85fr) minmax(0, 1.15fr);
  gap: 6px;
}

.quota-row input,
.quota-row select {
  min-height: 38px;
}

.quota-row input {
  text-align: center;
}

/* ════════════════════════════════════════════════════════
   PRINT — rapport PDF
   ════════════════════════════════════════════════════════ */

.print-report {
  display: none;
}

@media print {
  body {
    background: #ffffff;
    color: #111111;
  }

  .app-shell,
  dialog {
    display: none !important;
  }

  .print-report {
    display: block;
    padding: 28px;
    color: #111111;
    font-family: "DM Sans", "Helvetica Neue", sans-serif;
  }

  .print-report header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 28px;
    padding-bottom: 16px;
    border-bottom: 2px solid #111111;
  }

  .print-report img {
    width: 44px;
    height: 44px;
    object-fit: contain;
    filter: none;
  }

  .print-report p {
    color: #6b7280;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
  }

  .print-report h1 {
    margin: 4px 0;
    font-family: "DM Serif Display", serif;
    font-style: italic;
    font-size: 26px;
    font-weight: 400;
  }

  .print-report h2 {
    margin: 24px 0 10px;
    font-family: "DM Serif Display", serif;
    font-style: italic;
    font-size: 15px;
    font-weight: 400;
  }

  .print-totals {
    display: grid;
    gap: 4px;
    padding: 16px;
    border: 1px solid #d1d5db;
    border-radius: 8px;
    margin-bottom: 20px;
  }

  .print-expense-total {
    margin: 0 0 10px;
    color: #111111;
    font-size: 13px;
    font-weight: 600;
  }

  .print-totals strong {
    font-family: "DM Sans", sans-serif;
    font-size: 34px;
    font-weight: 300;
    line-height: 1;
  }

  .print-totals span,
  .print-totals em {
    color: #4b5563;
    font-style: normal;
    font-weight: 600;
  }

  .print-report table {
    width: 100%;
    border-collapse: collapse;
    font-size: 12px;
  }

  .print-report th,
  .print-report td {
    padding: 8px;
    border-bottom: 1px solid #e5e7eb;
    text-align: left;
  }

  .print-report th {
    color: #4b5563;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
  }
}

/* ════════════════════════════════════════════════════════
   RESPONSIVE
   ════════════════════════════════════════════════════════ */

/* Très petits écrans (<380px) */
@media (max-width: 380px) {
  .primary-actions {
    flex-direction: column;
  }

  .manual-button span {
    max-width: none;
  }

  .hero-metrics,
  .business-summary,
  .analysis-grid,
  .score-grid {
    grid-template-columns: 1fr;
  }
}

/* Tablette / Mac (≥680px) */
@media (min-width: 680px) {
  :root {
    --content-max: 720px;
  }

  .module-tabs {
    width: min(100%, 720px);
  }

  main {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }

  .project-strip,
  .hero-panel,
  .history-panel,
  .expenses-panel,
  .analysis-panel {
    grid-column: 1 / -1;
  }

  .project-card {
    width: 240px;
    min-width: 240px;
  }

  .hero-metrics,
  .analysis-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .history-panel {
    max-height: 360px;
    overflow-y: auto;
  }
}

/* Grand écran Mac (≥1024px) */
@media (min-width: 1024px) {
  :root {
    --content-max: 860px;
  }

  .module-tabs {
    width: min(100%, 860px);
  }

  main {
    grid-template-columns: 1fr 1fr 1fr;
  }

  .project-strip,
  .hero-panel {
    grid-column: 1 / -1;
  }

  .analysis-panel {
    grid-column: 1 / -1;
  }
}

/* ════════════════════════════════════════════════════════
   FAB GLOBAL — bouton flottant création projet
   ════════════════════════════════════════════════════════ */

.fab-global {
  position: fixed;
  bottom: calc(var(--tab-h) + 16px + env(safe-area-inset-bottom, 0px));
  right: 20px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #F59332, #D4700A);
  border: none;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(213,112,10,.45);
  z-index: 150;
  transition: transform .15s ease, box-shadow .15s ease;
}

.fab-global:active {
  transform: scale(.92);
  box-shadow: 0 2px 10px rgba(213,112,10,.35);
}
