/* Shared base for Vizion clickable prototypes. Each app sets its own colours on :root. */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: var(--font, system-ui, sans-serif);
  background: var(--page, #f4f4f4);
  color: var(--ink, #111);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow: hidden;
}
/* Opened on its own (not inside the portfolio phone frame): centre a phone-sized app. */
.app {
  position: relative; height: 100%; width: 100%; max-width: 430px; margin: 0 auto;
  background: var(--bg, #fff); overflow: hidden; display: flex; flex-direction: column;
}
@media (min-width: 520px) and (min-height: 700px) {
  body.standalone:not(.web) { display: grid; place-items: center; background: #e9ebef; }
  body.standalone:not(.web) .app { height: min(860px, calc(100vh - 80px)); width: 400px; border-radius: 36px; box-shadow: 0 30px 80px rgba(0,0,0,.25), 0 0 0 10px #111; }
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; }
[role="button"] { cursor: pointer; }
:focus-visible { outline: 2px solid var(--focus, #2563eb); outline-offset: 2px; }
img { display: block; max-width: 100%; }

.screens { position: relative; flex: 1; min-height: 0; }
.scr { position: absolute; inset: 0; display: none; flex-direction: column; background: var(--bg, #fff); }
.scr.on { display: flex; }
.scr.in-fwd { animation: inFwd .28s cubic-bezier(.2,.8,.2,1); }
.scr.in-back { animation: inBack .28s cubic-bezier(.2,.8,.2,1); }
@keyframes inFwd { from { transform: translateX(28px); opacity: 0; } }
@keyframes inBack { from { transform: translateX(-28px); opacity: 0; } }
.body { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; }
.body::-webkit-scrollbar { display: none; }
.pad { padding: 16px; }

/* Hotspot flash when someone taps a dead area */
.hot { animation: hot .9s ease-out; }
@keyframes hot { 0%, 40% { box-shadow: 0 0 0 3px rgba(37,99,235,.55); background-color: rgba(37,99,235,.08); } 100% { box-shadow: 0 0 0 3px rgba(37,99,235,0); } }

#proto-toast {
  position: absolute; left: 50%; bottom: 96px; transform: translate(-50%, 10px); z-index: 50;
  background: rgba(17,17,17,.92); color: #fff; padding: 10px 16px; border-radius: 999px; font-size: 13px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; white-space: nowrap; max-width: 90%;
  overflow: hidden; text-overflow: ellipsis;
}
#proto-toast.show { opacity: 1; transform: translate(-50%, 0); }

/* "Prototype · sample data" label: shown above the phone when a prototype is opened full screen on a big screen.
   Inside the portfolio's phone frame the page itself says it, so the app stays uncovered. */
.ribbon { display: none; }
@media (min-width: 520px) and (min-height: 700px) {
  body.standalone .ribbon {
    display: block; position: fixed; top: 12px; left: 50%; transform: translateX(-50%); z-index: 60; pointer-events: none;
    font: 600 11px/1 system-ui, sans-serif; letter-spacing: .06em; text-transform: uppercase;
    background: #111; color: #fff; padding: 6px 10px; border-radius: 6px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* Web-app prototypes (browser frame): full width, sidebar layout set by each page */
body.web .app { max-width: none; }
body.web #proto-toast { bottom: 28px; }
/* Web/desktop prototypes opened full screen: small tag in the corner (hidden inside the portfolio frame, where the page shows its own notice). */
body.web .ribbon { display: none; }
body.web.standalone .ribbon { display: block; position: fixed; right: 12px; bottom: 12px; left: auto; top: auto; transform: none; z-index: 60; pointer-events: none; font: 600 11px/1.3 system-ui, sans-serif; background: #111; color: #fff; padding: 6px 10px; border-radius: 6px; max-width: calc(100% - 24px); }

/* Shared web layout. Pages set --side-bg, --side-ink, --brand, --card, --line, --t2 */
body.web .app { flex-direction: row; }
.side { width: 220px; flex: none; background: var(--side-bg, #111827); color: var(--side-ink, #e5e7eb); display: flex; flex-direction: column; padding: 16px 12px; gap: 4px; }
.side .brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 16px; padding: 4px 8px 16px; }
.side .brand i { width: 30px; height: 30px; border-radius: 9px; background: var(--brand, #2563eb); color: var(--on-brand, #fff); display: grid; place-items: center; font-style: normal; font-size: 14px; }
.side button { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 10px 10px; border-radius: 10px; font-size: 14px; font-weight: 500; color: inherit; opacity: .75; position: relative; }
.side button:hover { opacity: 1; background: rgba(255,255,255,.06); }
.side button.active { opacity: 1; background: var(--side-active, rgba(255,255,255,.1)); font-weight: 600; }
.side .grow { flex: 1; }
.side .who { display: flex; align-items: center; gap: 10px; padding: 10px 8px 2px; font-size: 13px; border-top: 1px solid rgba(255,255,255,.1); }
.side .who b { display: block; font-size: 13px; }
.side .who small { opacity: .65; font-size: 11px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--brand, #2563eb); color: var(--on-brand, #fff); display: grid; place-items: center; font-weight: 700; font-size: 13px; flex: none; }
.cnt { margin-left: auto; min-width: 20px; height: 20px; border-radius: 10px; background: var(--brand, #2563eb); color: var(--on-brand, #fff); font-size: 11px; font-weight: 700; display: grid; place-items: center; padding: 0 6px; }
.cnt[hidden] { display: none; }
body.web .screens { flex: 1; min-width: 0; }
.topbar { height: 60px; flex: none; display: flex; align-items: center; gap: 12px; padding: 0 24px; border-bottom: 1px solid var(--line, #e5e7eb); background: var(--card, #fff); }
.topbar h1 { font-size: 18px; font-weight: 700; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .back { width: 34px; height: 34px; border-radius: 9px; display: grid; place-items: center; border: 1px solid var(--line, #e5e7eb); }
.wpad { padding: 24px; }
.wgrid { display: grid; gap: 16px; }
.wgrid.c2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.wgrid.c3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.wgrid.c4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.wcard { background: var(--card, #fff); border: 1px solid var(--line, #e5e7eb); border-radius: 14px; padding: 18px; min-width: 0; }
.wcard h3 { font-size: 15px; font-weight: 700; margin-bottom: 12px; }
.kpi small { color: var(--t2, #6b7280); font-size: 12px; font-weight: 600; }
.kpi b { display: block; font-size: 26px; font-weight: 800; margin-top: 4px; letter-spacing: -.02em; }
.kpi em { font-style: normal; font-size: 12px; color: var(--t2, #6b7280); }
.wbtn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 10px; background: var(--brand, #2563eb); color: var(--on-brand, #fff); font-weight: 600; font-size: 14px; white-space: nowrap; }
.wbtn.ghost { background: transparent; color: var(--ink, #111); border: 1px solid var(--line, #e5e7eb); }
.wbtn.sm { height: 32px; padding: 0 12px; font-size: 13px; }
.badge-s { display: inline-block; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 20px; white-space: nowrap; background: #eef2ff; color: #3730a3; }
.badge-s.green { background: #dcfce7; color: #166534; } .badge-s.amber { background: #fef3c7; color: #92400e; }
.badge-s.red { background: #fee2e2; color: #991b1b; } .badge-s.grey { background: #f1f5f9; color: #475569; }
.wtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.wtable th { text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; color: var(--t2, #6b7280); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--line, #e5e7eb); }
.wtable td { padding: 11px 10px; border-bottom: 1px solid var(--line, #e5e7eb); vertical-align: middle; }
.wtable tr:last-child td { border-bottom: 0; }
.wtable tr[data-go] { cursor: pointer; }
.wtable tr[data-go]:hover td { background: rgba(0,0,0,.025); }
.tscroll { overflow-x: auto; }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 600; }
.field .in { border: 1px solid var(--line, #e5e7eb); border-radius: 10px; padding: 10px 12px; font-size: 14px; background: var(--card, #fff); min-height: 40px; }
.field .in.area { min-height: 90px; line-height: 1.5; }
.meter { height: 8px; border-radius: 4px; background: var(--line, #e5e7eb); overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand, #2563eb); border-radius: 4px; transition: width .4s; }
.mtop { display: none; }

/* Mid-size (tablet, small laptop): sidebar becomes an icon rail */
@media (min-width: 721px) and (max-width: 1000px) {
  .side { width: 64px; padding: 14px 8px; align-items: center; }
  .side .brand { font-size: 0; gap: 0; padding: 4px 0 14px; }
  .side button { justify-content: center; padding: 10px 0; font-size: 17px; }
  .side button > span:not(.cnt) { display: none; }
  .side .cnt { position: absolute; top: 2px; right: 2px; margin: 0; }
  .side .who, .side .prop { display: none; }
}

/* Narrow (the portfolio frame on a phone): sidebar becomes a scrolling top strip */
@media (max-width: 720px) {
  body.web .app { flex-direction: column; }
  .side { width: auto; flex-direction: row; align-items: center; padding: 8px; gap: 2px; overflow-x: auto; scrollbar-width: none; }
  .side::-webkit-scrollbar { display: none; }
  .side .brand { padding: 0 8px 0 4px; font-size: 0; gap: 0; }
  .side button { width: auto; flex: none; padding: 8px 10px; font-size: 13px; }
  .side .grow, .side .who { display: none; }
  .topbar { padding: 0 14px; height: 52px; }
  .topbar h1 { font-size: 16px; }
  .wpad { padding: 14px; }
  .wgrid.c2, .wgrid.c3 { grid-template-columns: 1fr; }
  .wgrid.c4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hide-sm { display: none !important; }
}
