@import url('https://fonts.googleapis.com/css2?family=Sarabun:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #2d6a4f;
  --primary-light: #40916c;
  --primary-dark: #1b4332;
  --accent: #52b788;
  --accent-light: #74c69d;
  --bg: #f0f4f0;
  --sidebar-w: 240px;
  --sidebar-collapsed: 60px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: 'Sarabun', sans-serif; background: var(--bg); min-height: 100vh; color: #2d3436; }

/* ========== LOGIN ========== */
.login-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: linear-gradient(135deg, #1b4332 0%, #2d6a4f 50%, #52b788 100%);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-card {
  background: #fff; border-radius: 20px; padding: 32px;
  width: 100%; max-width: 440px; box-shadow: 0 20px 60px rgba(0,0,0,.3);
}
.login-logo { text-align: center; margin-bottom: 24px; }
.login-logo .logo-circle {
  width: 80px; height: 80px; border-radius: 50%; background: var(--primary);
  margin: 0 auto 12px; display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 2rem; box-shadow: 0 8px 24px rgba(45,106,79,.3);
}
.login-logo h2 { font-weight: 700; color: var(--primary); margin: 0; }
#login-tabs .nav-link { color: #555; font-weight: 600; border-radius: 10px; }
#login-tabs .nav-link.active { background: var(--primary); color: #fff; }

/* ========== SIDEBAR ========== */
#app-shell { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: #fff; position: fixed; top: 0; left: 0; height: 100vh; z-index: 100;
  transition: width 0.3s, transform 0.3s; overflow-y: auto; display: flex; flex-direction: column;
}
.sidebar.collapsed { width: var(--sidebar-collapsed); }
.sidebar.collapsed .sidebar-header span,
.sidebar.collapsed .sidebar-header small,
.sidebar.collapsed .sidebar-menu li span,
.sidebar.collapsed .sidebar-menu .submenu,
.sidebar.collapsed .sidebar-footer .user-meta,
.sidebar.collapsed .sidebar-footer .btn span { display: none; }

.sidebar-header {
  padding: 18px 16px; font-size: 1.4rem; font-weight: 700;
  display: flex; align-items: center; gap: 12px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
}
.sidebar-header i { font-size: 1.6rem; color: var(--accent-light); }
.sidebar-brand { font-size: 1.2rem; font-weight: 700; line-height: 1.1; }
.sidebar-sub { font-size: .7rem; color: rgba(255,255,255,.5); font-weight: 400; }

.sidebar-menu { list-style: none; padding: 8px 0; flex: 1; }
.sidebar-menu li {
  padding: 11px 20px; cursor: pointer; display: flex; align-items: center; gap: 12px;
  transition: all 0.2s; font-size: 0.92rem; border-left: 3px solid transparent;
  user-select: none;
}
.sidebar-menu li:hover { background: rgba(255,255,255,0.1); }
.sidebar-menu li.active { background: rgba(255,255,255,0.18); border-left-color: var(--accent-light); font-weight: 600; }
.sidebar-menu li i { width: 20px; text-align: center; font-size: 0.95rem; }
.sidebar-menu .menu-section {
  font-size: .65rem; color: rgba(255,255,255,.4); text-transform: uppercase;
  padding: 12px 20px 4px; letter-spacing: 1px; cursor: default;
}
.sidebar-menu .menu-section:hover { background: transparent; }
.sidebar-menu li.has-sub::after { content: "\f107"; font-family: "Font Awesome 6 Free"; font-weight: 900; margin-left: auto; transition: transform .2s; }
.sidebar-menu li.has-sub.open::after { transform: rotate(180deg); }
.sidebar-menu .submenu { list-style: none; background: rgba(0,0,0,.2); display: none; }
.sidebar-menu .submenu.open { display: block; }
.sidebar-menu .submenu li { padding-left: 48px; font-size: .85rem; }

.sidebar-footer {
  padding: 12px 14px; border-top: 1px solid rgba(255,255,255,0.15);
}
.user-card {
  display: flex; align-items: center; gap: 10px; padding: 6px;
  background: rgba(255,255,255,.08); border-radius: 10px;
}
.user-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: var(--accent);
  display: flex; align-items: center; justify-content: center; font-weight: 700;
  font-size: .95rem; flex-shrink: 0;
}
.user-meta { overflow: hidden; }
.user-name { font-size: .85rem; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: .65rem; color: rgba(255,255,255,.6); }

/* ========== MAIN ========== */
.main-content { margin-left: var(--sidebar-w); flex: 1; transition: margin-left 0.3s; padding: 0; min-width: 0; }
.sidebar.collapsed ~ .main-content { margin-left: var(--sidebar-collapsed); }

.top-bar {
  background: #fff; padding: 10px 20px; display: flex; align-items: center;
  gap: 12px; box-shadow: 0 2px 8px rgba(0,0,0,0.06); position: sticky; top: 0; z-index: 50;
}
.top-bar .btn-link { color: var(--primary); font-size: 1.2rem; text-decoration: none; padding: 4px 8px; }
.page-title { font-weight: 700; color: var(--primary); }

.page { padding: 22px; animation: fadeIn .25s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ========== STAT CARDS ========== */
.stat-card {
  background: #fff; border-radius: 12px; padding: 18px; display: flex;
  align-items: center; gap: 14px; box-shadow: 0 2px 12px rgba(0,0,0,0.06);
  transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover { transform: translateY(-2px); box-shadow: 0 4px 20px rgba(0,0,0,0.1); }
.stat-icon {
  width: 48px; height: 48px; border-radius: 12px; display: flex;
  align-items: center; justify-content: center; font-size: 1.2rem;
}
.stat-value { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.stat-label { font-size: 0.8rem; color: #636e72; margin-top: 2px; }

.card { border: none; border-radius: 12px; }
.card-title { font-weight: 600; margin-bottom: 14px; display: flex; align-items: center; gap: 8px; }

.table th { font-weight: 600; font-size: 0.78rem; text-transform: uppercase; color: #636e72; border-bottom: 2px solid #dee2e6; }
.table td { vertical-align: middle; font-size: 0.88rem; }

.badge-status { padding: 4px 10px; border-radius: 20px; font-size: 0.72rem; font-weight: 500; }
.badge-pending { background: #ffeaa7; color: #6c5ce7; }
.badge-completed { background: #d4edda; color: #155724; }
.badge-in_progress { background: #cce5ff; color: #004085; }
.badge-overdue { background: #f8d7da; color: #721c24; }

.progress-thin { height: 6px; border-radius: 3px; background: #e9ecef; overflow: hidden; }
.progress-thin .progress-bar { border-radius: 3px; height: 100%; }

.zone-card {
  background: #fff; border-radius: 10px; padding: 12px 8px; box-shadow: 0 1px 6px rgba(0,0,0,0.05);
  text-align: center; transition: transform 0.2s; cursor: pointer;
}
.zone-card:hover { transform: scale(1.05); }
.zone-code { font-size: 1.05rem; font-weight: 700; color: var(--primary); }
.zone-group { font-size: 0.7rem; color: #636e72; }

/* Frequency styles */
.freq-page-header {
  background: #fff; border-radius: 14px; padding: 16px 20px; margin-bottom: 18px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05); display: flex; align-items: center; gap: 16px;
}
.freq-badge {
  padding: 8px 16px; border-radius: 10px; font-weight: 700; font-size: 1rem;
  display: flex; align-items: center; gap: 8px; color: #fff; white-space: nowrap;
}
.freq-badge.daily { background: linear-gradient(135deg, #f4a261, #e76f51); }
.freq-badge.weekly { background: linear-gradient(135deg, #118ab2, #073b4c); }
.freq-badge.monthly { background: linear-gradient(135deg, #2d6a4f, #52b788); }
.freq-badge.quarterly { background: linear-gradient(135deg, #7b2cbf, #c77dff); }

.freq-summary-card {
  background: #fff; border-radius: 14px; padding: 16px; box-shadow: 0 2px 10px rgba(0,0,0,0.06);
  border-left: 5px solid; cursor: pointer; transition: all 0.2s;
}
.freq-summary-card:hover { transform: translateY(-3px); box-shadow: 0 6px 20px rgba(0,0,0,0.1); }
.freq-summary-card.daily { border-left-color: #e76f51; }
.freq-summary-card.weekly { border-left-color: #118ab2; }
.freq-summary-card.monthly { border-left-color: #2d6a4f; }
.freq-summary-card.quarterly { border-left-color: #7b2cbf; }
.freq-summary-card .freq-title { font-weight: 700; font-size: 1rem; margin-bottom: 4px; }
.freq-summary-card .freq-sub { font-size: .8rem; color: #888; }
.freq-summary-card .freq-nums { display: flex; gap: 12px; margin-top: 8px; }
.freq-summary-card .freq-nums .fn { text-align: center; flex: 1; }
.freq-summary-card .freq-nums .fn-val { font-size: 1.2rem; font-weight: 700; line-height: 1; }
.freq-summary-card .freq-nums .fn-lbl { font-size: .65rem; color: #888; }

.zone-group-card {
  background: #fff; border-radius: 14px; padding: 14px 18px; margin-bottom: 14px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}
.zone-group-title {
  font-weight: 700; font-size: 1rem; color: var(--primary); margin-bottom: 8px;
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.zone-group-title .zg-count {
  font-size: .72rem; font-weight: 500; color: #888; background: #f0f0f0;
  padding: 2px 8px; border-radius: 10px;
}
.zone-group-title .zg-pct { font-size: .8rem; font-weight: 600; margin-left: auto; }

.zt-card {
  background: #f8faf8; border-radius: 10px; padding: 9px 12px; margin-bottom: 6px;
  border: 1px solid #e8ece8; display: flex; align-items: center; gap: 10px;
}
.zt-zone-badge {
  font-weight: 700; font-size: .82rem; padding: 4px 10px; border-radius: 8px;
  min-width: 48px; text-align: center; flex-shrink: 0; cursor: pointer;
}
.zt-zone-badge.done { background: #d8f3dc; color: #1b5e20; }
.zt-zone-badge.pending { background: #fff3e0; color: #e65100; }
.zt-zone-badge.partial { background: #e3f2fd; color: #0d47a1; }
.zt-tasks { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.zt-chip { padding: 2px 8px; border-radius: 6px; font-size: .68rem; font-weight: 500; }
.zt-chip.done { background: #d8f3dc; color: #1b5e20; text-decoration: line-through; opacity: .6; }
.zt-chip.pending { background: #fff3e0; color: #e65100; }
.zt-chip.ip { background: #e3f2fd; color: #0d47a1; }
.zt-progress { width: 60px; flex-shrink: 0; }
.zt-pct { font-size: .72rem; font-weight: 700; text-align: right; flex-shrink: 0; min-width: 40px; }

.mini-stat {
  background: #fff; border-radius: 10px; padding: 11px 14px; text-align: center;
  box-shadow: 0 1px 6px rgba(0,0,0,0.05); cursor: pointer;
}
.mini-stat .ms-val { font-size: 1.4rem; font-weight: 700; line-height: 1; }
.mini-stat .ms-lbl { font-size: .7rem; color: #888; margin-top: 2px; }

.clickable { cursor: pointer; transition: all .15s; }
.clickable:hover { opacity: .85; }
.task-link { color: var(--primary); text-decoration: none; font-weight: 600; }
.task-link:hover { text-decoration: underline; }
.badge-freq { background: #e8e8e8; color: #555; font-size: .7rem; }

.lang-switch { display: flex; gap: 2px; }
.lang-sw-btn { border: 1px solid #ddd; background: #fff; border-radius: 6px; padding: 2px 6px; font-size: .8rem; cursor: pointer; transition: all .2s; }
.lang-sw-btn.active { border-color: var(--accent); background: #d8f3dc; }

/* Work Log Modal */
.worklog-overlay { position: fixed; inset: 0; z-index: 9999; background: rgba(0,0,0,.5); display: flex; align-items: center; justify-content: center; padding: 12px; }
.worklog-box { background: #fff; border-radius: 16px; width: 100%; max-width: 500px; max-height: 90vh; overflow-y: auto; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.worklog-header { display: flex; justify-content: space-between; align-items: center; padding: 14px 18px; border-bottom: 1px solid #eee; }
.worklog-header h5 { margin: 0; color: var(--primary); }
.worklog-body { padding: 18px; }
.wl-preview { display: flex; gap: 6px; flex-wrap: wrap; }
.wl-preview .wl-thumb { position: relative; width: 60px; height: 60px; }
.wl-preview .wl-thumb img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 2px solid var(--accent); display: block; }
.wl-preview > img { width: 60px; height: 60px; object-fit: cover; border-radius: 8px; border: 2px solid var(--accent); display: block; }
.wl-preview .wl-thumb .wl-del { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: #dc3545; color: #fff; border: 2px solid #fff; font-size: 13px; line-height: 1; display: flex; align-items: center; justify-content: center; cursor: pointer; padding: 0; box-shadow: 0 1px 3px rgba(0,0,0,.3); }
.wl-preview .wl-thumb .wl-del:hover { background: #b02a37; }
.wl-user-info { background: #f0f7f0; border-radius: 10px; padding: 10px 14px; display: flex; align-items: center; gap: 10px; }
.wl-user-info .wl-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--accent); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.wl-user-info .wl-uname { font-weight: 600; font-size: .95rem; }
.wl-user-info .wl-uchange { font-size: .7rem; color: var(--primary); cursor: pointer; text-decoration: underline; }

/* User-portal style cards */
.matrix-cat-card {
  background: #fff; border-radius: 12px; padding: 12px 14px; margin-bottom: 10px;
  box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.matrix-cat-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.matrix-cat-name { font-weight: 700; color: var(--primary); }
.matrix-cat-count { font-size: .78rem; color: #888; background: #f3f3f3; padding: 2px 8px; border-radius: 10px; }
.zone-chips { display: flex; flex-wrap: wrap; gap: 4px; }
.zone-chip { padding: 3px 9px; border-radius: 6px; font-size: .72rem; font-weight: 600; }
.zone-chip.pending { background: #fff3e0; color: #e65100; }
.zone-chip.done { background: #d8f3dc; color: #1b5e20; }
.zone-chip.ip { background: #e3f2fd; color: #0d47a1; }
.zone-chip.clickable { cursor: pointer; transition: transform .08s ease, box-shadow .08s ease; user-select: none; }
.zone-chip.clickable:hover { transform: translateY(-1px); box-shadow: 0 2px 6px rgba(0,0,0,.15); filter: brightness(1.05); }
.zone-chip.clickable:active { transform: translateY(0); }

/* Planner calendar */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.cal-header { text-align: center; font-weight: 600; font-size: .75rem; color: #888; padding: 4px; }
.cal-day { background: #fff; border-radius: 8px; padding: 6px 4px; min-height: 70px; font-size: .7rem; }
.cal-day.empty { background: transparent; }
.cal-day.today { border: 2px solid var(--accent); }
.cal-daynum { font-weight: 700; font-size: .85rem; color: var(--primary); }
.cal-task { padding: 2px 4px; border-radius: 4px; color: #fff; font-size: .6rem; margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.team-legend { display: flex; flex-wrap: wrap; gap: 12px; }
.team-dot { display: flex; align-items: center; gap: 6px; font-size: .82rem; }
.team-dot span { width: 14px; height: 14px; border-radius: 50%; display: inline-block; }

.plan-card { display: flex; align-items: center; gap: 10px; background: #fff; padding: 10px 14px; border-radius: 10px; margin-bottom: 6px; }
.plan-dot { width: 12px; height: 12px; border-radius: 50%; flex-shrink: 0; }
.plan-member { font-weight: 600; }

.empty-state { text-align: center; padding: 40px 20px; color: #888; }
.empty-state i { font-size: 2.5rem; margin-bottom: 10px; opacity: .4; }

/* Admin tabs */
.admin-subtabs {
  display: flex; gap: 4px; flex-wrap: wrap; padding: 8px; background: #fff;
  border-radius: 10px; margin-bottom: 16px; box-shadow: 0 1px 6px rgba(0,0,0,.05);
}
.admin-subtabs .stab {
  padding: 8px 14px; border-radius: 8px; cursor: pointer; font-size: .85rem;
  border: 1px solid transparent; background: transparent; color: #555;
}
.admin-subtabs .stab:hover { background: #f0f4f0; }
.admin-subtabs .stab.active { background: var(--primary); color: #fff; }

.admin-stat {
  background: #fff; border-radius: 12px; padding: 18px; text-align: center;
  box-shadow: 0 2px 10px rgba(0,0,0,.06);
}
.admin-stat .value { font-size: 1.7rem; font-weight: 700; line-height: 1; }
.admin-stat .label { font-size: .8rem; color: #666; margin-top: 4px; }

/* Date banner */
.date-banner { background: linear-gradient(135deg, var(--primary), var(--accent)); color: #fff; padding: 14px 20px; border-radius: 14px; margin-bottom: 14px; }
.date-banner .date-big { font-size: 1.4rem; font-weight: 700; }
.date-banner .date-sub { font-size: .85rem; opacity: .9; }

.qstat { background: #fff; border-radius: 10px; padding: 10px; text-align: center; box-shadow: 0 1px 6px rgba(0,0,0,.05); }
.qstat-val { font-size: 1.3rem; font-weight: 700; }
.qstat-lbl { font-size: .68rem; color: #888; }

.alert-card { background: #fff3cd; border: 1px solid #ffc107; border-radius: 10px; padding: 10px 14px; margin-bottom: 10px; font-size: .85rem; }
.section-title { font-weight: 700; color: var(--primary); margin: 12px 0 8px; }

.task-card { background: #fff; border-radius: 10px; padding: 14px 18px; margin-bottom: 10px; border-left: 4px solid var(--accent); font-size: .95rem; }
.task-card .task-cat { font-weight: 700; font-size: 1.05rem; }
.task-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.ttag { padding: 4px 10px; border-radius: 8px; font-size: .82rem; }
.ttag-zone { background: #e3f2fd; color: #0d47a1; }
.ttag-time { background: #f3e5f5; color: #6a1b9a; }
.ttag-done { background: #d8f3dc; color: #1b5e20; }
.ttag-pending { background: #ffeaa7; color: #6c5ce7; }
.ttag-progress { background: #cce5ff; color: #004085; }
.ttag-overdue { background: #ffd1d1; color: #b71c1c; }
.hist-pills { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 12px; }
.hist-pill { cursor: pointer; padding: 6px 14px; border-radius: 20px; font-size: .82rem; background: #f1f3f5; color: #495057; border: 1px solid transparent; transition: all .15s; user-select: none; }
.hist-pill:hover { background: #e9ecef; }
.hist-pill.active { background: var(--accent, #52b788); color: #fff; font-weight: 600; }
.hist-pill .pill-count { margin-left: 6px; opacity: .8; font-size: .72rem; }
.task-photos { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.task-photos img { width: 84px; height: 84px; object-fit: cover; border-radius: 8px; cursor: zoom-in; transition: transform .15s, box-shadow .15s; }
.task-photos img:hover { transform: scale(1.04); box-shadow: 0 4px 12px rgba(0,0,0,.18); }
.task-by { font-size: .85rem; color: #666; margin-top: 8px; }
.task-note { font-size: .88rem; color: #444; margin-top: 8px; padding: 8px 10px; background: #fff8e1; border-left: 3px solid #f9a825; border-radius: 6px; word-break: break-word; line-height: 1.4; }
.task-note strong { color: #b05a00; margin-right: 6px; }

.lightbox { position: fixed; inset: 0; background: rgba(0,0,0,.88); display: flex; align-items: center; justify-content: center; z-index: 9999; cursor: zoom-out; padding: 20px; }
.lightbox img { max-width: 96vw; max-height: 92vh; border-radius: 8px; box-shadow: 0 8px 32px rgba(0,0,0,.5); object-fit: contain; }
.lightbox-close { position: absolute; top: 16px; right: 20px; background: rgba(255,255,255,.15); color: #fff; border: none; width: 42px; height: 42px; border-radius: 50%; font-size: 1.4rem; cursor: pointer; line-height: 1; }
.lightbox-close:hover { background: rgba(255,255,255,.28); }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #b2bec3; border-radius: 3px; }

/* Mobile */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); width: var(--sidebar-w); }
  .sidebar.mobile-open { transform: translateX(0); }
  .main-content { margin-left: 0 !important; }
  .top-bar { padding: 8px 10px; gap: 6px; flex-wrap: wrap; padding-top: calc(8px + env(safe-area-inset-top, 0px)); }
  .top-bar .page-title { font-size: 1rem; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .page { padding: 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom, 0px)); }
  .freq-page-header { flex-direction: column; align-items: flex-start; }
  /* Prevent iOS zoom on input focus (scoped to forms users actually fill in) */
  .worklog-body .form-control, .worklog-body .form-select,
  .page .form-control, .page .form-select,
  .login-card .form-control, .login-card .form-select { font-size: 16px; }
  /* Bigger tap targets */
  .btn-sm { min-height: 36px; }
  .top-bar .btn-link { padding: 8px 10px; }
  /* Worklog modal full-screen on mobile */
  .worklog-overlay { padding: 0; align-items: stretch; }
  .worklog-box { max-width: 100%; max-height: 100vh; height: 100vh; border-radius: 0; padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); display: flex; flex-direction: column; }
  .worklog-body { flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch; }
  .wl-preview .wl-thumb, .wl-preview .wl-thumb img, .wl-preview > img { width: 56px; height: 56px; }
  /* Sidebar overlay backdrop */
  .sidebar.mobile-open ~ .main-content::before {
    content: ''; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99;
  }
  /* Lang switch wrap nicely */
  .lang-switch { flex-shrink: 0; }
}
/* Very small phones */
@media (max-width: 380px) {
  .top-bar { gap: 4px; }
  .top-bar .btn-sm, .top-bar select { font-size: .75rem; }
}

/* ===== Admin Tasks Grid View ===== */
.atk-grid-wrap {
  overflow-x: auto;
  max-height: 70vh;
  overflow-y: auto;
}
.atk-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  background: #fff;
}
.atk-grid thead th {
  position: sticky;
  top: 0;
  background: #f8f9fa;
  border-bottom: 2px solid #2d6a4f;
  padding: 8px 6px;
  text-align: center;
  z-index: 2;
  font-weight: 600;
  color: #2d6a4f;
  white-space: nowrap;
}
.atk-grid .atk-row-head {
  position: sticky;
  left: 0;
  background: #f8f9fa;
  border-right: 2px solid #2d6a4f;
  text-align: left;
  padding: 8px 12px;
  min-width: 220px;
  z-index: 1;
}
.atk-grid thead .atk-row-head { z-index: 3; }
.atk-grid .atk-col-head { min-width: 60px; }
.atk-grid .atk-cat {
  font-weight: 600;
  color: #1a3a2a;
  font-size: .9rem;
  line-height: 1.2;
}
.atk-grid .atk-zone {
  font-size: .75rem;
  margin-top: 2px;
  display: flex;
  gap: 4px;
  align-items: center;
}
.atk-grid tbody tr:nth-child(even) { background: #fafafa; }
.atk-grid tbody tr:nth-child(even) .atk-row-head { background: #fafafa; }
.atk-grid tbody tr:hover { background: #e8f5e9; }
.atk-grid tbody tr:hover .atk-row-head { background: #d4edda; }
.atk-grid .atk-cell-td {
  text-align: center;
  padding: 4px 2px;
  border-bottom: 1px solid #eee;
  vertical-align: middle;
}
.atk-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  font-size: .75rem;
  font-weight: 600;
  margin: 1px;
  vertical-align: middle;
  border: 1px solid transparent;
  transition: transform 0.1s;
}
.atk-cell.clickable { cursor: pointer; }
.atk-cell.clickable:hover { transform: scale(1.15); box-shadow: 0 2px 6px rgba(0,0,0,.2); }
.atk-cell.atk-done { background: #27ae60; color: #fff; border-color: #1e8449; }
.atk-cell.atk-overdue { background: #e74c3c; color: #fff; border-color: #c0392b; animation: atk-pulse 1.5s ease-in-out infinite; }
.atk-cell.atk-due-now { background: #f39c12; color: #fff; border-color: #d68910; }
.atk-cell.atk-due-soon { background: #f1c40f; color: #5a4a00; border-color: #d4ac0d; }
.atk-cell.atk-upcoming { background: #d6dbdf; color: #566573; border-color: #aab7b8; }
.atk-cell.atk-na { background: #f5f5f5; color: #ccc; border-color: #eee; }

@keyframes atk-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(231, 76, 60, 0.5); }
  50% { box-shadow: 0 0 0 4px rgba(231, 76, 60, 0); }
}

@media (max-width: 768px) {
  .atk-grid .atk-row-head { min-width: 140px; padding: 6px 8px; }
  .atk-cell { width: 26px; height: 26px; font-size: .65rem; }
}
