/* Phong cách ngân hàng: xanh lá đậm + trắng, chữ hệ thống SF, cỡ 14px.
   Bố cục: thanh đầu trang xanh, nội dung một cột trên điện thoại, hai cột từ 900px. */
:root {
  --brand: #006b3f;        /* xanh lá đậm – thanh đầu trang, nút chính */
  --brand-2: #00843d;      /* xanh lá vừa – hover, nhấn */
  --brand-soft: #e7f3ec;   /* nền nhạt cho vùng nhấn */
  --bg: #f4f7f5;           /* nền trang trắng ngả xanh */
  --surface: #ffffff;
  --ink: #1b2a22;
  --muted: #5f6f66;
  --line: #dde6e0;
  --warn: #b26a00; --warn-soft: #fff4e0;
  --bad: #c62828; --bad-soft: #fdecea;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", "Segoe UI", Roboto, Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
h1, h2, h3 { margin: 0; line-height: 1.3; text-wrap: balance; }
h1 { font-size: 18px; font-weight: 600; }
h2 { font-size: 16px; font-weight: 600; color: var(--brand); }
h3 { font-size: 14px; font-weight: 600; }
.num, td.num, .tile .v { font-variant-numeric: tabular-nums; }

.topbar { background: var(--brand); color: #fff; }
.topbar .in { max-width: 1180px; margin: 0 auto; padding: 14px 16px; display: flex; flex-wrap: wrap; gap: 12px; align-items: center; justify-content: space-between; }
.topbar p { margin: 2px 0 0; font-size: 13px; opacity: .85; }
.topbar select { background: rgba(255,255,255,.15); color: #fff; border-color: rgba(255,255,255,.35); }
.topbar select option { color: var(--ink); }

.wrap { max-width: 1180px; margin: 0 auto; padding: 16px; display: grid; gap: 16px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 16px; display: grid; gap: 12px; min-width: 0; }
.grid2 { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 900px) { .grid2 { grid-template-columns: 1fr 1fr; } }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.muted { color: var(--muted); } .small { font-size: 13px; } .note { font-size: 12px; color: var(--muted); }
.hidden { display: none !important; }

button, select, input, textarea { font: inherit; color: inherit; }
.btn { border: 1px solid var(--line); background: var(--surface); border-radius: 8px; padding: 8px 14px; cursor: pointer; font-weight: 500; }
.btn:hover { border-color: var(--brand-2); color: var(--brand); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-2); color: #fff; }
.btn.primary:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 4px 10px; font-size: 13px; }
:is(.btn, select, input, textarea, .drop):focus-visible { outline: 2px solid var(--brand-2); outline-offset: 2px; }
select, input, textarea { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0; }
label.f { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
label.f :is(input, select, textarea) { color: var(--ink); }
.formGrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }

.drop { border: 2px dashed #b9d3c3; background: var(--brand-soft); border-radius: 12px; padding: 20px; text-align: center; cursor: pointer; display: grid; gap: 4px; place-items: center; }
.drop.over { border-color: var(--brand); }
.drop strong { color: var(--brand); }
.thumbs { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 4px; }
.thumb { position: relative; flex: 0 0 auto; width: 78px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #fff; }
.thumb img { width: 100%; height: 110px; object-fit: cover; object-position: top; display: block; }
.thumb .x { position: absolute; top: 3px; right: 3px; border: 0; border-radius: 50%; width: 22px; height: 22px; background: rgba(0,0,0,.55); color: #fff; cursor: pointer; line-height: 1; }
.thumb .st { font-size: 11px; padding: 3px 4px; line-height: 1.3; }
.thumb .st.warn { background: var(--warn-soft); color: var(--warn); }
.log { font-size: 13px; color: var(--muted); max-height: 140px; overflow: auto; white-space: pre-wrap; }

.tiles { display: grid; gap: 12px; grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; min-width: 0; }
.tile.main { background: var(--brand); color: #fff; border-color: var(--brand); }
.tile .k { font-size: 12px; opacity: .8; } .tile .v { font-size: 20px; font-weight: 600; overflow-wrap: anywhere; } .tile .s { font-size: 12px; opacity: .75; }

.bars { display: grid; gap: 8px; }
.bar { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 10px; font-size: 13px; }
.bar .lab { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar .val { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.bar .track { grid-column: 1 / -1; height: 8px; background: #edf2ee; border-radius: 4px; overflow: hidden; }
.bar .fill { height: 100%; border-radius: 4px; background: var(--brand-2); }

.donutBox { display: grid; gap: 16px; align-items: center; grid-template-columns: 1fr; }
@media (min-width: 520px) { .donutBox { grid-template-columns: 180px 1fr; } }
.donutBox svg { width: 180px; height: 180px; margin: 0 auto; display: block; }
.legend { display: grid; gap: 6px; font-size: 13px; }
.legend div { display: grid; grid-template-columns: 12px minmax(0, 1fr) auto auto; gap: 8px; align-items: center; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: block; }
.legend .p { font-weight: 600; min-width: 46px; text-align: right; font-variant-numeric: tabular-nums; }
.legend .a { color: var(--muted); min-width: 84px; text-align: right; font-variant-numeric: tabular-nums; }

.tblWrap { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 7px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-weight: 600; white-space: nowrap; background: #f7faf8; }
td.num { text-align: right; white-space: nowrap; }
td select, td input { font-size: 13px; padding: 4px 6px; }
td input.amt { width: 110px; text-align: right; }
td input.dt { width: 130px; }
tr.low td { background: var(--warn-soft); }

.pill { display: inline-block; font-size: 12px; padding: 1px 8px; border-radius: 999px; font-weight: 600; }
.pill.good { background: var(--brand-soft); color: var(--brand); } .pill.warn { background: var(--warn-soft); color: var(--warn); } .pill.bad { background: var(--bad-soft); color: var(--bad); }
.habit { border-left: 4px solid var(--line); padding: 6px 10px; display: grid; gap: 2px; background: #fbfcfb; border-radius: 0 8px 8px 0; }
.habit.good { border-color: var(--brand-2); } .habit.warn { border-color: var(--warn); } .habit.bad { border-color: var(--bad); }
.score { display: flex; gap: 16px; align-items: center; }
.score .n { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; }
.cols3 { display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 800px) { .cols3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.cols3 > div { background: var(--brand-soft); border-radius: 10px; padding: 12px; display: grid; gap: 6px; align-content: start; }
ul.clean { margin: 0; padding-left: 18px; display: grid; gap: 4px; }
.banner { background: var(--warn-soft); border-radius: 8px; padding: 10px 12px; font-size: 13px; }
.banner.ok { background: var(--brand-soft); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs button { border: 0; background: none; padding: 8px 12px; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs button[aria-selected="true"] { color: var(--brand); border-color: var(--brand); font-weight: 600; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
