/* =====================================================================
   BẾP HỌC ĐƯỜNG - SHARED STYLES
   Sử dụng bởi quan-ly-bua-an.html (admin) và phu-huynh.html (parent)
   ===================================================================== */

* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; background: #f4f6f9; color: #222; }
header { background: linear-gradient(135deg, #1e88e5, #43a047); color: white; padding: 18px 28px; box-shadow: 0 2px 8px rgba(0,0,0,.1); }
header h1 { font-size: 22px; font-weight: 600; }
header .sub { font-size: 13px; opacity: .9; margin-top: 2px; }
header .brand-row { display: flex; align-items: center; gap: 12px; }
header .brand-logo { width: 44px; height: 44px; border-radius: 10px; background: #fff; padding: 4px; box-shadow: 0 2px 6px rgba(0,0,0,.15); flex: none; }
header .brand-logo img { width: 100%; height: 100%; display: block; }
header .brand-text { flex: 1; min-width: 0; }
header .links { margin-top: 8px; display: flex; gap: 12px; }
header .links a { color: white; text-decoration: none; padding: 4px 10px; border-radius: 4px; font-size: 13px; background: rgba(255,255,255,.15); transition: background .15s; }
header .links a:hover { background: rgba(255,255,255,.3); }
header .links a.active { background: rgba(255,255,255,.35); font-weight: 600; }

nav { display: flex; background: white; border-bottom: 1px solid #e0e0e0; overflow-x: auto; }
nav button { background: none; border: none; padding: 14px 22px; font-size: 14px; font-weight: 500; cursor: pointer; color: #555; border-bottom: 3px solid transparent; transition: all .15s; white-space: nowrap; }
nav button:hover { background: #f5f5f5; color: #1e88e5; }
nav button.active { color: #1e88e5; border-bottom-color: #1e88e5; background: #f8fbff; }

main { padding: 24px 28px; max-width: 1400px; margin: 0 auto; }
.panel { background: white; border-radius: 10px; padding: 22px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 20px; }
.panel h2 { font-size: 18px; margin-bottom: 14px; color: #1e88e5; display: flex; align-items: center; gap: 10px; }
.panel h2 .count { background: #e3f2fd; color: #1e88e5; padding: 2px 10px; border-radius: 12px; font-size: 13px; font-weight: 500; }
.panel h3 { font-size: 15px; color: #555; margin-bottom: 8px; }

.toolbar { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; align-items: center; }
button.btn { background: #1e88e5; color: white; border: none; padding: 9px 16px; border-radius: 6px; cursor: pointer; font-size: 14px; font-weight: 500; transition: background .15s; }
button.btn:hover { background: #1565c0; }
button.btn.secondary { background: #757575; }
button.btn.secondary:hover { background: #424242; }
button.btn.danger { background: #e53935; }
button.btn.danger:hover { background: #c62828; }
button.btn.success { background: #43a047; }
button.btn.success:hover { background: #2e7d32; }
button.btn.warn { background: #f57c00; }
button.btn.warn:hover { background: #e65100; }
button.btn.small { padding: 5px 10px; font-size: 12px; }
button.btn.large { padding: 12px 22px; font-size: 15px; }

input, select, textarea { padding: 8px 12px; border: 1px solid #ccc; border-radius: 6px; font-size: 14px; font-family: inherit; width: 100%; background: white; }
input:focus, select:focus, textarea:focus { outline: none; border-color: #1e88e5; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
table th, table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #eee; }
table th { background: #fafafa; font-weight: 600; color: #555; font-size: 13px; text-transform: uppercase; letter-spacing: .3px; }
table tr:hover { background: #f9fbfd; }
.empty { text-align: center; padding: 40px 20px; color: #999; font-style: italic; }

.modal-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; z-index: 100; }
.modal { background: white; border-radius: 10px; padding: 24px; max-width: 600px; width: 92%; max-height: 90vh; overflow-y: auto; }
.modal.modal-wide { max-width: 95vw; width: 920px; }
.modal h3 { margin-bottom: 16px; color: #1e88e5; }
.form-row { margin-bottom: 14px; }
.form-row label { display: block; margin-bottom: 5px; font-size: 13px; color: #555; font-weight: 500; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

.badge { display: inline-block; padding: 3px 9px; border-radius: 12px; font-size: 12px; font-weight: 500; }
.badge.green { background: #e8f5e9; color: #2e7d32; }
.badge.orange { background: #fff3e0; color: #ef6c00; }
.badge.red { background: #ffebee; color: #c62828; }
.badge.blue { background: #e3f2fd; color: #1565c0; }
.badge.purple { background: #f3e5f5; color: #7b1fa2; }
.badge.gray { background: #eeeeee; color: #555; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.stat-card { background: white; padding: 18px; border-radius: 10px; border-left: 4px solid #1e88e5; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.stat-card .label { font-size: 13px; color: #777; margin-bottom: 4px; }
.stat-card .value { font-size: 26px; font-weight: 700; color: #1e88e5; }
.stat-card.green { border-left-color: #43a047; }
.stat-card.green .value { color: #43a047; }
.stat-card.orange { border-left-color: #ef6c00; }
.stat-card.orange .value { color: #ef6c00; }
.stat-card.purple { border-left-color: #7b1fa2; }
.stat-card.purple .value { color: #7b1fa2; }

.ingredient-row { display: grid; grid-template-columns: 2fr 1fr auto; gap: 10px; margin-bottom: 8px; align-items: center; }
.nutrition-summary { background: #f8fbff; border: 1px solid #e3f2fd; border-radius: 8px; padding: 14px; margin-top: 12px; }
.nutrition-summary .row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; text-align: center; }
.nutrition-summary .item { padding: 8px; }
.nutrition-summary .item .lbl { font-size: 12px; color: #777; }
.nutrition-summary .item .val { font-size: 18px; font-weight: 700; color: #1e88e5; margin-top: 2px; }

.weekly-grid { display: grid; grid-template-columns: 100px repeat(7, 1fr); gap: 4px; }
.weekly-grid .head { background: #1e88e5; color: white; padding: 10px; text-align: center; font-weight: 600; font-size: 13px; border-radius: 6px; }
.weekly-grid .meal-label { background: #fafafa; padding: 14px 10px; font-weight: 600; text-align: center; border-radius: 6px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; }
.weekly-grid .meal-cell { background: #f8fbff; border: 1px dashed #c5e1f7; border-radius: 6px; padding: 8px; min-height: 70px; cursor: pointer; transition: all .15s; font-size: 12px; }
.weekly-grid .meal-cell:hover { background: #e3f2fd; border-style: solid; }
.weekly-grid .meal-cell.filled { background: #e8f5e9; border-color: #81c784; border-style: solid; }
.weekly-grid .meal-cell.filled:hover { background: #c8e6c9; }
.weekly-grid .meal-cell.read-only { cursor: default; }
.weekly-grid .meal-cell.absent { background: #ffebee !important; border-color: #ef5350; opacity: .7; }
.meal-cell .meal-name { font-weight: 600; color: #2e7d32; }
.meal-cell .meal-cal { color: #555; font-size: 11px; margin-top: 3px; }

.reg-grid { display: grid; grid-template-columns: 1fr; gap: 10px; }
.reg-row { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr 1fr; gap: 10px; align-items: center; padding: 10px; background: #fafafa; border-radius: 6px; }
.reg-row .name { font-weight: 600; }
.reg-row .check { text-align: center; }
.reg-row .check input { width: 18px; height: 18px; cursor: pointer; }

.filter-bar { display: flex; gap: 10px; margin-bottom: 14px; align-items: center; flex-wrap: wrap; }
.filter-bar label { font-size: 13px; color: #555; }

.summary-box { background: linear-gradient(135deg, #e3f2fd, #e8f5e9); padding: 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.summary-box strong { color: #1565c0; }

.alert { padding: 12px 14px; border-radius: 8px; margin: 10px 0; font-size: 13px; border-left: 4px solid; }
.alert.warn { background: #fff8e1; border-color: #f57f17; color: #6e4a00; }
.alert.bad { background: #ffebee; border-color: #c62828; color: #8b1e1e; }
.alert.good { background: #e8f5e9; border-color: #2e7d32; color: #1b5e20; }
.alert.info { background: #e3f2fd; border-color: #1565c0; color: #0d3c61; }

.nutri-bar { background: #eee; height: 10px; border-radius: 5px; overflow: hidden; margin-top: 4px; }
.nutri-bar > div { height: 100%; transition: width .3s; }
.nutri-bar.green > div { background: #43a047; }
.nutri-bar.orange > div { background: #ef6c00; }
.nutri-bar.red > div { background: #c62828; }
.ratio-box { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 10px; text-align: center; }
.ratio-box .item { background: white; padding: 8px; border-radius: 6px; border: 1px solid #ddd; }
.ratio-box .item .l { font-size: 11px; color: #777; }
.ratio-box .item .v { font-size: 16px; font-weight: 700; }
.ratio-box .item.ok .v { color: #2e7d32; }
.ratio-box .item.warn .v { color: #ef6c00; }

.shop-supplier { background: #f8fbff; border: 1px solid #c5e1f7; border-radius: 8px; padding: 14px; margin-bottom: 14px; }
.shop-supplier h3 { color: #1565c0; margin-bottom: 10px; font-size: 16px; display: flex; justify-content: space-between; align-items: center; }
.shop-supplier h3 .total { font-size: 13px; background: #1e88e5; color: white; padding: 4px 10px; border-radius: 12px; }

.grade-tabs { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; background: white; padding: 8px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.grade-tab { background: #f5f5f5; color: #555; border: 2px solid transparent; padding: 10px 18px; border-radius: 8px; cursor: pointer; font-size: 14px; font-weight: 600; transition: all .15s; display: flex; align-items: center; gap: 8px; }
.grade-tab:hover { background: #e3f2fd; color: #1565c0; }
.grade-tab.active { background: #1e88e5; color: white; }
.grade-tab-cnt { background: rgba(255,255,255,.25); padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 500; }
.grade-tab:not(.active) .grade-tab-cnt { background: #ddd; color: #555; }

/* ============== HOẠT ĐỘNG (Activity feed) ============== */
.activity-view { background: #f4f6f9; }
.activity-toolbar { display: flex; align-items: center; gap: 10px; background: white; padding: 12px 14px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 14px; position: sticky; top: 0; z-index: 10; }
.activity-toolbar h2 { font-size: 17px; color: #1565c0; margin: 0; flex: 1; }
.activity-toolbar .back-btn { background: #f5f5f5; border: none; padding: 6px 12px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13px; color: #555; }
.activity-toolbar .back-btn:hover { background: #e0e0e0; }

.activity-card { background: white; border-radius: 14px; padding: 16px; margin-bottom: 12px; box-shadow: 0 2px 8px rgba(0,0,0,.05); }
.activity-card .act-header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.activity-avatar { width: 42px; height: 42px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: white; font-weight: 700; font-size: 17px; flex-shrink: 0; }
.activity-card .act-name { font-weight: 600; font-size: 14px; color: #333; }
.activity-card .act-name-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.activity-card .act-time { color: #888; font-size: 12px; margin-top: 2px; }
.activity-card .act-menu { margin-left: auto; }
.activity-card .act-content { font-size: 14px; line-height: 1.55; color: #222; white-space: pre-wrap; word-break: break-word; margin-bottom: 10px; }
.activity-card .act-images { display: grid; gap: 4px; border-radius: 10px; overflow: hidden; margin-bottom: 10px; }
.activity-card .act-images.count-1 { grid-template-columns: 1fr; }
.activity-card .act-images.count-2 { grid-template-columns: 1fr 1fr; }
.activity-card .act-images.count-3 { grid-template-columns: 2fr 1fr; grid-template-rows: 1fr 1fr; }
.activity-card .act-images.count-3 img:first-child { grid-row: span 2; }
.activity-card .act-images.count-4 { grid-template-columns: 1fr 1fr; grid-template-rows: 1fr 1fr; }
.activity-card .act-images.count-many { grid-template-columns: 1fr 1fr 1fr; }
.activity-card .act-images img { width: 100%; height: 100%; object-fit: cover; display: block; max-height: 320px; min-height: 120px; cursor: pointer; transition: opacity .15s; }
.activity-card .act-images img:hover { opacity: .9; }
.activity-card .act-stats { display: flex; gap: 14px; font-size: 12px; color: #777; padding: 6px 0; border-top: 1px solid #eee; border-bottom: 1px solid #eee; }
.activity-card .act-actions { display: flex; gap: 4px; padding-top: 6px; }
.activity-card .act-action-btn { flex: 1; background: none; border: none; padding: 8px 10px; border-radius: 8px; cursor: pointer; font-family: inherit; font-size: 13px; color: #555; font-weight: 600; display: flex; align-items: center; justify-content: center; gap: 6px; transition: background .15s; }
.activity-card .act-action-btn:hover { background: #f5f5f5; }
.activity-card .act-action-btn.liked { color: #e91e63; }
.activity-card .act-action-btn svg { width: 18px; height: 18px; }

.activity-card .act-comments { margin-top: 8px; padding-top: 10px; border-top: 1px solid #eee; }
.activity-card .comment-row { display: flex; gap: 8px; margin-bottom: 8px; }
.activity-card .comment-row .activity-avatar { width: 32px; height: 32px; font-size: 13px; }
.activity-card .comment-body { background: #f5f5f5; padding: 8px 12px; border-radius: 14px; flex: 1; font-size: 13px; line-height: 1.4; min-width: 0; }
.activity-card .comment-body .comment-name { font-weight: 600; font-size: 12px; margin-bottom: 2px; display: flex; align-items: center; gap: 4px; }
.activity-card .comment-body .comment-content { word-break: break-word; }
.activity-card .comment-body .comment-time { font-size: 10px; color: #999; margin-top: 4px; }
.activity-card .comment-delete { background: none; border: none; cursor: pointer; color: #aaa; font-size: 12px; align-self: flex-start; padding: 4px; }
.activity-card .comment-delete:hover { color: #c62828; }

.activity-card .comment-form { display: flex; gap: 8px; margin-top: 10px; align-items: flex-start; }
.activity-card .comment-form .activity-avatar { width: 32px; height: 32px; font-size: 13px; }
.activity-card .comment-form input { flex: 1; border: 1px solid #ddd; border-radius: 18px; padding: 8px 14px; font-size: 13px; background: #f8f8f8; }
.activity-card .comment-form input:focus { background: white; border-color: #1e88e5; }
.activity-card .comment-form button { background: #1e88e5; color: white; border: none; padding: 8px 14px; border-radius: 18px; cursor: pointer; font-family: inherit; font-size: 13px; font-weight: 600; }
.activity-card .comment-form button:hover { background: #1565c0; }

/* Compose modal */
.compose-image-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.compose-image-item { width: 80px; height: 80px; border-radius: 8px; overflow: hidden; position: relative; border: 1px solid #ddd; }
.compose-image-item img { width: 100%; height: 100%; object-fit: cover; }
.compose-image-item .remove-btn { position: absolute; top: 3px; right: 3px; background: rgba(0,0,0,.65); color: white; border: none; width: 20px; height: 20px; border-radius: 50%; cursor: pointer; font-size: 12px; line-height: 1; display: flex; align-items: center; justify-content: center; }
.compose-image-item .remove-btn:hover { background: #c62828; }
.compose-add-image { width: 80px; height: 80px; border: 2px dashed #1e88e5; border-radius: 8px; background: #f8fbff; cursor: pointer; display: flex; flex-direction: column; align-items: center; justify-content: center; color: #1e88e5; font-size: 24px; font-family: inherit; }
.compose-add-image:hover { background: #e3f2fd; }
.compose-add-image small { font-size: 10px; margin-top: 2px; }

/* Lightbox xem ảnh */
.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.9); z-index: 999; display: flex; align-items: center; justify-content: center; padding: 20px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; }
.lightbox .lb-close { position: absolute; top: 20px; right: 20px; background: rgba(255,255,255,.2); color: white; border: none; width: 40px; height: 40px; border-radius: 50%; cursor: pointer; font-size: 20px; }

/* FAB - nút tạo bài nổi */
.fab-create { position: fixed; bottom: 90px; right: 20px; width: 56px; height: 56px; border-radius: 50%; background: linear-gradient(135deg, #1e88e5, #43a047); color: white; border: none; cursor: pointer; box-shadow: 0 4px 16px rgba(30,136,229,.4); display: flex; align-items: center; justify-content: center; z-index: 49; transition: transform .15s; }
.fab-create:hover { transform: scale(1.08); }
.fab-create svg { width: 26px; height: 26px; stroke: white; }

@media (max-width: 768px) {
  .activity-card { padding: 12px; border-radius: 12px; }
  .activity-card .act-images img { max-height: 260px; }
  .fab-create { bottom: 86px; right: 16px; width: 52px; height: 52px; }
}

/* ============== ĐƠN XIN NGHỈ ============== */
.leave-card { background: white; border-left: 4px solid #43a047; border-radius: 8px; padding: 14px; margin-bottom: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.leave-card.past { opacity: .7; border-left-color: #999; background: #fafafa; }
.leave-card.cancelled { opacity: .55; border-left-color: #c62828; background: #fff5f5; }
.leave-card.future { border-left-color: #1565c0; background: #f8fbff; }
.leave-card .leave-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; flex-wrap: wrap; gap: 8px; }
.leave-card .leave-dates { font-weight: 700; color: #1565c0; font-size: 15px; }
.leave-card .leave-reason { font-size: 14px; line-height: 1.5; margin-bottom: 6px; background: #fafafa; padding: 8px 10px; border-radius: 6px; white-space: pre-wrap; }
.leave-card .leave-note { font-size: 13px; color: #666; padding: 6px 10px; background: #fffde7; border-radius: 6px; margin-bottom: 6px; white-space: pre-wrap; }
.leave-card .leave-meta { font-size: 12px; color: #888; margin-top: 6px; }
.leave-card .leave-actions { margin-top: 8px; display: flex; gap: 6px; justify-content: flex-end; }

.leave-link { color: #1565c0; font-size: 11px; font-weight: 600; cursor: pointer; padding: 2px 6px; background: #e3f2fd; border-radius: 8px; margin-top: 4px; display: inline-block; }
.leave-link:hover { background: #bbdefb; text-decoration: underline; }

/* ============== FEATURE MENU (icon grid) ============== */
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 20px; }
.feature-card { background: white; border: 1px solid #f0f0f0; border-radius: 16px; padding: 18px 8px 14px; text-align: center; cursor: pointer; transition: all .2s cubic-bezier(.34,1.56,.64,1); font-family: inherit; position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04); overflow: hidden; }
.feature-card:hover { transform: translateY(-3px); box-shadow: 0 10px 22px rgba(0,0,0,.10); border-color: rgba(0,0,0,.08); }
.feature-card .fc-icon-wrap { width: 54px; height: 54px; border-radius: 16px; display: flex; align-items: center; justify-content: center; color: white; transition: transform .25s ease; box-shadow: 0 4px 10px rgba(0,0,0,.10); }
.feature-card .fc-icon-wrap svg { width: 28px; height: 28px; }
.feature-card:hover .fc-icon-wrap { transform: scale(1.1) rotate(-6deg); box-shadow: 0 6px 16px rgba(0,0,0,.18); }
.feature-card .fc-label { font-size: 12px; font-weight: 600; color: #333; line-height: 1.3; min-height: 32px; display: flex; align-items: center; }
.feature-card.coming-soon { background: #fbfbfd; }
.feature-card.coming-soon .fc-icon-wrap { filter: grayscale(.7) brightness(.95); opacity: .75; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.feature-card.coming-soon .fc-label { color: #888; }
.feature-card.coming-soon::after { content: 'Sắp có'; position: absolute; top: 8px; right: 6px; background: linear-gradient(135deg, #ff9800, #ef6c00); color: white; font-size: 9px; padding: 2px 7px; border-radius: 8px; font-weight: 700; letter-spacing: .3px; box-shadow: 0 2px 4px rgba(239,108,0,.3); }

/* Color gradients cho icon - 10 màu */
.fc-icon-wrap.color-orange { background: linear-gradient(135deg, #ffa726, #ef6c00); }
.fc-icon-wrap.color-green  { background: linear-gradient(135deg, #66bb6a, #2e7d32); }
.fc-icon-wrap.color-coral  { background: linear-gradient(135deg, #ff7e5f, #e63946); }
.fc-icon-wrap.color-indigo { background: linear-gradient(135deg, #5c6bc0, #283593); }
.fc-icon-wrap.color-purple { background: linear-gradient(135deg, #ba68c8, #6a1b9a); }
.fc-icon-wrap.color-cyan   { background: linear-gradient(135deg, #4dd0e1, #00838f); }
.fc-icon-wrap.color-teal   { background: linear-gradient(135deg, #4db6ac, #00695c); }
.fc-icon-wrap.color-red    { background: linear-gradient(135deg, #ef5350, #c62828); }
.fc-icon-wrap.color-amber  { background: linear-gradient(135deg, #ffd54f, #ff8f00); }
.fc-icon-wrap.color-pink   { background: linear-gradient(135deg, #f06292, #ad1457); }
.fc-icon-wrap.color-blue   { background: linear-gradient(135deg, #42a5f5, #1565c0); }

/* ============== BOTTOM NAV ============== */
.bottom-nav { position: fixed; bottom: 0; left: 0; right: 0; background: white; display: flex; border-top: 1px solid #e0e0e0; box-shadow: 0 -2px 12px rgba(0,0,0,.08); z-index: 50; }
.bottom-nav-item { flex: 1; background: none; border: none; padding: 8px 4px 6px; cursor: pointer; font-family: inherit; color: #666; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; position: relative; transition: all .15s; border-top: 3px solid transparent; }
.bottom-nav-item:hover { color: #1e88e5; background: #f8fbff; }
.bottom-nav-item.active { color: #1e88e5; border-top-color: #1e88e5; background: #f8fbff; }
.bottom-nav-item .bn-icon { width: 24px; height: 24px; display: inline-flex; align-items: center; justify-content: center; }
.bottom-nav-item .bn-icon svg { width: 100%; height: 100%; }
.bottom-nav-item .bn-label { font-size: 11px; font-weight: 500; }
.bottom-nav-item .bn-badge { position: absolute; top: 4px; right: calc(50% - 22px); background: #c62828; color: white; font-size: 9px; padding: 1px 5px; border-radius: 8px; font-weight: 700; min-width: 16px; line-height: 1.4; }
.bottom-nav-item.home .bn-icon-wrap { width: 48px; height: 48px; background: linear-gradient(135deg, #1e88e5, #43a047); display: flex; align-items: center; justify-content: center; margin-top: -18px; box-shadow: 0 4px 14px rgba(30,136,229,.45); transition: transform .2s; }
.bottom-nav-item.home:hover .bn-icon-wrap { transform: scale(1.08); }
.bottom-nav-item.home .bn-icon-wrap svg { width: 26px; height: 26px; stroke: white; }

body.has-bottom-nav main { padding-bottom: 90px; }

/* ============== TRANG PHỤ HUYNH ============== */
.child-selector { display: flex; flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; gap: 10px; padding: 4px 2px 10px; margin-bottom: 6px; scroll-snap-type: x proximity; }
.child-selector::-webkit-scrollbar { height: 6px; }
.child-selector::-webkit-scrollbar-track { background: #f5f5f5; border-radius: 3px; }
.child-selector::-webkit-scrollbar-thumb { background: #c5e1f7; border-radius: 3px; }
.child-tab-card { flex: 0 0 220px; scroll-snap-align: start; background: white; border: 2px solid #e0e0e0; border-radius: 12px; padding: 14px; cursor: pointer; text-align: left; transition: all .2s; font-family: inherit; box-shadow: 0 1px 3px rgba(0,0,0,.05); position: relative; }
.child-tab-card:hover { border-color: #43a047; background: #f7fcf7; transform: translateY(-1px); }
.child-tab-card.active { border-color: #43a047; background: linear-gradient(135deg, #e8f5e9, #c8e6c9); box-shadow: 0 4px 12px rgba(67,160,71,.25); }
.child-tab-card.active::after { content: '✓'; position: absolute; top: 8px; right: 10px; background: #43a047; color: white; width: 22px; height: 22px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; }
.child-tab-card .ctc-name { font-size: 16px; font-weight: 700; color: #2e7d32; margin-bottom: 4px; }
.child-tab-card .ctc-class { font-size: 12px; color: #666; margin-bottom: 10px; }
.child-tab-card .ctc-meals { font-size: 16px; letter-spacing: 4px; }
.child-tab-card .ctc-meals-none { font-size: 12px; color: #aaa; font-style: italic; }
.child-tab-card .ctc-abs { font-size: 11px; color: #ef6c00; margin-top: 8px; padding: 3px 8px; background: #fff3e0; border-radius: 10px; display: inline-block; }

.child-add-btn { flex: 0 0 160px; scroll-snap-align: end; background: #f8fbff; border: 2px dashed #1e88e5; border-radius: 12px; padding: 14px; cursor: pointer; text-align: center; color: #1e88e5; font-family: inherit; font-weight: 600; transition: all .2s; display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 120px; }
.child-add-btn:hover { background: #e3f2fd; border-color: #1565c0; transform: translateY(-1px); }
.child-add-btn .plus { font-size: 32px; line-height: 1; margin-bottom: 6px; color: #1e88e5; }
.child-add-btn .lbl { font-size: 13px; }
.child-add-btn .sub { font-size: 11px; color: #777; margin-top: 4px; font-weight: 400; }


.parent-login { background: white; padding: 24px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); margin-bottom: 20px; }
.parent-login h3 { color: #1e88e5; margin-bottom: 12px; }
.parent-card { background: linear-gradient(135deg, #e3f2fd, #f3e5f5); padding: 18px; border-radius: 10px; margin-bottom: 20px; }
.parent-card .name { font-size: 20px; font-weight: 700; color: #1565c0; }
.parent-card .info { font-size: 13px; color: #555; margin-top: 4px; }
.parent-card .logout { float: right; }

.child-card { background: white; border-radius: 10px; padding: 20px; margin-bottom: 16px; box-shadow: 0 1px 3px rgba(0,0,0,.05); border-left: 5px solid #43a047; }
.child-card .child-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 10px; }
.child-card .child-name { font-size: 18px; font-weight: 700; color: #2e7d32; }
.child-card .child-meta { font-size: 13px; color: #666; margin-top: 2px; }

.child-tabs { display: flex; gap: 4px; border-bottom: 2px solid #eee; margin-bottom: 16px; flex-wrap: wrap; }
.child-tab { background: none; border: none; padding: 10px 14px; cursor: pointer; font-size: 14px; color: #777; font-weight: 500; border-bottom: 3px solid transparent; margin-bottom: -2px; transition: all .15s; }
.child-tab:hover { color: #1e88e5; }
.child-tab.active { color: #1e88e5; border-bottom-color: #1e88e5; font-weight: 600; }

.month-reg-row { display: grid; grid-template-columns: 1fr auto auto auto; gap: 14px; align-items: center; padding: 12px 14px; background: #fafafa; border-radius: 8px; margin-bottom: 8px; }
.month-reg-row .lbl { font-weight: 500; font-size: 14px; }
.month-reg-row .toggle { display: flex; align-items: center; gap: 6px; }
.month-reg-row .toggle input { width: 18px; height: 18px; cursor: pointer; }

.absence-cal { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.absence-day { background: #f8fbff; border: 1px solid #e3f2fd; border-radius: 6px; padding: 8px; min-height: 100px; font-size: 12px; }
.absence-day.weekend { background: #f5f5f5; opacity: .6; }
.absence-day.past { opacity: .5; }
.absence-day .day-head { font-weight: 700; color: #1565c0; margin-bottom: 4px; }
.absence-day .day-head .dnum { font-size: 16px; }
.absence-day .day-head .dlbl { font-size: 11px; color: #777; }
.absence-day .meal-check { display: flex; align-items: center; gap: 4px; padding: 2px 0; }
.absence-day .meal-check input { width: 14px; height: 14px; cursor: pointer; }
.absence-day .meal-check label { font-size: 11px; cursor: pointer; }
.absence-day.has-absence { background: #fff3e0; border-color: #ef6c00; }
.absence-day .not-registered { color: #aaa; font-size: 10px; font-style: italic; }

.cal-month-header { background: #1e88e5; color: white; padding: 8px; text-align: center; font-weight: 600; font-size: 12px; border-radius: 6px; }

@media print {
  body { background: white; }
  header, nav, .toolbar, .modal-backdrop, .no-print { display: none !important; }
  main { padding: 0; max-width: 100%; }
  .panel { box-shadow: none; padding: 10px; page-break-inside: avoid; }
  .weekly-grid { grid-template-columns: 80px repeat(7, 1fr); }
  .weekly-grid .meal-cell { min-height: 60px; background: white !important; border: 1px solid #999 !important; }
  .weekly-grid .meal-cell.filled { background: #f5f5f5 !important; }
  .shop-supplier { page-break-inside: avoid; }
  .print-header { display: block !important; text-align: center; margin-bottom: 16px; padding-bottom: 10px; border-bottom: 2px solid #000; }
  .print-header h1 { font-size: 20px; }
  .print-header p { font-size: 12px; color: #555; margin-top: 4px; }
}
.print-header { display: none; }

/* ============== RESPONSIVE - TABLET ============== */
@media (max-width: 900px) {
  .form-grid, .form-grid-3 { grid-template-columns: 1fr; }
  .month-reg-row { grid-template-columns: 1fr; gap: 8px; }
}

/* ============== RESPONSIVE - MOBILE (<= 768px) ============== */
@media (max-width: 768px) {
  /* Header compact */
  header { padding: 12px 16px; }
  header h1 { font-size: 17px; line-height: 1.3; }
  header .sub { font-size: 12px; }
  header .links { flex-wrap: wrap; gap: 8px; margin-top: 10px; }
  header .links a { font-size: 12px; padding: 4px 8px; }

  main { padding: 14px; }

  /* Nav scroll horizontal */
  nav button { padding: 11px 12px; font-size: 13px; }

  /* Panel compact */
  .panel { padding: 14px; margin-bottom: 14px; border-radius: 8px; }
  .panel h2 { font-size: 15px; flex-wrap: wrap; gap: 6px; }
  .panel h2 .count { font-size: 12px; }
  .panel h3 { font-size: 14px; }

  /* Buttons */
  button.btn { padding: 7px 12px; font-size: 13px; }
  button.btn.large { padding: 10px 16px; font-size: 14px; }
  button.btn.small { padding: 4px 8px; font-size: 11px; }

  /* Inputs */
  input, select, textarea { padding: 8px 10px; font-size: 14px; }

  /* Stats 2 cột */
  .stats { grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
  .stat-card { padding: 12px; border-radius: 8px; }
  .stat-card .label { font-size: 11px; }
  .stat-card .value { font-size: 19px; }

  /* TẤT CẢ TABLE: scroll ngang */
  .panel table,
  .child-card table,
  .parent-login table,
  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    white-space: nowrap;
    max-width: 100%;
  }
  table th, table td { padding: 8px 10px; font-size: 12px; }
  table th { font-size: 11px; }

  /* Toolbar + filter */
  .toolbar { gap: 6px; }
  .toolbar > span { font-size: 12px !important; width: 100%; }
  .filter-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .filter-bar select, .filter-bar input { width: 100%; }
  .filter-bar label { font-size: 12px; }

  /* Reg-row: dạng grid cố định, scroll ngang */
  .reg-grid { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .reg-row { grid-template-columns: 140px 50px 70px 70px 70px; min-width: 420px; gap: 6px; padding: 8px; font-size: 12px; }
  .reg-row .name { font-size: 12px; }
  .reg-row .check input { width: 16px; height: 16px; }
  .reg-row .badge { font-size: 11px; padding: 2px 6px; }

  /* Nutrition summary: 2x2 */
  .nutrition-summary { padding: 10px; }
  .nutrition-summary .row { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .nutrition-summary .item .val { font-size: 16px; }
  .nutrition-summary .item .lbl { font-size: 11px; }

  /* Summary box + alert */
  .summary-box, .alert { padding: 10px 12px; font-size: 13px; }

  /* Grade tabs */
  .grade-tabs { padding: 6px; gap: 4px; }
  .grade-tab { padding: 8px 10px; font-size: 12px; }
  .grade-tab-cnt { padding: 1px 6px; font-size: 10px; }

  /* Weekly grid: scroll ngang */
  .weekly-grid { grid-template-columns: 70px repeat(7, minmax(80px, 1fr)); gap: 3px; }
  .weekly-grid .head { padding: 7px 4px; font-size: 11px; }
  .weekly-grid .meal-label { padding: 8px 4px; font-size: 11px; }
  .weekly-grid .meal-cell { padding: 5px; min-height: 55px; font-size: 11px; }
  .meal-cell .meal-name { font-size: 11px; }
  .meal-cell .meal-cal { font-size: 10px; }

  /* Modal */
  .modal { padding: 16px; max-height: 95vh; border-radius: 8px; }
  .modal h3 { font-size: 16px; }
  .form-row label { font-size: 12px; }
  .ingredient-row { grid-template-columns: 1.5fr 1fr auto; gap: 6px; }

  /* Shop supplier */
  .shop-supplier { padding: 12px; }
  .shop-supplier h3 { font-size: 14px; flex-direction: column; align-items: flex-start; gap: 4px; }

  /* Parent portal */
  .parent-login { padding: 16px; }
  .parent-card { padding: 14px; border-radius: 8px; }
  .parent-card .name { font-size: 16px; }
  .parent-card .info { font-size: 12px; }
  .parent-card .logout { float: none; margin-bottom: 10px; display: inline-block; }
  .child-card { padding: 14px; border-radius: 8px; border-left-width: 4px; }
  .child-card .child-header { flex-direction: column; align-items: flex-start; gap: 4px; margin-bottom: 12px; }
  .child-card .child-name { font-size: 16px; }
  .child-card .child-meta { font-size: 12px; }

  /* Child tabs scroll ngang */
  .child-tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; flex-wrap: nowrap; }
  .child-tab { padding: 8px 10px; font-size: 12px; white-space: nowrap; }

  /* Feature grid mobile */
  .feature-grid { gap: 8px; margin-bottom: 14px; }
  .feature-card { padding: 12px 4px 10px; border-radius: 14px; gap: 8px; }
  .feature-card .fc-icon-wrap { width: 46px; height: 46px; border-radius: 14px; }
  .feature-card .fc-icon-wrap svg { width: 24px; height: 24px; }
  .feature-card .fc-label { font-size: 11px; min-height: 28px; }
  .feature-card.coming-soon::after { font-size: 8px; padding: 1px 5px; top: 4px; right: 4px; }

  /* Bottom nav mobile */
  .bottom-nav-item .bn-icon { width: 22px; height: 22px; }
  .bottom-nav-item .bn-label { font-size: 10px; }
  .bottom-nav-item.home .bn-icon-wrap { width: 42px; height: 42px; margin-top: -16px; }
  .bottom-nav-item.home .bn-icon-wrap svg { width: 22px; height: 22px; }
  body.has-bottom-nav main { padding-bottom: 80px; }

  /* Child selector horizontal scroll - mobile compact */
  .child-selector { gap: 8px; padding: 4px 2px 8px; }
  .child-tab-card { flex: 0 0 180px; padding: 10px; border-radius: 10px; }
  .child-tab-card .ctc-name { font-size: 14px; }
  .child-tab-card .ctc-class { font-size: 11px; margin-bottom: 6px; }
  .child-tab-card .ctc-meals { font-size: 14px; letter-spacing: 2px; }
  .child-tab-card .ctc-abs { font-size: 10px; padding: 2px 6px; }
  .child-add-btn { flex: 0 0 140px; padding: 10px; min-height: 100px; }
  .child-add-btn .plus { font-size: 24px; }
  .child-add-btn .lbl { font-size: 12px; }
  .child-add-btn .sub { font-size: 10px; }

  /* Absence calendar */
  .absence-cal { grid-template-columns: repeat(6, minmax(58px, 1fr)); gap: 3px; }
  .absence-day { padding: 4px; min-height: 75px; font-size: 10px; }
  .absence-day .day-head { margin-bottom: 2px; }
  .absence-day .day-head .dnum { font-size: 13px; }
  .absence-day .day-head .dlbl { font-size: 9px; }
  .absence-day .meal-check { padding: 1px 0; gap: 2px; }
  .absence-day .meal-check input { width: 12px; height: 12px; }
  .absence-day .meal-check label { font-size: 9px; }
  .absence-day .not-registered { font-size: 9px; }
  .cal-month-header { padding: 6px 2px; font-size: 11px; }

  /* Ratio box */
  .ratio-box .item { padding: 6px; }
  .ratio-box .item .v { font-size: 14px; }
  .ratio-box .item .l { font-size: 10px; }
}

/* ============== RESPONSIVE - MOBILE NHỎ (<= 480px) ============== */
@media (max-width: 480px) {
  header h1 { font-size: 16px; }
  main { padding: 10px; }
  .panel { padding: 12px; }
  nav button { padding: 10px 9px; font-size: 12px; }

  /* Stats 2x2 vẫn giữ */
  .stat-card .value { font-size: 17px; }

  /* Weekly grid nhỏ hơn */
  .weekly-grid { grid-template-columns: 60px repeat(7, minmax(70px, 1fr)); }
  .weekly-grid .head { padding: 5px 2px; font-size: 10px; }
  .weekly-grid .meal-label { padding: 6px 2px; font-size: 10px; }
  .weekly-grid .meal-cell { padding: 4px; min-height: 50px; font-size: 10px; }
  .meal-cell .meal-name { font-size: 10px; }

  /* Absence calendar nhỏ hơn */
  .absence-cal { grid-template-columns: repeat(6, 50px); }
  .absence-day { min-height: 65px; }

  /* Reg-row nhỏ hơn */
  .reg-row { grid-template-columns: 120px 45px 60px 60px 60px; min-width: 360px; }
}
