/* =====================================================================
   PinLabel — PIN TAIWAN™ brand system
   Ink #16171B · Signature red #F03F38 (the only red, used sparingly)
   Warm paper neutrals · Archivo type · 28% squircle motif
   ===================================================================== */
:root {
  --ink: #16171B; --ink-soft: #34302D;
  --red: #F03F38; --red-press: #d6332c;
  --paper: #F6F4EF; --surface: #FFFFFF; --surface-2: #FBFAF7;
  --line: #E4E0D7; --line-2: #DDD9D0; --line-strong: #C9C6C0;
  --muted: #55534E; --muted-2: #8B8A87;
  --pass: #2E7D55; --warn: #B9791B; --fail: #F03F38;
  --pass-bg: #E7F1EB; --warn-bg: #F6EEDC; --fail-bg: #FDE9E8;
  --radius: 12px; --radius-lg: 18px; --radius-sm: 9px;
  --font: 'Archivo', -apple-system, "Segoe UI", Roboto, "Noto Sans TC", "PingFang TC", sans-serif;
  --mono: 'Archivo', ui-monospace, "SF Mono", Menlo, monospace;
}
* { box-sizing: border-box; }
html, body { background: var(--paper); }
body {
  margin: 0; color: var(--ink); font-family: var(--font);
  font-size: 14px; line-height: 1.55; -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-strong); }
a:hover { color: var(--red); border-color: var(--red); }
/* public/marketing top switches & login links: opt out of the underline + red-flip;
   give a clean neutral hover instead (these classes only exist on public pages). */
.langlink, .langsw, .lang, .toplink { border-bottom: 0; }
.langlink:hover, .langsw:hover, .lang:hover { background: var(--surface-2); border-color: var(--ink); color: var(--ink); }
.toplink, .toplink:hover { border-color: transparent; }
.toplink:hover { color: var(--red); }

/* ---- header (REVERSE · ink-black bar) ---- */
header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 22px; background: var(--ink); border-bottom: 1px solid #000;
}
header .brand { display: flex; align-items: center; gap: 11px; }
header .brand img { width: 30px; height: 30px; display: block; }
header .brand .wm { font-weight: 800; font-size: 19px; letter-spacing: -.5px; color: #fff; border: 0; }
header .brand .wm b { font-weight: 800; }
header .brand .tagline { font-size: 11px; color: rgba(255,255,255,.6); letter-spacing: .3px; border-left: 1px solid rgba(255,255,255,.22); padding-left: 11px; margin-left: 2px; }
header .muted { color: rgba(255,255,255,.62); }
header button.ghost { border-color: rgba(255,255,255,.28); color: #fff; }
header button.ghost:hover { background: rgba(255,255,255,.12); border-color: rgba(255,255,255,.5); }

.container { max-width: 1100px; margin: 0 auto; padding: 26px 22px; }

/* ---- type ---- */
h1 { font-size: 22px; font-weight: 800; letter-spacing: -.4px; margin: 0 0 4px; }
h2 { font-size: 12px; font-weight: 700; margin: 0 0 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
code { font-family: var(--mono); background: var(--surface-2); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px; font-size: 12px; }

/* ---- surfaces ---- */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg);
  padding: 20px; margin-bottom: 16px;
}

/* ---- forms ---- */
label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin: 12px 0 5px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm); font: inherit;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--red); box-shadow: 0 0 0 3px var(--fail-bg);
}
textarea { min-height: 64px; resize: vertical; }
input[disabled], select[disabled], textarea[disabled] { background: var(--surface-2); color: var(--muted); }

/* ---- buttons ---- */
button {
  background: var(--ink); color: #fff; border: 0; border-radius: var(--radius-sm);
  padding: 10px 17px; font: inherit; font-weight: 700; cursor: pointer; letter-spacing: .2px;
  transition: background .12s, transform .04s;
}
button:hover { background: #000; }
button:active { transform: translateY(1px); }
button.accent { background: var(--red); }
button.accent:hover { background: var(--red-press); }
button.ok { background: var(--pass); }
button.ok:hover { filter: brightness(.93); }
button.danger { background: var(--red); }
button.danger:hover { background: var(--red-press); }
button.ghost { background: transparent; border: 1px solid var(--line-strong); color: var(--ink); }
button.ghost:hover { background: var(--surface-2); border-color: var(--ink); }
button.small { padding: 6px 11px; font-size: 12px; }

/* ---- layout helpers ---- */
.row { display: flex; gap: 13px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }
.inline { display: flex; align-items: center; gap: 9px; }
.inline input[type=checkbox] { width: auto; accent-color: var(--red); }
input[type=checkbox] { accent-color: var(--red); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 860px) { .grid2 { grid-template-columns: 1fr; } }

/* ---- table ---- */
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 11px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; }
tr:hover td { background: var(--surface-2); }

/* ---- status badges ---- */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 700; border: 1px solid transparent; }
.s-draft { background: #EFEDE7; color: var(--muted); }
.s-submitted { background: #EAF0F6; color: #3A6FA0; }
.s-in_review { background: var(--warn-bg); color: var(--warn); }
.s-approved { background: var(--pass-bg); color: var(--pass); }
.s-print_ready { background: #16171B; color: #fff; }
.s-rejected { background: var(--fail-bg); color: var(--fail); }

/* ---- verdict pills ---- */
.pill { font-weight: 800; letter-spacing: .3px; }
.pill.pass { color: var(--pass); } .pill.warn { color: var(--warn); } .pill.fail { color: var(--fail); }

/* ---- findings ---- */
.finding { border-left: 3px solid var(--line-strong); padding: 9px 13px; margin: 7px 0; background: var(--surface-2); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.finding.pass { border-color: var(--pass); background: var(--pass-bg); }
.finding.warn { border-color: var(--warn); background: var(--warn-bg); }
.finding.fail { border-color: var(--fail); background: var(--fail-bg); }
.finding .rid { font-family: var(--mono); font-size: 12px; color: var(--muted); }

/* ---- ingredients ---- */
.ingredient { display: flex; gap: 9px; margin-bottom: 7px; align-items: center; }
.ingredient input[type=text] { flex: 2; } .ingredient input[type=number] { flex: 1; }

/* ---- toast ---- */
.toast { position: fixed; bottom: 22px; right: 22px; background: var(--ink); color: #fff; padding: 13px 17px; border-radius: var(--radius); max-width: 360px; box-shadow: 0 8px 30px rgba(22,23,27,.22); font-weight: 500; }
.toast.err { background: var(--red); }

.pill.warn, .pill.fail, .pill.pass { font-size: inherit; }

/* ============================================================
   Public-site nav: 知識庫 dropdown + mobile hamburger
   (shared by home / about / blog_* standalone templates)
   ============================================================ */
.hnav { position: relative; }

/* hamburger (hidden on desktop) */
.navtog-cb { display: none; }
.navtog {
  display: none; cursor: pointer; user-select: none;
  font-size: 20px; line-height: 1; padding: 6px 11px;
  border: 1px solid var(--line-strong); border-radius: 9px; color: var(--ink);
}
.navtog:hover { border-color: var(--red); color: var(--red); }

/* knowledge-base dropdown */
.kbnav { position: relative; display: inline-block; }
.kbnav .kbtop { white-space: nowrap; }
.kbmenu {
  position: absolute; left: 0; top: calc(100% + 6px); min-width: 214px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: 12px; box-shadow: 0 14px 38px rgba(22,23,27,.14);
  padding: 6px; display: none; z-index: 80;
}
.kbnav:hover .kbmenu, .kbnav:focus-within .kbmenu { display: block; }
.kbmenu a {
  display: block; margin: 0 !important; padding: 9px 12px;
  border-radius: 8px; font-size: 14px; color: var(--ink) !important;
  white-space: nowrap; text-decoration: none;
}
.kbmenu a:hover { background: var(--surface-2); color: var(--red) !important; }
.kbmenu .kbmore {
  border-top: 1px solid var(--line); margin-top: 4px !important;
  color: var(--red) !important; font-weight: 700;
}

/* ---- mobile: collapse nav into a tappable panel ---- */
@media (max-width: 760px) {
  .navtog { display: inline-block; }
  .hnav .links {
    display: none; position: absolute; left: 0; right: 0; top: calc(100% + 6px);
    flex-direction: column; align-items: stretch; gap: 2px;
    background: var(--surface); border: 1px solid var(--line-strong);
    border-radius: 14px; padding: 10px; z-index: 70;
    box-shadow: 0 16px 40px rgba(22,23,27,.16);
  }
  .navtog-cb:checked ~ .links { display: flex; }
  .hnav .links > a, .hnav .links > .kbnav {
    margin: 0 !important; width: 100%;
  }
  .hnav .links > a {
    padding: 11px 12px; border-radius: 9px; font-size: 15px;
  }
  .hnav .links > a:hover { background: var(--surface-2); }
  .hnav .links .btn, .hnav .links .btn.primary {
    width: 100%; text-align: center; margin-top: 4px !important;
  }
  .hnav .links .lang, .hnav .links .langsw {
    align-self: flex-start; width: auto; margin-top: 4px !important;
  }
  /* KB categories shown inline (no hover needed on touch) */
  .kbnav { width: 100%; }
  .kbnav .kbtop { display: block; padding: 11px 12px; border-radius: 9px; font-size: 15px; }
  .kbnav .kbtop:hover { background: var(--surface-2); }
  .kbmenu {
    position: static; display: block; min-width: 0; border: 0;
    box-shadow: none; padding: 2px 0 4px 14px;
  }
  .kbmenu a { padding: 8px 10px; font-size: 14px; color: var(--muted) !important; }
  .kbmenu .kbmore { border-top: 0; }
}
