/* =========================================================
   What How Why : the mock kit.

   Every "How" simulation is drawn with these classes, so a
   facilitator practising the register and one practising the
   marking app see the same quality of fake screen. Everything is
   prefixed m- and scoped inside .m-screen, so nothing here can
   leak into the training app's own chrome.

   --accent is set per module (the real app's main colour).
   The full list of classes is documented in MODULES.md.
   ========================================================= */

.m-device {
  position: relative;
  border-radius: 26px;
  padding: 12px;
  background: #1f2629;
  box-shadow: 0 30px 60px -30px rgba(20,30,35,.55), 0 0 0 1px rgba(0,0,0,.08);
}
.m-screen {
  --accent: #253238;
  --accent-soft: color-mix(in srgb, var(--accent) 12%, white);
  --m-ink: #1f2a30;
  --m-ink-2: #4a5960;
  --m-muted: #84919a;
  --m-line: #e3e6e8;
  --m-bg: #f4f6f7;
  --m-card: #fff;
  --m-ok: #2f8a5b;
  --m-bad: #c43d3d;
  --m-warn: #c98a12;
  --m-info: #2e6fa8;

  position: relative;
  overflow: hidden;
  border-radius: 16px;
  background: var(--m-bg);
  color: var(--m-ink);
  font: 14px/1.4 "Inter", -apple-system, system-ui, sans-serif;
  min-height: 460px;
  display: flex; flex-direction: column;
  user-select: none;
}
.m-screen * { box-sizing: border-box; }
.m-screen .m-hide { display: none !important; }

/* ---------- Structure ---------- */
.m-app { flex: 1; display: flex; flex-direction: column; min-height: 460px; }
.m-top {
  display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 8px 16px;
  background: var(--m-card); border-bottom: 1px solid var(--m-line);
}
.m-top.dark { background: var(--accent); color: #fff; border-bottom: 0; }
.m-brand { font-weight: 800; letter-spacing: -.01em; font-size: 15px; display: flex; align-items: center; gap: 8px; }
.m-brand .m-logo {
  width: 26px; height: 26px; border-radius: 7px; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
}
.m-top .m-spacer, .m-spacer { flex: 1; }
.m-top-title { font-weight: 700; }
.m-top-sub { font-size: 12px; color: var(--m-muted); }
.m-top.dark .m-top-sub { color: rgba(255,255,255,.75); }
.m-iconbtn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--m-line);
  background: var(--m-card); display: grid; place-items: center; color: var(--m-ink-2);
  font-size: 15px; cursor: pointer;
}
.m-body { flex: 1; display: flex; min-height: 0; }
.m-side {
  width: 170px; flex: none; padding: 12px 10px;
  background: var(--m-card); border-right: 1px solid var(--m-line);
}
.m-nav { display: flex; flex-direction: column; gap: 2px; }
.m-nav a, .m-nav button {
  display: flex; align-items: center; gap: 8px; text-align: left;
  padding: 8px 10px; border-radius: 8px; color: var(--m-ink-2);
  font-size: 13px; font-weight: 600; text-decoration: none; border: 0; background: none; cursor: pointer;
}
.m-nav .on { background: var(--accent-soft); color: var(--accent); }
.m-main { flex: 1; min-width: 0; padding: 16px; display: flex; flex-direction: column; gap: 12px; overflow: hidden; }
.m-foot {
  display: flex; gap: 8px; align-items: center; padding: 10px 16px;
  background: var(--m-card); border-top: 1px solid var(--m-line);
}
.m-tabbar {
  display: flex; justify-content: space-around; padding: 8px 6px;
  background: var(--m-card); border-top: 1px solid var(--m-line);
}
.m-tabbar button {
  border: 0; background: none; font-size: 11px; font-weight: 600; color: var(--m-muted);
  display: flex; flex-direction: column; align-items: center; gap: 3px; cursor: pointer;
}
.m-tabbar .on { color: var(--accent); }

/* ---------- Type ---------- */
.m-h1 { font-size: 20px; font-weight: 800; letter-spacing: -.02em; }
.m-h2 { font-size: 15px; font-weight: 700; }
.m-sub { font-size: 12.5px; color: var(--m-muted); }
.m-label { font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--m-muted); }
.m-strong { font-weight: 700; }
.m-muted { color: var(--m-muted); }

/* ---------- Layout ---------- */
.m-card { background: var(--m-card); border: 1px solid var(--m-line); border-radius: 12px; padding: 14px; }
.m-card.tight { padding: 10px; }
.m-stack { display: flex; flex-direction: column; gap: 10px; }
.m-hrow { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.m-grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.m-grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.m-grid4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }

/* ---------- Lists ---------- */
.m-list { background: var(--m-card); border: 1px solid var(--m-line); border-radius: 12px; overflow: hidden; }
.m-row {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-bottom: 1px solid var(--m-line); background: var(--m-card);
}
.m-row:last-child { border-bottom: 0; }
.m-row.click { cursor: pointer; }
.m-row .m-grow { flex: 1; min-width: 0; }
.m-row .m-chev { color: var(--m-muted); }
.m-avatar {
  width: 32px; height: 32px; border-radius: 99px; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 800;
  background: var(--accent-soft); color: var(--accent);
}

/* ---------- Tiles: big tappable cards (registers, houses, apps) ---------- */
.m-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: 8px; }
.m-tile {
  border: 1.5px solid var(--m-line); border-radius: 12px; background: var(--m-card);
  padding: 10px; display: flex; flex-direction: column; gap: 4px; cursor: pointer; min-height: 64px;
  transition: background .2s, border-color .2s, color .2s;
}
.m-tile .m-tile-name { font-weight: 700; font-size: 13px; }
.m-tile .m-tile-sub { font-size: 11px; color: var(--m-muted); }
.m-tile.ok   { background: #e7f4ec; border-color: var(--m-ok); }
.m-tile.bad  { background: #fbe9e9; border-color: var(--m-bad); }
.m-tile.warn { background: #fdf3df; border-color: var(--m-warn); }
.m-tile.info { background: #e6f0f8; border-color: var(--m-info); }
.m-tile.sel  { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

/* ---------- Controls ---------- */
.m-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px solid var(--m-line); background: var(--m-card); color: var(--m-ink);
  font: inherit; font-weight: 700; font-size: 13px; cursor: pointer; white-space: nowrap;
}
.m-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.m-btn.ok { background: var(--m-ok); border-color: var(--m-ok); color: #fff; }
.m-btn.danger { background: var(--m-bad); border-color: var(--m-bad); color: #fff; }
.m-btn.ghost { background: transparent; border-color: transparent; color: var(--accent); }
.m-btn.sm { height: 28px; padding: 0 10px; font-size: 12px; border-radius: 7px; }
.m-btn.lg { height: 44px; padding: 0 20px; font-size: 14px; }
.m-btn.block { width: 100%; }
.m-btn[disabled], .m-btn.disabled { opacity: .45; }

.m-field { display: flex; flex-direction: column; gap: 5px; }
.m-field > label { font-size: 12px; font-weight: 700; color: var(--m-ink-2); }
.m-input {
  height: 36px; padding: 0 10px; border-radius: 8px;
  border: 1px solid #cfd5d8; background: #fff; color: var(--m-ink);
  font: inherit; font-size: 13.5px; width: 100%;
}
textarea.m-input { height: 76px; padding: 8px 10px; resize: none; }
select.m-input { appearance: auto; -webkit-appearance: menulist; }
.m-input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
.m-input.ro { background: var(--m-bg); color: var(--m-ink-2); }

.m-seg { display: inline-flex; padding: 3px; border-radius: 9px; background: #e9ecee; gap: 2px; }
.m-seg button {
  border: 0; background: none; padding: 6px 12px; border-radius: 7px;
  font: inherit; font-size: 12.5px; font-weight: 700; color: var(--m-ink-2); cursor: pointer;
}
.m-seg .on { background: #fff; color: var(--m-ink); box-shadow: 0 1px 2px rgba(0,0,0,.1); }

.m-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--m-line); }
.m-tabs button {
  border: 0; background: none; padding: 9px 12px; font: inherit; font-size: 13px; font-weight: 700;
  color: var(--m-muted); border-bottom: 2px solid transparent; margin-bottom: -1px; cursor: pointer;
}
.m-tabs .on { color: var(--accent); border-bottom-color: var(--accent); }

.m-toggle {
  width: 40px; height: 24px; border-radius: 99px; background: #cfd5d8; position: relative;
  flex: none; cursor: pointer; transition: background .2s;
}
.m-toggle::after {
  content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px;
  border-radius: 99px; background: #fff; transition: transform .2s; box-shadow: 0 1px 2px rgba(0,0,0,.2);
}
.m-toggle.on { background: var(--accent); }
.m-toggle.on::after { transform: translateX(16px); }

.m-check {
  width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid #b9c2c6; background: #fff;
  flex: none; display: grid; place-items: center; cursor: pointer; font-size: 13px; color: #fff;
}
.m-check.on { background: var(--accent); border-color: var(--accent); }
.m-check.on::after { content: ""; width: 9px; height: 5px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }

.m-search {
  display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px;
  border: 1px solid #cfd5d8; border-radius: 9px; background: #fff; color: var(--m-muted); font-size: 13px;
}

.m-drop {
  border: 2px dashed #c4ccd0; border-radius: 12px; padding: 18px; text-align: center;
  color: var(--m-ink-2); font-size: 13px; background: #fafbfb; cursor: pointer;
}
.m-drop.on { border-color: var(--m-ok); background: #eef8f2; color: var(--m-ok); }

/* ---------- Status ---------- */
.m-pill {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 9px;
  border-radius: 99px; font-size: 11.5px; font-weight: 700;
  background: #e9ecee; color: var(--m-ink-2); white-space: nowrap;
}
.m-pill.ok { background: #e1f2e8; color: var(--m-ok); }
.m-pill.bad { background: #f8e2e2; color: var(--m-bad); }
.m-pill.warn { background: #fbefd6; color: #9a6a0c; }
.m-pill.info { background: #e0ecf6; color: var(--m-info); }
.m-pill.accent { background: var(--accent-soft); color: var(--accent); }

.m-stat { background: var(--m-card); border: 1px solid var(--m-line); border-radius: 12px; padding: 10px 12px; }
.m-stat .m-stat-num { font-size: 22px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.m-stat .m-stat-label { font-size: 11.5px; color: var(--m-muted); font-weight: 600; }
.m-stat.ok .m-stat-num { color: var(--m-ok); }
.m-stat.bad .m-stat-num { color: var(--m-bad); }
.m-stat.warn .m-stat-num { color: var(--m-warn); }

.m-progress { height: 8px; border-radius: 99px; background: #e5e9eb; overflow: hidden; }
.m-progress > span { display: block; height: 100%; background: var(--accent); border-radius: 99px; transition: width .4s; }

.m-banner {
  display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 10px;
  font-size: 13px; font-weight: 600; background: var(--accent-soft); color: var(--accent);
}
.m-banner.ok { background: #e1f2e8; color: var(--m-ok); }
.m-banner.bad { background: #f8e2e2; color: var(--m-bad); }
.m-banner.warn { background: #fbefd6; color: #8a5f0a; }

.m-empty { padding: 26px; text-align: center; color: var(--m-muted); font-size: 13px; }

/* ---------- Tables ---------- */
.m-table { width: 100%; border-collapse: collapse; background: var(--m-card); border: 1px solid var(--m-line); border-radius: 12px; overflow: hidden; font-size: 13px; }
.m-table th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--m-muted); padding: 8px 10px; background: #f8f9fa; border-bottom: 1px solid var(--m-line); }
.m-table td { padding: 8px 10px; border-bottom: 1px solid var(--m-line); }
.m-table tr:last-child td { border-bottom: 0; }
.m-table .num { text-align: right; font-variant-numeric: tabular-nums; }
.m-table td .m-input { height: 30px; }

/* ---------- Overlays inside the mock ---------- */
.m-modal {
  position: absolute; inset: 0; z-index: 5;
  background: rgba(20,28,32,.42);
  display: flex; align-items: flex-end; justify-content: center; padding: 18px;
}
.m-modal.center { align-items: center; }
.m-sheet {
  width: 100%; max-width: 440px; background: var(--m-card); border-radius: 16px; padding: 16px;
  display: flex; flex-direction: column; gap: 12px; box-shadow: 0 20px 40px -20px rgba(0,0,0,.5);
}
.m-doc {
  background: #fff; border: 1px solid var(--m-line); border-radius: 6px; padding: 18px;
  box-shadow: 0 8px 20px -14px rgba(0,0,0,.4); font-size: 12.5px;
}
.m-sig { font-family: "Brush Script MT", "Segoe Script", cursive; font-size: 22px; color: #1d3b6e; }

/* Toast drawn by the engine inside the screen */
.m-toast {
  position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%) translateY(20px);
  background: #1f2a30; color: #fff; padding: 9px 14px; border-radius: 10px; font-size: 13px; font-weight: 600;
  opacity: 0; transition: opacity .25s, transform .25s; z-index: 9; pointer-events: none; white-space: nowrap;
}
.m-toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- Guided-step affordances (applied by the engine) ---------- */
.m-screen [data-t] { transition: box-shadow .2s, outline-color .2s; }
.m-screen .m-target {
  outline: 3px solid #cca300; outline-offset: -3px;
  animation: m-pulse 1.4s ease-in-out infinite;
  position: relative; z-index: 3;
}
.m-screen .m-nope { animation: m-shake .35s; }
@keyframes m-pulse {
  0%, 100% { box-shadow: inset 0 0 0 0 rgba(204,163,0,.0), 0 0 0 0 rgba(204,163,0,.55); }
  50% { box-shadow: inset 0 0 0 6px rgba(204,163,0,.22), 0 0 0 6px rgba(204,163,0,0); }
}
@keyframes m-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

@media (max-width: 700px) {
  .m-side { display: none; }
  .m-grid3, .m-grid4 { grid-template-columns: 1fr 1fr; }
  .m-device { padding: 7px; border-radius: 18px; }
}
