/* Industrial / enterprise theme — Ocean Depths (deep navy / teal / seafoam / cream) */
body {
  font-family: "IBM Plex Sans Thai", "Sarabun", system-ui, -apple-system, Arial, sans-serif;
  /* ไล่เฉด mint → seafoam อ่อน; ตรึงกับ viewport (fixed) เลื่อนหน้าแล้วเฉดไม่ยืด/ซ้ำ.
     เฉดเข้มสุด #ebf4f3 — .subtitle (#207575) ได้ 4.86:1 (เพดานห้ามเข้มกว่า #e2f0f0 = 4.65) */
  background-color: #f4faf6;
  background-image: linear-gradient(168deg, #fafdfb 0%, #f4faf6 44%, #ebf4f3 100%);
  background-attachment: fixed;
  margin: 0;
  padding: 16px;
  color: #1a2332;
  -webkit-font-smoothing: antialiased;
}
h1, h2 { letter-spacing: -0.01em; }

/* จุดสถานะ (แทนอีโมจิ) */
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; vertical-align: middle; margin-right: 6px; }
.dot.g { background: #1f7a4d; }
.dot.y { background: #b07a12; }
.dot.r { background: #b3261e; }
.dot.e { background: #9aa7b2; }
.container { max-width: 1400px; margin: auto; }
/* หน้าบันทึก: จัดเป็น launcher กลางจอ ไม่ให้เหลือพื้นที่ว่างโล่งบนเดสก์ท็อป */
.record .container { max-width: 600px; min-height: 88vh; display: flex; flex-direction: column; justify-content: center; }
.record #selector { grid-template-columns: 1fr; gap: 14px; margin-top: 20px; }
/* modal เด้งเข้านุ่ม ๆ + ฉากหลังค่อย ๆ เบลอ */
dialog.form[open] { animation: pop .22s cubic-bezier(.22, 1, .36, 1); }
dialog.form::backdrop { animation: fade .22s ease-out; }
@keyframes pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
@media (prefers-reduced-motion: reduce) {
  dialog.form[open], dialog.form::backdrop { animation: none; }
}
/* การ์ดกราฟ: กริดหลายคอลัมน์ เห็นหลายอันในจอเดียว (เน้นจอคอม) */
#charts { grid-template-columns: repeat(auto-fit, minmax(440px, 1fr)); }
/* ตัวเลขยอดรวมบนหัวกราฟ */
.lead { font-size: 22px; font-weight: bold; color: #1a2332; margin: 2px 0 6px; }
h1 { font-size: 26px; margin-bottom: 4px; }
.subtitle { color: #207575; margin-bottom: 12px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.card {
  background: white;
  border-radius: 16px;
  padding: 18px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
}
.card h2 { margin-top: 0; font-size: 20px; }
label { display: block; margin-top: 10px; font-size: 14px; color: #1a2332; }
input, select {
  width: 100%;
  padding: 10px;
  margin-top: 4px;
  border: 1px solid #cdd9d9;
  border-radius: 10px;
  font-size: 16px;
  box-sizing: border-box;
}
button {
  width: 100%;
  padding: 12px;
  margin-top: 14px;
  border: none;
  border-radius: 12px;
  background: #1a2332;
  color: white;
  font-size: 16px;
  cursor: pointer;
}
.result { margin-top: 14px; padding: 12px; background: #a8dadc; border-radius: 10px; font-weight: bold; }
.big { font-size: 30px; font-weight: bold; color: #f1faee; }
.red { background: #1a2332; color: #f1faee; }
table { width: 100%; border-collapse: collapse; margin-top: 12px; }
th, td { padding: 10px; border-bottom: 1px solid #e6efe9; text-align: left; }
th { background: #a8dadc; }
.chart-cap { font-size: 12px; color: #207575; margin-top: 12px; margin-bottom: 2px; }
.chart svg { display: block; }
.note { font-size: 13px; color: #207575; margin-top: 8px; min-height: 16px; }
.daylog { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.daylog input { margin-top: 0; width: 100%; }
.daylog button { margin-top: 4px; }
/* คำอธิบายว่าแต่ละช่องที่กรอกคืออะไร และคำนวณอย่างไร */
.calc { font-size: 13px; color: #1a2332; background: #eef7f0; border-radius: 10px; padding: 12px; margin-top: 12px; }
.calc .formula { display: block; color: #207575; font-weight: bold; margin: 4px 0 8px; }
.calc ul { margin: 0; padding-left: 18px; }
.calc li { margin: 4px 0; }
.topbar { display: flex; gap: 8px; background: white; padding: 8px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,0.08); margin-bottom: 16px; }
.tab { flex: 1; width: auto; margin-top: 0; background: #a8dadc; color: #1a2332; }
.tab.active { background: #1a2332; color: white; }
.monthsel { display: flex; align-items: center; gap: 8px; background: white; padding: 8px 12px; border-radius: 12px; box-shadow: 0 4px 14px rgba(0,0,0,0.08); margin-bottom: 16px; }
.monthsel label { margin-top: 0; white-space: nowrap; }
.monthsel select { flex: 1; }
.pick {
  width: 100%;
  box-sizing: border-box;
  margin-top: 0;
  text-align: left;
  background: white;
  color: #1a2332;
  box-shadow: 0 4px 14px rgba(0,0,0,0.08);
  font-size: 18px;
  font-weight: bold;
  padding: 20px 18px;
  border-radius: 16px;
  border: 2px solid transparent;
}
.pick.active { border-color: #207575; background: #a8dadc; }
.pick small { display: block; font-weight: normal; font-size: 13px; color: #207575; margin-top: 4px; }
.pick.active small { color: #1a2332; }
/* ฟอร์มกรอกแบบ popup (native <dialog>) */
dialog.form {
  position: relative;
  box-sizing: border-box;
  width: calc(100% - 32px);
  max-width: 460px;
  max-height: 85vh;
  overflow: auto;
  border: none;
}
dialog.form::backdrop { background: rgba(26,35,50,0.45); backdrop-filter: blur(4px); }
.x {
  position: absolute; top: 10px; right: 12px;
  width: auto; margin: 0; padding: 4px 10px;
  background: transparent; color: #1a2332; font-size: 22px; line-height: 1;
}
.stack { display: flex; flex-direction: column; gap: 16px; }

/* ---- หน้า KPI สายฟาร์ม (farm.html) ---- */
.summary { font-size: 15px; font-weight: bold; color: #1a2332; }
.summary .muted { color: #207575; font-weight: normal; }
/* แถว KPI ในหน้ากรอก: grid คอลัมน์ตรงกัน (ชื่อ | เป้า | ช่องกรอก | สถานะ) อ่านเป็นตารางโดยไม่ต้องมีเส้นตาราง */
/* คอลัมน์กว้างคงที่ (ไม่ใช่ max-content) → ทุกแถว/ทุกหน่วยงานตรงกันเป็นคอลัมน์เดียว แม้ข้อความมูลค่าจะยาว */
.krow { display: grid; grid-template-columns: minmax(0, 1fr) 300px 128px 92px; gap: 2px 16px; align-items: center; padding: 11px 10px; margin: 0 -10px; border-bottom: 1px solid #e6efe9; border-radius: 10px; }
.krow:hover { background: #f4faf7; }
.krow:last-child { border-bottom: none; }
.kmain { min-width: 0; }
.kname { font-weight: 600; }
.kname .chip { display: inline-block; font-size: 11px; background: #a8dadc; color: #1a2332; border-radius: 999px; padding: 2px 8px; margin-left: 6px; font-weight: normal; vertical-align: middle; }
.ktarget { font-size: 13px; color: #207575; text-align: left; line-height: 1.5; }
.ktarget .krate { display: inline-block; margin-top: 2px; font-size: 12px; }
.krow input { width: 100%; margin-top: 0; text-align: right; font-variant-numeric: tabular-nums; }
/* ช่องที่มีค่าแล้ว: ขอบ+พื้นเขียวอ่อน มองปราดเดียวรู้ว่ากรอกถึงไหน */
.krow input:not(:placeholder-shown) { border-color: #207575; background: #f2faf7; }
/* วันที่ล็อก (ผ่านมาแล้ว): ช่อง readonly เทา ดูได้อย่างเดียว — วางหลังกฎเขียวให้ชนะ */
.krow input:read-only, .krow input:read-only:not(:placeholder-shown) { background: #eef3f3; border-color: #dbe6e6; color: #456a6a; cursor: default; }
.badge { justify-self: start; min-width: 66px; text-align: center; font-size: 12px; font-weight: bold; padding: 5px 11px; border-radius: 999px; white-space: nowrap; box-sizing: border-box; }
.badge.on { background: #d4ede0; color: #1f6b3a; }
.badge.off { background: #fbdce0; color: #c1121f; }
.badge.empty, .badge.noeval { background: #eef3f3; color: #456a6a; }
.node-meta .warn { color: #c1121f; font-weight: 700; }
.node-meta .ok { color: #1f6b3a; font-weight: 700; }
.kdate { font-size: 12px; color: #207575; margin-top: 2px; }
.kdate:empty { display: none; }
.kcost { font-size: 12px; color: #c1121f; font-weight: 700; margin-top: 2px; }
.kcost:empty { display: none; }
.kdate.stale { color: #c1121f; font-weight: 600; }
.stage { font-size: 15px; color: #207575; margin: 22px 0 10px; padding-bottom: 4px; border-bottom: 2px solid #a8dadc; }

/* ---- Executive dashboard ---- */
.finrow { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.stat .stat-l { font-size: 13px; color: #207575; font-weight: 600; }
.stat .lead { margin: 4px 0 2px; font-size: 26px; }
.stat .stat-s { font-size: 12px; color: #207575; }
.stat-green .lead { color: #1f6b3a; }
.stat-yellow .lead { color: #8a6000; }
.stat-red .lead { color: #c1121f; }
.muted2 { font-size: 12px; color: #207575; }
.board { width: 100%; border-collapse: collapse; }
.board td { padding: 8px 6px; border-bottom: 1px solid #e6efe9; font-size: 14px; vertical-align: top; }
.board td.num { text-align: right; white-space: nowrap; }
.board tr.r-red td { background: #fbeef0; }
.board tr.r-yellow td { background: #fbf6e8; }
.alert-row { padding: 8px 0; border-bottom: 1px solid #e6efe9; font-size: 14px; }
.alert-row:last-child { border-bottom: none; }

/* ---- App shell: sidebar + content (เน้นจอคอม) ---- */
body.app { margin: 0; padding: 0; max-width: none; display: flex; align-items: stretch; }
.sidebar { width: 230px; flex-shrink: 0; box-sizing: border-box; background: linear-gradient(180deg, #1e2938 0%, #1a2332 55%, #151d29 100%); color: #f1faee; padding: 20px 14px; min-height: 100vh; position: sticky; top: 0; transition: width .2s ease; }
/* หัวข้อกลุ่มในเมนู: คลิกพับได้ */
.side-grp { margin: 0; }
.side-grp > summary { list-style: none; cursor: pointer; display: flex; align-items: center; }
.side-grp > summary::-webkit-details-marker { display: none; }
.side-grp > summary::before { content: "▾"; font-size: 9px; margin-right: 5px; color: #86b0b0; transition: transform .15s; }
.side-grp:not([open]) > summary::before { transform: rotate(-90deg); }
.brand { display: block; font-size: 18px; font-weight: bold; line-height: 1.25; margin-bottom: 22px; color: #f1faee; text-decoration: none; cursor: pointer; }
.brand span { font-size: 12px; font-weight: normal; color: #a8dadc; }
#nav { display: flex; flex-direction: column; gap: 4px; }
#nav a { color: #f1faee; text-decoration: none; padding: 11px 12px; border-radius: 10px; font-size: 15px; }
#nav a:hover { background: #26384a; }
#nav a.active { background: #a8dadc; color: #1a2332; font-weight: bold; }
.side-foot { margin-top: 18px; font-size: 12px; color: #a8dadc; }
.side-switch { color: #a8dadc; text-decoration: underline; cursor: pointer; }
.side-switch:hover { color: #fff; }
.content { flex: 1; min-width: 0; box-sizing: border-box; padding: 22px 28px; }  /* ไม่ล็อก max-width — จอใหญ่ขยายเต็ม (กริดการ์ด/กราฟเพิ่มคอลัมน์เอง) */
.content h1 { margin-top: 0; }
.toprow { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
/* แถบเลือกช่วงเวลา: แท็บบน ตัวเลือกวัน/เดือนอยู่บรรทัดล่างชิดขวา (เหมือนกันทุกโหมด) */
.period { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.seg { display: inline-flex; background: #fff; border-radius: 10px; overflow: hidden; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.seg button { width: 96px; margin: 0; border-radius: 0; background: #fff; color: #1a2332; padding: 9px 0; text-align: center; white-space: nowrap; }
.seg button.on { background: #1a2332; color: #fff; }
.period select { margin-top: 0; width: auto; }
.side-h { margin: 20px 0 6px; font-size: 12px; color: #a8dadc; font-weight: bold; }
.side-g { font-size: 11px; color: #86b0b0; margin: 8px 0 2px; padding-left: 2px; }
.side-depts a { display: block; color: #cfe6e4; text-decoration: none; font-size: 13px; padding: 5px 12px; border-radius: 8px; }
.side-depts a:hover { background: #26384a; }
.side-depts a.active { background: #a8dadc; color: #1a2332; font-weight: bold; }

/* KPI scorecards */
/* ปุ่มกลุ่ม KPI: แถวเดียวต่อกัน ไม่พับซ้อนหลายแถว (เน้นจอคอม) */
.scard-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); align-items: start; }
.scard > summary { flex-direction: column; align-items: flex-start; gap: 6px; }
.scard > summary { list-style: none; cursor: pointer; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; }
.scard > summary::-webkit-details-marker { display: none; }
.scard-t { font-weight: bold; color: #1a2332; font-size: 16px; }
.scard .lead { margin: 8px 0 0; font-size: 22px; }
.scard .lead.tloss { color: #c1121f; }
.scard-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.sc { font-size: 12px; font-weight: bold; padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.sc.red { background: #fbdce0; color: #c1121f; }
.sc.yellow { background: #fbf6e8; color: #8a6000; }
.sc.green { background: #d4ede0; color: #1f6b3a; }
.sc.gray { background: #eef3f3; color: #456a6a; }
.scard .board { margin-top: 12px; }
.msub { font-size: 15px; margin: 16px 0 0; color: #1a2332; }
.kstation { font-size: 13px; color: #207575; font-weight: 600; margin: 10px 0 0; }
/* หัวข้อรอบการวัด ในหน้ากรอก (จัดกลุ่ม รายวัน/รายสัปดาห์/...) */
.kcad { font-size: 15px; font-weight: 700; color: #1a2332; margin: 22px 0 8px; padding-bottom: 4px; border-bottom: 2px solid #a8dadc; }
.kcad:first-of-type { margin-top: 6px; }
/* tab รอบการวัด ในหน้ากรอก */
.ctabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 14px; }
.ctab { width: auto; margin: 0; padding: 8px 14px; background: #f1faee; color: #1a2332; font-size: 14px; border-radius: 10px; }
.ctab.on { background: #1a2332; color: #fff; }
.ctab-n { opacity: .6; font-size: 12px; margin-left: 2px; }

/* accordion: หน่วยงาน (node) ย่อ/กาง */
details.node { margin-bottom: 0; }
details.node > summary {
  list-style: none; cursor: pointer;
  display: flex; align-items: center; gap: 8px;
  font-size: 20px; font-weight: bold; color: #1a2332;
}
details.node > summary::-webkit-details-marker { display: none; }
details.node > summary::before { content: "▸"; color: #207575; font-size: 16px; transition: transform .15s; }
details.node[open] > summary::before { transform: rotate(90deg); }
.node-meta { margin-left: auto; font-size: 13px; font-weight: normal; color: #207575; white-space: nowrap; }
.node-body { margin-top: 12px; }
/* accordion: ไก่เนื้อ/ไก่ไข่ (line) ย่อ/กาง */
details.line { margin-top: 12px; padding-top: 10px; border-top: 1px solid #eef3f3; }
details.line > summary { list-style: none; cursor: pointer; font-weight: 700; color: #1a2332; }
details.line > summary::-webkit-details-marker { display: none; }
details.line > summary::before { content: "▸ "; color: #207575; }
details.line[open] > summary::before { content: "▾ "; }
details.line .cnt { font-size: 12px; font-weight: normal; color: #207575; }
.done { background: #a8dadc; color: #1a2332; margin-top: 18px; }

/* ---- หน้าหลัก (landing) 2 ทาง ---- */
.landing .container { max-width: 760px; min-height: 88vh; display: flex; flex-direction: column; justify-content: center; }
.landing #home { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 24px; }
a.pick { display: block; text-decoration: none; }
.landing .pick { padding: 32px 26px; font-size: 22px; min-height: 116px; }

/* ---- หน้ากรอกข้อมูล: จำกัดความกว้างบนจอคอมให้เป็นบล็อกพอดี ---- */
.entry .container { max-width: 920px; }
/* selector: auto-fit = กลุ่มสั้นยืดเต็มแถว (ช่องว่างท้ายยุบ ไม่เหลือรูโบ๋) */
.pickgrid { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.pickgrid .pick { padding: 16px; font-size: 16px; }
.pickgrid .pick small { font-size: 12px; margin-top: 3px; }

/* ---- หน้ากรอก: หัวเรื่องซ้าย + ตัวเลือกวันที่ชิดขวา ---- */
.depthead { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.depthead h1 { margin: 0; }
.depthead .subtitle { margin: 4px 0 0; }
.datepick { display: flex; align-items: center; gap: 10px; background: #fff; border-radius: 12px; padding: 9px 14px; box-shadow: 0 4px 14px rgba(0,0,0,.08); }
.datepick label { margin: 0; font-size: 13px; font-weight: 600; color: #207575; white-space: nowrap; }
.datepick input { width: auto; margin: 0; padding: 7px 10px; font-size: 15px; }

/* วันที่ล็อก: แบนเนอร์แจ้งโหมดดูอย่างเดียว + แถบล่างแบบไม่มีปุ่มบันทึก */
.locknote { background: #fbf6e8; color: #8a6000; font-weight: 600; font-size: 14px; box-shadow: none; border: 1px solid #ecd9a8; padding: 12px 16px; }
.savebar.locked { background: linear-gradient(100deg, #33414f 0%, #2b3947 100%); }
.savebar.locked .savemeta, .savebar.locked .savestatus { color: #cfe6e4; }

/* ---- หน้ากรอก: แถบบันทึกลอยติดล่างจอ (ความคืบหน้า + ปุ่มบันทึกใกล้มือเสมอ) ---- */
.savebar { position: sticky; bottom: 14px; z-index: 5; display: flex; align-items: center; gap: 18px; background: linear-gradient(100deg, #1e2938 0%, #1a2332 60%, #16202c 100%); color: #f1faee; border-radius: 14px; padding: 12px 18px; margin-top: 18px; box-shadow: 0 8px 24px rgba(26, 35, 50, .28); }
.savemeta { display: flex; align-items: center; gap: 12px; font-size: 14px; white-space: nowrap; }
.savemeta b { font-size: 16px; font-variant-numeric: tabular-nums; }
.progress { width: 150px; height: 6px; background: #26384a; border-radius: 999px; overflow: hidden; }
.progress i { display: block; height: 100%; width: 0; background: #a8dadc; border-radius: 999px; transition: width .3s cubic-bezier(.22, 1, .36, 1); }
.savestatus { flex: 1; font-size: 13px; color: #a8dadc; text-align: right; min-height: 16px; }
.savestatus.ok { color: #9fe3bf; font-weight: 600; }
.savestatus.err { color: #ffb3ad; font-weight: 600; }
.savebar button { width: auto; margin: 0; padding: 11px 24px; background: #a8dadc; color: #1a2332; font-weight: 700; border-radius: 10px; }
.savebar button:hover { background: #bde6e8; }
.savebar button:disabled { opacity: .55; cursor: default; }
@media (prefers-reduced-motion: reduce) { .progress i { transition: none; } }

/* ---- โหมดอุปกรณ์: หน้าเลือก มือถือ/คอม (ครั้งแรก) ---- */
body.choosing .sidebar, body.choosing .mbar { display: none; }
body.choosing .content { max-width: 640px; margin: 0 auto; min-height: 92vh; display: flex; flex-direction: column; justify-content: center; }
.choose h1 { text-align: center; }
.choose .subtitle { text-align: center; }
.choose-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-top: 22px; }
.choose .pick { cursor: pointer; text-align: center; padding: 28px 20px; font-size: 20px; }
.choose .pick small { font-size: 13px; margin-top: 8px; }

/* ---- หน้า login รหัสกลาง ---- */
.loginbox { max-width: 360px; margin: 22px auto 0; display: flex; flex-direction: column; gap: 4px; }
.loginbox input { text-align: center; font-size: 18px; letter-spacing: 2px; }
.loginbox .note { text-align: center; min-height: 18px; }
.choose-foot { text-align: center; margin-top: 26px; font-size: 13px; }

/* ---- โหมดมือถือ: ไม่มี sidebar ใช้แถบบน + dropdown นำทาง ---- */
.mbar { display: none; }
body.mobile .mbar { position: sticky; top: 0; z-index: 6; display: flex; align-items: center; gap: 10px; background: linear-gradient(100deg, #1e2938 0%, #1a2332 100%); color: #f1faee; padding: 10px 12px; }
.mbar-t { font-weight: bold; font-size: 13px; white-space: nowrap; color: #f1faee; text-decoration: none; }
.mbar select { flex: 1; margin: 0; padding: 8px 10px; font-size: 15px; min-width: 0; }
.mswitch { width: auto; margin: 0; padding: 8px 12px; font-size: 13px; background: #26384a; color: #a8dadc; border-radius: 8px; white-space: nowrap; }
body.mobile { display: block; }
body.mobile .sidebar { display: none; }
body.mobile .content { padding: 14px 12px 20px; max-width: none; }
/* แถว KPI: ชื่อ+เป้าเต็มแถว แล้วค่อย ช่องกรอก | badge */
body.mobile .krow { grid-template-columns: 1fr 96px; gap: 4px 10px; }
body.mobile .kmain, body.mobile .ktarget { grid-column: 1 / -1; }
body.mobile .ktarget { font-size: 12px; }
body.mobile .badge { justify-self: end; }
body.mobile .depthead { flex-direction: column; align-items: stretch; }
body.mobile .datepick { justify-content: space-between; }
body.mobile .savebar { flex-wrap: wrap; gap: 8px 14px; padding: 10px 14px; bottom: 8px; }
body.mobile .savebar .progress { width: 90px; }
body.mobile .savestatus { flex-basis: 100%; text-align: left; order: 3; min-height: 0; }
body.mobile .savestatus:empty { display: none; }
/* แดชบอร์ดบนมือถือ: การ์ด 2 คอลัมน์ กราฟ 1 คอลัมน์ ตารางเลื่อนข้างได้ */
body.mobile .scard-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
body.mobile .grid:not(.scard-grid):not(.choose-grid) { grid-template-columns: 1fr; }
body.mobile .toprow { flex-direction: column; align-items: stretch; gap: 10px; }
body.mobile .period { align-items: stretch; }
body.mobile .seg { justify-content: stretch; display: flex; }
body.mobile .seg button { flex: 1; width: auto; }
body.mobile .card { overflow-x: auto; }

/* ---- polish pass: focus rings, motion, numerals ---- */
:where(a, button, input, select, summary, [tabindex]):focus-visible { outline: 2px solid #207575; outline-offset: 2px; }
.sidebar a:focus-visible { outline-color: #a8dadc; }
.lead, .stat .lead, .ktarget, .kcost, .board td.num { font-variant-numeric: tabular-nums; }
h1, .card h2, .scard-t { text-wrap: balance; }
.pick { transition: transform .18s cubic-bezier(.22, 1, .36, 1), box-shadow .18s ease; }
.pick:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(26, 35, 50, .12); }
.seg button, .ctab, .tab, button { transition: background-color .15s ease, color .15s ease, transform .1s ease; }
button:active { transform: scale(.97); }
@media (prefers-reduced-motion: reduce) {
  .pick, .seg button, .ctab, .tab, button { transition: none; }
  .pick:hover { transform: none; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.08); }
}
