/* Bàn học: the screens of an account (Đăng nhập, Tài khoản, Tủ, Nhận file, Gửi cho bạn), the file
   layer, the sheet's "Gửi và nhận file" and "Trợ lý AI đổi phòng", and the draft pages
   (dieu-khoan.html, du-lieu.html). Same tokens as app.css. The host-* classes are also in cr-scan's
   stylesheet: the pinned scan page draws "Lưu vào Tủ" and "Gửi cho bạn" with them. */

/* launchpad: the two icons of an account */
.app-icon--tu { background: var(--paper); }
.app-icon--send { background: var(--ink-3); }

/* over the member's room */
.room-change { position: absolute; top: 10px; right: 10px; z-index: 5; }

/* ---------- screens ---------- */
.acc-body { display: grid; gap: 18px; }
.acc-loading { color: var(--muted); margin: 8px 0; }
.acc-note { display: grid; gap: 12px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--ink-2); }
.acc-note p { margin: 0; color: #d8d1c4; }
.acc-note-title { margin: 0; font-family: var(--display); font-size: 1.45rem; letter-spacing: -0.02em; }
.acc-stack { display: grid; gap: 10px; }
.acc-why { margin: 0; color: var(--muted); font-size: 0.9rem; }
.acc-error { margin: 0; color: #ffb4a8; font-size: 0.92rem; }
.acc-links { margin: 0; color: var(--muted); font-size: 0.9rem; }
.acc-links a { color: var(--paper); }

/* forms */
.acc-form { display: grid; gap: 14px; }
.acc-form .lead { margin: 0; }
.acc-field { display: grid; gap: 6px; font-size: 0.92rem; color: #d8d1c4; }
.acc-input {
  width: 100%; min-height: 50px; padding: 0 14px; border: 1px solid var(--line); border-radius: 12px;
  background: var(--ink); color: var(--paper); font: inherit; font-size: 1.05rem;
}
textarea.acc-input { min-height: 96px; padding: 12px 14px; line-height: 1.45; resize: vertical; }
.acc-input:focus { outline: 2px solid var(--lamp); outline-offset: 1px; border-color: transparent; }
.acc-birth { display: grid; gap: 8px; margin: 0; padding: 0; border: 0; min-width: 0; }
.acc-birth legend { padding: 0; margin-bottom: 8px; font-weight: 600; }
.acc-birth-row { display: grid; grid-template-columns: 1fr 1fr 1.4fr; gap: 10px; }
.acc-birth-box { display: grid; gap: 4px; font-size: 0.84rem; color: var(--muted); }
.acc-birth-box .acc-input { text-align: center; font-variant-numeric: tabular-nums; }
.acc-check { display: flex; gap: 12px; align-items: flex-start; font-size: 0.94rem; color: #d8d1c4; }
.acc-check input { width: 22px; height: 22px; margin: 2px 0 0; flex: none; accent-color: var(--lamp); }
.acc-check a { color: var(--paper); }

/* Tài khoản */
.acc-profile { display: flex; align-items: center; gap: 14px; }
.acc-avatar {
  display: grid; place-items: center; width: 54px; height: 54px; flex: none; border-radius: 999px;
  background: var(--lamp); color: var(--lamp-ink); font-family: var(--display); font-weight: 700; font-size: 1.2rem;
}
.acc-avatar--sm { width: 34px; height: 34px; font-size: 0.85rem; }
.acc-name { margin: 0; font-weight: 600; font-size: 1.1rem; }
.acc-email { margin: 0; color: var(--muted); font-size: 0.9rem; word-break: break-all; }
.acc-section { display: grid; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); }
.acc-section > p { margin: 0; }
.acc-section-title { margin: 0; font-family: var(--display); font-size: 1.3rem; letter-spacing: -0.01em; }
.acc-usage { display: grid; gap: 8px; }
.acc-usage p { margin: 0; }
.meter { height: 8px; border-radius: 999px; background: var(--ink-3); overflow: hidden; }
.meter-bar { display: block; height: 100%; width: 0; border-radius: inherit; background: var(--lamp); }
.acc-switch {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 14px;
  padding: 12px 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--ink-2);
}
.acc-switch-text { display: grid; gap: 3px; }
.acc-switch-text small { color: var(--muted); font-size: 0.84rem; }
input[role="switch"] {
  appearance: none; -webkit-appearance: none; position: relative; flex: none; width: 50px; height: 30px; margin: 2px 0 0;
  border-radius: 999px; background: var(--ink-3); border: 1px solid var(--line); cursor: pointer;
  transition: background 0.2s var(--ease);
}
input[role="switch"]::before {
  content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--paper); transition: transform 0.2s var(--ease);
}
input[role="switch"]:checked { background: var(--lamp); border-color: transparent; }
input[role="switch"]:checked::before { transform: translateX(20px); background: var(--lamp-ink); }
input[role="switch"]:disabled { opacity: 0.5; }
.acc-danger { border-top-color: rgba(255, 138, 122, 0.35); }
.btn--danger { background: none; border-color: rgba(255, 138, 122, 0.55); color: #ffb4a8; }

/* ---------- Tủ ---------- */
.tu-head { display: grid; gap: 10px; }
.tu-usage { margin: 0; font-size: 0.94rem; color: #d8d1c4; }
.tu-warn { margin: 0; color: var(--lamp); font-size: 0.9rem; }
.tu-queue { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tu-queue:empty { display: none; }
.tu-up {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--ink-2); font-size: 0.9rem;
}
.tu-up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tu-up-state { color: var(--muted); font-variant-numeric: tabular-nums; }
.tu-up progress { grid-column: 1 / -1; width: 100%; height: 6px; accent-color: var(--lamp); }
.tu-up--loi { border-color: rgba(255, 138, 122, 0.45); }
.tu-up--loi .tu-up-state { grid-column: 1 / -1; color: #ffb4a8; }
.tu-up--doi .tu-up-state { grid-column: 1 / -1; }
.tu-up--xong .tu-up-state { color: var(--lamp); }
.tu-up-done { text-align: right; }
.tu-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
@media (min-width: 520px) { .tu-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.tu-file {
  display: grid; gap: 6px; width: 100%; padding: 8px; text-align: left;
  border: 1px solid var(--line); border-radius: 14px; background: var(--ink-2);
}
.tu-file:active { background: var(--ink-3); }
.tu-thumb {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; overflow: hidden;
  border-radius: 10px; background: var(--ink);
}
.tu-thumb img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.tu-badge {
  padding: 4px 10px; border-radius: 8px; background: var(--ink-3); color: var(--lamp);
  font-family: var(--display); font-weight: 700; font-size: 0.9rem; letter-spacing: 0.04em;
}
.tu-badge--big { justify-self: center; padding: 12px 20px; font-size: 1.4rem; }
.tu-name {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 0.9rem; font-weight: 500; line-height: 1.3; word-break: break-word;
}
.tu-meta { color: var(--muted); font-size: 0.78rem; }
.tu-empty { margin: 0; color: var(--muted); }

/* ---------- one file of Tủ, full screen ---------- */
body.is-file { overflow: hidden; }
.file-layer {
  position: fixed; inset: 0; z-index: 42; display: flex; flex-direction: column;
  background: var(--ink); padding: env(safe-area-inset-top, 0px) 0 var(--safe-b);
}
.file-bar { display: flex; align-items: center; gap: 6px; width: 100%; max-width: 640px; margin: 0 auto; padding: 6px 12px; }
.file-title { flex: 1; min-width: 0; margin: 0; font-size: 1rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-body { flex: 1; min-height: 0; overflow: auto; display: grid; place-items: center; padding: 8px 16px; }
.file-img { display: block; max-width: 100%; max-height: 100%; border-radius: 8px; }
.file-text {
  align-self: start; justify-self: stretch; width: 100%; max-width: 640px; margin: 0 auto; padding: 14px;
  border-radius: 12px; background: var(--ink-2); white-space: pre-wrap; word-break: break-word;
  font: 0.92rem/1.5 ui-monospace, Menlo, Consolas, monospace; color: var(--paper);
}
.file-pdf { display: grid; gap: 12px; width: 100%; max-width: 420px; text-align: center; }
.file-pdf p { margin: 0; word-break: break-all; }
.file-note { margin: 0; color: #d8d1c4; text-align: center; max-width: 26em; }
.file-actions { display: grid; gap: 10px; width: 100%; max-width: 640px; margin: 0 auto; padding: 10px 16px 14px; }
.file-row { display: flex; flex-wrap: wrap; gap: 8px; }
.file-row .btn { flex: 1 1 auto; min-height: 46px; padding: 0.6em 1em; }
a.btn { text-decoration: none; }

/* ---------- sending and receiving ---------- */
.send-file { margin: 0; color: #d8d1c4; word-break: break-word; }
.send-code {
  margin: 0; font-family: var(--display); font-weight: 700; font-size: clamp(2.6rem, 13vw, 3.4rem);
  letter-spacing: 0.08em; line-height: 1; color: var(--lamp); font-variant-numeric: tabular-nums;
}
.send-left { margin: 0; color: var(--muted); }
.send-qr { display: grid; justify-items: center; gap: 8px; margin: 4px 0; }
.send-qr figcaption { color: var(--muted); font-size: 0.86rem; text-align: center; }
.qr { display: block; width: min(240px, 70vw); height: auto; border-radius: 10px; }
.qr-paper { fill: #fff; }
.qr-ink { fill: #000; }
.send-link { margin: 0; color: var(--muted); font-size: 0.86rem; word-break: break-all; -webkit-user-select: all; user-select: all; }
.send-card { display: grid; gap: 8px; padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--ink-2); }
.send-card p { margin: 0; }
.send-from { display: flex; align-items: center; gap: 10px; color: #d8d1c4; }
.send-file-name { font-weight: 600; font-size: 1.1rem; word-break: break-word; }
.send-subtitle { margin: 6px 0 0; font-size: 1rem; font-weight: 600; }
.send-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.send-item {
  display: flex; align-items: center; gap: 8px; padding: 10px 12px;
  border: 1px solid var(--line); border-radius: 12px; background: var(--ink);
}
.send-item-text { flex: 1; min-width: 0; display: grid; gap: 2px; }
.send-item-text b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.send-item-text small { color: var(--muted); font-size: 0.84rem; font-variant-numeric: tabular-nums; }
.send-receive-row { display: flex; gap: 8px; }
.send-input { text-transform: uppercase; letter-spacing: 0.12em; font-variant-numeric: tabular-nums; }

/* the sheet holds lists now: it scrolls inside when they are long */
.sheet-panel { max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.sheet-body { display: grid; gap: 14px; }

/* Trợ lý AI đổi phòng */
.prompt-meta { display: flex; justify-content: space-between; gap: 12px; margin: 0; color: var(--muted); font-size: 0.86rem; }
.prompt-count { flex: none; font-variant-numeric: tabular-nums; }

/* ---------- done screens: Lưu vào Tủ, Gửi cho bạn (same classes in cr-scan) ---------- */
.host-ask:empty { display: none; }
.host-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.host-row .btn { padding-left: 0.8em; padding-right: 0.8em; }
.host-note { margin: 0; color: var(--muted); font-size: 0.88rem; overflow-wrap: anywhere; }
.host-note:empty { display: none; }
.host-link { justify-self: start; }
.host-card { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: var(--ink); }
.host-card p { margin: 0; color: #d8d1c4; font-size: 0.94rem; }
.host-card .host-card-title { color: var(--paper); font-weight: 600; font-size: 1rem; }
.host-card:focus { outline: none; }
/* an end of a card purchase drawn in place of its transfer screen takes the focus to be read out, like a view title */
.acc-note[tabindex="-1"]:focus, .acc-note-title[tabindex="-1"]:focus { outline: none; }
.host-error { margin: 0; color: #ffb4a8; font-size: 0.9rem; }

/* ---------- the draft pages ---------- */
.doc { width: 100%; max-width: 680px; margin: 0 auto; padding: 8px 20px 48px; }
.doc h1 { font-family: var(--display); font-size: clamp(2rem, 8vw, 2.6rem); line-height: 1.05; letter-spacing: -0.02em; margin: 14px 0 12px; }
.doc h2 { font-family: var(--display); font-size: 1.35rem; letter-spacing: -0.01em; margin: 28px 0 8px; }
.doc p, .doc li { color: #d8d1c4; }
.doc ul { padding-left: 1.2em; }
.doc li { margin: 4px 0; }
.doc a { color: var(--paper); }
.doc-draft {
  margin: 0 0 18px; padding: 10px 14px; border-radius: 12px;
  background: rgba(242, 193, 78, 0.12); color: var(--lamp); font-size: 0.92rem;
}
.doc-todo { color: var(--lamp); font-weight: 600; }

/* Thẻ hội viên: the offer, the cards, the transfer (QR, bank fields with a copy button each) */
.card-fake {
  margin: 0; padding: 8px 12px; border: 1px dashed var(--lamp); border-radius: 10px;
  color: var(--lamp); font-weight: 700; font-size: 0.86rem; letter-spacing: 0.04em; text-align: center;
}
.card-offer { display: grid; gap: 10px; padding: 18px; border: 1px solid var(--line); border-radius: var(--r); background: var(--ink-2); }
.card-offer p { margin: 0; color: #d8d1c4; }
.card-title { margin: 0; font-family: var(--display); font-size: 1.45rem; letter-spacing: -0.02em; overflow-wrap: anywhere; }
.card-offer .card-price { color: var(--paper); font-weight: 600; font-size: 1.05rem; }
.card-offer .card-running { color: var(--lamp); }
.card-offer .acc-error { color: #ffb4a8; }
.card-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.card-item { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--ink-2); }
.card-item b { letter-spacing: 0.04em; }
.card-item span { color: var(--muted); font-size: 0.88rem; }
.card-hold { margin: 0; color: var(--lamp); font-weight: 600; font-variant-numeric: tabular-nums; }
.card-pay { display: grid; gap: 14px; }
.card-pay > p { margin: 0; }
.card-qr .qr { width: min(280px, 76vw); }
.card-qr .btn { width: 100%; max-width: 380px; }
.card-qr .hint-small { margin: 0; text-align: center; }
.card-noqr { margin: 0; color: #d8d1c4; }
.card-rows { margin: 0; display: grid; gap: 8px; }
.card-row { display: grid; gap: 2px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; background: var(--ink-2); }
.card-row dt { color: var(--muted); font-size: 0.82rem; }
.card-row dd { margin: 0; display: flex; align-items: center; gap: 10px; }
.card-value { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; font-variant-numeric: tabular-nums; -webkit-user-select: all; user-select: all; }
.card-row .btn { flex: none; }
.acc-warn { margin: 0; color: var(--lamp); font-size: 0.92rem; }
.tu-up-card { display: grid; }
