/* ==========================================================================
   Lolool — Theo dõi đường huyết thai kỳ (mục "Đường huyết")
   CSS phạm vi hoá bằng tiền tố .tdh- ; KHÔNG có reset * / body toàn cục
   để không phá layout của app.
   Màu ĐỒNG BỘ hệ brand (xanh lá #469F4C / ink #293D33 / kem #fdfbf6).
   Màu trạng thái xanh/vàng/đỏ giữ nguyên (ngữ nghĩa: bình thường / cao / vượt ngưỡng).
   ========================================================================== */
.tdh-wrap, .tdh-wrap * { box-sizing: border-box; }

.tdh-wrap { max-width: 900px; margin: 0 auto; padding: 6px 0 8px; color: #33414E; font-size: 15px; line-height: 1.5; }
.tdh-header { text-align: center; margin-bottom: 24px; }
.tdh-header h1 { font-size: 20px; font-weight: 700; color: #293D33; }
.tdh-header p  { color: #667581; font-size: 13px; margin-top: 3px; }
.tdh-card { background: white; border-radius: 10px; padding: 18px 20px; box-shadow: 0 1px 5px rgba(0,0,0,0.07); margin-bottom: 16px; }
.tdh-card-title { font-weight: 600; color: #293D33; margin-bottom: 14px; font-size: 13px; text-transform: uppercase; letter-spacing: 0.5px; }
.tdh-form-outer { display: flex; gap: 18px; align-items: flex-start; flex-wrap: wrap; }
.tdh-form-left { flex: 1 1 320px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.tdh-form-left .tdh-btn-add { grid-column: 1 / -1; }
.tdh-form-right { flex: 0 0 200px; min-width: 180px; }
@media (max-width: 640px) { .tdh-form-right { flex: 1 1 100%; } }
@media (max-width: 400px) { .tdh-form-left  { grid-template-columns: 1fr; } }
.tdh-field label { display: block; font-size: 12px; font-weight: 600; color: #667581; margin-bottom: 4px; text-transform: uppercase; letter-spacing: 0.3px; }
.tdh-field select,
.tdh-field input[type="number"],
.tdh-field input[type="date"] { width: 100%; padding: 9px 11px; border: 1px solid #e5ddcd; border-radius: 7px; font-size: 14px; color: #33414E; background: #fdfbf6; outline: none; transition: border-color 0.15s, background 0.15s; }
.tdh-field select:focus, .tdh-field input:focus { border-color: #469F4C; background: white; }
.tdh-btn-add { width: 100%; background: #469F4C; color: white; border: none; border-radius: 7px; padding: 11px; font-size: 15px; font-weight: 600; cursor: pointer; transition: background 0.15s; margin-top: 2px; }
.tdh-btn-add:hover  { background: #37813C; }
.tdh-btn-add:active { background: #2E7D32; }
.tdh-threshold { background: #f3eee3; border-radius: 8px; padding: 14px 16px; font-size: 13px; color: #33414E; }
.tdh-threshold strong { color: #293D33; display: block; margin-bottom: 10px; font-size: 13px; }
.tdh-t-row { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px solid #e5ddcd; }
.tdh-t-row:last-child { border-bottom: none; }
.tdh-t-label { color: #667581; }
.tdh-t-val   { font-weight: 700; color: #293D33; }
.tdh-alert { display: none; border-radius: 8px; padding: 13px 40px 13px 16px; margin-bottom: 16px; position: relative; font-size: 14px; line-height: 1.65; }
.tdh-alert.ok     { background: #f0fdf4; border-left: 4px solid #22c55e; }
.tdh-alert.warn   { background: #fffbeb; border-left: 4px solid #f59e0b; }
.tdh-alert.danger { background: #fef2f2; border-left: 4px solid #ef4444; }
.tdh-alert-title  { font-weight: 700; margin-bottom: 5px; font-size: 14px; }
.tdh-alert-close  { position: absolute; top: 10px; right: 12px; cursor: pointer; color: #8a97a1; font-size: 17px; background: none; border: none; line-height: 1; }
.tdh-alert-close:hover { color: #667581; }
.tdh-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
@media (max-width: 480px) { .tdh-stats { grid-template-columns: repeat(2, 1fr); } }
.tdh-stat { text-align: center; }
.tdh-stat-val   { font-size: 26px; font-weight: 700; color: #293D33; line-height: 1.1; }
.tdh-stat-val.g { color: #16a34a; }
.tdh-stat-val.r { color: #dc2626; }
.tdh-stat-lbl   { font-size: 11.5px; color: #667581; margin-top: 2px; }
.tdh-filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 12px; }
.tdh-filter-grp { display: flex; flex-direction: column; }
.tdh-filter-grp label { font-size: 12px; font-weight: 600; color: #667581; margin-bottom: 3px; text-transform: uppercase; letter-spacing: 0.3px; }
.tdh-filter-grp select,
.tdh-filter-grp input[type="date"] { min-width: 130px; padding: 7px 10px; font-size: 13.5px; border: 1px solid #e5ddcd; border-radius: 6px; background: #fdfbf6; color: #33414E; outline: none; }
.tdh-filter-grp select:focus, .tdh-filter-grp input:focus { border-color: #469F4C; background: white; }
.tdh-btn-reset { background: none; border: 1px solid #e5ddcd; border-radius: 6px; padding: 7px 13px; font-size: 13px; color: #667581; cursor: pointer; height: 36px; }
.tdh-btn-reset:hover { background: #f3eee3; }
.tdh-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.tdh-tbl { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.tdh-tbl thead th { background: #f3eee3; padding: 9px 11px; text-align: left; font-weight: 600; color: #667581; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.3px; border-bottom: 2px solid #e5ddcd; white-space: nowrap; }
table.tdh-tbl tbody td { padding: 9px 11px; border-bottom: 1px solid #efe8da; vertical-align: middle; }
table.tdh-tbl tr.r-ok     td { background: #f0fdf4; }
table.tdh-tbl tr.r-warn   td { background: #fffbeb; }
table.tdh-tbl tr.r-danger td { background: #fef2f2; }
table.tdh-tbl tbody tr:hover td { filter: brightness(0.965); }
.tdh-badge { display: inline-block; padding: 2px 9px; border-radius: 20px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.tdh-badge.ok     { background: #dcfce7; color: #15803d; }
.tdh-badge.warn   { background: #fef3c7; color: #92400e; }
.tdh-badge.danger { background: #fee2e2; color: #b91c1c; }
.tdh-btn-del { background: none; border: none; color: #c9c0b0; cursor: pointer; font-size: 14px; padding: 3px 6px; border-radius: 4px; }
.tdh-btn-del:hover { color: #ef4444; background: #fee2e2; }
.tdh-advice { font-size: 12px; color: #667581; max-width: 200px; line-height: 1.45; }
.tdh-chart-note { font-size: 12px; color: #8a97a1; margin-top: 10px; }
.tdh-kl { display: flex; align-items: flex-start; gap: 14px; }
.tdh-kl-icon { font-size: 30px; line-height: 1; flex-shrink: 0; }
.tdh-kl-text { flex: 1; }
.tdh-kl-title { font-weight: 700; font-size: 15px; margin-bottom: 5px; }
.tdh-kl-body  { font-size: 13.5px; color: #667581; line-height: 1.65; }
.tdh-kl.ok    .tdh-kl-title { color: #15803d; }
.tdh-kl.caution .tdh-kl-title { color: #b45309; }
.tdh-kl.warn  .tdh-kl-title { color: #c2410c; }
.tdh-kl.danger .tdh-kl-title { color: #b91c1c; }
/* Nguồn ngưỡng + câu hướng về bác sĩ, ngay dưới hộp kết luận */
.tdh-nguon { font-size: 12px; color: #8a97a1; line-height: 1.6; margin: 12px 0 0; padding-top: 10px; border-top: 1px dashed #ece5d6; }
.tdh-bottom { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; }
.tdh-saved-note { font-size: 12px; color: #8a97a1; }
.tdh-btn-export { background: #469F4C; color: white; border: none; border-radius: 7px; padding: 10px 22px; font-size: 14px; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.tdh-btn-export:hover { background: #37813C; }
.tdh-btn-clear { background: none; border: 1px solid #fca5a5; color: #dc2626; border-radius: 6px; padding: 8px 14px; font-size: 13px; cursor: pointer; }
.tdh-btn-clear:hover { background: #fef2f2; }
.tdh-empty { text-align: center; padding: 32px 0; color: #8a97a1; font-size: 14px; }
@media (max-width: 640px) {
  .tdh-col-hide { display: none; }
  .tdh-advice   { max-width: 140px; }
  table.tdh-tbl tbody td { padding: 8px 8px; font-size: 13px; }
}
