/* ============================================================
   Nide Works — Portail Pro (Espace ouvriers · clients · direction)
   Feuille de styles de l'application. S'appuie sur les tokens de
   marque définis dans ../css/styles.css (:root).
   Palette : teal #0f9d8e · accent #e08a34 · anthracite #334155
   ============================================================ */

:root {
  --app-bg: #eef2f5;
  --app-surface: #ffffff;
  --app-surface-2: #f6f8fa;
  --app-line: #e2e8ec;
  --app-ink: #1f2b3a;
  --app-muted: #6b7787;
  --app-primary: #0f9d8e;
  --app-primary-dark: #0b7d70;
  --app-accent: #e08a34;
  --app-danger: #d64545;
  --app-warn: #d9962a;
  --app-ok: #2e9e6b;
  --app-radius: 14px;
  --app-radius-sm: 9px;
  --app-shadow: 0 10px 30px rgba(31, 43, 58, 0.08);
  --app-shadow-lg: 0 24px 60px rgba(31, 43, 58, 0.18);
  --app-sidebar-w: 248px;
  --app-header-h: 62px;
  --app-font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --app-display: "Space Grotesk", "Inter", sans-serif;
}

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

html, body { height: 100%; }
/* Rendu « app native premium » : pas de zoom accidentel, pas de redimensionnement
   auto du texte, pas de débordement horizontal. */
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body.app-body {
  font-family: var(--app-font);
  color: var(--app-ink);
  background: var(--app-bg);
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  min-height: 100%;
  touch-action: manipulation;
  overflow-x: hidden;
}

img { max-width: 100%; display: block; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--app-display); letter-spacing: -0.02em; color: var(--app-ink); line-height: 1.15; }
[hidden] { display: none !important; }

/* ---------- Utilitaires ---------- */
.muted { color: var(--app-muted); }
.small { font-size: 0.82rem; }
.right { text-align: right; }
.center { text-align: center; }
.flex { display: flex; align-items: center; gap: 12px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.grow { flex: 1; }
.wrap { flex-wrap: wrap; }
.stack { display: flex; flex-direction: column; gap: 6px; }
.mt { margin-top: 16px; }
.mt-lg { margin-top: 28px; }
.nowrap { white-space: nowrap; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 1px solid transparent; border-radius: var(--app-radius-sm);
  padding: 10px 16px; font-weight: 600; font-size: 0.92rem;
  transition: transform .15s ease, box-shadow .2s ease, background .2s ease, border-color .2s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--app-primary); color: #fff; box-shadow: 0 6px 16px rgba(15,157,142,.28); }
.btn-primary:hover { background: var(--app-primary-dark); }
.btn-accent { background: var(--app-accent); color: #fff; box-shadow: 0 6px 16px rgba(224,138,52,.28); }
.btn-accent:hover { filter: brightness(.96); }
.btn-ghost { background: var(--app-surface); color: var(--app-ink); border-color: var(--app-line); }
.btn-ghost:hover { border-color: var(--app-primary); color: var(--app-primary-dark); }
.btn-danger { background: transparent; color: var(--app-danger); border-color: rgba(214,69,69,.4); }
.btn-danger:hover { background: rgba(214,69,69,.08); }
.btn-sm { padding: 6px 11px; font-size: 0.82rem; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }

/* ---------- Champs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.82rem; font-weight: 600; color: var(--app-ink); }
.input, select.input, textarea.input {
  width: 100%; padding: 11px 13px; border: 1px solid var(--app-line);
  border-radius: var(--app-radius-sm); font-size: 0.95rem; font-family: inherit;
  color: var(--app-ink); background: #fff; transition: border-color .2s, box-shadow .2s;
}
.input:focus, select.input:focus, textarea.input:focus {
  outline: none; border-color: var(--app-primary);
  box-shadow: 0 0 0 3px rgba(15,157,142,.15);
}
textarea.input { resize: vertical; min-height: 82px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.hint { font-size: 0.78rem; color: var(--app-muted); }

/* ---------- Cartes / badges ---------- */
.card {
  background: var(--app-surface); border: 1px solid var(--app-line);
  border-radius: var(--app-radius); box-shadow: var(--app-shadow); padding: 20px;
}
.card + .card { margin-top: 16px; }
.card-title { font-size: 1.05rem; margin-bottom: 4px; }
.badge {
  display: inline-flex; align-items: center; gap: 5px; font-size: 0.72rem; font-weight: 700;
  padding: 3px 9px; border-radius: 999px; letter-spacing: .02em; text-transform: uppercase;
}
.badge-ok { background: rgba(46,158,107,.13); color: var(--app-ok); }
.badge-warn { background: rgba(217,150,42,.15); color: var(--app-warn); }
.badge-danger { background: rgba(214,69,69,.12); color: var(--app-danger); }
.badge-info { background: rgba(15,157,142,.13); color: var(--app-primary-dark); }
.badge-muted { background: #eef1f4; color: var(--app-muted); }

.pill {
  display: inline-flex; align-items: center; gap: 6px; font-size: 0.8rem; font-weight: 600;
  padding: 5px 11px; border-radius: 999px; background: var(--app-surface-2);
  border: 1px solid var(--app-line);
}

/* ============================================================
   ÉCRAN DE CONNEXION
   ============================================================ */
.auth {
  min-height: 100vh; display: grid; grid-template-columns: 1.05fr 1fr;
}
.auth-hero {
  position: relative; color: #fff; padding: 48px; display: flex; flex-direction: column;
  justify-content: space-between; overflow: hidden;
  background: linear-gradient(150deg, #0d1f2c 0%, #0b7d70 130%);
}
.auth-hero::after {
  content: ""; position: absolute; inset: 0;
  background-image: radial-gradient(circle at 80% 15%, rgba(224,138,52,.28), transparent 42%),
                    radial-gradient(circle at 12% 90%, rgba(15,157,142,.4), transparent 45%);
}
.auth-hero > * { position: relative; z-index: 1; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-family: var(--app-display); font-weight: 700; font-size: 1.25rem; }
.auth-brand img { width: 44px; height: 44px; border-radius: 10px; }
.auth-hero h1 { color: #fff; font-size: clamp(1.9rem, 3vw, 2.7rem); margin-bottom: 14px; }
.auth-hero p { color: rgba(255,255,255,.82); max-width: 40ch; }
.auth-points { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.auth-points li { display: flex; align-items: flex-start; gap: 11px; color: rgba(255,255,255,.9); font-size: .95rem; }
.auth-points .tick { flex: 0 0 22px; height: 22px; border-radius: 50%; background: rgba(255,255,255,.16); display: grid; place-items: center; font-size: .8rem; }
.auth-foot { font-size: .8rem; color: rgba(255,255,255,.6); }

.auth-panel {
  display: flex; flex-direction: column; justify-content: center;
  padding: 40px clamp(24px, 6vw, 72px); background: var(--app-surface);
}
.auth-panel-inner { width: 100%; max-width: 400px; margin-inline: auto; }
.auth-panel h2 { font-size: 1.6rem; margin-bottom: 6px; }
.auth-lang { display: flex; gap: 6px; justify-content: flex-end; margin-bottom: 26px; }
.auth-lang button {
  border: 1px solid var(--app-line); background: #fff; border-radius: 8px;
  padding: 5px 10px; font-weight: 700; font-size: .78rem; color: var(--app-muted);
}
.auth-lang button.active { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }

.demo-accounts { margin-top: 22px; padding-top: 20px; border-top: 1px dashed var(--app-line); }
.demo-accounts h3 { font-size: .95rem; margin-bottom: 4px; }
.demo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.demo-card {
  border: 1px solid var(--app-line); border-radius: var(--app-radius-sm); padding: 11px 10px;
  text-align: center; background: var(--app-surface-2); transition: border-color .2s, transform .12s;
}
.demo-card:hover { border-color: var(--app-primary); transform: translateY(-2px); }
.demo-card .emoji { font-size: 1.4rem; }
.demo-card .role { font-weight: 700; font-size: .82rem; margin-top: 3px; }
.demo-card .who { font-size: .72rem; color: var(--app-muted); }

.auth-error {
  background: rgba(214,69,69,.09); color: var(--app-danger); border: 1px solid rgba(214,69,69,.25);
  border-radius: var(--app-radius-sm); padding: 10px 13px; font-size: .86rem; margin-bottom: 16px;
}

/* ============================================================
   COQUE DE L'APPLICATION (connecté)
   ============================================================ */
.shell { display: grid; grid-template-columns: var(--app-sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
  background: #0e2230; color: #cdd8de; display: flex; flex-direction: column;
  position: sticky; top: 0; height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 18px 20px; border-bottom: 1px solid rgba(255,255,255,.08); }
.sidebar-brand img { width: 38px; height: 38px; border-radius: 9px; }
.sidebar-brand b { font-family: var(--app-display); color: #fff; font-size: 1.05rem; }
.sidebar-brand span { font-size: .68rem; color: #7f96a3; text-transform: uppercase; letter-spacing: .08em; }
.sidebar-nav { flex: 1; padding: 14px 12px; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 13px; border-radius: 10px;
  color: #b6c4cd; font-weight: 600; font-size: .92rem; margin-bottom: 3px; transition: background .16s, color .16s;
}
.sidebar-nav a .ico { width: 20px; text-align: center; font-size: 1.05rem; }
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--app-primary); color: #fff; box-shadow: 0 6px 16px rgba(15,157,142,.35); }
.sidebar-foot { padding: 14px 16px; border-top: 1px solid rgba(255,255,255,.08); font-size: .74rem; color: #7f96a3; }

.main { display: flex; flex-direction: column; min-width: 0; }
.appbar {
  height: var(--app-header-h); background: var(--app-surface); border-bottom: 1px solid var(--app-line);
  display: flex; align-items: center; gap: 14px; padding: 0 22px; position: sticky; top: 0; z-index: 30;
}
.appbar h1 { font-size: 1.15rem; }
.appbar-spacer { flex: 1; }
.burger { display: none; background: none; border: 1px solid var(--app-line); border-radius: 8px; padding: 7px 10px; }

.lang-mini { display: flex; gap: 4px; }
.lang-mini button {
  border: 1px solid var(--app-line); background: #fff; border-radius: 7px; padding: 4px 8px;
  font-weight: 700; font-size: .72rem; color: var(--app-muted);
}
.lang-mini button.active { background: var(--app-primary); border-color: var(--app-primary); color: #fff; }
.lang-sel { border: 1px solid var(--app-line); background: #fff; border-radius: 8px; padding: 6px 8px;
  font-weight: 700; font-size: .78rem; color: var(--app-ink); font-family: inherit; max-width: 150px; }
.auth-lang .lang-sel { font-size: .85rem; }

.usermenu { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; color: #fff; font-size: .85rem; background: var(--app-accent); flex: 0 0 auto;
}
.avatar.role-worker { background: var(--app-primary); }
.avatar.role-client { background: #4f6d8c; }
.avatar.role-admin { background: var(--app-accent); }
.usermenu .who { line-height: 1.2; }
.usermenu .who b { font-size: .88rem; }
.usermenu .who span { font-size: .74rem; color: var(--app-muted); display: block; }

.view { padding: 24px 22px 60px; max-width: 1120px; width: 100%; margin-inline: auto; }
.view-head { margin-bottom: 20px; }
.view-head h2 { font-size: 1.5rem; }
.view-head p { color: var(--app-muted); font-size: .92rem; }

/* ---------- Grille de stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; }
.stat { background: var(--app-surface); border: 1px solid var(--app-line); border-radius: var(--app-radius); padding: 18px; box-shadow: var(--app-shadow); }
.stat .k { font-size: .78rem; color: var(--app-muted); text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat .v { font-family: var(--app-display); font-size: 1.9rem; font-weight: 700; margin-top: 4px; }
.stat .v small { font-size: .9rem; color: var(--app-muted); font-weight: 500; }
.stat .sub { font-size: .78rem; color: var(--app-muted); margin-top: 2px; }
.stat.accent { border-left: 4px solid var(--app-accent); }
.stat.primary { border-left: 4px solid var(--app-primary); }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border-radius: var(--app-radius); border: 1px solid var(--app-line); background: #fff; }
table.data { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 640px; }
table.data th, table.data td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--app-line); }
table.data th { font-size: .74rem; text-transform: uppercase; letter-spacing: .04em; color: var(--app-muted); background: var(--app-surface-2); font-weight: 700; }
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr:hover, table.data tr:hover { background: #fafcfc; }
.t-actions { display: flex; gap: 6px; }
/* Bandeau d'installation PWA (bas d'écran, très visible) */
.install-bar { position: fixed; left: 12px; right: 12px; bottom: calc(12px + env(safe-area-inset-bottom, 0px)); z-index: 200;
  display: flex; align-items: center; gap: 12px; padding: 11px 12px 11px 15px;
  background: var(--app-surface); border: 1px solid var(--app-line); border-radius: 14px;
  box-shadow: 0 10px 30px rgba(15,34,48,.22); animation: ibup .3s ease; max-width: 560px; margin: 0 auto; }
@keyframes ibup { from { transform: translateY(20px); opacity: 0; } to { transform: none; opacity: 1; } }
.install-bar .ib-txt { flex: 1; min-width: 0; line-height: 1.25; font-size: .82rem; }
.install-bar .ib-txt b { display: block; font-size: .95rem; color: var(--app-ink); }
.install-bar .ib-txt span { color: var(--app-muted); }
.install-bar .ib-act { display: flex; align-items: center; gap: 4px; flex-shrink: 0; }
.install-bar .ib-x { background: none; border: none; color: var(--app-muted); font-size: 1rem; width: 30px; height: 30px; cursor: pointer; border-radius: 8px; }
.install-bar .ib-x:hover { background: var(--app-surface-2); }
.score-why { font-size: .82rem; color: var(--app-ink); background: var(--app-surface-2); padding: 8px 11px; border-radius: 8px; }
.score-why b { color: var(--app-muted); font-weight: 700; }
.earn-card { padding: 0; overflow: hidden; }
.earn-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.earn-cell { padding: 14px 12px; text-align: center; border-right: 1px solid var(--app-line); }
.earn-cell:last-child { border-right: none; }
.earn-k { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: var(--app-muted); font-weight: 700; }
.earn-v { font-size: 1.3rem; font-weight: 800; margin-top: 3px; color: var(--app-ink); }
.earn-pay { display: flex; justify-content: space-between; align-items: center; padding: 12px 15px; background: var(--app-primary); color: #fff; font-weight: 600; }
.earn-pay b { font-size: 1.2rem; }
.feed { display: flex; flex-direction: column; }
.feed-row { display: flex; gap: 11px; padding: 9px 0; border-bottom: 1px solid var(--app-line); }
.feed-row:last-child { border-bottom: none; }
.feed-ico { flex: 0 0 30px; height: 30px; border-radius: 8px; background: var(--app-surface-2); display: flex; align-items: center; justify-content: center; font-size: 1rem; }
.feed-body { flex: 1; min-width: 0; }
.feed-line { font-size: .9rem; line-height: 1.35; }
.feed-where { color: var(--app-primary-dark); font-weight: 600; white-space: nowrap; }
.feed-time { margin-top: 2px; }
.site-board { display: flex; flex-direction: column; gap: 10px; }
.site-row { border: 1px solid var(--app-line); border-radius: 12px; padding: 11px 13px; transition: background .15s, border-color .15s; }
.site-row:hover { background: var(--app-surface-2); border-color: var(--app-primary); }
.site-row-h { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.site-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
.site-chip { font-size: .8rem; padding: 4px 9px; border-radius: 999px; font-weight: 600; white-space: nowrap; }
.site-chip.on { background: rgba(46,158,107,.14); color: var(--app-ok); }
.site-chip.plan { background: var(--app-surface-2); color: var(--app-muted); }
.reason-cell { max-width: 320px; }
.reason-more { color: var(--app-ink); }
.reason-more u { color: var(--app-primary); white-space: nowrap; font-weight: 600; text-decoration: none; }
.reason-more u::before { content: "· "; color: var(--app-muted); }

/* ---------- NIDE SCORE ---------- */
.nscore-ring { width: 84px; height: 84px; border-radius: 50%; display: grid; place-items: center; flex: 0 0 auto; }
.nscore-inner { width: 64px; height: 64px; border-radius: 50%; background: var(--app-surface); display: grid; place-items: center; text-align: center; line-height: 1.05; }
.nscore-inner b { font-family: var(--app-display); font-size: 1.55rem; display: block; }
.nscore-inner span { font-size: .64rem; color: var(--app-muted); }

/* ---------- Bannière détail chantier (photo réelle) ---------- */
.proj-banner { position: relative; height: 180px; border-radius: var(--app-radius); overflow: hidden;
  background: linear-gradient(135deg, #0b7d70, #0e2230); display: grid; place-items: center; font-size: 2.4rem; color: rgba(255,255,255,.4); }
.proj-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.proj-banner-ov { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end;
  padding: 16px 18px; background: linear-gradient(to top, rgba(14,34,48,.8), rgba(14,34,48,.05) 55%, transparent); color: #fff; }
.proj-banner-ov h2 { color: #fff; font-size: 1.4rem; margin: 0; }
.proj-banner-ov .loc { font-size: .85rem; opacity: .92; margin-top: 2px; }
@media (max-width: 560px) { .proj-banner { height: 150px; } .proj-banner-ov h2 { font-size: 1.2rem; } }

/* ---------- Chantier card ---------- */
.chantier-card { display: flex; flex-direction: column; overflow: hidden; padding: 0; }
.chantier-cover { height: 128px; background: linear-gradient(135deg, #0b7d70, #0e2230); display: grid; place-items: center; color: rgba(255,255,255,.5); font-size: 2.2rem; position: relative; }
.chantier-cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.chantier-cover.has-cover { font-size: 0; }
.chantier-cover.has-cover::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(11,34,48,.10) 0%, rgba(11,34,48,.52) 100%); }
.proj-banner.has-cover { font-size: 0; }
.chantier-card .body { padding: 15px 16px 17px; }
.chantier-card h3 { font-size: 1.05rem; }
.chantier-card .loc { font-size: .8rem; color: var(--app-muted); margin-bottom: 10px; }
.progress { height: 8px; background: #e7edf0; border-radius: 999px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: linear-gradient(90deg, var(--app-primary), var(--app-accent)); border-radius: 999px; }

/* ---------- Photos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.photo-tile { position: relative; border-radius: var(--app-radius-sm); overflow: hidden; aspect-ratio: 1; background: var(--app-surface-2); border: 1px solid var(--app-line); cursor: pointer; }
.photo-tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .3s; }
.photo-tile:hover img { transform: scale(1.05); }
.photo-tile .cap { position: absolute; inset: auto 0 0 0; background: linear-gradient(transparent, rgba(0,0,0,.78)); color: #fff; padding: 22px 9px 8px; font-size: .72rem; }
.photo-tile .cap b { display: block; line-height: 1.25; }
.photo-tile .cap .ph-stamp { display: block; font-size: .66rem; opacity: .82; margin-top: 2px; }
.photo-tile .cap .ph-task { display: block; font-size: .68rem; opacity: .92; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-tile .del { position: absolute; top: 6px; right: 6px; background: rgba(0,0,0,.55); color: #fff; border: none; border-radius: 6px; width: 26px; height: 26px; font-size: .95rem; opacity: 0; transition: opacity .2s; }
.photo-tile:hover .del { opacity: 1; }

.dropzone { border: 2px dashed var(--app-line); border-radius: var(--app-radius); padding: 26px; text-align: center; color: var(--app-muted); transition: border-color .2s, background .2s; }
.dropzone.drag { border-color: var(--app-primary); background: rgba(15,157,142,.05); }

/* ---------- Timeline ---------- */
.timeline { position: relative; padding-left: 26px; }
.timeline::before { content: ""; position: absolute; left: 7px; top: 4px; bottom: 4px; width: 2px; background: var(--app-line); }
.timeline .ev { position: relative; padding-bottom: 18px; }
.timeline .ev::before { content: ""; position: absolute; left: -23px; top: 5px; width: 12px; height: 12px; border-radius: 50%; background: var(--app-primary); border: 2px solid #fff; box-shadow: 0 0 0 2px var(--app-line); }
.timeline .ev time { font-size: .76rem; color: var(--app-muted); font-weight: 600; }

/* ---------- Empty state ---------- */
.empty { text-align: center; padding: 44px 20px; color: var(--app-muted); }
.empty .em { font-size: 2.6rem; margin-bottom: 8px; }

/* ---------- Toast ---------- */
.toast-wrap { position: fixed; right: 18px; bottom: 18px; z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #0e2230; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--app-shadow-lg); font-size: .88rem; font-weight: 500; display: flex; align-items: center; gap: 9px; animation: toast-in .25s ease; max-width: 340px; }
.toast.ok { background: #14795c; }
.toast.err { background: #b23b3b; }
@keyframes toast-in { from { transform: translateY(12px); opacity: 0; } }

/* ---------- Modal ---------- */
.modal-back { position: fixed; inset: 0; background: rgba(14,34,48,.6); backdrop-filter: blur(2px); z-index: 150; display: grid; place-items: center; padding: 18px; }
.modal { background: #fff; border-radius: var(--app-radius); box-shadow: var(--app-shadow-lg); width: 100%; max-width: 480px; max-height: 90vh; overflow-y: auto; }
.modal-head { padding: 18px 20px; border-bottom: 1px solid var(--app-line); display: flex; align-items: center; justify-content: space-between; }
.modal-head h3 { font-size: 1.15rem; }
.modal-body { padding: 20px; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--app-line); display: flex; justify-content: flex-end; gap: 10px; }
.x-close { background: none; border: none; font-size: 1.5rem; color: var(--app-muted); line-height: 1; }

/* ---------- Lightbox ---------- */
.lbx { position: fixed; inset: 0; background: rgba(8,18,26,.92); z-index: 300; display: none; align-items: center; justify-content: center; padding: 30px; }
.lbx.open { display: flex; }
.lbx img { max-width: 92vw; max-height: 82vh; border-radius: 8px; box-shadow: var(--app-shadow-lg); }
.lbx .cap { position: absolute; bottom: 22px; left: 0; right: 0; text-align: center; color: #fff; font-size: .9rem; }
.lbx .x { position: absolute; top: 18px; right: 24px; background: rgba(255,255,255,.12); color: #fff; border: none; width: 42px; height: 42px; border-radius: 50%; font-size: 1.5rem; }
.lbx .nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255,255,255,.12); color: #fff; border: none; width: 46px; height: 46px; border-radius: 50%; font-size: 1.6rem; }
.lbx .prev { left: 18px; } .lbx .next { right: 18px; }

/* ---------- Segmented / filtres ---------- */
.seg { display: inline-flex; background: var(--app-surface-2); border: 1px solid var(--app-line); border-radius: 10px; padding: 3px; gap: 3px; }
.seg button { border: none; background: none; padding: 7px 13px; border-radius: 8px; font-weight: 600; font-size: .84rem; color: var(--app-muted); }
.seg button.active { background: #fff; color: var(--app-primary-dark); box-shadow: var(--app-shadow); }

/* ============================================================
   RESPONSIVE
   ============================================================ */
.scrim { display: none; }
@media (max-width: 900px) {
  body.nav-open { overflow: hidden; }
  .auth { grid-template-columns: 1fr; }
  .auth-hero { display: none; }
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 120; width: 268px; transform: translateX(-100%);
    transition: transform .25s ease;
  }
  .sidebar.open { transform: translateX(0); box-shadow: var(--app-shadow-lg); }
  .burger { display: inline-flex; }
  .scrim.show { display: block; position: fixed; inset: 0; background: rgba(14,34,48,.45); z-index: 110; }
  .grid-2 { grid-template-columns: 1fr; }
  .field-row { grid-template-columns: 1fr; }
  .demo-grid { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .view { padding: 14px 12px 48px; }
  /* Barre du haut : compacte, tient sur un téléphone */
  .appbar { padding: 0 10px; gap: 7px; }
  .appbar h1 { font-size: 1rem; }
  .usermenu { gap: 6px; }
  .usermenu .who { display: none; }
  .lang-mini { gap: 3px; }
  .lang-mini button { padding: 3px 6px; font-size: .68rem; }
  #view-as { max-width: 116px; padding: 5px 7px; font-size: .78rem; }
  .avatar { width: 32px; height: 32px; font-size: .78rem; }
  .view-head { margin-bottom: 14px; }
  .view-head h2 { font-size: 1.25rem; }
  .view-head p { font-size: .86rem; }
  /* Stats : 2 par ligne, plus compactes */
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 13px 14px; border-radius: 12px; }
  .stat .k { font-size: .66rem; }
  .stat .v { font-size: 1.45rem; }
  /* Tableaux : cellules plus serrées, moins de défilement */
  table.data { min-width: 460px; font-size: .85rem; }
  table.data th, table.data td { padding: 9px 10px; }
  .card { padding: 15px; }
}
@media (max-width: 330px) {
  .stats { grid-template-columns: 1fr; }
  .lang-mini button { padding: 3px 5px; font-size: .64rem; }
  #view-as { max-width: 96px; }
}

/* ---------- Barre de navigation inférieure (mobile) ---------- */
.bottomnav { display: none; }
@media (max-width: 900px) {
  .bottomnav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 150;
    background: var(--app-surface); border-top: 1px solid var(--app-line);
    padding-bottom: env(safe-area-inset-bottom, 0px);
    box-shadow: 0 -3px 14px rgba(15, 34, 48, .07);
  }
  .bottomnav a, .bottomnav .bn-more {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
    padding: 8px 2px 6px; font-size: .62rem; font-weight: 700; color: var(--app-muted);
    background: none; border: none; cursor: pointer; text-align: center;
  }
  .bottomnav a.active { color: var(--app-primary-dark); }
  .bottomnav .bn-ico { font-size: 1.3rem; line-height: 1; }
  .view { padding-bottom: 84px; }
  .install-bar { bottom: calc(80px + env(safe-area-inset-bottom, 0px)); }
}

/* ---------- Réalisations / Achievements ---------- */
.ach-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.ach-badge { position: relative; text-align: center; padding: 12px 6px 10px; border-radius: 12px; border: 1px solid var(--app-line); background: var(--app-surface-2); }
.ach-badge.earned { background: linear-gradient(160deg, rgba(15,157,142,.12), rgba(224,138,52,.10)); border-color: rgba(15,157,142,.35); }
.ach-badge.locked { filter: grayscale(1); opacity: .55; }
.ach-ico { font-size: 1.7rem; line-height: 1; }
.ach-lbl { font-size: .72rem; font-weight: 700; color: var(--app-ink); margin-top: 5px; }
.ach-ok { position: absolute; top: 6px; right: 8px; color: var(--app-ok); font-weight: 800; font-size: .85rem; }
.ach-prog { font-size: .64rem; color: var(--app-muted); margin-top: 3px; font-weight: 600; }
@media (max-width: 380px) { .ach-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------- Rapport direction ---------- */
.rp-total td { font-weight: 800; border-top: 2px solid var(--app-line); background: var(--app-surface-2); }
.rp-rate { display: flex; align-items: center; gap: 4px; white-space: nowrap; color: var(--app-muted); font-size: .8rem; }
.rp-proof { text-align: center; }

/* ---------- Congés / Отпуски ---------- */
.leave-bal { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; max-width: 660px; margin-bottom: 16px; }
.lb-card { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 16px 8px; border-radius: 14px; border: 1px solid var(--app-line); background: var(--app-surface-2); }
.lb-card.lb-hl { background: linear-gradient(160deg, rgba(15,157,142,.14), rgba(224,138,52,.10)); border-color: rgba(15,157,142,.38); }
.lb-num { font-size: 1.9rem; font-weight: 800; line-height: 1; color: var(--app-ink); font-family: "Space Grotesk", Inter, sans-serif; }
.lb-hl .lb-num { color: var(--app-accent); }
.lb-lbl { font-size: .74rem; font-weight: 600; color: var(--app-muted); text-align: center; }
.lv-allow { text-align: center; }

/* ============================================================
   Fluidité premium — micro-interactions & transitions
   (couche additive : n'altère aucune mise en page existante)
   ============================================================ */

/* Chaque changement d'écran glisse doucement vers le haut. */
@keyframes nw-view-in {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}
.view.anim { animation: nw-view-in .28s cubic-bezier(.2, .8, .3, 1) both; }

/* Boutons : retour tactile net (pression + relâchement). */
.btn { transition: transform .12s ease, box-shadow .18s ease, background .18s ease, opacity .18s ease; }
.btn:active { transform: scale(.965); }
.btn-primary { box-shadow: 0 4px 14px rgba(15, 157, 142, .28); }
.btn-primary:hover { box-shadow: 0 6px 20px rgba(15, 157, 142, .36); }

/* Cartes : présence subtile, relief au survol (desktop uniquement). */
.card { transition: box-shadow .22s ease, transform .22s ease; }
@media (hover: hover) and (pointer: fine) {
  .card:hover { box-shadow: var(--app-shadow); }
}

/* Tableaux : lignes réactives, lecture apaisée. */
.data tbody tr { transition: background .15s ease; }
.data tbody tr:hover { background: rgba(15, 157, 142, .045); }

/* Navigation latérale : glissement doux de l'état actif. */
.sidebar-nav a { transition: background .16s ease, color .16s ease, transform .16s ease; }
.sidebar-nav a:active { transform: scale(.98); }

/* Barre inférieure : l'onglet actif « respire ». */
.bottomnav a, .bottomnav .bn-more { transition: color .18s ease, transform .14s ease; }
.bottomnav a:active, .bottomnav .bn-more:active { transform: scale(.92); }
.bottomnav a.active .bn-ico { animation: nw-pop .3s cubic-bezier(.2, .8, .3, 1); }
@keyframes nw-pop { 0% { transform: scale(.7); } 60% { transform: scale(1.18); } 100% { transform: scale(1); } }

/* Champs : focus visible, doux et coloré. */
.input { transition: border-color .16s ease, box-shadow .16s ease; }
.input:focus { outline: none; border-color: var(--app-primary); box-shadow: 0 0 0 3px rgba(15, 157, 142, .16); }
:focus-visible { outline: 2px solid var(--app-primary); outline-offset: 2px; }
.btn:focus-visible, .input:focus-visible { outline: none; }

/* Badges & pills : apparition en douceur dans les listes redessinées. */
.badge, .pill, .site-chip { transition: transform .14s ease; }

/* Barres de progression : la valeur glisse au lieu de sauter. */
.progress i { transition: width .5s cubic-bezier(.2, .8, .3, 1); }

/* Défilement : élan naturel + barres discrètes. */
.view, .table-wrap { -webkit-overflow-scrolling: touch; scroll-behavior: smooth; }
.table-wrap::-webkit-scrollbar { height: 6px; }
.table-wrap::-webkit-scrollbar-thumb { background: var(--app-line); border-radius: 3px; }

/* ---------- Régie / imprévus & rappels ---------- */
.regie-toggle { display: flex; gap: 12px; align-items: flex-start; padding: 13px 15px; border-radius: 12px; margin: 12px 0;
  border: 1.5px dashed rgba(224, 138, 52, .55); background: rgba(224, 138, 52, .07); cursor: pointer; }
.regie-toggle input { width: 22px; height: 22px; accent-color: var(--app-accent); flex: 0 0 auto; margin-top: 2px; }
.regie-toggle b { color: #b06a1e; }
.regie-toggle .small { color: var(--app-muted); }
.regie-toggle:has(input:checked) { background: rgba(224, 138, 52, .16); border-style: solid; }
.row-regie td { background: rgba(224, 138, 52, .07); }
.missed-banner { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; margin: 14px 0 0;
  padding: 15px 18px; border: 0; border-radius: var(--app-radius); font-family: inherit; font-size: 1rem; cursor: pointer;
  background: linear-gradient(120deg, rgba(224, 138, 52, .95), rgba(214, 69, 69, .88)); color: #fff;
  box-shadow: 0 10px 26px rgba(224, 138, 52, .35); animation: nw-view-in .4s cubic-bezier(.2, .8, .3, 1) both; }
.missed-banner b { font-size: 1.02rem; }
.missed-banner .small { opacity: .9; }
.missed-banner .mb-go { margin-left: auto; font-size: 1.4rem; font-weight: 800; }
.news-banner { display: flex; align-items: center; gap: 14px; width: 100%; text-align: left; margin: 14px 0 0;
  padding: 15px 18px; border: 0; border-radius: var(--app-radius); font-family: inherit; font-size: 1rem; cursor: pointer;
  background: linear-gradient(120deg, rgba(15, 157, 142, .96), rgba(11, 127, 116, .92)); color: #fff;
  box-shadow: 0 10px 26px rgba(15, 157, 142, .3); animation: nw-view-in .4s cubic-bezier(.2, .8, .3, 1) both; }
.news-banner b { font-size: 1.02rem; }
.news-banner .mb-go { margin-left: auto; font-size: 1.4rem; font-weight: 800; }
.news-banner.leave { background: linear-gradient(120deg, rgba(52, 152, 219, .95), rgba(41, 121, 176, .92));
  box-shadow: 0 10px 26px rgba(52, 152, 219, .3); cursor: default; }
#nw-sync.spin { animation: nw-spin .8s linear infinite; }
@keyframes nw-spin { to { transform: rotate(360deg); } }

/* Accessibilité : on respecte les préférences de mouvement réduit. */
@media (prefers-reduced-motion: reduce) {
  .view.anim, .bottomnav a.active .bn-ico { animation: none; }
  .btn, .card, .progress i { transition: none; }
}

/* ============================================================
   V3 — PREMIUM 2026 / INDUSTRIAL OPERATIONS PORTAL
   ============================================================ */
:root {
  --app-bg: #f2f1ed;
  --app-surface: #ffffff;
  --app-surface-2: #f7f7f4;
  --app-line: #d9dedf;
  --app-ink: #17232d;
  --app-muted: #5f6b78;
  --app-primary: #08796f;
  --app-primary-dark: #075f58;
  --app-accent: #b85f18;
  --app-danger: #b63737;
  --app-warn: #a76415;
  --app-ok: #176b4f;
  --app-radius: 10px;
  --app-radius-sm: 7px;
  --app-shadow: 0 1px 2px rgba(23, 35, 45, .05), 0 8px 24px rgba(23, 35, 45, .05);
  --app-shadow-lg: 0 20px 60px rgba(12, 24, 32, .2);
  --app-sidebar-w: 264px;
  --app-header-h: 68px;
  --app-font: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --app-display: "Arial Narrow", "Roboto Condensed", Inter, ui-sans-serif, sans-serif;
}

body.app-body { background: var(--app-bg); letter-spacing: -.005em; }
.nw-sprite { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.nw-icon {
  width: 1.15em; height: 1.15em; display: inline-block; flex: 0 0 auto;
  fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round;
  vertical-align: -.16em;
}
.app-loading { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--app-muted); font-weight: 700; letter-spacing: .08em; text-transform: uppercase; font-size: .78rem; }
.app-spinner { width: 36px; height: 36px; border: 2px solid var(--app-line); border-top-color: var(--app-primary); border-radius: 50%; animation: nw-spin .8s linear infinite; }

h1, h2, h3, h4 { font-family: var(--app-display); letter-spacing: -.035em; }
.btn { min-height: 42px; border-radius: 7px; padding: 9px 15px; box-shadow: none; font-weight: 720; }
.btn-primary { background: var(--app-primary); color: #fff; box-shadow: none; }
.btn-primary:hover { background: var(--app-primary-dark); box-shadow: none; }
.btn-accent { background: var(--app-accent); color: #fff; box-shadow: none; }
.btn-ghost { background: #fff; }
.btn-sm { min-height: 36px; }
.icon-button { width: 40px; min-width: 40px; padding-inline: 0; }
.icon-button .nw-icon { width: 19px; height: 19px; }
.input, select.input, textarea.input { min-height: 44px; border-radius: 7px; background: #fff; }
.input:focus, select.input:focus, textarea.input:focus { border-color: var(--app-primary); box-shadow: 0 0 0 3px rgba(8, 121, 111, .14); }
:focus-visible { outline: 3px solid rgba(8, 121, 111, .42); outline-offset: 2px; }
.btn:focus-visible, .input:focus-visible { outline: 3px solid rgba(8, 121, 111, .42); outline-offset: 2px; }

.card, .stat { border-radius: var(--app-radius); box-shadow: var(--app-shadow); }
.card { padding: 19px; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 760; }
.card-title > .nw-icon { color: var(--app-primary); }
.badge, .pill { border-radius: 6px; }
.pill { gap: 7px; }
.pill .nw-icon, .badge .nw-icon { width: 14px; height: 14px; }
.inline-icon { display: inline-flex; align-items: center; gap: 5px; }
.score-dot { width: 9px; height: 9px; display: inline-block; border-radius: 50%; background: var(--app-danger); }
.score-dot.green { background: var(--app-ok); }
.score-dot.amber { background: var(--app-warn); }
.score-dot.orange { background: var(--app-accent); }
.assignment { border: 1px solid var(--app-line); padding: 7px 11px; }
.assignment.today { background: rgba(8, 121, 111, .08); border-color: rgba(8, 121, 111, .24); }
.assignment.tomorrow { background: rgba(184, 95, 24, .07); border-color: rgba(184, 95, 24, .22); }
.assignment b { margin-left: 3px; }

.auth { background: #101b23; }
.auth-hero { padding: clamp(34px, 5vw, 72px); background: #111e27; }
.auth-hero::before { content: ""; position: absolute; inset: 0; opacity: .22; background-image: linear-gradient(rgba(255,255,255,.055) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.055) 1px, transparent 1px); background-size: 44px 44px; }
.auth-hero::after { background: radial-gradient(circle at 76% 22%, rgba(8, 121, 111, .35), transparent 38%), linear-gradient(150deg, transparent 35%, rgba(184, 95, 24, .08)); }
.auth-brand img { border-radius: 7px; }
.auth-points .tick { border-radius: 6px; background: rgba(131, 216, 206, .13); color: #83d8ce; }
.auth-panel { background: #fbfbf8; }
.auth-panel-inner { max-width: 420px; }
.auth-panel h2 { font-size: 1.8rem; }
.auth-mobile-brand { display: none; align-items: center; gap: 12px; margin-bottom: 24px; }
.auth-mobile-brand img { width: 44px; height: 44px; border-radius: 7px; }
.auth-mobile-brand span { display: grid; line-height: 1.05; }
.auth-mobile-brand b { font-family: var(--app-display); font-size: 1.12rem; }
.auth-mobile-brand small { margin-top: 5px; color: var(--app-muted); font-size: .67rem; letter-spacing: .1em; text-transform: uppercase; }
.demo-grid { gap: 10px; }
.demo-card { min-height: 104px; border-radius: 8px; background: #fff; }
.demo-icon { width: 34px; height: 34px; margin: 0 auto 7px; display: grid; place-items: center; border: 1px solid var(--app-line); border-radius: 7px; color: var(--app-primary); }
.demo-icon .nw-icon { width: 19px; height: 19px; }

.sidebar { background: #101b23; color: #cbd5da; border-right: 1px solid rgba(255,255,255,.06); }
.sidebar-brand { min-height: var(--app-header-h); padding: 14px 18px; }
.sidebar-brand img { width: 39px; height: 39px; border-radius: 7px; }
.sidebar-brand span { color: #8da0ab; }
.sidebar-nav { padding: 12px 10px 18px; }
.nav-group-label { padding: 16px 12px 6px; color: #71858f; font-size: .64rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.nav-group-label:first-child { padding-top: 5px; }
.sidebar-nav a { position: relative; gap: 11px; margin: 1px 0; padding: 9px 11px; border-radius: 6px; color: #b9c6cc; }
.sidebar-nav a .ico { width: 21px; display: grid; place-items: center; }
.sidebar-nav a .ico .nw-icon { width: 18px; height: 18px; }
.sidebar-nav a.active { background: rgba(8, 121, 111, .24); color: #fff; box-shadow: inset 3px 0 #83d8ce; }
.sidebar-nav a:hover { background: rgba(255,255,255,.055); }
.sidebar-nav .nav-external { margin-top: 18px; border-top: 1px solid rgba(255,255,255,.07); padding-top: 14px; }
.sidebar-foot { padding: 15px 18px; color: #82939c; }
.sidebar-foot span { opacity: .72; }
.sidebar-mobile-tools { display: none; padding: 14px 18px; border-top: 1px solid rgba(255,255,255,.08); }
.sidebar-tool-label { margin-bottom: 6px; color: #82939c; font-size: .65rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; }
.sidebar-mobile-tools .lang-sel { width: 100%; max-width: none; color: #fff; border-color: rgba(255,255,255,.16); background: #172832; }

.appbar { padding: 0 20px; background: rgba(255,255,255,.96); backdrop-filter: blur(14px); }
.appbar h1 { font-size: 1.18rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.burger { color: var(--app-ink); }
.sync-state { display: inline-flex; align-items: center; gap: 7px; padding: 5px 9px; border: 1px solid var(--app-line); border-radius: 999px; color: var(--app-muted); font-size: .7rem; font-weight: 750; white-space: nowrap; }
.sync-state i { width: 7px; height: 7px; border-radius: 50%; background: var(--app-ok); box-shadow: 0 0 0 3px rgba(23,107,79,.1); }
.sync-state.offline i { background: var(--app-warn); box-shadow: 0 0 0 3px rgba(167,100,21,.1); }
.preview-label { display: inline-flex; align-items: center; gap: 7px; }
.view { padding: 28px 26px 68px; max-width: 1180px; }
.view-head { margin-bottom: 22px; }
.view-head h2 { font-size: clamp(1.4rem, 2vw, 1.75rem); }
.stat { padding: 17px; }
.stat .v { font-size: 1.75rem; }
.quick-action { min-width: 160px; justify-content: flex-start; }
.quick-action .nw-icon { width: 18px; height: 18px; }
.site-row-h b, .feed-where { display: inline-flex; align-items: center; gap: 6px; }
.site-row-h b .nw-icon, .feed-where .nw-icon { width: 14px; height: 14px; }
.site-chip.on::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.site-chip.plan { display: inline-flex; align-items: center; gap: 5px; }
.site-chip.plan .nw-icon { width: 13px; height: 13px; }
.feed-ico { color: var(--app-primary); }
.feed-ico .nw-icon { width: 16px; height: 16px; }
.ach-ico .nw-icon { width: 26px; height: 26px; color: var(--app-primary); }
.empty .em { min-height: 46px; display: grid; place-items: center; }
.empty .em .nw-icon { width: 36px; height: 36px; color: #89969e; }
.chantier-cover > .nw-icon, .proj-banner > .nw-icon { width: 42px; height: 42px; }
.chantier-card .loc, .proj-banner-ov .loc { display: inline-flex; align-items: center; gap: 5px; }
.chantier-card .loc .nw-icon, .proj-banner-ov .loc .nw-icon { width: 13px; height: 13px; }
.banner-icon { width: 22px; height: 22px; }
.missed-banner, .news-banner { border-radius: 8px; box-shadow: none; }
.missed-banner { background: #a95622; }
.news-banner { background: #08796f; }
.news-banner.leave { background: #345f79; box-shadow: none; }
.regie-toggle > .nw-icon { width: 20px; height: 20px; color: var(--app-accent); margin-top: 3px; }
.dropzone-icon { width: 48px; height: 48px; margin: 0 auto 8px; border: 1px solid var(--app-line); border-radius: 8px; display: grid; place-items: center; color: var(--app-primary); }
.dropzone-icon .nw-icon { width: 24px; height: 24px; }
.proof-note { margin-bottom: 14px; padding: 11px 14px; border-left: 3px solid var(--app-accent); }
.proof-note .small { display: flex; align-items: center; gap: 7px; color: var(--app-ink); }
.photo-tile .del .nw-icon { width: 15px; height: 15px; }
.ph-stamp { display: flex !important; align-items: center; gap: 4px; }
.ph-stamp .nw-icon { width: 11px; height: 11px; }
.guest-pending { display: flex; gap: 9px; align-items: center; border-color: rgba(184,95,24,.35); background: rgba(184,95,24,.07); }
.install-bar .ib-txt { display: grid; grid-template-columns: 22px 1fr; column-gap: 7px; align-items: center; }
.install-bar .ib-txt > .nw-icon { grid-row: 1 / 3; width: 20px; height: 20px; color: var(--app-primary); }
.install-bar .ib-txt b, .install-bar .ib-txt span { grid-column: 2; }
.table-wrap { border-radius: 8px; overscroll-behavior-x: contain; }
table.data { font-variant-numeric: tabular-nums; }

.bottomnav { height: calc(62px + env(safe-area-inset-bottom, 0px)); }
.bottomnav a, .bottomnav .bn-more { min-height: 58px; padding-top: 7px; }
.bottomnav .bn-ico { height: 23px; display: grid; place-items: center; }
.bottomnav .bn-ico .nw-icon { width: 21px; height: 21px; }
.bottomnav a.active { color: var(--app-primary); }

@media (max-width: 900px) {
  .auth-panel { min-height: 100svh; padding: 28px clamp(20px, 7vw, 52px); }
  .auth-mobile-brand { display: flex; }
  .sidebar { width: min(86vw, 320px); }
  .sidebar-mobile-tools { display: block; }
  .view { padding-inline: 18px; }
}

@media (max-width: 720px) {
  .sync-state span { display: none; }
  .sync-state { width: 30px; height: 30px; padding: 0; justify-content: center; border: 0; }
  .lang-mini { display: none; }
}

@media (max-width: 560px) {
  :root { --app-header-h: 58px; }
  .appbar { padding: 0 10px; gap: 7px; }
  .appbar h1 { font-size: .98rem; }
  #view-as { display: none; }
  .usermenu #logout { width: 36px; min-width: 36px; }
  .burger { width: 38px; min-width: 38px; }
  .view { padding: 15px 12px 88px; }
  .view-head { margin-bottom: 15px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
  .stat { padding: 13px; }
  .stat .v { font-size: 1.42rem; }
  .stat .k { line-height: 1.25; }
  .card { padding: 15px; }
  .quick-action { flex: 1 1 calc(50% - 6px); min-width: 0; min-height: 48px; }
  .quick-action span { white-space: normal; text-align: left; line-height: 1.15; }
  .missed-banner, .news-banner { padding: 13px 14px; font-size: .9rem; }
  .earn-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .earn-cell { padding-inline: 6px; }
  .earn-v { font-size: 1.05rem; }
  .table-wrap { margin-inline: -2px; border-radius: 7px; }
  table.data { min-width: 580px; }
  .recent-wrap { margin-inline: 0; overflow: visible; border: 0; background: transparent; }
  table.recent-data { min-width: 0; display: block; }
  .recent-data tbody { display: grid; gap: 9px; }
  .recent-data tr { display: grid; padding: 11px 13px; border: 1px solid var(--app-line); border-radius: 8px; background: #fff; box-shadow: var(--app-shadow); }
  .recent-data td { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 5px 0; border: 0; text-align: right; }
  .recent-data td::before { content: attr(data-label); color: var(--app-muted); font-size: .7rem; font-weight: 750; letter-spacing: .04em; text-transform: uppercase; text-align: left; }
  .modal-back { padding: 10px; align-items: end; }
  .modal { max-height: 92svh; border-radius: 12px 12px 0 0; }
  .modal-foot { padding-bottom: calc(14px + env(safe-area-inset-bottom, 0px)); }
  .toast-wrap { left: 12px; right: 12px; bottom: calc(74px + env(safe-area-inset-bottom, 0px)); }
  .toast { max-width: none; }
}

@media (max-width: 360px) {
  .stats { grid-template-columns: 1fr; }
  .appbar-spacer { min-width: 0; }
  .avatar { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .app-spinner { animation-duration: 1.8s; }
}
