/* ==========================================
   1. GOOGLE FONTS IMPORT
   ========================================== */
@import url('https://fonts.googleapis.com/css2?family=Be+Vietnam+Pro:wght@300;400;500;600;700;800&display=swap');

/* ==========================================
   2. CSS RESET & GLOBAL STYLES
   ========================================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ==========================================
   3. DESIGN SYSTEM VARIABLES — LIGHT THEME (DEFAULT)
   Mở khoá zone (MASTER.md §4) theo lệnh lãnh đạo 20/05/2026:
   ưu tiên theme sáng làm mặc định, dark vẫn giữ qua [data-theme="dark"].
   Đảm bảo contrast WCAG AA cho cả 2 theme.
   ========================================== */
:root {
  /* Light theme — palette mặc định */
  --primary: #0F5132;          /* xanh rêu đậm — nổi bật trên nền trắng */
  --primary-light: #198754;    /* xanh tươi cho hover/active */
  --primary-soft: #D1E7DD;     /* xanh nhạt cho background highlight */
  --accent: #B8860B;           /* vàng đậm dark goldenrod — nổi bật */
  --accent-soft: #FFF3CD;      /* vàng kem cho background */
  --bg-body: #F4F6F4;          /* xám trắng dịu mắt */
  --bg-card: #FFFFFF;          /* trắng cho card nổi */
  --bg-sidebar: #FFFFFF;       /* sidebar trắng + border */
  --bg-elevated: #FAFBFA;      /* nền hover nhẹ */
  --text-main: #1A2E22;        /* đen xanh đậm — đọc rõ */
  --text-muted: #5A6B62;       /* xám tối — đủ contrast */
  --text-on-primary: #FFFFFF;  /* chữ trên nút primary */
  --border: #D8E0DA;           /* viền nhẹ */
  --border-strong: #B8C5BC;    /* viền rõ cho input */
  --success: #16A34A;
  --warning: #D97706;
  --danger:  #DC2626;
  --info:    #2563EB;
  --shadow: 0 2px 8px rgba(15,81,50,0.08);
  --shadow-lg: 0 8px 24px rgba(15,81,50,0.12);
  --radius: 12px;
  --radius-sm: 6px;
}

/* Dark theme — kích hoạt qua <html data-theme="dark"> */
[data-theme="dark"] {
  --primary: #2EA968;
  --primary-light: #4DD08A;
  --primary-soft: rgba(46,169,104,0.18);
  --accent: #E5B636;
  --accent-soft: rgba(229,182,54,0.15);
  --bg-body: #0F1A14;
  --bg-card: #162318;
  --bg-sidebar: #111D15;
  --bg-elevated: #1B2E20;
  --text-main: #E8F0EA;
  --text-muted: #9AB5A1;
  --text-on-primary: #0F1A14;
  --border: #243B2A;
  --border-strong: #355A3F;
  --success: #4ADE80;
  --warning: #FBBF24;
  --danger:  #F87171;
  --info:    #60A5FA;
  --shadow: 0 4px 20px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 30px rgba(0,0,0,0.55);
}

/* ==========================================
   4. BODY CONFIGURATION
   ========================================== */
body {
  background-color: var(--bg-body);
  font-family: 'Be Vietnam Pro', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--text-main);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color 0.25s ease, color 0.25s ease;
}
.kpi-card, .chart-card, .data-table, .stat-box, .filter-bar, .info-card,
.modal-box, .login-card, .sidebar-nav a, .form-group input, .form-group select {
  transition: background-color 0.25s ease, color 0.25s ease, border-color 0.25s ease;
}

/* ==========================================
   5. APP GRID LAYOUT
   ========================================== */
#app {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* ==========================================
   6. SIDEBAR LAYOUT
   ========================================== */
#sidebar {
  background-color: var(--bg-sidebar);
  padding: 24px 0;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
}

/* ==========================================
   7. MAIN CONTENT AREA
   ========================================== */
#main-content {
  padding: 24px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

/* ==========================================
   8. TOP BAR LAYOUT
   ========================================== */
#topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
}

/* ==========================================
   9. COMPONENTS: KPI CARD, CHART CARD, TABLE, BADGES & BUTTONS
   ========================================== */
/* KPI Card */
.kpi-card { background: var(--bg-card); border-radius: var(--radius); padding: 20px;
            box-shadow: var(--shadow); border: 1px solid var(--border); }
.kpi-card.green  { border-left: 4px solid var(--success); }
.kpi-card.yellow { border-left: 4px solid var(--accent); }
.kpi-card.red    { border-left: 4px solid var(--danger); }
.kpi-value { font-size: 2rem; font-weight: 700; color: var(--text-main); }
.progress-bar { height: 6px; background: var(--border); border-radius: 3px; margin-top: 8px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }

/* Grid KPI: 5 cột */
.kpi-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 16px; margin-bottom: 24px; }

/* Chart Card */
.chart-card { background: var(--bg-card); border-radius: var(--radius); padding: 20px;
              box-shadow: var(--shadow); border: 1px solid var(--border); }
.chart-card h3 { color: var(--text-main); font-size: 1rem; margin-bottom: 12px; font-weight: 600; }
.charts-row { display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 16px; margin-bottom: 24px; }

/* Table */
.data-table { width: 100%; border-collapse: collapse; background: var(--bg-card);
              border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.data-table th { background: var(--bg-elevated); color: var(--text-muted); font-weight: 600;
                 padding: 12px 16px; text-align: left; border-bottom: 2px solid var(--border); }
.data-table td { padding: 12px 16px; border-bottom: 1px solid var(--border); color: var(--text-main); }
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--primary-soft); }

/* Badge */
.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.8rem; font-weight: 600; }
.badge-green  { background: color-mix(in srgb, var(--success) 18%, transparent); color: var(--success); }
.badge-yellow { background: color-mix(in srgb, var(--accent)  18%, transparent); color: var(--accent); }
.badge-red    { background: color-mix(in srgb, var(--danger)  18%, transparent); color: var(--danger); }
.badge-blue   { background: color-mix(in srgb, var(--info)    18%, transparent); color: var(--info); }

/* Button */
.btn { padding: 8px 18px; border-radius: var(--radius-sm); border: none; cursor: pointer;
       font-size: 0.9rem; font-family: inherit; font-weight: 600; transition: all 0.15s; }
.btn-primary { background: var(--primary); color: var(--text-on-primary); }
.btn-primary:hover { background: var(--primary-light); }
.btn-sm { padding: 4px 12px; font-size: 0.8rem; }
.btn-danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.btn-danger:hover { background: color-mix(in srgb, var(--danger) 22%, transparent); }

/* ==========================================
   10. LAYOUT COMPONENTS: SIDEBAR, FILTER BAR, STATS ROW, MODAL, TABS, LOGIN, PAGE VISIBILITY & RESPONSIVE
   ========================================== */
/* Sidebar */
.sidebar-logo { font-size: 1.3rem; font-weight: 700; color: var(--primary);
                padding: 20px; border-bottom: 1px solid var(--border); }
.sidebar-nav a { display: flex; align-items: center; gap: 10px; padding: 12px 20px;
                 color: var(--text-muted); text-decoration: none; transition: all 0.2s; cursor: pointer;
                 border-left: 3px solid transparent; font-size: 0.92rem; }
.sidebar-nav a:hover,
.sidebar-nav a.active { background: var(--primary-soft); color: var(--primary);
                         border-left: 3px solid var(--primary); font-weight: 600; }
.sidebar-hotline { padding: 20px; font-size: 0.85rem; color: var(--text-muted);
                   border-top: 1px solid var(--border); margin-top: auto; }

/* Filter Bar */
.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; flex-wrap: wrap;
              background: var(--bg-card); padding: 12px 16px; border-radius: var(--radius);
              border: 1px solid var(--border); box-shadow: var(--shadow); }
.filter-bar select { background: var(--bg-elevated); border: 1px solid var(--border-strong);
                     color: var(--text-main); padding: 8px 14px; border-radius: var(--radius-sm);
                     font-family: inherit; cursor: pointer; font-size: 0.9rem; }
.filter-bar label { color: var(--text-muted); font-size: 0.9rem; font-weight: 500; }

/* Stats Row */
.stats-row { display: flex; gap: 16px; margin-bottom: 20px; }
.stat-box { background: var(--bg-card); border-radius: var(--radius); padding: 16px 20px;
            text-align: center; flex: 1; border: 1px solid var(--border); box-shadow: var(--shadow);
            min-width: 120px; }
.stat-box .stat-num { font-size: 1.6rem; font-weight: 700; color: var(--primary); }
.stat-box .stat-label { font-size: 0.8rem; color: var(--text-muted); margin-top: 4px; font-weight: 500; }

/* Modal */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.55);
                 z-index: 100; justify-content: center; align-items: center; padding: 16px; }
.modal-overlay.open { display: flex; }
.modal-box { background: var(--bg-card); border-radius: var(--radius); padding: 28px;
             width: 480px; max-width: 100%; border: 1px solid var(--border);
             box-shadow: var(--shadow-lg); }
.modal-box h3 { margin-bottom: 20px; color: var(--primary); font-weight: 700; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; color: var(--text-muted); font-size: 0.85rem; margin-bottom: 6px; font-weight: 500; }
.form-group input,
.form-group select { width: 100%; background: var(--bg-elevated); border: 1px solid var(--border-strong);
                     color: var(--text-main); padding: 10px 14px; border-radius: var(--radius-sm);
                     font-family: inherit; box-sizing: border-box; font-size: 0.95rem; }
.form-group input:focus,
.form-group select:focus { outline: none; border-color: var(--primary); }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 20px; }

/* Tabs */
.tab-bar { display: flex; gap: 4px; margin-bottom: 20px; border-bottom: 2px solid var(--border);
           overflow-x: auto; }
.tab-btn { padding: 10px 20px; background: none; border: none; color: var(--text-muted);
           cursor: pointer; font-family: inherit; border-bottom: 3px solid transparent;
           font-size: 0.92rem; font-weight: 500; white-space: nowrap; }
.tab-btn:hover { color: var(--text-main); }
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 700; }

/* Login Page */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center;
              background: var(--bg-body); padding: 16px; }
.login-card { background: var(--bg-card); border-radius: var(--radius); padding: 40px 32px;
              width: 380px; max-width: 100%; text-align: center; border: 1px solid var(--border);
              box-shadow: var(--shadow-lg); }
.login-card h1 { color: var(--primary); font-size: 1.5rem; margin-bottom: 8px; font-weight: 700; }
.login-card .subtitle { color: var(--text-muted); font-size: 0.9rem; margin-bottom: 28px; }
.login-hint { margin-top: 16px; font-size: 0.8rem; color: var(--text-muted); }

/* Login auto-buttons (T10) */
.login-btn-large { display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 18px;
                   border-radius: var(--radius); border: 2px solid var(--border-strong);
                   background: var(--bg-elevated); color: var(--text-main); cursor: pointer;
                   font-family: inherit; font-size: 0.95rem; font-weight: 600; text-align: left;
                   margin-bottom: 12px; transition: all 0.15s; }
.login-btn-large:hover { border-color: var(--primary); background: var(--primary-soft); }
.login-btn-large.primary { background: var(--primary); color: var(--text-on-primary); border-color: var(--primary); }
.login-btn-large.primary:hover { background: var(--primary-light); border-color: var(--primary-light); }
.login-btn-large .icon { font-size: 1.6rem; }
.login-btn-large .meta { display: flex; flex-direction: column; gap: 2px; }
.login-btn-large .meta-title { font-size: 0.95rem; font-weight: 700; }
.login-btn-large .meta-sub   { font-size: 0.78rem; opacity: 0.85; font-weight: 400; }

/* Page visibility */
.page { display: none; }
.page.active { display: block; }

/* Animations */
@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
.page.active { animation: fadeIn 0.3s ease; }

/* ==========================================
   13. BOTTOM NAV + MOBILE DRAWER (T11) — like-app
   ========================================== */
.bottom-nav {
  display: none; /* desktop ẩn */
  position: fixed; left: 0; right: 0; bottom: 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  z-index: 90;
  padding: 6px 4px;
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 2px; padding: 6px 2px; color: var(--text-muted); cursor: pointer;
  text-decoration: none; border-radius: var(--radius-sm);
  font-size: 0.7rem; font-weight: 600; min-height: 52px;
  transition: all 0.15s;
}
.bottom-nav a .bn-icon  { font-size: 1.25rem; line-height: 1; }
.bottom-nav a .bn-label { font-size: 0.7rem; }
.bottom-nav a:hover,
.bottom-nav a.active { color: var(--primary); background: var(--primary-soft); }

.mobile-drawer-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45);
  z-index: 95; align-items: flex-end; justify-content: center;
}
.mobile-drawer-overlay.open { display: flex; }
.mobile-drawer {
  width: 100%; max-width: 480px;
  background: var(--bg-card); border-top-left-radius: 16px; border-top-right-radius: 16px;
  padding: 20px 16px 80px; max-height: 80vh; overflow-y: auto;
  border-top: 4px solid var(--primary);
}
.drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  color: var(--primary); font-weight: 700; font-size: 1.05rem;
  padding-bottom: 12px; margin-bottom: 12px; border-bottom: 1px solid var(--border);
}
.drawer-item {
  display: block; padding: 14px 16px; color: var(--text-main);
  text-decoration: none; cursor: pointer; border-radius: var(--radius-sm);
  font-size: 0.96rem; font-weight: 500; margin-bottom: 4px;
}
.drawer-item:hover,
.drawer-item.active { background: var(--primary-soft); color: var(--primary); font-weight: 700; }
.drawer-footer { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }

/* ==========================================
   14. RESPONSIVE — MOBILE FIRST (≤768px)
   ========================================== */
@media (max-width: 768px) {
  body { font-size: 15px; }
  #app { grid-template-columns: 1fr; }
  #sidebar { display: none; }
  #main-content { padding: 12px 12px 80px; } /* padding-bottom tránh che bởi bottom-nav */
  #topbar { gap: 8px; }
  #topbar h1 { font-size: 1.1rem; flex: 1; }
  .hamburger { display: inline-flex; }
  .btn-icon { padding: 6px 10px; font-size: 0.8rem; }

  .bottom-nav { display: flex; }

  .kpi-grid { grid-template-columns: 1fr; gap: 12px; }
  .kpi-card { padding: 16px; }
  .kpi-value { font-size: 1.8rem; }
  .charts-row { grid-template-columns: 1fr; gap: 12px; }
  .chart-card { padding: 14px; }
  .stats-row { flex-direction: column; gap: 8px; }
  .stat-box { padding: 12px 16px; }
  .stat-box .stat-num { font-size: 1.4rem; }
  .card-grid { grid-template-columns: 1fr; gap: 12px; }
  .action-bar { flex-direction: column; align-items: stretch; gap: 8px; }
  .action-bar .btn { width: 100%; }
  .filter-bar { gap: 8px; padding: 10px 12px; }
  .filter-bar select { flex: 1; min-width: 0; }
  .tab-bar { font-size: 0.85rem; }
  .tab-btn { padding: 8px 14px; }
  .demo-footer { font-size: 0.72rem; padding: 12px 14px; }
  .modal-box { padding: 20px 16px; width: 100%; }

  /* TABLE → CARD STACK (T12) — không kéo trái/phải trên điện thoại */
  .data-table { display: block; border-radius: 0; box-shadow: none; background: transparent; }
  .data-table thead { display: none; }
  .data-table tbody { display: block; }
  .data-table tr {
    display: block; margin-bottom: 12px;
    background: var(--bg-card); border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: var(--radius); padding: 12px 14px;
    box-shadow: var(--shadow);
  }
  .data-table tr:hover td { background: transparent; }
  .data-table td {
    display: flex; justify-content: space-between; align-items: flex-start;
    gap: 10px; padding: 6px 0; border-bottom: 1px dashed var(--border);
    font-size: 0.92rem; text-align: right;
  }
  .data-table td:last-child { border-bottom: none; }
  .data-table td::before {
    content: attr(data-label);
    font-weight: 600; color: var(--text-muted);
    font-size: 0.82rem; text-align: left;
    flex-shrink: 0; min-width: 38%;
  }
  .data-table td:empty::before,
  .data-table td:not([data-label])::before { content: ''; min-width: 0; }
}

/* ==========================================
   11. v2.0 — DEMO LABELING (tối thiểu) + HELPER CLASSES
   ========================================== */

/* DEMO footer — chân trang phòng vệ pháp lý PDPL (theme-aware) */
.demo-footer {
  margin-top: 32px;
  padding: 14px 20px;
  background: color-mix(in srgb, var(--warning) 10%, transparent);
  border-top: 1px solid color-mix(in srgb, var(--warning) 35%, transparent);
  color: var(--warning);
  font-size: 0.78rem;
  text-align: center;
  letter-spacing: 0.3px;
  font-weight: 500;
}
.demo-footer strong { color: var(--warning); font-weight: 700; }

/* DEMO inline warning — bắt buộc trên modal nhập dữ liệu cá nhân */
.demo-warning-inline {
  background: color-mix(in srgb, var(--warning) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--warning) 40%, transparent);
  border-left: 4px solid var(--warning);
  color: var(--warning);
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  margin-bottom: 16px;
  line-height: 1.5;
  font-weight: 500;
}
.demo-warning-inline strong { color: var(--warning); font-weight: 700; }

/* Empty state — khi bảng/danh sách trống */
.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-muted);
  background: var(--bg-card);
  border-radius: var(--radius);
  border: 1px dashed var(--border);
}
.empty-state .empty-icon { font-size: 2rem; margin-bottom: 10px; opacity: 0.5; }
.empty-state .empty-title { font-size: 1rem; margin-bottom: 4px; color: var(--text-main); }
.empty-state .empty-sub { font-size: 0.85rem; }

/* Action bar — chứa nút "+ Thêm mới" + meta */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.action-bar .action-title { font-size: 1rem; color: var(--text-main); font-weight: 600; }
.action-bar .action-meta { color: var(--text-muted); font-size: 0.82rem; }

/* Card grid — cho module Trainings / Investments */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.info-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 18px;
  border: 1px solid var(--border);
}
.info-card .info-card-title { font-size: 1rem; font-weight: 700; color: var(--primary); margin-bottom: 8px; }
.info-card .info-card-row { display: flex; justify-content: space-between; padding: 6px 0; font-size: 0.85rem; }
.info-card .info-card-row .label { color: var(--text-muted); }
.info-card .info-card-row .value { color: var(--text-main); font-weight: 500; }

/* Table meta footer */
.table-meta { color: var(--text-muted); font-size: 0.8rem; padding: 10px 4px 0; }

/* Button outline variant */
.btn-outline { background: transparent; color: var(--primary); border: 1px solid var(--primary); }
.btn-outline:hover { background: var(--primary-soft); }

/* Status row stats badge variations */
.stat-box.accent .stat-num { color: var(--accent); }
.stat-box.danger .stat-num { color: var(--danger); }

@media (max-width: 768px) {
  .card-grid { grid-template-columns: 1fr; }
  .action-bar { flex-direction: column; align-items: stretch; }
}

/* ==========================================
   11.5 TOPBAR ACTIONS — theme toggle + hamburger (T9, T11)
   ========================================== */
#topbar { gap: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.btn-icon {
  padding: 8px 14px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong);
  background: var(--bg-card); color: var(--text-main); cursor: pointer; font-family: inherit;
  font-size: 0.88rem; font-weight: 600; transition: all 0.15s;
}
.btn-icon:hover { background: var(--primary-soft); border-color: var(--primary); color: var(--primary); }

.hamburger {
  display: none; /* desktop ẩn */
  background: var(--bg-card); border: 1px solid var(--border-strong);
  color: var(--text-main); width: 42px; height: 42px; border-radius: var(--radius-sm);
  font-size: 1.3rem; cursor: pointer; align-items: center; justify-content: center;
}

/* ==========================================
   12. CHART CONTAINER — FIX BUG INFINITE GROW (T7.1)
   ========================================== */
.chart-container {
  position: relative;
  width: 100%;
  height: 260px;
}
.chart-container canvas {
  max-height: 100%;
  width: 100% !important;
  height: 100% !important;
}
@media (max-width: 768px) {
  .chart-container { height: 220px; }
}

/* ==========================================
   15. DETAIL MODAL — F2 VIEWS (T14.1)
   ========================================== */
.detail-modal-overlay {
  display: none; position: fixed; inset: 0;
  background: rgba(0,0,0,0.55);
  z-index: 200;
  align-items: center; justify-content: center;
  padding: 24px;
  animation: fadeIn 0.2s ease;
}
.detail-modal-overlay.open { display: flex; }

.detail-modal {
  width: 100%; max-width: 1080px;
  height: 90vh; max-height: 90vh;
  background: var(--bg-body);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  display: flex; flex-direction: column;
  overflow: hidden;
  animation: slideUp 0.25s ease;
}
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

.detail-modal-header {
  display: flex; align-items: center; gap: 12px;
  padding: 16px 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.detail-modal-header .dm-icon  { font-size: 1.8rem; }
.detail-modal-header .dm-meta  { flex: 1; min-width: 0; }
.detail-modal-header .dm-title {
  font-size: 1.15rem; font-weight: 700; color: var(--text-main);
  margin: 0 0 2px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.detail-modal-header .dm-sub   { font-size: 0.82rem; color: var(--text-muted); }
.detail-modal-close {
  width: 40px; height: 40px;
  border: 1px solid var(--border-strong);
  background: var(--bg-elevated);
  color: var(--text-main);
  border-radius: var(--radius-sm);
  font-size: 1.2rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.15s;
}
.detail-modal-close:hover { background: var(--danger); color: white; border-color: var(--danger); }

.detail-modal-body {
  flex: 1; overflow-y: auto;
  padding: 0; background: var(--bg-body);
}

.detail-tabs {
  display: flex; gap: 0; background: var(--bg-card);
  border-bottom: 2px solid var(--border);
  padding: 0 24px; overflow-x: auto;
  position: sticky; top: 0; z-index: 5;
}
.detail-tabs .tab-btn { padding: 14px 18px; font-size: 0.92rem; }

.detail-content { padding: 24px; }

.detail-section {
  background: var(--bg-card);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}
.detail-section h4 {
  font-size: 1.02rem; color: var(--primary);
  margin: 0 0 14px 0; font-weight: 700;
  padding-bottom: 10px; border-bottom: 2px solid var(--primary-soft);
}

.info-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px 22px;
}
.info-row {
  display: flex; flex-direction: column; gap: 3px;
}
.info-row .info-label {
  font-size: 0.78rem; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: 0.4px; font-weight: 600;
}
.info-row .info-value {
  font-size: 0.96rem; color: var(--text-main); font-weight: 500;
  word-break: break-word;
}
.info-row .info-value.lg { font-size: 1.2rem; font-weight: 700; color: var(--primary); }

.benefit-item {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 14px; background: var(--bg-elevated);
  border-radius: var(--radius-sm); margin-bottom: 8px;
  border-left: 4px solid var(--border);
}
.benefit-item.used { border-left-color: var(--success); }
.benefit-item.used .b-check { color: var(--success); }
.benefit-item .b-check { font-size: 1.4rem; color: var(--text-muted); flex-shrink: 0; }
.benefit-item .b-text { flex: 1; color: var(--text-main); font-size: 0.92rem; }
.benefit-item .b-date { font-size: 0.78rem; color: var(--text-muted); }

.timeline { position: relative; padding-left: 22px; }
.timeline::before {
  content: ''; position: absolute; left: 6px; top: 8px; bottom: 8px;
  width: 2px; background: var(--primary-soft);
}
.timeline-item {
  position: relative; padding: 6px 0 14px;
}
.timeline-item::before {
  content: ''; position: absolute; left: -19px; top: 10px;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); border: 2px solid var(--bg-card);
}
.timeline-item .tl-date { font-size: 0.78rem; color: var(--text-muted); font-weight: 600; }
.timeline-item .tl-text { font-size: 0.92rem; color: var(--text-main); margin-top: 2px; }

.mini-list { list-style: none; padding: 0; margin: 0; }
.mini-list li {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 12px; border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}
.mini-list li:last-child { border-bottom: none; }
.mini-list li .ml-label { color: var(--text-main); }
.mini-list li .ml-value { color: var(--text-muted); font-weight: 600; }

.detail-modal-footer {
  padding: 14px 24px;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  flex-shrink: 0;
}

.clickable-row { cursor: pointer; }
.clickable-row:hover td { background: var(--primary-soft) !important; }
.clickable-row:active { background: var(--primary-soft); transform: scale(0.998); }
.info-card.clickable-row:hover { border-color: var(--primary); box-shadow: var(--shadow-lg); }
.info-card.clickable-row:active { transform: scale(0.99); }
.click-hint {
  font-size: 0.78rem; color: var(--text-muted); margin-bottom: 8px;
  font-style: italic;
}

/* Mobile detail-modal full-screen */
@media (max-width: 768px) {
  .detail-modal-overlay { padding: 0; align-items: stretch; }
  .detail-modal {
    width: 100%; height: 100vh; max-height: 100vh;
    border-radius: 0; border: none;
    padding-top: env(safe-area-inset-top, 0);
    padding-bottom: env(safe-area-inset-bottom, 0);
  }
  .detail-modal-header { padding: 12px 14px; position: sticky; top: 0; z-index: 10; }
  .detail-modal-header .dm-title { font-size: 1rem; }
  .detail-modal-header .dm-sub   { font-size: 0.76rem; }
  .detail-modal-close { width: 44px; height: 44px; font-size: 1.3rem; }
  .detail-tabs { padding: 0 4px; }
  .detail-tabs .tab-btn { padding: 12px 14px; font-size: 0.85rem; }
  .detail-content { padding: 14px 12px; }
  .detail-section { padding: 16px 14px; margin-bottom: 12px; }
  .detail-section h4 { font-size: 0.96rem; }
  .info-grid { grid-template-columns: 1fr; gap: 12px; }
  .info-row .info-value { font-size: 0.92rem; }
  .info-row .info-value.lg { font-size: 1.05rem; }
  .detail-modal-footer { padding: 12px 14px; flex-wrap: wrap; gap: 8px; }
  .detail-modal-footer .btn { flex: 1; min-width: 0; font-size: 0.85rem; padding: 10px 12px; }
  .timeline { padding-left: 18px; }
  .timeline-item .tl-text { font-size: 0.88rem; }
  .mini-list li { padding: 12px 10px; font-size: 0.9rem; flex-wrap: wrap; gap: 4px; }
  .benefit-item { flex-wrap: wrap; }
  .benefit-item .b-date { width: 100%; padding-left: 32px; margin-top: 4px; }
}

