@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&family=Sora:wght@500;600;700;800&display=swap");

:root {
  --bg: #f2f4f7;
  --panel: #ffffff;
  --text: #0f141a;
  --muted: #5f6b7a;
  --line: #dde3ec;
  --line-strong: #c8d0dc;
  --accent: #0d7f4f;
  --accent-strong: #07613b;
  --ok: #0d7f4f;
  --danger: #c81e1e;
  --sidebar-w: 248px;
  --sidebar-w-collapsed: 82px;
  --radius-xl: 14px;
  --radius-lg: 12px;
  --radius-md: 10px;
  --ui-fast: 180ms ease;
  --ui-med: 260ms ease;
  --ui-slow: 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
  line-height: 1.3;
}

a {
  color: inherit;
  text-decoration: none;
}

.min-w-0 {
  min-width: 0;
}

.app-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  transition: grid-template-columns var(--ui-med);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 0.7rem;
  display: flex;
  flex-direction: column;
  gap: 0.58rem;
  background: #fff;
  border-right: 1px solid var(--line);
  transition: padding var(--ui-fast), gap var(--ui-fast);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
}

.brand-logo-shell {
  width: 100%;
  max-width: 286px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.brand-logo {
  width: auto;
  height: auto;
  max-width: 100%;
  max-height: 90px;
  object-fit: contain;
  display: block;
}

.brand-copy {
  display: none;
}

.brand-title,
.brand-sub {
  display: none;
}

.sidebar-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  border-color: var(--line-strong);
  color: #31363d;
}

.nav-section-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.65px;
  color: #8b93a0;
  font-weight: 700;
  padding: 0 0.25rem;
}

.nav-side {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.nav-link-side {
  position: relative;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.45rem 0.56rem;
  border-radius: 8px;
  border: 1px solid transparent;
  color: #2f3540;
  font-size: 0.86rem;
  font-weight: 600;
  transition: background var(--ui-fast), border-color var(--ui-fast), color var(--ui-fast), padding var(--ui-fast);
}

.nav-link-side:hover {
  background: #f6f7f9;
  border-color: var(--line);
}

.nav-link-side.active {
  background: #f6f7f9;
  border-color: var(--line);
  color: #111214;
}

.nav-link-side.active::before {
  content: "";
  position: absolute;
  left: 0.24rem;
  top: 0.34rem;
  bottom: 0.34rem;
  width: 3px;
  border-radius: 999px;
  background: var(--accent);
}

.nav-icon {
  width: 1.05rem;
  text-align: center;
  color: #6d7480;
}

.nav-link-side.active .nav-icon {
  color: #111214;
}

.nav-link-side span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content-wrap {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
}

body.sidebar-collapsed .app-layout,
html.sidebar-collapsed .app-layout {
  grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
}

body.sidebar-collapsed .brand,
html.sidebar-collapsed .brand {
  padding: 0.3rem;
}

body.sidebar-collapsed .nav-section-label,
body.sidebar-collapsed .nav-link-side span,
body.sidebar-collapsed .sidebar-toggle-btn span,
html.sidebar-collapsed .nav-section-label,
html.sidebar-collapsed .nav-link-side span,
html.sidebar-collapsed .sidebar-toggle-btn span {
  display: none;
}

body.sidebar-collapsed .brand-logo-shell,
html.sidebar-collapsed .brand-logo-shell {
  width: min(100%, 64px);
  min-height: 62px;
}

body.sidebar-collapsed .nav-link-side,
body.sidebar-collapsed .sidebar-toggle-btn,
html.sidebar-collapsed .nav-link-side,
html.sidebar-collapsed .sidebar-toggle-btn {
  justify-content: center;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 1040;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.58rem;
  padding: 0.64rem 0.9rem;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.topbar-title {
  margin: 0;
  font-size: clamp(0.98rem, 1.7vw, 1.08rem);
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: 0;
  color: #111214;
  overflow-wrap: anywhere;
}

.topbar-actions {
  min-height: 2rem;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.5rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #3a4250;
  font-size: 0.72rem;
  font-weight: 600;
  max-width: min(64vw, 560px);
}

.user-pill-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-trigger {
  border-color: var(--line-strong);
  color: #2d323a;
}

.page-content {
  width: 100%;
  max-width: 100%;
  padding: 0.82rem;
}

body.sidebar-collapsed .page-content,
html.sidebar-collapsed .page-content {
  padding-left: 1.02rem;
  padding-right: 1.02rem;
}

.page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  margin-bottom: 0.62rem;
}

.section-tag {
  margin: 0;
  font-size: 0.66rem;
  letter-spacing: 0.6px;
  text-transform: uppercase;
  font-weight: 700;
  color: #848b96;
}

.page-title {
  margin: 0.12rem 0 0;
  font-size: clamp(1.08rem, 2.05vw, 1.3rem);
  line-height: 1.2;
  font-weight: 700;
  color: #111214;
}

.page-subtitle {
  margin: 0.14rem 0 0;
  max-width: 62ch;
  color: #717987;
  font-size: 0.8rem;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  box-shadow: 0 1px 0 rgba(17, 19, 24, 0.02);
}

.btn {
  border-radius: 7px;
  font-weight: 600;
}

.btn-primary {
  background: #111214;
  border: 1px solid #111214;
  color: #fff;
}

.btn-primary:hover,
.btn-primary:focus {
  background: #000;
  border-color: #000;
}

.btn-ghost,
.btn-outline-secondary {
  background: #fff;
  border: 1px solid var(--line-strong);
  color: #1e232b;
}

.btn-ghost:hover,
.btn-outline-secondary:hover {
  background: #f6f7f9;
  border-color: var(--line-strong);
}

.form-control,
.form-select,
.form-control-color,
.choices__inner {
  min-height: 36px;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  color: #111214;
  background: #fff;
}

.form-control::placeholder {
  color: #8c949f;
}

.form-control:focus,
.form-select:focus,
.form-control-color:focus,
.btn:focus-visible {
  border-color: #aab2bf;
  box-shadow: 0 0 0 0.16rem rgba(17, 18, 20, 0.08);
}

.form-label,
.form-label.small,
.stack-controls label.small,
.stack-controls .small.fw-semibold {
  color: #596272 !important;
  font-size: 0.71rem !important;
  letter-spacing: 0.45px;
  text-transform: uppercase;
  font-weight: 700 !important;
}

.compact-toggle-row {
  padding: 0.1rem 0.12rem;
}

.compact-toggle-row .form-check-input {
  width: 2rem;
  height: 1rem;
  cursor: pointer;
}

#calendarCount {
  color: #4d5563;
  font-size: 0.72rem;
  font-weight: 600;
}

.calendar-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  gap: 0.75rem;
  align-items: stretch;
  transition: grid-template-columns var(--ui-med);
}

.calendar-layout.filters-collapsed {
  grid-template-columns: var(--sidebar-w-collapsed) minmax(0, 1fr);
}

.calendar-side,
.calendar-main {
  min-width: 0;
}

.calendar-filter-panel {
  transition: padding var(--ui-fast), gap var(--ui-fast);
}

.calendar-filter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.45rem;
}

.calendar-filter-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  white-space: nowrap;
}

.calendar-filter-panel.filters-collapsed {
  padding: 0.52rem 0.46rem !important;
}

.calendar-filter-panel.filters-collapsed .calendar-filter-head {
  margin-bottom: 0 !important;
  justify-content: center;
}

.calendar-filter-panel.filters-collapsed .section-tag {
  display: none;
}

.calendar-filter-panel.filters-collapsed .calendar-filter-toggle {
  width: 100%;
}

.calendar-filter-panel.filters-collapsed .calendar-filter-toggle .btn-label {
  display: none;
}

.calendar-filter-panel.filters-collapsed #calendarFiltersBody {
  display: none;
}

.stack-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.68rem;
  margin-bottom: 0.8rem;
  border: 1px solid var(--line);
  background: #fcfcfd;
}

.stack-controls > * {
  min-width: 0;
}

.control-w-xs {
  width: 90px;
}

.control-w-sm {
  width: 160px;
}

.control-w-md {
  width: 240px;
}

.stack-controls .form-control.form-control-sm,
.stack-controls .form-select.form-select-sm {
  max-width: 100%;
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.55rem;
  margin-bottom: 0.8rem;
}

.kpi-card {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 1px solid #111214;
  border-radius: var(--radius-lg);
  padding: 0.56rem;
}

.kpi-card .label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.58px;
  font-weight: 700;
  color: #747c87;
}

.kpi-card .value {
  margin-top: 0.12rem;
  font-size: clamp(1.08rem, 2.1vw, 1.42rem);
  line-height: 1.1;
  font-weight: 700;
  color: #111214;
}

.board {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.7rem;
}

.board-col {
  min-height: 300px;
  padding: 0.52rem;
}

.board-col--ongoing {
  border-top: 2px solid var(--ok);
}

.board-col--future {
  border-top: 2px solid #111214;
}

.board-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.52rem;
}

.board-head h3 {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.2;
  font-weight: 700;
}

.counter-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.54rem;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: #444d59;
  font-size: 0.72rem;
  font-weight: 700;
}

.trip-list {
  display: grid;
  gap: 0.48rem;
}

.trip-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0.42rem;
  box-shadow: none;
}

.trip-top {
  margin-bottom: 0.15rem;
}

.trip-destination {
  font-size: 0.91rem;
  line-height: 1.18;
  font-weight: 700;
  color: #111214;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.trip-link {
  color: inherit;
  text-decoration: none;
}

.trip-link:hover {
  text-decoration: underline;
}

.trip-destination .trip-inline-time {
  font-weight: 700;
}

.trip-dates {
  margin-top: 0.04rem;
  font-size: 0.68rem;
  font-weight: 700;
  color: #7b838f;
  overflow-wrap: anywhere;
}

.trip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.24rem;
  margin-bottom: 0.18rem;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0.07rem 0.4rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f7f8fa;
  color: #39414d;
  font-size: 0.64rem;
  font-weight: 600;
}

.trip-note {
  margin-bottom: 0.2rem;
  color: #596272;
  font-size: 0.74rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.trip-actions {
  display: flex;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 0.3rem;
}

.attachment-list {
  display: grid;
  gap: 0.42rem;
}

.attachment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.44rem 0.52rem;
  background: #fff;
}

.attachment-main {
  min-width: 0;
}

.attachment-name {
  display: inline-block;
  max-width: 100%;
  color: #1f2a37;
  font-size: 0.82rem;
  font-weight: 600;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.attachment-name:hover {
  text-decoration: underline;
}

.attachment-meta {
  margin-top: 0.08rem;
  color: #69707d;
  font-size: 0.69rem;
}

.attachment-actions {
  display: inline-flex;
  align-items: center;
  gap: 0.28rem;
}

.btn-icon {
  width: 1.75rem;
  height: 1.75rem;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.timeline {
  display: grid;
  gap: 0.65rem;
}

.timeline-month {
  background: #fff;
  border: 1px solid var(--line);
  border-left: 2px solid #111214;
  border-radius: var(--radius-lg);
  padding: 0.56rem;
}

.timeline-title {
  margin: 0 0 0.42rem;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.58px;
  font-weight: 700;
  color: #757d88;
}

.member-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 0.6rem;
}

.member-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.62rem;
}

.member-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.4rem;
}

.member-name {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.2;
  font-weight: 700;
  color: #111214;
  overflow-wrap: anywhere;
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  border: 1px solid rgba(0, 0, 0, 0.24);
}

.chart-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.7rem;
}

.chart-panel {
  min-height: 320px;
  padding: 0.72rem;
}

.chart-panel canvas {
  width: 100% !important;
  height: 290px !important;
}

.table-responsive,
.table {
  border-radius: 10px;
  overflow: hidden;
}

.table > :not(caption) > * > * {
  border-color: var(--line);
}

.table thead th {
  background: #f7f8fa;
  color: #414a56;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.audit-table td,
.audit-table th {
  vertical-align: middle;
}

.audit-table tbody tr:hover {
  background: #fbfcfd;
}

.audit-day-row td {
  padding: 0.35rem 0.45rem;
  background: #f4f6f8;
  border-top: 1px solid var(--line) !important;
}

.audit-day-toggle {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 0.5rem;
  font-weight: 700;
  color: #253041;
  padding: 0.18rem 0.28rem;
}

.audit-day-toggle .badge {
  margin-left: auto;
}

.audit-summary {
  min-width: 180px;
  max-width: 640px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.audit-actor-name {
  color: #1f2937;
  font-weight: 700;
}

.audit-summary-main {
  color: #1f2937;
  font-weight: 600;
}

.audit-meta {
  margin-top: 0.12rem;
  font-size: 0.68rem;
  color: #6b7280;
  line-height: 1.2;
}

.audit-kpi-latest {
  font-size: 0.95rem !important;
  line-height: 1.25;
}

.audit-details-pre {
  max-height: min(56vh, 440px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.68rem;
  background: #f7f8fa;
  color: #2d3745;
  font-size: 0.78rem;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}

.audit-details-content {
  display: grid;
  gap: 0.62rem;
}

.audit-detail-section {
  border: 1px solid #d7e1ec;
  border-radius: 10px;
  background: #f9fbfe;
  padding: 0.58rem 0.62rem;
}

.audit-detail-title {
  margin: 0 0 0.4rem;
  font-size: 0.78rem;
  font-weight: 700;
  color: #223244;
}

.audit-subsection + .audit-subsection {
  margin-top: 0.52rem;
}

.audit-subtitle {
  margin-bottom: 0.28rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.45px;
  color: #54657b;
}

.audit-summary-block {
  margin-top: 0.46rem;
  padding: 0.44rem 0.5rem;
  border: 1px dashed #cfdbea;
  border-radius: 8px;
  background: #ffffff;
  font-size: 0.78rem;
  color: #1f2f41;
  overflow-wrap: anywhere;
}

.audit-kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.44rem;
}

.audit-kv-item {
  border: 1px solid #d9e3ef;
  border-radius: 8px;
  background: #fff;
  padding: 0.38rem 0.44rem;
  min-width: 0;
}

.audit-kv-key {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.46px;
  color: #5a6c83;
}

.audit-kv-value {
  margin-top: 0.18rem;
  font-size: 0.78rem;
  line-height: 1.28;
  color: #1c2b3d;
  overflow-wrap: anywhere;
}

.audit-json-mini {
  margin: 0;
  max-height: 180px;
  overflow: auto;
  border: 1px solid #d8e3ef;
  border-radius: 7px;
  padding: 0.34rem 0.4rem;
  background: #f7f9fc;
  font-size: 0.71rem;
  line-height: 1.34;
  white-space: pre-wrap;
  word-break: break-word;
}

.audit-changes-wrap {
  border: 1px solid #d8e3ef;
  border-radius: 9px;
}

.audit-changes-table thead th {
  background: #eef3f9;
  color: #3f5168;
}

.audit-changes-table td {
  vertical-align: top;
}

@media (max-width: 768px) {
  .audit-kv-grid {
    grid-template-columns: 1fr;
  }
}

.swatch {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1px solid var(--line);
  display: inline-block;
  vertical-align: middle;
}

.choices__inner {
  padding: 0.14rem 0.3rem;
}

.choices__list--multiple .choices__item {
  border: 1px solid var(--line);
  background: #f7f8fa;
  color: #38424f;
  border-radius: 999px;
  font-size: 0.68rem;
}

.fc {
  --fc-border-color: var(--line);
  --fc-page-bg-color: transparent;
  --fc-neutral-bg-color: transparent;
  --fc-today-bg-color: rgba(0, 0, 0, 0.05);
}

.fc .fc-toolbar-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: #111214;
}

.fc .fc-button {
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  font-weight: 600;
  background: #fff;
  color: #1f252d;
  padding: 0.2rem 0.5rem;
  font-size: 0.74rem;
}

.fc .fc-button-primary {
  background: #fff;
  border-color: var(--line-strong);
  color: #1f252d;
}

.fc .fc-button-primary:not(:disabled).fc-button-active,
.fc .fc-button-primary:not(:disabled):active {
  background: #111214;
  border-color: #111214;
  color: #fff;
}

.fc .fc-event {
  border-radius: 5px;
  cursor: pointer;
}

.fc .fc-daygrid-day-events {
  margin-top: 1px;
  margin-bottom: 2px;
}

.fc .fc-daygrid-event-harness {
  margin-top: 1px;
}

.fc .fc-daygrid-day-frame {
  min-height: 88px;
  height: auto;
}

.fc .fc-event-title,
.fc .fc-event-main {
  white-space: normal;
  word-break: break-word;
}

.fc .fc-event-main {
  padding: 1px 3px;
}

.fc .fc-event-card {
  display: grid;
  gap: 1px;
  line-height: 1.15;
}

.fc .fc-event-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 4px;
}

.fc .fc-event-top .fc-event-dest {
  min-width: 0;
  flex: 1 1 auto;
}

.fc .fc-event-dest {
  font-size: 0.67rem;
  font-weight: 700;
}

.fc .fc-status-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  padding: 0 5px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background: rgba(255, 255, 255, 0.92);
  color: #1d2735;
  font-size: 0.46rem;
  font-weight: 800;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  line-height: 1.25;
  white-space: nowrap;
}

.fc .fc-status-tag--approved {
  background: rgba(214, 246, 228, 0.96);
  border-color: rgba(25, 135, 84, 0.38);
  color: #0f5132;
}

.fc .fc-status-tag--unconfirmed {
  background: rgba(255, 224, 226, 0.96);
  border-color: rgba(220, 53, 69, 0.38);
  color: #842029;
}

.fc .fc-activity-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  width: fit-content;
  padding: 1px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.9);
  color: #111214;
  font-size: 0.54rem;
  font-weight: 700;
  line-height: 1.15;
}

.fc .fc-event-sub {
  font-size: 0.57rem;
  opacity: 0.9;
}

.calendar-compact .fc .fc-toolbar-title {
  font-size: 0.82rem;
}

.calendar-compact .fc .fc-button {
  padding: 0.14rem 0.42rem;
  font-size: 0.69rem;
}

.calendar-compact .fc .fc-daygrid-day-number {
  font-size: 0.72rem;
  padding: 1px 4px;
}

.calendar-compact .fc .fc-event-main {
  padding: 0 2px;
}

.calendar-compact .fc .fc-event-dest {
  font-size: 0.61rem;
}

.calendar-compact .fc .fc-status-tag {
  padding: 0 4px;
  font-size: 0.42rem;
}

.calendar-compact .fc .fc-activity-pill {
  font-size: 0.5rem;
  padding: 0 4px;
}

.cal-activity-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f5f7f9;
  color: #2f3744;
  font-size: 0.6rem;
  font-weight: 600;
}

.fc .past-event {
  opacity: 0.55;
}

.modal-content {
  border-radius: 10px;
  border: 1px solid var(--line);
}

.offcanvas {
  background: #fff;
  color: #111214;
}

.offcanvas .offcanvas-header {
  border-bottom: 1px solid var(--line);
}

.offcanvas .offcanvas-body {
  padding-top: 0.8rem;
}

.mobile-brand-logo {
  width: auto;
  height: auto;
  max-width: clamp(210px, 52vw, 300px);
  max-height: 90px;
  object-fit: contain;
  display: block;
}

.toast-zone {
  z-index: 1080;
}

.error-wrap {
  min-height: calc(100vh - 6rem);
  display: grid;
  place-items: center;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: radial-gradient(1200px 400px at 50% -10%, #ffffff, var(--bg));
}

.login-card {
  width: min(440px, 100%);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 1rem;
}

.login-logo {
  width: auto;
  height: auto;
  max-width: clamp(240px, 52vw, 360px);
  max-height: 98px;
  object-fit: contain;
  display: block;
}

.error-card {
  width: min(560px, 96%);
  padding: 1.6rem 1.1rem;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #fff;
  text-align: center;
}

.error-code {
  font-size: clamp(2.4rem, 8vw, 4rem);
  line-height: 1;
  color: var(--danger);
  font-weight: 800;
}

/* Global visual refresh: light, minimal, higher readability */
body {
  background:
    radial-gradient(900px 260px at 10% -40%, #ffffff 0%, rgba(255, 255, 255, 0) 70%),
    radial-gradient(900px 240px at 90% -40%, #ffffff 0%, rgba(255, 255, 255, 0) 70%),
    var(--bg);
}

.app-layout {
  gap: 0.58rem;
  padding: 0.58rem;
}

.sidebar {
  margin: 0;
  height: calc(100vh - 1.16rem);
  border-radius: 16px;
  border: 1px solid var(--line);
  box-shadow: 0 6px 20px rgba(15, 20, 26, 0.05);
}

.content-wrap {
  min-height: calc(100vh - 1.16rem);
}

.topbar {
  top: 0;
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 6px 16px rgba(15, 20, 26, 0.04);
  padding: 0.72rem 0.92rem;
}

.topbar-title {
  font-weight: 700;
  letter-spacing: -0.01em;
}

.page-content {
  padding: 0.86rem 0.08rem 1.2rem;
}

body.sidebar-collapsed .page-content,
html.sidebar-collapsed .page-content {
  padding-left: 0.08rem;
  padding-right: 0.08rem;
}

.section-tag {
  color: #798393;
  letter-spacing: 0.5px;
}

.page-title {
  font-size: clamp(1.14rem, 2.2vw, 1.42rem);
  letter-spacing: -0.015em;
}

.page-subtitle {
  color: #667486;
  font-size: 0.82rem;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(15, 20, 26, 0.04);
}

.btn {
  border-radius: 10px;
  min-height: 36px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.btn-sm {
  min-height: 32px;
}

.btn-primary {
  background: #11161d;
  border-color: #11161d;
}

.btn-primary:hover,
.btn-primary:focus {
  background: #0a0f14;
  border-color: #0a0f14;
}

.btn-ghost,
.btn-outline-secondary {
  color: #1a212c;
  border-color: #cfd7e3;
  background: #fff;
}

.btn-ghost:hover,
.btn-outline-secondary:hover {
  background: #f7f9fc;
  border-color: #c1cbda;
}

.stack-controls {
  background: #fff;
  border-radius: 14px;
  padding: 0.72rem;
  gap: 0.56rem;
}

.form-control,
.form-select,
.form-control-color,
.choices__inner {
  min-height: 38px;
  border-radius: 10px;
}

.board {
  gap: 0.82rem;
}

.board-col {
  padding: 0.64rem;
  min-height: 320px;
}

.board-col--ongoing,
.board-col--future {
  border-top-width: 1px;
}

.trip-card {
  border-radius: 11px;
  padding: 0.52rem;
}

.trip-destination {
  font-size: 0.92rem;
  letter-spacing: -0.01em;
}

.trip-dates {
  font-size: 0.7rem;
  color: #707b8b;
}

.chip {
  border-radius: 999px;
  background: #f6f8fb;
  border-color: #d9e1ec;
  color: #334152;
}

.timeline-month {
  border-left-width: 1px;
  border-radius: 14px;
}

.member-card {
  border-radius: 12px;
}

.kpi-card {
  border-left-width: 1px;
  border-radius: 12px;
  padding: 0.68rem;
}

.kpi-card .value {
  letter-spacing: -0.02em;
}

.table {
  border: 1px solid var(--line);
  background: #fff;
}

.table thead th {
  background: #f5f7fb;
  color: #4a5667;
  font-size: 0.69rem;
}

.calendar-layout {
  gap: 0.82rem;
}

.calendar-filter-panel {
  border-radius: 14px;
}

.fc .fc-toolbar-title {
  font-size: 0.94rem;
  font-weight: 700;
}

.fc .fc-event {
  border-radius: 7px;
}

.fc .fc-event-dest {
  font-size: 0.66rem;
}

.fc .fc-event-sub {
  font-size: 0.56rem;
}

.modal-content {
  border-radius: 14px;
}

.login-shell {
  background:
    radial-gradient(800px 260px at 50% -15%, #ffffff, rgba(255, 255, 255, 0)),
    var(--bg);
}

.login-card {
  border-radius: 16px;
  box-shadow: 0 10px 28px rgba(15, 20, 26, 0.08);
}

/* Uniformity pass: all boxes/sections share the same visual language */
:is(.panel, .kpi-card, .trip-card, .timeline-month, .member-card, .attachment-row, .error-card, .login-card) {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 4px 14px rgba(15, 20, 26, 0.04);
}

.board-col--ongoing,
.board-col--future,
.timeline-month,
.kpi-card {
  border-top: 1px solid var(--line) !important;
  border-left: 1px solid var(--line) !important;
}

.page-content > section,
.page-content > div.calendar-layout,
.page-content > div.error-wrap {
  margin-bottom: 0.82rem;
}

.page-content > section:last-child,
.page-content > div.calendar-layout:last-child,
.page-content > div.error-wrap:last-child {
  margin-bottom: 0;
}

.panel h3,
.timeline-title,
.board-head h3 {
  letter-spacing: -0.01em;
  color: #11161d;
}

.table-responsive {
  border-radius: 12px;
}

/* Motion and micro-interactions */
@keyframes uiFadeSlideIn {
  from {
    opacity: 0;
    transform: translate3d(0, 10px, 0) scale(0.995);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.ui-reveal {
  opacity: 0;
  transform: translate3d(0, 10px, 0) scale(0.995);
}

.ui-reveal.is-in {
  animation: uiFadeSlideIn var(--ui-slow) both;
  animation-delay: var(--reveal-delay, 0ms);
}

.nav-link-side,
.btn,
.chip,
.counter-pill,
.trip-card,
.kpi-card,
.timeline-month,
.member-card,
.attachment-row,
.table tbody tr {
  transition:
    transform var(--ui-fast),
    box-shadow var(--ui-med),
    border-color var(--ui-fast),
    background-color var(--ui-fast),
    color var(--ui-fast);
}

.nav-link-side:hover {
  transform: translateX(2px);
}

.nav-link-side.active {
  box-shadow: inset 0 0 0 1px rgba(17, 22, 29, 0.04);
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 14px rgba(15, 20, 26, 0.08);
}

.btn:active {
  transform: translateY(0);
}

.btn:focus-visible {
  outline: none;
}

:is(.trip-card, .kpi-card, .timeline-month, .member-card, .attachment-row):hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(15, 20, 26, 0.08);
  border-color: #c9d3e1;
}

.chip:hover,
.counter-pill:hover {
  border-color: #c7d2df;
  background: #f1f5fa;
}

.table tbody tr:hover {
  transform: translateY(-1px);
}

.topbar,
.sidebar {
  transition: box-shadow var(--ui-med), border-color var(--ui-fast), background-color var(--ui-fast);
}

.topbar:hover,
.sidebar:hover {
  box-shadow: 0 10px 24px rgba(15, 20, 26, 0.06);
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}

body.motion-reduce .ui-reveal,
body.motion-reduce .ui-reveal.is-in {
  opacity: 1 !important;
  transform: none !important;
  animation: none !important;
}

@media (max-width: 1200px) {
  .dashboard-board {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-grid {
    grid-template-columns: 1fr;
  }

  .calendar-layout,
  .calendar-layout.filters-collapsed {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1100px) {
  .board {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 991.98px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  body.sidebar-collapsed .app-layout,
  html.sidebar-collapsed .app-layout {
    grid-template-columns: 1fr;
  }

  .page-content {
    padding: 0.84rem;
  }

  .control-w-xs,
  .control-w-sm,
  .control-w-md {
    width: 100%;
  }

  .stack-controls .ms-auto {
    margin-left: 0 !important;
  }
}

@media (max-width: 768px) {
  .topbar {
    padding: 0.62rem 0.78rem;
    align-items: flex-start;
  }

  .topbar-title {
    font-size: 0.96rem;
  }

  .page-subtitle {
    display: none;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .stack-controls {
    align-items: stretch;
  }

  .stack-controls .btn,
  .stack-controls .form-control,
  .stack-controls .form-select,
  .stack-controls .small {
    width: 100%;
  }

  .page-head .btn {
    width: 100%;
  }

  .attachment-row {
    flex-direction: column;
    align-items: flex-start;
  }

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

/* Aesthetic v2: login + dashboard + calendar */
.topbar-title,
.page-title,
.board-head h3,
.login-title,
.login-hero-title,
.fc .fc-toolbar-title {
  font-family: "Sora", "Manrope", "Segoe UI", system-ui, -apple-system, sans-serif;
}

/* Login */
body.login-page {
  background:
    radial-gradient(1200px 520px at 10% -15%, #fff4dc 0%, rgba(255, 244, 220, 0) 62%),
    radial-gradient(900px 380px at 100% 110%, #d8efe5 0%, rgba(216, 239, 229, 0) 62%),
    #eef3f8;
}

.login-shell {
  padding: clamp(0.9rem, 2.5vw, 1.8rem);
}

.login-stage {
  width: min(980px, 100%);
  display: grid;
  grid-template-columns: 1.15fr 0.95fr;
  gap: 1rem;
  align-items: stretch;
}

.login-brand-panel {
  border-radius: 22px;
  padding: 1.45rem 1.3rem;
  border: 1px solid rgba(15, 22, 29, 0.08);
  background:
    radial-gradient(520px 160px at 6% 0%, rgba(255, 218, 153, 0.36), rgba(255, 218, 153, 0)),
    radial-gradient(540px 180px at 100% 100%, rgba(102, 176, 142, 0.28), rgba(102, 176, 142, 0)),
    linear-gradient(156deg, #0f1d2b 0%, #162534 60%, #1f2f40 100%);
  color: #eef4fb;
  box-shadow: 0 20px 42px rgba(15, 22, 29, 0.22);
  display: grid;
  align-content: center;
  gap: 0.8rem;
}

.login-brand-panel .login-logo {
  max-width: clamp(270px, 56vw, 420px);
  max-height: 118px;
  filter: brightness(0) invert(1);
}

.login-kicker {
  display: inline-flex;
  width: fit-content;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.26);
  background: rgba(255, 255, 255, 0.08);
  color: #f3f7fd;
  padding: 0.18rem 0.62rem;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-hero-title {
  margin: 0;
  font-size: clamp(1.2rem, 2.6vw, 1.84rem);
  line-height: 1.16;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.login-hero-subtitle {
  margin: 0;
  color: rgba(238, 244, 251, 0.88);
  font-size: 0.9rem;
  max-width: 44ch;
}

.login-feature-list {
  display: grid;
  gap: 0.44rem;
  margin-top: 0.24rem;
}

.login-feature-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: rgba(238, 244, 251, 0.96);
  font-size: 0.8rem;
  font-weight: 600;
}

.login-feature-item i {
  width: 1.32rem;
  height: 1.32rem;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.12);
}

.login-card {
  width: 100%;
  border-radius: 22px;
  border: 1px solid #d8e2ed;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(4px);
  box-shadow: 0 18px 40px rgba(15, 22, 29, 0.12);
  padding: 1.2rem 1.1rem;
}

.login-card-head {
  margin-bottom: 0.45rem;
}

.login-title {
  margin: 0;
  font-size: 1.16rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.login-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: #667588;
}

.login-page .form-label {
  color: #4f5e72 !important;
}

.login-guest-btn i {
  margin-right: 0.2rem;
}

/* Dashboard */
.dashboard-head {
  margin-bottom: 0.72rem;
  padding: 0.9rem 1rem;
  border-radius: 18px;
  border: 1px solid #d7e1ec;
  background:
    radial-gradient(420px 140px at 0% 0%, rgba(255, 223, 169, 0.35), rgba(255, 223, 169, 0)),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.dashboard-head .section-tag {
  color: #5f6f85;
}

.dashboard-head .page-title {
  font-size: clamp(1.2rem, 2.8vw, 1.58rem);
}

.dashboard-controls {
  border-radius: 16px;
  border-color: #d9e2ee;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(248, 251, 255, 0.96));
  box-shadow: 0 8px 20px rgba(15, 22, 29, 0.05);
}

.dashboard-board {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.95rem;
}

.dashboard-board.dashboard-board--no-drafts {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dashboard-column {
  border-radius: 18px;
  border: 1px solid #d8e2ed !important;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98));
  box-shadow: 0 10px 24px rgba(15, 22, 29, 0.06);
  min-width: 0;
  transition: padding 0.18s ease;
}

.dashboard-column.board-col--draft {
  border-top: 1px solid #d8e2ed !important;
  border-left: 4px solid #6d7a8a !important;
}

.dashboard-column.board-col--ongoing {
  border-top: 1px solid #d8e2ed !important;
  border-left: 4px solid #2d8f66 !important;
}

.dashboard-column.board-col--future {
  border-top: 1px solid #d8e2ed !important;
  border-left: 4px solid #c58b2d !important;
}

.dashboard-column .board-head {
  margin-bottom: 0.62rem;
}

.board-head-tools {
  display: inline-flex;
  align-items: center;
  gap: 0.34rem;
}

.dashboard-collapse-btn {
  width: 1.72rem;
  height: 1.72rem;
  border: 1px solid #c8d5e4;
  border-radius: 9px;
  background: #ffffff;
  color: #2f4460;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.dashboard-collapse-btn:hover {
  border-color: #a9bdd3;
  background: #f2f7fd;
}

.dashboard-collapse-btn i {
  font-size: 0.76rem;
}

.dashboard-column .counter-pill {
  background: #ffffff;
  border-color: #cfd9e4;
}

.dashboard-column.is-collapsed {
  padding: 0.5rem 0.36rem;
  overflow: hidden;
}

.dashboard-column.is-collapsed .trip-list {
  display: none;
}

.dashboard-column.is-collapsed .board-head {
  min-height: 220px;
  margin-bottom: 0;
  flex-direction: column;
  align-items: center;
  justify-content: flex-start;
  gap: 0.34rem;
}

.dashboard-column.is-collapsed .board-head h3 {
  writing-mode: vertical-rl;
  transform: rotate(180deg);
  text-align: center;
  line-height: 1;
  margin: 0;
  font-size: 0.78rem;
}

.dashboard-column.is-collapsed .board-head-tools {
  flex-direction: column;
  gap: 0.3rem;
}

.dashboard-column.is-collapsed .counter-pill {
  min-width: 1.78rem;
  justify-content: center;
  padding: 0.14rem 0.24rem;
  font-size: 0.68rem;
}

.dashboard-trip-card {
  border-radius: 14px;
  border-color: #d6dfeb;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(15, 22, 29, 0.06);
}

.dashboard-trip-card:hover {
  border-color: #bfcddf;
}

.dashboard-column .trip-card.ui-reveal {
  opacity: 1;
  transform: none;
}

.dashboard-column .trip-card.ui-reveal.is-in {
  animation: none;
}

.mission-form-modal,
.dashboard-mission-modal {
  border-radius: 16px;
  border: 1px solid #d8e3ef;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.99));
  box-shadow: 0 16px 30px rgba(15, 22, 29, 0.12);
}

.mission-form-dialog {
  --bs-modal-width: min(1240px, 96vw);
}

.mission-form-modal .modal-header,
.dashboard-mission-modal .modal-header {
  align-items: flex-start;
  padding: 0.58rem 0.78rem;
  border-bottom: 1px solid #d9e3ef;
  background:
    radial-gradient(420px 120px at 0% 0%, rgba(170, 214, 196, 0.24), rgba(170, 214, 196, 0)),
    linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.mission-form-modal .modal-title,
.dashboard-mission-modal .modal-title {
  margin: 0.12rem 0 0;
  font-size: 0.98rem;
  color: #243549;
}

.dashboard-mission-modal-subtitle {
  margin-top: 0.08rem;
  font-size: 0.76rem;
  line-height: 1.28;
}

.mission-form-modal .modal-body,
.dashboard-mission-modal .modal-body {
  padding: 0.66rem 0.78rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.96));
}

.mission-form-modal .modal-footer,
.dashboard-mission-modal .modal-footer {
  padding: 0.56rem 0.78rem;
  border-top: 1px solid #d9e3ef;
  background: #f7fafd;
}

.mission-form-grid,
.dashboard-mission-grid {
  row-gap: 0.56rem;
}

.dashboard-mission-section-title {
  padding-bottom: 0.22rem;
  border-bottom: 1px dashed #d3deea;
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.56px;
  text-transform: uppercase;
  color: #5f6f85;
}

.mission-form-grid .form-label,
.dashboard-mission-grid .form-label {
  margin-bottom: 0.22rem;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  color: #495a71;
}

.mission-form-grid .form-control,
.mission-form-grid .form-select,
.mission-form-grid .choices__inner,
.dashboard-mission-grid .form-control,
.dashboard-mission-grid .form-select,
.dashboard-mission-grid .choices__inner {
  min-height: 32px;
  border-color: #bfd0e1;
}

.mission-form-grid .choices__inner,
.dashboard-mission-grid .choices__inner {
  max-height: 72px;
  overflow: auto;
}

.mission-form-grid .form-control:focus,
.mission-form-grid .form-select:focus,
.dashboard-mission-grid .form-control:focus,
.dashboard-mission-grid .form-select:focus {
  border-color: #8ea5c0;
  box-shadow: 0 0 0 0.14rem rgba(73, 104, 142, 0.18);
}

.mission-form-grid textarea.form-control,
.dashboard-mission-grid textarea.form-control {
  min-height: 40px;
  resize: vertical;
}

@media (max-width: 991.98px) {
  .mission-form-dialog {
    --bs-modal-width: 96vw;
  }

  .mission-form-modal .modal-header,
  .mission-form-modal .modal-body,
  .mission-form-modal .modal-footer {
    padding-left: 0.7rem;
    padding-right: 0.7rem;
  }
}

/* Calendar */
.calendar-head {
  margin-bottom: 0.72rem;
  padding: 0.88rem 0.96rem;
  border-radius: 18px;
  border: 1px solid #d7e2ef;
  background:
    radial-gradient(420px 120px at 100% 0%, rgba(167, 215, 191, 0.28), rgba(167, 215, 191, 0)),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.calendar-layout {
  gap: 0.95rem;
}

.calendar-filter-panel {
  border-radius: 18px;
  border-color: #d8e3ef;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98));
  box-shadow: 0 10px 24px rgba(15, 22, 29, 0.05);
}

.calendar-surface {
  border-radius: 18px;
  border-color: #d8e3ef;
  background:
    radial-gradient(540px 180px at 100% 0%, rgba(255, 222, 168, 0.2), rgba(255, 222, 168, 0)),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.fc .fc-toolbar.fc-header-toolbar {
  margin-bottom: 0.8rem;
}

.fc .fc-daygrid-day-frame {
  min-height: 96px;
}

.fc .fc-daygrid-day-number {
  color: #536175;
  font-weight: 700;
  font-size: 0.78rem;
}

.fc .fc-event {
  border-radius: 10px;
  box-shadow: 0 4px 10px rgba(15, 22, 29, 0.12);
}

.fc .fc-event-main {
  padding: 2px 4px;
}

.fc .fc-event-dest {
  font-size: 0.68rem;
}

.calendar-fallback-card {
  border-radius: 13px;
  border-color: #d5dfeb;
  box-shadow: 0 4px 12px rgba(15, 22, 29, 0.06);
}

/* Aesthetic v3: activity + statistics + users */
:is(.activity-head, .stats-head, .users-head) {
  margin-bottom: 0.72rem;
  padding: 0.88rem 0.96rem;
  border-radius: 18px;
  border: 1px solid #d7e2ef;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.activity-head {
  background:
    radial-gradient(440px 130px at 0% 0%, rgba(255, 220, 162, 0.28), rgba(255, 220, 162, 0)),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.stats-head {
  background:
    radial-gradient(420px 130px at 100% 0%, rgba(161, 219, 191, 0.28), rgba(161, 219, 191, 0)),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.users-head {
  background:
    radial-gradient(430px 130px at 0% 0%, rgba(177, 206, 255, 0.22), rgba(177, 206, 255, 0)),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.activity-controls,
.users-controls {
  border-radius: 16px;
  border-color: #d8e3ef;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98));
  box-shadow: 0 8px 20px rgba(15, 22, 29, 0.05);
}

.activity-kpi-row .kpi-card:nth-child(1) {
  border-left-color: #2d8f66;
}

.activity-kpi-row .kpi-card:nth-child(2) {
  border-left-color: #238a5f;
}

.activity-kpi-row .kpi-card:nth-child(3) {
  border-left-color: #2473a6;
}

.activity-kpi-row .kpi-card:nth-child(4) {
  border-left-color: #b14949;
}

.activity-kpi-row .kpi-card:nth-child(5) {
  border-left-color: #6c7789;
}

.stats-kpi-row .kpi-card {
  border-left-color: #3b4b62;
}

.stats-kpi-row-secondary .kpi-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(248, 251, 255, 0.98));
}

.activity-table-panel,
.users-table-panel {
  border-radius: 18px;
  border-color: #d8e3ef;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.99));
}

.activity-table-wrap,
.users-table-wrap {
  border-radius: 14px;
  border: 1px solid #d8e2ee;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.activity-table-wrap .table thead th,
.users-table-wrap .table thead th {
  background: #f3f6fb;
  color: #4a5a6d;
}

.activity-table tbody tr:hover,
.users-table tbody tr:hover {
  background: #f9fbfe;
}

.stats-chart-grid {
  gap: 0.95rem;
}

.stats-chart-panel {
  border-radius: 18px;
  border: 1px solid #d8e3ef;
  background:
    radial-gradient(420px 140px at 100% 0%, rgba(255, 225, 173, 0.16), rgba(255, 225, 173, 0)),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  box-shadow: 0 10px 24px rgba(15, 22, 29, 0.06);
}

.stats-chart-panel h3 {
  color: #263448;
}

.stats-chart-panel canvas {
  height: 300px !important;
}

.users-table td {
  color: #2d3a4e;
}

.users-table .btn-icon {
  border-radius: 9px;
}

.activity-modal-content .modal-header,
.user-modal-content .modal-header {
  background: #f7f9fc;
}

.activity-modal-content .modal-footer,
.user-modal-content .modal-footer {
  background: #fbfcfe;
}

@media (max-width: 991.98px) {
  .login-stage {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    min-height: 220px;
  }

  :is(.activity-head, .stats-head, .users-head) {
    padding: 0.78rem 0.8rem;
  }
}

@media (max-width: 768px) {
  .activity-head-actions {
    width: 100%;
  }

  .activity-head-actions .btn {
    flex: 1 1 0;
  }

  .stats-chart-panel canvas {
    height: 260px !important;
  }
}

/* Aesthetic v4: concluse + missione + persone + impostazioni + backup */
:is(.archive-head, .mission-head, .people-head, .settings-head, .backup-head) {
  margin-bottom: 0.72rem;
  padding: 0.88rem 0.96rem;
  border-radius: 18px;
  border: 1px solid #d7e2ef;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.archive-head {
  background:
    radial-gradient(430px 130px at 0% 0%, rgba(178, 205, 238, 0.2), rgba(178, 205, 238, 0)),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.mission-head {
  background:
    radial-gradient(430px 130px at 100% 0%, rgba(160, 218, 190, 0.24), rgba(160, 218, 190, 0)),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.people-head {
  background:
    radial-gradient(430px 130px at 0% 0%, rgba(174, 205, 255, 0.24), rgba(174, 205, 255, 0)),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.settings-head {
  background:
    radial-gradient(420px 130px at 100% 0%, rgba(205, 211, 223, 0.28), rgba(205, 211, 223, 0)),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.backup-head {
  background:
    radial-gradient(430px 130px at 0% 0%, rgba(176, 220, 206, 0.26), rgba(176, 220, 206, 0)),
    linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
}

.archive-controls,
.backup-controls {
  border-radius: 16px;
  border-color: #d8e3ef;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.97), rgba(245, 250, 255, 0.97));
  box-shadow: 0 8px 20px rgba(15, 22, 29, 0.05);
}

.archive-timeline .timeline-month {
  border-left-color: #3a4a62;
}

.archive-modal-content .modal-header,
.archive-attachments-modal-content .modal-header,
.mission-modal-content .modal-header,
.person-modal-content .modal-header {
  background: #f7f9fc;
}

.archive-modal-content .modal-footer,
.archive-attachments-modal-content .modal-footer,
.mission-modal-content .modal-footer,
.person-modal-content .modal-footer {
  background: #fbfcfe;
}

.mission-form-modal .modal-header {
  background:
    radial-gradient(420px 120px at 0% 0%, rgba(170, 214, 196, 0.24), rgba(170, 214, 196, 0)),
    linear-gradient(180deg, #ffffff 0%, #f7fbff 100%);
}

.mission-form-modal .modal-footer {
  background: #f7fafd;
}

.archive-attachment-upload .btn,
.mission-attachment-upload .btn {
  min-width: 126px;
}

.mission-kpi-row .kpi-card:nth-child(1) {
  border-left-color: #4c5668;
}

.mission-kpi-row .kpi-card:nth-child(2) {
  border-left-color: #2d8f66;
}

.mission-kpi-row .kpi-card:nth-child(3) {
  border-left-color: #2f7aa3;
}

.mission-kpi-row .kpi-card:nth-child(4) {
  border-left-color: #8564a8;
}

.mission-summary-panel,
.mission-attachments-panel,
.mission-kpi-panel,
.mission-team-panel,
.mission-notes-panel {
  border-radius: 18px;
  border-color: #d8e3ef;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.99));
}

.mission-quick-panel {
  border-radius: 18px;
  border-color: #d8e3ef;
  background:
    radial-gradient(520px 150px at 100% 0%, rgba(178, 226, 200, 0.2), rgba(178, 226, 200, 0)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.99));
}

.mission-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 0.5rem;
}

.mission-quick-item {
  padding: 0.5rem 0.56rem;
  border: 1px solid #d5e0ec;
  border-radius: 12px;
  background: #fff;
}

.mission-quick-item .label {
  font-size: 0.66rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.42px;
  color: #62748a;
}

.mission-quick-item .value {
  margin-top: 0.14rem;
  font-size: 0.84rem;
  font-weight: 700;
  color: #223449;
  line-height: 1.2;
}

.mission-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 0.68rem;
  align-items: start;
}

.mission-main-col,
.mission-side-col {
  display: grid;
  gap: 0.68rem;
}

.mission-side-col {
  position: static;
  grid-template-columns: minmax(0, 1fr);
}

.mission-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
}

.mission-summary-item {
  display: flex;
  align-items: flex-start;
  gap: 0.52rem;
  padding: 0.48rem 0.52rem;
  border: 1px solid #d9e3ef;
  border-radius: 12px;
  background: #fff;
}

.mission-summary-icon {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid #d4e0ec;
  background: #f4f8fd;
  color: #305578;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.mission-note-block {
  padding: 0.48rem 0.54rem;
  border: 1px dashed #d9e3ef;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.84);
}

.mission-kpi-row-compact {
  margin-bottom: 0;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.mission-team-panel .trip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.36rem;
}

.mission-summary-item .trip-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.28rem;
}

.mission-attachments-head h3 {
  color: #263448;
  letter-spacing: -0.01em;
}

.people-grid {
  gap: 0.78rem;
}

.people-grid .member-card {
  border-color: #d8e3ef;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.99));
}

.settings-panel {
  border-radius: 18px;
  border-color: #d8e3ef;
  background:
    radial-gradient(520px 180px at 100% 0%, rgba(255, 221, 166, 0.18), rgba(255, 221, 166, 0)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.99));
}

.settings-panel-title {
  color: #263448;
}

.settings-form {
  max-width: 620px;
}

.settings-block {
  padding: 0.5rem 0.58rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.72);
}

.settings-block .fw-semibold {
  color: #2a3a4f;
  letter-spacing: -0.01em;
}

.settings-actions {
  padding-top: 0.16rem;
}

.backup-table-panel {
  border-radius: 18px;
  border-color: #d8e3ef;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.99));
}

.backup-diag-panel {
  border-radius: 18px;
  border-color: #d8e3ef;
  background:
    radial-gradient(520px 180px at 100% 0%, rgba(170, 211, 255, 0.14), rgba(170, 211, 255, 0)),
    linear-gradient(180deg, rgba(255, 255, 255, 0.99), rgba(248, 251, 255, 0.99));
}

.backup-diag-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.52rem;
}

.backup-diag-item {
  border: 1px solid #d5e0ec;
  border-radius: 12px;
  background: #fff;
  padding: 0.46rem 0.54rem;
  display: grid;
  gap: 0.12rem;
}

.backup-diag-item .label {
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.35px;
  text-transform: uppercase;
  color: #5e7289;
}

.backup-diag-item .value {
  font-size: 0.81rem;
  font-weight: 700;
  color: #24384f;
  line-height: 1.2;
  word-break: break-word;
}

.backup-table-wrap {
  border-radius: 14px;
  border: 1px solid #d8e2ee;
}

.backup-table thead th {
  background: #f3f6fb;
  color: #4a5a6d;
}

.backup-table tbody tr:hover {
  background: #f9fbfe;
}

@media (max-width: 991.98px) {
  :is(.archive-head, .mission-head, .people-head, .settings-head, .backup-head) {
    padding: 0.78rem 0.8rem;
  }

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

  .mission-layout {
    grid-template-columns: 1fr;
  }

  .mission-side-col {
    position: static;
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .archive-head-actions,
  .mission-head-actions,
  .backup-head-actions {
    width: 100%;
  }

  .archive-head-actions .btn,
  .mission-head-actions .btn,
  .backup-head-actions .btn {
    flex: 1 1 0;
  }

  .settings-actions {
    flex-direction: column;
    align-items: stretch !important;
  }

  .mission-summary-grid,
  .mission-quick-grid,
  .backup-diag-grid,
  .mission-kpi-row-compact,
  .mission-side-col {
    grid-template-columns: 1fr;
  }
}

/* Aesthetic v5 micro-pass: spacing + font-size consistency */
.page-content {
  --tm-section-gap: 0.84rem;
}

.page-content > section,
.page-content > div.calendar-layout,
.page-content > div.error-wrap {
  margin-bottom: var(--tm-section-gap);
}

.page-content > section:last-child,
.page-content > div.calendar-layout:last-child,
.page-content > div.error-wrap:last-child {
  margin-bottom: 0;
}

.page-head {
  gap: 0.72rem;
  margin-bottom: 0.72rem;
}

:is(
  .dashboard-head,
  .calendar-head,
  .activity-head,
  .stats-head,
  .users-head,
  .archive-head,
  .mission-head,
  .people-head,
  .settings-head,
  .backup-head
) {
  padding: 0.9rem 0.98rem;
}

.section-tag {
  font-size: 0.67rem;
  letter-spacing: 0.62px;
}

.page-title {
  font-size: clamp(1.16rem, 2.15vw, 1.44rem);
  line-height: 1.18;
}

.page-subtitle {
  margin-top: 0.18rem;
  max-width: 68ch;
  font-size: 0.82rem;
  line-height: 1.34;
}

.stack-controls {
  gap: 0.56rem;
  padding: 0.74rem;
  border-radius: 16px;
}

.stack-controls .btn,
.stack-controls .form-control,
.stack-controls .form-select {
  min-height: 34px;
}

.kpi-card {
  padding: 0.7rem 0.72rem;
}

.kpi-card .label {
  font-size: 0.67rem;
}

.kpi-card .value {
  margin-top: 0.14rem;
  font-size: clamp(1.06rem, 1.9vw, 1.32rem);
  line-height: 1.15;
}

.panel h3,
.board-head h3,
.timeline-title {
  font-size: 0.9rem;
  line-height: 1.24;
}

.table thead th {
  padding: 0.62rem 0.56rem;
  font-size: 0.68rem;
  letter-spacing: 0.52px;
}

.table > :not(caption) > * > * {
  padding: 0.56rem 0.52rem;
}

.modal-header,
.modal-footer {
  padding: 0.78rem 0.9rem;
}

.modal-body {
  padding: 0.9rem;
}

@media (max-width: 991.98px) {
  .page-content {
    --tm-section-gap: 0.78rem;
  }

  :is(
    .dashboard-head,
    .calendar-head,
    .activity-head,
    .stats-head,
    .users-head,
    .archive-head,
    .mission-head,
    .people-head,
    .settings-head,
    .backup-head
  ) {
    padding: 0.8rem 0.82rem;
  }
}

@media (max-width: 768px) {
  .page-content {
    --tm-section-gap: 0.72rem;
  }

  .page-head {
    gap: 0.58rem;
  }

  .page-title {
    font-size: clamp(1.04rem, 5.2vw, 1.24rem);
  }

  .kpi-card {
    padding: 0.64rem 0.66rem;
  }

  .modal-header,
  .modal-footer,
  .modal-body {
    padding: 0.72rem 0.76rem;
  }
}

/* Aesthetic v6: contrast/accessibility pass */
body {
  color: #0d131a;
}

.section-tag {
  color: #5d6878;
}

.page-subtitle {
  color: #556376;
}

.form-label,
.form-label.small,
.stack-controls label.small,
.stack-controls .small.fw-semibold {
  color: #445164 !important;
}

.small.text-secondary,
.text-secondary {
  color: #4e5c70 !important;
}

.kpi-card .label,
.timeline-title,
.trip-dates,
.audit-meta,
.attachment-meta {
  color: #5a687c;
}

.table thead th {
  color: #36475b;
  background: #eef3f9;
}

.table tbody td {
  color: #1a2736;
}

.chip {
  color: #2c3a4f;
  background: #f1f6fc;
  border-color: #ccd8e6;
}

.btn-ghost,
.btn-outline-secondary {
  color: #162130;
  border-color: #b7c5d8;
}

.btn-ghost:hover,
.btn-outline-secondary:hover {
  color: #0f1724;
  border-color: #9eb0c8;
  background: #f1f5fb;
}

.form-control,
.form-select,
.form-control-color,
.choices__inner {
  border-color: #b8c4d6;
}

.form-control:focus,
.form-select:focus,
.form-control-color:focus,
.btn:focus-visible {
  border-color: #7e95b3;
  box-shadow: 0 0 0 0.16rem rgba(57, 88, 127, 0.2);
}

/* Workflow + checklist + availability */
.trip-meta .badge {
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.mission-checklists-panel .progress {
  background: #e8eef6;
}

.mission-checklists-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.8rem;
}

.mission-checklist-col {
  min-width: 0;
}

.mission-checklists-panel .progress-bar {
  background: #2f7aa3;
}

.mission-checklists-panel .form-check-input {
  cursor: pointer;
}

.mission-checklists-panel .form-check-input:disabled {
  cursor: not-allowed;
}

.chip-person {
  border-color: #6c8fb8;
  background: linear-gradient(180deg, #eaf2fb 0%, #ddebf9 100%);
  color: #17283d;
  font-weight: 700;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.65) inset;
}

.chip-person i {
  color: #214b79;
}

.chip-person:hover {
  border-color: #587faa;
  background: linear-gradient(180deg, #dceafb 0%, #cfe2f8 100%);
}

.btn-create-mission {
  background: #11161d !important;
  border: 1px solid #11161d !important;
  color: #ffffff !important;
}

.btn-create-mission:hover,
.btn-create-mission:focus {
  background: #0b1118 !important;
  border-color: #11161d !important;
  color: #ffffff !important;
}

.btn-create-activity {
  background: #2f7aa3 !important;
  border: 1px solid #2f7aa3 !important;
  color: #ffffff !important;
}

.btn-create-activity:hover,
.btn-create-activity:focus {
  background: #245f7d !important;
  border-color: #245f7d !important;
  color: #ffffff !important;
}

.mission-form-grid .js-time-toggle-wrap,
.dashboard-mission-grid .js-time-toggle-wrap {
  margin-top: 0.1rem;
  padding: 0.44rem 0.58rem;
  border: 1px dashed #bfd0e1;
  border-radius: 10px;
  background: #f6f9fc;
}

.mission-form-grid .js-time-toggle-wrap .form-check-label,
.dashboard-mission-grid .js-time-toggle-wrap .form-check-label {
  color: #324964;
}

.mission-form-grid .form-control[readonly],
.dashboard-mission-grid .form-control[readonly] {
  background-color: #f4f7fb;
  color: #31465f;
}

.mission-form-grid .form-label,
.dashboard-mission-grid .form-label {
  margin-bottom: 0.24rem;
  font-size: 0.72rem;
  letter-spacing: 0.2px;
  text-transform: none;
}

.mission-form-grid .form-control,
.mission-form-grid .form-select,
.dashboard-mission-grid .form-control,
.dashboard-mission-grid .form-select {
  min-height: 36px;
}

.mission-form-modal .modal-body,
.dashboard-mission-modal .modal-body {
  overflow-x: clip;
}

.mission-form-modal .mission-form-grid,
.dashboard-mission-modal .dashboard-mission-grid {
  --bs-gutter-x: 0.56rem;
  width: 100%;
  margin-left: 0;
  margin-right: 0;
}

.mission-form-grid .choices,
.dashboard-mission-grid .choices {
  width: 100%;
  min-width: 0;
}

.fc .fc-event-dest {
  font-size: 0.72rem;
  line-height: 1.22;
}

.fc .fc-event-sub {
  display: inline-flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  font-size: 0.58rem;
  line-height: 1.2;
  opacity: 0.96;
}

.fc .fc-event-dot {
  opacity: 0.68;
  font-weight: 700;
}

.fc .fc-daygrid-more-link {
  font-size: 0.62rem;
  font-weight: 700;
  color: #324964;
}

.fc .fc-event-line1 {
  min-width: 0;
  flex: 1 1 auto;
  font-size: 0.66rem;
  line-height: 1.2;
  font-weight: 500;
  letter-spacing: 0.1px;
  text-transform: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc .fc-event-time-inline {
  font-weight: 800;
  opacity: 0.98;
  letter-spacing: 0.1px;
  white-space: nowrap;
}

/* Week view: compact time-grid slots for cleaner empty rows */
.fc .fc-timegrid-slot {
  height: 1.5rem;
}

.fc .fc-timegrid-axis-cushion,
.fc .fc-timegrid-slot-label-cushion {
  font-size: 0.63rem;
  line-height: 1.1;
  padding-top: 0.08rem;
  padding-bottom: 0.08rem;
}

.fc .fc-event-card:not(.fc-event-card--compact) .fc-event-line1 {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  text-overflow: initial;
}

.fc .fc-event-operators {
  font-weight: 800;
}

.fc .fc-event-activity {
  font-weight: 500;
  opacity: 0.95;
}

.fc .fc-event-sep {
  opacity: 0.78;
}

.fc .fc-event-line2 {
  margin-top: 1px;
  font-size: 0.58rem;
  line-height: 1.2;
  font-weight: 700;
  opacity: 0.95;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.fc .fc-status-indicator {
  flex: 0 0 auto;
  width: 11px;
  height: 11px;
  border-radius: 999px;
  border: 2px solid #ffffff;
  box-shadow:
    0 0 0 1px rgba(17, 18, 20, 0.45),
    0 1px 2px rgba(17, 18, 20, 0.25);
  margin-top: 2px;
}

.fc .fc-status-indicator--approved {
  background: #16c46b;
}

.fc .fc-status-indicator--unconfirmed {
  background: #ff4d4f;
}

.fc .fc-status-indicator--in-progress {
  background: #ff9f1a;
}

.fc .fc-status-indicator--default {
  background: #7f8c9b;
}

.fc .fc-activity-pill--ghost {
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(17, 18, 20, 0.18);
}

@media (max-width: 900px) {
  .mission-checklists-grid {
    grid-template-columns: 1fr;
  }
}

.people-availability-panel .section-tag {
  margin: 0;
}

.people-availability-grid {
  gap: 0.62rem;
}

/* Final mobile stabilization */
@media (max-width: 1200px) {
  .dashboard-board {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .dashboard-board.dashboard-board--no-drafts {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  .mission-layout {
    grid-template-columns: 1fr !important;
  }

  .mission-side-col {
    position: static;
    grid-template-columns: 1fr;
  }

  .mission-summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .app-layout {
    padding: 0.42rem;
  }

  .content-wrap,
  .sidebar {
    min-height: auto;
    height: auto;
  }

  .topbar {
    border-radius: 14px;
    padding: 0.62rem 0.7rem;
  }

  .page-content {
    padding: 0.72rem 0;
  }

  .user-pill {
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .stack-controls {
    gap: 0.5rem;
  }

  .stack-controls .form-control,
  .stack-controls .form-select,
  .stack-controls .btn,
  .stack-controls .control-w-xs,
  .stack-controls .control-w-sm,
  .stack-controls .control-w-md {
    width: 100% !important;
  }

  .dashboard-board,
  .dashboard-board.dashboard-board--no-drafts,
  .board,
  .chart-grid,
  .stats-chart-grid,
  .calendar-layout,
  .calendar-layout.filters-collapsed,
  .mission-side-col,
  .mission-summary-grid,
  .mission-kpi-row-compact,
  .member-grid,
  .people-grid {
    grid-template-columns: 1fr !important;
  }

  .dashboard-collapse-btn {
    display: none;
  }

  .table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .mission-form-dialog {
    --bs-modal-width: 96vw;
  }

  .mission-form-dialog .modal-content {
    max-height: calc(100dvh - 1rem);
    display: flex;
    flex-direction: column;
  }

  .mission-form-dialog .modal-body {
    overflow-y: auto;
  }

  .fc .fc-event-sub {
    font-size: 0.55rem;
  }

  .fc .fc-event-line1 {
    font-size: 0.62rem;
  }

  .fc .fc-event-line2 {
    font-size: 0.54rem;
  }

  .fc .fc-status-indicator {
    width: 10px;
    height: 10px;
  }
}

@media (max-width: 768px) {
  .topbar {
    gap: 0.5rem;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    gap: 0.45rem !important;
  }

  .activity-head-actions,
  .archive-head-actions,
  .mission-head-actions,
  .backup-head-actions {
    width: 100%;
    flex-direction: column;
  }

  .activity-head-actions .btn,
  .archive-head-actions .btn,
  .mission-head-actions .btn,
  .backup-head-actions .btn {
    width: 100%;
  }

  .dashboard-controls .btn {
    width: 100%;
  }

  .mission-form-dialog {
    margin: 0.45rem auto;
  }

  .mission-form-dialog .modal-header,
  .mission-form-dialog .modal-body,
  .mission-form-dialog .modal-footer {
    padding: 0.66rem 0.7rem;
  }
}

@media (max-width: 575.98px) {
  .app-layout {
    padding: 0.3rem;
  }

  .topbar {
    border-radius: 12px;
  }

  .user-pill {
    display: none;
  }

  .page-title {
    line-height: 1.22;
  }

  .trip-actions {
    justify-content: flex-start;
  }
}

/* Phase 1 polish: calendar readability + mobile balance */
.fc .fc-event-main {
  overflow: visible;
}

.fc .fc-event-card {
  min-width: 0;
}

.fc .fc-event-top {
  align-items: flex-start;
  gap: 6px;
}

.fc .fc-event-line1 {
  min-height: 2.25em;
}

.fc .fc-status-indicator {
  width: 12px;
  height: 12px;
  border: 2px solid rgba(255, 255, 255, 0.98);
  box-shadow:
    0 0 0 1.25px rgba(14, 18, 25, 0.62),
    0 1px 2px rgba(14, 18, 25, 0.28);
}

.fc .fc-status-indicator--approved {
  background: #11bf61;
}

.fc .fc-status-indicator--unconfirmed {
  background: #e24848;
}

.fc .fc-status-indicator--in-progress {
  background: #ff9800;
  animation: calendar-status-pulse 1.05s ease-in-out infinite;
  box-shadow:
    0 0 0 1.25px rgba(14, 18, 25, 0.62),
    0 0 0 5px rgba(255, 193, 7, 0.22),
    0 1px 2px rgba(14, 18, 25, 0.28);
}

@keyframes calendar-status-pulse {
  0%,
  100% {
    transform: scale(1);
    background: #ffbf1f;
  }
  50% {
    transform: scale(1.24);
    background: #ffd54a;
  }
}

@media (max-width: 991.98px) {
  .calendar-head {
    padding: 0.72rem 0.78rem;
  }

  .calendar-head-actions {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.44rem !important;
  }

  .calendar-head-actions .btn {
    width: 100%;
  }

  .calendar-layout,
  .calendar-layout.filters-collapsed {
    gap: 0.62rem !important;
  }

  .calendar-filter-panel {
    padding: 0.74rem !important;
  }

  .fc .fc-toolbar {
    flex-wrap: wrap;
    row-gap: 0.36rem;
  }

  .fc .fc-toolbar-title {
    font-size: 1rem;
  }

  .fc .fc-daygrid-day-frame {
    min-height: 80px;
  }

  .fc .fc-event-line1 {
    font-size: 0.61rem;
    line-height: 1.16;
  }

  .fc .fc-event-line2 {
    font-size: 0.53rem;
    text-transform: none;
  }

  .fc .fc-status-indicator {
    width: 11px;
    height: 11px;
  }
}

@media (max-width: 768px) {
  .calendar-head-actions {
    grid-template-columns: 1fr;
  }

  .calendar-filter-toggle .btn-label {
    display: none;
  }

  .fc .fc-toolbar-chunk {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 0.3rem;
  }

  .fc .fc-button {
    padding: 0.2rem 0.38rem;
    font-size: 0.67rem;
  }

  .fc .fc-daygrid-day-frame {
    min-height: 72px;
  }

  .fc .fc-event-card:not(.fc-event-card--compact) .fc-event-line1 {
    -webkit-line-clamp: 1;
  }
}

/* Calendar layout stabilization: collapsible filters + predictable expansion */
#calendarLayout.calendar-layout {
  grid-template-columns: minmax(252px, 286px) minmax(0, 1fr);
  align-items: stretch;
  gap: 0.95rem;
}

#calendarLayout.calendar-layout.filters-collapsed {
  grid-template-columns: 72px minmax(0, 1fr);
}

#calendarLayout > .calendar-side,
#calendarLayout > .calendar-main {
  min-width: 0;
}

#calendarLayout > .calendar-main {
  width: 100%;
}

#calendarLayout #calendarFilterPanel {
  min-width: 0;
}

#calendarLayout.filters-collapsed #calendarFilterPanel {
  padding: 0.52rem 0.46rem !important;
}

#calendarLayout.filters-collapsed #calendarFilterPanel .calendar-filter-head {
  margin-bottom: 0 !important;
  justify-content: center;
}

#calendarLayout.filters-collapsed #calendarFilterPanel .section-tag,
#calendarLayout.filters-collapsed #calendarFilterPanel .calendar-filter-toggle .btn-label {
  display: none;
}

#calendarLayout.filters-collapsed #calendarFilterPanel .calendar-filter-toggle {
  width: 100%;
}

#calendarLayout.filters-collapsed #calendarFilterPanel #calendarFiltersBody {
  display: none;
}

#calendarLayout .calendar-surface {
  min-height: 0;
  overflow: hidden;
}

#calendarLayout .fc {
  width: 100%;
  min-width: 0;
}

#calendarLayout .fc .fc-event-line1,
#calendarLayout .fc .fc-event-line2 {
  min-width: 0;
}

@media (max-width: 1199.98px) {
  #calendarLayout.calendar-layout,
  #calendarLayout.calendar-layout.filters-collapsed {
    grid-template-columns: 1fr !important;
  }

  #calendarLayout #calendarFilterPanel,
  #calendarLayout #calendarFilterPanel.filters-collapsed {
    padding: 0.74rem !important;
  }
}

/* Mobile adaptation pass: shared actions, tables, modals */
@media (max-width: 991.98px) {
  [class*="head-actions"] {
    width: 100%;
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.44rem !important;
  }

  [class*="head-actions"] .btn {
    width: 100%;
  }

  :is(.users-table, .activity-table, .backup-table, .audit-changes-table) {
    min-width: 640px;
  }

  :is(.users-table-wrap, .activity-table-wrap, .backup-table-wrap, .audit-changes-wrap) {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

@media (max-width: 768px) {
  .page-head {
    align-items: stretch;
  }

  [class*="head-actions"] {
    grid-template-columns: 1fr !important;
  }

  .modal-dialog {
    max-width: calc(100vw - 0.8rem);
    margin: 0.4rem auto;
  }

  .modal-content {
    max-height: calc(100dvh - 0.8rem);
    display: flex;
    flex-direction: column;
  }

  .modal-body {
    overflow-y: auto;
  }

  .modal-footer {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.44rem;
  }

  .modal-footer .btn,
  .modal-footer .btn.me-auto {
    width: 100%;
    margin: 0 !important;
  }
}

/* Visual refresh v1: coherent app-wide polish */
:root {
  --theme-bg-a: #eef4ff;
  --theme-bg-b: #f7fafc;
  --theme-ink: #0e1824;
  --theme-line: #d4dfec;
  --theme-line-strong: #b8c8dc;
  --theme-primary: #111214;
  --theme-primary-strong: #000000;
  --theme-surface: #ffffff;
}

body {
  color: var(--theme-ink);
  background:
    radial-gradient(1000px 480px at -8% -12%, rgba(176, 210, 255, 0.34), rgba(176, 210, 255, 0)),
    radial-gradient(860px 420px at 108% 104%, rgba(198, 217, 246, 0.24), rgba(198, 217, 246, 0)),
    linear-gradient(180deg, var(--theme-bg-a), var(--theme-bg-b));
}

.topbar,
.sidebar {
  backdrop-filter: blur(8px);
  background: rgba(255, 255, 255, 0.9);
}

.page-head {
  border: 1px solid var(--theme-line);
  border-radius: 18px;
  padding: 0.92rem 1rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 255, 0.96));
  box-shadow: 0 10px 26px rgba(23, 39, 60, 0.06);
}

.panel {
  border-color: var(--theme-line);
  border-radius: 16px;
  background: var(--theme-surface);
  box-shadow:
    0 1px 0 rgba(18, 28, 40, 0.03),
    0 10px 22px rgba(24, 39, 61, 0.05);
}

.btn {
  border-radius: 10px;
  font-weight: 700;
  letter-spacing: 0.1px;
}

.btn-primary {
  background: linear-gradient(180deg, var(--theme-primary), var(--theme-primary-strong));
  border-color: var(--theme-primary-strong);
}

.btn-primary:hover,
.btn-primary:focus {
  background: linear-gradient(180deg, #0e1012, #000000);
  border-color: #000000;
}

.btn-ghost,
.btn-outline-secondary {
  border-color: var(--theme-line-strong);
  background: #fff;
}

.btn-create-mission {
  background: linear-gradient(180deg, #263547, #1c2735);
  border-color: #1c2735;
  color: #fff;
}

.btn-create-activity {
  background: linear-gradient(180deg, #1270b7, #0f5c97);
  border-color: #0f5c97;
  color: #fff;
}

.form-control,
.form-select,
.choices__inner {
  border-color: #c2d0e2;
  border-radius: 10px;
}

.form-control:focus,
.form-select:focus,
.choices__inner:focus-within {
  border-color: #7da0c5;
  box-shadow: 0 0 0 0.16rem rgba(75, 123, 176, 0.2);
}

.kpi-card {
  border-left: 4px solid rgba(17, 22, 29, 0.84);
  border-color: var(--theme-line);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.98));
}

.kpi-card .label {
  color: #4f6076;
}

:is(.trip-card, .timeline-month, .member-card, .attachment-row, .board-col) {
  border-color: var(--theme-line);
  box-shadow: 0 6px 16px rgba(22, 37, 59, 0.05);
}

:is(.trip-card, .timeline-month, .member-card, .attachment-row, .board-col):hover {
  box-shadow: 0 12px 28px rgba(22, 37, 59, 0.1);
}

.chip {
  border-color: #c6d5e8;
  background: #edf4fc;
  color: #1d3552;
  font-weight: 700;
}

.table {
  border-radius: 12px;
}

.table thead th {
  background: #eaf1f9;
  color: #2f4662;
  border-bottom-color: #cbd9ea;
}

.table tbody tr:nth-child(even) {
  background: rgba(241, 246, 252, 0.46);
}

.modal-content {
  border-color: #cbd9e9;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(17, 31, 49, 0.22);
}

.modal-header {
  background:
    radial-gradient(460px 130px at 100% 0%, rgba(176, 209, 246, 0.24), rgba(176, 209, 246, 0)),
    linear-gradient(180deg, #ffffff, #f4f9ff);
  border-bottom-color: #d1deee;
}

.modal-footer {
  border-top-color: #d1deee;
  background: #f8fbff;
}

.login-card,
.login-brand-panel {
  box-shadow: 0 18px 40px rgba(17, 31, 49, 0.14);
}

/* Concluse: keep page tone aligned with global theme */
.archive-head {
  border-color: var(--theme-line) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(246, 250, 255, 0.96)) !important;
}

.archive-controls {
  border-color: var(--theme-line) !important;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.98), rgba(246, 250, 255, 0.98)) !important;
}

.archive-timeline .timeline-month {
  border-color: var(--theme-line) !important;
  background: #ffffff !important;
}
