/* Khung trang: nền, chữ, cột nội dung, thanh dưới, kiểu chữ và ô nhập dùng chung. */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: var(--fs-body);
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

h1, h2, h3, p, ul, ol { margin: 0; padding: 0; }
ul, ol { list-style: none; }
a { color: inherit; }

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  margin: 0;
  padding: 0;
  text-align: inherit;
  cursor: pointer;
}

input, textarea, select {
  font: inherit;
  font-size: var(--fs-body);
  color: var(--text);
  width: 100%;
  padding: 11px 12px;
  background: var(--surface);
  border: 1px solid var(--pill-line);
  border-radius: 10px;
}
input::placeholder, textarea::placeholder { color: var(--text-3); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Dòng cảnh báo khi kho không ghi được xuống máy. */
.warn-line {
  max-width: var(--w-max);
  margin: 0 auto;
  padding: 10px var(--gutter);
  background: var(--chip-warn-bg);
  color: var(--chip-warn-text);
  font-size: var(--fs-sm);
  font-weight: 500;
}
.warn-line[hidden] { display: none; }

/* Cột nội dung: một cột, canh giữa, rộng tối đa 560px (spec 7.9). */
main {
  max-width: var(--w-max);
  margin: 0 auto;
  padding: 26px var(--gutter) calc(var(--tabs-h) + 40px + env(safe-area-inset-bottom));
}

/* Thanh dưới: Hôm nay · Tuần · + · Tháng · Mục tiêu */
nav.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 10;
  max-width: var(--w-max);
  margin: 0 auto;
  display: flex;
  align-items: center;
  min-height: var(--tabs-h);
  padding: 6px 6px calc(6px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--line);
}
nav.tabs > a {
  flex: 1 1 0;
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  font-size: var(--fs-sm);
  color: var(--text-3);
  text-decoration: none;
  text-align: center;
}
nav.tabs > a.on { color: var(--text); font-weight: 600; }
#nut-them {
  flex: 0 0 auto;
  width: 48px;
  height: 48px;
  margin: 0 8px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--on-accent);
  font-size: 28px;
  font-weight: 400;
  line-height: 1;
  text-align: center;
  box-shadow: 0 2px 6px rgba(179, 38, 30, .25);
}

/* Kiểu chữ dùng chung */
.eye { font-size: var(--fs-hd); font-weight: 600; letter-spacing: .04em; color: var(--text-3); }
.big { font-size: var(--fs-big); font-weight: 600; letter-spacing: -.01em; line-height: 1.2; margin-top: 2px; overflow-wrap: anywhere; }
.sub { font-size: var(--fs-md); color: var(--text-3); margin-top: 3px; overflow-wrap: anywhere; }
.mut { color: var(--text-3); }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* Nút chữ trong bảng trượt */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 10px 18px;
  border: 1px solid var(--pill-line);
  border-radius: 10px;
  background: var(--surface);
  font-size: var(--fs-body);
  font-weight: 500;
}
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
