/* ECOVATION — ui_kits/mobile/styles.css
 * Layout only. Every colour, size and radius comes from ../../colors_and_type.css.
 * No backdrop-filter, no emoji, no hardcoded hex — except the QR quiet zone,
 * which must stay literally black on white in both themes.
 */

/* ── Page ───────────────────────────────────────────────────────────────── */
body {
  background:
    radial-gradient(1200px 600px at 8% -10%, var(--hub-wash-1), transparent 60%),
    radial-gradient(900px 500px at 100% 10%, var(--hub-wash-2), transparent 55%),
    var(--surface-1);
  min-height: 100vh;
  padding: var(--sp-8) var(--sp-6) var(--sp-10);
  font-family: var(--font-ui);
  color: var(--text-1);
}

.kit-head { max-width: 1290px; margin: 0 auto var(--sp-8); }
.kit-brand { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.kit-brand img { width: 40px; height: 40px; object-fit: contain; }
.kit-brand span {
  font-weight: 800; font-size: var(--fs-22); letter-spacing: -.02em;
  color: var(--primary-text);
}
.kit-title {
  margin: 0 0 var(--sp-2);
  font-size: var(--fs-28); line-height: var(--lh-28);
  font-weight: 700; letter-spacing: -.02em; color: var(--text-1);
}
.kit-sub { margin: 0; max-width: 720px; font-size: var(--fs-16); line-height: var(--lh-16); color: var(--text-2); }

.theme-toggle {
  position: fixed; top: var(--sp-5); right: var(--sp-5);
  width: 38px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--border);
  color: var(--text-2); cursor: pointer;
  box-shadow: var(--shadow-sm); transition: var(--transition-base);
}
.theme-toggle:hover { color: var(--text-1); border-color: var(--border-strong); }
.theme-toggle svg { width: 17px; height: 17px; }

.kit-foot {
  max-width: 1290px; margin: var(--sp-9) auto 0;
  padding-top: var(--sp-5); border-top: 1px solid var(--border);
  font-size: var(--fs-13); color: var(--text-3);
}
.kit-foot a { color: var(--primary-text); }

/* ── Phone grid ─────────────────────────────────────────────────────────── */
.phones {
  display: grid;
  grid-template-columns: repeat(auto-fit, 390px);
  justify-content: center;
  gap: var(--sp-8) var(--sp-7);
  max-width: 1290px; margin: 0 auto;
}
.phone-wrap { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); }
.phone-label {
  font-size: var(--fs-12); font-weight: 600; letter-spacing: .08em;
  text-transform: uppercase; color: var(--text-3);
}

/* ── Device bezel — iPhone 14 Pro geometry, 390 × 844 ───────────────────── */
.device {
  position: relative;
  width: 390px; height: 844px;
  border-radius: 46px;
  background: var(--surface-2);
  box-shadow: var(--shadow-xl), 0 0 0 1px var(--border-strong);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.device__island {
  position: absolute; top: 11px; left: 50%; transform: translateX(-50%);
  width: 122px; height: 35px; border-radius: var(--r-pill);
  background: var(--navy); z-index: 40;
}
.device__home {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  width: 134px; height: 5px; border-radius: var(--r-pill);
  background: var(--text-1); opacity: .3; z-index: 40;
}

/* status bar */
.statusbar {
  position: relative; z-index: 30;
  flex: none; height: 54px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px var(--sp-6) 0;
  font-size: var(--fs-14); font-weight: 600; color: var(--text-1);
}
.statusbar__icons { display: flex; align-items: center; gap: 6px; color: var(--text-1); }
.statusbar__icons svg { display: block; }

/* scrolling screen body */
.screen {
  flex: 1; min-height: 0; overflow: hidden;
  background: var(--surface-1);
  display: flex; flex-direction: column;
  gap: var(--sp-3);
  padding: var(--sp-4) var(--sp-4) var(--sp-5);
}
.screen--tabbed { padding-bottom: 86px; }

/* ── In-screen primitives ───────────────────────────────────────────────── */
.m-appbar { display: flex; align-items: center; gap: var(--sp-3); padding: 0 var(--sp-1) var(--sp-1); }
.m-appbar__back {
  width: 32px; height: 32px; flex: none;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-pill);
  background: var(--surface-3); color: var(--text-2);
}
.m-appbar__back svg { width: 15px; height: 15px; }
.m-appbar__title { font-size: var(--fs-18); line-height: var(--lh-18); font-weight: 700; color: var(--text-1); }
.m-appbar__sub { font-size: var(--fs-12); color: var(--text-3); }

.m-greet { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-1) var(--sp-1) 0; }
.m-avatar {
  width: 44px; height: 44px; flex: none; border-radius: var(--r-pill);
  background: var(--primary); color: var(--text-on-primary);
  display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-14); font-weight: 700;
}
.m-greet__hi { font-size: var(--fs-12); color: var(--text-3); }
.m-greet__name { font-size: var(--fs-16); line-height: var(--lh-16); font-weight: 700; color: var(--text-1); }

.m-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: var(--sp-4);
  box-shadow: var(--shadow-card);
}
.m-card--flat { box-shadow: none; }
.m-card__label {
  font-size: var(--fs-12); font-weight: 600; letter-spacing: .06em;
  text-transform: uppercase; color: var(--text-3);
  margin-bottom: var(--sp-3);
}

.m-htx {
  display: flex; align-items: center; gap: var(--sp-3);
  background: var(--primary); border-radius: var(--r-md);
  padding: var(--sp-4); color: var(--text-on-primary);
}
.m-htx__mark {
  width: 38px; height: 38px; flex: none; border-radius: var(--r-sm);
  background: var(--primary-deep);
  display: flex; align-items: center; justify-content: center;
}
.m-htx__mark svg { width: 20px; height: 20px; }
.m-htx__name { font-size: var(--fs-14); line-height: var(--lh-14); font-weight: 700; }
.m-htx__meta { font-size: var(--fs-12); opacity: .82; }

.m-weather {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-13); color: var(--text-2);
}
.m-weather > span { display: inline-flex; align-items: center; gap: var(--sp-2); }
.m-weather svg { width: 18px; height: 18px; flex: none; color: var(--text-3); }
.m-weather strong { color: var(--text-1); font-size: var(--fs-16); font-weight: 700; }

.m-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); }
.m-stat {
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: var(--sp-3);
  text-align: center;
}
.m-stat__v { font-size: var(--fs-22); line-height: var(--lh-22); font-weight: 700; color: var(--text-1); }
.m-stat__k { font-size: var(--fs-12); line-height: 15px; color: var(--text-3); margin-top: 2px; }

.m-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3) 0;
  border-bottom: 1px solid var(--border-soft);
}
.m-row:last-child { border-bottom: 0; padding-bottom: 0; }
.m-row:first-of-type { padding-top: 0; }
.m-row__icon {
  width: 34px; height: 34px; flex: none; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-2);
  display: flex; align-items: center; justify-content: center;
}
.m-row__icon svg { width: 17px; height: 17px; }
.m-row__body { min-width: 0; flex: 1; }
.m-row__t { font-size: var(--fs-13); line-height: var(--lh-13); font-weight: 600; color: var(--text-1); }
.m-row__s { font-size: var(--fs-12); line-height: 17px; color: var(--text-3); }
.m-row__chev { color: var(--text-3); flex: none; }
.m-row__chev svg { width: 14px; height: 14px; display: block; }

/* Status pills — UPPERCASE Vietnamese, five reserved roles only */
.pill {
  display: inline-flex; align-items: center; flex: none;
  height: 22px; padding: 0 var(--sp-2);
  border-radius: var(--r-pill);
  font-size: var(--fs-12); font-weight: 600; letter-spacing: .03em;
  white-space: nowrap;
}
.pill--ok    { background: var(--ok-soft);   color: var(--ok); }
.pill--info  { background: var(--info-soft); color: var(--info); }
.pill--warn  { background: var(--warn-soft); color: var(--warn); }
.pill--err   { background: var(--err-soft);  color: var(--err); }
.pill--idle  { background: var(--surface-3); color: var(--text-2); }

/* GPS / meta chips */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  height: 24px; padding: 0 var(--sp-2);
  border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-2);
  font-size: var(--fs-12); font-family: var(--font-mono);
}
.chip svg { width: 12px; height: 12px; }

/* Journal timeline */
.m-time { position: relative; padding-left: var(--sp-6); }
.m-time::before {
  content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px;
  width: 2px; background: var(--border);
}
.m-time__item { position: relative; padding-bottom: var(--sp-4); }
.m-time__item:last-child { padding-bottom: 0; }
.m-time__item::before {
  content: ''; position: absolute; left: calc(var(--sp-6) * -1 + 3px); top: 4px;
  width: 10px; height: 10px; border-radius: var(--r-pill);
  background: var(--surface-2); border: 2px solid var(--dot, var(--primary));
}
.m-time__when { font-size: var(--fs-12); color: var(--text-3); font-family: var(--font-mono); }
.m-time__what { font-size: var(--fs-13); line-height: var(--lh-13); font-weight: 600; color: var(--text-1); margin: 2px 0 4px; }
.m-time__note { font-size: var(--fs-12); line-height: 17px; color: var(--text-2); margin-bottom: 6px; }

/* Form controls */
.m-field { margin-bottom: var(--sp-2); }
.m-field__label {
  display: block; margin-bottom: 6px;
  font-size: var(--fs-12); font-weight: 600; color: var(--text-2);
}
.m-input {
  display: flex; align-items: center; justify-content: space-between;
  height: var(--h-lg); padding: 0 var(--sp-3);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-14); color: var(--text-1);
}
.m-input--placeholder { color: var(--text-3); }
.m-input--focus { border-color: var(--primary); box-shadow: var(--focus-ring); }
.m-input svg { width: 15px; height: 15px; color: var(--text-3); flex: none; }
.m-input__unit { font-size: var(--fs-13); color: var(--text-3); }

.m-photos { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.m-photo {
  aspect-ratio: 1; border-radius: var(--r-sm);
  background: var(--surface-3); border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text-3);
}
.m-photo svg { width: 16px; height: 16px; }
.m-photo--add { border-style: dashed; border-color: var(--border-strong); }

.m-btn {
  display: flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: var(--h-lg); border-radius: var(--r-md);
  background: var(--primary); color: var(--text-on-primary);
  font-family: var(--font-ui); font-size: var(--fs-14); font-weight: 600;
  border: 0; width: 100%;
}
.m-btn--ghost {
  background: var(--surface-2); color: var(--text-1);
  border: 1px solid var(--border);
}
.m-btn svg { width: 16px; height: 16px; }

/* QR scanner viewfinder */
.m-view {
  position: relative; flex: 1; min-height: 0;
  border-radius: var(--r-lg);
  background: var(--navy);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
}
.m-view__grid {
  position: absolute; inset: 0;
  background-image:
    linear-gradient(var(--map-road) 1px, transparent 1px),
    linear-gradient(90deg, var(--map-road) 1px, transparent 1px);
  background-size: 26px 26px;
  opacity: .5;
}
.m-view__box { position: relative; width: 196px; height: 196px; }
.m-view__box i {
  position: absolute; width: 34px; height: 34px;
  border: 3px solid var(--secondary); border-radius: 4px;
}
.m-view__box i:nth-child(1) { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.m-view__box i:nth-child(2) { top: 0; right: 0; border-left: 0; border-bottom: 0; }
.m-view__box i:nth-child(3) { bottom: 0; left: 0; border-right: 0; border-top: 0; }
.m-view__box i:nth-child(4) { bottom: 0; right: 0; border-left: 0; border-top: 0; }
.m-view__scan {
  position: absolute; left: 6px; right: 6px; top: 50%; height: 2px;
  background: var(--secondary);
}
.m-view__hint {
  position: absolute; left: var(--sp-4); right: var(--sp-4); bottom: var(--sp-4);
  text-align: center;
  font-size: var(--fs-13); line-height: var(--lh-13);
  color: var(--map-overlay-text);
  background: var(--map-overlay-bg);
  border-radius: var(--r-md); padding: var(--sp-3);
}

/* Zero Trust gate — always L1 → L4, never reordered */
.gate { display: flex; flex-direction: column; gap: var(--sp-2); }
.gate__layer {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3);
  background: var(--surface-2); border: 1px solid var(--border);
  border-left: 3px solid var(--edge, var(--ok));
  border-radius: var(--r-sm);
}
.gate__layer--ok  { --edge: var(--ok); }
.gate__layer--err { --edge: var(--err); }
.gate__id {
  font-family: var(--font-mono); font-size: var(--fs-12); font-weight: 500;
  color: var(--text-3); flex: none; width: 20px;
}
.gate__body { flex: 1; min-width: 0; }
.gate__name { font-size: var(--fs-13); line-height: var(--lh-13); font-weight: 600; color: var(--text-1); }
.gate__src { font-size: var(--fs-12); line-height: 16px; color: var(--text-3); }

/* QR quiet zone — the one allowed literal black-on-white in both themes */
.qr {
  width: 132px; height: 132px; margin: 0 auto;
  padding: 10px; background: #FFFFFF; border-radius: var(--r-sm);
  border: 1px solid var(--border);
}
.qr svg { display: block; width: 100%; height: 100%; }
.qr rect { fill: #000000; }

.m-code {
  text-align: center; font-family: var(--font-mono);
  font-size: var(--fs-12); color: var(--text-2); letter-spacing: .06em;
}

/* Search */
.m-search {
  display: flex; align-items: center; gap: var(--sp-2);
  height: var(--h-md); padding: 0 var(--sp-3);
  background: var(--surface-2); border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: var(--fs-14); color: var(--text-3);
}
.m-search svg { width: 15px; height: 15px; flex: none; }

.m-segment { display: flex; gap: 4px; padding: 3px; background: var(--surface-3); border-radius: var(--r-md); }
.m-segment span {
  flex: 1; text-align: center; padding: 6px 0;
  font-size: var(--fs-12); font-weight: 600; color: var(--text-2);
  border-radius: var(--r-sm);
}
.m-segment span[aria-current] { background: var(--surface-2); color: var(--text-1); box-shadow: var(--shadow-sm); }

.m-scroll { flex: 1; min-height: 0; overflow: hidden; display: flex; flex-direction: column; gap: var(--sp-3); }

/* ── Tab bar ────────────────────────────────────────────────────────────── */
.tabbar {
  position: absolute; left: var(--sp-3); right: var(--sp-3); bottom: 22px; z-index: 35;
  display: grid; grid-template-columns: repeat(4, 1fr);
  padding: var(--sp-2) var(--sp-1);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}
.tabbar__item {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px; font-weight: 600; letter-spacing: .02em;
  color: var(--text-3);
}
.tabbar__item svg { width: 20px; height: 20px; }
.tabbar__item[aria-current] { color: var(--primary-text); }
