/* Style cơ bản, responsive cho điện thoại (B7). Bộ nhận diện EVNNPC. */
:root {
  --evn-blue: #164397;        /* xanh EVN (màu chính) */
  --evn-blue-dark: #0f3270;
  --evn-red: #ed1c24;         /* đỏ EVN */
  --evn-yellow: #fff200;      /* vàng ngôi sao */
}
* { box-sizing: border-box; }
body {
  font-family: "Inter", -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  margin: 0; background: #f4f6f8; color: #1f2d3d; line-height: 1.5;
}
a { color: var(--evn-blue); text-decoration: none; transition: color .15s ease; }
a:hover { text-decoration: underline; }

header.topbar {
  background: linear-gradient(90deg, var(--evn-blue) 0%, var(--evn-blue-dark) 100%);
  color: #fff; padding: 8px 16px;
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  box-shadow: 0 2px 8px rgba(15,50,112,.25);
}
header.topbar .brand { font-weight: 800; font-size: 18px; }
header.topbar .brand a { display: flex; align-items: center; gap: 9px; }
header.topbar .brand a:hover { text-decoration: none; }
header.topbar .brand-logo {
  height: 34px; width: 34px; border-radius: 50%; background: #fff;
  padding: 2px; box-shadow: 0 1px 3px rgba(0,0,0,.2); object-fit: contain;
}
header.topbar .brand-text { letter-spacing: .2px; }
header.topbar a { color: #fff; }
header.topbar .userbox { font-size: 14px; }
header.topbar .bell { position: relative; text-decoration: none; }
header.topbar .noti-badge {
  position: absolute; top: -8px; right: -10px; background: #e53935; color: #fff;
  font-size: 11px; font-weight: 700; min-width: 16px; height: 16px; line-height: 16px;
  text-align: center; border-radius: 8px; padding: 0 4px;
}
/* Thanh menu: gom nút thành 3 vùng có nhãn (nút hiện sẵn, bấm là ăn ngay) — 1 dòng, hẹp thì cuộn ngang */
header.topbar .mainnav {
  display: flex; align-items: center; gap: 6px; flex: 1 1 auto;
  flex-wrap: nowrap; justify-content: center; margin: 0 10px; overflow-x: auto;
}
header.topbar .navgroup {
  display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto;
  background: rgba(255,255,255,.10); border: 1px solid rgba(255,255,255,.18);
  border-radius: 10px; padding: 4px 6px;
}
header.topbar .navgroup-title {
  font-size: 10.5px; font-weight: 800; letter-spacing: .2px; text-transform: uppercase;
  color: #dfe7ff; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px;
  border-right: 1px solid rgba(255,255,255,.22); margin-right: 2px; padding-right: 6px;
}
header.topbar .navgroup-row { display: inline-flex; gap: 3px; }
header.topbar .nbtn {
  padding: 6px 8px; border-radius: 7px; background: rgba(255,255,255,.16); color: #fff;
  font-size: 12.5px; font-weight: 600; white-space: nowrap;
  display: inline-flex; align-items: center; gap: 3px; transition: background .15s ease;
}
header.topbar .nbtn:hover { background: rgba(255,255,255,.30); text-decoration: none; }
header.topbar .nbtn.cta { background: var(--evn-yellow); color: #1f2d3d; font-weight: 700; }
header.topbar .nbtn.cta:hover { background: #ffe14d; }
header.topbar .nbtn .b-badge {
  background: #e53935; color: #fff; font-size: 10px; font-weight: 700;
  border-radius: 8px; padding: 0 5px; line-height: 15px;
}
/* màu phân biệt 3 vùng: Ưu tiên (xanh) / nhóm giữa (vàng) / Tổng hợp (xanh lá) */
header.topbar .navgroup.zUu { background: rgba(120,200,255,.16); border-color: rgba(120,200,255,.36); }
header.topbar .navgroup.zUu .navgroup-title { color: #dff0ff; }
header.topbar .navgroup.zMid { background: rgba(255,210,90,.13); border-color: rgba(255,210,90,.32); }
header.topbar .navgroup.zMid .navgroup-title { color: #ffe9b0; }
header.topbar .navgroup.zBc { background: rgba(150,220,180,.14); border-color: rgba(150,220,180,.32); }
header.topbar .navgroup.zBc .navgroup-title { color: #cdeedd; }
/* Nút ☰ (chỉ hiện trên điện thoại) */
header.topbar .navtoggle {
  display: none; background: rgba(255,255,255,.16); color: #fff; border: none;
  border-radius: 8px; font-size: 20px; line-height: 1; padding: 6px 12px; cursor: pointer;
}

main { max-width: 960px; margin: 0 auto; padding: 16px; }
main.wide { max-width: 1200px; }   /* trang báo cáo/dashboard cần rộng hơn */

.card {
  background: #fff; border-radius: 12px; padding: 18px;
  box-shadow: 0 1px 4px rgba(15,50,112,.08); margin-bottom: 16px;
  border: 1px solid #eef1f6;
}
h1 { font-size: 22px; margin: 0 0 12px; color: var(--evn-blue); }
h2 { font-size: 18px; margin: 0 0 10px; color: var(--evn-blue-dark); }

label { display: block; font-weight: 600; margin: 10px 0 4px; font-size: 14px; }
input, select, textarea {
  width: 100%; padding: 10px; border: 1px solid #cbd5e0; border-radius: 8px;
  font-size: 15px; font-family: inherit;
}
textarea { min-height: 80px; resize: vertical; }

.btn {
  display: inline-block; background: var(--evn-blue); color: #fff; border: 0;
  padding: 11px 18px; border-radius: 8px; font-size: 15px; cursor: pointer; font-weight: 600;
  transition: background .15s ease, box-shadow .15s ease, transform .05s ease;
}
.btn:hover { background: var(--evn-blue-dark); text-decoration: none; box-shadow: 0 2px 8px rgba(15,50,112,.3); }
.btn:active { transform: translateY(1px); }
.btn.secondary { background: #607d8b; }
.btn.danger { background: var(--evn-red); }
.btn.danger:hover { background: #c41119; }
.btn.ghost { background: #eceff1; color: #1f2d3d; }
.btn.ghost:hover { background: #dde3e8; box-shadow: none; }
/* Đã chuyển nút Xóa vào trang sửa (dùng .btn.danger), bỏ link đỏ trong bảng để tránh nhầm.
.linklike-danger { background: none; border: none; padding: 0; margin-left: 10px;
  color: #c0392b; cursor: pointer; font: inherit; text-decoration: underline; }
.linklike-danger:hover { color: #e53935; } */

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid #e2e8f0; }
th { background: #eef2fb; color: var(--evn-blue-dark); }
tbody tr { transition: background .12s ease; }
tbody tr:hover { background: #f7f9fd; }

.badge { padding: 2px 8px; border-radius: 12px; font-size: 12px; background: #e3f2fd; color: #0d47a1; }
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; }
.flash.error { background: #ffebee; color: #b71c1c; }
.flash.ok { background: #e8f5e9; color: #1b5e20; }
.muted { color: #607d8b; font-size: 13px; }

.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Điện thoại (B7): nav/nút dễ bấm, bảng cuộn ngang thay vì vỡ layout */
@media (max-width: 640px) {
  .row2 { grid-template-columns: 1fr; }
  main { padding: 12px; }
  header.topbar { padding: 8px 12px; }
  header.topbar .brand { font-size: 16px; }
  /* Điện thoại: ẩn thanh menu, hiện nút ☰; bấm ☰ mới mở (xếp dọc theo vùng, nút hiện sẵn) */
  header.topbar .navtoggle { display: inline-block; order: 2; }
  header.topbar .mainnav {
    display: none; width: 100%; order: 4; margin: 8px 0 0; overflow: visible;
    flex-direction: column; align-items: stretch; gap: 8px;
  }
  header.topbar .mainnav.open { display: flex; }
  header.topbar .navgroup { width: 100%; flex-direction: column; align-items: stretch; gap: 6px; }
  header.topbar .navgroup-title {
    border-right: 0; border-bottom: 1px solid rgba(255,255,255,.18);
    margin: 0; padding: 0 0 5px;
  }
  header.topbar .navgroup-row { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
  header.topbar .nbtn { justify-content: center; padding: 11px 8px; font-size: 13.5px; }
  header.topbar .nbtn.cta { grid-column: 1 / -1; }
  .card { padding: 14px; }
  h1 { font-size: 19px; }
  h2 { font-size: 16px; }
  /* table -> khối cuộn ngang để không tràn màn hình hẹp */
  table {
    display: block; width: 100%; overflow-x: auto; white-space: nowrap;
    -webkit-overflow-scrolling: touch; font-size: 13px;
  }
  th, td { padding: 8px 8px; }
  .btn { padding: 12px 16px; }   /* vùng chạm lớn hơn cho ngón tay */
}

.login-wrap { max-width: 380px; margin: 8vh auto; }
.login-logo { display: block; max-width: 230px; width: 80%; height: auto; margin: 0 auto 10px; }

/* Menu tài khoản (bấm vào tên -> đổi MK / chữ ký / cập nhật SĐT / đăng xuất) */
.usermenu { position: relative; display: inline-block; }
.usermenu-btn { font-weight: 600; cursor: pointer; }
.usermenu-pop {
  display: none; position: absolute; right: 0; top: 100%; margin-top: 6px;
  background: #fff; border: 1px solid #d7dde8; border-radius: 10px; min-width: 210px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14); padding: 6px; z-index: 50;
}
.usermenu-pop.open { display: block; }
.usermenu-pop a {
  display: block; padding: 9px 12px; border-radius: 7px;
  text-decoration: none; white-space: nowrap;
}
/* Đè màu trắng của 'header.topbar a' (đặc hiệu cao hơn) để chữ menu đọc được trên nền trắng */
header.topbar .usermenu-pop a { color: #1b2538; }
header.topbar .usermenu-pop a:hover { background: #eef2fb; color: var(--evn-blue); }

/* C2 — Bảng dạng THẺ trên điện thoại: mỗi dòng thành 1 thẻ, nhãn cột ở bên trái.
   Áp dụng cho bảng có class .tbl-stack (vd danh sách yêu cầu) để khỏi cuộn ngang khó đọc. */
@media (max-width: 640px) {
  table.tbl-stack { display: block; overflow: visible; white-space: normal; border: 0; }
  table.tbl-stack thead { display: none; }
  table.tbl-stack tbody, table.tbl-stack tr, table.tbl-stack td { display: block; width: 100%; }
  table.tbl-stack tr {
    border: 1px solid #e2e8f0; border-radius: 10px; margin-bottom: 10px;
    padding: 6px 12px; background: #fff;
  }
  table.tbl-stack td {
    border: 0; padding: 5px 0; display: flex; justify-content: space-between;
    align-items: center; gap: 12px; border-bottom: 1px dashed #eef1f6;
  }
  table.tbl-stack td:last-child { border-bottom: 0; }
  table.tbl-stack td::before {
    content: attr(data-label); font-weight: 600; color: #607d8b; font-size: 12.5px; flex-shrink: 0;
  }
  table.tbl-stack td .muted { font-size: 12px; }
}
