:root {
  --bg: #f4f6fa;
  --panel: #ffffff;
  --panel-2: #edf2f8;
  --primary: #1b293d;        /* AFSA Air Force Deep Navy */
  --primary-strong: #111a27; /* Command Deep Navy */
  --primary-mid: #2a4163;    /* Aviation Mid Navy */
  --accent: #8c2424;         /* Chapter 1678 Crimson / Maroon */
  --accent-light: #fbeeed;   /* Crimson Tint */
  --accent-blue: #4a72a7;    /* AFSA Aviation Blue */
  --success: #0d9468;
  --warning: #d97706;
  --danger: #dc2626;
  --text: #1e293b;
  --muted: #64748b;
  --border: rgba(27, 41, 61, 0.12);
  --shadow: 0 16px 36px rgba(27, 41, 61, 0.09);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: radial-gradient(circle at top, #edf2f9 0%, #f4f6fa 35%, var(--bg) 100%);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.page-shell {
  max-width: 1400px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 24px;
  gap: 20px;
}

.brand-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-logo {
  height: 52px;
  max-width: 190px;
  object-fit: contain;
  display: block;
}

.dynamic-greeting {
  font-size: 1.55rem;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 2px 0;
  line-height: 1.25;
}

.header-date-badge {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--muted, #64748b);
  margin-top: 2px;
}

.brand-mark {
  min-width: 64px;
  height: 46px;
  padding: 0 12px;
  border-radius: 12px;
  display: inline-grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  border: 2px solid var(--accent);
  color: white;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  box-shadow: var(--shadow);
  flex-shrink: 0;
}

.eyebrow {
  margin: 0;
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(1.8rem, 2vw, 2.3rem);
}

.primary-btn,
.ghost-btn,
.filter-btn,
.task-toggle {
  border: none;
  border-radius: 12px;
  transition: 0.2s ease;
}

.primary-btn {
  background: linear-gradient(135deg, var(--primary), var(--primary-mid));
  color: white;
  box-shadow: 0 10px 22px rgba(27, 41, 61, 0.22);
  font-weight: 600;
  padding: 0.9rem 1.25rem;
}

.primary-btn:hover {
  background: linear-gradient(135deg, var(--primary-strong), var(--primary));
  transform: translateY(-1px);
}

.ghost-btn:hover,
.filter-btn:hover {
  transform: translateY(-1px);
}

.ghost-btn {
  background: rgba(27, 41, 61, 0.08);
  color: var(--primary);
  padding: 0.7rem 0.9rem;
  font-weight: 600;
}

.ghost-btn:hover {
  background: rgba(27, 41, 61, 0.14);
  color: var(--primary-strong);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px;
  margin-bottom: 24px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(8px);
  border: 1px solid var(--border);
  border-radius: 22px;
  box-shadow: 0 18px 35px rgba(15, 23, 42, 0.05);
  padding: 20px 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto auto 0;
  width: 100%;
  height: 4px;
  border-radius: 18px 18px 0 0;
}

.accent-blue::before { background: linear-gradient(90deg, #1b293d, #4a72a7); }
.accent-purple::before { background: linear-gradient(90deg, #8c2424, #b93838); }
.accent-gold::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.accent-green::before { background: linear-gradient(90deg, #10b981, #34d399); }

.stat-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.stat-card strong {
  font-size: clamp(1.6rem, 2vw, 2.3rem);
}

.stat-card small {
  color: var(--muted);
}

.main-grid {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr) 300px;
  gap: 24px;
  align-items: start;
}

.planner-panel,
.workspace-panel,
.insights-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.06);
  padding: 24px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.planner-panel.collapsed {
  padding-bottom: 20px;
}

.planner-panel.collapsed #event-form {
  display: none;
}

.planner-panel.collapsed #reset-form {
  display: none;
}

.planner-panel.collapsed .panel-head {
  margin-bottom: 0;
}

.planner-head {
  cursor: pointer;
  user-select: none;
  width: 100%;
}

.planner-panel .panel-head {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
}

.planner-toggle {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  background: none;
  border: none;
  padding: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
  text-align: left;
}

.planner-toggle h2 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
}

.planner-toggle-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: #edf2f9;
  color: var(--primary);
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.planner-toggle:hover .planner-toggle-icon {
  background: rgba(27, 41, 61, 0.15);
  color: var(--primary-strong);
}

.small-gap {
  margin-bottom: 12px;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.filter-btn {
  background: #edf2f9;
  color: var(--text);
  padding: 0.5rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
}

.filter-btn.active {
  background: var(--primary);
  color: white;
}

#event-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field-row {
  width: 100%;
}

.two-col {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.82rem;
}

input,
select,
textarea {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: #f8fafc;
  border-radius: 12px;
  padding: 0.9rem 1rem;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(79, 70, 229, 0.5);
  box-shadow: 0 0 0 4px rgba(99, 102, 241, 0.12);
}

textarea {
  resize: vertical;
  min-height: 110px;
}

.submit-btn {
  margin-top: 4px;
  width: 100%;
}

.event-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.event-card {
  background: linear-gradient(180deg, #ffffff 0%, #f8f9ff 100%);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.event-card:hover {
  transform: translateY(-2px);
  border-color: rgba(79, 70, 229, 0.2);
  box-shadow: 0 14px 32px rgba(15, 23, 42, 0.04);
}

.event-card.selected {
  border-color: rgba(79, 70, 229, 0.5);
  box-shadow: 0 16px 28px rgba(79, 70, 229, 0.12);
}

.event-card-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.event-card-title {
  font-size: 1.08rem;
  font-weight: 700;
}

.event-card-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  color: var(--muted);
  font-size: 0.82rem;
}

.event-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.42rem 0.7rem;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.badge-planning {
  color: #9a5b00;
  background: rgba(245, 158, 11, 0.12);
}

.badge-confirmed {
  color: #0c7c58;
  background: rgba(16, 185, 129, 0.12);
}

.badge-completed {
  color: #3545d1;
  background: rgba(79, 70, 229, 0.12);
}

.event-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.8rem;
}

.event-progress {
  width: 100%;
  height: 8px;
  background: #eef2ff;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.muted-tag {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.42rem 0.7rem;
  border-radius: 999px;
  background: #eef2ff;
  color: var(--primary-strong);
}

.task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.task-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  background: #f8fafc;
}

.task-item.done .task-label {
  text-decoration: line-through;
  color: var(--muted);
}

.task-toggle {
  width: 22px;
  height: 22px;
  min-width: 22px;
  border-radius: 7px;
  border: 2px solid rgba(79, 70, 229, 0.45);
  background: white;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.task-item.done .task-toggle {
  background: linear-gradient(135deg, var(--success), #34d399);
  border-color: transparent;
}

.task-item.done .task-toggle::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 3px;
  width: 5px;
  height: 10px;
  border: solid white;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.task-label {
  flex: 1;
  font-size: 0.88rem;
}

.task-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.task-filter-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted, #64748b);
  cursor: pointer;
  user-select: none;
}

.task-filter-toggle input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--primary, #4f46e5);
  cursor: pointer;
}

.detail-task-bar {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-bottom: 12px;
  background: #f8fafc;
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.35);
}

.detail-task-bar input[type="text"] {
  flex: 2;
  min-width: 120px;
  padding: 6px 10px;
  border: 1px solid transparent;
  background: #fff;
  border-radius: 7px;
  font-size: 0.84rem;
}

.detail-task-bar input[type="text"]:focus {
  border-color: var(--primary, #4f46e5);
  outline: none;
}

.detail-task-bar input[type="date"] {
  flex: 1;
  min-width: 110px;
  max-width: 130px;
  padding: 6px 8px;
  border: 1px solid transparent;
  background: #fff;
  border-radius: 7px;
  font-size: 0.78rem;
  color: var(--text, #1e293b);
}

.detail-task-bar button,
.detail-task-bar .primary-btn,
.detail-task-bar .small-btn {
  width: auto;
  min-width: 48px;
  height: 28px;
  padding: 4px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  border-radius: 6px;
  box-shadow: none;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0;
}

.task-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.task-deadline {
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--muted, #64748b);
}

.task-deadline.overdue {
  color: #dc2626;
  font-weight: 600;
}

.task-delete-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 1.15rem;
  line-height: 1;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.task-delete-btn:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.empty-state {
  padding: 22px 18px;
  border: 1px dashed rgba(148, 163, 184, 0.5);
  border-radius: 18px;
  color: var(--muted);
  background: rgba(148, 163, 184, 0.04);
  text-align: center;
}

.small-btn {
  margin-top: 0;
}

.template-wrap {
  display: flex;
  align-items: end;
  gap: 12px;
  width: 100%;
}

.template-wrap label {
  flex: 1;
}

.template-wrap .small-btn {
  margin-bottom: 0;
  white-space: nowrap;
}

.small-btn {
  width: auto;
  min-width: 150px;
}

.view-panel.hidden {
  display: none;
}

.landing-shell {
  display: grid;
  gap: 22px;
  padding-top: 8px;
}

.chapter-banner-wrap {
  width: 100%;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 14px 34px rgba(27, 41, 61, 0.12);
  border: 1px solid rgba(27, 41, 61, 0.15);
  margin-bottom: 22px;
  background: #1b293d;
}

.chapter-banner-img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.landing-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 28px 24px;
  border-radius: 26px;
  background: linear-gradient(135deg, rgba(27, 41, 61, 0.05), rgba(74, 114, 167, 0.1));
  border: 1px solid rgba(27, 41, 61, 0.12);
}

.landing-copy {
  max-width: 600px;
}

.landing-copy h2 {
  font-size: clamp(2rem, 3vw, 3rem);
  margin: 8px 0 12px;
}

.landing-copy p:last-child {
  color: var(--muted);
  line-height: 1.6;
}

.accent {
  color: var(--accent);
}

.landing-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.landing-highlights {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  width: 100%;
  margin: 16px 0;
}

.highlight-card {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(27, 41, 61, 0.14);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.highlight-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.9rem;
}

.highlight-content .highlight-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.highlight-content .small-btn {
  margin-top: auto;
  align-self: flex-start;
  padding: 6px 12px;
  font-size: 0.8rem;
}

.landing-panel {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.06);
  padding: 24px;
}

.landing-event-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 18px;
}

.landing-event-item {
  background: linear-gradient(180deg, #ffffff, #f8f9ff);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.landing-event-item h3 {
  font-size: 1.05rem;
}

.landing-event-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
  color: var(--muted);
  font-size: 0.82rem;
}

.landing-event-item .ghost-btn {
  margin-top: auto;
}



.detail-header {
  margin-bottom: 18px;
}

.detail-page {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 20px;
}

.detail-card {
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.06);
  padding: 24px;
}

.detail-summary {
  grid-column: 1 / -1;
}

.detail-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.5rem 0.8rem;
  background: rgba(79, 70, 229, 0.12);
  color: var(--primary-strong);
  font-weight: 700;
  margin-bottom: 18px;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}

.detail-label {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}

.detail-card textarea {
  width: 100%;
  margin-top: 10px;
}

.detail-head {
  margin-bottom: 12px;
}

#detail-task-list {
  margin-top: 8px;
}

#detail-notes {
  min-height: 180px;
}



.event-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.danger-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}

.budget-summary-card {
  grid-column: 1 / -1;
}

.budget-overview-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.budget-box {
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.budget-box span {
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.budget-box strong {
  font-size: clamp(1.2rem, 2vw, 1.8rem);
}

.budget-card {
  grid-column: 1 / -1;
}

.budget-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 20px;
}

.budget-form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-direction: row !important;
  font-weight: 600;
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.budget-table-wrap {
  overflow-x: auto;
}

.budget-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

.budget-category-row {
  background: #f8fafc;
  border-top: 2px solid rgba(148, 163, 184, 0.35);
  border-bottom: 1px solid rgba(148, 163, 184, 0.25);
}

.budget-category-row td {
  padding: 10px 12px;
}

.budget-category-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary, #4f46e5);
}

.budget-category-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted, #64748b);
  background: #e2e8f0;
  padding: 2px 8px;
  border-radius: 999px;
}

.budget-category-subtotal {
  font-size: 0.9rem;
  font-weight: 700;
  color: #1e293b;
}

.budget-item-name {
  color: #1e293b;
  font-weight: 600;
}

.budget-item-notes {
  font-size: 0.78rem;
  color: #64748b;
  margin-top: 3px;
}

.budget-item-row.editing td {
  background: #fdfdfe;
}

.budget-table th,
.budget-table td {
  text-align: left;
  padding: 12px 10px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.2);
  vertical-align: middle;
}

.budget-table th {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.budget-entry-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.budget-table input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.event-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.danger-btn {
  background: rgba(239, 68, 68, 0.1);
  color: #b91c1c;
}



.budget-status-wrap {
  margin-top: 18px;
  background: #f8fafc;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  padding: 14px 16px;
}

.budget-status-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.budget-status-bar {
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}

.budget-status-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--success), #63d6a9);
  width: 0%;
  transition: width 0.2s ease;
}

.budget-action-buttons {
  display: flex;
  align-items: center;
  gap: 10px;
}

.budget-table td input[type="number"],
.budget-table td input[type="text"] {
  width: 100%;
  min-width: 110px;
  padding: 0.6rem 0.7rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.4);
  background: #fff;
}

.budget-table td input[type="checkbox"] {
  accent-color: var(--primary);
}

.budget-status-bar.over-budget .budget-status-fill {
  background: linear-gradient(90deg, #f59e0b, #ef4444);
}

.people-panel {
  max-width: 1400px;
  margin: 24px auto 0;
  background: rgba(255, 255, 255, 0.9);
  border: 1px solid var(--border);
  border-radius: 24px;
  box-shadow: 0 24px 50px rgba(15, 23, 42, 0.06);
  padding: 24px;
}

.people-form {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-bottom: 16px;
}

.people-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.person-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 16px;
  background: #f8fafc;
  padding: 14px;
}

.person-details {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.person-details strong {
  font-size: 1rem;
}

.person-details span,
.person-details small {
  color: var(--muted);
  font-size: 0.8rem;
}

.role-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.role-card {
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 18px;
  background: linear-gradient(180deg, #ffffff, #f8f9ff);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.role-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.role-card h3 {
  font-size: 1.05rem;
}

.role-card-head span,
.role-meta {
  color: var(--muted);
  font-size: 0.78rem;
}

.role-meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.role-assigned-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.84rem;
  color: var(--muted);
}

.role-assignment-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: auto;
}

.role-assignment-form select {
  flex: 1;
  min-width: 120px;
}

.volunteer-card {
  grid-column: 1 / -1;
}

.document-form {
  display: flex;
  gap: 8px;
  align-items: flex-end;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.document-form label {
  flex: 1;
  min-width: 200px;
}

.document-form input[type="file"] {
  padding: 8px 12px;
  font-size: 14px;
}

.documents-list {
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.document-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px;
  background: linear-gradient(180deg, #ffffff, #f8f9ff);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  font-size: 14px;
}

.document-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.document-filename {
  font-weight: 600;
  color: #1e293b;
}

.document-meta {
  font-size: 12px;
  color: #64748b;
}

.document-actions {
  display: flex;
  gap: 8px;
}

.document-actions button {
  padding: 6px 12px;
  font-size: 12px;
}

/* ==========================================================================
   Responsive Design & Mobile / iPad Ergonomics
   ========================================================================== */

/* Touch & Interaction Feedback */
.primary-btn:active,
.ghost-btn:active,
.filter-btn:active,
.planner-toggle:active {
  transform: scale(0.98);
}

.task-item {
  min-height: 44px;
}

.task-delete-btn {
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* --- iPad & Tablet Layout (769px to 1120px) --- */
@media (min-width: 769px) and (max-width: 1120px) {
  .page-shell {
    padding: 24px 20px 40px;
  }

  /* Two-column layout on iPad */
  .main-grid {
    grid-template-columns: minmax(0, 1.25fr) minmax(280px, 0.95fr);
    gap: 20px;
  }

  .planner-panel {
    grid-column: 1 / -1;
  }

  .workspace-panel {
    grid-column: 1;
  }

  .insights-panel {
    grid-column: 2;
  }

  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
  }

  .detail-page {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .detail-meta-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .budget-overview-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

/* --- Mobile & Small Tablet Devices (<= 768px) --- */
@media (max-width: 768px) {
  /* Prevent iOS Safari Auto-Zoom by ensuring form inputs are at least 16px */
  input:not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Ergonomic Page Shell with Safe Area Padding */
  .page-shell {
    padding: 16px 14px max(24px, env(safe-area-inset-bottom));
  }

  /* Compact Card and Panel Padding */
  .planner-panel,
  .workspace-panel,
  .insights-panel,
  .landing-panel,
  .landing-hero,
  .detail-card,
  .people-panel {
    padding: 18px 14px;
    border-radius: 20px;
  }

  /* Header & Navigation */
  .topbar {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
    margin-bottom: 20px;
  }

  .brand-wrap {
    justify-content: flex-start;
  }

  .brand-logo {
    height: 44px;
    max-width: 145px;
  }

  .dynamic-greeting {
    font-size: 1.35rem;
  }

  /* Touch-Friendly Action Buttons */
  .landing-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    width: 100%;
  }

  .landing-actions button,
  .landing-actions .primary-btn,
  .landing-actions .ghost-btn {
    flex: 1 1 calc(50% - 6px);
    min-height: 44px;
    font-size: 0.88rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
  }

  /* 2x2 Stats Grid */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
    margin-bottom: 20px;
  }

  .stat-card {
    padding: 14px 12px;
    border-radius: 16px;
    gap: 8px;
  }

  .stat-card strong {
    font-size: 1.65rem;
  }

  /* Single Column Main Grid Flow */
  .main-grid {
    display: flex;
    flex-direction: column;
    gap: 20px;
  }

  .planner-panel,
  .workspace-panel,
  .insights-panel {
    width: 100%;
  }

  /* Form Fields */
  .two-col {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .template-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .template-wrap .small-btn {
    width: 100%;
    min-height: 42px;
  }

  /* Horizontal Filter Bar with Smooth Scrolling */
  .filters {
    width: 100%;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    flex-wrap: nowrap;
  }

  .filter-btn {
    flex-shrink: 0;
    min-height: 38px;
    padding: 8px 14px;
    font-size: 0.84rem;
  }

  /* Landing Hero Mobile */
  .landing-hero {
    flex-direction: column;
    align-items: stretch;
    gap: 16px;
  }

  .landing-copy h2 {
    font-size: 1.7rem;
  }

  .landing-highlights {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .landing-event-list {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  /* Event Details Page */
  .detail-page {
    display: flex;
    flex-direction: column;
    gap: 18px;
  }

  .detail-meta-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 14px;
  }

  .budget-overview-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .budget-form-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 14px;
  }

  .budget-action-buttons {
    display: flex;
    width: 100%;
    gap: 8px;
  }

  .budget-action-buttons button {
    flex: 1;
    min-height: 44px;
  }

  .budget-table-wrap {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    border-radius: 12px;
    border: 1px solid rgba(148, 163, 184, 0.25);
  }

  /* Task Input Bar Mobile Layout */
  .detail-task-bar {
    flex-wrap: wrap;
    gap: 8px;
    padding: 8px;
  }

  .detail-task-bar input[type="text"] {
    flex: 1 1 100%;
    min-height: 42px;
  }

  .detail-task-bar input[type="date"] {
    flex: 1;
    max-width: none;
    min-height: 42px;
  }

  .detail-task-bar button,
  .detail-task-bar .small-btn {
    min-height: 42px;
    padding: 0 18px;
  }

  /* Volunteer & Role Forms Mobile */
  .role-assignment-form {
    flex-direction: column;
    align-items: stretch;
  }

  .role-assignment-form select,
  .role-assignment-form button {
    width: 100%;
    min-height: 42px;
  }

  /* Document Upload Mobile */
  .document-form {
    flex-direction: column;
    align-items: stretch;
  }

  .document-form button {
    width: 100%;
    min-height: 44px;
  }

  .document-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .document-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .document-actions button {
    min-height: 36px;
    padding: 6px 14px;
  }
}

/* --- Ultra-Compact Phones (<= 440px) --- */
@media (max-width: 440px) {
  .detail-meta-grid {
    grid-template-columns: 1fr;
  }

  .landing-actions button,
  .landing-actions .primary-btn,
  .landing-actions .ghost-btn {
    flex: 1 1 100%;
  }

  .event-card-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }

  .event-card-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .event-card-actions {
    width: 100%;
    justify-content: stretch;
  }

  .event-card-actions button {
    flex: 1;
    text-align: center;
    min-height: 40px;
  }

  .panel-head {
    flex-direction: column;
    align-items: flex-start;
    gap: 10px;
  }
}

/* Volunteer Portal Badges & PIN styling */
.volunteer-pin-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #eff6ff;
  color: #1e40af;
  border: 1px solid #bfdbfe;
  padding: 3px 8px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.85rem;
  font-weight: 800;
}

.save-event-star-btn {
  background: #f8fafc;
  border: 1.5px solid #cbd5e1;
  color: #475569;
  border-radius: 999px;
  padding: 6px 14px;
  font-size: 0.82rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.save-event-star-btn:hover {
  background: #fffbeb;
  border-color: #f59e0b;
  color: #b45309;
}

.save-event-star-btn.saved {
  background: #fef3c7;
  border-color: #f59e0b;
  color: #92400e;
}

