:root {
  --red-50: #fff5f5;
  --red-100: #ffe3e3;
  --red-200: #ffc9c9;
  --red-300: #ffa8a8;
  --red-400: #ff8787;
  --red-500: #e03131;
  --red-600: #c92a2a;
  --red-700: #a61e1e;
  --red-800: #8b1a1a;
  --red-900: #6b1414;
  --glass-bg: rgba(255, 255, 255, 0.42);
  --glass-bg-strong: rgba(255, 255, 255, 0.62);
  --glass-border: rgba(255, 255, 255, 0.55);
  --glass-shadow: 0 8px 32px rgba(139, 26, 26, 0.12), inset 0 1px 0 rgba(255,255,255,0.6);
  --text: #2b1212;
  --text-muted: #7a5555;
  --radius: 22px;
  --radius-sm: 14px;
  --font: "Sarabun", "SF Pro Display", -apple-system, BlinkMacSystemFont, sans-serif;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 600px at 10% -10%, rgba(255, 135, 135, 0.45), transparent 55%),
    radial-gradient(900px 500px at 90% 0%, rgba(201, 42, 42, 0.35), transparent 50%),
    radial-gradient(800px 500px at 50% 110%, rgba(255, 200, 200, 0.5), transparent 45%),
    linear-gradient(165deg, #fff8f8 0%, #ffe8e8 35%, #f8d4d4 70%, #f0c4c4 100%);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  opacity: 0.4;
  z-index: 0;
}

a { color: var(--red-700); text-decoration: none; }
a:hover { color: var(--red-500); }

/* Liquid glass panel */
.glass {
  background: var(--glass-bg);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--glass-shadow);
}

.glass-strong {
  background: var(--glass-bg-strong);
  backdrop-filter: blur(40px) saturate(200%);
  -webkit-backdrop-filter: blur(40px) saturate(200%);
  border: 1px solid rgba(255,255,255,0.7);
  border-radius: var(--radius);
  box-shadow: 0 12px 40px rgba(139, 26, 26, 0.14), inset 0 1px 0 rgba(255,255,255,0.75);
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1240px;
  margin: 0 auto;
  padding: 20px 20px calc(40px + var(--safe-bottom));
}

/* Top nav */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  margin-bottom: 24px;
  animation: floatIn 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 4px 10px rgba(169, 30, 30, 0.25));
  animation: logoPulse 4s ease-in-out infinite;
}

.brand-text { min-width: 0; }
.brand-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--red-800);
  line-height: 1.2;
}
.brand-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav-link {
  padding: 8px 14px;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--red-800);
  background: rgba(255,255,255,0.35);
  border: 1px solid rgba(255,255,255,0.45);
  transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
}
.nav-link:hover {
  background: rgba(255,255,255,0.7);
  transform: translateY(-1px);
  color: var(--red-700);
}
.nav-link.active {
  background: linear-gradient(135deg, var(--red-500), var(--red-700));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 6px 18px rgba(201, 42, 42, 0.35);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px 6px 6px;
  border-radius: 999px;
  background: rgba(255,255,255,0.5);
  border: 1px solid rgba(255,255,255,0.6);
  font-size: 0.8rem;
}
.user-avatar {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--red-400), var(--red-700));
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.75rem;
}

/* Page header */
.page-hero {
  margin-bottom: 22px;
  animation: floatIn 0.7s cubic-bezier(0.22, 1, 0.36, 1) 0.05s both;
}
.page-hero h1 {
  margin: 0 0 6px;
  font-size: clamp(1.45rem, 3vw, 1.9rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--red-900);
}
.page-hero p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
  max-width: 640px;
}

.hero-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}
.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, #ff6b6b, var(--red-600) 50%, var(--red-800));
  color: #fff;
  box-shadow: 0 8px 24px rgba(201, 42, 42, 0.35);
}
.btn-primary:hover {
  box-shadow: 0 10px 28px rgba(201, 42, 42, 0.45);
  transform: translateY(-1px);
  color: #fff;
}

.btn-ghost {
  background: rgba(255,255,255,0.45);
  color: var(--red-800);
  border: 1px solid rgba(255,255,255,0.65);
  backdrop-filter: blur(12px);
}
.btn-ghost:hover { background: rgba(255,255,255,0.75); color: var(--red-700); }

.btn-danger {
  background: rgba(255,255,255,0.4);
  color: var(--red-700);
  border: 1px solid rgba(201, 42, 42, 0.25);
}
.btn-danger:hover { background: var(--red-100); }

.btn-sm { padding: 7px 14px; font-size: 0.82rem; }

/* Stats */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 22px;
  animation: floatIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.1s both;
}
.stat-card {
  padding: 18px 16px;
  position: relative;
  overflow: hidden;
}
.stat-card::after {
  content: "";
  position: absolute;
  width: 90px;
  height: 90px;
  right: -20px;
  top: -20px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,135,135,0.35), transparent 70%);
}
.stat-label { font-size: 0.8rem; color: var(--text-muted); margin-bottom: 6px; }
.stat-value { font-size: 1.55rem; font-weight: 700; color: var(--red-800); letter-spacing: -0.02em; }
.stat-value.sm { font-size: 1.15rem; }

/* Charts */
.charts-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 22px;
  animation: floatIn 0.75s cubic-bezier(0.22, 1, 0.36, 1) 0.15s both;
}
.chart-panel { padding: 8px 8px 14px; overflow: hidden; }
.chart-panel .panel-head {
  padding: 10px 12px 4px;
  margin-bottom: 0;
}
.chart-panel .panel-head h2 { font-size: 1rem; }
.chart-wrap {
  position: relative;
  height: 260px;
  padding: 8px 12px 12px;
}
.chart-wrap-doughnut { height: 240px; }
.chart-empty {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
  padding: 20px;
}

/* Cards / tables */
.panel {
  padding: 20px;
  margin-bottom: 18px;
  animation: floatIn 0.8s cubic-bezier(0.22, 1, 0.36, 1) 0.12s both;
}
.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.panel-head h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--red-900);
}
.filter-bar {
  display: flex;
  align-items: center;
  gap: 10px;
}
.filter-bar label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--red-800);
  white-space: nowrap;
}
.filter-bar select {
  min-width: 140px;
  padding: 8px 32px 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.6);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--red-900);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b1a1a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.filter-bar select:focus {
  border-color: rgba(224, 49, 49, 0.45);
  box-shadow: 0 0 0 4px rgba(224, 49, 49, 0.12);
}

.table-wrap { overflow-x: auto; border-radius: var(--radius-sm); }

table.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
table.data th {
  text-align: left;
  padding: 12px 10px;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  border-bottom: 1px solid rgba(169, 30, 30, 0.1);
}
table.data td {
  padding: 14px 10px;
  border-bottom: 1px solid rgba(169, 30, 30, 0.06);
  vertical-align: top;
}
table.data tr:last-child td { border-bottom: none; }
table.data tbody tr {
  transition: background 0.2s;
}
table.data tbody tr:hover {
  background: rgba(255,255,255,0.45);
}
table.data .col-seq {
  width: 56px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--red-800);
}

.table-act-wrap { overflow: visible; }
.table-act {
  table-layout: fixed;
  width: 100%;
  font-size: 0.82rem;
}
table.data.table-act th,
table.data.table-act td {
  padding: 8px 6px;
  white-space: normal;
  word-break: break-word;
  vertical-align: top;
}
.table-act .col-seq { width: 48px; }
.table-act .col-name { width: 18%; }
.table-act .col-person { width: 14%; }
.table-act .col-budget {
  width: 88px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.table-act .col-attach { width: 78px; text-align: center; }
.table-act .col-status { width: 210px; }
.table-act .col-months { width: auto; }
.table-act .col-actions { width: 72px; }
.actions-stack {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: stretch;
}
.actions-stack .btn { width: 100%; justify-content: center; padding: 5px 8px; }
.table-fb { width: 100%; }
.table-fb .col-fb-date { width: 120px; white-space: nowrap; }
.table-fb .col-fb-by { width: 200px; }
.table-fb .col-fb-msg {
  overflow-wrap: anywhere;
  word-break: break-word;
  white-space: pre-wrap;
  font-weight: 400;
}
.table-fb .col-actions { width: 72px; }
.month-mini {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 4px;
}
.month-mini-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 3px 2px;
  border-radius: 8px;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(169, 30, 30, 0.06);
}
.month-mini-item.has-val {
  background: #fff5f5;
  border-color: rgba(169, 30, 30, 0.12);
}
.month-mini-item .m {
  font-size: 0.62rem;
  font-weight: 700;
  color: var(--text-muted);
  letter-spacing: 0;
  text-transform: none;
}
.month-mini-item .p {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--red-800);
  font-variant-numeric: tabular-nums;
}
@media (min-width: 1100px) {
  .month-mini { grid-template-columns: repeat(12, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .table-act thead { display: none; }
  .table-act,
  .table-act tbody,
  .table-act tr,
  .table-act td { display: block; width: 100%; }
  .table-act { table-layout: auto; }
  .table-act tr {
    margin-bottom: 12px;
    padding: 12px;
    border-radius: 16px;
    background: rgba(255,255,255,0.55);
    border: 1px solid rgba(169, 30, 30, 0.08);
  }
  .table-act td {
    display: grid;
    grid-template-columns: 120px 1fr;
    gap: 8px;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(169, 30, 30, 0.08);
    text-align: left !important;
    width: auto;
  }
  .table-act td:last-child { border-bottom: none; }
  .table-act td::before {
    content: attr(data-label);
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--red-800);
  }
  .table-act .col-seq,
  .table-act .col-name,
  .table-act .col-person,
  .table-act .col-budget,
  .table-act .col-attach,
  .table-act .col-status,
  .table-act .col-months,
  .table-act .col-actions { width: auto; }
  .table-act .col-months { grid-template-columns: 1fr; }
  .table-act .col-months::before { margin-bottom: 6px; }
  .actions-stack { flex-direction: row; }
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 600;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.7);
}
.status-badge::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}
.status-pending { color: #868e96; }
.status-delayed { color: #e03131; }
.status-progress { color: #f08c00; }
.status-paused { color: #7950f2; }
.status-done { color: #2f9e44; }

.activity-status-cell {
  display: grid;
  gap: 8px;
  min-width: 190px;
}
.activity-status-cell .status-badge { width: fit-content; }
.activity-current-status {
  position: relative;
  max-width: 100%;
  justify-content: center;
  gap: 9px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, .28);
  border-radius: 14px;
  font-size: 0.88rem;
  font-weight: 700;
  line-height: 1.5;
  text-align: center;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .75), 0 3px 10px rgba(15, 23, 42, .06);
}
.activity-status-cell .activity-current-status { width: 100%; }
.activity-current-status::before { width: 8px; height: 8px; flex: 0 0 8px; }
.activity-current-status.status-progress {
  color: #0369a1;
  background: linear-gradient(135deg, #f0f9ff, #bae6fd);
  border-color: #7dd3fc;
}
.activity-current-status.status-progress::before {
  background: #0ea5e9;
  animation: activity-status-pulse 2.4s ease-out infinite;
}
.activity-current-status.status-stopped {
  color: #a32232;
  background: linear-gradient(135deg, #fff1f2, #ffe4e6);
  border-color: #f3b6be;
}
.activity-current-status.status-started { color: #1e40af; background: #dbeafe; border-color: #93c5fd; }
.activity-current-status.status-done { color: #166534; background: #dcfce7; border-color: #86efac; }
@keyframes activity-status-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(14, 165, 233, 0), 0 0 4px rgba(14, 165, 233, .3); }
  25% { box-shadow: 0 0 0 3px rgba(14, 165, 233, .2), 0 0 9px rgba(14, 165, 233, .65); }
  75% { box-shadow: 0 0 0 8px rgba(14, 165, 233, 0), 0 0 4px rgba(14, 165, 233, .3); }
}
@media (prefers-reduced-motion: reduce) {
  .activity-current-status.status-progress::before { animation: none; }
}
.activity-status-actions {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}
.status-action-btn {
  border: 0;
  border-radius: 7px;
  padding: 5px 9px;
  color: #fff;
  font: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: transform .15s ease, opacity .15s ease;
}
.status-action-btn:hover { transform: translateY(-1px); opacity: .88; }
.status-action-btn.is-active {
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px currentColor;
}
.status-action-btn.is-active::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: #fff;
  vertical-align: 1px;
}
.status-action-btn.is-stay { background: #d97706; }
.status-action-btn.is-stay.is-active::before { background: #fde68a; animation: activity-status-pulse 2.4s ease-out infinite; }
.status-action-btn.is-start { background: #1e40af; }
.status-action-btn.is-finish { background: #15803d; }
@media (prefers-reduced-motion: reduce) { .status-action-btn.is-stay::before { animation: none; } }
.status-action-btn.is-stop { background: #c92a2a; }
.table-status-history td { vertical-align: top; }
.table-status-history th:first-child { min-width: 145px; }
.status-history-note { min-width: 180px; white-space: pre-wrap; overflow-wrap: anywhere; }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.form-grid .full { grid-column: 1 / -1; }

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--red-800);
  margin-bottom: 6px;
}
.field .hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}
.check-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}
.check-inline input[type="checkbox"] {
  width: auto;
  margin: 0;
}

.person-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 10px;
}
.person-chips:empty {
  display: none;
}
.person-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 8px 6px 12px;
  border-radius: 999px;
  background: rgba(201, 42, 42, 0.1);
  border: 1px solid rgba(201, 42, 42, 0.18);
  color: var(--red-800);
  font-size: 0.88rem;
  font-weight: 600;
}
.person-chip span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.person-chip-remove {
  width: 22px;
  height: 22px;
  border: 0;
  border-radius: 50%;
  background: rgba(201, 42, 42, 0.16);
  color: var(--red-800);
  cursor: pointer;
  line-height: 1;
  font-size: 1rem;
  padding: 0;
}
.person-chip-remove:hover {
  background: rgba(201, 42, 42, 0.28);
}
.person-add-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.person-add-row input {
  flex: 1;
}
.person-add-row .btn {
  flex-shrink: 0;
  white-space: nowrap;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: box-shadow 0.2s, border-color 0.2s, background 0.2s;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: rgba(224, 49, 49, 0.45);
  background: rgba(255,255,255,0.85);
  box-shadow: 0 0 0 4px rgba(224, 49, 49, 0.12);
}

/* Searchable select */
.search-select {
  position: relative;
}
.search-select-input-wrap {
  position: relative;
}
.search-select-input {
  width: 100%;
  padding: 12px 36px 12px 14px !important;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
  transition: box-shadow 0.2s, border-color 0.2s, background 0.2s;
}
.search-select-input:focus {
  border-color: rgba(224, 49, 49, 0.45);
  background: rgba(255,255,255,0.85);
  box-shadow: 0 0 0 4px rgba(224, 49, 49, 0.12);
}
.search-select.is-invalid .search-select-input {
  border-color: rgba(224, 49, 49, 0.65);
  box-shadow: 0 0 0 4px rgba(224, 49, 49, 0.15);
}
.search-select-clear {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  width: 26px;
  height: 26px;
  border: none;
  border-radius: 50%;
  background: rgba(169, 30, 30, 0.12);
  color: var(--red-700);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  z-index: 2;
}
.search-select-clear:hover {
  background: rgba(169, 30, 30, 0.22);
}
.search-select-list {
  display: none;
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 6px);
  max-height: 260px;
  overflow-y: auto;
  z-index: 40;
  padding: 6px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.75);
  box-shadow: 0 16px 40px rgba(139, 26, 26, 0.18);
}
.search-select-list.is-open { display: block; }
.search-select-option {
  display: block;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-family: inherit;
  font-size: 0.92rem;
  color: var(--text);
  cursor: pointer;
}
.search-select-option:hover,
.search-select-option.is-active {
  background: rgba(224, 49, 49, 0.12);
  color: var(--red-800);
}
.search-select-empty {
  padding: 12px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
}

/* Thai calendar date picker */
.thaidate {
  position: relative;
}
.thaidate-native {
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 1px !important;
  height: 1px !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
}
.thaidate-display {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(10px);
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: box-shadow 0.2s, border-color 0.2s, background 0.2s;
}
.thaidate-display:hover,
.thaidate.is-open .thaidate-display {
  border-color: rgba(224, 49, 49, 0.45);
  background: rgba(255,255,255,0.85);
  box-shadow: 0 0 0 4px rgba(224, 49, 49, 0.12);
}
.thaidate.is-invalid .thaidate-display {
  border-color: rgba(224, 49, 49, 0.65);
  box-shadow: 0 0 0 3px rgba(224, 49, 49, 0.12);
}
.thaidate-icon {
  display: flex;
  color: var(--red-700);
  flex-shrink: 0;
}
.thaidate-label {
  flex: 1;
  font-weight: 600;
  color: var(--red-900);
}
.thaidate-label.is-placeholder {
  font-weight: 500;
  color: var(--text-muted);
}
.thaidate-clear {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(169, 30, 30, 0.12);
  color: var(--red-700);
  font-size: 1rem;
  line-height: 1;
  flex-shrink: 0;
}
.thaidate-clear:hover {
  background: rgba(169, 30, 30, 0.22);
}
.thaidate-popover {
  display: none;
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 50;
  width: min(320px, 92vw);
  padding: 14px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(28px) saturate(180%);
  -webkit-backdrop-filter: blur(28px) saturate(180%);
  border: 1px solid rgba(255,255,255,0.8);
  box-shadow: 0 18px 48px rgba(139, 26, 26, 0.2);
  animation: floatIn 0.25s ease;
}
.thaidate.is-open .thaidate-popover {
  display: block;
}
.thaidate-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
  gap: 8px;
}
.thaidate-title {
  font-weight: 700;
  color: var(--red-900);
  font-size: 0.98rem;
}
.thaidate-nav {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(224, 49, 49, 0.1);
  color: var(--red-800);
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
}
.thaidate-nav:hover {
  background: rgba(224, 49, 49, 0.2);
}
.thaidate-week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 6px;
  text-align: center;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
}
.thaidate-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}
.thaidate-day {
  aspect-ratio: 1;
  border: none;
  border-radius: 12px;
  background: transparent;
  font-family: inherit;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, transform 0.15s;
}
.thaidate-day:not(.is-empty):not(.is-disabled):hover {
  background: rgba(224, 49, 49, 0.12);
  color: var(--red-800);
}
.thaidate-day.is-empty {
  cursor: default;
}
.thaidate-day.is-today {
  box-shadow: inset 0 0 0 1.5px rgba(224, 49, 49, 0.45);
}
.thaidate-day.is-selected {
  background: linear-gradient(135deg, #ff6b6b, var(--red-700));
  color: #fff;
  box-shadow: 0 4px 12px rgba(201, 42, 42, 0.35);
}
.thaidate-day.is-disabled {
  color: #ccc;
  cursor: not-allowed;
  opacity: 0.45;
}
.thaidate-foot {
  margin-top: 10px;
  display: flex;
  justify-content: flex-end;
}
.thaidate-today-btn {
  border: none;
  background: rgba(224, 49, 49, 0.1);
  color: var(--red-800);
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  cursor: pointer;
}
.thaidate-today-btn:hover:not(:disabled) {
  background: rgba(224, 49, 49, 0.18);
}
.thaidate-today-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
.month-item {
  padding: 10px;
  border-radius: 14px;
  background: rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.55);
}
.month-item label {
  font-size: 0.75rem;
  margin-bottom: 4px;
}
.month-item input {
  padding: 8px 10px;
  font-size: 0.88rem;
}
.month-item textarea {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.55);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
  outline: none;
  resize: vertical;
  min-height: 72px;
}
.month-item textarea:focus {
  border-color: rgba(224, 49, 49, 0.45);
  background: rgba(255,255,255,0.85);
  box-shadow: 0 0 0 3px rgba(224, 49, 49, 0.12);
}
.month-item select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.55);
  font-family: inherit;
  font-size: 0.88rem;
  color: var(--text);
  outline: none;
  cursor: pointer;
}
.month-item select:focus {
  border-color: rgba(224, 49, 49, 0.45);
  background: rgba(255,255,255,0.85);
  box-shadow: 0 0 0 3px rgba(224, 49, 49, 0.12);
}
.month-grid-work {
  grid-template-columns: repeat(3, 1fr);
}
@media (max-width: 900px) {
  .month-grid-work { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 640px) {
  .month-grid-work { grid-template-columns: 1fr; }
}
.month-total {
  margin-top: 12px;
  padding: 12px 16px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(255,107,107,0.15), rgba(201,42,42,0.12));
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
  color: var(--red-800);
  transition: background 0.2s, color 0.2s, box-shadow 0.2s;
}
.month-total.is-over {
  background: rgba(224, 49, 49, 0.18);
  color: var(--red-700);
  box-shadow: 0 0 0 2px rgba(224, 49, 49, 0.35);
}
.month-over-warning {
  display: none;
  margin-top: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: #ffe3e3;
  border: 1px solid #ffa8a8;
  color: #a61e1e;
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1.45;
}
.month-over-warning.is-show {
  display: block;
}
.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.form-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(169, 30, 30, 0.08);
}

.swal2-popup {
  font-family: var(--font) !important;
  border-radius: 18px !important;
}
.swal2-title, .swal2-html-container { color: var(--text) !important; }
.swal2-styled.swal2-confirm,
.swal2-styled.swal2-cancel {
  border-radius: 999px !important;
  font-weight: 700 !important;
  box-shadow: none !important;
}

/* Flash */
.flash {
  padding: 12px 16px;
  border-radius: 14px;
  margin-bottom: 16px;
  font-size: 0.9rem;
  font-weight: 500;
  animation: floatIn 0.4s ease;
}
.flash-success {
  background: rgba(47, 158, 68, 0.15);
  border: 1px solid rgba(47, 158, 68, 0.3);
  color: #2b8a3e;
}
.flash-error {
  background: rgba(224, 49, 49, 0.12);
  border: 1px solid rgba(224, 49, 49, 0.28);
  color: var(--red-700);
}

/* Empty state */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-muted);
}
.empty-icon {
  font-size: 2.5rem;
  margin-bottom: 8px;
  opacity: 0.5;
}

/* Project detail meta */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
.meta-grid-info {
  grid-template-columns: repeat(4, 1fr);
}
.meta-grid-budget {
  grid-template-columns: repeat(3, 1fr);
}
.meta-item {
  padding: 14px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.55);
}
.meta-item .label { font-size: 0.75rem; color: var(--text-muted); margin-bottom: 4px; }
.meta-item .value { font-weight: 600; color: var(--red-900); font-size: 0.95rem; }

.progress-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,0.5);
  overflow: hidden;
  margin-top: 8px;
}
.progress-bar > span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #ff8787, var(--red-600));
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.actions-inline { display: flex; gap: 6px; flex-wrap: wrap; }

.monthly-row td {
  padding-top: 0 !important;
  padding-bottom: 16px !important;
  border-bottom: 1px solid rgba(169, 30, 30, 0.1);
}

.monthly-table-wrap {
  margin-top: 4px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.45);
  border: 1px solid rgba(255,255,255,0.6);
}

.monthly-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.monthly-table-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--red-800);
  margin-bottom: 8px;
}

.monthly-table-panel {
  margin-top: 8px;
}

table.monthly-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.84rem;
}

table.monthly-table th,
table.monthly-table td {
  padding: 8px 10px;
  border: 1px solid rgba(169, 30, 30, 0.1);
  text-align: left;
}

table.monthly-table th {
  background: rgba(224, 49, 49, 0.08);
  color: var(--red-800);
  font-weight: 700;
  font-size: 0.76rem;
}

table.monthly-table td:nth-child(2) {
  text-align: left;
  font-weight: 500;
  white-space: pre-wrap;
  word-break: break-word;
}

table.monthly-table td:last-child {
  text-align: right;
  font-weight: 600;
  color: var(--red-900);
  white-space: nowrap;
}

table.monthly-table .monthly-total-row td {
  background: rgba(224, 49, 49, 0.06);
  font-weight: 700;
}

/* Login page */
.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  position: relative;
  z-index: 1;
}
.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 36px 32px;
  animation: floatIn 0.7s cubic-bezier(0.22, 1, 0.36, 1);
}
.auth-logo-wrap {
  text-align: center;
  margin-bottom: 20px;
}
.auth-logo {
  width: 88px;
  height: 88px;
  object-fit: contain;
  filter: drop-shadow(0 8px 20px rgba(169, 30, 30, 0.3));
  animation: logoPulse 4s ease-in-out infinite;
}
.auth-card h1 {
  margin: 0 0 6px;
  text-align: center;
  font-size: 1.45rem;
  color: var(--red-900);
  letter-spacing: -0.02em;
}
.auth-card .subtitle {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.88rem;
  margin: 0 0 24px;
  line-height: 1.5;
}
.auth-hint {
  margin-top: 18px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(255,255,255,0.4);
  font-size: 0.8rem;
  color: var(--text-muted);
  line-height: 1.5;
}
.college-select-hint {
  max-height: 120px;
  overflow-y: auto;
  font-size: 0.72rem;
  margin-top: 8px;
  opacity: 0.85;
}

.orb {
  position: fixed;
  border-radius: 50%;
  filter: blur(60px);
  pointer-events: none;
  z-index: 0;
  animation: orbFloat 12s ease-in-out infinite;
}
.orb-1 {
  width: 320px; height: 320px;
  background: rgba(255, 107, 107, 0.45);
  top: -80px; left: -60px;
}
.orb-2 {
  width: 280px; height: 280px;
  background: rgba(201, 42, 42, 0.3);
  bottom: 10%; right: -40px;
  animation-delay: -4s;
}
.orb-3 {
  width: 200px; height: 200px;
  background: rgba(255, 168, 168, 0.5);
  top: 40%; left: 30%;
  animation-delay: -7s;
}

@keyframes floatIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
@keyframes logoPulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.04); }
}
@keyframes orbFloat {
  0%, 100% { transform: translate(0, 0); }
  50% { transform: translate(20px, -30px); }
}

/* CFR monitoring dashboard */
.cfr-monitor-page { margin-bottom: 24px; }
.mon-hero {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}
.mon-hero-icon svg { width: 64px; height: 64px; display: block; }
.mon-hero-text { flex: 1; min-width: 0; }
.mon-hero-text h1 {
  margin: 0 0 6px;
  font-size: 1.35rem;
  color: var(--red-900);
  line-height: 1.35;
}
.mon-hero-text p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.55;
}
.mon-hero-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.mon-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 12px 16px;
  align-items: flex-end;
  margin: 0 0 16px;
  padding: 14px 16px;
  background: rgba(255,255,255,0.78);
  border: 1px solid rgba(180, 150, 150, 0.28);
  border-radius: 18px;
}
.mon-filter-field { min-width: 180px; }
.mon-filter-project { flex: 1; min-width: 260px; }
.mon-filter-field label {
  display: block;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--red-800);
  margin-bottom: 6px;
}
.mon-filter-field select {
  width: 100%;
  padding: 10px 36px 10px 12px;
  border-radius: 12px;
  border: 1px solid #e0c8c8;
  background: #fff;
  font-family: inherit;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--red-900);
  outline: none;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238b1a1a' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
.mon-filter-field select:focus {
  border-color: rgba(224, 49, 49, 0.45);
  box-shadow: 0 0 0 4px rgba(224, 49, 49, 0.12);
}
.mon-board {
  background: rgba(255, 255, 255, 0.58);
  backdrop-filter: blur(22px) saturate(180%);
  -webkit-backdrop-filter: blur(22px) saturate(180%);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 22px;
  box-shadow: 0 12px 32px rgba(201, 42, 42, 0.12), inset 0 1px 0 rgba(255,255,255,0.75);
  padding: 16px;
  margin-bottom: 20px;
}
.mon-card {
  background: rgba(255, 255, 255, 0.88);
  border: 1px solid rgba(255, 196, 196, 0.7);
  border-radius: 16px;
  box-shadow: 0 8px 22px rgba(201, 42, 42, 0.1);
  overflow: hidden;
}
.mon-bar {
  background: linear-gradient(135deg, #ff7a82, #e85a64);
  color: #fff;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.mon-bar svg { width: 18px; height: 18px; fill: #fff; }
.mon-card-body { padding: 14px 16px 16px; }
.mon-card h2 {
  margin: 0 0 10px;
  font-size: 0.95rem;
  color: var(--red-900);
  display: flex;
  align-items: center;
  gap: 8px;
}
.mon-card h2 svg { width: 20px; height: 20px; fill: var(--red-700); }
.mon-top {
  display: grid;
  grid-template-columns: 0.95fr 1.15fr;
  gap: 14px;
  margin-bottom: 14px;
  align-items: stretch;
}
.mon-top-right { display: flex; flex-direction: column; gap: 14px; }
.mon-kpi { text-align: center; display: flex; flex-direction: column; }
.mon-kpi .mon-card-body { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.mon-gauge {
  position: relative;
  width: min(100%, 360px);
  margin: 0 auto 2px;
}
.mon-gauge-svg { width: 100%; height: auto; display: block; overflow: visible; }
.mon-gauge-tick {
  fill: var(--red-600);
  font-size: 13px;
  font-weight: 700;
  font-family: var(--font);
}
.mon-gauge-score {
  fill: var(--red-600);
  font-size: 36px;
  font-weight: 800;
  font-family: var(--font);
}
.mon-gauge-den {
  fill: #a07070;
  font-size: 15px;
  font-weight: 700;
  font-family: var(--font);
}
.mon-kpi-foot {
  margin: 6px 0 0;
  color: #6b3f3f;
  font-size: 0.86rem;
  line-height: 1.5;
}
.mon-kpi-foot b { color: var(--red-800); }
.mon-alert-split { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mon-alert-pane {
  border-radius: 14px;
  padding: 14px 10px;
  background: linear-gradient(180deg, #ffe8ea, #ffc9ce);
  color: var(--red-800);
  text-align: center;
  min-height: 148px;
  outline: 2px solid transparent;
}
.mon-alert-pane.is-active { outline-color: #e85a64; background: linear-gradient(180deg, #ffd6da, #ffb0b6); }
.mon-alert-pane strong { display: block; margin: 6px 0 4px; font-size: 0.9rem; color: var(--red-800); }
.mon-alert-pane p { margin: 0; font-size: 0.78rem; line-height: 1.45; color: var(--text-muted); }
.mon-alert-pane em {
  display: block;
  margin-top: 8px;
  font-size: 0.78rem;
  font-style: normal;
  font-weight: 700;
  color: #fff;
  background: #e85a64;
  border-radius: 999px;
  padding: 6px 8px;
}
.mon-alert-pane em.is-pass { background: #37b24d; }
.mon-alert-ico { width: 42px; height: 42px; margin: 0 auto; }
.mon-alert-ico svg { width: 42px; height: 42px; }
.mon-feedback-pane { min-height: 0; }
.mon-fb-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-top: 10px;
  padding: 7px 16px;
  border: 0;
  border-radius: 999px;
  background: #e85a64;
  color: #fff;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
}
.mon-fb-btn:hover { filter: brightness(1.06); }
.mon-fb-list {
  margin-top: 10px;
  display: grid;
  gap: 8px;
  text-align: left;
  max-height: 160px;
  overflow-y: auto;
}
.mon-fb-item {
  background: none;
  padding: 0;
}
.mon-fb-item p {
  margin: 0;
  color: var(--red-900);
  font-size: 0.8rem;
  line-height: 1.45;
  font-weight: 400;
}
.mon-fb-date {
  display: inline;
  margin-right: 6px;
  color: var(--red-700);
  font-weight: 400;
  white-space: nowrap;
}
.mon-fb-more {
  margin-top: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--red-700);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 700;
  cursor: pointer;
}
.mon-fb-more:hover { text-decoration: underline; }
body.is-modal-open { overflow: hidden; }
.mon-modal[hidden] { display: none; }
.mon-modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.mon-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(80, 20, 28, 0.45);
}
.mon-modal-card {
  position: relative;
  width: min(100%, 520px);
  max-width: 100%;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(139, 26, 26, 0.22);
  padding: 20px 20px 16px;
  overflow: hidden;
}
.mon-modal-card h3 {
  margin: 0 0 6px;
  color: var(--red-800);
  font-size: 1.15rem;
}
.mon-modal-card > p {
  margin: 0 0 12px;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.mon-modal-card label {
  display: block;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--red-800);
  margin-bottom: 6px;
}
.mon-modal-card textarea {
  width: 100%;
  resize: vertical;
  min-height: 140px;
  padding: 10px 12px;
  border: 1px solid #efc4c8;
  border-radius: 12px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--text);
  outline: none;
}
.mon-modal-card textarea:focus {
  border-color: #e85a64;
  box-shadow: 0 0 0 4px rgba(232, 90, 100, 0.16);
}
.mon-modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}
.mon-fb-view-body {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: var(--text) !important;
  font-size: 0.95rem !important;
  line-height: 1.7;
  max-height: 60vh;
  max-width: 100%;
  overflow-x: hidden;
  overflow-y: auto;
}
.mon-task { margin-bottom: 14px; }
.mon-task-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  padding: 16px 18px;
}
.mon-task h3 { margin: 0 0 8px; font-size: 1.02rem; color: var(--red-900); line-height: 1.45; }
.mon-task-count { margin: 0 0 8px; font-weight: 800; color: var(--red-700); font-size: 1.05rem; }
.mon-task-desc { margin: 0; color: #666; font-size: 0.86rem; line-height: 1.55; }
.mon-link { font-weight: 700; font-size: 0.86rem; }
.mon-budget-sub { margin: 0 0 12px; color: #777; font-size: 0.84rem; }
.mon-budget-figs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.mon-budget-figs div {
  background: linear-gradient(180deg, #fff5f5, #ffe3e6);
  border-radius: 12px;
  padding: 12px 10px;
  text-align: center;
}
.mon-budget-figs svg { width: 26px; height: 26px; fill: var(--red-700); margin-bottom: 4px; }
.mon-budget-figs span { display: block; font-size: 0.74rem; color: #888; margin-bottom: 4px; }
.mon-budget-figs strong { font-size: 1.2rem; color: var(--red-800); }
.mon-timeline { margin-bottom: 14px; padding: 14px 16px 16px; }
.mon-tl {
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  padding: 8px 4px 0;
  min-height: 86px;
}
.mon-tl-line {
  position: absolute;
  left: 18px; right: 18px; bottom: 28px;
  height: 3px;
  background: #e85a64;
}
.mon-tl-item { position: relative; z-index: 1; width: 8.3%; text-align: center; }
.mon-tl-pct {
  min-height: 16px;
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--red-800);
  margin-bottom: 6px;
}
.mon-tl-dot {
  width: 18px; height: 18px;
  margin: 0 auto 8px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid #e85a64;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.9);
}
.mon-tl-item.is-progress .mon-tl-dot { background: #ffb0b6; }
.mon-tl-item.is-done .mon-tl-dot { background: #e03131; border-color: #e03131; }
.mon-tl-item.is-empty .mon-tl-dot { border-color: #e8b4b8; }
.mon-tl-month { font-size: 0.72rem; font-weight: 700; color: var(--red-800); }
.mon-bottom { display: block; }
.mon-table-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid rgba(255, 196, 196, 0.7);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 8px 22px rgba(201, 42, 42, 0.1);
}

/* Dashboard project/task cards (CFR monitor) */
.cfr-projects { margin-bottom: 22px; }
.cfr-projects-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 2px 14px;
}
.cfr-projects-head h2 {
  margin: 0 0 4px;
  font-size: 1.2rem;
  color: var(--red-900);
}
.cfr-projects-head p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}
.cfr-card {
  background: rgba(255,255,255,0.72);
  border: 1px solid rgba(255,255,255,0.8);
  border-radius: 22px;
  box-shadow: 0 12px 36px rgba(139, 26, 26, 0.12);
  overflow: hidden;
  margin-bottom: 18px;
}
.cfr-card-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px 16px;
}
.cfr-kicker {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--red-700);
  margin-bottom: 4px;
}
.cfr-card-top h3 {
  margin: 0 0 6px;
  font-size: 1.05rem;
  color: var(--red-900);
  line-height: 1.4;
}
.cfr-card-top p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}
.cfr-card-budget { text-align: right; min-width: 160px; }
.cfr-card-budget-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--red-800);
  margin-bottom: 8px;
}
.cfr-table-wrap { overflow-x: auto; }
.cfr-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.cfr-table th {
  background: linear-gradient(135deg, #ff7a82, #e85a64);
  color: #fff;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 12px 16px;
  text-align: left;
  white-space: nowrap;
}
.cfr-table th .cfr-th-end { width: 100%; }
.cfr-link-btn {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(201, 42, 42, 0.1);
  color: var(--red-800);
  font-weight: 700;
  font-size: 0.8rem;
  white-space: nowrap;
}
.cfr-link-btn:hover { background: rgba(201, 42, 42, 0.18); color: var(--red-700); }
.cfr-th {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.cfr-th-end { justify-content: flex-end; width: 100%; }
.cfr-th svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  flex-shrink: 0;
}
.cfr-table td {
  padding: 13px 16px;
  border-bottom: 1px solid rgba(169, 30, 30, 0.08);
  vertical-align: top;
  color: var(--text);
}
.cfr-table tbody tr:nth-child(odd) { background: #fff7f7; }
.cfr-table tbody tr:nth-child(even) { background: #ffffff; }
.cfr-table tbody tr:hover { background: #ffe8e8; }
.cfr-table td a { color: var(--red-800); font-weight: 600; }

/* Dashboard status, latest note and controls. */
.mon-table-card .cfr-table {
  table-layout: fixed;
}
.mon-table-card .cfr-table th:nth-child(1) { width: 13%; }
.mon-table-card .cfr-table th:nth-child(2) { width: 23%; }
.mon-table-card .cfr-table th:nth-child(3) { width: 15%; }
.mon-table-card .cfr-table th:nth-child(4) { width: 9%; }
.mon-table-card .cfr-table th:nth-child(5) { width: 13%; }
.mon-table-card .cfr-table th:nth-child(6) { width: 12%; }
.mon-table-card .cfr-table th:nth-child(7) { width: 15%; }
.mon-table-card .cfr-table th,
.mon-table-card .cfr-table td {
  padding-left: 12px;
  padding-right: 12px;
  overflow-wrap: anywhere;
}
.mon-table-card .cfr-table th { white-space: normal; }
.mon-table-card .activity-status-cell,
.mon-table-card .mon-budget-lines {
  min-width: 0;
}
.mon-table-card .activity-status-actions {
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
}
.mon-table-card .status-action-btn {
  padding: 5px 7px;
}
.activity-latest-note {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 0.84rem;
  line-height: 1.55;
}
.activity-status-panel { max-width: 980px; margin-left: auto; margin-right: auto; }
.activity-status-edit-grid {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(260px, 1.5fr) minmax(220px, 1fr);
  gap: 22px;
  align-items: start;
}
.activity-status-edit-grid > div > .label {
  margin-bottom: 8px;
  color: var(--text-muted);
  font-size: .82rem;
  font-weight: 700;
}
.activity-status-edit-grid .activity-status-cell { min-width: 0; }
.activity-status-edit-grid .activity-status-actions { flex-direction: column; }
@media (max-width: 760px) {
  .activity-status-edit-grid { grid-template-columns: 1fr; }
}
.cfr-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  color: var(--red-800);
  white-space: nowrap;
}
.mon-budget-lines {
  display: grid;
  gap: 4px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  min-width: 11rem;
}
.mon-budget-lines > div {
  display: grid;
  grid-template-columns: 3.2rem 1fr;
  gap: 8px;
  align-items: baseline;
}
.mon-budget-lines span {
  color: #8a6a6a;
  font-size: 0.78rem;
  font-weight: 600;
}
.mon-budget-lines b {
  color: var(--red-800);
  font-weight: 700;
  text-align: right;
}
.cfr-muted { color: var(--text-muted); font-weight: 500; }
.cfr-drive {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 14px 18px 16px;
  background: rgba(255,245,245,0.7);
}
.cfr-drive-actions { display: flex; flex-wrap: wrap; gap: 8px; }

@media (max-width: 900px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-grid { grid-template-columns: 1fr; }
  .meta-grid { grid-template-columns: 1fr 1fr; }
  .meta-grid-budget { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .month-grid { grid-template-columns: repeat(3, 1fr); }
  .cfr-card-top { flex-direction: column; }
  .cfr-card-budget { text-align: left; }
  .mon-hero { flex-wrap: wrap; }
  .mon-filter { flex-direction: column; align-items: stretch; }
  .mon-filter-field, .mon-filter-project { min-width: 0; }
  .mon-top,
  .mon-task-split { grid-template-columns: 1fr; }
  .mon-alert-split { grid-template-columns: 1fr; }
  .mon-table-card .cfr-table { min-width: 1100px; }
}
@media (max-width: 640px) {
  .topbar { flex-direction: column; align-items: stretch; }
  .nav-links { justify-content: flex-start; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .charts-grid { grid-template-columns: 1fr; }
  .chart-wrap { height: 220px; }
  .meta-grid { grid-template-columns: 1fr; }
  .month-grid { grid-template-columns: 1fr 1fr; }
  .brand-sub { white-space: normal; }
  .cfr-projects-head { align-items: flex-start; flex-direction: column; }
  .mon-hero-text h1 { font-size: 1.12rem; }
  .mon-budget-figs { grid-template-columns: 1fr; }
  .mon-tl { overflow-x: auto; justify-content: flex-start; gap: 8px; }
  .mon-tl-item { width: 42px; flex: 0 0 42px; }
}
