/* NCC Payments Dashboard - CSS viet tay, khong framework, khong asset ngoai. */

@font-face {
  font-family: "Mona Sans";
  src: url("/static/MonaSans-VariableFont.ttf") format("truetype-variations");
  font-weight: 200 900;
  font-style: normal;
  font-display: swap;
}

:root {
  --yellow: #FED519;
  --ink: #414545;
  --purple: #7E00EC;
  --red: #ED3201;
  --bg: #F6F6F4;
  --card: #FFFFFF;
  --line: #E2E3E0;
  --muted: #6E7373;
  --ok: #1B7F4B;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(65, 69, 69, .08), 0 4px 14px rgba(65, 69, 69, .05);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "Mona Sans", "Segoe UI", system-ui, -apple-system, Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { margin: 0 0 .4rem; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 1.45rem; }
h2 { font-size: 1.12rem; }
h3 { font-size: .98rem; }

/* --- header --- */
.topbar {
  background: var(--ink);
  color: #fff;
  padding: .55rem 1rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .75rem;
}
.brand {
  font-weight: 800;
  font-size: 1.05rem;
  color: var(--yellow);
  letter-spacing: .02em;
  white-space: nowrap;
}
.brand span { color: #fff; font-weight: 500; }
.topbar .spacer { flex: 1 1 auto; }
.topbar .who { font-size: .85rem; color: #D8DBDA; white-space: nowrap; }
.topbar .who b { color: #fff; }

nav.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: .25rem;
  background: var(--ink);
  padding: 0 .75rem .5rem;
}
nav.tabs a {
  color: #D8DBDA;
  padding: .35rem .7rem;
  border-radius: 999px;
  font-size: .92rem;
  font-weight: 600;
}
nav.tabs a:hover { background: rgba(255, 255, 255, .1); text-decoration: none; }
nav.tabs a.active { background: var(--yellow); color: var(--ink); }

/* --- pull box --- */
.pull { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.pull .stamp { font-size: .78rem; color: #D8DBDA; white-space: nowrap; }
.pull .stamp b { color: #fff; }
.pull .state { font-size: .78rem; font-weight: 700; }
.pull .state.running { color: var(--yellow); }
.pull .state.failed { color: #FF8A6B; }
.pull .state.done { color: #9BE7B8; }

/* --- layout --- */
main { padding: 1rem; max-width: 1280px; margin: 0 auto; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: .9rem 1rem;
  margin-bottom: 1rem;
}
.card > h2 { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.row { display: flex; flex-wrap: wrap; gap: 1rem; align-items: flex-start; }
.row > * { flex: 1 1 260px; }

.kpis { display: flex; flex-wrap: wrap; gap: .75rem; margin-bottom: 1rem; }
.kpi {
  flex: 1 1 190px;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--yellow);
  border-radius: var(--radius);
  padding: .7rem .9rem;
  box-shadow: var(--shadow);
}
.kpi .label { font-size: .78rem; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 1.35rem; font-weight: 800; }
.kpi .sub { font-size: .8rem; color: var(--muted); }
.kpi.danger { border-left-color: var(--red); }
.kpi.danger .value { color: var(--red); }
.kpi.accent { border-left-color: var(--purple); }

/* --- bang --- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: .9rem; min-width: 640px; }
th, td { padding: .45rem .55rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 700; white-space: nowrap; }
td.num, th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
tbody tr:hover { background: #FAFAF8; }
tr.overdue td { background: #FFF3F0; }
tr.overdue:hover td { background: #FFE9E4; }
.money { font-weight: 700; font-variant-numeric: tabular-nums; }
.money.red { color: var(--red); }
.money.muted { color: var(--muted); font-weight: 500; }

.supplier-head td {
  background: #FFFBEA;
  font-weight: 700;
  border-top: 2px solid var(--yellow);
}

/* --- badge --- */
.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 700;
  padding: .08rem .45rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #F2F2EF;
  color: var(--muted);
  white-space: nowrap;
}
.badge.red { background: #FDEAE5; border-color: #F6C3B5; color: var(--red); }
.badge.purple { background: #F3E9FF; border-color: #DDC4FA; color: var(--purple); }
.badge.yellow { background: #FFF6CC; border-color: #F2DE86; color: #7A6400; }
.badge.green { background: #E7F6ED; border-color: #B9E2CA; color: var(--ok); }

/* --- form --- */
label { display: block; font-size: .78rem; color: var(--muted); font-weight: 600; margin-bottom: .15rem; }
input[type="text"], input[type="password"], input[type="date"], input[type="number"], select, textarea {
  font: inherit;
  font-size: .9rem;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: .35rem .5rem;
  width: 100%;
  max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--yellow); outline-offset: 1px; }
.field { flex: 1 1 140px; min-width: 110px; }
.inline-form { display: flex; flex-wrap: wrap; gap: .5rem; align-items: flex-end; }

button, .btn {
  font: inherit;
  font-size: .88rem;
  font-weight: 700;
  cursor: pointer;
  border: 1px solid var(--ink);
  background: var(--yellow);
  color: var(--ink);
  border-radius: 8px;
  padding: .35rem .8rem;
  white-space: nowrap;
}
button:hover, .btn:hover { filter: brightness(.96); text-decoration: none; }
button.ghost, .btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); }
button.link { background: none; border: none; color: var(--purple); padding: .1rem .2rem; font-weight: 600; }
button.danger { background: #fff; border-color: #F6C3B5; color: var(--red); }
button[disabled] { opacity: .5; cursor: not-allowed; }

details.action { margin: 0; }
details.action > summary {
  cursor: pointer;
  font-size: .82rem;
  font-weight: 700;
  color: var(--purple);
  list-style: none;
  white-space: nowrap;
}
details.action > summary::-webkit-details-marker { display: none; }
details.action > summary::before { content: "+ "; }
details.action[open] > summary::before { content: "- "; }
details.action > div { margin-top: .4rem; padding: .5rem; background: #FAFAF8; border: 1px solid var(--line); border-radius: 8px; }

/* --- thong bao --- */
.flash, .alert {
  border-radius: var(--radius);
  padding: .55rem .8rem;
  margin-bottom: 1rem;
  font-size: .9rem;
  border: 1px solid var(--line);
  background: #FFF6CC;
  border-color: #F2DE86;
}
.alert.error { background: #FDEAE5; border-color: #F6C3B5; color: var(--red); }
.alert.info { background: #F3E9FF; border-color: #DDC4FA; color: var(--purple); }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.nowrap { white-space: nowrap; }
.empty { color: var(--muted); padding: .8rem 0; font-style: italic; }

/* --- lich --- */
table.cal { min-width: 700px; table-layout: fixed; }
table.cal th { text-align: center; }
table.cal td {
  height: 82px;
  vertical-align: top;
  border: 1px solid var(--line);
  padding: .3rem;
}
table.cal td.other { background: #FAFAF8; color: #B9BCBB; }
table.cal td.today { outline: 2px solid var(--yellow); outline-offset: -2px; background: #FFFBEA; }
table.cal td.past { background: #FCFCFA; }
table.cal .dnum { font-size: .78rem; font-weight: 700; color: var(--muted); }
table.cal .dtotal { font-size: .84rem; font-weight: 800; margin-top: .2rem; }
table.cal .dcount { font-size: .72rem; color: var(--muted); }
table.cal .carried { font-size: .72rem; color: var(--red); font-weight: 700; }

/* --- login --- */
.login-wrap { max-width: 380px; margin: 8vh auto; padding: 0 1rem; }
.login-wrap .card { padding: 1.4rem; }
.login-wrap .brand { color: var(--ink); font-size: 1.3rem; margin-bottom: .2rem; }
.login-wrap .brand span { color: var(--muted); }
.login-wrap label { margin-top: .7rem; }
.login-wrap button { width: 100%; margin-top: 1rem; padding: .5rem; }

.credential {
  background: #F3E9FF;
  border: 1px solid #DDC4FA;
  border-radius: var(--radius);
  padding: .7rem .9rem;
  margin-bottom: 1rem;
}
.credential code {
  font-size: 1.05rem;
  font-weight: 800;
  background: #fff;
  padding: .1rem .4rem;
  border-radius: 6px;
  border: 1px solid #DDC4FA;
}

footer.foot { text-align: center; color: var(--muted); font-size: .78rem; padding: 1rem; }

@media (max-width: 640px) {
  main { padding: .7rem; }
  .kpi { flex: 1 1 100%; }
  .topbar { gap: .5rem; }
  .topbar .who { width: 100%; }
}
