:root {
    --page: var(--frame);
    --frame: #efefef;
    --surface: #ffffff;
    --soft: #efefef;          /* nền viên thuốc nav, nút tròn */
    --text: #051F20;
    --muted: #6b8178;
    --icon: #3f5b52;           /* icon / chữ nav chưa chọn */
    --border: #e4e4e7;
    --primary: #235347;
    --primary-text: #ffffff;
    --grad: linear-gradient(135deg, #235347, #163832);   /* nền nút, mục đang chọn */
    --grad-text: linear-gradient(90deg, #235347, #051F20); /* chữ logo */
    --accent: #235347;         /* chữ / viền nhấn */
    --tint: #DAF1DE;           /* nền nút phụ nhỏ */
    --tint-text: #163832;
    --ok: #235347; --err: #d83a3a;
    --radius: 22px;
    --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
:root[data-theme="dark"] {
    --page: var(--frame);
    --frame: #0e0e0f;
    --surface: #19191a;
    --soft: #242426;
    --text: #f1f1f2;
    --muted: #8b8b90;
    --icon: #a3a3a8;
    --border: #2a2a2d;
    --primary: #235347;
    --grad: linear-gradient(135deg, #235347, #163832);
    --grad-text: linear-gradient(90deg, #8EB69B, #DAF1DE);
    --accent: #8EB69B;
    --tint: #163832;
    --tint-text: #DAF1DE;
    --ok: #8EB69B;
}
* { box-sizing: border-box; }
body { margin: 0; font: 15px/1.5 var(--font); background: var(--page); color: var(--text); }
a { color: var(--accent); text-decoration: none; }
h1, h2 { margin: 0; }
code { background: var(--soft); padding: 1px 6px; border-radius: 6px; font-size: .9em; }
.muted { color: var(--muted); }
.ico { display: block; flex: none; }
.ico-text { font-size: 18px; line-height: 1; }
button { font-family: inherit; }

/* ===== Khung ngoài ===== */
.frame { max-width: 1560px; margin: 0 auto; background: transparent; padding: 20px 28px 32px; min-height: 100vh; }

/* ===== Header ===== */
.header { background: var(--surface); border-radius: 999px; height: 66px; padding: 0 20px; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.header-left { display: flex; align-items: center; gap: 10px; }
.logo { display: inline-flex; align-items: center; gap: 8px; color: var(--accent); font-weight: 600; font-size: 1.17rem; letter-spacing: -.01em; }
.logo-mark { width: 32px; height: 32px; color: var(--primary); }
.logo span, .auth-card h1 { background: var(--grad-text); -webkit-background-clip: text; background-clip: text; color: transparent; }
.header-nav { display: flex; gap: 4px; background: var(--soft); border-radius: 999px; padding: 6px; }
.header-nav a { padding: 8px 20px; border-radius: 999px; font-weight: 500; font-size: .93rem; color: var(--icon); }
.header-nav a:hover { color: var(--text); }
.header-nav a.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(0,0,0,.05); }
.header-right { display: flex; align-items: center; justify-content: flex-end; gap: 12px; }

.round-btn { width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--soft); color: var(--text); display: grid; place-items: center; cursor: pointer; }
.round-btn:hover { filter: brightness(.96); }
.menu-btn { display: none; }

.user-menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 6px; background: none; border: 0; padding: 0; cursor: pointer; color: var(--muted); }
.avatar { width: 40px; height: 40px; border-radius: 50%; background: var(--grad); color: var(--primary-text); display: grid; place-items: center; font-weight: 600; }
.dropdown { position: absolute; right: 0; top: calc(100% + 12px); min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 18px; padding: 8px; box-shadow: 0 12px 32px rgba(0,0,0,.12); z-index: 30; }
.dropdown[hidden] { display: none; }
.dropdown-head { padding: 8px 12px; font-weight: 500; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.dropdown a, .dropdown button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; background: none; border-radius: 12px; color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.dropdown a:hover, .dropdown button:hover { background: var(--soft); }

/* ===== Thân: sidebar + nội dung ===== */
.body { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 48px; margin-top: 40px; padding-left: 8px; align-items: start; }

.sidebar { position: sticky; top: 18px; display: flex; flex-direction: column; gap: 16px; min-height: calc(100vh - 170px); }
.side-group { background: var(--surface); border-radius: 999px; padding: 7px 6px; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.side-bottom { margin-top: auto; }
.side-bottom form { margin: 0; }
.side-item { position: relative; width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; border: 0; background: none; color: var(--icon); cursor: pointer; padding: 0; }
.side-item:hover { background: var(--soft); color: var(--text); }
.side-item.active { background: var(--grad); color: var(--primary-text); }
.side-item::after { content: attr(data-label); position: absolute; left: calc(100% + 14px); top: 50%; transform: translateY(-50%); background: var(--text); color: var(--surface); padding: 5px 10px; border-radius: 8px; font-size: .8rem; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .12s; z-index: 40; }
.side-item:hover::after { opacity: 1; }

.content { min-width: 0; }
.page-title { font-size: 2.1rem; font-weight: 500; letter-spacing: -.02em; margin-bottom: 22px; }
.page-title span { color: var(--muted); }

/* ===== Thành phần ===== */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; }
.card { background: var(--surface); border-radius: var(--radius); padding: 20px; }
.card h2 { font-size: .94rem; font-weight: 500; margin-bottom: 14px; }
.card h2 a { color: var(--text); }
.row { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.row:last-child { border-bottom: 0; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-size: .88rem; color: var(--muted); }
input, textarea, select { font: inherit; padding: 11px 14px; border: 1px solid var(--border); border-radius: 14px; background: var(--frame); color: var(--text); width: 100%; }
input:focus, textarea:focus, select:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
.btn { background: var(--grad); color: var(--primary-text); border: 0; padding: 10px 20px; border-radius: 999px; font: inherit; font-weight: 500; cursor: pointer; }
.btn:hover { filter: brightness(1.08); }
.btn-sm { padding: 6px 14px; font-size: .85rem; }
.btn-ghost { background: var(--tint); color: var(--tint-text); }
.alert { padding: 11px 16px; border-radius: 14px; margin-bottom: 18px; background: var(--surface); border: 1px solid var(--border); }
.alert-success { border-color: var(--ok); color: var(--ok); }
.alert-error { border-color: var(--err); color: var(--err); }

/* ===== Đăng nhập ===== */
.auth-body { display: grid; place-items: center; min-height: 100vh; padding: 16px; }
.auth-card { width: 100%; max-width: 400px; background: var(--surface); border-radius: 26px; padding: 32px; }
.auth-card h1 { font-size: 1.3rem; margin-bottom: 20px; text-align: center; }

/* ===== Điện thoại / máy tính bảng ===== */
.backdrop { display: none; }
@media (max-width: 900px) {
    .frame { padding: 12px 12px 24px; }
    .header { grid-template-columns: 1fr auto; padding: 10px 12px 10px 10px; height: auto; border-radius: 28px; row-gap: 10px; }
    .header-nav { grid-column: 1 / -1; order: 3; overflow-x: auto; scrollbar-width: none; }
    .header-nav a { white-space: nowrap; padding: 8px 16px; }
    .menu-btn { display: grid; width: 40px; height: 40px; }
    .header-right .round-btn { width: 40px; height: 40px; }
    .body { grid-template-columns: minmax(0, 1fr); padding-left: 0; margin-top: 18px; }
    .sidebar { position: fixed; z-index: 20; left: 12px; top: 130px; bottom: 12px; min-height: 0; transform: translateX(-140%); transition: transform .22s; }
    .nav-open .sidebar { transform: none; }
    .nav-open .backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 10; }
    .side-item::after { display: none; }
    .page-title { font-size: 1.6rem; }
}

/* ===== Nút sáng/tối: mặt trời lặn, mặt trăng mọc (đơn sắc) ===== */
.theme-btn .sky { position: absolute; inset: 0; border-radius: 50%; overflow: hidden; }
.theme-btn .sky svg { position: absolute; left: 50%; top: 50%; width: 20px; height: 20px; margin: -10px 0 0 -10px; transition: transform .6s cubic-bezier(.3, 1.2, .5, 1), opacity .4s ease; }
.theme-btn .sun  { transform: none; }
.theme-btn .moon { transform: translateY(30px) rotate(-30deg); opacity: 0; }
:root[data-theme="dark"] .theme-btn .sun  { transform: translateY(30px) rotate(60deg); opacity: 0; }
:root[data-theme="dark"] .theme-btn .moon { transform: none; opacity: 1; }

/* Chuyển màu mượt toàn trang khi đổi giao diện */
.theme-switching, .theme-switching *, .theme-switching *::before, .theme-switching *::after {
    transition: background-color .45s ease, color .45s ease, border-color .45s ease !important;
}
.theme-switching .sky svg { transition: transform .6s cubic-bezier(.3, 1.2, .5, 1), opacity .4s ease !important; }
@media (prefers-reduced-motion: reduce) { .sky svg { transition: none !important; } }

/* Mục lớn trống */
.card.empty { text-align: center; padding: 48px 20px; }
.card.empty h2 { margin: 12px 0 6px; }
.empty-ico { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; background: var(--tint); display: grid; place-items: center; color: var(--tint-text); }

/* ===== Job: chấm màu, thanh tab phụ, chọn màu ===== */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; flex: none; }
.header-nav a { display: inline-flex; align-items: center; gap: 8px; }
.subhead { display: flex; flex-wrap: wrap; align-items: center; gap: 14px; margin-bottom: 22px; }
.job-badge { display: inline-flex; align-items: center; gap: 8px; font-weight: 500; }
.subnav { display: flex; gap: 4px; background: var(--surface); border-radius: 999px; padding: 5px; max-width: 100%; overflow-x: auto; }
.subnav a { padding: 7px 18px; border-radius: 999px; color: var(--muted); font-weight: 500; font-size: .9rem; white-space: nowrap; }
.subnav a:hover { color: var(--text); }
.subnav a.active { background: var(--soft); color: var(--text); }
.stat { display: flex; flex-direction: column; gap: 4px; color: var(--text); }
.stat strong { font-size: 1.8rem; font-weight: 500; }
.form-label { font-size: .88rem; color: var(--muted); margin-bottom: -6px; }
.swatches { display: flex; gap: 10px; }
.swatch { position: relative; cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--c); box-shadow: 0 0 0 2px transparent, 0 0 0 4px transparent; transition: box-shadow .15s; }
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.swatch input:focus-visible + span { outline: 2px solid var(--text); outline-offset: 4px; }

/* Chữ cái đầu của job trong sidebar */
.side-item .ico-text { font-size: .94rem; font-weight: 600; }
.header-nav { max-width: 100%; }

/* Trên nền màu (xanh/màu job) chữ luôn trắng, ở cả sáng và tối */
.side-item.active,
:root[data-theme="dark"] .side-item.active,
.side-item.active:hover,
.avatar, .btn:not(.btn-ghost) { color: #fff; }

/* ===== Ảnh đại diện job ===== */
.side-item img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; display: block; }
.side-item[data-img].active { background: none; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ring, var(--primary)); }
.badge-img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.avatar-field { display: flex; align-items: center; gap: 16px; }
.avatar-preview { width: 64px; height: 64px; flex: none; border-radius: 50%; background: var(--c, var(--primary)); color: #fff; display: grid; place-items: center; font-size: 1.32rem; font-weight: 600; overflow: hidden; }
.avatar-preview img { width: 100%; height: 100%; object-fit: cover; }
.avatar-actions { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.avatar-actions input[type=file] { padding: 8px 10px; }
.check { flex-direction: row !important; align-items: center; gap: 8px !important; }
.check input { width: auto; }

/* Viền sáng cho mục đang chọn ở dark mode (nền xanh đậm trên nền tối) */
:root[data-theme="dark"] .side-item.active { box-shadow: 0 0 0 1px rgba(142, 182, 155, .45); }
:root[data-theme="dark"] .side-item[data-img].active { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--ring, #8EB69B); }
/* Màu job sáng (#8EB69B): chữ tối để đọc được */
.side-item.active[style*="8EB69B"] { color: #051F20; }

:root { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

/* Ô chọn (select): mũi tên tự vẽ, cách lề phải */
select {
    -webkit-appearance: none; appearance: none;
    padding-right: 38px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b8b90' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    cursor: pointer;
}

/* Chữ in đậm mặc định của trình duyệt (b, strong, tiêu đề) nhẹ hơn một bậc: 700 -> 600 */
b, strong, th, h1, h2, h3, h4, h5, h6 { font-weight: 600; }

/* Đăng nhập bằng Facebook */
.fb-or { display: flex; align-items: center; gap: 12px; margin: 16px 0 12px; color: var(--muted); font-size: .82rem; }
.fb-or::before, .fb-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.btn-fb { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: #1877f2; color: #fff; text-decoration: none; border: 0; box-sizing: border-box; }
.btn-fb:hover { background: #1568d8; color: #fff; }
.fb-note { text-align: center; font-size: .8rem; margin: 12px 0 0; }
.legal { line-height: 1.55; font-size: .92rem; }
.legal h2 { font-size: 1rem; margin: 18px 0 6px; }
.auth-card:has(.legal) { max-width: 560px; }

/* Điện thoại: Cài đặt gọn, không bị xuống dòng lẻ */

.btn-gg { display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; background: #fff; color: #3c4043; border: 1px solid #dadce0; text-decoration: none; box-sizing: border-box; margin-bottom: 8px; }
.btn-gg:hover { background: #f8f9fa; color: #3c4043; }
a.btn.btn-gg, a.btn.btn-gg:visited { color: #3c4043; font-weight: 600; }
a.btn.btn-gg:hover { color: #202124; background: #f8f9fa; }

.gsi-btn { display: flex; justify-content: center; margin-bottom: 8px; min-height: 44px; }

/* ===== Trang Cài đặt ===== */
.st { max-width: 960px; margin: 0 auto; display: flex; flex-direction: column; gap: 30px; padding-bottom: 40px; }
.st-lead { margin: -6px 0 0; color: var(--muted); font-size: .95rem; }
.st-sec { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 8px 32px; scroll-margin-top: 90px; }
.st-side h2 { font-size: 1rem; font-weight: 600; margin: 0 0 4px; }
.st-side p { margin: 0; color: var(--muted); font-size: .84rem; line-height: 1.5; }
.st-card { background: var(--surface); border: 1px solid var(--border); border-radius: 18px; overflow: hidden; min-width: 0; }
.st-row { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-top: 1px solid var(--border); min-width: 0; }
.st-row:first-child { border-top: 0; }
.st-col { flex-direction: column; align-items: stretch; gap: 12px; }
.st-line { display: flex; align-items: center; gap: 14px; min-width: 0; }
.st-who { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.st-who b { font-size: .95rem; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-who small { color: var(--muted); font-size: .82rem; line-height: 1.4; }
.st-av { flex: none; width: 46px; height: 46px; border-radius: 50%; display: grid; place-items: center; background: var(--primary); color: #fff; font-weight: 600; font-size: 1.05rem; object-fit: cover; }
.st-av.sm { width: 38px; height: 38px; font-size: .92rem; }
.st-chip { flex: none; padding: 4px 11px; border-radius: 99px; background: var(--soft); color: var(--icon); font-size: .76rem; font-weight: 600; }
.st-muted { margin: 0; color: var(--muted); font-size: .88rem; line-height: 1.55; }
.st-note { padding: 11px 14px; border-radius: 12px; background: var(--soft); color: var(--icon); font-size: .84rem; line-height: 1.55; }
.st-note b { color: var(--text); font-weight: 600; }
.st-acts { display: flex; align-items: center; gap: 8px; flex: none; }
.st-acts form { margin: 0; }
.st-btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font: inherit; font-size: .86rem; font-weight: 500; cursor: pointer; white-space: nowrap; flex: none; transition: background-color .15s, border-color .15s; }
.st-btn:hover { background: var(--soft); }
.st-btn[aria-expanded="true"] { background: var(--soft); }
.st-btn.primary { background: var(--grad); color: #fff; border-color: transparent; }
.st-btn.primary:hover { filter: brightness(1.1); }
.st-btn.danger { color: var(--err); border-color: color-mix(in srgb, var(--err) 35%, var(--border)); background: transparent; }
.st-btn.danger:hover { background: color-mix(in srgb, var(--err) 10%, transparent); }
.st-btn.danger.solid { background: var(--err); color: #fff; border-color: transparent; }
.st-panel { padding: 16px; border-radius: 14px; background: var(--frame); border: 1px solid var(--border); }
.st-panel[hidden] { display: none; }
.st-two { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.st-form { display: flex; flex-direction: column; gap: 14px; margin: 0; }
.st-form label { display: flex; flex-direction: column; gap: 6px; font-size: .86rem; font-weight: 500; }
.st-hint { color: var(--muted); font-weight: 400; font-size: .78rem; margin-left: 4px; }
.st-form input { height: 42px; padding: 0 12px; border-radius: 10px; font-size: .92rem; width: 100%; background: var(--surface); }
.st-pw { display: flex; gap: 8px; min-width: 0; }
.st-pw input { flex: 1; min-width: 0; }
.st-actions { display: flex; justify-content: flex-start; }
.st-feat .switch { flex: none; }
.st-dng { border-color: color-mix(in srgb, var(--err) 30%, var(--border)); }
@media (max-width: 800px) {
  .st-sec { grid-template-columns: 1fr; gap: 12px; }
  .st-side p { max-width: 520px; }
  .st-two { grid-template-columns: 1fr; gap: 16px; }
  .st-row { padding: 14px 16px; }
}
@media (max-width: 520px) {
  .st-line { flex-wrap: wrap; }
  .st-line .st-who { flex-basis: calc(100% - 60px); }
  .st-acts { width: 100%; }
  .st-acts .st-btn { flex: 1; }
  .st-acts form { flex: 1; display: flex; }
  .st-pw { flex-wrap: wrap; }
  .st-pw input { flex-basis: 100%; }
  .st-pw .st-btn { flex: 1; }
  .st-prof { flex-wrap: wrap; }
}
.st-two .st-pw { flex-wrap: wrap; }
.st-two .st-pw input { flex-basis: 100%; }
.st-two .st-pw .st-btn { flex: 1; }
.st-two .st-form { justify-content: flex-start; }
.st-two .st-form .st-actions { margin-top: auto; }

.back-link { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px 0 10px; margin-bottom: 14px; border-radius: 99px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: .88rem; font-weight: 500; text-decoration: none; }
.back-link:hover { background: var(--soft); color: var(--text); }
