* { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Theme variables ── */

:root {
  --bg:          #f2f2f7;
  --bg-card:     #fff;
  --text:        #000;
  --text-2:      #3a3a3c;
  --text-3:      #8e8e93;
  --sep:         rgba(0,0,0,0.08);
  --nav-bg:      rgba(242,242,247,0.92);
  --nav-border:  rgba(0,0,0,0.12);
  --blue:        #007aff;
  --green:       #34c759;
  --seg-bg:      rgba(118,118,128,0.12);
  --seg-active:  #fff;
  --seg-text:    #3a3a3c;
  --seg-text-a:  #000;
  --tog-off:     #e5e5ea;
  --tog-on:      #34c759;
  --step-bg:     #fff;
  --step-bdr:    rgba(0,0,0,0.18);
  --hover:       rgba(0,0,0,0.03);
  --active-bg:   rgba(0,0,0,0.06);
  --chevron:     #c7c7cc;
}

html[data-theme="dark"] {
  --bg:          #1c1c1e;
  --bg-card:     #1c1c1e;
  --text:        #fff;
  --text-2:      #ebebf5;
  --text-3:      #8e8e93;
  --sep:         rgba(255,255,255,0.08);
  --nav-bg:      rgba(28,28,30,0.92);
  --nav-border:  rgba(255,255,255,0.1);
  --blue:        #0a84ff;
  --green:       #30d158;
  --seg-bg:      rgba(118,118,128,0.24);
  --seg-active:  #3a3a3c;
  --seg-text:    rgba(235,235,245,0.6);
  --seg-text-a:  #fff;
  --tog-off:     #3a3a3c;
  --tog-on:      #30d158;
  --step-bg:     #2c2c2e;
  --step-bdr:    rgba(255,255,255,0.15);
  --hover:       rgba(255,255,255,0.05);
  --active-bg:   rgba(255,255,255,0.08);
  --chevron:     #48484a;
}

/* ── Base ── */

html, body {
  min-height: 100%;
  background: var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
  color: var(--text);
  font-size: 16px;
}

/* ── Navigation bar ── */

.nav-bar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--nav-bg);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid var(--nav-border);
  padding: 0 16px;
  height: 52px;
  display: flex;
  align-items: center;
  gap: 0;
}

.nav-back {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--blue);
  text-decoration: none;
  font-size: 16px;
  padding: 8px 0;
  white-space: nowrap;
}

.nav-back:hover { opacity: 0.7; }
.nav-back svg { flex-shrink: 0; }

.nav-title {
  flex: 1;
  text-align: center;
  font-weight: 600;
  font-size: 17px;
  pointer-events: none;
  color: var(--text);
}

.nav-spacer { width: 80px; }

/* ── Page content ── */

.page {
  max-width: 600px;
  margin: 0 auto;
  padding: 24px 16px 40px;
}

/* ── Section ── */

.section { margin-bottom: 24px; }

.section-header {
  font-size: 13px;
  font-weight: 400;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0 16px 6px;
}

.card {
  background: var(--bg-card);
  border-radius: 12px;
  overflow: hidden;
}

/* ── Form rows ── */

.row {
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--sep);
}

.row:last-child { border-bottom: none; }

.row-label {
  flex: 1;
  font-size: 16px;
  color: var(--text);
}

.row-value {
  font-size: 16px;
  color: var(--text-3);
  text-align: right;
  white-space: nowrap;
}

.row-input {
  text-align: right;
  font-family: inherit;
  font-size: 16px;
  color: var(--blue);
  border: none;
  background: none;
  outline: none;
  width: 110px;
  min-width: 0;
  -webkit-appearance: none;
}

input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button { -webkit-appearance: none; }

.row-date {
  font-family: inherit;
  font-size: 16px;
  color: var(--blue);
  border: none;
  background: none;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

/* Toggle switch */
.toggle {
  position: relative;
  width: 51px;
  height: 31px;
  flex-shrink: 0;
}

.toggle input { opacity: 0; width: 0; height: 0; }

.toggle-track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: var(--tog-off);
  transition: background 0.2s;
  cursor: pointer;
}

.toggle input:checked ~ .toggle-track { background: var(--tog-on); }

.toggle-thumb {
  position: absolute;
  top: 2px; left: 2px;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
  transition: transform 0.2s;
  pointer-events: none;
}

.toggle input:checked ~ .toggle-track ~ .toggle-thumb,
.toggle input:checked + .toggle-track + .toggle-thumb {
  transform: translateX(20px);
}

/* Segmented control */
.segmented {
  display: flex;
  background: var(--seg-bg);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  flex: 1;
  border: none;
  background: none;
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
  font-weight: 500;
  padding: 6px 4px;
  cursor: pointer;
  color: var(--seg-text);
  transition: background 0.15s, color 0.15s;
}

.seg-btn.active {
  background: var(--seg-active);
  color: var(--seg-text-a);
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* Result highlight */
.result-big {
  font-size: 28px;
  font-weight: 600;
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.result-big.negative,
.row-value.negative { color: #ff3b30; }

.row-sublabel { font-size: 12px; color: var(--text-3); }

/* Stepper row */
.stepper {
  display: flex;
  align-items: center;
  gap: 0;
}

.step-btn {
  width: 32px;
  height: 32px;
  border: 1px solid var(--step-bdr);
  background: var(--step-bg);
  font-size: 20px;
  font-weight: 300;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--blue);
  transition: background 0.1s;
}

.step-btn:first-child { border-radius: 8px 0 0 8px; }
.step-btn:last-child  { border-radius: 0 8px 8px 0; }
.step-btn:hover       { background: var(--hover); }

.step-value {
  border-top: 1px solid var(--step-bdr);
  border-bottom: 1px solid var(--step-bdr);
  background: var(--step-bg);
  color: var(--text);
  padding: 0 14px;
  height: 32px;
  display: flex;
  align-items: center;
  font-size: 15px;
  min-width: 56px;
  justify-content: center;
  font-variant-numeric: tabular-nums;
}

/* Hub list */
.hub-row {
  display: flex;
  align-items: center;
  min-height: 48px;
  padding: 10px 16px;
  text-decoration: none;
  color: var(--text);
  border-bottom: 1px solid var(--sep);
  gap: 12px;
}

.hub-row:last-child { border-bottom: none; }
.hub-row:hover      { background: var(--hover); }
.hub-row:active     { background: var(--active-bg); }

.hub-icon  { font-size: 24px; width: 32px; text-align: center; flex-shrink: 0; }
.hub-label { flex: 1; font-size: 16px; }
.hub-chevron { color: var(--chevron); font-size: 14px; }

/* Footnote */
.footnote {
  font-size: 13px;
  color: var(--text-3);
  padding: 8px 16px 0;
  line-height: 1.5;
}

/* Holiday detail list */
.holiday-list { display: flex; flex-direction: column; gap: 0; }

.holiday-row {
  padding: 10px 16px;
  border-bottom: 1px solid var(--sep);
}

.holiday-row:last-child { border-bottom: none; }

.holiday-name { font-size: 15px; color: var(--text); }
.holiday-meta { font-size: 13px; color: var(--text-3); margin-top: 1px; }

/* Conversion table */
.conv-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}

.conv-table th {
  text-align: left;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-3);
  border-bottom: 1px solid var(--sep);
}

.conv-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--sep);
  font-variant-numeric: tabular-nums;
  color: var(--text);
}

.conv-table tr:last-child td { border-bottom: none; }
.conv-table tr.selected td  { background: rgba(0,122,255,0.08); }
.conv-minutes { font-weight: 500; }

/* FAQ accordion */
details.faq-item { border-bottom: 1px solid var(--sep); }
details.faq-item:last-child { border-bottom: none; }

details.faq-item summary {
  list-style: none;
  display: flex;
  align-items: center;
  min-height: 44px;
  padding: 10px 16px;
  gap: 8px;
  cursor: pointer;
  font-size: 16px;
  user-select: none;
  color: var(--text);
}

details.faq-item summary::-webkit-details-marker { display: none; }

.faq-chevron {
  margin-left: auto;
  color: var(--chevron);
  font-size: 18px;
  flex-shrink: 0;
  transition: transform 0.2s;
}

details.faq-item[open] .faq-chevron { transform: rotate(90deg); }

.faq-body {
  padding: 0 16px 14px;
  font-size: 15px;
  color: var(--text-2);
  line-height: 1.55;
}

/* History rows */
button.hist-row {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 56px;
  padding: 10px 16px;
  gap: 12px;
  border-bottom: 1px solid var(--sep);
  cursor: pointer;
  background: none;
  border-top: none; border-left: none; border-right: none;
  text-align: left;
  font-family: inherit;
  color: inherit;
  transition: background 0.1s;
}

button.hist-row:last-child { border-bottom: none; }
button.hist-row:hover  { background: var(--hover); }
button.hist-row:active { background: var(--active-bg); }

.hist-main { flex: 1; min-width: 0; }

.hist-calc {
  font-size: 15px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.hist-time   { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.hist-inject { color: var(--chevron); font-size: 16px; flex-shrink: 0; }

/* Empty state */
.empty-state { text-align: center; padding: 56px 24px; }
.empty-icon  { font-size: 48px; margin-bottom: 12px; }
.empty-title { font-size: 17px; font-weight: 600; color: var(--text-2); margin-bottom: 6px; }
.empty-desc  { font-size: 15px; color: var(--text-3); line-height: 1.5; }

/* Action rows */
.row.danger  { color: #ff3b30; justify-content: center; cursor: pointer; }
.row.center  { justify-content: center; cursor: pointer; color: var(--blue); }
.row.center:hover, .row.danger:hover { background: var(--hover); }

/* Legal pages (confidentialite.php) */
.legal-section { margin-bottom: 28px; }

.legal-h2 {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  padding: 0 16px 8px;
}

.legal-body {
  background: var(--bg-card);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 15px;
  line-height: 1.65;
  color: var(--text-2);
}

.legal-body p + p    { margin-top: 10px; }
.legal-body ul       { padding-left: 20px; margin-top: 8px; }
.legal-body ul li    { margin-bottom: 4px; }
.legal-body strong   { color: var(--text); }
.legal-body a        { color: var(--blue); text-decoration: none; }
.legal-body a:hover  { text-decoration: underline; }

.legal-meta {
  font-size: 13px;
  color: var(--text-3);
  padding: 0 16px 20px;
  line-height: 1.5;
}
