/*
 * Khung "app" cho cụm Cư dân: thanh trên cố định, thanh tab dưới, lưới dịch vụ.
 * CSS thường (không Tailwind), tiền tố kcc-, dùng chung cho layout main_ticket (Tailwind)
 * và main (Bootstrap 3) mà không xung đột class.
 * AA: chữ thường >= 4.5:1 (#5F6B7A / #9A4A06 trên trắng), vùng bấm >= 44px.
 */
/* Cả app nằm trong 1 cột điện thoại 430px ở giữa màn hình (như thecoffeehouse.com) */
html:has(body.kcc-app) { background: #fff; }
body.kcc-app {
  font-family: var(--app-font) !important;
  background-color: var(--app-bg) !important;
  --kcc-tab-h: 60px;
  --kcc-col: 430px;
  width: 100%;
  max-width: var(--kcc-col);
  min-height: 100vh;
  margin-left: auto !important;
  margin-right: auto !important;
  position: relative;
  box-shadow: 0 0 0 1px #E5E7EB;
  padding-bottom: calc(var(--kcc-tab-h) + env(safe-area-inset-bottom, 0px));
}

/* Thanh trên */
.kcc-appbar,
.kcc-tabbar { letter-spacing: 0; }
.kcc-appbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #fff;
  border-bottom: 1px solid #E5E7EB;
  padding-top: env(safe-area-inset-top, 0px);
}
.kcc-appbar__in {
  max-width: 560px;
  margin: 0 auto;
  height: 52px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.kcc-appbar__dot {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  background: #F79320;
}
.kcc-appbar__title {
  margin: 0;
  font: 700 16px/1 var(--app-font);
  color: var(--app-text);
}

/* Thanh tab dưới */
.kcc-tabbar {
  position: fixed;
  left: 50%;
  width: 100%;
  max-width: var(--kcc-col, 430px);
  transform: translateX(-50%);
  bottom: 0;
  z-index: 50;
  background: #fff;
  border-top: 1px solid #E5E7EB;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.kcc-tabbar__in {
  max-width: 560px;
  margin: 0 auto;
  display: flex;
}
.kcc-tab {
  flex: 1;
  min-height: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font: 600 12px/1.2 var(--app-font);
  color: #5F6B7A;
  text-decoration: none;
}
.kcc-tab:hover,
.kcc-tab:focus { color: var(--app-text); text-decoration: none; }
.kcc-tab.is-active { color: #9A4A06; }
.kcc-tab svg { width: 22px; height: 22px; }
.kcc-tab:focus-visible {
  outline: 3px solid rgba(247, 147, 32, .55);
  outline-offset: -3px;
}

/* Trang chủ: lời chào + lưới dịch vụ */
.kcc-home {
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 8px;
}
.kcc-home__title {
  margin: 0 0 4px;
  font: 800 22px/1.25 var(--app-font);
  color: var(--app-text);
}
.kcc-home__sub {
  margin: 0 0 16px;
  font-size: 14px;
  color: #4B5563;
}
.kcc-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.kcc-tile:last-child:nth-child(odd) { grid-column: 1 / -1; }
.kcc-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  min-height: 116px;
  padding: 16px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: var(--app-radius-md);
  box-shadow: 0 1px 3px rgba(17, 24, 39, .06);
  color: var(--app-text);
  font: 600 15px/1.3 var(--app-font);
  text-decoration: none;
}
.kcc-tile:hover,
.kcc-tile:focus { color: var(--app-text); text-decoration: none; border-color: #F79320; }
.kcc-tile:active { transform: scale(.98); }
.kcc-tile:focus-visible {
  outline: 3px solid rgba(247, 147, 32, .55);
  outline-offset: 2px;
}
.kcc-tile__ic {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: #FFF1E0;
  color: #9A4A06;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kcc-tile__ic svg { width: 24px; height: 24px; }
.kcc-tile__hint {
  display: block;
  margin-top: 2px;
  font-weight: 400;
  font-size: 13px;
  color: #5F6B7A;
}

/* Lịch sử yêu cầu: mỗi yêu cầu là một thẻ bấm được */
.kcc-hist { display: flex; flex-direction: column; gap: 10px; }
.kcc-hist__item {
  gap: 10px;
  padding: 12px;
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(17, 24, 39, .06);
  cursor: pointer;
}
.kcc-hist__item:hover { border-color: #F79320; }
.kcc-hist__item:active { transform: scale(.99); }
/* Chip trạng thái: nền đủ đậm để chữ trắng đạt AA (>= 4.5:1) */
.kcc-hist__badge.bg-rose-500 { background-color: #BE123C; }
.kcc-hist__badge.bg-sky-500 { background-color: #0369A1; }
.kcc-hist__badge.bg-amber-500 { background-color: #B45309; }
.kcc-hist__badge.bg-slate-400 { background-color: #475569; }
.kcc-hist__badge.bg-cyan-500 { background-color: #0E7490; }
.kcc-hist__badge.bg-emerald-500 { background-color: #047857; }

/* Thang cỡ chữ thống nhất cho mọi trang cư dân: tiêu đề trang 20px, mục 17/16/15px */
body.kcc-app h1 {
  font-size: 20px !important;
  line-height: 1.3 !important;
  font-weight: 800 !important;
  letter-spacing: 0 !important;
  margin: 0 0 8px !important;
  padding: 0 !important;
}
body.kcc-app h1 strong { font-weight: 800; }
body.kcc-app h2 { font-size: 17px !important; line-height: 1.3 !important; font-weight: 700 !important; margin: 0 0 8px !important; letter-spacing: 0 !important; }
body.kcc-app h3 { font-size: 16px !important; line-height: 1.3 !important; font-weight: 700 !important; margin: 0 0 8px !important; letter-spacing: 0 !important; }
body.kcc-app h4 { font-size: 15px !important; line-height: 1.3 !important; font-weight: 700 !important; margin: 0 0 8px !important; letter-spacing: 0 !important; }
/* Trang Tailwind: bớt khoảng trống dọc quanh tiêu đề */
body.kcc-app main { padding-top: 16px !important; padding-bottom: 16px !important; }
body.kcc-app div:has(> h1.text-brand) { margin: 0 0 12px !important; }
.kcc-home { padding-top: 16px; }
.kcc-home__title { font-size: 20px !important; }
body.kcc-app h5,
body.kcc-app h6 { font-size: 14px !important; line-height: 1.4 !important; font-weight: 700 !important; margin: 0 0 6px !important; letter-spacing: 0 !important; }
body.kcc-app h1, body.kcc-app h2, body.kcc-app h3, body.kcc-app h4, body.kcc-app h5, body.kcc-app h6 { text-indent: 0 !important; }
body.kcc-app h4 i, body.kcc-app h4 em { font-style: normal; }

/* assets/style.css đặt padding 20px trên/dưới cho h2-h6: bỏ để tiêu đề không chừa khoảng trống thừa */
body.kcc-app h2, body.kcc-app h3, body.kcc-app h4, body.kcc-app h5, body.kcc-app h6 { padding: 0 !important; }

/* Khối nội dung của ticket/create (class frest-card trước đây chưa có CSS nên trông trần trụi) */
.frest-card {
  background: #fff;
  border: 1px solid #E5E7EB;
  border-radius: var(--app-radius-md);
  box-shadow: 0 1px 3px rgba(17, 24, 39, .06);
}
.frest-card .kcc-hist__item { background: #F9FAFB; box-shadow: none; }
/* Ô nhập trong thẻ trắng: cần viền để không chìm vào nền thẻ */
.frest-card input[type="text"] { border: 1px solid #D1D5DB; }

/* Trang Tailwind (main_ticket): nút/thành phần nền cam -> cam đậm + chữ/icon trắng (AA) */
body.kcc-app .bg-brand,
body.kcc-app .bg-brand .text-white,
body.kcc-app .bg-brand svg { background-color: var(--app-cta); color: var(--app-on-cta) !important; }
body.kcc-app .bg-brand svg { background-color: transparent; }
body.kcc-app .bg-brand:hover,
body.kcc-app .hover\:bg-brand-hover:hover { background-color: var(--app-cta-hover) !important; color: var(--app-on-cta) !important; }
