/* Trang riêng Giả lập thiết bị */
:root { --navy: #0b2a4a; --blue: #0b5cad; --orange: #f47920; --green: #1f9d55; --red: #c53030; --line: #e3e8ef; --muted: #6b7785; --bg: #f3f5f8; }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 14px/1.45 "Segoe UI", Roboto, Arial, sans-serif; color: #1e2b38; background: var(--bg); }
a { color: var(--blue); }
button, input, select { font: inherit; }
button { cursor: pointer; border: 1px solid var(--blue); background: var(--blue); color: #fff; border-radius: 6px; padding: 7px 14px; }
button:hover { filter: brightness(1.08); }
button.green { background: var(--green); border-color: var(--green); }
button.red { background: #fff; color: var(--red); border-color: var(--red); }
button.link { background: none; border: 0; color: var(--blue); padding: 0 4px; text-decoration: underline; }
input, select { border: 1px solid #c7d0db; border-radius: 6px; padding: 6px 9px; background: #fff; color: inherit; }
input:focus, select:focus, button:focus-visible { outline: 2px solid #8bb8e8; outline-offset: 1px; }
.muted { color: var(--muted); font-size: 13px; }

.logo { display: inline-flex; gap: 2px; vertical-align: -3px; }
.logo i { font: italic 900 12px "Arial Black", Arial, sans-serif; color: #fff; width: 15px; height: 18px; display: grid; place-items: center; transform: skewX(-12deg); border-radius: 2px; }
.logo .f { background: #1c75bc; } .logo .p { background: #f47920; } .logo .t { background: #39b54a; }
.logo.big i { width: 30px; height: 36px; font-size: 22px; border-radius: 4px; }

/* thanh trên */
.topbar { display: flex; align-items: center; gap: 18px; height: 52px; padding: 0 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 5; }
.brand { color: #fff; text-decoration: none; font-weight: 600; font-size: 16px; white-space: nowrap; display: flex; gap: 8px; align-items: center; }
.tabs { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; }
.tabs button, .tabs a { background: transparent; border: 0; color: #c9d6e4; padding: 8px 12px; border-radius: 6px; text-decoration: none; white-space: nowrap; }
.tabs button:hover, .tabs a:hover { color: #fff; background: rgba(255,255,255,.08); }
.tabs .on { color: #fff; background: rgba(255,255,255,.16); }
.who { display: flex; align-items: center; gap: 12px; white-space: nowrap; font-size: 13px; }
.who .role { background: rgba(255,255,255,.15); padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.who a { color: #c9d6e4; }
.who form { margin: 0; }
.who button { background: transparent; border: 1px solid rgba(255,255,255,.4); padding: 4px 10px; }

.flashes { max-width: 960px; margin: 12px auto 0; padding: 0 16px; }
.flash { padding: 9px 12px; border-radius: 6px; margin-bottom: 8px; }
.flash.err { background: #fdecec; color: #8a1f1f; border: 1px solid #f3c2c2; }
.flash.ok { background: #e8f6ee; color: #18603a; border: 1px solid #bfe3cd; }

/* đăng nhập */
.page-login { background: linear-gradient(135deg, #0b2a4a 0%, #0b5cad 60%, #1c75bc 100%); }
.page-login .flashes { max-width: 380px; position: relative; top: 60px; }
.login-wrap { min-height: 100%; display: grid; place-items: center; padding: 70px 16px 40px; }
.login-card { width: 100%; max-width: 380px; background: #fff; border-radius: 12px; padding: 28px 28px 22px; box-shadow: 0 12px 40px rgba(0,0,0,.25); display: flex; flex-direction: column; gap: 6px; }
.login-brand { text-align: center; margin-bottom: 4px; }
.login-card h1 { margin: 6px 0 0; text-align: center; font-size: 22px; color: var(--navy); }
.login-card .sub { margin: 0 0 12px; text-align: center; color: var(--muted); font-size: 13px; }
.login-card label { font-weight: 600; font-size: 13px; margin-top: 6px; }
.login-card input { padding: 9px 11px; }
.login-card button { margin-top: 16px; padding: 10px; font-weight: 600; }
.login-card .hint { margin: 10px 0 0; text-align: center; color: var(--muted); font-size: 12px; }

/* trang chính */
.page-portal { overflow: hidden; }
.portal { height: calc(100% - 52px); }
.pane { height: 100%; }
#paneSim iframe { width: 100%; height: 100%; border: 0; display: block; background: #fff; }
#paneRes { overflow: auto; padding: 16px; }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 14px; }
.filters label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
.filters .actions { display: flex; gap: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 10px; margin-bottom: 14px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; }
.kpi .v { font-size: 24px; font-weight: 700; color: var(--navy); }
.kpi .l { color: var(--muted); font-size: 12px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; margin-bottom: 14px; }
.card { background: #fff; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.card-h { padding: 10px 14px; font-weight: 600; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; }
.tbl th, .tbl td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tbl th { background: #f7f9fb; font-size: 12px; color: var(--muted); font-weight: 600; white-space: nowrap; }
.tbl td.num, .tbl th.num { text-align: right; white-space: nowrap; }
.tbl tbody tr.click { cursor: pointer; }
.tbl tbody tr.click:hover { background: #f1f6fc; }
.tbl tr.off td { color: #9aa5b1; }
.empty { padding: 18px; text-align: center; color: var(--muted); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; color: #fff; }
.b-ok { background: var(--green); } .b-mid { background: #d69e2e; } .b-bad { background: var(--red); } .b-exam { background: var(--blue); margin-right: 6px; }
.pager { display: flex; justify-content: flex-end; align-items: center; gap: 6px; padding: 8px 12px; }
.pager button { padding: 4px 10px; background: #fff; color: var(--blue); }
.pager button:disabled { opacity: .4; cursor: default; }

dialog { border: 0; border-radius: 12px; padding: 0; width: min(760px, 94vw); box-shadow: 0 12px 40px rgba(0,0,0,.3); }
dialog::backdrop { background: rgba(10,25,45,.45); }
.modal-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.modal-h h2 { margin: 0; font-size: 17px; }
.modal-h button { background: none; border: 0; color: var(--muted); font-size: 18px; }
#resModalBody { padding: 14px 16px 18px; max-height: 70vh; overflow: auto; }
.dl { display: grid; grid-template-columns: 150px 1fr; gap: 6px 12px; margin: 0 0 12px; font-size: 13px; }
.dl dt { color: var(--muted); }
.dl dd { margin: 0; }
.toast { position: fixed; right: 16px; bottom: 16px; background: var(--navy); color: #fff; padding: 10px 14px; border-radius: 8px; opacity: 0; transform: translateY(8px); transition: .2s; pointer-events: none; z-index: 20; }
.toast.show { opacity: 1; transform: none; }
.toast.warn { background: #9c4221; }

/* trang phụ */
.panel { max-width: 1200px; margin: 18px auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.panel.narrow { max-width: 520px; }
.panel h1 { margin: 0 0 14px; font-size: 20px; color: var(--navy); }
.form-grid { display: grid; grid-template-columns: 180px 1fr; gap: 10px 12px; align-items: center; }
.create-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; padding: 12px; background: #f7f9fb; border-radius: 8px; margin-bottom: 14px; }
.create-row label { display: flex; flex-direction: column; font-size: 12px; color: var(--muted); gap: 3px; }
form.inline, .inline { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
form.inline input, .inline input { width: 130px; padding: 4px 8px; }
form.inline button, .inline button, .tbl td > button { padding: 4px 10px; }
.tbl select { padding: 3px 6px; }

@media (max-width: 720px) {
  .topbar { height: auto; flex-wrap: wrap; padding: 8px 12px; gap: 8px; }
  .who .role, .who a { display: none; }
  .portal { height: calc(100% - 96px); }
  .grid2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .dl { grid-template-columns: 1fr; }
}
