/* src/css/mobile-cloud.css – mobile: thanh trên cùng + ngăn kéo điều hướng, bảng toàn màn hình (đặt SAU cloud.css) */
.m-top, .m-bar, .m-drawer-nen, .m-bar-spacer, .m-sheet { display: none; }

/* Thanh trên cùng: ☰ · tên trang · tài khoản. Cao 48px (+ tai thỏ) */
body[data-layout="mobile"] { padding-top: calc(48px + env(safe-area-inset-top)); }
body[data-layout="mobile"] .m-bar-spacer { display: block; height: env(safe-area-inset-bottom); }
body[data-layout="mobile"] .m-top:not([hidden]) {
  display: flex; align-items: center; gap: 6px;
  position: fixed; left: 0; right: 0; top: 0; z-index: 9000;
  height: calc(48px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) calc(8px + env(safe-area-inset-right)) 0 calc(4px + env(safe-area-inset-left));
  box-sizing: border-box;
  background: var(--ui-mtop);                   /* theo theme (theme.css); luôn tối */
  border-bottom: 1px solid var(--ui-mtop-vien);
}
.m-top-btn, .m-top-acc {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: center;
  width: 44px; height: 44px; padding: 0; border: 0; border-radius: 10px;
  background: none; color: #f0cd87; cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.m-top-btn:active, .m-top-acc:active { background: rgba(255, 255, 255, .08); }
.m-top-btn svg, .m-top-acc svg { width: 24px; height: 24px; display: block; }
.m-top-ten {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font: bold 16px Arial, sans-serif; color: #f3ead6;
}
.m-top-home .m-top-ten { font: italic 700 19px 'Playfair Display', Georgia, serif; }
.m-top-av {
  display: flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 50%;
  background: linear-gradient(180deg, #f8dc9a, #d9a64c); color: #2a1a05; font: bold 14px Arial, sans-serif;
}

/* Ngăn kéo điều hướng (trượt từ trái), nền mờ phía sau */
body[data-layout="mobile"] .m-drawer-nen {
  display: block; position: fixed; inset: 0; z-index: 9400;
  background: rgba(3, 5, 18, .55); opacity: 0; pointer-events: none; transition: opacity .25s;
}
html.m-drawer-open body[data-layout="mobile"] .m-drawer-nen { opacity: 1; pointer-events: auto; }
body[data-layout="mobile"] .m-bar {
  display: flex; flex-direction: column; gap: 2px;
  position: fixed; left: 0; top: 0; bottom: 0; z-index: 9450;
  width: min(300px, 82vw); box-sizing: border-box; overflow-y: auto; overscroll-behavior: contain;
  padding: calc(10px + env(safe-area-inset-top)) 10px calc(16px + env(safe-area-inset-bottom)) calc(10px + env(safe-area-inset-left));
  background: var(--ui-mdrawer); border-right: 1px solid var(--ui-mtop-vien);
  box-shadow: 8px 0 30px rgba(0, 0, 0, .45);
  transform: translateX(-105%); visibility: hidden;
  transition: transform .25s ease, visibility 0s linear .25s;
  touch-action: pan-y;
}
html.m-drawer-open body[data-layout="mobile"] .m-bar { transform: none; visibility: visible; transition: transform .25s ease; }
html.m-drawer-open, html.m-drawer-open body { overflow: hidden; }
.m-drawer-dau { display: flex; align-items: center; height: 44px; padding: 0 10px 8px; margin-bottom: 6px; border-bottom: 1px solid rgba(240, 205, 135, .18); }
.m-drawer-logo { font: italic 700 22px 'Playfair Display', Georgia, serif; color: #f3ead6; }
.m-drawer-vach { height: 1px; margin: 8px 6px; background: rgba(240, 205, 135, .18); }
.m-bar-btn {
  display: flex; align-items: center; gap: 14px;
  min-height: 48px; padding: 0 12px; border: 0; border-radius: 10px;
  background: none; color: var(--ui-mdrawer-chu); text-align: left;
  font: bold 15px Arial, sans-serif;
  cursor: pointer; -webkit-tap-highlight-color: transparent;
}
.m-bar-btn:active { background: rgba(255, 255, 255, .08); }
.m-bar-btn.on { background: rgba(242, 200, 110, .14); color: #f2c86e; box-shadow: inset 3px 0 0 #f2c86e; }
.m-ico { position: relative; display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; flex: 0 0 auto; }
.m-ico svg { width: 22px; height: 22px; display: block; }
@media (prefers-reduced-motion: reduce) {
  body[data-layout="mobile"] .m-bar, body[data-layout="mobile"] .m-drawer-nen { transition: none; }
}
.m-dot {
  display: none; position: absolute; top: -1px; right: -7px;
  width: 9px; height: 9px; border-radius: 50%;
  background: #e67e22; border: 2px solid #fff;
}
.m-bar-btn.has-dot .m-dot { display: block; }

body[data-layout="mobile"] .m-sheet:not([hidden]) {
  display: flex; flex-direction: column;
  position: fixed; left: 0; right: 0; top: 0; height: 100%;
  z-index: 9500;
  background: var(--ui-side);
  padding-bottom: env(safe-area-inset-bottom);
  box-sizing: border-box;
}
html.m-sheet-open, html.m-sheet-open body { overflow: hidden; }
.m-sheet-head {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 8px;
  padding: calc(8px + env(safe-area-inset-top)) 10px 8px 14px;
  background: #1f4e79; color: #fff;
  font: bold 15px Arial, sans-serif;
}
.m-sheet-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-sheet-close, .m-sheet-save {
  flex: 0 0 auto; height: 34px; padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, .5); border-radius: 8px;
  background: transparent; color: #fff;
  font: bold 14px Arial, sans-serif; cursor: pointer;
}
.m-sheet-close { width: 38px; padding: 0; font-size: 16px; }
.m-sheet-body {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  padding: 10px;
  overflow: hidden;
}

/* ── Trang Lá số đã lưu (mobile): trang phủ dưới thanh trên cùng, như Trang chủ ── */
.m-trang-luu { display: none; }
body[data-layout="mobile"].m-page-cloud { overflow: hidden; }           /* không cuộn trang lá số bên dưới */
body[data-layout="mobile"].m-page-cloud .m-trang-luu {
  display: flex; flex-direction: column;
  position: fixed; left: 0; right: 0; top: calc(48px + env(safe-area-inset-top)); bottom: 0; z-index: 8900;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom)); box-sizing: border-box;
  background: var(--ui-side);
}
/* Danh sách lấp đầy chiều cao, chữ 16px để iOS không tự phóng to khi gõ */
.m-trang-luu .cloud-panel {
  flex: 1 1 auto; min-height: 0;
  display: flex; flex-direction: column;
  margin: 0; font-size: 14px;
}
.m-trang-luu #cloudList { display: flex; flex-direction: column; flex: 1 1 auto; min-height: 0; }
.m-trang-luu .cl-items { flex: 1 1 auto; max-height: none; min-height: 0; -webkit-overflow-scrolling: touch; }
.m-trang-luu .cl-row { gap: 8px; margin-top: 8px; }
.m-trang-luu .cl-row .cl-sort { max-width: 46%; }
.m-trang-luu .cl-item { padding: 9px 8px; gap: 8px; }
.m-trang-luu .cl-snip { font-size: 12px; }
.m-trang-luu .cl-del { display: none; font-size: 16px; padding: 4px 6px; }   /* chỉ hiện ở lá số đang mở, tránh chạm nhầm */
.m-trang-luu .cl-item.active .cl-del { display: inline-block; opacity: .85; }
body[data-layout="mobile"] .cl-toast-undo button { padding: 8px 14px; font-size: 14px; }
.m-trang-luu .cl-btn { padding: 10px 12px; font-size: 14px; }
/* Email + Đăng xuất: đã có ở trang Tài khoản (tai-khoan.js) */
.m-trang-luu .cl-head,
.m-trang-luu .cl-user { display: none; }

/* Note trong bảng */
#mSheetNote .m-sheet-body { padding: 0; }
#mSheetNote .note-panel {
  display: flex; flex-direction: column;
  flex: 1 1 auto; min-height: 0;
  border: 0; border-radius: 0; background: #fff;
}
#mSheetNote .note-toolbar {
  flex: 0 0 auto; flex-wrap: nowrap; overflow-x: auto;
  border-radius: 0; padding: 6px 8px; gap: 4px;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
#mSheetNote .note-toolbar::-webkit-scrollbar { display: none; }
#mSheetNote .note-toolbar button { flex: 0 0 auto; min-width: 34px; height: 34px; font-size: 15px; }
#mSheetNote .note-toolbar .note-tb-sep { flex: 0 0 1px; height: 24px; }
#mSheetNote .note-editor { font-size: 16px; padding: 12px 14px; -webkit-overflow-scrolling: touch; }
#mSheetNote .note-editor h3 { font-size: 18px; }
#mSheetNote .note-gallery { border-radius: 0; padding: 6px 10px 8px; }
#mSheetNote .ng-add { padding: 6px 12px; font-size: 13px; }
#mSheetNote .ng-item { width: 72px; height: 72px; }
#mSheetNote .ng-btn { opacity: 1; width: 24px; height: 24px; font-size: 13px; line-height: 24px; }
html.m-sheet-open .cl-toast { top: auto; bottom: calc(20px + env(safe-area-inset-bottom)); }

/* ── Trang Cấu hình / trang Chọn giờ đẹp (tab Tìm) ─────────────── */
body[data-layout="mobile"] #tabSEARCH,
body[data-layout="mobile"] #tabCFG { display: none !important; }

/* Cấu hình: bảng cấu hình ở trên, lá số đang xem ở dưới (như bản web) */
body.m-page-cfg #formAreaLaso > .tab-bar,
body.m-page-cfg #formWrap,
body.m-page-cfg #err,
body.m-page-cfg #searchPanel { display: none !important; }
body.m-page-cfg #cfgPanel { display: block !important; margin: 0 0 10px !important; border-radius: 10px; }   /* thắng style="display:none" do switchTab đặt */

/* Tab Lá số: không có hàng ◀ ▶ ☰ ★ */
body[data-layout="mobile"]:not(.m-page-search) #searchResultNav { display: none !important; }

/* Tab Tìm: chỉ khung tìm kiếm + danh sách + ◀ ▶ ☰ ★ + lá số kết quả */
body.m-page-search #formAreaLaso > .tab-bar,
body.m-page-search #formWrap,
body.m-page-search #err,
body.m-page-search #btnNoteMobile { display: none !important; }
body.m-page-search.m-search-empty #lasoWrap { display: none !important; }   /* chưa có kết quả: chưa có lá số */
body.m-page-search #searchPanel { display: block !important; }
body[data-layout="mobile"] #searchResultList {                           /* danh sách dài: cuộn trong khung */
  max-height: 45vh; overflow-y: auto; overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
}
body[data-layout="mobile"] #searchResultNav { margin: 0 0 8px; }

/* Nút 📝 Note trong hàng Xem hạn / Tương tác… */
.m-note-btn { display: none; }
body[data-layout="mobile"] .m-note-btn {
  display: inline-flex; align-items: center; gap: 4px; position: relative;
  padding: 4px 10px; border: 1px solid #1f4e79; border-radius: 6px;
  background: #fff; color: #1f4e79; font: bold 12px Arial, sans-serif; cursor: pointer;
}
.m-note-btn:disabled { opacity: .4; cursor: default; }
.m-note-btn .m-dot { top: -4px; right: -4px; }
.m-note-btn.has-dot .m-dot { display: block; }
.m-note-btn .nt-ico { width: 14px; height: 14px; }

/* ── Note thu nhỏ: cửa sổ nổi phía dưới (mobile-cloud.js) ──────── */
.m-sheet-mini {
  flex: 0 0 auto; width: 38px; height: 34px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid rgba(255, 255, 255, .5); border-radius: 8px;
  background: transparent; color: #fff; cursor: pointer;
}
.m-sheet-mini svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.m-sheet-mini .i-phong, #mSheetNote.m-mini .m-sheet-mini .i-thu { display: none; }
#mSheetNote.m-mini .m-sheet-mini .i-phong { display: block; }
.m-mini-grip, .m-note-tab { display: none; }

body[data-layout="mobile"] #mSheetNote.m-mini:not([hidden]) {
  left: 6px; right: 6px; bottom: auto;                 /* top/height do JS đặt */
  z-index: 8900;                                       /* dưới các bảng toàn màn hình */
  padding-bottom: 0;
  border-radius: 12px; overflow: hidden;
  background: #fff;
  box-shadow: 0 -2px 18px rgba(7, 10, 34, .35), 0 0 0 1px rgba(7, 10, 34, .15);
  transition: opacity .15s, transform .15s;
}
#mSheetNote.m-mini.m-mini-drag { transition: none; }
#mSheetNote.m-mini .m-mini-grip {
  display: block; flex: 0 0 14px; position: relative;
  background: #1f4e79; touch-action: none; cursor: ns-resize;
}
#mSheetNote.m-mini .m-mini-grip::after {
  content: ''; position: absolute; left: 50%; top: 5px; width: 40px; height: 4px;
  margin-left: -20px; border-radius: 2px; background: rgba(255, 255, 255, .55);
}
#mSheetNote.m-mini .m-sheet-head {
  padding: 2px 6px 6px 12px; font-size: 13px; gap: 6px;
  touch-action: none; cursor: grab; user-select: none;
}
#mSheetNote.m-mini .m-sheet-head button { height: 30px; }
#mSheetNote.m-mini .m-sheet-save { padding: 0 8px; font-size: 13px; }
#mSheetNote.m-mini .m-sheet-close, #mSheetNote.m-mini .m-sheet-mini { width: 32px; }
#mSheetNote.m-mini .note-toolbar,
#mSheetNote.m-mini .note-gallery { display: none; }
#mSheetNote.m-mini .note-editor { padding: 8px 12px; }
/* Ảnh trong note: ẩn ảnh, chỉ để khung chữ "Ảnh" đánh dấu chỗ có ảnh */
#mSheetNote.m-mini .note-editor img.note-img {
  display: inline-block; width: 58px; height: 20px; margin: 2px 0;
  object-position: -9999px 0;
  border: 1px dashed #c8b88a; border-radius: 4px;
  background: #fbf8f0 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='50' height='14'%3E%3Crect x='1' y='2' width='13' height='10' rx='2' fill='none' stroke='%239a8a66'/%3E%3Cpath d='M2 11l4-4 3 3 2-2 3 3' fill='none' stroke='%239a8a66'/%3E%3Ctext x='18' y='11' font-family='Arial' font-size='11' fill='%239a8a66'%3E%E1%BA%A2nh%3C/text%3E%3C/svg%3E") center no-repeat;
}
/* Chừa chỗ ở cuối trang để cuộn được cả hàng cung cuối lên trên cửa sổ */
html.m-note-mini-on body[data-layout="mobile"] .m-bar-spacer {
  height: calc(env(safe-area-inset-bottom) + var(--m-note-pad, 0px) + 12px);
}
/* Nút mũi tên bám mép khi cửa sổ đã vuốt sang bên */
body[data-layout="mobile"] .m-note-tab:not([hidden]) {
  display: flex; align-items: center; justify-content: center;
  position: fixed; z-index: 8900; width: 30px; height: 44px; padding: 0;
  border: 0; background: #1f4e79; color: #fff;
  box-shadow: 0 2px 10px rgba(7, 10, 34, .35); cursor: pointer;
}
.m-note-tab[data-side="right"] { right: 0; border-radius: 10px 0 0 10px; }
.m-note-tab[data-side="left"]  { left: 0;  border-radius: 0 10px 10px 0; }
.m-note-tab[data-side="left"] svg { transform: scaleX(-1); }
.m-note-tab svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }