/* PAXU base styles — brand: #00609C (deep blue), #00ABC8 (cyan), #B5DC79 (green). */
:root {
  --blue: #00609C;
  --cyan: #00ABC8;
  --green: #B5DC79;
  --primary: #50B3CA;       /* main action buttons, from the app design */
  --primary-hover: #3FA0B7;
  --ink: #12304a;
  --muted: #4d6478;
  --bg: #ffffff;
  --surface: #f2f7fa;
  --line: #d6e3ec;
  --radius: 14px;
  --font-head: "Montserrat", "Segoe UI", system-ui, sans-serif;
  --font-body: "Source Sans 3", "Segoe UI", system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink: #e7f0f6;
    --muted: #a7bccb;
    --bg: #0d1c28;
    --surface: #132a3b;
    --line: #23415a;
  }
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
  background: var(--bg);
  color: var(--ink);
  font: 400 1.0625rem/1.55 var(--font-body);
}

h1, h2, h3 { font-family: var(--font-head); line-height: 1.2; margin: 0 0 .5em; }

a { color: var(--blue); }

:focus-visible { outline: 3px solid var(--cyan); outline-offset: 2px; }

.content {
  max-width: 40rem;
  margin: 0 auto;
  padding: 1.5rem 1.25rem 3rem;
}

/* --- Home (main page) --- */
body.home {
  background: linear-gradient(180deg, #BCE77E 0%, #93DE92 33%, #5FD4A9 65%, #1BC7C7 100%) fixed;
  color: #fff;
}
.home .content { max-width: 28rem; padding: 0 1.25rem; }
.home-page {
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  min-height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
}

.home-header { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; }
.icon-button {
  display: grid;
  place-items: center;
  width: 3rem;
  height: 3rem;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
}

/* --- Navigation drawer (modal <dialog> sliding in from the left) --- */
.drawer {
  position: fixed;
  inset: 0 auto 0 0;
  width: min(78vw, 22rem);
  max-width: none;
  height: 100%;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0 22px 22px 0;
  background: linear-gradient(180deg, #B6DC79 0%, #8ED48C 25%, #63CA9F 50%, #37C1B4 75%, #0CB8C6 100%);
  color: #fff;
  overflow-y: auto;
}
.drawer::backdrop { background: rgba(0, 0, 0, .6); }
.drawer[open] { animation: drawer-in .22s ease-out; }
@keyframes drawer-in { from { transform: translateX(-100%); } }

.drawer-inner {
  min-height: 100%;
  padding: calc(env(safe-area-inset-top, 0px) + 4.5rem) 1.5rem calc(env(safe-area-inset-bottom, 0px) + 2rem);
}
.drawer-profile { display: flex; align-items: center; gap: 1.5rem; margin-bottom: 2.75rem; }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 6.5rem;
  height: 6.5rem;
  border-radius: 50%;
  background: rgba(255, 255, 255, .3);
  font: 700 2.5rem var(--font-head);
}
.drawer-username { min-width: 0; overflow-wrap: anywhere; font: 700 1.2rem var(--font-head); }

.drawer-menu { margin: 0; padding: 0; list-style: none; border-top: 1px solid rgba(255, 255, 255, .85); }
.drawer-menu li { border-bottom: 1px solid rgba(255, 255, 255, .85); }
.drawer-menu a,
.drawer-menu button {
  display: block;
  width: 100%;
  padding: 1.3rem 0;
  border: 0;
  background: transparent;
  color: #fff;
  font: 400 1.15rem var(--font-head);
  letter-spacing: .03em;
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.drawer-menu a:hover,
.drawer-menu button:hover { text-decoration: underline; text-underline-offset: .25em; }
img.avatar { object-fit: cover; }

/* --- Inner pages: light header with back button, tabs --- */
.page .content { max-width: none; padding: 0; }
.page-header {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  padding: 1.75rem 1.5rem;
  background: #EBF5FE;
}
.page-header h1 { margin: 0; color: #01B5CC; font: 700 1.3rem var(--font-head); letter-spacing: .02em; text-transform: uppercase; }
.back-button {
  display: grid;
  place-items: center;
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: #16B8C3;
  color: #fff;
}

.tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 2rem; border: 2px solid #C1C0C8; border-width: 2px 0; }
.tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .4rem;
  min-height: 4.5rem;
  padding: .5rem;
  background: #fff;
  color: #01B5CC;
  font: 700 clamp(.8rem, 3.6vw, 1rem)/1.25 var(--font-head);
  text-transform: uppercase;
  text-decoration: none;
}
.tab + .tab { border-left: 2px solid #C1C0C8; }
.tab svg { flex: none; width: 1.6rem; height: 1.6rem; }
.tab.is-active { background: #01B5CC; color: #fff; }

.page-body { max-width: 32rem; margin: 0 auto; padding: 2.5rem 1.25rem 3rem; }
.notice { margin: -1rem 0 1.5rem; padding: .75rem 1rem; border-radius: 8px; background: #E3F7F2; color: #146C55; font-weight: 600; }

/* --- Profile form --- */
.profile-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
  border: 1.5px solid #29A2B3;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
}
.profile-photo {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 35%;
  aspect-ratio: 6 / 5;
  background: #E6F7F9;
}
.profile-photo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.profile-initial { color: #01B5CC; font: 700 2.5rem var(--font-head); }
.photo-badge {
  position: absolute;
  right: .4rem;
  bottom: .4rem;
  display: grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  background: rgba(0, 0, 0, .55);
  color: #fff;
}
.profile-username { min-width: 0; overflow-wrap: anywhere; color: #01B5CC; font: 700 1.2rem var(--font-head); }

.profile-row { display: grid; grid-template-columns: 38% 1fr; align-items: end; gap: 1rem; margin-top: 1.4rem; }
.profile-row label,
.profile-label,
.profile-gender legend { padding-bottom: .4rem; color: #0072AB; font: 700 1.1rem/1.3 var(--font-head); }
.profile-row input,
.profile-readonly {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: .4rem 0;
  border: 0;
  border-bottom: 1.5px solid #969696;
  border-radius: 0;
  background: transparent;
  color: #266183;
  font: 400 1.1rem var(--font-head);
}
.profile-row input::placeholder { color: #C8C8CA; }
.profile-row input[type="number"] { appearance: textfield; -moz-appearance: textfield; }
.profile-row input[type="number"]::-webkit-inner-spin-button,
.profile-row input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.profile-row input:focus { outline: none; border-bottom-color: #01B5CC; }
.profile-readonly { line-height: 1.9; }

.profile-gender { margin: 1.6rem 0 0; padding: 0; border: 0; }
.profile-gender legend { padding: 0 0 1.1rem; }
.segmented { display: grid; grid-template-columns: repeat(3, 1fr); border: 2px solid #C1C0C8; }
.segmented label { position: relative; cursor: pointer; }
.segmented label + label { border-left: 2px solid #C1C0C8; }
.segmented input { position: absolute; opacity: 0; }
.segmented span {
  display: grid;
  place-items: center;
  min-height: 4.5rem;
  color: #111;
  font: 700 1.15rem var(--font-head);
}
.segmented input:checked + span { background: #01B5CC; color: #fff; }
.segmented input:focus-visible + span { outline: 3px solid var(--cyan); outline-offset: -5px; }

.profile-form .btn-save {
  margin-top: 2.5rem;
  min-height: 3.25rem;
  background: var(--primary);
  color: #fff;
  font: 700 1.125rem var(--font-head);
  letter-spacing: .04em;
  text-transform: uppercase;
}
.profile-form .btn-save:hover { background: var(--primary-hover); }

.drawer-version { margin: .75rem 0 0; text-align: center; font: 400 1rem var(--font-head); letter-spacing: .03em; }

.home-brand { text-align: center; margin: .25rem 0 1.75rem; }
.home-brand img { display: block; width: 4.5rem; height: auto; margin: 0 auto; filter: brightness(0) invert(1); }
.home-brand h1 { margin: .25rem 0 0; font: 600 1rem var(--font-head); letter-spacing: .12em; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 1.4rem; }
.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: .5rem;
  min-height: 9.4rem;
  padding: 1rem .5rem;
  border-radius: 8px;
  background: #fff;
  color: #17BFC6;
  font: 700 1.05rem/1.35 var(--font-head);
  text-align: center;
  text-decoration: none;
  box-shadow: 0 2px 10px rgba(0, 90, 90, .08);
}
.tile svg {
  width: 3.75rem;
  height: 3.75rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
a.tile:hover { box-shadow: 0 4px 16px rgba(0, 90, 90, .18); }
.tile-disabled { background: rgba(255, 255, 255, .45); color: #3CBFB4; box-shadow: none; }

.support { margin-top: auto; padding: 2.5rem 0 1.5rem; text-align: center; }
.support p { display: flex; justify-content: center; align-items: center; gap: .4rem; margin: 0; font: 600 .95rem var(--font-head); }
.zalo { display: inline-flex; }
.support-phone { color: #fff; font: 700 1.3rem var(--font-head); text-decoration: none; letter-spacing: .02em; }

.btn {
  display: inline-block;
  min-height: 44px;
  padding: .6rem 1.2rem;
  border: 0;
  border-radius: 999px;
  font: 600 1rem var(--font-body);
  cursor: pointer;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-ghost { background: transparent; color: var(--ink); }

.btn-block { display: block; width: 100%; }

.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

/* --- Login / register --- */
.auth { max-width: 26rem; margin: 0 auto; text-align: center; }
.auth-logo { display: block; width: 9rem; height: auto; margin: .5rem auto 1.5rem; }
.auth form { text-align: left; }
.auth .btn-block {
  background: var(--primary);
  color: #fff;
  margin-top: 2rem;
  min-height: 3.25rem;
  font: 700 1.125rem var(--font-head);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.auth .btn-block:hover { background: var(--primary-hover); }

/* Login start screen: two login choices, then register. */
.auth-choice { display: flex; flex-direction: column; min-height: 80vh; min-height: 80dvh; }
.auth-choice .auth-logo { width: 11rem; margin: 3rem auto 4.5rem; }
.choice-buttons { display: grid; gap: 1rem; }
.btn-choice {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  min-height: 3.5rem;
  padding: .6rem 1.25rem;
  border: 1.5px solid transparent;
  font: 700 clamp(.95rem, 4.2vw, 1.15rem)/1.2 var(--font-head);
  letter-spacing: .02em;
  text-transform: uppercase;
  text-decoration: none;
}
.btn-choice svg { flex: none; width: 1.6rem; height: 1.6rem; }
.btn-choice-phone { background: #02B4CE; color: #fff; }
.btn-choice-account { background: #0071AD; color: #fff; }
.btn-choice-register { margin-top: 5rem; border-color: #38A6A7; background: transparent; color: #1FA9B4; }
.btn-choice-phone:hover { background: #029FB6; }
.btn-choice-account:hover { background: #00639A; }
.btn-choice-register:hover { background: rgba(56, 166, 167, .08); }

.field {
  display: flex;
  align-items: center;
  gap: .75rem;
  border-bottom: 1px solid var(--line);
  padding: .25rem 0;
}
.field:focus-within { border-bottom-color: var(--cyan); }
.field-invalid { border-bottom-color: #c62828; }
.field-icon { flex: none; width: 1.75rem; height: 1.75rem; color: var(--cyan); }
.field-icon svg, .field-toggle svg { display: block; width: 100%; height: 100%; }
.field-prefix { flex: none; font-size: 1.125rem; }
.field input {
  flex: 1;
  min-width: 0;
  min-height: 3rem;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: 400 1.125rem var(--font-body);
}
.field input::placeholder { color: var(--muted); opacity: .8; }
.field input:focus { outline: none; }
.field-toggle {
  flex: none;
  width: 2.75rem;
  height: 2.75rem;
  padding: .45rem;
  border: 0;
  background: transparent;
  color: var(--cyan);
  cursor: pointer;
}
.field-toggle[aria-pressed="true"] { color: var(--blue); }

.errorlist { margin: .35rem 0 0; padding: 0; list-style: none; color: #c62828; font-size: .95rem; }
@media (prefers-color-scheme: dark) { .errorlist { color: #ff8a80; } }
.errorlist.nonfield { margin-bottom: .75rem; }

.auth-switch {
  display: inline-block;
  margin-top: 1.75rem;
  color: var(--ink);
  font: 400 1rem var(--font-head);
  text-transform: uppercase;
}

.install {
  position: fixed;
  left: 1rem;
  right: 1rem;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 1rem);
  max-width: 28rem;
  margin: 0 auto;
  padding: 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  box-shadow: 0 8px 30px rgba(0, 40, 70, .18);
}
.install p { margin: 0 0 .75rem; }
.install-actions { display: flex; gap: .5rem; }

@media (prefers-reduced-motion: reduce) {
  * { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}
