/* =========================================================
   [BƯỚC 9] KHU QUẢN TRỊ TÀI KHOẢN — khớp phong cách app
   ========================================================= */
.aa-root { font-family: 'Nunito', 'Segoe UI', Arial, sans-serif; color: #1f2d3d; }

.aa-section-title {
    color: #1f4e79; font-weight: 800; font-size: 17px; margin: 4px 0 12px;
    display: flex; align-items: center; gap: 8px;
}

/* Thanh công cụ (search + nút Tạo): có đường kẻ MỜ, MỎNG phân tách với vùng danh sách bên dưới
   — đồng bộ kiểu gạch của tab "Cửa hàng đổi thưởng" (.config-inline-header: 1px dashed #d9eaf7). */
.aa-toolbar {
    display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
    margin-bottom: 14px; padding-bottom: 14px; border-bottom: 1px dashed #d9eaf7;
}
.aa-search {
    flex: 1 1 220px; min-width: 180px; font-size: 16px; font-family: inherit;
    padding: 10px 12px; border: 1.5px solid #d9eaf7; border-radius: 10px; background: #fff;
}
.aa-search:focus { outline: none; border-color: #2f75b5; box-shadow: 0 0 0 3px rgba(47,117,181,.15); }

.aa-btn {
    font-family: inherit; font-weight: 700; font-size: 14px; cursor: pointer;
    border-radius: 10px; padding: 10px 16px; border: 1px solid #d9eaf7;
    background: #eaf3fb; color: #1f4e79; transition: all .15s ease;
}
.aa-btn:hover { background: #d9eaf7; }
.aa-btn-primary { background: #2f75b5; color: #fff; border-color: #2f75b5; }
.aa-btn-primary:hover { background: #285f93; }
.aa-btn-primary:disabled { opacity: .55; cursor: not-allowed; }
.aa-btn-sm { padding: 6px 12px; font-size: 13px; }
.aa-btn-danger { background: #fde2e1; color: #a83232; border-color: #e9b7b5; }

/* Danh sách phụ huynh */
.aa-list { display: flex; flex-direction: column; gap: 8px; }
.aa-item {
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 12px 14px; border: 1px solid #d9eaf7; border-radius: 10px; background: #fffaf0;
    cursor: pointer; transition: all .12s ease;
}
.aa-item:hover { border-color: #2f75b5; box-shadow: 0 2px 8px rgba(31,78,121,.08); }
.aa-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.aa-item-name { font-weight: 700; color: #1f4e79; }
.aa-item-email { font-size: 13px; color: #5b6b7a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.aa-item-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }

/* [Đợt acct] BẢNG danh sách phụ huynh — có HEADER 6 cột (PC). Mỗi dòng là 1 "thẻ hàng"
   bo góc + nền kem, giữ phong cách .aa-item cũ. Lớp bọc cho cuộn ngang khi màn hẹp vừa. */
.aa-table-wrap { overflow-x: auto; min-width: 0; }
.aa-table { width: 100%; border-collapse: separate; border-spacing: 0 8px; }
/* Header CĂN GIỮA mỗi cột tương ứng. */
.aa-table thead th {
    text-align: center; font-size: 12.5px; font-weight: 800; color: #5b6b7a;
    padding: 2px 12px; white-space: nowrap;
}
.aa-table tbody .aa-row { cursor: pointer; }
.aa-table .aa-td {
    padding: 12px 12px; border-top: 1px solid #d9eaf7; border-bottom: 1px solid #d9eaf7;
    background: #fffaf0; vertical-align: middle; transition: border-color .12s ease, box-shadow .12s ease;
}
.aa-table .aa-td:first-child {
    border-left: 1px solid #d9eaf7; border-top-left-radius: 10px; border-bottom-left-radius: 10px;
}
.aa-table .aa-td:last-child {
    border-right: 1px solid #d9eaf7; border-top-right-radius: 10px; border-bottom-right-radius: 10px;
}
.aa-table tbody .aa-row:hover .aa-td { border-color: #2f75b5; box-shadow: 0 2px 8px rgba(31,78,121,.06); }

/* Cột "Tài khoản": CĂN TRÁI (cả tên phụ huynh lẫn email); tên đậm trên, email nhỏ dưới. */
.aa-td-acc { text-align: left; }
.aa-td-acc .aa-item-name { display: block; text-align: left; }
.aa-td-acc .aa-item-email { display: block; text-align: left; white-space: normal; word-break: break-word; }

/* Cột "Thông tin học sinh": các TAG nằm liên tiếp 1 dòng, KHÔNG xuống dòng; chật → cuộn ngang. */
.aa-td-kids { max-width: 240px; }
/* Cụm tag CUỘN TRONG Ô khi chật (không nới ô/bảng): cap bề rộng + min-width:0 để overflow-x
   thực sự kích hoạt (kể cả khi .aa-tags là flex-item trong thẻ card mobile). */
.aa-tags { display: flex; gap: 6px; flex-wrap: nowrap; overflow-x: auto; max-width: 240px; min-width: 0; padding-bottom: 2px; }
.aa-tag {
    flex: 0 0 auto; white-space: nowrap; font-size: 12px; font-weight: 700;
    padding: 3px 9px; border-radius: 999px; background: #e8f1fb; color: #1f4e79; border: 1px solid #cfe2f4;
}
.aa-tags-empty { color: #9fb2c4; }

/* Cột ngày (Ngày đăng ký / Ngày hết hạn): gọn 1 dòng + CĂN GIỮA. */
.aa-td-date { white-space: nowrap; font-size: 13.5px; color: #3a4a5a; text-align: center; }
.aa-td-status { text-align: center; }
.aa-td-view { text-align: center; white-space: nowrap; }

/* Nhãn trạng thái hạn */
.aa-badge { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.aa-badge-ok { background: #e6f4ea; color: #2f6b2f; }
.aa-badge-expired { background: #fde2e1; color: #a83232; }
.aa-badge-pending { background: #fff3cd; color: #8a6d1b; }
.aa-badge-forever { background: #e7e9fb; color: #3b3f9b; }

/* Phân trang */
.aa-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 14px; }
.aa-pager .aa-page-info { color: #5b6b7a; font-size: 13px; }

/* Form / hộp */
.aa-box {
    border: 1px solid #d9eaf7; border-radius: 12px; background: #fff; padding: 16px; margin-top: 6px;
}
.aa-field { display: flex; flex-direction: column; margin-bottom: 12px; }
.aa-label { font-weight: 700; color: #1f4e79; font-size: 14px; margin-bottom: 5px; }
.aa-input {
    font-size: 16px; font-family: inherit; padding: 10px 12px; border: 1.5px solid #d9eaf7;
    border-radius: 10px; background: #fff; color: #1f2d3d;
}
.aa-input:focus { outline: none; border-color: #2f75b5; box-shadow: 0 0 0 3px rgba(47,117,181,.15); }
.aa-input:disabled { background: #eef2f6; color: #9fb2c4; }
.aa-date-row { display: flex; gap: 12px; flex-wrap: wrap; }
.aa-date-row .aa-field { flex: 1 1 150px; }
.aa-hint { font-size: 12.5px; color: #6b7280; margin-top: 4px; }
/* Dòng phụ hiển thị ngày dạng dd/mm/yyyy ngay dưới ô <input type=date> native. */
.aa-date-vn { font-size: 13px; font-weight: 700; color: #2f75b5; margin-top: 4px; min-height: 18px; }

/* Hộp kết quả (mật khẩu hiển thị để copy tay) */
.aa-result { border: 1px solid #6aa84f; background: #f1f8ee; border-radius: 12px; padding: 14px; margin-top: 14px; }
.aa-result.is-warn { border-color: #e0a800; background: #fff8e8; }
.aa-cred-row { display: flex; align-items: center; gap: 8px; margin: 8px 0; flex-wrap: wrap; }
.aa-cred-label { font-weight: 700; color: #1f4e79; min-width: 130px; }
.aa-cred-value { font-family: ui-monospace, Menlo, Consolas, monospace; font-weight: 800; font-size: 16px; color: #1f2d3d; background: #fff; border: 1px solid #d9eaf7; border-radius: 8px; padding: 4px 10px; }

/* Cây phụ huynh → con */
.aa-back { background: none; border: none; color: #2f75b5; font-weight: 700; cursor: pointer; font-size: 14px; padding: 4px 0; margin-bottom: 8px; }
.aa-back:hover { text-decoration: underline; }
.aa-detail-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 12px; }
.aa-detail-name { font-size: 18px; font-weight: 800; color: #1f4e79; }
.aa-detail-email { color: #5b6b7a; font-size: 14px; }
.aa-child-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.aa-child-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid #d9eaf7; border-radius: 10px; background: #fffaf0; }
.aa-child-name { font-weight: 700; color: #1f4e79; }
.aa-child-grade { font-size: 13px; color: #5b6b7a; }

.aa-empty { color: #6b7280; font-style: italic; padding: 14px; text-align: center; }
.aa-msg { border-radius: 10px; padding: 10px 12px; margin: 10px 0; font-weight: 600; font-size: 14px; }
.aa-msg-error { background: #fde2e1; border: 1px solid #e06666; color: #a83232; }
.aa-msg-ok { background: #e6f4ea; border: 1px solid #6aa84f; color: #2f6b2f; }
.aa-divider { height: 1px; background: #e6eef6; margin: 16px 0; }

@media (max-width: 600px) {
    .aa-item { flex-direction: column; align-items: stretch; }
    .aa-item-right { justify-content: space-between; }

    /* [Đợt acct] Bảng 6 cột → THẺ (card): mỗi phụ huynh 1 thẻ, các trường xếp DỌC có nhãn. */
    .aa-table { border-spacing: 0; display: block; }
    .aa-table thead { display: none; }
    .aa-table tbody { display: block; }
    .aa-table tbody .aa-row {
        display: block; border: 1px solid #d9eaf7; border-radius: 12px; background: #fffaf0;
        margin-bottom: 10px; padding: 4px 2px;
    }
    .aa-table .aa-td {
        display: flex; align-items: center; justify-content: space-between; gap: 12px;
        border: none; border-radius: 0; padding: 8px 12px; background: transparent;
    }
    .aa-table .aa-td::before {
        content: attr(data-label); flex: 0 0 auto; font-weight: 800; color: #5b6b7a; font-size: 12.5px;
    }
    /* Cột Tài khoản: nhãn trên, tên + email xuống dưới (căn trái). */
    .aa-table .aa-td-acc { flex-direction: column; align-items: stretch; gap: 2px; }
    .aa-table .aa-td-acc::before { margin-bottom: 2px; }
    /* Tag học sinh: dồn về phải, cho cuộn ngang nếu nhiều. */
    .aa-td-kids { max-width: none; }
    .aa-table .aa-td-kids .aa-tags { justify-content: flex-end; }
    .aa-table .aa-td-status, .aa-table .aa-td-view { text-align: left; }
    .aa-table .aa-td-view { justify-content: space-between; }
    .aa-table tbody .aa-row:hover .aa-td { box-shadow: none; }
}
