/* Thành phần dùng lại trên mọi màn hình. */

/* Nút */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 12px; border: 1.5px solid transparent; background: none; font-weight: 700; font-size: 15px; line-height: 20px; text-decoration: none; white-space: nowrap; transition: background-color .15s, border-color .15s, color .15s; }
.btn.sand { background: var(--sand-btn); border-color: var(--sand-btn); }
.btn.sand:hover { background: var(--sand-btn-h); border-color: var(--sand-btn-h); }
.btn.deep { background: var(--deep); border-color: var(--deep); color: #fff; }
.btn.deep:hover { background: #124655; border-color: #124655; }
.btn.line { border-color: var(--deep); background: #fff; }
.btn.line:hover { background: #EEF4F2; }
.btn.ghost { color: var(--deep); padding: 0 12px; }
.btn.ghost:hover { background: rgba(11, 52, 64, .07); }
.btn.danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn.danger:hover { background: #80231A; border-color: #80231A; }
.btn.white-line { border-color: rgba(255, 255, 255, .9); color: #fff; }
.btn.white-line:hover { background: #fff; color: var(--deep); }
.btn.sm { min-height: 44px; padding: 0 13px; font-size: 14px; font-weight: 600; }
.btn.block { width: 100%; }
.btn[disabled], .btn[aria-disabled=true] { opacity: 1; background: #E5E9E7; border-color: #E5E9E7; color: #586F74; cursor: not-allowed; }

.icon-btn { width: 44px; height: 44px; display: inline-grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--deep); background: #fff; transition: background-color .15s, color .15s; flex: none; }
.icon-btn:hover { background: var(--deep); color: #fff; }
.icon-btn[disabled] { border-color: #C9D3D0; color: #8A9C9E; background: #F4F6F5; cursor: not-allowed; }
.icon-btn.flat { border-color: transparent; background: transparent; }
.icon-btn.flat:hover { background: rgba(11, 52, 64, .08); color: var(--deep); }

/* Nút bỏ phiếu */
.vote { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; padding: 0 13px; border-radius: 12px; border: 1.5px solid var(--deep); background: #fff; font-size: 14px; font-weight: 600; white-space: nowrap; transition: background-color .15s, border-color .15s; }
.vote .icon { width: 17px; height: 17px; }
.vote:hover { background: #EEF4F2; }
.vote[aria-pressed=true] { background: var(--sand-btn); border-color: var(--sand-btn); }
.vote[aria-pressed=true]:hover { background: var(--sand-btn-h); border-color: var(--sand-btn-h); }
.vote[aria-pressed=true] .icon { fill: currentColor; }
.vote[disabled] { background: #EEF1EF; border-color: #C9D3D0; color: #586F74; cursor: not-allowed; }

/* Trường nhập */
.field { display: block; }
.field > .lb { display: block; font-size: 14px; line-height: 21px; font-weight: 600; margin-bottom: 5px; }
.field .opt { font-weight: 400; color: var(--deep-soft); }
.input, .select, .textarea { display: block; width: 100%; min-height: 48px; padding: 11px 13px; border: 1.5px solid var(--line-strong); border-radius: var(--r-in); background: #fff; font-size: 16px; line-height: 24px; }
.textarea { min-height: 96px; resize: vertical; }
.input:focus, .select:focus, .textarea:focus { outline: 0; border-color: var(--deep); box-shadow: 0 0 0 1px var(--deep); }
.input::placeholder, .textarea::placeholder { color: #5A7077; opacity: 1; }
.input[readonly], .input[disabled], .select[disabled], .textarea[disabled] { background: #F1F4F2; color: var(--deep-soft); }
.field.err .input, .field.err .select, .field.err .textarea { border-color: var(--err); }
.hint { display: block; margin-top: 5px; font-size: 13.5px; line-height: 20px; color: var(--deep-soft); }
.errmsg { display: flex; gap: 5px; align-items: flex-start; margin-top: 5px; font-size: 13.5px; line-height: 20px; color: var(--err); font-weight: 500; }
.errmsg .icon { width: 16px; height: 16px; margin-top: 2px; }
.input-affix { position: relative; }
.input-affix .input { padding-right: 62px; }
.input-affix .affix { position: absolute; right: 13px; top: 12px; color: var(--deep-soft); font-size: 14px; pointer-events: none; }
.pw-toggle { position: absolute; right: 2px; top: 2px; }

/* Lựa chọn dạng thẻ và công tắc */
.choices { display: grid; gap: 10px; }
.choices.cols { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.choice { position: relative; display: flex; gap: 11px; align-items: flex-start; padding: 13px 14px; border: 1.5px solid var(--line-strong); border-radius: var(--r-in); background: #fff; cursor: pointer; }
.choice input { width: 18px; height: 18px; margin: 3px 0 0; accent-color: var(--deep); flex: none; }
.choice:has(input:checked) { border-color: var(--deep); background: var(--sand-soft); }
.choice:has(input:disabled) { background: #F1F4F2; cursor: not-allowed; }
.switch { display: inline-flex; align-items: center; gap: 9px; min-height: 32px; cursor: pointer; font-weight: 500; }
.switch input { width: 18px; height: 18px; margin: 0; accent-color: var(--deep); flex: none; }

.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 13px; border-radius: 10px; border: 1.5px solid var(--line-strong); background: #fff; font-size: 14px; font-weight: 500; }
.chip[aria-pressed=true] { background: var(--deep); border-color: var(--deep); color: #fff; font-weight: 600; }
.chip .icon { width: 16px; height: 16px; }

/* Thẻ và khối */
.card { background: #fff; border-radius: var(--r-card); box-shadow: var(--shadow-card); padding: 22px; }
.card.flat { box-shadow: none; border: 1px solid var(--line); }
.card.tight { padding: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.glass { background: var(--glass); border: 1px solid rgba(255, 255, 255, .85); backdrop-filter: blur(14px) saturate(1.3); border-radius: var(--r-card); }

/* Nhãn trạng thái */
.tag { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; padding: 3px 9px 3px 7px; border-radius: 9px; font-size: 13px; line-height: 19px; font-weight: 600; background: #EDF1EF; color: var(--deep); }
.tag .icon { width: 14px; height: 14px; }
.tag.ok { background: var(--ok-bg); color: var(--ok); }
.tag.warn { background: var(--warn-bg); color: var(--warn); }
.tag.err { background: var(--err-bg); color: var(--err); }
.tag.info { background: var(--info-bg); color: var(--info); }
.tag.sand { background: var(--sand-soft); color: var(--deep); }

/* Thông báo */
.notice { display: flex; gap: 11px; align-items: flex-start; padding: 13px 15px; border-radius: var(--r-in); font-size: 15px; line-height: 23px; background: var(--info-bg); color: var(--info); }
.notice .icon { margin-top: 2px; }
.notice.ok { background: var(--ok-bg); color: var(--ok); }
.notice.warn { background: var(--warn-bg); color: var(--warn); }
.notice.err { background: var(--err-bg); color: var(--err); }
.notice b { font-weight: 700; }
.notice a { font-weight: 600; }
.notice .grow > .btn { margin-top: 8px; }

/* Avatar thành viên */
.dot { width: 36px; height: 36px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 14px; font-weight: 700; background: var(--c, var(--deep)); color: #fff; border: 2px solid #fff; flex: none; box-shadow: 0 3px 8px -3px rgba(6, 40, 54, .6); }
.dot.sm { width: 30px; height: 30px; font-size: 13px; }
.dots { display: inline-flex; }
.dots .dot + .dot { margin-left: -8px; }

/* Bảng thông tin nhiều ô */
.ledger { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); background: #fff; border-radius: 14px; box-shadow: var(--shadow-card); overflow: hidden; }
.ledger > div { padding: 14px 18px; border-left: 1px solid var(--line); }
.ledger > div:first-child { border-left: 0; }
.ledger dt, .ledger .k { font-size: 13px; line-height: 18px; color: var(--deep-soft); }
.ledger dd, .ledger .v { margin-top: 3px; font-size: 16px; line-height: 23px; font-weight: 600; }

.kv { display: grid; gap: 0; }
.kv > div { display: grid; grid-template-columns: minmax(120px, 2fr) minmax(0, 3fr); gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 15px; line-height: 22px; }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--deep-soft); }
.kv dd { font-weight: 500; }

/* Thanh trắng chia ô */
.segbar { display: flex; background: #fff; border-radius: 14px; box-shadow: 0 14px 26px -22px rgba(6, 40, 54, .8); }
.seg { display: flex; align-items: center; gap: 13px; min-height: 70px; padding: 8px 20px; flex: 1 1 0; min-width: 0; border-left: 1px solid var(--line); cursor: text; }
.seg:first-child { border-left: 0; border-radius: 14px 0 0 14px; }
.seg:last-child { border-radius: 0 14px 14px 0; }
.seg .icon { width: 22px; height: 22px; color: var(--deep-soft); }
.seg > span { display: block; flex: 1; min-width: 0; }
.seg small { display: block; font-size: 13px; line-height: 18px; color: var(--deep-soft); }
.seg input, .seg select { display: block; width: 100%; padding: 0; border: 0; outline: 0; background: none; font-size: 15px; line-height: 23px; font-weight: 600; }
.seg input::placeholder { color: #5A7077; font-weight: 400; opacity: 1; }
.seg:focus-within { box-shadow: inset 0 0 0 2px var(--deep); }
@media (max-width: 720px) {
  .segbar { flex-direction: column; }
  .seg { flex: none; border-left: 0; border-top: 1px solid var(--line); border-radius: 0; }
  .seg:first-child { border-top: 0; border-radius: 14px 14px 0 0; }
  .seg:last-child { border-radius: 0 0 14px 14px; }
}

/* Thẻ tab con và bước */
.tabs { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.tab { flex: none; display: inline-flex; align-items: center; gap: 7px; min-height: 44px; padding: 0 14px; border-radius: 11px; border: 0; background: none; font-size: 15px; font-weight: 500; text-decoration: none; color: var(--deep); }
.tab:hover { background: rgba(11, 52, 64, .07); }
.tab[aria-current], .tab[aria-pressed=true] { background: var(--deep); color: #fff; font-weight: 600; }
.tab .count { font-size: 13px; opacity: .8; }

.steps { display: flex; gap: 8px; flex-wrap: wrap; counter-reset: st; }
.step { flex: 1 1 200px; display: flex; gap: 11px; align-items: center; padding: 11px 14px; border-radius: var(--r-in); background: #fff; border: 1.5px solid var(--line); text-decoration: none; font-size: 15px; font-weight: 500; }
.step i { font-style: normal; width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; background: #EDF1EF; font-size: 14px; font-weight: 700; flex: none; }
.step[aria-current] { border-color: var(--deep); font-weight: 700; }
.step[aria-current] i { background: var(--deep); color: #fff; }
.step.done i { background: var(--ok-bg); color: var(--ok); }

/* Bảng */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 15px; line-height: 22px; }
.table th { text-align: left; font-size: 13px; line-height: 18px; color: var(--deep-soft); font-weight: 600; padding: 8px 12px; border-bottom: 1.5px solid var(--line-strong); }
.table td { padding: 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }

/* Trạng thái rỗng */
.empty { display: grid; justify-items: center; gap: 8px; padding: 44px 22px; text-align: center; background: #fff; border: 1.5px dashed var(--line-strong); border-radius: var(--r-card); }
.empty .icon { width: 32px; height: 32px; color: var(--deep-soft); }
.empty p { max-width: 54ch; color: var(--deep-soft); }
.empty .btn { margin-top: 8px; }

/* Hộp thoại và thông báo nổi */
dialog.modal { border: 0; border-radius: 20px; padding: 0; width: min(540px, calc(100vw - 24px)); max-height: calc(100vh - 32px); background: #fff; color: var(--deep); box-shadow: var(--shadow-float); }
dialog.modal.wide { width: min(760px, calc(100vw - 24px)); }
dialog.modal::backdrop { background: rgba(7, 34, 46, .58); backdrop-filter: blur(3px); }
.modal-body { padding: 24px; display: grid; gap: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 10px; flex-wrap: wrap; padding: 0 24px 22px; }
.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); width: max-content; max-width: calc(100vw - 32px); padding: 12px 18px; border-radius: 12px; background: var(--deep); color: #fff; font-size: 14px; line-height: 21px; z-index: 60; box-shadow: var(--shadow-float); }

.pop { position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 230px; padding: 8px; border-radius: 14px; background: #fff; color: var(--deep); box-shadow: var(--shadow-float); }
.pop a, .pop button { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 0 10px; border: 0; border-radius: 9px; background: none; text-decoration: none; font-size: 15px; font-weight: 500; }
.pop a:hover, .pop button:hover { background: #EEF4F2; }
.pop .who { padding: 8px 10px 10px; border-bottom: 1px solid var(--line); margin-bottom: 6px; font-size: 14px; line-height: 20px; }

.progress { height: 8px; border-radius: 4px; background: #E5ECE9; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--deep); border-radius: 4px; transition: width .3s; }
.progress.over > i { background: var(--err); }
.progress.warnbar > i { background: var(--sand-2); }

.spin { width: 20px; height: 20px; border: 2.5px solid rgba(11, 52, 64, .2); border-top-color: var(--deep); border-radius: 50%; animation: spin .8s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Ảnh giữ chỗ dệt khi chưa có ảnh thật */
.woven { background: repeating-linear-gradient(90deg, rgba(214, 168, 112, .2) 0 7px, transparent 7px 14px), repeating-linear-gradient(0deg, #FBEFDD 0 7px, #FFF8EC 7px 14px); }
