/* =========================================================================
   Frais pro - adaptations pour telephone.
   Chargee apres style.css, uniquement par mobile.html.
   ========================================================================= */

body[data-view="mobile"] {
  background-image: none;
  background: var(--paper);
  overscroll-behavior-y: contain;
}

.m-app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(74px + env(safe-area-inset-bottom));
}

/* ---------- En-tete mobile ---------------------------------------------- */

.m-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--ink);
  color: #fff;
  padding: calc(10px + env(safe-area-inset-top)) 16px 14px;
  border-radius: 0 0 18px 18px;
  box-shadow: var(--shadow-sm);
}

.m-header__top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.m-header__title {
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: 1;
}

.m-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
}

.m-status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #9fb0c0;
}

.m-status[data-state="synced"] .m-status__dot {
  background: #4ade80;
}
.m-status[data-state="syncing"] .m-status__dot {
  background: #93c5fd;
  animation: pulse 1s ease-in-out infinite;
}
.m-status[data-state="pending"] .m-status__dot {
  background: #fbbf24;
}
.m-status[data-state="error"] .m-status__dot {
  background: #f87171;
}
.m-status[data-state="offline"] .m-status__dot {
  background: #9fb0c0;
}

.m-monthbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 12px;
}

.m-monthbar__label {
  font-size: 15px;
  font-weight: 650;
  text-transform: capitalize;
}

.m-arrow {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}

.m-total {
  margin-top: 10px;
}

.m-total__label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  opacity: 0.65;
}

.m-total__value {
  font-size: 34px;
  font-weight: 700;
  line-height: 1.1;
}

.m-total__sub {
  font-size: 12px;
  opacity: 0.7;
}

/* ---------- Corps -------------------------------------------------------- */

.m-main {
  flex: 1;
  padding: 14px 14px 20px;
}

.m-view {
  display: none;
}

.m-view.is-active {
  display: block;
}

.m-searchbar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.m-searchbar input,
.m-searchbar select {
  flex: 1;
  min-height: 44px;
  padding: 8px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: var(--sheet);
}

/* Cartes de depenses */
.m-card {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  text-align: left;
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-left: 5px solid var(--card-color, var(--rule-strong));
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
}

.m-card:active {
  transform: scale(0.995);
}

.m-card__body {
  flex: 1;
  min-width: 0;
}

.m-card__cat {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--card-color, var(--ink-soft));
}

.m-card__meta {
  font-size: 13px;
  color: var(--ink-soft);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.m-card__amount {
  font-size: 19px;
  font-weight: 700;
  white-space: nowrap;
}

.m-daygroup {
  margin-bottom: 18px;
}

.m-dayhead {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0 4px 6px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 10px;
}

.m-dayhead__date {
  font-weight: 700;
  text-transform: capitalize;
}

.m-dayhead__total {
  font-weight: 650;
  color: var(--ink-soft);
}

/* Formulaire */
.m-chips {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}

.m-chip {
  min-height: 54px;
  border-radius: 14px;
  border: 2px solid var(--rule-strong);
  background: var(--sheet);
  font-size: 15px;
  font-weight: 650;
  cursor: pointer;
}

.m-chip[aria-pressed="true"] {
  border-color: var(--chip-color);
  background: var(--chip-bg);
  color: var(--chip-color);
}

.m-amount {
  text-align: center;
  padding: 14px 0 6px;
}

.m-amount__value {
  font-size: 46px;
  font-weight: 700;
  line-height: 1;
}

.m-amount__hint {
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 6px;
}

.m-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0 16px;
}

.m-key {
  min-height: 58px;
  font-size: 22px;
  font-weight: 650;
  border-radius: 14px;
  border: 1px solid var(--rule-strong);
  background: var(--sheet);
  cursor: pointer;
}

.m-key:active {
  background: var(--paper);
}

.m-key--wide {
  grid-column: span 1;
  font-size: 18px;
}

.m-field {
  margin-bottom: 12px;
}

.m-field input,
.m-field textarea,
.m-field select {
  width: 100%;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid var(--rule-strong);
  border-radius: 12px;
  background: var(--sheet);
}

.m-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.m-btn {
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid var(--rule-strong);
  background: var(--sheet);
  font-size: 16px;
  font-weight: 650;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.m-btn--primary {
  background: var(--c-hotel);
  border-color: var(--c-hotel);
  color: #fff;
}

.m-btn--danger {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

/* Totaux */
.m-totalrow {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 10px;
}

.m-totalrow__head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.m-totalrow__name {
  font-weight: 700;
  color: var(--row-color, var(--ink));
}

.m-track {
  height: 8px;
  border-radius: 4px;
  background: var(--rule);
  overflow: hidden;
}

.m-track__fill {
  height: 100%;
  background: var(--row-color, var(--ink));
  transition: width 0.3s ease;
}

/* Reglages */
.m-settings-group {
  background: var(--sheet);
  border: 1px solid var(--rule);
  border-radius: 14px;
  padding: 6px 14px;
  margin-bottom: 14px;
}

.m-setting {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 13px 0;
  border-bottom: 1px solid var(--rule);
}

.m-setting:last-child {
  border-bottom: none;
}

.m-setting__label {
  font-weight: 600;
}

.m-setting__value {
  color: var(--ink-soft);
  font-size: 14px;
  text-align: right;
}

/* Barre de navigation basse */
.m-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--sheet);
  border-top: 1px solid var(--rule);
  padding-bottom: env(safe-area-inset-bottom);
  box-shadow: 0 -4px 18px rgba(22, 33, 46, 0.09);
}

.m-nav__item {
  border: none;
  background: none;
  padding: 9px 4px 10px;
  font-size: 11px;
  font-weight: 650;
  color: var(--ink-faint);
  cursor: pointer;
  display: grid;
  justify-items: center;
  gap: 3px;
}

.m-nav__icon {
  font-size: 19px;
  line-height: 1;
}

.m-nav__item[aria-current="page"] {
  color: var(--c-hotel);
}

.m-fab {
  position: fixed;
  right: 16px;
  bottom: calc(88px + env(safe-area-inset-bottom));
  z-index: 45;
  min-height: 56px;
  padding: 0 22px;
  border-radius: 28px;
  border: none;
  background: var(--c-hotel);
  color: #fff;
  font-size: 17px;
  font-weight: 700;
  box-shadow: 0 8px 22px rgba(37, 99, 235, 0.4);
  cursor: pointer;
}

.m-empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 48px 16px;
}

.m-empty__title {
  color: var(--ink);
  font-weight: 650;
  margin-bottom: 6px;
}
