/* ==========================================================================
   The phone — device frame + the in-app UI kit (light theme, matches the app).
   Logical design size 384 x 812; the deck scales it to fit via --phone-scale.
   ========================================================================== */

.device {
  width: 384px;
  height: 812px;
  background: linear-gradient(150deg, #2b2e35, #0b0c0f 55%);
  border-radius: 48px;
  padding: 12px;
  position: relative;
  box-shadow:
    0 40px 90px rgba(0,0,0,0.65),
    0 0 0 2px #34373f,
    0 0 0 9px #0d0e11;
}
.device-island {
  position: absolute; top: 20px; left: 50%; transform: translateX(-50%);
  width: 116px; height: 30px; background: #000; border-radius: 16px; z-index: 30;
}
.device-island::after {
  content: ""; position: absolute; right: 12px; top: 50%; transform: translateY(-50%);
  width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #2a3550, #0a0d14);
}
.device .vol { position: absolute; left: -3px; width: 3px; border-radius: 3px; background: #23252b; }
.device .vol.v1 { top: 150px; height: 30px; }
.device .vol.v2 { top: 196px; height: 52px; }
.device .vol.v3 { top: 262px; height: 52px; }
.device .pwr { position: absolute; right: -3px; top: 210px; width: 3px; height: 78px; border-radius: 3px; background: #23252b; }

.screen {
  width: 100%; height: 100%;
  background: var(--app-bg);
  border-radius: 37px;
  overflow: hidden;
  position: relative;
  display: flex; flex-direction: column;
  color: var(--text);
  font-size: 14px;
}

/* ---------- OS status bar ---------- */
.statusbar {
  flex: 0 0 auto; height: 46px;
  display: flex; align-items: flex-end; justify-content: space-between;
  padding: 0 26px 7px; font-size: 13px; font-weight: 700; color: var(--text);
}
.statusbar .sb-right { display: flex; align-items: center; gap: 6px; }
.statusbar svg { display: block; }

/* ---------- App bar ---------- */
.appbar {
  flex: 0 0 auto; min-height: 54px;
  display: flex; align-items: center; gap: 6px;
  padding: 4px 8px 4px 16px;
  background: var(--surface);
}
.appbar.flat { background: transparent; }
.appbar .ab-title { font-size: 18px; font-weight: 600; color: var(--text); }
.appbar .ab-greet { display: flex; flex-direction: column; line-height: 1.15; }
.appbar .ab-greet .g1 { font-size: 18px; font-weight: 700; }
.appbar .ab-greet .g2 { font-size: 12px; font-weight: 500; color: var(--text-faint); }
.appbar .ab-spacer { flex: 1; }
.icon-btn {
  width: 42px; height: 42px; border-radius: 50%; border: none; background: transparent;
  color: var(--text); display: grid; place-items: center; position: relative;
}
.icon-btn:active { background: var(--surface-muted); }
.bell-badge {
  position: absolute; top: 6px; right: 6px;
  min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px;
  background: var(--brand-red); color: #fff; font-size: 10px; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--surface);
}

/* ---------- App area + body ---------- */
.appwrap { flex: 1 1 auto; min-height: 0; display: flex; flex-direction: column; }
.screen-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; }
.screen-body::-webkit-scrollbar { width: 0; height: 0; }
.pad { padding: 16px; }

/* ---------- Bottom nav ---------- */
.bottomnav {
  flex: 0 0 auto; height: 62px; display: flex;
  border-top: 1px solid var(--border); background: var(--surface);
}
.nav-item {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--text-faint); font-size: 11px; font-weight: 600; border: none; background: none; position: relative;
}
.nav-item.active { color: var(--brand-red); }
.nav-item .nbadge {
  position: absolute; top: 6px; left: calc(50% + 8px);
  min-width: 16px; height: 16px; padding: 0 3px; border-radius: 8px;
  background: var(--brand-red); color: #fff; font-size: 9px; font-weight: 800; display: grid; place-items: center;
}

/* ---------- FAB ---------- */
.fab {
  position: absolute; right: 16px; bottom: 78px; z-index: 16;
  width: 56px; height: 56px; border-radius: 18px;
  background: var(--brand-red); color: #fff; border: none;
  display: grid; place-items: center;
  box-shadow: 0 10px 26px rgba(235,30,37,0.45);
}
.fab:active { transform: scale(0.94); }

/* ---------- Cards ---------- */
.kc-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 16px; box-shadow: 0 1px 2px rgba(16,24,40,0.04);
}
.kc-card + .kc-card, .kc-card + .kc-section, .kc-section + .kc-card, .kc-section + .kc-section { margin-top: 14px; }
.kc-section {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden;
}
.kc-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px 6px;
}
.kc-section-head .sh-title { font-size: 16px; font-weight: 600; }
.kc-section-head .sh-link { font-size: 13px; font-weight: 600; color: var(--brand-red); background: none; border: none; }
.kc-section-body { padding: 4px 16px 8px; }
.label-cap { font-size: 11px; font-weight: 700; letter-spacing: 0.8px; color: var(--text-faint); text-transform: uppercase; }

.row { display: flex; align-items: center; gap: 12px; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.divider { height: 1px; background: var(--border); border: none; margin: 0; }
.tap { cursor: pointer; }
.tap:active { background: var(--surface-muted); }

/* ---------- Status chip ---------- */
.status-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px; border-radius: var(--r-pill); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.status-chip .d { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-chip.dense { font-size: 11px; padding: 3px 8px; }
.st-info    { color: var(--info);    background: var(--info-bg); }
.st-warning { color: var(--warning); background: var(--warning-bg); }
.st-success { color: var(--success); background: var(--success-bg); }
.st-danger  { color: var(--danger);  background: var(--danger-bg); }
.st-teal    { color: var(--teal);    background: rgba(13,148,136,0.12); }
.st-violet  { color: var(--violet);  background: rgba(124,58,237,0.12); }
.st-neutral { color: var(--neutral); background: var(--neutral-bg); }

.mini-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: var(--r-pill); font-size: 11px; font-weight: 600;
  background: var(--surface-muted); color: var(--text-muted); border: 1px solid var(--border);
}

/* ---------- Buttons ---------- */
.kc-btn {
  width: 100%; min-height: 50px; border-radius: var(--r-md); border: none;
  background: var(--brand-red); color: #fff; font-size: 15px; font-weight: 700; letter-spacing: 0.2px;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  transition: transform 0.1s, opacity 0.2s;
}
.kc-btn:active { transform: scale(0.985); }
.kc-btn:disabled { opacity: 0.55; }
.kc-btn.outline { background: transparent; color: var(--brand-red); border: 1.5px solid var(--brand-red); }
.kc-btn.danger { background: var(--danger); }
.kc-btn.danger-outline { background: transparent; color: var(--danger); border: 1.5px solid var(--danger); }
.kc-btn.sm { min-height: 44px; width: auto; padding: 0 18px; font-size: 14px; }
.kc-btn.ghost { background: var(--surface-muted); color: var(--text); }
.text-link { background: none; border: none; color: var(--brand-red); font-weight: 600; font-size: 14px; }

/* spinner */
.spin { width: 18px; height: 18px; border: 2.5px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.7s linear infinite; }
.kc-btn.outline .spin, .kc-btn.danger-outline .spin { border-color: rgba(235,30,37,0.35); border-top-color: var(--brand-red); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Inputs ---------- */
.field { margin-bottom: 14px; }
.field > .flabel { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; display: block; }
.field .req { color: var(--brand-red); }
.input, .select, .textarea {
  width: 100%; background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--r-md);
  padding: 13px 14px; font-size: 15px; color: var(--text); font-family: inherit; outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.textarea { resize: none; line-height: 1.45; }
.input:focus, .select:focus, .textarea:focus { border-color: var(--brand-red); box-shadow: 0 0 0 3px rgba(235,30,37,0.12); }
.input::placeholder, .textarea::placeholder { color: var(--text-faint); }
.input-wrap { position: relative; }
.input-wrap .suffix { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--text-faint); padding: 6px; }
.input.with-prefix { padding-left: 46px; }
.input-prefix { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--text-muted); font-size: 15px; font-weight: 600; }
.select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%23626B77' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 40px;
}
.counter { text-align: right; font-size: 11px; color: var(--text-faint); margin-top: 4px; }

/* ---------- Snackbar (in-phone) ---------- */
.snackbar {
  position: absolute; left: 14px; right: 14px; bottom: 16px; z-index: 25;
  background: #2b2f36; color: #fff; border-radius: var(--r-md); padding: 14px 16px; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,0.35); display: flex; align-items: center; gap: 10px;
  transform: translateY(20px); opacity: 0; transition: all 0.3s;
}
.snackbar.show { transform: none; opacity: 1; }
.snackbar .sb-ico { color: var(--brand-yellow); }

/* ---------- In-phone modal / dialog ---------- */
.sheet-scrim {
  position: absolute; inset: 0; background: rgba(0,0,0,0.4); z-index: 22;
  display: flex; align-items: flex-end; opacity: 0; transition: opacity 0.25s;
}
.sheet-scrim.show { opacity: 1; }
.dialog-scrim { align-items: center; justify-content: center; padding: 24px; }
.dialog {
  background: var(--surface); border-radius: var(--r-lg); padding: 20px; width: 100%;
  transform: scale(0.94); transition: transform 0.25s;
}
.sheet-scrim.show .dialog { transform: none; }
.dialog h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.dialog p { margin: 0 0 18px; color: var(--text-muted); font-size: 14px; line-height: 1.5; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.bottom-sheet {
  background: var(--surface); border-radius: 20px 20px 0 0; width: 100%; padding: 8px 0 18px;
  transform: translateY(20px); transition: transform 0.25s;
}
.sheet-scrim.show .bottom-sheet { transform: none; }
.bottom-sheet .grip { width: 38px; height: 4px; border-radius: 4px; background: var(--border-strong); margin: 8px auto 6px; }
.sheet-item { display: flex; align-items: center; gap: 14px; padding: 15px 20px; font-size: 15px; font-weight: 500; color: var(--text); }
.sheet-item:active { background: var(--surface-muted); }
.sheet-item .si-ico { color: var(--text-muted); }

/* ---------- In-phone notification banner ---------- */
.notif-host { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 28; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.notif-banner {
  background: rgba(255,255,255,0.92); backdrop-filter: blur(12px);
  border: 1px solid var(--border); border-radius: var(--r-lg);
  padding: 12px 14px; display: flex; gap: 12px; align-items: flex-start;
  box-shadow: 0 14px 36px rgba(16,24,40,0.22);
  transform: translateY(-130%); opacity: 0; transition: transform 0.4s cubic-bezier(0.22,0.61,0.36,1), opacity 0.4s;
}
.notif-banner.show { transform: none; opacity: 1; }
.notif-banner .nb-ico {
  flex: 0 0 auto; width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center;
  background: var(--brand-red); color: #fff;
}
.notif-banner .nb-body { flex: 1; min-width: 0; }
.notif-banner .nb-app { font-size: 11px; font-weight: 700; letter-spacing: 0.4px; color: var(--brand-red); text-transform: uppercase; }
.notif-banner .nb-title { font-size: 14px; font-weight: 700; color: var(--text); margin-top: 1px; }
.notif-banner .nb-text { font-size: 13px; color: var(--text-muted); line-height: 1.35; margin-top: 1px; }
.notif-banner .nb-time { font-size: 11px; color: var(--text-faint); white-space: nowrap; }
