@import url("fonts.css");
/* yukiyo62 — ธีมหลัก (Bootstrap 5 + ปรับแต่ง) */

:root {
  --brand: #0f766e;
  --brand-600: #0d6560;
  --brand-50: #ecfdf8;
  --ink: #1f2937;
  --bg: #f1f5f4;
  --bs-body-font-family: 'Sarabun', 'Segoe UI', Tahoma, sans-serif;
  --bs-body-color: var(--ink);
  --bs-body-bg: var(--bg);
  --bs-border-radius: .6rem;
}
body { font-size: 1rem; }
.text-brand { color: var(--brand) !important; }

/* ปุ่ม */
.btn-brand { --bs-btn-bg: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-color: #fff;
  --bs-btn-hover-bg: var(--brand-600); --bs-btn-hover-border-color: var(--brand-600); --bs-btn-hover-color: #fff;
  --bs-btn-active-bg: var(--brand-600); --bs-btn-disabled-bg: #8fb9b4; --bs-btn-disabled-border-color: #8fb9b4; --bs-btn-disabled-color: #fff; }
.btn-outline-brand { --bs-btn-color: var(--brand); --bs-btn-border-color: var(--brand); --bs-btn-hover-bg: var(--brand);
  --bs-btn-hover-border-color: var(--brand); --bs-btn-hover-color: #fff; --bs-btn-active-bg: var(--brand-600); }

/* แถบเมนู */
.app-nav { background: linear-gradient(90deg, #0f766e, #115e59); box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.app-nav .nav-link { color: rgba(255,255,255,.85); border-radius: .5rem; padding: .45rem .75rem !important; }
.app-nav .nav-link:hover, .app-nav .nav-link.active { color: #fff; background: rgba(255,255,255,.14); }
.branch-form .form-select { min-width: 190px; }

/* การ์ด */
.app-card { border: 0; box-shadow: 0 1px 3px rgba(15,23,42,.08), 0 1px 2px rgba(15,23,42,.04); }
.app-card > .card-header { background: #fff; font-weight: 600; border-bottom: 1px solid #e5ecea; padding: .75rem 1rem; }
.section-title { color: var(--brand); font-weight: 600; border-bottom: 1px dashed #cfe3df; padding-bottom: .35rem; }
.form-label { font-size: .9rem; color: #4b5563; margin-bottom: .2rem; }

/* หน้าหลัก */
.quick-tile { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: .35rem;
  background: #fff; border-radius: 1rem; padding: 1.25rem .5rem; text-decoration: none; color: var(--brand);
  box-shadow: 0 1px 3px rgba(15,23,42,.08); border-bottom: 4px solid var(--brand); transition: transform .12s; }
.quick-tile:hover { transform: translateY(-2px); color: var(--brand-600); }
.quick-tile i { font-size: 2rem; }
.quick-tile span { font-weight: 600; font-size: 1.1rem; }
.tile-indigo { color: #4338ca; border-color: #4338ca; } .tile-indigo:hover { color: #3730a3; }
.tile-amber { color: #b45309; border-color: #d97706; } .tile-amber:hover { color: #92400e; }
.tile-slate { color: #334155; border-color: #475569; } .tile-slate:hover { color: #1e293b; }
.stat-label { color: #6b7280; font-size: .85rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }

/* หน้าบิล */
.tile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(118px, 1fr)); gap: .5rem; max-height: 70vh; overflow-y: auto; }
.tile { display: flex; flex-direction: column; justify-content: center; min-height: 78px; border: 0; border-radius: .75rem;
  background: var(--brand); color: #fff; padding: .4rem; text-align: center; transition: transform .08s, background .12s; }
.tile:hover { background: var(--brand-600); }
.tile:active { transform: scale(.97); }
.tile-name { font-weight: 600; line-height: 1.2; word-break: break-word; }
.tile-price { font-size: .8rem; opacity: .85; }
.entry-card { border-top: 4px solid var(--brand); }
.entry-preview { font-size: 1.05rem; }
.total-bar { display: flex; justify-content: space-between; align-items: center; background: var(--brand); color: #fff;
  border-radius: .75rem; padding: .6rem 1rem; margin-top: .5rem; }
.total-bar strong { font-size: 1.9rem; }
.doc-table td, .lines-table td { vertical-align: middle; }

/* ลูกค้า */
.id-photo { width: 96px; height: 120px; border: 1px dashed #cbd5e1; border-radius: .5rem; display: flex; align-items: center;
  justify-content: center; color: #94a3b8; font-size: 2.5rem; overflow: hidden; background: #f8fafc; }
.id-photo img { width: 100%; height: 100%; object-fit: cover; }
.history-photo { width: 96px; height: 120px; object-fit: cover; border-radius: .5rem; }

/* สินค้าใช้บ่อย */
#frequentList li { cursor: grab; }
#frequentList li.dragging { opacity: .5; background: var(--brand-50); }

/* หน้า login / error */
.blank-body { min-height: 100vh; background: radial-gradient(circle at 20% 20%, #14b8a6 0, transparent 40%),
  radial-gradient(circle at 80% 80%, #0e7490 0, transparent 45%), #0f3d3a; }
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.login-card { width: 100%; max-width: 420px; background: #fff; border-radius: 1.25rem; padding: 2rem; }

@media print {
  .app-nav, .toast-container, form, .btn, #printFrame { display: none !important; }
  .app-card { box-shadow: none; }
  main { padding: 0 !important; }
}

/* ===================================================== Dashboard */
.kpi { background:#fff; border-radius:.8rem; padding:1rem 1.1rem; height:100%;
  box-shadow:0 1px 2px rgba(0,0,0,.05); border:1px solid #e5ebe9; border-top:3px solid var(--kpi, #94a3b8); }
.kpi-muted { --kpi:#94a3b8; background:#fafcfb; }
.kpi-label { color:#64748b; font-size:.9rem; }
.kpi-value { font-size:1.75rem; font-weight:700; line-height:1.2; margin:.15rem 0 .35rem; font-variant-numeric:tabular-nums; }
.kpi-value small { font-size:.9rem; font-weight:500; color:#64748b; }
.kpi-meta { font-size:.85rem; color:#475569; margin-top:.15rem; }
.chip { display:inline-block; padding:0 .45rem; border-radius:99px; font-size:.78rem; font-weight:600; }
.chip-up { background:#dcfce7; color:#166534; }
.chip-down { background:#fee2e2; color:#991b1b; }
.chip-flat { background:#f1f5f9; color:#475569; }
.legend { display:flex; gap:1rem; flex-wrap:wrap; font-size:.85rem; color:#334155; }
.legend i { display:inline-block; width:12px; height:12px; border-radius:3px; vertical-align:-1px; margin-right:.25rem; }
.chart-wrap { position:relative; }
.chart-svg { width:100%; height:auto; display:block; overflow:visible; }
.chart-svg .grid { stroke:#e7ecea; stroke-width:1; }
.chart-svg .axis { fill:#64748b; font-size:11px; }
.chart-svg .series-line { fill:none; stroke-width:2; stroke-linejoin:round; stroke-linecap:round; }
.chart-svg .end-dot { stroke:#fff; stroke-width:2; }
.chart-svg .end-label { fill:#475569; font-size:11px; }
.chart-svg .end-value { fill:#1f2937; font-size:12px; font-weight:700; }
.chart-svg .crosshair { stroke:#94a3b8; stroke-width:1; stroke-dasharray:3 3; }
.chart-svg .hit, .chart-svg .hit-bar { fill:transparent; cursor:crosshair; }
.chart-svg .hit-bar:hover { fill:rgba(15,118,110,.06); }
.chart-svg .bar-label { fill:#1f2937; font-size:11px; font-weight:700; }
.chart-svg .hover-dot { stroke:#fff; stroke-width:2; pointer-events:none; }
.chart-tip { position:absolute; z-index:5; pointer-events:none; background:#fff; color:#1f2937;
  border:1px solid #e2e8f0; border-radius:.5rem; box-shadow:0 6px 18px rgba(15,23,42,.12);
  padding:.45rem .6rem; font-size:.82rem; white-space:nowrap; transform:translate(-50%, calc(-100% - 10px)); }
.chart-tip .tip-row { display:flex; align-items:center; gap:.4rem; }
.chart-tip .tip-row i { width:10px; height:10px; border-radius:2px; display:inline-block; }
.chart-tip .tip-row b { margin-left:auto; padding-left:.8rem; font-variant-numeric:tabular-nums; }
.rank-row { display:flex; gap:.7rem; align-items:flex-start; padding:.45rem .2rem; color:inherit; text-decoration:none; border-radius:.5rem; }
.rank-row:hover { background:#f6faf9; }
.rank-row + .rank-row { border-top:1px solid #f1f5f4; }
.rank-no { flex:0 0 26px; height:26px; border-radius:50%; background:#f1f5f9; color:#334155; font-weight:700;
  display:flex; align-items:center; justify-content:center; font-size:.85rem; }
.rank-row:first-child .rank-no { background:#fef3c7; color:#92400e; }
.hbar { display:block; height:6px; background:#eef2f1; border-radius:99px; overflow:hidden; margin:.25rem 0; }
.hbar > span { display:block; height:100%; border-radius:99px; }
.item-row { padding:.35rem 0; }
.item-row + .item-row { border-top:1px solid #f1f5f4; }
.nav-sm .nav-link { font-size:.85rem; }
.nav-pills .nav-link.active { background:var(--brand); }
.type-tag { display:inline-flex; align-items:center; gap:.3rem; font-size:.78rem; font-weight:600; padding:.1rem .5rem;
  border-radius:99px; color:#1f2937; background:color-mix(in srgb, var(--c) 14%, #fff); }
.type-tag::before { content:""; width:8px; height:8px; border-radius:50%; background:var(--c); }
@media print { .dash-head form { display:none !important; } }

/* ===================================================== Audit log */
.audit-table td.audit-brief { max-width:420px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.audit-detail > td { background:#f8fafc; }
.page-item.active .page-link { background:var(--brand); border-color:var(--brand); }
.page-link { color:var(--brand); }

/* ===================================================== ราคา / ปิดรอบ / สต็อก */
.price-bar { background:#fff; top:56px; z-index:3; }
.price-input { max-width:140px; margin-left:auto; font-variant-numeric:tabular-nums; }
.price-input.changed { background:#fef9c3; border-color:#eab308; font-weight:700; }
input.price-board { background:#ecfdf5; }
input.price-board[readonly] { cursor:not-allowed; }
.tile-price .bi-tag-fill { color:#16a34a; font-size:.75em; }
.denom-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); gap:.4rem .9rem; }
.denom { display:grid; grid-template-columns:64px 14px 1fr 86px; align-items:center; gap:.4rem; margin:0; }
.denom-face { display:inline-flex; align-items:center; justify-content:center; height:30px; font-weight:700; font-size:.9rem; border-radius:6px; }
.denom-face.note { background:#ecfdf5; color:#065f46; border:1px solid #a7f3d0; }
.denom-face.coin { background:#f1f5f9; color:#334155; border:1px solid #cbd5e1; border-radius:99px; }
.denom-sum { font-variant-numeric:tabular-nums; color:#475569; }
.close-result { display:grid; grid-template-columns:repeat(3, 1fr); gap:.5rem; background:#f8fafc; border:1px solid #e2e8f0; border-radius:.6rem; padding:.75rem; }
.close-result > div { display:flex; flex-direction:column; align-items:flex-end; }
.close-result strong { font-size:1.35rem; font-variant-numeric:tabular-nums; }
.print-blank { display:inline-block; width:90px; border-bottom:1px dotted #94a3b8; height:1.2em; }
@media print {
  .app-nav, .price-bar, form[method="get"], .btn, .modal { display:none !important; }
  .price-input { border:0; background:none !important; padding:0; }
  .card { border:0 !important; box-shadow:none !important; }
}
.modal-body > .table td:first-child, .modal-body > .table th:first-child { padding-left:1rem; }
.modal-body > .table td:last-child, .modal-body > .table th:last-child { padding-right:1rem; }
.tile .tile-price .bi-tag-fill { color:#fde68a; }

/* ===================================================== คู่มือ */
.help-hero { display:flex; gap:1.1rem; align-items:center; padding:1.4rem 1.6rem; border-radius:1rem;
  background:linear-gradient(120deg, #e6f4f1, #f2faf8); border:1px solid #cfe7e2; }
.help-hero-icon { font-size:2.6rem; line-height:1; }
.help-hero-title { font-size:1.4rem; font-weight:700; margin:0 0 .2rem; color:#0f3d38; }
.help-hero-sub { color:#3b5c57; font-size:.92rem; }
.help-layout { display:grid; grid-template-columns:270px minmax(0, 1fr); gap:1.25rem; align-items:start; }
.help-toc { position:sticky; top:70px; }
.help-toc-inner { background:#fff; border:1px solid #e5ebe9; border-radius:.8rem; padding:.9rem; max-height:calc(100vh - 90px); overflow:auto; }
.help-toc-group { font-size:.78rem; color:#64748b; margin:.8rem 0 .2rem; font-weight:600; }
.help-toc-link { display:flex; justify-content:space-between; align-items:center; gap:.4rem; padding:.28rem .5rem; border-radius:.45rem; color:#1f2937; text-decoration:none; font-size:.92rem; }
.help-toc-link:hover { background:#f1f7f6; }
.help-toc-link.active { background:var(--brand-50); color:var(--brand); font-weight:600; box-shadow:inset 3px 0 0 var(--brand); }
.help-badge { font-size:.68rem; font-weight:600; padding:.05rem .45rem; border-radius:99px; white-space:nowrap; vertical-align:middle; }
.help-badge-new { background:#dcfce7; color:#166534; }
.help-badge-admin { background:#fef3c7; color:#92400e; }
.help-group-title { color:#64748b; font-size:.85rem; font-weight:600; margin:1.4rem 0 .5rem; display:flex; align-items:center; gap:.6rem; }
.help-group-title::after { content:""; flex:1; height:1px; background:#dfe6e4; }
.help-group-title:first-of-type { margin-top:0; }
.help-section { background:#fff; border:1px solid #e5ebe9; border-radius:.9rem; padding:1.2rem 1.4rem; margin-bottom:1rem; scroll-margin-top:72px; }
.help-section-title { font-size:1.15rem; font-weight:700; margin:0 0 .9rem; padding-bottom:.6rem; border-bottom:1px solid #eef2f1; }
.help-body { font-size:.97rem; line-height:1.7; }
.help-body h6 { font-weight:700; margin:1rem 0 .4rem; }
.help-body code { background:#f1f5f9; color:#0f3d38; padding:.05rem .35rem; border-radius:.3rem; }
.help-steps { list-style:none; counter-reset:st; padding:0; margin:.5rem 0 1rem; }
.help-steps > li { counter-increment:st; position:relative; padding:.35rem 0 .55rem 2.6rem; }
.help-steps > li::before { content:counter(st); position:absolute; left:0; top:.3rem; width:1.85rem; height:1.85rem; border-radius:50%;
  border:2px solid var(--brand); color:var(--brand); font-weight:700; display:flex; align-items:center; justify-content:center; font-size:.9rem; background:#fff; }
.help-steps > li:not(:last-child)::after { content:""; position:absolute; left:.88rem; top:2.2rem; bottom:0; width:2px; background:#d7ebe7; }
.help-note { display:flex; gap:.7rem; align-items:flex-start; padding:.7rem .9rem; border-radius:.6rem; margin:.7rem 0; font-size:.93rem; }
.help-note > i { font-size:1.1rem; margin-top:.1rem; }
.help-note-tip { background:#ecfdf5; border:1px solid #bbf7d0; } .help-note-tip > i { color:#15803d; }
.help-note-warn { background:#fffbeb; border:1px solid #fde68a; } .help-note-warn > i { color:#b45309; }
.help-note-info { background:#eff6ff; border:1px solid #bfdbfe; } .help-note-info > i { color:#1d4ed8; }
.help-shot { margin:.8rem 0 1.1rem; }
.help-shot img { width:100%; height:auto; border-radius:.6rem; border:1px solid #dbe3e1; box-shadow:0 4px 14px rgba(15,23,42,.08); background:#fff; }
.help-shot figcaption { font-size:.84rem; color:#64748b; margin-top:.45rem; text-align:center; }
.help-table { font-size:.92rem; } .help-table th { background:#f1f7f6; font-weight:600; }
.ui { display:inline-block; padding:0 .45rem; border:1px solid #cbd5e1; border-bottom-width:2px; border-radius:.35rem; background:#f8fafc; font-size:.88em; font-weight:600; white-space:nowrap; }
.help-faq dt { font-weight:700; margin-top:.9rem; } .help-faq dt::before { content:"❓ "; }
.help-faq dd { margin:.2rem 0 0 1.6rem; color:#334155; }
mark.help-hit { background:#fef08a; padding:0; }
@media (max-width: 991px) { .help-layout { grid-template-columns:1fr; } .help-toc { position:static; } .help-toc-inner { max-height:260px; } }
@media print { .help-toc, .help-hero a { display:none !important; } .help-layout { display:block; } .help-section { break-inside:avoid-page; border:0; } }

/* ===================================================== อัปเดตระบบ */
.cl-chip { border:1px solid #d5dfdc; background:#fff; color:#334155; border-radius:99px; padding:.3rem .8rem; font-size:.88rem; }
.cl-chip:hover { border-color:var(--brand); }
.cl-chip.active { background:var(--brand); border-color:var(--brand); color:#fff; }
.cl-chip-n { opacity:.65; margin-left:.15rem; font-size:.8em; }
.cl-dot { display:inline-block; width:8px; height:8px; border-radius:50%; vertical-align:1px; }
.cl-dot-new { background:#16a34a; } .cl-dot-improve { background:#2563eb; } .cl-dot-fix { background:#ea580c; }
.cl-month { display:flex; align-items:center; gap:.7rem; font-weight:700; color:#334155; margin:1.2rem 0 .7rem; }
.cl-month::after { content:""; flex:1; height:1px; background:#dfe6e4; }
.cl-day { display:grid; grid-template-columns:96px minmax(0, 1fr); gap:1rem; margin-bottom:.9rem; }
.cl-date { position:sticky; top:72px; align-self:start; background:#fff; border:1px solid #e5ebe9; border-radius:.7rem; text-align:center; padding:.5rem .3rem; }
.cl-date-d { font-size:1.6rem; font-weight:700; color:var(--brand); line-height:1.1; }
.cl-date-m { font-size:.72rem; color:#64748b; }
.cl-items { display:flex; flex-direction:column; gap:.7rem; }
.cl-card { background:#fff; border:1px solid #e5ebe9; border-left:4px solid #94a3b8; border-radius:.7rem; padding:.85rem 1.1rem; }
.cl-card-new { border-left-color:#16a34a; } .cl-card-improve { border-left-color:#2563eb; } .cl-card-fix { border-left-color:#ea580c; }
.cl-meta { display:flex; gap:.5rem; align-items:center; margin-bottom:.3rem; }
.cl-type { font-size:.74rem; font-weight:700; padding:.05rem .5rem; border-radius:99px; }
.cl-type-new { background:#dcfce7; color:#166534; } .cl-type-improve { background:#dbeafe; color:#1e40af; } .cl-type-fix { background:#ffedd5; color:#9a3412; }
.cl-cat { font-size:.76rem; color:#7c3aed; background:#f3e8ff; padding:.05rem .5rem; border-radius:99px; }
.cl-title { font-size:1.02rem; font-weight:700; margin:.15rem 0 .35rem; }
.cl-list { margin:0 0 .4rem; padding-left:1.1rem; font-size:.92rem; color:#334155; }
.cl-list li { margin:.12rem 0; }
.cl-foot { display:flex; justify-content:space-between; align-items:center; gap:.5rem; }
.cl-nav-dot { position:absolute; top:6px; right:2px; width:8px; height:8px; border-radius:50%; background:#f97316; box-shadow:0 0 0 2px #0f766e; }
@media (max-width: 575px) { .cl-day { grid-template-columns:1fr; } .cl-date { position:static; display:flex; gap:.5rem; align-items:baseline; text-align:left; padding:.3rem .7rem; } }
