/* Thành phần dùng chung (docs/plan/GD-0.md §7). Mỗi khối ghi board tham chiếu. */

/* ===== Nút (board 1, 31, 35, 28) ===== */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--h-md); padding: 0 18px; border-radius: var(--r-pill); border: 1px solid transparent;
  font-size: var(--fs-13); font-weight: 600; line-height: 1; white-space: nowrap; cursor: pointer;
  text-decoration: none; background: var(--white); color: var(--text); transition: background .12s, border-color .12s;
}
.btn:hover { text-decoration: none; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-strong); color: var(--on-accent); }
.btn-secondary { border-color: var(--border-input); background: var(--white); color: var(--text); }
.btn-secondary:hover:not(:disabled) { background: var(--slate-50); color: var(--text); }
.btn-danger { border-color: var(--err-border); color: var(--err-strong); background: var(--white); }
.btn-danger:hover:not(:disabled) { background: var(--err-bg); color: var(--err-strong); }
.btn-danger-solid { background: var(--err-fg); color: var(--white); }
.btn-ghost { background: transparent; color: var(--text-2); }
.btn-ghost:hover:not(:disabled) { background: var(--slate-100); color: var(--text); }
.btn-sm { height: var(--h-sm); padding: 0 13px; font-size: var(--fs-12); }
.btn-lg { height: var(--h-lg); padding: 0 22px; font-size: var(--fs-14); }
.btn-xl { height: var(--h-xl); padding: 0 24px; font-size: 15px; }
.btn-block { width: 100%; }
.btn .icon { width: 15px; height: 15px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--link); font-weight: 600; cursor: pointer; font-size: inherit; }
.link-btn:hover { color: var(--link-hover); text-decoration: underline; }

/* ===== Trường nhập (board 1, 31) ===== */
.field { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.field > label, .label { font-size: var(--fs-12); font-weight: 600; color: var(--slate-700); }
.input, .select, .textarea {
  width: 100%; height: 42px; padding: 0 13px; border: 1px solid var(--border-input); border-radius: var(--r-md);
  background: var(--white); font-size: var(--fs-13); color: var(--text);
}
.input-lg { height: var(--h-lg); font-size: var(--fs-14); padding: 0 14px; }
.textarea { height: auto; min-height: 92px; padding: 11px 13px; resize: vertical; line-height: 1.5; }
.select { appearance: none; padding-right: 34px;
  background-image: url("/assets/chevron-down.svg"); background-repeat: no-repeat; background-position: right 12px center; background-size: 14px; }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 20%, transparent); }
.input[readonly], .input:disabled { background: var(--slate-100); color: var(--text-3); border-style: dashed; }
.field-hint { font-size: var(--fs-11); color: var(--text-3); line-height: 1.5; }
.field-error { font-size: var(--fs-11); color: var(--err-strong); }
.field.has-error .input, .field.has-error .select, .field.has-error .textarea { border-color: var(--err-border); }
.input-group { display: flex; align-items: stretch; height: 42px; border: 1px solid var(--border-input); border-radius: var(--r-md); overflow: hidden; background: var(--white); }
.input-group:focus-within { border-color: var(--focus); }
.input-group .input { border: 0; border-radius: 0; height: 100%; }
.input-group .input:focus { box-shadow: none; }
.input-addon { display: flex; align-items: center; padding: 0 13px; background: var(--slate-100); color: var(--text-2); border-left: 1px solid var(--border); font-size: var(--fs-13); white-space: nowrap; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; font-size: var(--fs-13); color: var(--slate-700); }
.check input { width: 16px; height: 16px; margin: 2px 0 0; accent-color: var(--accent-strong); flex: 0 0 auto; }
.seg { display: inline-flex; border: 1px solid var(--border-input); border-radius: var(--r-pill); padding: 3px; gap: 3px; background: var(--white); }
.seg label { display: inline-flex; align-items: center; height: 30px; padding: 0 14px; border-radius: var(--r-pill); font-size: var(--fs-12); font-weight: 600; color: var(--text-2); cursor: pointer; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg input:checked + span { color: var(--on-accent); }
.seg label:has(input:checked) { background: var(--accent); color: var(--on-accent); }
.seg label:has(input:focus-visible) { outline: 2px solid var(--focus); outline-offset: 1px; }

/* Ô OTP 6 số (board 28) */
.otp { display: flex; gap: 9px; margin: 0; padding: 0; border: 0; }
.otp input { width: 52px; height: 60px; text-align: center; font-family: var(--font-head); font-size: 23px; font-weight: 600;
  border: 1.5px solid var(--border-input); border-radius: var(--r-lg); background: var(--white); color: var(--text); }
.otp input:focus { outline: none; border-color: var(--accent); }
@media (max-width: 420px) { .otp input { width: 44px; height: 54px; } }

/* Độ mạnh mật khẩu (board 2, 88, 89) — chỉ gợi ý; quy tắc thật ở server */
.pw-meter { display: flex; flex-direction: column; gap: 6px; }
.pw-meter-bars { display: flex; gap: 5px; }
.pw-meter-bars span { flex: 1; height: 5px; border-radius: var(--r-pill); background: var(--slate-200); }
.pw-meter[data-level="1"] .pw-meter-bars span:nth-child(-n+1),
.pw-meter[data-level="2"] .pw-meter-bars span:nth-child(-n+2),
.pw-meter[data-level="3"] .pw-meter-bars span:nth-child(-n+3),
.pw-meter[data-level="4"] .pw-meter-bars span { background: var(--lime-600); }
.pw-meter[data-level="1"] .pw-meter-bars span:first-child { background: var(--err-fg); }
.pw-meter-label { font-size: var(--fs-11); color: var(--lime-800); }
.checklist { display: flex; flex-direction: column; gap: 7px; margin: 0; padding: 0; list-style: none; }
.checklist li { display: flex; align-items: center; gap: 8px; font-size: var(--fs-12); color: var(--text-3); }
.checklist li::before { content: ""; width: 16px; height: 16px; border-radius: 999px; background: var(--slate-300); flex: 0 0 auto; }
.checklist li.ok { color: var(--lime-800); }
.checklist li.ok::before { background: var(--lime-600) url("/assets/check-white.svg") center / 10px no-repeat; }

/* ===== Nhãn trạng thái B5 (board 30) ===== */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: var(--r-pill);
  font-size: var(--fs-11); font-weight: 600; white-space: nowrap; background: var(--muted-bg); color: var(--muted-fg); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.badge-ok { background: var(--ok-bg); color: var(--ok-fg); }
.badge-warn { background: var(--warn-bg); color: var(--warn-fg); }
.badge-err { background: var(--err-bg); color: var(--err-fg); }
.badge-info { background: var(--info-bg); color: var(--info-fg); }
.badge-violet { background: var(--console-100); color: var(--console-600); }
.badge-plain::before { display: none; }
.pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--r-pill); font-size: var(--fs-11); font-weight: 600; letter-spacing: .06em; border: 1px solid var(--border); color: var(--text-2); }

/* ===== Thẻ, tiêu đề trang ===== */
.card { background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--r-xl); padding: 22px; }
.card-lg { border-radius: 22px; padding: 30px; }
.card-flush { padding: 0; overflow: hidden; }
.card-title { font-family: var(--font-head); font-size: var(--fs-16); font-weight: 600; }
.eyebrow { font-size: var(--fs-11); letter-spacing: .08em; font-weight: 600; color: var(--text-3); text-transform: uppercase; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; }
.page-head h1 { font-size: var(--fs-22); }
.crumbs { font-size: var(--fs-12); color: var(--text-3); display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs a { color: var(--text-3); }
.kv { display: grid; grid-template-columns: minmax(120px, max-content) 1fr; gap: 9px 18px; margin: 0; font-size: var(--fs-13); }
.kv dt { color: var(--text-3); }
.kv dd { margin: 0; font-weight: 500; min-width: 0; overflow-wrap: anywhere; }
.divider { height: 1px; background: var(--border); border: 0; margin: 0; }
.avatar { width: 32px; height: 32px; border-radius: 999px; display: inline-flex; align-items: center; justify-content: center;
  font-size: var(--fs-11); font-weight: 700; background: var(--lime-100); color: var(--lime-800); flex: 0 0 auto; }
.logo-mark { width: 36px; height: 36px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--font-head); font-weight: 700; font-size: 13px; background: var(--accent); color: var(--on-accent); flex: 0 0 auto; }

/* Thẻ chỉ số / hạn mức (board 5, 18) */
.quota { display: flex; flex-direction: column; gap: 8px; }
.quota-head { display: flex; justify-content: space-between; gap: 10px; font-size: var(--fs-12); }
.quota-bar { height: 7px; border-radius: var(--r-pill); background: var(--slate-200); overflow: hidden; }
.quota-bar > span { display: block; height: 100%; background: var(--lime-600); border-radius: inherit; width: 0; }
.quota[data-state="warn"] .quota-bar > span { background: var(--warn-dot); }
.quota[data-state="full"] .quota-bar > span { background: var(--err-fg); }
.stat { display: flex; flex-direction: column; gap: 4px; }
.stat-value { font-family: var(--font-head); font-size: var(--fs-22); font-weight: 600; }

/* ===== Banner, toast, trạng thái rỗng ===== */
.banner { display: flex; gap: 11px; align-items: flex-start; border: 1px solid; border-radius: var(--r-lg); padding: 12px 15px; font-size: var(--fs-12); line-height: 1.6; }
.banner .icon { width: 17px; height: 17px; flex: 0 0 auto; margin-top: 1px; }
.banner strong { display: block; font-size: var(--fs-13); }
.banner-err { background: var(--err-bg); border-color: var(--err-border); color: var(--err-strong); }
.banner-ok { background: var(--lime-50); border-color: var(--lime-200); color: var(--lime-800); }
.banner-warn { background: var(--warn-bg); border-color: var(--warn-border); color: var(--warn-fg); }
.banner-info { background: var(--slate-50); border-color: var(--border); color: var(--text-2); }
.banner-violet { background: var(--console-100); border-color: var(--console-200); color: var(--console-700); }
.toasts { position: fixed; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 60; max-width: min(380px, calc(100vw - 40px)); }
.toast { background: var(--ink); color: var(--white); border-radius: var(--r-lg); padding: 12px 16px; font-size: var(--fs-13); box-shadow: var(--shadow-pop); }
.toast-err { background: var(--err-strong); }
.empty { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; padding: 38px 20px; color: var(--text-3); }
.empty-icon { width: 44px; height: 44px; border-radius: 14px; background: var(--slate-100); display: flex; align-items: center; justify-content: center; }
.empty-title { font-family: var(--font-head); font-size: var(--fs-16); color: var(--text); font-weight: 600; }
.skeleton { background: linear-gradient(90deg, var(--slate-100), var(--slate-200), var(--slate-100)); background-size: 200% 100%; animation: sk 1.2s infinite; border-radius: var(--r-sm); min-height: 14px; }
@keyframes sk { to { background-position: -200% 0; } }

/* ===== Bảng (board 30, 34, 42, 43) ===== */
.table-wrap { overflow-x: auto; }
.table { font-size: var(--fs-12); }
.table th { text-align: left; font-size: var(--fs-11); letter-spacing: .05em; font-weight: 600; color: var(--text-3); text-transform: uppercase;
  padding: 11px 14px; border-bottom: 1px solid var(--border); background: var(--slate-50); white-space: nowrap; }
.table th button { all: unset; cursor: pointer; display: inline-flex; gap: 4px; align-items: center; }
.table th button:focus-visible { outline: 2px solid var(--focus); }
.table td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: var(--slate-50); }
.table tbody tr:last-child td { border-bottom: 0; }
.table .cell-main { font-weight: 600; color: var(--text); }
.table .cell-sub { font-size: var(--fs-11); color: var(--text-3); }
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 14px; border-bottom: 1px solid var(--border); }
.toolbar .select, .toolbar .input { height: var(--h-sm); font-size: var(--fs-12); width: auto; }
.toolbar .search { min-width: 220px; flex: 1 1 240px; }
.pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 14px; font-size: var(--fs-12); color: var(--text-3); }

/* ===== Tab (board 32, 34) ===== */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tabs a, .tabs button { display: inline-flex; align-items: center; height: 40px; padding: 0 14px; font-size: var(--fs-13); font-weight: 600;
  color: var(--text-3); border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; cursor: pointer; text-decoration: none; }
.tabs [aria-selected="true"], .tabs .active { color: var(--text); border-bottom-color: var(--accent); }

/* ===== Modal (board 35) ===== */
.modal-backdrop { position: fixed; inset: 0; background: rgba(15, 23, 43, .45); display: flex; align-items: flex-start; justify-content: center;
  padding: 7vh 16px 24px; z-index: 50; overflow-y: auto; }
.modal { width: 100%; max-width: 560px; background: var(--white); border-radius: 22px; box-shadow: var(--shadow-modal); display: flex; flex-direction: column; }
.modal-lg { max-width: 720px; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 0; }
.modal-body { padding: 18px 24px; display: flex; flex-direction: column; gap: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; padding: 0 24px 22px; flex-wrap: wrap; }
.icon-btn { width: 34px; height: 34px; border-radius: 999px; border: 1px solid var(--border); background: var(--white); display: inline-flex;
  align-items: center; justify-content: center; cursor: pointer; color: var(--text-2); flex: 0 0 auto; }
.icon-btn:hover { background: var(--slate-50); color: var(--text); }
.icon { width: 16px; height: 16px; flex: 0 0 auto; }
.menu { position: absolute; background: var(--white); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
  padding: 6px; min-width: 200px; z-index: 40; display: flex; flex-direction: column; }
.menu a, .menu button { all: unset; display: block; padding: 9px 12px; border-radius: var(--r-sm); font-size: var(--fs-13); cursor: pointer; color: var(--text); }
.menu a:hover, .menu button:hover, .menu a:focus-visible, .menu button:focus-visible { background: var(--slate-100); }
.menu .danger { color: var(--err-strong); }
.menu-sep { height: 1px; background: var(--border); margin: 5px 4px; }
.field > .seg, .field > .row > .seg { align-self: flex-start; }
.seg { flex-wrap: wrap; max-width: 100%; }
.area-console .auth-brand h1 em { color: var(--console-300); }
