/* ---- Bootstrap 호환 별칭 (기존 마크업 유지) ---- */
.gs-stack {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.gs-stack--lg {
  gap: 1.25rem;
}
.gs-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}
.gs-muted {
  color: #858796 !important;
}
.gs-error {
  color: #e74a3b !important;
}
.gs-panel {
  background: #fff;
  border: 1px solid #e3e6f0;
  border-radius: 0.35rem;
  box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
  padding: 1.25rem;
}
.gs-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1.5;
  border-radius: 0.35rem;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
.gs-btn:disabled {
  opacity: 0.65;
  pointer-events: none;
}
.gs-btn--block {
  width: 100%;
  display: flex;
}
.gs-tone--primary {
  background: #4e73df;
  color: #fff;
  border-color: #4e73df;
}
.gs-tone--primary:hover:not(:disabled) {
  background: #2e59d9;
  color: #fff;
}
.gs-tone--ghost {
  background: #fff;
  color: #5a5c69;
  border-color: #d1d3e2;
}
.gs-tone--ghost:hover:not(:disabled) {
  background: #eaecf4;
}
.gs-tone--accent {
  background: #36b9cc;
  color: #fff;
  border-color: #36b9cc;
}
.gs-tone--danger {
  background: #e74a3b;
  color: #fff;
  border-color: #e74a3b;
}
.gs-tone--ghost-danger {
  background: #fff;
  color: #e74a3b;
  border-color: #e74a3b;
}
.gs-tone--soft {
  background: #eaecf4;
  color: #5a5c69;
  border-color: #eaecf4;
}
.gs-tone--soft-accent {
  background: #e0f7fa;
  color: #0c5460;
  border-color: #e0f7fa;
}
.gs-badge {
  display: inline-block;
  padding: 0.25em 0.55em;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 0.35rem;
  background: #eaecf4;
  color: #5a5c69;
}
.gs-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}
.gs-tabs--segmented {
  background: #eaecf4;
  padding: 0.25rem;
  border-radius: 0.35rem;
}
.gs-tab {
  border: 0;
  background: transparent;
  padding: 0.4rem 0.75rem;
  border-radius: 0.25rem;
  font-size: 0.85rem;
  color: #5a5c69;
  cursor: pointer;
  text-decoration: none;
}

.cal-chip,
.gs-tab:hover,
.gs-tab:focus,
.gs-tab:focus-visible {
  text-decoration: none;
}
.gs-tab.active,
.gs-tab[aria-selected="true"] {
  background: #fff;
  color: #4e73df;
  font-weight: 600;
  box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* Domain styles retained from previous gsmain (calendar, stats, members, …) */

.danger-zone {
  border-color: #f3c1bb;
}

.event-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.1rem;
  transition: transform 0.15s ease, border-color 0.15s ease;
}

.event-row:hover {
  transform: translateY(-2px);
  border-color: #a9c3b2;
}

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

.period-custom {
  display: grid;
  gap: 0.75rem;
  align-items: end;
}

@media (min-width: 720px) {
  .period-custom {
    grid-template-columns: 1fr 1fr auto;
  }
}

.stats-grid {
  display: grid;
  gap: 0.85rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.revenue-panels {
  display: grid;
  gap: 1rem;
  grid-template-columns: 1fr;
  min-width: 0;
}

.revenue-panels > .member-stats-panel {
  margin: 0;
  min-width: 0;
}

@media (min-width: 821px) {
  .revenue-panels--pair {
    grid-template-columns: 1fr 1fr;
    align-items: start;
  }
}

.member-stats-panel {
  gap: 1rem;
}

.member-stats-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.member-stats-head h2 {
  margin: 0;
}

.member-stats-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.member-stats-chart {
  min-height: 280px;
  width: 100%;
}

.app-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(560px, calc(100vw - 2rem));
  width: 100%;
  font: inherit;
  color: inherit;
}

/* 데스크톱: 가로만 가운데. 세로는 건드리지 않음 */
@media (min-width: 821px) {
  .app-dialog,
  .member-stats-dialog {
    margin-inline: auto;
  }
}

.app-dialog::backdrop {
  background: rgba(20, 24, 22, 0.45);
}

.app-dialog-panel {
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.25rem;
  max-height: min(85vh, 720px);
  overflow: auto;
}

.app-dialog-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.app-dialog-close {
  flex-shrink: 0;
}

.create-event-form {
  gap: 0.85rem;
}

.event-share-form {
  gap: 0.85rem;
}

.event-share-list {
  display: grid;
  gap: 0.55rem;
}

.event-share-row {
  display: flex !important;
  flex-direction: row !important;
  align-items: center;
  gap: 0.75rem;
  margin: 0;
}

.event-share-label {
  flex: 1 1 auto;
  font-weight: 600;
  font-size: 0.92rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.event-share-row input[type="number"] {
  flex: 0 0 5.5rem;
  width: 5.5rem !important;
  max-width: 5.5rem !important;
}

.event-share-amount {
  flex: 0 0 auto;
  min-width: 5.5rem;
  text-align: right;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .event-share-row {
    grid-template-columns: minmax(0, 1fr) 4.5rem;
  }

  .event-share-amount {
    grid-column: 1 / -1;
    text-align: left;
  }
}

.checkbox-label {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.checkbox-label input {
  width: auto;
}

.member-stats-dialog {
  border: 0;
  padding: 0;
  background: transparent;
  max-width: min(720px, calc(100vw - 2rem));
  width: 100%;
}

.member-stats-dialog::backdrop {
  background: rgba(20, 24, 22, 0.45);
}

.member-stats-dialog-panel {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.15rem 1.2rem 1.25rem;
  max-height: min(80vh, 720px);
  overflow: auto;
}

.member-stats-dialog-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.member-stats-dialog-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.member-stats-swatch-row {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.member-stats-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(20, 24, 22, 0.12);
  flex-shrink: 0;
}

.member-stats-drill-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  padding: 0;
  cursor: pointer;
  text-align: left;
}

.member-stats-drill-link:hover .member-stats-drill-caret,
.member-stats-drill-link:focus-visible .member-stats-drill-caret {
  color: var(--brand);
}

.member-stats-drill-caret {
  margin-left: 0.15rem;
  color: var(--ink-soft);
  font-weight: 700;
}

.category-stats-title-path {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
}

.category-stats-breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem;
  margin-top: 0.15rem;
  font-size: 0.88rem;
}

.category-stats-crumb {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand);
  font: inherit;
  font-weight: 700;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

.category-stats-crumb.current {
  color: var(--ink-soft);
  font-weight: 600;
  text-decoration: none;
  cursor: default;
}

.category-stats-crumb-sep {
  color: var(--ink-soft);
}

.category-stats-title-segment {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.cross-table-wrap {
  overflow-x: auto;
  margin: 0 -0.15rem;
  padding: 0 0.15rem;
}

.cross-table {
  min-width: 100%;
  font-size: 0.9rem;
}

.cross-table th,
.cross-table td {
  white-space: nowrap;
}

.cross-table-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.cross-table-sticky {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--card);
  box-shadow: 1px 0 0 var(--line);
  text-align: left;
  min-width: 9rem;
}

.cross-table-col-head {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  justify-content: flex-end;
}

.cross-table thead .cross-table-num {
  vertical-align: bottom;
}

.cross-table-total-col {
  background: rgba(15, 107, 76, 0.06);
}

.cross-table tfoot th,
.cross-table tfoot td {
  border-top: 2px solid var(--line);
}

.member-category-cross h2 {
  margin: 0;
}

.stat-card {
  background: #fff;
  border: 1px solid #e3e6f0;
  border-radius: 0.35rem;
  box-shadow: 0 0.15rem 1.75rem 0 rgba(58, 59, 69, 0.1);
  padding: 1.1rem 1.2rem;
}

.stat-value-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.5rem;
  margin-top: 0.35rem;
}

.stat-card strong {
  font-family: "Noto Sans KR", sans-serif;
  font-weight: 700;
  font-size: 1.6rem;
  line-height: 1.1;
}

.stat-cumulative {
  flex-shrink: 0;
  font-size: 0.88rem;
  line-height: 1.2;
  text-align: right;
  white-space: nowrap;
}

.table-scroll-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.stats-detail-table {
  min-width: 36rem;
}

.stats-detail-list {
  display: grid;
  gap: 0.75rem;
}

.stats-detail-card {
  display: grid;
  gap: 0.75rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.stats-detail-card.deleted,
.stats-detail-table tr.deleted {
  opacity: 0.72;
}

.stats-detail-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.85rem;
}

.stats-detail-head h2 {
  margin: 0;
}

.stats-detail-card .person-cell {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.35rem 0.5rem;
}

.stats-detail-fields {
  display: grid;
  gap: 0.65rem;
  margin: 0;
}

.stats-detail-field {
  display: grid;
  gap: 0.2rem;
}

.stats-detail-field dt {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.stats-detail-field dd {
  margin: 0;
}

.stats-detail-table-wrap {
  display: none;
}

@media (min-width: 821px) {
  .stats-detail-list {
    display: none;
  }

  .stats-detail-table-wrap {
    display: block;
  }
}

.table th,
.table td {
  text-align: left;
  padding: 0.75rem 0.4rem;
  border-bottom: 1px solid var(--line);
  font-size: 0.92rem;
}

.person-cell {
  display: grid;
  gap: 0.15rem;
}

.person-cell strong {
  font-weight: 700;
}

.color-dropdown {
  position: relative;
  display: inline-block;
  min-width: 8.5rem;
}

.color-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  box-sizing: border-box;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 400;
  line-height: 1.5;
  color: #6e707e;
  background-color: #fff;
  border: 1px solid #d1d3e2;
  border-radius: 0.35rem;
  cursor: pointer;
}

.color-dropdown-swatch {
  width: 1rem;
  height: 1rem;
  border-radius: 999px;
  border: 2px solid currentColor;
  flex-shrink: 0;
}

.color-dropdown-label {
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.color-dropdown-caret {
  margin-left: auto;
  color: #6e707e;
  font-size: 0.75rem;
}

.color-dropdown-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  z-index: 40;
  width: min(240px, 72vw);
  display: grid;
  gap: 0.75rem;
  padding: 0.85rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: var(--shadow);
}

.color-picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.color-picker-row input[type="color"] {
  width: 3rem;
  height: 2rem;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.rgb-inputs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.45rem;
}

.rgb-inputs label {
  font-size: 0.78rem;
}

.rgb-inputs input {
  width: 100%;
  padding: 0.4rem 0.45rem;
}

.color-dropdown-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
}

.calendar-detail-list {
  display: grid;
  gap: 0.85rem;
}

.calendar-detail-card {
  gap: 0.9rem;
}

.calendar-detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 0.75rem;
  align-items: center;
}

.calendar-detail-swatch {
  width: 1.1rem;
  height: 1.1rem;
  border-radius: 999px;
  border: 1px solid rgba(20, 24, 22, 0.12);
  flex-shrink: 0;
}

.calendar-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.55rem;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  background: rgba(255, 255, 255, 0.7);
}

.calendar-status-badge.ok {
  color: #0f6b4c;
  border-color: rgba(15, 107, 76, 0.28);
  background: rgba(15, 107, 76, 0.08);
}

.calendar-status-badge.warn {
  color: #9a6700;
  border-color: rgba(154, 103, 0, 0.28);
  background: rgba(154, 103, 0, 0.08);
}

.calendar-detail-grid {
  display: grid;
  gap: 0.75rem;
  margin: 0;
}

.calendar-detail-grid > div {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.calendar-detail-grid dt {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.calendar-detail-grid dd {
  margin: 0;
  word-break: break-word;
}

.calendar-detail-grid .mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 0.82rem;
}

.calendar-detail-grid .break {
  overflow-wrap: anywhere;
}

@media (min-width: 821px) {
  .calendar-detail-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.member-list {
  display: grid;
  gap: 0.75rem;
}

.member-card {
  display: grid;
  gap: 0.85rem;
  padding: 0.9rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.member-card-editor {
  display: grid;
  gap: 0.75rem;
  min-width: 0;
}

.member-card-fields {
  display: grid;
  gap: 0.75rem;
}

.member-field {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.member-field > span {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.member-field select,
.member-field--share input {
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.member-field--color input[type="color"] {
  display: block;
  width: 100%;
  box-sizing: border-box;
  height: calc(0.875rem * 1.5 + 0.375rem * 2 + 2px);
  padding: 0.2rem;
  border: 1px solid #d1d3e2;
  border-radius: 0.35rem;
  background-color: #fff;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
}

.member-field--color input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.member-field--color input[type="color"]::-webkit-color-swatch {
  border: 0;
  border-radius: 0.2rem;
}

.member-field--color input[type="color"]::-moz-color-swatch {
  border: 0;
  border-radius: 0.2rem;
}

/* 멤버 카드 필드 열에서는 입력과 같이 가로 채움 */
.member-field .color-dropdown {
  display: block;
  width: 100%;
}

.member-card-actions {
  display: flex;
  gap: 0.6rem;
  align-items: stretch;
}

.member-save-form,
.member-remove-form {
  display: flex;
  flex: 1 1 0;
  min-width: 0;
}

@media (min-width: 821px) {
  .member-card {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 2fr);
    align-items: center;
  }

  .member-card-editor {
    display: flex;
    flex-wrap: nowrap;
    align-items: end;
    gap: 0.75rem;
    min-width: 0;
  }

  .member-card-fields {
    display: flex;
    flex-wrap: nowrap;
    align-items: end;
    gap: 0.75rem;
    min-width: 0;
    flex: 1 1 auto;
  }

  .member-field--color {
    flex: 0 0 8.5rem;
    width: 8.5rem;
  }

  .member-field--role,
  .member-field--share {
    flex: 0 0 6.5rem;
    width: 6.5rem;
  }

  .member-field--role select,
  .member-field--share input {
    width: 100%;
    box-sizing: border-box;
  }

  .member-card-actions {
    justify-content: flex-end;
    flex: 0 0 auto;
    margin-left: auto;
  }

  .member-save-form,
  .member-remove-form {
    flex: 0 0 auto;
  }
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

.invite-form {
  display: grid;
  gap: 0.85rem;
}

@media (min-width: 821px) {
  .invite-form {
    grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.2fr) minmax(6rem, 0.45fr) auto;
    align-items: end;
  }
}

.category-create-form {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 721px) {
  .category-create-form {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) auto auto;
    align-items: end;
  }
}

.category-color-field {
  display: grid;
  gap: 0.35rem;
}

.category-color-field > span {
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.category-tree {
  display: grid;
  gap: 0.75rem;
}

.category-card {
  display: grid;
  gap: 0.55rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
}

.category-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
}

.category-row.child {
  padding-left: 1rem;
  border-left: 2px solid var(--line);
}

.category-edit-form {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.55rem;
  flex: 1;
  min-width: 0;
}

.category-name-field {
  flex: 1;
  min-width: 10rem;
  margin: 0;
}

.category-name-field input {
  width: 100%;
}

.category-active {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin: 0;
  font-size: 0.88rem;
  font-weight: 600;
  white-space: nowrap;
}

.category-active input {
  width: auto;
}

.category-children {
  display: grid;
  gap: 0.45rem;
}

.category-meta {
  margin: 0;
  font-size: 0.85rem;
}

.category-swatch {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 999px;
  border: 1px solid rgba(20, 24, 22, 0.12);
  flex-shrink: 0;
}

.mobile-nav {
  display: none;
}

.flash-banner {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 14px;
  border: 1px solid transparent;
  font-weight: 700;
  animation: flash-in-block 0.25s ease both;
}

.flash-banner.flash-success,
.flash-toast.flash-success {
  background: #e8f6ef;
  border-color: #b7dcc8;
  color: var(--brand-deep);
}

.flash-banner.flash-error,
.flash-toast.flash-error {
  background: #fdecea;
  border-color: #f3c1bb;
  color: var(--danger);
}

.flash-banner.flash-info,
.flash-toast.flash-info {
  background: #eef3f8;
  border-color: #c9d7e6;
  color: #1d4f91;
}

.flash-toast {
  position: fixed;
  left: 50%;
  top: calc(var(--topbar-height) + 0.75rem);
  bottom: auto;
  transform: translateX(-50%);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  max-width: min(92vw, 420px);
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid transparent;
  box-shadow: var(--shadow);
  font-weight: 700;
  animation: flash-in 0.25s ease both;
}

.flash-close {
  border: none;
  background: transparent;
  color: inherit;
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  padding: 0;
}

@keyframes flash-in {
  from {
    opacity: 0;
    transform: translate(-50%, -10px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

@keyframes flash-in-block {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.cal-page-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}

.cal-page-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.6rem;
}

.cal-sync-form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.45rem 0.6rem;
}

.cal-sync-form label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 600;
  color: #858796;
}

.cal-sync-form input[type="date"] {
  padding: 0.3rem 0.45rem;
  border: 1px solid #d1d3e2;
  border-radius: 0.35rem;
  font-size: 0.85rem;
  color: #5a5c69;
  background: #fff;
}

.cal-sync-form input[type="date"]:disabled {
  opacity: 0.65;
  cursor: not-allowed;
}

.cal-sync-progress {
  position: fixed;
  left: 50%;
  top: 1.1rem;
  transform: translateX(-50%);
  z-index: 81;
  display: flex;
  align-items: center;
  gap: 0.7rem;
  max-width: min(92vw, 28rem);
  padding: 0.85rem 1rem;
  border-radius: 14px;
  border: 1px solid #c9d7e6;
  background: #eef3f8;
  color: #1d4f91;
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 0.92rem;
  line-height: 1.4;
}

.cal-sync-progress-spinner {
  flex-shrink: 0;
  width: 1.1rem;
  height: 1.1rem;
  border: 2px solid rgba(29, 79, 145, 0.25);
  border-top-color: #1d4f91;
  border-radius: 50%;
  animation: cal-sync-spin 0.7s linear infinite;
}

@keyframes cal-sync-spin {
  to {
    transform: rotate(360deg);
  }
}

.show-deleted-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--ink-soft);
  white-space: nowrap;
}

.show-deleted-toggle input {
  width: auto;
  margin: 0;
}

.cal-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.cal-toolbar-left {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  min-width: 0;
}

.cal-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.cal-nav {
  display: inline-flex;
  gap: 0.25rem;
}

.cal-nav-btn {
  width: 2rem;
  height: 2rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-size: 1.35rem;
  line-height: 1;
  color: var(--ink-soft);
}

.cal-nav-btn .mdi {
  font-size: 1.35rem;
  line-height: 1;
}

.cal-title {
  margin: 0;
  font-size: 1.25rem;
}

.cal-month {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.cal-month-head,
.cal-month-body {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.cal-month-head {
  background: #f7faf7;
  border-bottom: 1px solid var(--line);
}

.cal-weekday {
  padding: 0.55rem 0.4rem;
  text-align: center;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--ink-soft);
}

.cal-weekday.sun,
.cal-week-dayhead.sun {
  color: #b42318;
}

.cal-weekday.sat,
.cal-week-dayhead.sat {
  color: #1d4f91;
}

.cal-month-cell {
  min-height: 110px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 0.35rem;
  background: #fff;
}

.cal-month-cell:nth-child(7n) {
  border-right: none;
}

.cal-month-cell.outside {
  background: #f6f8f6;
  color: #8a9a90;
}

.cal-month-cell.today {
  background: rgba(15, 107, 76, 0.06);
}

.cal-month-cell-create {
  cursor: pointer;
}

.cal-month-cell-create:hover {
  background: rgba(15, 107, 76, 0.05);
}

.cal-month-cell-create:focus-visible {
  outline: 2px solid rgba(15, 107, 76, 0.35);
  outline-offset: -2px;
}

.cal-week-daycol-create,
.cal-week-allday-create {
  cursor: pointer;
}

.cal-week-daycol-create:hover,
.cal-week-allday-create:hover {
  background: rgba(15, 107, 76, 0.03);
}

.cal-day-number {
  display: inline-flex;
  min-width: 1.6rem;
  height: 1.6rem;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.cal-month-cell.today .cal-day-number {
  background: var(--brand);
  color: #fff;
}

.cal-month-events {
  display: grid;
  gap: 0.18rem;
}

.cal-chip {
  display: block;
  border-radius: 6px;
  padding: 0.12rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  background: var(--cal-fill, #0f6b4c14);
  color: var(--cal-ink, var(--brand-deep));
  border: 2px solid var(--cal-border, rgba(15, 107, 76, 0.45));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cal-chip.unpaid,
.cal-week-event.unpaid {
  border-style: dashed;
}

.cal-chip.deleted,
.cal-week-event.deleted {
  opacity: 0.62;
  text-decoration: line-through;
  border-style: dotted;
  border-color: rgba(180, 35, 24, 0.45);
  color: var(--ink-soft);
}

.cal-fab-stack {
  position: fixed;
  right: 1.25rem;
  bottom: 1.25rem;
  z-index: 200;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
}

body:has(.cal-legend-sheet[open]) .cal-fab-stack .cal-legend-fab,
body:has(.cal-legend-sheet[open]) .cal-fab-stack .cal-create-fab,
body:has(.create-event-dialog[open]) .cal-fab-stack .cal-legend-fab,
body:has(.create-event-dialog[open]) .cal-fab-stack .cal-create-fab {
  opacity: 0;
  pointer-events: none;
}

.cal-legend-fab,
.cal-create-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 3.6rem;
  height: 3.6rem;
  padding: 0;
  border-radius: 999px;
  font: inherit;
  font-weight: 700;
  letter-spacing: -0.02em;
  cursor: pointer;
  transition:
    transform 0.15s ease,
    background 0.15s ease,
    color 0.15s ease,
    opacity 0.15s ease;
}

.cal-legend-fab {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
  color: var(--brand-deep);
  font-size: 0.78rem;
  box-shadow: 0 8px 22px rgba(28, 42, 34, 0.12);
}

.cal-legend-fab:hover {
  background: #fff;
  transform: translateY(-2px);
}

.cal-create-fab {
  border: none;
  background: var(--brand);
  color: #fff;
  font-size: 1.65rem;
  line-height: 1;
  box-shadow: 0 10px 28px rgba(15, 107, 76, 0.28);
}

.cal-create-fab:hover {
  background: var(--brand-deep);
  transform: translateY(-2px);
}

.cal-legend-fab:focus-visible,
.cal-create-fab:focus-visible {
  outline: 2px solid var(--brand-deep);
  outline-offset: 3px;
}

.cal-create-fab:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.cal-legend-sheet {
  margin: auto auto 0.75rem;
  width: min(24rem, calc(100vw - 1.5rem));
  max-width: 24rem;
}

.cal-legend-sheet-panel {
  display: grid;
  gap: 1rem;
  padding: 1rem 1.15rem 1.25rem;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  max-height: min(72vh, 560px);
  overflow: auto;
}

.cal-legend-sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  position: sticky;
  top: 0;
  z-index: 1;
  padding-bottom: 0.15rem;
  background: rgba(255, 255, 255, 0.98);
}

.cal-legend-sheet-title {
  margin: 0;
  font-size: 1.1rem;
}

.cal-legend-sheet-close {
  flex-shrink: 0;
  min-width: 2.5rem;
  padding-inline: 0.65rem;
}

.cal-legend-sheet-body {
  display: grid;
  gap: 1.1rem;
}

.cal-legend-section {
  display: grid;
  gap: 0.55rem;
}

.cal-legend-section-title {
  margin: 0;
  font-family: var(--font-body);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0;
  color: var(--ink-soft);
}

.cal-legend-section-body {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  align-items: center;
}

.cal-legend-item,
.cal-legend-style {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.35;
}

.cal-legend-swatch,
.cal-legend-line {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 4px;
  border: 2px solid var(--cal-border, rgba(15, 107, 76, 0.45));
  background: transparent;
  flex-shrink: 0;
}

.cal-legend-swatch.filled {
  border-color: rgba(20, 24, 22, 0.12);
  background: var(--cal-fill, rgba(148, 163, 184, 0.22));
}

.cal-legend-line {
  width: 1.25rem;
  height: 0;
  border-radius: 0;
  border-top-width: 2px;
  border-right: none;
  border-bottom: none;
  border-left: none;
}

.cal-legend-style.paid .cal-legend-line {
  border-style: solid;
  border-color: var(--brand);
}

.cal-legend-style.unpaid .cal-legend-line {
  border-style: dashed;
  border-color: var(--brand);
}


.cal-more {
  font-size: 0.7rem;
  font-weight: 700;
  color: var(--ink-soft);
  padding: 0.1rem 0.2rem;
}

.cal-week {
  border: 1px solid var(--line);
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
}

.cal-week-x-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

.cal-week-board {
  min-width: 720px;
}

.cal-week-allday {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  border-bottom: 1px solid var(--line);
  background: #f7faf7;
}

.cal-week-gutter {
  padding: 0.7rem 0.35rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--ink-soft);
  border-right: 1px solid var(--line);
}

.cal-week-allday-col {
  border-right: 1px solid var(--line);
  min-height: 72px;
  padding: 0.35rem;
}

.cal-week-allday-col:last-child,
.cal-week-daycol:last-child {
  border-right: none;
}

.cal-week-dayhead {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.1rem;
  margin-bottom: 0.35rem;
  font-size: 0.75rem;
  color: var(--ink-soft);
}

.cal-week-dayhead strong {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 1.05rem;
  color: var(--ink);
}

.cal-week-allday-col.today .cal-week-dayhead strong,
.cal-week-daycol.today {
  box-shadow: inset 0 0 0 1px rgba(15, 107, 76, 0.18);
}

.cal-week-allday-list {
  display: grid;
  gap: 0.2rem;
}

.cal-week-y-scroll {
  overflow-y: auto;
  max-height: min(70vh, 760px);
}

.cal-week-timed {
  display: grid;
  grid-template-columns: 56px repeat(7, minmax(0, 1fr));
  position: relative;
}

.cal-week-hours {
  border-right: 1px solid var(--line);
}

.cal-week-hour {
  height: 48px;
  padding: 0.15rem 0.3rem 0 0;
  text-align: right;
  font-size: 0.68rem;
  color: var(--ink-soft);
  font-weight: 600;
}

.cal-week-daycol {
  position: relative;
  border-right: 1px solid var(--line);
  height: calc(48px * 24);
}

.cal-week-gridlines {
  position: absolute;
  inset: 0;
}

.cal-week-gridline {
  height: 48px;
  border-bottom: 1px solid #e7eee8;
}

.cal-week-event {
  position: absolute;
  left: 3px;
  right: 3px;
  z-index: 1;
  box-sizing: border-box;
  border-radius: 8px;
  padding: 0.25rem 0.35rem;
  background: var(--cal-fill, rgba(15, 107, 76, 0.08));
  color: var(--cal-ink, var(--brand-deep));
  border: 2px solid var(--cal-border, rgba(15, 107, 76, 0.45));
  overflow: hidden;
  font-size: 0.72rem;
  line-height: 1.25;
  display: flex;
  flex-direction: column;
  gap: 0.08rem;
  min-width: 0;
}

.cal-week-event:hover {
  z-index: 20;
}

.cal-week-event strong {
  font-size: 0.78rem;
}

.cal-week-event span {
  opacity: 0.9;
}

.create-event-times {
  display: grid;
  gap: 0.75rem;
}

@media (min-width: 720px) {
  .create-event-times {
    grid-template-columns: 1fr 1fr;
  }
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 820px) {
  .desktop-nav {
    display: none;
  }

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

  .stat-value-row {
    flex-wrap: wrap;
    align-items: baseline;
  }

  .stat-cumulative {
    white-space: normal;
  }

  .cross-table-wrap {
    margin: 0 -0.35rem;
    padding: 0 0.35rem;
  }

  .cross-table {
    min-width: max(100%, 28rem);
  }

  .cal-fab-stack {
    right: 1rem;
    bottom: 1rem;
  }

  .cal-month-cell {
    min-height: 84px;
  }

  .cal-chip {
    font-size: 0.66rem;
  }

  .flash-toast,
  .cal-sync-progress {
    top: calc(var(--topbar-height) + 0.5rem);
  }

  .create-event-dialog {
    margin: auto 0 0;
    max-width: none;
    width: 100%;
  }

  .create-event-dialog .app-dialog-panel {
    border-bottom-left-radius: 0;
    border-bottom-right-radius: 0;
    max-height: min(88vh, 720px);
  }
}
