/* The phone emulator: npwd's phone - a dark handset, rounded bezel, MUI-style apps. */
:root {
  --bg: #0e1116;
  --page: #1a1f27;
  --ink: #e8ebf0;
  --dim: #97a0ad;
  --line: #2a313c;
  --card: #1c2129;
  --card2: #252b35;
  --screen: #111418;
  --accent: #2f8cff;
  --green: #2fbf4a;
  --red: #e5383b;
  --orange: #f08c2a;
  --teal: #16a79a;
  --grey: #6b7584;
  --bezel: #05070a;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: radial-gradient(ellipse at 30% 20%, #202836 0%, var(--bg) 60%);
  color: var(--ink);
  font: 14px/1.4 "Segoe UI", Roboto, system-ui, -apple-system, sans-serif;
  overflow: hidden;
}
button { font: inherit; color: inherit; cursor: pointer; border: 0; background: none; }
input, select { font: inherit; color: var(--ink); }
svg { width: 100%; height: 100%; display: block; }

/* --- The stage: the notes beside the phone ------------------------------------------------ */
.stage {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 48px;
  padding: 16px;
}
.side { max-width: 300px; color: var(--dim); }
.side h1 { color: var(--ink); font-size: 22px; margin: 12px 0 8px; font-weight: 600; }
.side p { margin: 0 0 10px; }
.side .note { font-size: 12.5px; border-left: 2px solid var(--line); padding-left: 10px; }
.side-logo { width: 96px; height: auto; }
.side-who { margin-top: 18px; font-size: 12.5px; color: var(--ink); }

/* --- The handset ---------------------------------------------------------------------------- */
.device {
  width: 380px;
  height: min(800px, calc(100vh - 32px));
  padding: 12px;
  border-radius: 52px;
  background: var(--bezel);
  box-shadow: 0 0 0 2px #2b3038, 0 30px 80px rgba(0, 0, 0, .6);
  flex: none;
}
.screen {
  position: relative;
  height: 100%;
  border-radius: 42px;
  overflow: hidden;
  background: var(--screen);
  display: flex;
  flex-direction: column;
}
.statusbar {
  flex: none;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 26px 0;
  font-size: 13px;
  font-weight: 600;
  position: relative;
  z-index: 3;
}
.sb-mid { font-size: 11px; color: var(--dim); letter-spacing: .08em; }
.sb-right { display: flex; gap: 6px; align-items: center; }
.sig { width: 16px; height: 10px; background: linear-gradient(90deg, var(--ink) 0 20%, transparent 20% 27%, var(--ink) 27% 47%, transparent 47% 54%, var(--ink) 54% 74%, transparent 74% 81%, var(--ink) 81%); clip-path: polygon(0 100%, 100% 0, 100% 100%); }
.bat { width: 22px; height: 11px; border: 1.5px solid var(--ink); border-radius: 3px; position: relative; }
.bat::after { content: ""; position: absolute; inset: 1.5px 5px 1.5px 1.5px; background: var(--ink); border-radius: 1px; }
.homebar {
  flex: none;
  height: 22px;
  position: relative;
  cursor: pointer;
  z-index: 3;
}
.homebar::after { content: ""; position: absolute; left: 50%; top: 8px; width: 120px; height: 5px; margin-left: -60px; border-radius: 3px; background: #d9dde3; opacity: .8; }

.app { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.app > * { flex: 1; min-height: 0; }
.blocked { padding: 40px 24px; text-align: center; color: var(--dim); }

/* --- Home ----------------------------------------------------------------------------------- */
.home {
  display: flex;
  flex-direction: column;
  padding: 10px 18px 12px;
  background: linear-gradient(160deg, #1d3557 0%, #13233a 45%, #0e141d 100%);
  margin-top: -38px;
  padding-top: 48px;
}
.home-top { text-align: center; margin: 18px 0 22px; }
.home-time { font-size: 56px; font-weight: 300; line-height: 1; }
.home-date { color: #c5cedb; margin-top: 6px; }
.home-num { color: var(--dim); font-size: 12px; margin-top: 4px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px 8px; }
.appicon { display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 11.5px; }
.ai {
  width: 56px;
  height: 56px;
  border-radius: 15px;
  padding: 14px;
  color: #fff;
  display: block;
  box-shadow: 0 4px 12px rgba(0, 0, 0, .35);
}
.g-green { background: linear-gradient(160deg, #4cd964, #1f9e38); }
.g-blue { background: linear-gradient(160deg, #4aa3ff, #1766d1); }
.g-orange { background: linear-gradient(160deg, #ffad4a, #e0701a); }
.g-teal { background: linear-gradient(160deg, #3bd1c2, #0f8a7f); }
.g-grey { background: linear-gradient(160deg, #9aa3b0, #545d6a); }
.home-card {
  margin-top: auto;
  background: rgba(255, 255, 255, .08);
  border-radius: 16px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  cursor: pointer;
  backdrop-filter: blur(6px);
}
.home-card b { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: #aebbd0; }
.dock {
  margin-top: 12px;
  display: flex;
  justify-content: space-around;
  padding: 10px;
  border-radius: 24px;
  background: rgba(255, 255, 255, .1);
}

/* --- App chrome ----------------------------------------------------------------------------- */
.phoneapp { display: flex; flex-direction: column; background: var(--screen); position: relative; }
.hdr { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 10px 10px; border-bottom: 1px solid var(--line); }
.hdr h3 { margin: 0; font-size: 19px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hdr-back { width: 34px; height: 34px; padding: 6px; border-radius: 50%; color: var(--accent); }
.hdr-back:hover { background: var(--card2); }
.tabbody { flex: 1; min-height: 0; overflow: auto; display: flex; flex-direction: column; }
.tabs { flex: none; display: flex; border-top: 1px solid var(--line); background: var(--card); }
.tab { flex: 1; padding: 11px 0 12px; color: var(--dim); font-size: 12.5px; font-weight: 600; }
.tab.on { color: var(--accent); box-shadow: inset 0 2px 0 var(--accent); }
.list { flex: 1; overflow: auto; }
.li { width: 100%; display: flex; align-items: center; gap: 12px; padding: 10px 16px; border-bottom: 1px solid var(--line); text-align: left; }
button.li:hover { background: var(--card); }
.li-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.li-t b { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-t small { color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.li-time { color: var(--dim); font-size: 12px; }
.li-ic { width: 18px; height: 18px; color: var(--dim); flex: none; }
.li.missed b, .li.missed .li-ic { color: var(--red); }
.avatar {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  background: var(--card2);
  display: grid;
  place-items: center;
  font-weight: 600;
  color: #c8d2e0;
}
.mini { width: 34px; height: 34px; border-radius: 50%; padding: 8px; flex: none; color: #fff; }
.mini.green { background: var(--green); }
.mini.blue { background: var(--accent); }
.empty { padding: 32px 20px; text-align: center; color: var(--dim); }
.fab {
  position: absolute;
  right: 18px;
  bottom: 18px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  padding: 14px;
  background: var(--accent);
  color: #fff;
  box-shadow: 0 6px 16px rgba(0, 0, 0, .45);
}

/* --- Keypad --------------------------------------------------------------------------------- */
.keypad { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; padding: 8px 28px 16px; }
.kp-disp { text-align: center; min-height: 74px; margin-bottom: 10px; }
.kp-num { font-size: 32px; font-weight: 300; letter-spacing: .02em; word-break: break-all; }
.kp-who { color: var(--accent); font-size: 13px; min-height: 18px; }
.kp-keys { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px 18px; justify-items: center; }
.kp-k {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: var(--card2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.kp-k:active { background: #3a4250; }
.kp-k b { font-size: 28px; font-weight: 400; line-height: 1; }
.kp-k span { font-size: 9.5px; letter-spacing: .14em; color: var(--dim); min-height: 11px; }
.kp-row { display: grid; grid-template-columns: repeat(3, 1fr); justify-items: center; align-items: center; margin-top: 14px; }
.kp-del { width: 44px; height: 44px; padding: 10px; color: var(--dim); }
.round { width: 68px; height: 68px; border-radius: 50%; padding: 19px; color: #fff; }
.round.green { background: var(--green); }
.round.red { background: var(--red); }
.round.ghost { background: rgba(255, 255, 255, .14); }
.round.ghost.on { background: #fff; color: #111; }

/* --- Messages ------------------------------------------------------------------------------- */
.chat { flex: 1; overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 18px; display: flex; flex-direction: column; white-space: pre-wrap; word-wrap: break-word; }
.bubble small { font-size: 10.5px; opacity: .7; margin-top: 2px; }
.bubble.mine { align-self: flex-end; background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.bubble.mine small { align-self: flex-end; }
.bubble.theirs { align-self: flex-start; background: var(--card2); border-bottom-left-radius: 5px; }
.compose { flex: none; display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-top: 1px solid var(--line); }
.compose input { flex: 1; min-width: 0; background: var(--card2); border: 1px solid var(--line); border-radius: 20px; padding: 9px 14px; outline: none; }
.compose input:focus { border-color: var(--accent); }

/* --- Maps and Settings ---------------------------------------------------------------------- */
.phoneapp > .place, .phoneapp > .hint, .phoneapp > .lbl, .phoneapp > .row, .phoneapp > select { margin-left: 16px; margin-right: 16px; }
.place { flex: none; display: flex; gap: 12px; align-items: flex-start; margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--card2); }
.place > div { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.place b { font-size: 16px; }
.place small { color: var(--dim); }
.place-pin { width: 34px; height: 34px; flex: none; color: var(--red); }
.hint { color: var(--dim); font-size: 12.5px; flex: none; }
.lbl { display: block; font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); margin-top: 14px; margin-bottom: 6px; flex: none; }
.row { display: flex; gap: 8px; flex: none; }
.row input { flex: 1; min-width: 0; }
.row .btn { flex: 1; }
.row form, form.row { margin: 0; }
input:not([type]), input[type="password"], input[type="text"], select {
  background: var(--card2);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  outline: none;
}
input:focus, select:focus { border-color: var(--accent); }
select { flex: none; }
.btn { padding: 9px 14px; border-radius: 10px; background: var(--card2); font-weight: 600; }
.btn:hover { background: #313845; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { background: transparent; color: var(--red); border: 1px solid #5a2427; }
.btn.ghost { background: rgba(255, 255, 255, .1); color: #fff; }
.settings { padding: 8px 16px; display: flex; flex-direction: column; gap: 14px; flex: none; }
.set { display: flex; flex-direction: column; gap: 5px; }
.set > span { font-weight: 600; }
.set small { color: var(--dim); font-size: 12px; }
.set input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); }
.phoneapp > .btn.danger { margin: 18px 16px; flex: none; }

/* --- Call screen (npwd CallModal) ------------------------------------------------------------ */
.callscreen {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 24px 20px;
  gap: 6px;
  background: linear-gradient(180deg, #243b55 0%, #141e30 100%);
  margin-top: -38px;
  padding-top: 70px;
  text-align: center;
}
.cs-label { font-size: 11px; letter-spacing: .18em; color: #9fb3cf; }
.cs-name { font-size: 28px; font-weight: 500; margin-top: 4px; }
.cs-num { color: #b7c4d8; min-height: 20px; }
.cs-avatar { width: 108px; height: 108px; border-radius: 50%; margin: 26px 0 16px; padding: 30px; background: rgba(255, 255, 255, .12); color: #dfe7f3; }
.cs-status { font-size: 17px; color: #dfe7f3; min-height: 24px; font-variant-numeric: tabular-nums; }
.cs-status.hold { color: #ffc861; }
.cs-controls { margin-top: auto; display: flex; gap: 56px; justify-content: center; }
.cs-vol { display: flex; align-items: center; gap: 10px; width: 80%; margin: 22px 0 10px; color: #b7c4d8; }
.cs-vol span { width: 22px; height: 22px; flex: none; }
.cs-vol input { flex: 1; accent-color: #fff; }
.callscreen .btn.ghost { margin-top: 4px; }
.callbar {
  flex: none !important;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  background: var(--green);
  color: #fff;
  font-weight: 600;
}
.callbar b { font-variant-numeric: tabular-nums; }

.toast {
  position: absolute;
  left: 16px;
  right: 16px;
  bottom: 14px;
  flex: none !important;
  padding: 10px 14px;
  border-radius: 12px;
  background: #2b3340;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .5);
  z-index: 5;
}
.toast.err { background: #5a1f22; }
.rx-el { display: none; }

/* --- Sign in -------------------------------------------------------------------------------- */
.login { position: fixed; inset: 0; display: none; place-items: center; background: rgba(8, 10, 14, .8); backdrop-filter: blur(4px); z-index: 10; padding: 16px; }
.login.show { display: grid; }
.login-card { width: 100%; max-width: 320px; background: var(--page); border: 1px solid var(--line); border-radius: 16px; padding: 24px; display: flex; flex-direction: column; gap: 10px; text-align: center; }
.login-card img { width: 72px; margin: 0 auto; }
.login-card h2 { margin: 4px 0 0; font-weight: 600; }
.login-card p { margin: 0 0 6px; color: var(--dim); }
.login-err { color: #ff8a8d !important; min-height: 18px; margin: 0 !important; }
.login-card .sso-btn { display: block; text-decoration: none; }
.login-card .sso-btn.hidden { display: none; }

/* --- A phone's own screen: the emulator is the page ---------------------------------------- */
@media (max-width: 760px) {
  body { overflow: auto; }
  .stage { padding: 0; gap: 0; }
  .side { display: none; }
  .device { width: 100%; height: 100dvh; padding: 0; border-radius: 0; box-shadow: none; }
  .screen { border-radius: 0; }
}
@media (max-height: 700px) and (min-width: 761px) {
  .kp-k { width: 58px; height: 58px; }
  .kp-k b { font-size: 24px; }
  .home-time { font-size: 44px; }
}
