/* GameF — giao diện chung cho /tai-khoan/, /thu/ (GameF Mail), /quan-tri/ */
:root {
  --nen: #f3f5fb; --mat: #ffffff; --mat2: #eef1fa; --vien: #dfe4f1;
  --chu: #0f1a33; --phu: #5b6787; --nhan: #4f46e5; --nhan-nhat: #e8e7ff; --nhan-chu: #ffffff;
  --do: #d93838; --vang: #a86a00; --vang-nen: #fff6df; --xanh: #0f8a5f;
  --bo: 12px; --bong: 0 8px 30px rgba(15, 26, 51, .12);
  --font: "Be Vietnam Pro", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --nen: #0e111a; --mat: #161a26; --mat2: #1e2333; --vien: #2a3045;
    --chu: #e8ebf5; --phu: #97a0bb; --nhan: #8b84ff; --nhan-nhat: #2a2752; --nhan-chu: #0e111a;
    --do: #ff6b6b; --vang: #ffc861; --vang-nen: #33290f; --xanh: #4fd1a1;
    --bong: 0 8px 30px rgba(0, 0, 0, .5); color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --nen: #0e111a; --mat: #161a26; --mat2: #1e2333; --vien: #2a3045;
  --chu: #e8ebf5; --phu: #97a0bb; --nhan: #8b84ff; --nhan-nhat: #2a2752; --nhan-chu: #0e111a;
  --do: #ff6b6b; --vang: #ffc861; --vang-nen: #33290f; --xanh: #4fd1a1;
  --bong: 0 8px 30px rgba(0, 0, 0, .5); color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--nen); color: var(--chu); font: 14px/1.5 var(--font); }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea {
  background: var(--mat); border: 1px solid var(--vien); border-radius: 8px; padding: 8px 10px; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--nhan); outline-offset: -1px; border-color: transparent; }
label { display: grid; gap: 4px; font-weight: 500; color: var(--phu); font-size: 13px; }
.phu { color: var(--phu); font-size: 13px; margin: 0; }
.loi { color: var(--do); min-height: 1.5em; margin: 0; }

.nut { border: 0; border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 600; white-space: nowrap; }
.nut.chinh { background: var(--nhan); color: var(--nhan-chu); }
.nut.chinh:disabled { opacity: .6; cursor: progress; }
.nut.nhe { background: var(--mat2); color: var(--chu); }
.nut.nhe:hover { background: var(--nhan-nhat); }
.nut.rong { width: 100%; }
.nut.nguy { background: transparent; color: var(--do); padding: 4px 8px; }
.nut-icon { border: 0; background: transparent; width: 36px; height: 36px; border-radius: 8px; cursor: pointer; font-size: 17px; flex: none; }
.nut-icon:hover { background: var(--mat2); }
.nut-chu { border: 0; background: none; color: var(--nhan); font-weight: 600; cursor: pointer; padding: 0; }

/* Đăng nhập */
.dang-nhap { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.the-dang-nhap { background: var(--mat); padding: 32px; border-radius: 18px; box-shadow: var(--bong); width: min(380px, 100%); display: grid; gap: 14px; text-align: center; }
.the-dang-nhap img { margin: 0 auto; border-radius: 14px; }
.the-dang-nhap h1 { margin: 0; font-size: 24px; }
.the-dang-nhap label { text-align: left; }

/* Khung ứng dụng */
.ung-dung {
  height: 100%; display: grid; grid-template-columns: 232px minmax(280px, 380px) 1fr;
  grid-template-rows: 56px 1fr; grid-template-areas: "tren tren tren" "ben ds doc";
}
.thanh-tren { grid-area: tren; display: flex; align-items: center; gap: 12px; padding: 0 16px; background: var(--mat); border-bottom: 1px solid var(--vien); }
.thuong-hieu { display: flex; align-items: center; gap: 8px; color: var(--chu); text-decoration: none; font-size: 17px; white-space: nowrap; }
.thuong-hieu img { border-radius: 7px; }
.tim { flex: 1; max-width: 560px; }
.tim input { background: var(--mat2); border-color: transparent; }

.ben { grid-area: ben; padding: 14px 10px; display: flex; flex-direction: column; gap: 6px; overflow: auto; background: var(--nen); }
.muc { display: grid; gap: 2px; }
.muc button {
  display: flex; align-items: center; gap: 8px; border: 0; background: none; text-align: left; padding: 7px 12px;
  border-radius: 8px; cursor: pointer; color: var(--chu); min-width: 0;
}
.muc button span.ten { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.muc button:hover { background: var(--mat2); }
.muc button.dang-chon { background: var(--nhan-nhat); color: var(--nhan); font-weight: 600; }
.dem { margin-left: auto; font-size: 12px; font-weight: 700; }
.tieu-de-ben { font-size: 12px; font-weight: 700; color: var(--phu); text-transform: uppercase; letter-spacing: .04em; padding: 12px 12px 2px; }
#nut-soan { margin-bottom: 8px; padding: 11px; }
#nut-quan-tri { margin-top: auto; text-align: center; text-decoration: none; white-space: normal; }

.cot-ds { grid-area: ds; background: var(--mat); border-left: 1px solid var(--vien); border-right: 1px solid var(--vien); overflow: auto; display: flex; flex-direction: column; }
.dau-cot { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px 10px 16px; border-bottom: 1px solid var(--vien); position: sticky; top: 0; background: var(--mat); z-index: 1; }
.dau-cot h2 { margin: 0; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-thu { list-style: none; margin: 0; padding: 0; }
.ds-thu li { padding: 10px 16px; border-bottom: 1px solid var(--vien); cursor: pointer; display: grid; gap: 1px; }
.ds-thu li:hover { background: var(--mat2); }
.ds-thu li.dang-chon { background: var(--nhan-nhat); }
.ds-thu li.chua-doc .nguoi, .ds-thu li.chua-doc .chu-de { font-weight: 700; color: var(--chu); }
.ds-thu .dong1 { display: flex; gap: 8px; align-items: baseline; }
.ds-thu .nguoi { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--chu); }
.ds-thu .gio { font-size: 12px; color: var(--phu); flex: none; }
.ds-thu .chu-de, .ds-thu .tom-tat { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ds-thu .tom-tat { color: var(--phu); font-size: 13px; }
.ds-thu .rong-ds { color: var(--phu); text-align: center; padding: 40px 16px; cursor: default; }
.ds-thu .rong-ds:hover { background: none; }
#nut-them { margin: 12px auto; width: calc(100% - 32px); }

.cot-doc { grid-area: doc; overflow: auto; background: var(--mat); }
.trong { height: 100%; display: grid; place-items: center; color: var(--phu); }
#doc-thu { padding: 8px 24px 24px; display: flex; flex-direction: column; gap: 10px; min-height: 100%; }
.cong-cu { display: flex; align-items: center; gap: 6px; position: sticky; top: 0; background: var(--mat); padding: 6px 0; flex-wrap: wrap; }
.cong-cu .gian { flex: 1; }
#doc-chu-de { margin: 4px 0 0; font-size: 21px; line-height: 1.3; overflow-wrap: anywhere; }
.thong-tin { color: var(--phu); font-size: 13px; display: grid; gap: 2px; overflow-wrap: anywhere; }
.thong-tin b { color: var(--chu); }
.huy-hieu { display: inline-block; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 99px; background: var(--mat2); margin-left: 6px; }
.huy-hieu.tot { color: var(--xanh); } .huy-hieu.xau { color: var(--do); }
.canh-bao { background: var(--vang-nen); color: var(--vang); padding: 8px 12px; border-radius: 8px; font-size: 13px; }
.ds-tep { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.ds-tep a, .ds-tep span { display: inline-flex; gap: 6px; align-items: center; padding: 6px 10px; border: 1px solid var(--vien); border-radius: 8px; color: var(--chu); text-decoration: none; font-size: 13px; max-width: 100%; overflow-wrap: anywhere; }
.ds-tep a:hover { border-color: var(--nhan); }
#doc-html { width: 100%; flex: 1; min-height: 420px; border: 0; border-radius: 8px; background: #fff; }
.van-ban { white-space: pre-wrap; overflow-wrap: anywhere; font: 14px/1.6 var(--font); margin: 0; }

/* Hộp thoại */
.hop { border: 0; border-radius: 16px; padding: 0; width: min(640px, calc(100vw - 32px)); max-height: calc(100vh - 32px); background: var(--mat); color: var(--chu); box-shadow: var(--bong); }
.hop.rong { width: min(860px, calc(100vw - 32px)); padding: 0 20px 20px; }
.hop::backdrop { background: rgba(10, 14, 25, .45); }
.hop form { display: grid; gap: 10px; padding: 0 20px 20px; }
.dau-hop { display: flex; align-items: center; justify-content: space-between; padding-top: 12px; }
.dau-hop h2 { margin: 0; font-size: 18px; }
.hop textarea { resize: vertical; min-height: 200px; }
.chan-hop { display: flex; justify-content: flex-end; }
.tao-hop { grid-template-columns: 1.3fr 1fr 1fr auto; align-items: center; padding: 8px 0 !important; }
.o-dia-chi { display: flex; align-items: center; gap: 4px; }
.o-dia-chi span { color: var(--phu); }
.bang { width: 100%; border-collapse: collapse; margin-top: 10px; font-size: 13px; }
.bang th { text-align: left; color: var(--phu); font-weight: 600; padding: 6px; border-bottom: 1px solid var(--vien); }
.bang td { padding: 6px; border-bottom: 1px solid var(--vien); vertical-align: middle; }
.bang td:first-child { font-weight: 600; overflow-wrap: anywhere; }
.bang input[type="checkbox"] { width: auto; }
.mac-dinh { margin-top: 14px; max-width: 420px; }

.thong-bao {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); opacity: 0; pointer-events: none;
  background: var(--chu); color: var(--mat); padding: 10px 16px; border-radius: 10px; transition: .2s; max-width: calc(100vw - 32px); z-index: 9;
}
.thong-bao.hien { opacity: 1; transform: translateX(-50%); }
.man-che, .chi-dt { display: none; }

/* Chip tài khoản trên thanh trên */
.chip-tk { display: inline-flex; align-items: center; gap: 8px; padding: 3px 12px 3px 3px; border-radius: 99px; background: var(--mat2); color: var(--chu); text-decoration: none; font-weight: 600; max-width: 200px; flex: none; }
.chip-tk img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; background: var(--mat); }
.chip-tk span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thanh-tren.don { height: 56px; position: sticky; top: 0; z-index: 3; }
.gian { flex: 1; }
a.nut { text-decoration: none; display: inline-block; text-align: center; }

/* Trang tài khoản */
.giua { padding: 24px 16px 48px; display: grid; justify-items: center; }
.the-tk { background: var(--mat); border-radius: 18px; box-shadow: var(--bong); padding: 28px; width: min(420px, 100%); display: grid; gap: 14px; }
.the-tk.rong { width: min(640px, 100%); }
.the-tk h1 { margin: 0; font-size: 22px; }
.logo-tk { border-radius: 14px; }
.the-tab { display: flex; gap: 4px; background: var(--mat2); padding: 4px; border-radius: 10px; }
.the-tab button { flex: 1; border: 0; background: none; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-weight: 600; color: var(--phu); }
.the-tab button[aria-selected="true"] { background: var(--mat); color: var(--chu); box-shadow: 0 1px 4px rgba(0, 0, 0, .08); }
.form-tk { display: grid; gap: 12px; }
.form-tk.ngang { grid-template-columns: 1fr auto; align-items: end; }
.ho-so { display: flex; gap: 18px; align-items: center; }
.ho-so h1 { overflow-wrap: anywhere; }
.anh-dai-dien { border: 0; padding: 0; background: var(--mat2); border-radius: 50%; width: 96px; height: 96px; cursor: pointer; flex: none; position: relative; overflow: hidden; }
.anh-dai-dien img { width: 100%; height: 100%; object-fit: cover; display: block; }
.anh-dai-dien::after { content: "Đổi ảnh"; position: absolute; inset: auto 0 0; background: rgba(0, 0, 0, .55); color: #fff; font-size: 11px; padding: 3px 0; opacity: 0; transition: .15s; }
.anh-dai-dien:hover::after, .anh-dai-dien:focus-visible::after { opacity: 1; }
.luoi-tk { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; }
.o-tk { display: grid; gap: 2px; padding: 12px 14px; border: 1px solid var(--vien); border-radius: 12px; color: var(--chu); text-decoration: none; }
.o-tk:hover { border-color: var(--nhan); }
.o-tk span { color: var(--phu); font-size: 13px; overflow-wrap: anywhere; }
.khoi-ma { display: grid; gap: 6px; padding: 14px; background: var(--mat2); border-radius: 12px; }
.ma-dong-bo { display: flex; gap: 8px; align-items: center; }
.ma-dong-bo code { font: 600 18px/1.4 ui-monospace, Consolas, monospace; letter-spacing: .06em; flex: 1; overflow-wrap: anywhere; }
.khoi-mk summary { cursor: pointer; font-weight: 600; padding: 4px 0; }
.khoi-mk form { margin-top: 10px; }
.hang-nut { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* Trang quản trị */
.khung-qt { max-width: 1100px; margin: 0 auto; padding: 18px 16px 48px; display: grid; gap: 14px; }
.khung-qt .the-tab { max-width: 520px; }
.khung-qt section { background: var(--mat); border-radius: 14px; padding: 16px; display: grid; gap: 10px; }
.tim-tv input { max-width: 420px; }
.nguoi-tv { display: flex; gap: 10px; align-items: center; }
.nguoi-tv img { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--mat2); flex: none; }
.bi-khoa { opacity: .6; }
.hang-chon { display: flex; flex-direction: row; gap: 8px; align-items: center; color: var(--chu); font-size: 14px; }
.hang-chon input { width: auto; }
.khung-qt .mac-dinh { margin-top: 0; }

/* Điện thoại: mỗi lúc một cột */
@media (max-width: 860px) {
  .ung-dung { grid-template-columns: 1fr; grid-template-areas: "tren" "chinh"; }
  .chi-dt { display: inline-block; }
  .thanh-tren { padding: 0 8px; gap: 6px; }
  .thuong-hieu b + * { display: none; }
  .chip-tk span { display: none; }
  .chip-tk { padding: 3px; }
  .the-tk { padding: 20px; }
  .ho-so { flex-direction: column; text-align: center; }
  .cot-ds, .cot-doc { grid-area: chinh; border: 0; }
  .ung-dung[data-xem="ds"] .cot-doc, .ung-dung[data-xem="doc"] .cot-ds { display: none; }
  .ben { position: fixed; inset: 0 auto 0 0; width: 270px; z-index: 5; background: var(--mat); box-shadow: var(--bong); transform: translateX(-105%); transition: transform .2s; }
  .ung-dung.mo-ben .ben { transform: none; }
  .ung-dung.mo-ben .man-che { display: block; position: fixed; inset: 0; background: rgba(10, 14, 25, .4); z-index: 4; }
  #doc-thu { padding: 4px 16px 16px; }
  .tao-hop { grid-template-columns: 1fr; }
  .bang thead { display: none; }
  .bang tr { display: grid; grid-template-columns: 1fr auto; padding: 8px 0; border-bottom: 1px solid var(--vien); }
  .bang td { border: 0; padding: 3px 0; }
  .bang td:first-child { grid-column: 1 / -1; }
}
