/* MIDU OS v3: lớp bổ sung cho app.css (app.css chép từ bản cũ, giữ nguyên). Chỉ thêm lớp mới, không ghi đè lớp cũ trừ chỗ ghi rõ. */

/* ------------------------------------------------------------------ người */
.av { display: inline-flex; align-items: center; justify-content: center; flex: none; border-radius: 50%; background: var(--av, #8a6e4b); color: #fff; font-weight: 700; line-height: 1; user-select: none; }
.chip.nguoi { padding-left: 2px; gap: 6px; }
.chip.nha .dot { width: 8px; height: 8px; }
.user-chip { display: inline-flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 4px; border-radius: 10px; border: 0; background: transparent; cursor: pointer; color: var(--text); text-align: left; font: inherit; }
.user-chip:hover { background: var(--fill); }
.uc-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.uc-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 140px; }
.uc-role { font-size: 11px; color: var(--text-3); }
.sidebar .sb-user { display: flex; align-items: center; gap: 8px; padding: 8px 4px 0; border-top: 1px solid var(--hair); }
.sidebar .sb-user .user-chip { flex: 1; min-width: 0; }
.sidebar .sb-user .uc-name { max-width: 150px; }
.sb-names { display: flex; flex-direction: column; min-width: 0; }
.sb-name .os { color: var(--accent); }
.tb-bell { position: relative; }
.tb-badge { position: absolute; top: 1px; right: 1px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--crit); color: #fff; font-size: 10.5px; font-weight: 700; display: grid; place-items: center; line-height: 1; }
.nav-gap { flex: 1; }
.nav-count.live { color: var(--accent); font-weight: 600; }
.palette-root.open { position: fixed; inset: 0; z-index: 55; }

/* --------------------------------------------------------- thanh dưới (điện thoại) */
.tabbar { display: none; }
@media (max-width: 860px) {
  .tabbar { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); position: fixed; left: 8px; right: 8px; bottom: 8px; height: 60px; z-index: 35; border-radius: 18px; background: var(--glass-strong); backdrop-filter: blur(30px) saturate(180%); -webkit-backdrop-filter: blur(30px) saturate(180%); border: 1px solid var(--edge); box-shadow: var(--sh-pop); }
  .tab-item { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; border: 0; background: transparent; color: var(--text-2); font-size: 10.5px; font-weight: 500; cursor: pointer; text-decoration: none; font-family: inherit; min-width: 0; }
  .tab-item .ic { width: 20px; height: 20px; }
  .tab-item.on { color: var(--accent); font-weight: 600; }
  .tab-item:hover { text-decoration: none; }
  .tab-badge { position: absolute; top: 6px; left: calc(50% + 6px); min-width: 16px; height: 16px; padding: 0 4px; border-radius: 99px; background: var(--crit); color: #fff; font-size: 10px; font-weight: 700; display: grid; place-items: center; }
  .content { padding-bottom: 84px; }
  .gop-y-btn { bottom: 80px; }
  .toast-root { bottom: 84px; }
}

/* ------------------------------------------------------------- đăng nhập */
body.auth .sidebar, body.auth .toolbar, body.auth .sb-scrim, body.auth .tabbar, body.auth .gop-y-btn { display: none !important; }
body.auth .app { grid-template-columns: minmax(0, 1fr); }
body.auth .content { display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-wrap { width: 100%; display: flex; justify-content: center; }
.login-card { width: min(400px, 100%); padding: 28px 26px 22px; border-radius: var(--r-xl); display: flex; flex-direction: column; gap: 14px; border: 1px solid var(--edge); box-shadow: var(--sh-2); }
.login-card .field-label { margin: 0 0 6px; }
.login-brand { display: flex; align-items: center; gap: 12px; }
.login-brand .sb-name { font-size: 22px; }
.login-brand .logo { width: 40px; height: 40px; border-radius: 50%; background: none; box-shadow: none; }
.login-brand .logo svg { width: 40px; height: 40px; }
.login-title { font-size: 14px; color: var(--text-2); }
.login-err { background: var(--crit-soft); color: var(--text); padding: 9px 11px; border-radius: 10px; font-size: 13px; }
.login-err[hidden] { display: none; }
.login-demo { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.login-demo b { color: var(--text-2); font-weight: 600; }
.btn.lg { height: 44px; font-size: 15px; justify-content: center; border-radius: 12px; }
.btn.wide { width: 100%; justify-content: center; }

/* --------------------------------------------------------------- ngăn kéo */
.drawer-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.drawer-title > .ic { width: 20px; height: 20px; color: var(--accent); flex: none; }
.drawer-title .head-title { font-size: 17px; font-weight: 700; }
.drawer-title .sub { margin-top: 1px; font-size: 12.5px; }
.drawer-foot { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 12px 18px; border-top: 1px solid var(--hair); flex: none; flex-wrap: wrap; }
.drawer-foot .sp { flex: 1; }

/* ------------------------------------------------------------ bố cục chung */
.section-title .right { margin-left: auto; font-weight: 400; font-size: 12.5px; display: inline-flex; gap: 8px; align-items: center; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.hang { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.hang.giua { justify-content: space-between; }
.hang .sp, .sp { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.stack.sm { gap: 6px; }
.list { display: flex; flex-direction: column; }
.list-item { display: flex; align-items: center; gap: 12px; padding: 10px 6px; border-bottom: 1px solid var(--hair); min-width: 0; }
.list-item:last-child { border-bottom: 0; }
.list-item.clickable { cursor: pointer; border-radius: 10px; }
.list-item.clickable:hover { background: var(--fill-2); }
.li-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.li-title { font-weight: 500; font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.li-sub { font-size: 12.5px; color: var(--text-3); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.li-right { display: flex; align-items: center; gap: 6px; flex: none; }
.table-wrap { overflow-x: auto; border-radius: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--text-3); padding: 8px 10px; border-bottom: 1px solid var(--hair-2); white-space: nowrap; }
.table td { padding: 9px 10px; border-bottom: 1px solid var(--hair); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: var(--fill-2); }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.dl { display: grid; grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); gap: 6px 14px; font-size: 13.5px; margin: 0; }
.dl dt { color: var(--text-3); }
.dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }
.log-box { font-family: var(--font-mono); font-size: 12px; line-height: 1.5; background: var(--fill-2); border-radius: 10px; padding: 10px 12px; max-height: 380px; overflow: auto; white-space: pre-wrap; word-break: break-word; margin: 0; }
.page-err { padding: 24px; }
textarea.input { height: auto; min-height: 84px; padding: 8px 11px; resize: vertical; line-height: 1.5; font: inherit; font-size: 13.5px; }
select.input { padding-right: 28px; }
.note { font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ----------------------------------------------------------------- biểu đồ */
.spark { display: block; max-width: 100%; }
.bieu-cot { display: flex; align-items: flex-end; gap: 8px; padding: 0 4px; }
.cot { flex: 1; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; gap: 6px; }
.cot-fill { width: 100%; max-width: 44px; border-radius: 6px 6px 2px 2px; background: var(--accent); min-height: 2px; transition: height .3s; }
.cot-label { font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.hm-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid var(--hair); }
.hm-row:last-child { border-bottom: 0; }
.hm-ten { display: flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 500; min-width: 0; }
.hm-ten span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hm-hoi { font-size: 12px; color: var(--text-3); white-space: nowrap; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.so-lon { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }

/* --------------------------------------------------- bước hướng dẫn, dòng thời gian */
.buoc { display: flex; gap: 14px; padding: 12px 0; border-bottom: 1px solid var(--hair); }
.buoc:last-child { border-bottom: 0; }
.buoc-so { flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent-soft); color: var(--accent); font-weight: 700; display: grid; place-items: center; font-size: 13px; }
.buoc-main { flex: 1; min-width: 0; }
.buoc-title { font-weight: 600; font-size: 14.5px; margin-bottom: 3px; }
.tl-item { display: grid; grid-template-columns: 56px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--hair); font-size: 13.5px; }
.tl-item:last-child { border-bottom: 0; }
.tl-time { font-size: 12px; color: var(--text-3); font-variant-numeric: tabular-nums; padding-top: 2px; }

/* ------------------------------------------------------------------ góp ý */
.gop-y-btn { position: fixed; right: 18px; bottom: 18px; z-index: 34; display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 12px; border-radius: 99px; border: 1px solid var(--edge); background: var(--glass-strong); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); box-shadow: var(--sh-pop); font-size: 12.5px; font-weight: 600; color: var(--text); cursor: pointer; font-family: inherit; }
.gop-y-btn:hover { background: var(--card); }
.gop-y-paste { margin-top: 10px; border: 1px dashed var(--hair-2); border-radius: 10px; padding: 12px; text-align: center; color: var(--text-3); font-size: 12.5px; cursor: text; outline: none; }
.gop-y-paste:focus { border-color: var(--accent); }
.gop-y-anh { display: block; max-width: 100%; max-height: 220px; border-radius: 8px; margin: 8px auto 0; }

/* ------------------------------------------------------------- màn hình hẹp */
@media (max-width: 860px) {
  .grid-2, .grid-3, .grid-4 { grid-template-columns: minmax(0, 1fr); }
  .tiles, .tiles-5 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hm-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .dl { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
  .dl dt { margin-top: 6px; }
  .toolbar .uc-text { display: none; }
  .toolbar .user-chip { padding: 0 4px; }
  .page-head h1 { font-size: 22px; }
}
@media (min-width: 861px) and (max-width: 1200px) {
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tổng quan */
.tq-tiles { margin-bottom: 14px; }
.tile-of { font-size: 0.6em; font-weight: 500; color: var(--text-3); margin-left: 2px; }
.tq-luoi { margin-bottom: 14px; align-items: start; }
.tq-ghi { margin: -2px 0 8px; }
.tq-row { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 5px 0; color: inherit; text-decoration: none; }
a.tq-row:hover .tq-ten span { text-decoration: underline; }
.tq-row .pbar { min-width: 0; }
.tq-ten { display: flex; align-items: center; gap: 6px; font-size: 13px; min-width: 0; }
.tq-ten span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tq-so { font-size: 13px; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }
.tq-delta { font-size: 12px; font-weight: 600; }
.tq-len { color: var(--good); }
.tq-xuong, .tq-do { color: var(--crit); }
.tq-seo-so { margin-bottom: 10px; }
.tq-hm-giua { min-width: 0; display: grid; gap: 4px; }
.tq-cap { gap: 4px; }
.tq-theo-nha { margin-top: 10px; }
.tq-row-gon { padding: 2px 0; }
.tq-farm-panel { padding-bottom: 8px; }
.tq-farm .farm-lists, .tq-farm #farm-lists { display: none; }
.tq-farm .farm-page { padding: 0; }
.tq-farm .farm-page > .page-head h1 { display: none; }
@media (max-width: 860px) {
  .tq-row { grid-template-columns: 110px minmax(0, 1fr) auto; gap: 8px; }
}
