/* ---------- Card ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); box-shadow: var(--shadow-card); min-width: 0; transition: box-shadow var(--ease); }
.card:hover { box-shadow: 0 2px 4px rgba(23, 33, 43, .05), 0 4px 14px rgba(23, 33, 43, .07); }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px 8px; min-height: 44px; }
.card-head h2 { font-size: 13px; font-weight: 600; color: var(--text-primary); line-height: 1.3; }
.head-actions { display: flex; gap: 8px; align-items: center; }
.head-actions.wrap { flex-wrap: wrap; justify-content: flex-end; }
.spaced { margin-bottom: 12px; } .spaced-top { margin-top: 10px; border-top: 1px solid var(--divider); }
.pad { padding: 4px 14px 14px; }
.pad-card { padding-bottom: 12px; }

/* ---------- Nút ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 32px; padding: 0 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-ctl); cursor: pointer;
  font-size: 12px; font-weight: 500; color: var(--text-body); white-space: nowrap;
  transition: background var(--ease), border-color var(--ease), box-shadow var(--ease);
}
.btn:hover { background: var(--content-bg); border-color: var(--text-disabled); text-decoration: none; }
.btn svg { width: 14px; height: 14px; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: color-mix(in srgb, var(--primary) 88%, #000); border-color: color-mix(in srgb, var(--primary) 88%, #000); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 88%, #000); border-color: color-mix(in srgb, var(--danger) 88%, #000); }
.btn-danger-outline { color: var(--danger); border-color: var(--danger-soft); }
.btn-danger-outline:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-sm { height: 28px; padding: 0 9px; font-size: 11.5px; }
.btn-block { width: 100%; height: 38px; }
.btn[disabled], .btn.is-loading { opacity: .6; pointer-events: none; }
.icon-btn { width: 32px; height: 32px; display: inline-grid; place-items: center; background: transparent; border: 0; border-radius: 8px; cursor: pointer; color: var(--text-secondary); position: relative; transition: background var(--ease); }
.icon-btn:hover { background: var(--divider); }
.icon-btn svg { width: 16px; height: 16px; }

/* ---------- Form ---------- */
.input { height: 32px; width: 100%; padding: 0 10px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-ctl); font-size: 12px; transition: border-color var(--ease), box-shadow var(--ease); }
textarea.input { height: auto; padding: 8px 10px; resize: vertical; min-height: 64px; }
.input:focus { outline: 0; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input.sm { height: 28px; font-size: 11.5px; width: auto; }
select.input { padding-right: 24px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field > span { font-size: 11.5px; font-weight: 500; color: var(--text-secondary); }
.field .req { color: var(--danger); }
.field.actions { justify-content: flex-end; }
.form-stack { display: flex; flex-direction: column; gap: 12px; }
.form-stack.narrow { max-width: 380px; padding: 4px 14px 14px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.check-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.check-row.compact { white-space: nowrap; }
.hint { font-size: 11px; color: var(--text-secondary); }
.inline-search { display: flex; align-items: center; gap: 6px; height: 32px; padding: 0 10px; width: 230px; max-width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-ctl); }
.inline-search:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.inline-search svg { width: 14px; height: 14px; color: var(--text-secondary); flex: none; }
.inline-search input { border: 0; outline: 0; background: transparent; flex: 1; min-width: 0; font-size: 12px; }

/* ---------- Badge / trạng thái ---------- */
.badge { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 10.5px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.badge-blue { background: var(--primary-soft); color: var(--primary); }
.badge-teal { background: var(--teal-soft); color: var(--teal); }
.badge-warn { background: var(--warning-soft); color: color-mix(in srgb, var(--orange) 80%, #000); }
.badge-danger { background: var(--danger-soft); color: var(--danger); }
.badge-ok { background: var(--success-soft); color: var(--success); }
.badge-gray { background: var(--divider); color: var(--text-secondary); }
.status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--text-disabled); flex: none; }
.dot.ok { background: var(--success); } .dot.warn { background: var(--warning); } .dot.danger { background: var(--danger); } .dot.blue { background: var(--primary); } .dot.teal { background: var(--teal); }
.badge-dot { position: absolute; top: 3px; right: 3px; min-width: 14px; height: 14px; padding: 0 3px; border-radius: 999px; background: var(--danger); color: #fff; font-size: 9px; font-weight: 700; display: grid; place-items: center; }
.avatar { width: 28px; height: 28px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); display: inline-grid; place-items: center; font-weight: 700; font-size: 12px; flex: none; }
.avatar.sm { width: 26px; height: 26px; }

/* ---------- Bảng ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 12px; }
.table th { text-align: left; font-size: 11.5px; font-weight: 600; color: var(--text-body); padding: 10px 12px; background: var(--content-bg); border-top: 1px solid var(--divider); border-bottom: 1px solid var(--divider); white-space: nowrap; }
.table th.num { text-align: right; }
.table td { padding: 8px 12px; border-bottom: 1px solid var(--divider); vertical-align: middle; }
.table tbody tr { transition: background var(--ease); }
.table tbody tr:hover { background: var(--content-bg); }
.table.compact td { padding: 7px 12px; }
.table tfoot td { font-weight: 600; background: var(--content-bg); border-bottom: 0; }
.table .empty, .empty { text-align: center; color: var(--text-secondary); padding: 22px 12px; }
.table-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 14px; font-size: 12px; }
.pager { display: flex; gap: 4px; flex-wrap: wrap; }
.pager button { min-width: 30px; height: 30px; padding: 0 8px; border: 1px solid var(--border); background: var(--surface); border-radius: 7px; cursor: pointer; font-size: 12px; transition: background var(--ease); }
.pager button:hover:not([disabled]) { background: var(--content-bg); }
.pager button.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.pager button[disabled] { color: var(--text-disabled); cursor: default; }
.note { margin-top: 8px; }

/* ---------- Progress ---------- */
.progress { height: 6px; background: var(--divider); border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--primary), var(--teal)); transition: width 200ms ease; }
.progress.sm { height: 5px; }

/* ---------- Dropdown ---------- */
.dropdown { position: relative; }
.user-btn { display: flex; align-items: center; gap: 4px; background: transparent; border: 0; cursor: pointer; padding: 2px 4px; border-radius: 999px; color: var(--text-secondary); }
.user-btn svg { width: 14px; height: 14px; }
.dropdown-menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 210px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 6px; z-index: 60; }
.dropdown-menu a, .dropdown-menu button, .row-menu button { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; background: transparent; border: 0; border-radius: 7px; cursor: pointer; font-size: 12px; color: var(--text-body); text-align: left; }
.dropdown-menu a:hover, .dropdown-menu button:hover, .row-menu button:hover { background: var(--content-bg); text-decoration: none; }
.dropdown-menu svg, .row-menu svg { width: 14px; height: 14px; color: var(--text-secondary); }
.menu-head { padding: 8px 10px 8px; border-bottom: 1px solid var(--divider); margin-bottom: 4px; display: flex; flex-direction: column; }
.menu-head small { color: var(--text-secondary); font-size: 11px; }
.bell-menu { min-width: 250px; }
.bell-menu .item { padding: 8px 10px; font-size: 12px; border-radius: 7px; display: flex; gap: 8px; align-items: center; }
.row-menu { position: fixed; z-index: 90; min-width: 180px; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-pop); padding: 6px; }
.row-menu .sep { height: 1px; background: var(--divider); margin: 4px 0; }
.row-menu .danger { color: var(--danger); }

/* ---------- Modal ---------- */
.modal-overlay { position: fixed; inset: 0; z-index: 100; background: rgba(23, 33, 43, .42); display: flex; align-items: flex-start; justify-content: center; padding: 5vh 12px; overflow-y: auto; opacity: 0; transition: opacity var(--ease); }
.modal-overlay.open { opacity: 1; }
.modal { width: 100%; max-width: 560px; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-pop); transform: translateY(8px); transition: transform var(--ease); }
.modal.lg { max-width: 760px; } .modal.sm { max-width: 420px; }
.modal-overlay.open .modal { transform: none; }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--divider); }
.modal-head h3 { font-size: 15px; font-weight: 650; color: var(--text-primary); }
.modal-body { padding: 16px 18px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--divider); background: var(--content-bg); border-radius: 0 0 14px 14px; }
.kv { display: grid; grid-template-columns: 130px 1fr; gap: 6px 12px; font-size: 12.5px; }
.kv dt { color: var(--text-secondary); } .kv dd { margin: 0; color: var(--text-primary); word-break: break-word; }
.form-error { color: var(--danger); font-size: 12px; margin-top: 10px; min-height: 0; }

/* ---------- Toast / alert ---------- */
.toast-root { position: fixed; right: 14px; bottom: 14px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 28px); }
.toast { background: var(--text-primary); color: #fff; padding: 10px 14px; border-radius: 10px; font-size: 12.5px; box-shadow: var(--shadow-pop); opacity: 0; transform: translateY(6px); transition: opacity var(--ease), transform var(--ease); max-width: 360px; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); } .toast.success { background: var(--success); }
.alert { padding: 10px 12px; border-radius: 8px; font-size: 12.5px; margin: 10px 0; text-align: left; }
.alert-danger { background: var(--danger-soft); color: var(--danger); }
.alert-success { background: var(--success-soft); color: var(--success); }
.alert-warning { background: var(--warning-soft); color: color-mix(in srgb, var(--orange) 75%, #000); }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; margin-bottom: 12px; border-bottom: 1px solid var(--border); overflow-x: auto; }
.tab { background: transparent; border: 0; padding: 9px 14px; font-size: 12.5px; font-weight: 500; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- Skeleton ---------- */
.skeleton { color: transparent !important; background: linear-gradient(90deg, var(--divider), var(--content-bg), var(--divider)); background-size: 200% 100%; border-radius: 6px; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }

.help-list { padding: 4px 14px 10px 32px; list-style: decimal; display: flex; flex-direction: column; gap: 8px; font-size: 12.5px; }
.help-list.plain { list-style: none; padding-left: 14px; }
.page-intro { margin-bottom: 10px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
