*{box-sizing:border-box}
body{margin:0;background:#F5F5F2;color:#1A1A1A;font-family:'IBM Plex Sans Thai',system-ui,sans-serif;font-size:15px;line-height:1.5}
input,select,textarea,button{font-family:inherit;font-size:inherit;color:inherit}
h1,h2,h3{margin:0;line-height:1.3}
.muted{color:#5C5C5C}
.small{font-size:13px}
.wrap{max-width:1360px;margin:0 auto;padding:24px;display:flex;flex-direction:column;gap:20px}

/* header */
.top{background:#fff;border-bottom:1px solid #E4E4E0}
.top-in{max-width:1360px;margin:0 auto;padding:14px 24px;display:flex;flex-wrap:wrap;gap:14px;align-items:center;justify-content:space-between}
.brand{display:flex;gap:12px;align-items:center}
.logo{width:44px;height:44px;border-radius:10px;background:#B3261E;color:#fff;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.brand h1{font-size:19px;font-weight:700}
.tools{display:flex;flex-wrap:wrap;gap:8px;align-items:center}

/* controls */
.btn{height:44px;padding:0 16px;border:1px solid #CFCFCA;border-radius:8px;background:#fff;font-weight:500;cursor:pointer;display:inline-flex;align-items:center;gap:8px;text-decoration:none;color:#1A1A1A}
.btn:hover{background:#F2F2EF}
.btn.dark{background:#1A1A1A;border-color:#1A1A1A;color:#fff}
.btn.dark:hover{background:#333}
.btn.primary{background:#B3261E;border-color:#B3261E;color:#fff;font-weight:600}
.btn.primary:hover{background:#8C1D17}
.btn.sm{height:40px;padding:0 14px}
.btn:disabled{opacity:.5;cursor:not-allowed}
.pill{border-radius:999px}
.field{height:44px;padding:0 12px;border:1px solid #CFCFCA;border-radius:8px;background:#fff}
textarea.field{height:auto;padding:10px 12px;width:100%;resize:vertical}
.lbl{font-size:14px;font-weight:600}
.stack{display:flex;flex-direction:column;gap:6px}
.row{display:flex;flex-wrap:wrap;gap:8px;align-items:center}
.between{justify-content:space-between}
.search{display:flex;align-items:center;gap:8px;height:44px;padding:0 12px;background:#fff;border:1px solid #CFCFCA;border-radius:8px;min-width:260px;flex:0 1 360px}
.search input{border:0;outline:none;flex:1;min-width:0;height:40px;background:transparent}
.sr{position:absolute;width:1px;height:1px;overflow:hidden;clip:rect(0 0 0 0)}

/* cards */
.card{background:#fff;border:1px solid #E4E4E0;border-radius:12px}
.stats{display:grid;grid-template-columns:repeat(auto-fit,minmax(210px,1fr));gap:16px}
.stat{padding:16px 20px;display:flex;flex-direction:column;gap:2px}
.stat .v{font-size:32px;font-weight:700;line-height:1.15}
.bar{height:8px;background:#EBEBE8;border-radius:999px;margin-top:6px;overflow:hidden}
.bar>div{height:8px;background:#1B6136;border-radius:999px}

/* chips */
.chip{display:inline-block;font-size:13px;font-weight:600;padding:2px 10px;border-radius:999px;white-space:nowrap}
.tag{display:inline-block;font-size:13px;font-weight:600;padding:2px 10px;border-radius:6px}
.cat-eye{background:#E6EEF9;color:#1D4E89}
.cat-ear{background:#FCE6DC;color:#8A3510}
.cat-lung{background:#E3F1EE;color:#1F5F55}
.st-todo{background:#FDEBD3;color:#7A4100}
.st-sent{background:#DDE9FA;color:#1A4A86}
.st-done{background:#D9EEDF;color:#1B6136}
.st-skip,.st-na{background:#EBEBE8;color:#4D4D4D}
.st-ok{background:#D9EEDF;color:#1B6136}
.watch{background:#B3261E;color:#fff;font-size:12px;font-weight:700;padding:2px 8px;border-radius:999px}
.total{min-width:44px;height:36px;padding:0 10px;border-radius:8px;display:inline-flex;align-items:center;justify-content:center;font-size:18px;font-weight:700}
.total.hi{background:#B3261E;color:#fff}

/* layout */
.split{display:flex;flex-wrap:wrap;gap:20px;align-items:flex-start}
.main-col{flex:999 1 640px;min-width:0;overflow:hidden}
.side-col{flex:1 1 380px;min-width:0;padding:20px;display:flex;flex-direction:column;gap:18px}
.bar-top{display:flex;flex-wrap:wrap;gap:8px;padding:14px 16px;border-bottom:1px solid #E4E4E0;align-items:center;justify-content:space-between}
.count{font-size:12px;font-weight:600;padding:1px 8px;border-radius:999px;background:#FDEBD3;color:#7A4100}
.on{background:#1A1A1A!important;border-color:#1A1A1A!important;color:#fff!important}
.on .count{background:#fff;color:#1A1A1A}

/* table */
.tbl-wrap{overflow-x:auto}
table.tbl{width:100%;border-collapse:collapse;min-width:940px}
.tbl th{text-align:left;font-size:13px;font-weight:600;color:#5C5C5C;background:#FAFAF8;padding:10px 12px;border-bottom:1px solid #E4E4E0;vertical-align:bottom}
.tbl td{padding:12px;border-bottom:1px solid #EFEFEC;vertical-align:top;font-size:14px}
.tbl tr.sel td{background:#FFF6E8}
.tbl tr.dim td{opacity:.62}
.tbl .nm{font-weight:600;font-size:15px}
.foot{padding:12px 16px;font-size:13px;color:#5C5C5C;border-top:1px solid #E4E4E0}
.empty{padding:48px 16px;text-align:center;color:#5C5C5C}

/* panel */
.box{border:1px solid #E4E4E0;border-radius:10px;padding:14px;display:flex;flex-direction:column;gap:8px;background:#FAFAF8}
.box.red{border-color:#F0C9C6;background:#FCF1F0}
.check{display:flex;gap:10px;align-items:center;min-height:44px;cursor:pointer}
.check input{width:20px;height:20px;accent-color:#1A1A1A}
.legend{display:flex;flex-direction:column;gap:12px}
.legend>div{display:flex;gap:10px;align-items:flex-start}
.err{color:#8C1D17;font-weight:600;font-size:14px}

/* login */
.login{min-height:100vh;display:flex;align-items:center;justify-content:center;padding:24px}
.login .card{width:100%;max-width:420px;padding:28px;display:flex;flex-direction:column;gap:16px}

/* import */
.drop{border:2px dashed #B8B8B2;border-radius:12px;padding:32px;text-align:center;background:#fff;display:flex;flex-direction:column;gap:10px;align-items:center}

#toast{position:fixed;left:50%;bottom:24px;transform:translateX(-50%);background:#1A1A1A;color:#fff;padding:12px 18px;border-radius:10px;font-weight:500;opacity:0;pointer-events:none;transition:opacity .2s;z-index:10}
#toast.show{opacity:1}
.loading{padding:60px;text-align:center;color:#5C5C5C}

@media print{
  body{background:#fff}
  .top,.noprint,.bar-top,.side-col{display:none!important}
  .wrap{padding:0;max-width:none}
  .card{border:0}
  .tbl{min-width:0}
  .tbl td,.tbl th{padding:6px 8px;font-size:11pt}
  .print-title{display:block!important}
}
.print-title{display:none;font-size:16pt;font-weight:700;margin-bottom:8px}

.mx-c{text-align:center}
.mx td{padding:8px 12px;vertical-align:middle}
.mx td,.mx th{border-right:1px solid #EFEFEC}
@media print{.mx{break-before:page}}
.mx-g td{background:#F2F2EF;font-weight:700;font-size:14px}

/* charts */
.ch-grid{padding:16px;display:flex;flex-direction:column;gap:20px}
.ch-pair{display:grid;grid-template-columns:repeat(auto-fit,minmax(340px,1fr));gap:20px}
.chart{display:flex;flex-direction:column;gap:8px;min-width:0}
.chart svg{width:100%;height:auto;display:block;font-family:inherit}
.ch-h{display:flex;flex-wrap:wrap;gap:8px 16px;align-items:center;justify-content:space-between}
.ch-h h3{font-size:15px;font-weight:700}
.lg{display:flex;flex-wrap:wrap;gap:6px 14px;font-size:13px;color:#4D4D4D}
.lg span{display:inline-flex;align-items:center;gap:6px}
.lg i{width:12px;height:12px;border-radius:3px;display:inline-block}
.chart .ax{font-size:12px;fill:#5C5C5C}
.chart .yr{font-size:13px;font-weight:600;fill:#1A1A1A}
.chart .vl{font-size:12px;font-weight:600;fill:#1A1A1A}
.chart .dl{font-size:13px;font-weight:700}
.chart .in{font-size:12px;font-weight:700;fill:#FFFFFF}
.chart .in.dk{fill:#1A1A1A}
.chart [data-tip]{cursor:default}
.chart [data-tip]:hover path,.chart [data-tip]:hover rect[fill^="#"]{opacity:.85}
.tip{position:fixed;display:none;background:#1A1A1A;color:#fff;font-size:13px;padding:6px 10px;border-radius:6px;pointer-events:none;z-index:20;max-width:280px}
@media print{.charts{break-inside:avoid}}
.ch-scroll{overflow-x:auto}
