/* Hearty Label — styled with the Hearty Label brand kit (tokens mirror its tokens.json) */
:root {
  --surface: #FFFFFF; --surface-soft: #F4F8EE; --line: #DCE5D3;
  --ink: #1F2A1C; --ink-muted: #55624F;
  --hearty-green: #6CBD45; --hearty-orange: #F68C45;
  --green-text: #2F7420; --orange-text: #A84B15;
  --action: #2F7420; --on-action: #FFFFFF; --leaf-tint: #D5E694; --danger: #B3261E;
  --thermal-paper: #FFFFFF; --thermal-ink: #000000;
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-6: 24px; --space-8: 32px;
  --radius-sm: 8px; --radius-md: 16px; --radius-lg: 24px; --radius-pill: 999px;
  --font: "Nunito", "Noto Sans Myanmar", "Padauk", "Myanmar Text", system-ui, sans-serif;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --surface: #141B12; --surface-soft: #1F2A1C; --line: #2E3B2A;
    --ink: #F1F5EC; --ink-muted: #B3BFAC; --green-text: #8CCB6D; --orange-text: #F9A66E;
    --action: #8CCB6D; --on-action: #141B12; --leaf-tint: #2C3A22; --danger: #F2A39C;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --surface: #141B12; --surface-soft: #1F2A1C; --line: #2E3B2A;
  --ink: #F1F5EC; --ink-muted: #B3BFAC; --green-text: #8CCB6D; --orange-text: #F9A66E;
  --action: #8CCB6D; --on-action: #141B12; --leaf-tint: #2C3A22; --danger: #F2A39C;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { background: var(--surface-soft); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.8; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--action); outline-offset: 2px; }

/* top bar */
.top { position: sticky; top: 0; z-index: 10; background: var(--surface); border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: var(--space-3); padding: var(--space-2) var(--space-4); flex-wrap: wrap; }
.brand { display: flex; align-items: center; text-decoration: none; }
.brand img { height: 40px; width: auto; display: block; }
nav { display: flex; gap: var(--space-1); margin-left: auto; overflow-x: auto; }
nav a { text-decoration: none; color: var(--ink-muted); padding: var(--space-1) var(--space-3); border-radius: var(--radius-pill); white-space: nowrap; font-weight: 700; line-height: 28px; }
nav a.on { background: var(--action); color: var(--on-action); }

#banner:not(:empty) { background: var(--leaf-tint); color: var(--ink); padding: var(--space-2) var(--space-4); font-size: 13px; border-bottom: 1px solid var(--line); }
main { max-width: 1100px; margin: 0 auto; padding: var(--space-4); }
.loading { padding: 40px; text-align: center; color: var(--ink-muted); }

h1 { font-size: 22px; line-height: 1.6; font-weight: 800; margin: var(--space-1) 0 var(--space-3); color: var(--green-text); }
h2 { font-size: 17px; line-height: 1.7; font-weight: 800; margin: 0 0 var(--space-3); color: var(--green-text); }
.muted { color: var(--ink-muted); font-size: 13px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-4); margin-bottom: var(--space-4); }
@media (min-width: 900px) { .card { padding: var(--space-6); } }
.row { display: flex; gap: var(--space-3); flex-wrap: wrap; align-items: end; }
.grow { flex: 1; min-width: 0; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: var(--space-3); align-items: end; }
label.f { display: flex; flex-direction: column; gap: 2px; font-size: 13px; color: var(--ink-muted); min-width: 0; }
input[type=text], input[type=number], input[type=email], input[type=password], select, textarea {
  background: var(--surface); border: 1px solid var(--ink-muted); border-radius: var(--radius-sm); padding: 7px 10px; min-height: 40px; min-width: 0; width: 100%; color: var(--ink); }
textarea { resize: vertical; line-height: 1.7; min-height: 40px; overflow: hidden; display: block; }
table.pt textarea { min-width: 160px; }
label.f.wide { grid-column: 1 / -1; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--action); outline-offset: 0; border-color: var(--action); }
input[type=checkbox] { accent-color: var(--action); width: 18px; height: 18px; }
.chk { display: flex; align-items: center; gap: 6px; font-size: 14px; }

/* buttons (brand kit: Buttons) */
.btn { border: 0; border-radius: var(--radius-pill); padding: var(--space-2) var(--space-4); min-height: 40px; font-weight: 700; cursor: pointer;
  background: var(--leaf-tint); color: var(--ink); white-space: nowrap; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; gap: var(--space-1); }
.btn.pri { background: var(--action); color: var(--on-action); }
.btn.org { background: var(--hearty-orange); color: #1F2A1C; }
.btn.sm { padding: var(--space-1) var(--space-3); min-height: 32px; font-size: 13px; }
.btn.ghost { background: transparent; border: 1px solid var(--ink-muted); color: var(--ink); }
.btn.danger { border-color: var(--line); color: var(--danger); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btns { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.pro { background: var(--hearty-orange); color: #1F2A1C; border-radius: var(--radius-pill); font-size: 11px; line-height: 16px; letter-spacing: .06em; padding: 0 var(--space-2); font-weight: 800; }
.btn.org .pro { background: #1F2A1C; color: var(--hearty-orange); }

/* design list */
.dgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: var(--space-3); }
.dcard { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-md); padding: var(--space-3); display: flex; flex-direction: column; gap: var(--space-2); }
.dcard canvas, .eprev canvas { background: var(--thermal-paper); border-radius: var(--radius-sm); box-shadow: 0 0 0 1px var(--line); max-width: 100%; height: auto; display: block; margin: 0 auto; }
.empty { text-align: center; padding: var(--space-8) var(--space-4); border-radius: var(--radius-lg); }
.mascot { display: block; margin: 0 auto var(--space-3); height: 140px; width: auto; }

/* editor */
.editor { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr); gap: var(--space-4); align-items: start; }
@media (max-width: 820px) { .editor { grid-template-columns: 1fr; } }
.eprev { position: sticky; top: 72px; }
@media (max-width: 820px) { .eprev { position: static; } }
.eprev .stage { background: var(--surface-soft); border-radius: var(--radius-md); padding: var(--space-6); }
.warn { color: var(--danger); font-size: 13px; }
.rowcard { border: 1px dashed var(--ink-muted); border-radius: var(--radius-md); padding: var(--space-3); margin-bottom: var(--space-3); }
.rowhead { display: flex; align-items: center; gap: 6px; margin-bottom: var(--space-2); flex-wrap: wrap; }
.rowhead b { color: var(--green-text); margin-right: auto; }
.item { background: var(--surface-soft); border-radius: var(--radius-sm); padding: var(--space-2); margin-top: var(--space-2); }
.item .grid2 { grid-template-columns: repeat(auto-fit, minmax(96px, 1fr)); }
.seg { display: inline-flex; border: 1px solid var(--ink-muted); border-radius: var(--radius-pill); overflow: hidden; }
.seg button { border: 0; background: var(--surface); color: var(--ink); padding: var(--space-1) var(--space-3); cursor: pointer; font-weight: 700; min-height: 32px; }
.seg button.on { background: var(--action); color: var(--on-action); }
.langsw button { font-size: 13px; }
@media (max-width: 560px) { nav { margin-left: 0; order: 3; width: 100%; } .langsw { margin-left: auto; } .brand img { height: 34px; } }
.tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-top: var(--space-2); }

/* generator */
.tablewrap { overflow-x: auto; }
table.pt { width: 100%; border-collapse: separate; border-spacing: 0 6px; }
table.pt th { text-align: left; font-size: 12px; color: var(--ink-muted); font-weight: 700; padding: 0 4px; white-space: nowrap; }
table.pt td { padding: 0 4px; vertical-align: top; }
table.pt td.n { width: 28px; color: var(--ink-muted); font-size: 12px; padding-top: 10px; }
table.pt input { min-width: 90px; }
table.pt input.cp { width: 76px; min-width: 76px; }
.err { color: var(--danger); font-size: 12px; }
.tabs { display: inline-flex; flex-wrap: wrap; background: var(--leaf-tint); border-radius: var(--radius-pill); padding: 3px; margin-bottom: var(--space-3); }
.tabs button { border: 0; background: transparent; border-radius: var(--radius-pill); padding: 6px 14px; cursor: pointer; font-weight: 700; color: var(--ink); }
.tabs button.on { background: var(--surface); box-shadow: 0 0 0 1px var(--line); }
.drop { display: block; border: 2px dashed var(--hearty-green); border-radius: var(--radius-md); padding: 18px; margin: var(--space-1) 0 0; text-align: center; cursor: pointer; line-height: 1.9; }
.drop:hover { background: var(--surface-soft); }
#bulkBox { margin-bottom: var(--space-4); }
#bulkBox p { line-height: 1.9; }
.steps { counter-reset: s; }
.steps > .card > h2::before { counter-increment: s; content: counter(s); display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; background: var(--hearty-orange); color: #1F2A1C; font-size: 13px; margin-right: var(--space-2); vertical-align: 1px; }

.pv { display: flex; flex-direction: column; gap: var(--space-2); align-items: center; background: var(--surface-soft); border-radius: var(--radius-md); padding: var(--space-3); max-height: 70vh; overflow: auto; }
.pv canvas { background: var(--thermal-paper); width: 100%; max-width: 520px; height: auto; box-shadow: 0 0 0 1px var(--line); border-radius: 4px; }
.summary { font-weight: 800; color: var(--green-text); }

#toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--ink); color: var(--surface); padding: 10px 18px; border-radius: var(--radius-pill); opacity: 0; transition: .25s; pointer-events: none; z-index: 50; max-width: calc(100% - 32px); text-align: center; }
#toast.show { opacity: 1; }

.login { max-width: 400px; margin: 32px auto; }
.login .logo-big { display: block; width: 100%; max-width: 280px; height: auto; margin: 0 auto var(--space-4); }
.login .welcome { display: flex; align-items: center; gap: var(--space-3); margin-bottom: var(--space-3); }
.login .welcome img { height: 88px; width: auto; flex: none; }
.foot { text-align: center; color: var(--ink-muted); font-size: 12px; padding: var(--space-6) var(--space-4); }
#printArea { display: none; }
@media print {
  body > *:not(#printArea) { display: none !important; }
  #printArea { display: block !important; }
  #printArea img { display: block; break-after: page; page-break-after: always; }
  #printArea img:last-child { break-after: auto; page-break-after: auto; }
  body { background: #fff; }
}
