:root {
  --bg: #eef4ff;
  --surface: rgba(255,255,255,.92);
  --text: #172033;
  --muted: #7b8497;
  --line: rgba(24,39,75,.08);
  --primary: #1677ff;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background: radial-gradient(circle at top, #dbeafe 0, #eef4ff 38%, #f8fafc 100%);
  color: var(--text);
}

body {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.phone-shell {
  width: min(100%, 420px);
  min-height: min(860px, calc(100dvh - 32px));
  position: relative;
  overflow: hidden;
  border: 8px solid #111827;
  border-radius: 38px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(248,250,252,.98)),
    radial-gradient(circle at 50% 0%, #dbeafe, transparent 45%);
  box-shadow: 0 30px 90px rgba(15,23,42,.28);
  padding-bottom: 92px;
}

.phone-shell::before {
  content: "";
  position: absolute;
  top: 8px;
  left: 50%;
  width: 112px;
  height: 28px;
  transform: translateX(-50%);
  border-radius: 18px;
  background: #111827;
  z-index: 5;
}

.status-bar {
  height: 46px;
  padding: 12px 18px 0;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  font-size: 12px;
  font-weight: 700;
}

.status-icons { display: flex; gap: 7px; color: #2f3a4f; }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 22px 12px;
}

.eyebrow {
  margin: 0 0 5px;
  font-size: 10px;
  letter-spacing: .14em;
  color: var(--primary);
  font-weight: 800;
}

h1 {
  margin: 0;
  font-size: 25px;
  letter-spacing: -.4px;
}

.profile-dot {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 15px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #1677ff, #62a7ff);
  box-shadow: 0 10px 24px rgba(22,119,255,.28);
}

.search-wrap { padding: 0 20px 14px; }
.search-box {
  height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  background: rgba(255,255,255,.9);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(15,23,42,.06);
}
.search-box span { color: var(--muted); font-size: 20px; }
.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  font-size: 14px;
  color: var(--text);
}
.search-box input::placeholder { color: #a7afbf; }

.app-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 20px 10px;
  padding: 8px 18px 20px;
}

.app-card {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  color: var(--text);
  text-align: center;
  transition: transform .18s ease, opacity .18s ease;
}

.app-card:hover { transform: translateY(-3px); }
.app-card:active { transform: scale(.94); }
.app-card.hidden { display: none; }

.app-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  color: #fff;
  font-size: 22px;
  font-weight: 900;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.32), 0 10px 22px rgba(15,23,42,.15);
}

.app-name {
  width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 11px;
  font-weight: 700;
}

.icon-blue { background: linear-gradient(135deg,#1877f2,#58a0ff); }
.icon-pink { background: linear-gradient(135deg,#ff3d8d,#a239ff); }
.icon-cyan { background: linear-gradient(135deg,#00a8ff,#2563eb); }
.icon-black { background: linear-gradient(135deg,#111827,#000); }
.icon-sky { background: linear-gradient(135deg,#0ea5e9,#38bdf8); }
.icon-green { background: linear-gradient(135deg,#16a34a,#34d058); }
.icon-teal { background: linear-gradient(135deg,#0891b2,#22d3ee); }
.icon-yellow { background: linear-gradient(135deg,#f5b700,#ffd84d); color:#5c4300; }
.icon-blue2 { background: linear-gradient(135deg,#229ed9,#60c9f4); }
.icon-lightblue { background: linear-gradient(135deg,#4bb8ff,#8dd7ff); }
.icon-red { background: linear-gradient(135deg,#ff1f2d,#e60012); }
.icon-purple { background: linear-gradient(135deg,#6d5dfc,#9b8cff); }
.icon-lime { background: linear-gradient(135deg,#06c755,#4ce07f); }
.icon-crimson { background: linear-gradient(135deg,#e60023,#ff4d6a); }
.icon-map { background: linear-gradient(135deg,#34a853,#fbbc05 45%,#ea4335); }
.icon-mail { background: linear-gradient(135deg,#ef4444,#fca5a5); }
.icon-darkgreen { background: linear-gradient(135deg,#078a2f,#16a34a); }
.icon-violet { background: linear-gradient(135deg,#665cac,#9f8cdf); }
.icon-gray { background: linear-gradient(135deg,#475569,#94a3b8); }
.icon-other { background: linear-gradient(135deg,#2563eb,#14b8a6); }

.disclaimer {
  padding: 0 24px 20px;
  text-align: center;
  color: #98a1b3;
  font-size: 10px;
  line-height: 1.45;
}

.dock {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 12px;
  height: 68px;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: center;
  padding: 7px;
  border: 1px solid rgba(255,255,255,.75);
  border-radius: 23px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 40px rgba(15,23,42,.16);
}

.dock-item {
  border: 0;
  background: transparent;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  color: #9aa3b5;
  cursor: pointer;
}
.dock-item span { font-size: 20px; }
.dock-item small { font-size: 9px; font-weight: 700; }
.dock-item.active { color: var(--primary); }

@media (max-width: 480px) {
  body { padding: 0; background: #fff; }
  .phone-shell {
    width: 100%;
    min-height: 100dvh;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }
  .phone-shell::before { display: none; }
  .status-bar { padding-top: max(12px, env(safe-area-inset-top)); height: calc(44px + env(safe-area-inset-top)); }
  .dock { bottom: max(10px, env(safe-area-inset-bottom)); }
}

@media (max-width: 360px) {
  .app-grid { gap: 17px 7px; padding-left: 12px; padding-right: 12px; }
  .app-icon { width: 52px; height: 52px; border-radius: 16px; }
  .app-name { font-size: 10px; }
}

/* Fix kích thước ảnh biểu tượng ứng dụng */
.app-icon {
  overflow: hidden;
  background: #fff;
}

.app-icon img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
  border-radius: inherit;
}

/* Hộp nhập mã */
.code-modal[hidden] {
  display: none;
}

.code-modal {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 20px;
}

.code-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(5px);
}

.code-dialog {
  position: relative;
  z-index: 1;
  width: min(100%, 340px);
  padding: 28px 22px 22px;
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 26px 80px rgba(15, 23, 42, 0.35);
  text-align: center;
}

.code-close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: #f1f5f9;
  color: #64748b;
  font-size: 22px;
  cursor: pointer;
}

.code-lock {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: #eaf2ff;
  font-size: 28px;
}

.code-dialog h2 {
  margin: 0 0 8px;
  font-size: 21px;
}

.code-dialog > p {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.code-field {
  display: block;
  text-align: left;
}

.code-field span {
  display: block;
  margin-bottom: 7px;
  font-size: 12px;
  font-weight: 700;
}

.code-field input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid #dbe3ef;
  border-radius: 14px;
  outline: 0;
  font-size: 15px;
}

.code-field input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(22, 119, 255, 0.12);
}

.code-error {
  min-height: 20px;
  margin: 8px 0 10px !important;
  color: #dc2626 !important;
  font-size: 12px !important;
  text-align: left;
}

.code-submit {
  width: 100%;
  height: 48px;
  border: 0;
  border-radius: 14px;
  background: linear-gradient(135deg, #1677ff, #4f9cff);
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.modal-open {
  overflow: hidden;
}
