:root {
  --brand: #D7005B;
  --brand-dark: #a90046;
  --ink: #20242a;
  --text: var(--ink);
  --muted: #6a7280;
  --line: #dde2ea;
  --panel: #ffffff;
  --page: #f5f7fa;
  --soft: #f8fafc;
  --good: #0e8f62;
  --warn: #c77800;
  --bad: #c92a2a;
  --danger: var(--bad);
  --blue: #1e63b6;
  --brand-soft: #fff0f6;
  --good-soft: #e9f6f0;
  --warn-soft: #fff7ed;
  --bad-soft: #fdf0f0;
  --blue-soft: #eef4fb;
  --shadow: 0 8px 18px rgba(20, 26, 34, 0.08);
  --shadow-sm: 0 8px 18px rgba(20, 26, 34, 0.08);
  --shadow-lg: 0 14px 34px rgba(20, 26, 34, 0.12);
  color-scheme: light;
}

.housing-title-button,
.space-title-button {
  cursor: pointer;
  font: inherit;
}

.housing-detail-modal,
.space-detail-modal {
  width: min(920px, 100%);
}

@media (max-width: 1180px) {
  .housing-kpi-grid,
  .housing-card-grid,
  .property-kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .housing-form-quick-grid,
  .housing-form-field-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .housing-group-toolbar,
  .housing-unit-row,
  .property-form-grid,
  .property-expense-grid {
    grid-template-columns: 1fr;
  }

  .housing-unit-actions {
    justify-content: flex-start;
  }
}

@media (max-width: 760px) {
  .housing-kpi-grid,
  .housing-card-grid,
  .housing-card-money,
  .housing-card-info,
  .housing-detail-facts,
  .housing-form-quick-grid,
  .housing-form-field-grid,
  .property-form-grid,
  .property-expense-grid,
  .property-expense-fields,
  .property-detail-grid {
    grid-template-columns: 1fr;
  }

  .housing-card-head,
  .housing-form-head,
  .housing-expiry-item {
    align-items: stretch;
    flex-direction: column;
  }

  .housing-shell-actions {
    justify-content: stretch;
  }

  .housing-group-toolbar,
  .housing-search-form {
    grid-template-columns: 1fr;
  }

  .housing-group-mode {
    justify-content: stretch;
  }

  .housing-group-mode .compact-action,
  .housing-search-form .compact-action {
    width: 100%;
  }

  .housing-group summary {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .housing-group summary b {
    white-space: nowrap;
  }

  .housing-shell-actions .inline-form,
  .housing-shell-actions .compact-action,
  .housing-form-quick-grid .wide,
  .property-form-grid .span-2,
  .property-expense-fields .span-2 {
    width: 100%;
    grid-column: auto;
  }

  .housing-expiry-actions {
    justify-content: stretch;
    width: 100%;
  }

  .housing-expiry-actions .compact-action {
    flex: 1;
  }

  .housing-detail-grid,
  .space-detail-summary {
    grid-template-columns: 1fr;
  }

  .housing-resident-form-row {
    grid-template-columns: 1fr;
  }

  .housing-resident-form-row .housing-resident-remove {
    justify-self: end;
    min-width: 72px;
  }
}

.test-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 4px 9px;
  border-radius: 999px;
  background: var(--warn-soft);
  color: var(--warn);
  font-size: 12px;
  font-weight: 800;
}

.full-width {
  width: 100%;
  justify-content: center;
}

.compact-action.danger {
  color: var(--bad);
}

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

  .department-calendar-sidebar {
    position: static;
  }

  .department-calendar-weekdays,
  .department-calendar-grid {
    min-width: 860px;
  }

  .department-operations-metrics {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .department-operations-grid,
  .fellowship-screen-grid,
  .fellowship-section-grid {
    grid-template-columns: 1fr;
  }

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

  .fellowship-operations-topbar {
    position: static;
    align-items: stretch;
    flex-direction: column;
  }

  .fellowship-operations-nav {
    justify-content: flex-start;
  }

  .fellowship-schedule-grid,
  .fellowship-trend-grid,
  .fellowship-stats-summary,
  .fellowship-check-summary,
  .fellowship-stats-list-grid,
  .fellowship-page-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 760px) {
  .department-calendar-pending-item,
  .department-calendar-pending-actions {
    grid-template-columns: 1fr;
  }

  .department-calendar-hero,
  .department-calendar-board-head,
  .department-operations-hero,
  .department-operations-workboard-head,
  .fellowship-operations-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .department-calendar-export-status {
    min-width: 0;
  }

  .department-operations-head-actions {
    width: 100%;
    min-width: 0;
  }

  .department-calendar-board-controls,
  .department-calendar-month-actions,
  .department-calendar-tool-actions {
    justify-content: stretch;
  }

  .department-calendar-board-controls,
  .department-calendar-tool-actions {
    width: 100%;
  }

  .department-calendar-tool-actions {
    padding-left: 0;
    padding-top: 10px;
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .department-calendar-month-actions .compact-action,
  .department-calendar-tool-actions .compact-action {
    flex: 1;
  }

  .department-calendar-floating-panel {
    position: static;
    width: auto;
    max-height: none;
  }

  .department-calendar-detail-card {
    max-width: none;
    margin-right: 0;
  }

  .department-calendar-detail-list {
    grid-template-columns: 1fr;
  }

  .department-operations-metrics,
  .department-request-sync-grid,
  .department-operations-funnel-row,
  .department-operations-activity-grid,
  .department-operations-summary,
  .fellowship-metric-grid,
  .fellowship-health-grid,
  .fellowship-health-grid.visit,
  .fellowship-trend-grid,
  .fellowship-stats-summary,
  .fellowship-stats-list-grid,
  .fellowship-stats-chart-grid,
  .fellowship-ring-grid {
    grid-template-columns: 1fr;
  }

  .fellowship-board-head,
  .fellowship-platform-head {
    align-items: stretch;
    flex-direction: column;
  }

  .fellowship-board-date {
    text-align: left;
  }

  .department-operations-kanban-grid {
    grid-template-columns: 1fr;
  }

  .department-request-item {
    grid-template-columns: 1fr;
  }

  .department-request-meta {
    justify-content: flex-start;
  }

  .department-operations-funnel-row b {
    display: none;
  }

  .operations-scope-select,
  .operations-week-select {
    width: 100%;
    min-width: 0;
  }

  .operation-owner-picker,
  .operation-deadline-picker,
  .operation-week-modal-body {
    grid-template-columns: 1fr;
  }

  .department-operations-toolbar,
  .department-operations-cumulative-actions {
    align-items: stretch;
  }

  .operation-task-form .form-grid,
  .fellowship-check-toolbar,
  .fellowship-check-summary,
  .fellowship-admin-grid,
  .fellowship-region-head,
  .fellowship-team-head,
  .fellowship-member-row,
  .fellowship-member-create,
  .fellowship-member-bulk,
  .fellowship-role-assign,
  .fellowship-schedule-grid,
  .fellowship-role-grid,
  .fellowship-page-grid,
  .fellowship-region-summary {
    grid-template-columns: 1fr;
  }

  .fellowship-check-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .fellowship-check-type-toggle,
  .fellowship-check-date input {
    width: 100%;
  }

  .fellowship-check-type-toggle button {
    flex: 1;
  }
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--page);
  font-family: Arial, "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  letter-spacing: 0;
}

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

input,
select,
textarea {
  font-size: 16px;
}

button {
  border: 0;
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.multiline-text {
  white-space: pre-wrap;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 420px;
}

.login-visual {
  padding: 48px;
  color: #fff;
  background:
    linear-gradient(135deg, rgba(215, 0, 91, 0.94), rgba(22, 25, 31, 0.9)),
    repeating-linear-gradient(90deg, rgba(255, 255, 255, 0.16) 0 1px, transparent 1px 88px),
    repeating-linear-gradient(0deg, rgba(255, 255, 255, 0.1) 0 1px, transparent 1px 88px);
  background-size: cover;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.login-visual h1 {
  margin: 0;
  max-width: 680px;
  font-size: clamp(36px, 5vw, 72px);
  line-height: 1.04;
}

.login-visual p {
  max-width: 620px;
  font-size: 18px;
  line-height: 1.7;
}

.login-title-lockup {
  margin-top: auto;
}

.login-logo {
  font-size: clamp(38px, 6.8vw, 96px);
  line-height: 0.95;
  font-weight: 900;
  letter-spacing: 0;
  overflow-wrap: anywhere;
}

.login-card {
  background: var(--panel);
  padding: 44px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  border-left: 1px solid rgba(0, 0, 0, 0.08);
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 800;
  font-size: 20px;
  margin-bottom: 28px;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--brand);
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 16px;
}

.field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 16px;
  padding: 11px 12px;
  outline: none;
}

.field textarea {
  resize: vertical;
  min-height: 90px;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(215, 0, 91, 0.12);
}

.input-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.table-inline-action {
  min-width: 240px;
}

.table-inline-action .table-input {
  min-width: 130px;
}

.table-inline-action .ghost {
  padding: 8px 10px;
  white-space: nowrap;
}

.check-result {
  min-height: 18px;
  margin: 0;
}

.account-login-check {
  margin-top: 4px;
  font-size: 12px;
}

.check-result.ok {
  color: var(--good);
}

.check-result.bad {
  color: var(--danger);
}

.primary,
.secondary,
.ghost,
.danger {
  border-radius: 8px;
  min-height: 40px;
  padding: 10px 14px;
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  white-space: nowrap;
}

.primary {
  background: var(--brand);
  color: #fff;
}

.primary:hover {
  background: var(--brand-dark);
}

.secondary {
  background: var(--ink);
  color: #fff;
}

.ghost {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
}

.danger {
  background: var(--bad-soft);
  color: var(--bad);
  border: 1px solid #f2c2c2;
}

.hint {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.error {
  border: 1px solid #f2c2c2;
  background: var(--bad-soft);
  color: var(--bad);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 10px 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 260px 1fr;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  overflow-y: auto;
  background: #16191f;
  color: #dce2ea;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.side-title {
  display: flex;
  align-items: center;
  gap: 10px;
  width: fit-content;
  border: 0;
  background: transparent;
  color: #fff;
  cursor: pointer;
  font-weight: 900;
  padding: 0;
  text-align: left;
}

.side-title:hover,
.side-title:focus-visible {
  color: #fff;
}

.account-box {
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.04);
}

.account-box strong {
  display: block;
  color: #fff;
  margin-bottom: 4px;
}

.nav {
  display: grid;
  gap: 16px;
}

.nav-group {
  display: grid;
  gap: 6px;
}

.nav-heading {
  color: #8f9baa;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  padding: 0 4px;
}

.nav button {
  width: 100%;
  text-align: left;
  color: #dce2ea;
  background: transparent;
  border-radius: 8px;
  padding: 11px 12px;
  font-weight: 800;
}

.nav button.active,
.nav button:hover {
  color: #fff;
  background: rgba(215, 0, 91, 0.18);
}

.main {
  min-width: 0;
  padding: 24px;
}

.bootstrap-sync-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 28px;
  margin: 0 0 12px;
  padding: 6px 10px;
  border: 1px solid #c7d2fe;
  border-radius: 6px;
  background: #eef2ff;
  color: #3730a3;
  font-size: 12px;
  font-weight: 900;
  line-height: 1.3;
}

.bootstrap-sync-indicator span {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: #4f46e5;
  flex: 0 0 auto;
}

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

.topbar h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.2;
  flex: 0 0 auto;
  white-space: nowrap;
}

.toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.topbar > .toolbar {
  flex: 1 1 auto;
  justify-content: flex-end;
  min-width: 0;
  padding-right: 132px;
}

.session-timer {
  position: fixed;
  top: 14px;
  right: 18px;
  z-index: 1200;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  font-size: 14px;
  font-weight: 800;
  line-height: 1;
  padding: 11px 16px;
  white-space: nowrap;
  box-shadow: var(--shadow);
}

.session-timer.warning {
  border-color: rgba(215, 0, 91, 0.34);
  background: var(--brand-soft);
  color: var(--brand);
}

.session-warning-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.44);
}

.session-warning-dialog {
  width: min(360px, 100%);
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  padding: 20px;
}

.session-warning-dialog h3,
.session-warning-dialog p {
  margin: 0;
}

.session-warning-dialog > strong {
  font-size: 30px;
  line-height: 1;
}

.date-filter {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.date-filter label,
.date-filter span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.date-filter input {
  width: 142px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 9px 10px;
}

.grid {
  display: grid;
  gap: 16px;
}

.cards {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.card {
  padding: 16px;
}

.metric-card {
  text-align: left;
}

.metric-card strong {
  font-variant-numeric: tabular-nums;
}

.metric-card:hover {
  border-color: rgba(215, 0, 91, 0.38);
}

.metric-card.direction-sent {
  box-shadow: inset 4px 0 0 var(--blue);
}

.metric-card.direction-received {
  box-shadow: inset 4px 0 0 var(--brand);
}

.card.accent {
  border-color: rgba(215, 0, 91, 0.42);
  box-shadow: inset 4px 0 0 var(--brand);
}

.card.accent-soft {
  box-shadow: inset 4px 0 0 rgba(215, 0, 91, 0.42);
}

.card.good-card {
  box-shadow: inset 4px 0 0 var(--good);
}

.card.warn-card {
  box-shadow: inset 4px 0 0 var(--warn);
}

.card.danger-card {
  border-color: rgba(201, 42, 42, 0.32);
  box-shadow: inset 4px 0 0 var(--bad);
}

.card .label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.card .value {
  font-size: 30px;
  font-weight: 900;
  font-variant-numeric: tabular-nums;
  line-height: 1.05;
  margin-top: 8px;
  max-width: 100%;
  overflow-wrap: anywhere;
}

.kpi-sub {
  color: var(--muted);
  font-size: 12px;
  margin-top: 6px;
}

.panel {
  padding: 18px;
}

.panel h3 {
  margin: 0 0 14px;
  font-size: 18px;
}

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

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

.panel-head h3 {
  margin: 0;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-weight: 900;
  text-align: left;
}

.link-button:hover {
  color: var(--brand);
}

.request-title-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.request-list-panel .panel-head {
  margin-bottom: 12px;
}

.data-loading-panel {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
}

.data-loading-copy {
  display: grid;
  gap: 4px;
  min-height: 38px;
  align-content: center;
}

.data-loading-copy strong {
  color: var(--ink);
  font-size: 14px;
  font-weight: 900;
}

.data-loading-copy span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.skeleton-kpi-grid,
.skeleton-panel-grid {
  display: grid;
  gap: 12px;
}

.skeleton-kpi-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

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

.skeleton-card {
  display: grid;
  gap: 12px;
  align-content: start;
  min-width: 0;
  overflow: hidden;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.skeleton-kpi {
  min-height: 118px;
}

.skeleton-panel {
  min-height: 236px;
}

.skeleton-block {
  position: relative;
  overflow: hidden;
  display: block;
  border-radius: 7px;
  background: var(--line);
}

.skeleton-block::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.68), transparent);
  animation: skeleton-shimmer 1.35s ease-in-out infinite;
}

.skeleton-line {
  width: 72%;
  height: 12px;
}

.skeleton-line.short {
  width: 42%;
}

.skeleton-line.medium {
  width: 56%;
}

.skeleton-line.wide {
  width: 86%;
}

.skeleton-value {
  width: 48%;
  height: 30px;
}

.skeleton-chart {
  width: 100%;
  height: 136px;
}

@keyframes skeleton-shimmer {
  100% {
    transform: translateX(100%);
  }
}

@media (max-width: 760px) {
  .skeleton-kpi-grid,
  .skeleton-panel-grid {
    grid-template-columns: 1fr;
  }
}

.request-table-wrap td:first-child {
  min-width: 280px;
}

.due-chip,
.next-action-chip {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 9px;
  margin-top: 7px;
  background: #f4f6f8;
  color: #56606d;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.due-chip.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.due-chip.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.due-chip.done {
  background: var(--soft);
  color: var(--muted);
}

.next-action-chip {
  margin-top: 0;
  background: var(--blue-soft);
  color: var(--blue);
}

.filter-banner {
  border: 1px solid rgba(215, 0, 91, 0.2);
  border-radius: 8px;
  background: var(--brand-soft);
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.request-quick-filters,
.space-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.request-quick-filter,
.space-tab {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 9px 12px;
  font-weight: 900;
}

.compact-import-panel {
  align-self: start;
  padding: 0;
  overflow: hidden;
}

.compact-import-panel summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 56px;
  padding: 14px 16px;
  cursor: pointer;
  font-weight: 900;
  list-style: none;
}

.compact-import-panel summary::-webkit-details-marker {
  display: none;
}

.compact-import-panel summary em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.compact-import-panel form {
  padding: 0 16px 16px;
}

.compact-action {
  min-height: 32px;
  padding: 6px 8px;
  font-size: 12px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 92px;
  z-index: 50;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100vw - 36px));
}

.toast {
  border: 1px solid rgba(14, 143, 98, 0.22);
  border-radius: 8px;
  background: var(--good-soft);
  color: #075f42;
  padding: 12px 14px;
  text-align: left;
  font-weight: 800;
  box-shadow: var(--shadow);
  cursor: pointer;
}

.toast.bad {
  border-color: rgba(201, 42, 42, 0.24);
  background: var(--bad-soft);
  color: var(--danger);
}

.toast.info {
  border-color: rgba(30, 99, 182, 0.24);
  background: var(--blue-soft);
  color: var(--blue);
  padding-left: 34px;
  position: relative;
}

.toast.info::before {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -7px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: toast-spin 0.8s linear infinite;
}

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

.app-dialog {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  color: var(--ink);
  padding: 20px;
  width: min(420px, calc(100vw - 32px));
  box-shadow: var(--shadow-lg);
}

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

.app-dialog h3 {
  margin: 0 0 8px;
}

.app-dialog p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.app-dialog textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  resize: vertical;
  margin-bottom: 14px;
  box-sizing: border-box;
}

.app-dialog .toolbar {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.time-preset-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.time-preset-chip {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--ink);
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}

.time-preset-chip:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.time-preset-chip.active {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--brand);
}

.time-preset-summary {
  margin-left: auto;
  font-size: 12px;
  font-weight: 800;
  color: var(--muted);
}

.time-preset-summary.bad {
  color: var(--danger);
}

.quantity-input {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  gap: 6px;
  align-items: stretch;
}

.quantity-input input {
  text-align: center;
}

.quantity-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--ink);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
}

.quantity-step:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.draft-attachment-picker {
  border: 1px dashed transparent;
  border-radius: 10px;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.draft-attachment-picker.is-dragover {
  border-color: var(--brand);
  background: var(--brand-soft);
}

.image-lightbox {
  width: min(920px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  display: grid;
  gap: 10px;
}

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

.image-lightbox-head strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-lightbox-body {
  position: relative;
  display: grid;
  place-items: center;
  background: rgba(20, 26, 34, 0.05);
  border-radius: 10px;
  overflow: hidden;
  min-height: 240px;
  max-height: calc(100vh - 190px);
}

.image-lightbox-body img {
  max-width: 100%;
  max-height: calc(100vh - 190px);
  transition: transform 0.08s linear;
  cursor: grab;
  user-select: none;
}

.image-lightbox-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--panel);
  font-size: 18px;
  font-weight: 800;
  cursor: pointer;
  z-index: 2;
}

.image-lightbox-nav[data-lightbox-prev] {
  left: 10px;
}

.image-lightbox-nav[data-lightbox-next] {
  right: 10px;
}

.image-lightbox-hint {
  margin: 0;
  text-align: center;
}

.request-hover-preview {
  position: fixed;
  z-index: 60;
  display: grid;
  gap: 6px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  pointer-events: none;
}

.request-hover-preview strong {
  font-size: 13px;
}

.request-hover-meta {
  font-size: 11px;
  font-weight: 800;
  color: var(--brand);
}

.request-hover-preview p {
  margin: 0;
  font-size: 12px;
  line-height: 1.5;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.field-invalid {
  border-color: var(--danger) !important;
  box-shadow: 0 0 0 2px rgba(201, 42, 42, 0.15);
}

:root[data-theme="dark"] {
  --brand: #fb4f7d;
  --brand-dark: #e11d58;
  --ink: #f1f5f9;
  --text: var(--ink);
  --muted: #a8b3c5;
  --line: #334155;
  --panel: #0f172a;
  --page: #020617;
  --soft: #111c30;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #fb7185;
  --danger: var(--bad);
  --blue: #60a5fa;
  --brand-soft: rgba(244, 63, 94, 0.14);
  --good-soft: rgba(16, 185, 129, 0.15);
  --warn-soft: rgba(245, 158, 11, 0.15);
  --bad-soft: rgba(244, 63, 94, 0.15);
  --blue-soft: rgba(59, 130, 246, 0.16);
  --shadow: 0 8px 18px rgba(0, 0, 0, 0.45);
  --shadow-sm: 0 8px 18px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 14px 34px rgba(0, 0, 0, 0.55);
  color-scheme: dark;
}

[data-theme="dark"] .case-modal,
[data-theme="dark"] .space-calendar,
[data-theme="dark"] .space-day-timeline,
[data-theme="dark"] .fixed-reservation-group,
[data-theme="dark"] .comment-item {
  background: var(--panel);
}

[data-theme="dark"] .comment-item.reply-item {
  background: var(--soft);
}

[data-theme="dark"] .department-calendar-event:hover,
[data-theme="dark"] .department-calendar-event.active {
  background: var(--soft);
}

[data-theme="dark"] .toast {
  background: var(--good-soft);
  color: var(--good);
}

[data-theme="dark"] .toast.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

.comment-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.comment-thread {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.comment-list > .comment-thread {
  position: relative;
  padding-left: 20px;
}

.comment-list > .comment-thread::before {
  content: "";
  position: absolute;
  left: 2px;
  top: 16px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--brand);
  opacity: 0.45;
}

.comment-list > .comment-thread::after {
  content: "";
  position: absolute;
  left: 6px;
  top: 32px;
  bottom: -10px;
  width: 2px;
  background: var(--line);
}

.comment-list > .comment-thread:last-child::after {
  display: none;
}

.comment-replies {
  display: grid;
  gap: 8px;
  margin-left: 22px;
  padding-left: 14px;
  border-left: 2px solid rgba(215, 0, 91, 0.18);
  min-width: 0;
}

.comment-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--panel);
  min-width: 0;
}

.comment-item.reply-item {
  background: var(--soft);
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
  min-width: 0;
}

.comment-head div {
  display: grid;
  gap: 3px;
}

.comment-head em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.comment-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.comment-item p {
  margin: 6px 0;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.comment-item .attachment-list {
  margin: 8px 0;
}

.comment-item span {
  color: var(--muted);
  font-size: 12px;
}

.comment-date {
  display: inline-block;
}

.comment-form {
  display: grid;
  gap: 10px;
}

.comment-form textarea {
  width: 100%;
  min-height: 90px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  resize: vertical;
}

.answer-list,
.template-answer-list,
.template-field-list {
  display: grid;
  gap: 10px;
}

.answer-item,
.template-answer-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.answer-item p {
  margin: 6px 0 0;
  white-space: pre-wrap;
  color: var(--muted);
}

.template-answer-head {
  display: grid;
  gap: 3px;
  margin-bottom: 10px;
}

.template-answer-head span {
  color: var(--muted);
  font-size: 12px;
}

.template-field-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.15fr) minmax(200px, 1.25fr) auto;
  gap: 8px;
  align-items: center;
}

.template-field-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--panel);
}

.check-inline {
  display: inline-flex;
  gap: 6px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.check-inline input {
  width: auto;
}

.church-check-panel {
  display: grid;
  gap: 10px;
  margin: 8px 0 12px;
}

.church-check-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(132px, 1fr));
  gap: 8px;
}

.church-check {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 8px 10px;
  color: var(--ink);
}

.church-check:has(input:checked) {
  border-color: rgba(215, 0, 91, 0.38);
  background: var(--brand-soft);
  color: var(--brand);
}

.reply-target {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  border: 1px solid rgba(215, 0, 91, 0.22);
  border-radius: 8px;
  background: var(--brand-soft);
  color: var(--brand);
  padding: 8px 10px;
  font-weight: 800;
}

.reply-target[hidden] {
  display: none;
}

.backup-panel {
  margin-top: 16px;
}

.file-button {
  position: relative;
  overflow: hidden;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dashboard-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
  border-bottom: 1px solid var(--line);
}

.dashboard-tab {
  border: 0;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--muted);
  min-height: 42px;
  padding: 10px 12px 12px;
  font-size: 14px;
  font-weight: 900;
  cursor: pointer;
}

.dashboard-tab.active {
  border-color: var(--brand);
  color: var(--brand);
}

.chart-panel {
  min-height: 270px;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 142px 1fr;
  gap: 18px;
  align-items: center;
}

.donut {
  width: 142px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 50%;
  background: var(--panel);
}

.donut span {
  position: relative;
  z-index: 1;
  display: grid;
  text-align: center;
  font-weight: 900;
  font-size: 26px;
}

.donut small {
  color: var(--muted);
  font-size: 12px;
}

.donut-legend {
  display: grid;
  gap: 8px;
}

.donut-legend div {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 13px;
}

.donut-legend i {
  width: 12px;
  height: 12px;
  border-radius: 3px;
}

.line-chart svg {
  width: 100%;
  height: 138px;
}

.line-chart line {
  stroke: #d9dee7;
  stroke-width: 1;
}

.line-chart polyline {
  fill: none;
  stroke-width: 4;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.line-chart .created {
  stroke: var(--brand);
}

.line-chart .completed {
  stroke: var(--good);
}

.line-labels,
.chart-legend {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
}

.chart-legend {
  justify-content: flex-start;
  margin-top: 10px;
}

.chart-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.created-dot,
.completed-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.created-dot {
  background: var(--brand);
}

.completed-dot {
  background: var(--good);
}

.mini-bars,
.drill-list,
.risk-list,
.flow-list {
  display: grid;
  gap: 10px;
}

.type-distribution-list {
  display: grid;
  gap: 8px;
  max-height: 250px;
  overflow: auto;
  padding-right: 4px;
}

.type-distribution-row {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(86px, 1fr) 46px 42px;
  gap: 8px 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 9px 10px;
  text-align: left;
}

.type-distribution-row:hover {
  border-color: rgba(215, 0, 91, 0.42);
}

.type-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 900;
}

.type-count,
.type-percent {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: right;
  white-space: nowrap;
}

.type-track {
  grid-column: 1 / -1;
  height: 8px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.type-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.target-picker {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.target-picker input {
  margin: 0;
}

.selected-targets,
.target-picker-list,
.collab-list {
  display: grid;
  gap: 8px;
}

.selected-target-chip,
.target-option,
.collab-row {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  display: grid;
  gap: 8px;
  align-items: center;
  cursor: pointer;
}

.selected-target-chip {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 9px 10px;
  text-align: left;
}

.selected-target-chip strong,
.target-option b {
  color: var(--brand);
  font-size: 12px;
}

.target-picker-list {
  max-height: 300px;
  overflow: auto;
}

.target-option {
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 10px;
  text-align: left;
}

.target-option span,
.collab-row span {
  display: grid;
  gap: 3px;
}

.target-option em,
.collab-row em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.target-cascade {
  display: grid;
  gap: 12px;
}

.target-picker-section {
  display: grid;
  gap: 8px;
}

.target-picker-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.target-picker-title strong {
  font-size: 13px;
}

.target-picker-title span {
  color: var(--muted);
  font-size: 12px;
}

.request-church-tabs,
.request-department-grid,
.request-section-grid {
  display: grid;
  gap: 8px;
}

.request-church-tabs {
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
}

.request-department-grid {
  grid-template-columns: repeat(auto-fit, minmax(118px, 1fr));
}

.request-section-grid {
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
}

.request-church-tab,
.request-department-card,
.request-section-option {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.request-section-option-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 36px;
  gap: 6px;
  min-width: 0;
}

.request-church-tab {
  min-height: 40px;
  padding: 9px 10px;
  text-align: center;
  font-weight: 900;
}

.request-department-card {
  min-height: 68px;
  padding: 11px;
  display: grid;
  align-content: center;
  gap: 5px;
}

.request-department-card span {
  color: var(--muted);
  font-size: 12px;
}

.request-section-option {
  min-height: 62px;
  padding: 10px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
}

.request-section-option span {
  display: grid;
  gap: 3px;
}

.request-section-option em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

.request-section-option b {
  color: var(--brand);
  font-size: 12px;
}

.request-church-tab.active,
.request-department-card.active,
.request-section-option.active {
  border-color: rgba(215, 0, 91, 0.42);
  background: var(--brand-soft);
  color: var(--brand);
}

.request-section-option:disabled {
  cursor: not-allowed;
  opacity: 0.56;
  background: var(--soft);
}

.request-target-favorite-toggle {
  min-width: 0;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  font-weight: 900;
}

.request-target-favorite-toggle.active {
  border-color: rgba(199, 120, 0, 0.38);
  background: var(--warn-soft);
  color: var(--warn);
}

.request-target-favorites {
  padding-bottom: 2px;
}

.mini-bar-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) 1.6fr 48px;
  gap: 10px;
  align-items: center;
  font-size: 13px;
}

.ranking-row {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 10px;
  text-align: left;
  grid-template-columns: minmax(120px, 1fr) 1.4fr 56px;
}

.ranking-row small {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
}

.mini-track {
  height: 10px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.mini-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.echart {
  width: 100%;
  min-height: 280px;
}

.echart-wide {
  min-height: 340px;
}

.columns-2 {
  grid-template-columns: 1.3fr 1fr;
}

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

.bar-row {
  display: grid;
  grid-template-columns: 120px 1fr 56px;
  gap: 10px;
  align-items: center;
  margin: 10px 0;
  font-size: 13px;
}

.bar-track {
  height: 12px;
  border-radius: 999px;
  background: var(--soft);
  overflow: hidden;
}

.bar-track.tall {
  height: 14px;
  margin-top: 12px;
}

.bar {
  height: 100%;
  background: var(--brand);
}

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

.block {
  display: block;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  font-variant-numeric: tabular-nums;
}

th,
td {
  border-bottom: 1px solid #edf0f4;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

th {
  color: #596273;
  font-size: 12px;
  text-transform: uppercase;
}

tr.clickable-row {
  cursor: pointer;
}

tr.clickable-row:hover {
  background: var(--soft);
}

tr.selected-row {
  background: rgba(215, 0, 91, 0.07);
}

.table-input {
  width: 100%;
  min-width: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-size: 16px;
  padding: 8px 9px;
  outline: none;
}

.table-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(215, 0, 91, 0.12);
}

.table-input:disabled {
  background: var(--soft);
  color: var(--muted);
}

.case-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(20, 24, 31, 0.48);
}

.case-modal {
  width: min(980px, 100%);
  max-height: min(86vh, 760px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
}

.case-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}

.case-modal-head h3 {
  margin: 4px 0;
  font-size: 20px;
  line-height: 1.35;
}

.case-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  padding: 20px;
}

.case-modal-grid h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.request-template-preview-modal {
  width: min(760px, 100%);
}

.request-template-preview-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.request-template-preview-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.request-template-preview-summary > div,
.request-template-preview-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  padding: 12px;
}

.request-template-preview-field.blocked,
.template-answer-blocked,
.template-contact-policy {
  border: 1px solid rgba(201, 42, 42, 0.18);
  border-radius: 8px;
  background: var(--bad-soft);
  padding: 12px;
}

.template-contact-policy {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.template-contact-policy p {
  margin: 0;
  color: #5b6470;
  font-size: 13px;
  line-height: 1.5;
}

.template-contact-policy textarea {
  min-height: 74px;
}

.request-template-preview-summary span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 12px;
}

.request-template-preview-summary strong {
  display: block;
  min-width: 0;
  overflow-wrap: anywhere;
}

.request-template-preview-fields {
  display: grid;
  gap: 10px;
}

.request-template-preview-field-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.request-template-preview-field-head > span {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.request-template-preview-field dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.request-template-preview-field dl > div {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 8px;
}

.request-template-preview-field dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.request-template-preview-field dd {
  margin: 0;
  color: var(--muted);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.notice {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
}

.notice.warn {
  border-color: rgba(199, 120, 0, 0.24);
  background: var(--warn-soft);
  color: #8a5300;
}

.notice.error {
  border-color: rgba(201, 42, 42, 0.22);
  background: var(--bad-soft);
  color: var(--bad);
}

.ok {
  color: var(--good);
  font-weight: 900;
}

.bad {
  color: var(--bad);
  font-weight: 900;
}

.attendance-table {
  min-width: 1120px;
}

.attendance-table th,
.attendance-table td {
  white-space: nowrap;
  text-align: right;
}

.attendance-table th:first-child,
.attendance-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 1;
  background: var(--panel);
  text-align: left;
}

.attendance-table .total-row td {
  background: #0968ad;
  color: #fff;
  border-bottom-color: #0968ad;
  font-weight: 900;
}

.attendance-table .total-row td:first-child {
  background: #0968ad;
}

.attendance-table .total-row .ok,
.attendance-table .total-row .bad {
  color: #a7f3d0;
}

.inline-form.attendance-filter-form,
.attendance-filter-form {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 8px;
  margin-top: 0;
  max-width: 100%;
  overflow-x: auto;
}

.inline-form.attendance-filter-form > *,
.attendance-filter-form > * {
  flex: 0 0 auto;
}

.attendance-filter-form .filter-label,
.attendance-filter-form .date-range-separator {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.attendance-filter-form input[type="date"] {
  width: 144px;
}

.attendance-filter-form select {
  min-width: 140px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 800;
  background: var(--soft);
  color: var(--muted);
}

.badge.good {
  background: var(--good-soft);
  color: var(--good);
}

.badge.warn {
  background: var(--warn-soft);
  color: var(--warn);
}

.badge.bad {
  background: var(--bad-soft);
  color: var(--bad);
}

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

.span-2 {
  grid-column: span 2;
}

.toolbar.wrap {
  flex-wrap: wrap;
}

.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
}

.status-callout {
  border: 1px solid rgba(215, 0, 91, 0.18);
  border-radius: 8px;
  background: var(--brand-soft);
  padding: 12px;
  display: grid;
  gap: 6px;
}

.status-callout.bad {
  border-color: rgba(201, 42, 42, 0.28);
  background: var(--bad-soft);
}

.status-callout strong {
  font-size: 20px;
}

.status-callout p {
  margin: 0;
  color: var(--muted);
}

.telegram-otp-panel {
  display: grid;
  gap: 14px;
}

.telegram-otp-actions {
  justify-content: flex-start;
}

.telegram-otp-link-box {
  border: 1px solid rgba(30, 99, 182, 0.18);
  border-radius: 8px;
  background: var(--blue-soft);
  padding: 12px;
  display: grid;
  gap: 8px;
}

.telegram-otp-link-box[hidden] {
  display: none;
}

.telegram-otp-link-box p {
  margin: 0;
}

.telegram-otp-reminder-overlay {
  position: fixed;
  inset: 0;
  z-index: 1900;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(15, 23, 42, 0.5);
}

.telegram-otp-reminder-dialog {
  width: min(520px, 100%);
  max-height: min(720px, 92vh);
  overflow: auto;
  display: grid;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  padding: 22px;
}

.telegram-otp-reminder-head {
  display: grid;
  gap: 8px;
}

.telegram-otp-reminder-head h3,
.telegram-otp-reminder-head p {
  margin: 0;
}

.telegram-otp-reminder-head h3 {
  font-size: 22px;
}

.telegram-otp-reminder-head p,
.telegram-otp-reminder-steps {
  color: var(--muted);
  line-height: 1.55;
}

.telegram-otp-reminder-steps {
  display: grid;
  gap: 6px;
  border: 1px solid #edf0f4;
  border-radius: 8px;
  background: var(--soft);
  padding: 12px;
  font-size: 13px;
}

.telegram-otp-reminder-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.telegram-otp-admin-panel {
  display: grid;
  gap: 14px;
}

.summary-chip-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.summary-chip {
  border: 1px solid #edf0f4;
  border-radius: 8px;
  padding: 10px;
  display: grid;
  gap: 4px;
  min-width: 0;
}

.summary-chip.warn {
  border-color: rgba(199, 120, 0, 0.24);
  background: var(--warn-soft);
}

.summary-chip-row.compact {
  grid-template-columns: repeat(2, minmax(84px, 1fr));
  margin-top: 0;
}

.summary-chip-row.compact .summary-chip {
  min-width: 84px;
  padding: 8px 10px;
}

.summary-chip strong {
  font-size: 18px;
}

.summary-chip span,
.summary-chip em {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
}

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

.ai-insight-panel {
  margin-top: 16px;
}

.ai-insight-layout,
.ai-card-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.ai-section {
  margin-top: 18px;
}

.ai-section h4,
.ai-insight-layout h4 {
  margin: 0 0 8px;
  font-size: 14px;
}

.ai-list {
  margin: 0;
  padding-left: 18px;
  color: var(--ink);
}

.ai-list li + li {
  margin-top: 6px;
}

.ai-mini-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
}

.ai-mini-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.ai-floating {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 70;
  display: grid;
  justify-items: end;
  gap: 12px;
  pointer-events: none;
}

.ai-floating.expanded {
  right: auto;
  bottom: auto;
  inset: auto;
  justify-items: stretch;
  align-items: start;
}

.ai-floating.open.expanded .ai-fab {
  display: none;
}

.ai-floating.dragging {
  cursor: grabbing;
}

.ai-floating > * {
  pointer-events: auto;
}

.ai-fab {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: var(--ink);
  color: #fff;
  font-weight: 900;
  letter-spacing: 0;
  box-shadow: var(--shadow);
}

.ai-panel {
  width: min(420px, calc(100vw - 40px));
  max-height: min(680px, calc(100vh - 104px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.ai-floating.expanded .ai-panel {
  width: min(980px, calc(100vw - 32px));
  height: min(820px, calc(100vh - 32px));
  max-height: calc(100vh - 32px);
}

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

.ai-floating.expanded .ai-panel-head {
  cursor: grab;
  user-select: none;
}

.ai-floating.dragging .ai-panel-head {
  cursor: grabbing;
}

.ai-panel-head strong,
.ai-panel-head span {
  display: block;
}

.ai-panel-head span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.ai-panel-actions {
  display: flex;
  gap: 6px;
  align-items: center;
}

.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f1f4f8;
  color: var(--ink);
  font-size: 18px;
  line-height: 1;
}

.icon-btn.text {
  width: auto;
  min-width: 46px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 900;
}

.notice.small {
  border: 1px solid rgba(199, 120, 0, 0.24);
  border-radius: 8px;
  background: var(--warn-soft);
  color: #8a5300;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 800;
  margin-bottom: 0;
}

.ai-form {
  display: grid;
  gap: 10px;
  margin-bottom: 0;
}

.ai-form textarea {
  width: 100%;
  resize: vertical;
  min-height: 72px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}

.toolbar.between {
  justify-content: space-between;
}

.ai-chat {
  flex: 1 1 auto;
  min-height: 180px;
  max-height: 360px;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 10px;
  padding: 4px;
}

.ai-floating.expanded .ai-chat {
  max-height: none;
}

.ai-chat-empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft);
  color: var(--muted);
  line-height: 1.5;
}

.ai-chat-empty strong,
.ai-chat-empty span {
  display: block;
}

.ai-chat-empty strong {
  color: var(--ink);
  margin-bottom: 4px;
}

.ai-example-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.ai-example {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--panel);
  color: var(--ink);
  padding: 8px 10px;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.25;
  text-align: left;
}

.ai-example:hover {
  border-color: var(--brand);
  color: var(--brand);
}

.ai-message {
  display: flex;
}

.ai-message.user {
  justify-content: flex-end;
}

.ai-message.assistant {
  justify-content: flex-start;
}

.ai-bubble {
  max-width: min(92%, 720px);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--soft);
  overflow: hidden;
}

.ai-message.user .ai-bubble {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.ai-message.user .ai-bubble p {
  margin: 0;
}

.ai-message.error-message .ai-bubble {
  border-color: rgba(202, 54, 54, 0.24);
  background: var(--bad-soft);
}

.ai-typing {
  color: var(--muted);
  font-weight: 800;
}

.ai-answer {
  display: grid;
  gap: 10px;
}

.ai-answer p,
.ai-answer ul {
  margin: 0;
}

.ai-answer ul {
  padding-left: 18px;
}

.ai-answer li + li {
  margin-top: 5px;
}

.ai-answer-section {
  display: grid;
  gap: 8px;
}

.ai-suggestion {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--soft);
}

.ai-suggestion span,
.ai-suggestion small {
  display: block;
}

.ai-suggestion span {
  font-weight: 900;
}

.ai-suggestion small {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.45;
}

.ai-chart-card {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.ai-chart-source {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.ai-chat-chart {
  width: 100%;
  min-height: 220px;
  height: 220px;
}

.ai-floating.expanded .ai-chat-chart {
  min-height: 320px;
  height: 320px;
}

.compact-item {
  padding: 10px 12px;
}

.inline-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
}

.inline-form select {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 9px 10px;
}

.inline-form input[type="search"] {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 9px 10px;
}

.inline-form input[type="number"],
.inline-form input[type="time"],
.inline-form input[type="date"],
.inline-form input[type="month"] {
  min-height: 40px;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  padding: 9px 10px;
}

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

.check-grid.compact {
  gap: 6px;
}

.profile-info-form {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.footer-note {
  margin-top: auto;
  color: #9da7b6;
  font-size: 12px;
  line-height: 1.5;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 14px;
}

.pagination span {
  color: var(--muted);
  font-size: 13px;
  min-width: 56px;
  text-align: center;
}

@media (max-width: 1120px) {
  .cards {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .dashboard-main,
  .dashboard-wide,
  .mileage-hero,
  .mileage-layout,
  .request-receiver-hero,
  .request-receiver-layout,
  .detail-grid,
  .request-filter-form,
  .popup-admin-layout,
  .org-admin-layout,
  .permission-menu-layout,
  .organization-permission-layout,
  .permission-role-grid,
  .permission-filter-form,
  .menu-template-form,
  .columns-2,
  .columns-3 {
    grid-template-columns: 1fr;
  }

  .org-tree-panel {
    position: static;
  }

  .request-action-panel {
    position: static;
  }

  .popup-ad-form {
    position: static;
  }

  .org-tree-list {
    max-height: 360px;
  }

  .org-cascade-picker {
    max-height: 420px;
  }

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

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

  .presentation-workbench {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .presentation-editor-grid {
    grid-template-columns: 156px minmax(0, 1fr);
  }

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

  .presentation-flow-toolbar,
  .presentation-template-columns {
    grid-template-columns: 1fr;
  }

  .presentation-flow-layouts {
    justify-content: flex-start;
  }

  .presentation-manage-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .permission-guide-grid,
  .permission-preview-grid,
  .permission-account-summary.permission-account-summary-wide {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .presentation-format-sidebar {
    grid-column: 1 / -1;
    border-left: 0;
    border-top: 1px solid var(--line);
    max-height: 360px;
  }

  .presentation-inspector {
    grid-column: 1 / -1;
  }

  .presentation-ribbon-panel {
    min-height: 78px;
  }

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

  .permission-menu-detail {
    grid-column: 1 / -1;
  }

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

@media (max-width: 760px) {
  .login-shell,
  .app-shell {
    grid-template-columns: 1fr;
  }

  .login-visual {
    min-height: 260px;
    padding: 28px;
  }

  .login-card {
    padding: 28px;
  }

  .sidebar {
    position: static;
    height: auto;
    overflow: visible;
    padding: 14px;
  }

  .popup-admin-card {
    grid-template-columns: 1fr;
  }

  .popup-admin-thumb {
    min-height: 0;
  }

  .popup-admin-title-row,
  .popup-ad-actions {
    align-items: stretch;
    flex-direction: column;
  }

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

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

  .nav-heading {
    grid-column: 1 / -1;
  }

  .home-compose-nav {
    align-items: stretch;
    flex-direction: column;
  }

  .home-compose-nav .dashboard-tabs {
    width: 100%;
  }

  .home-editor-tools .compact-action {
    flex: 1 1 calc(33.333% - 6px);
  }

  .main {
    padding: 16px;
  }

  .bootstrap-sync-indicator {
    width: 100%;
  }

  .mileage-hero {
    padding: 18px;
  }

  .mileage-hero h3 {
    font-size: 24px;
  }

  .mileage-summary {
    grid-template-columns: 1fr;
  }

  .mileage-podium {
    grid-template-columns: 1fr;
    min-height: 0;
  }

  .mileage-podium-card,
  .mileage-podium-card.rank-1,
  .mileage-podium-card.rank-2,
  .mileage-podium-card.rank-3 {
    min-height: 150px;
  }

  .mileage-rank-row {
    grid-template-columns: 34px minmax(0, 1fr);
  }

  .mileage-rank-score {
    grid-column: 2;
    grid-template-columns: 1fr auto;
    text-align: left;
  }

  .mileage-trend {
    min-height: 190px;
  }

  .mileage-trend-bar {
    height: 112px;
  }

  .request-template-check,
  .request-receiver-unit-list button {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .request-template-check b,
  .request-receiver-unit-list em {
    grid-column: 2;
    grid-row: auto;
  }

  .request-template-check-wrap,
  .request-template-preview-summary,
  .request-template-preview-field dl > div {
    grid-template-columns: 1fr;
  }

  .request-template-check-wrap > button {
    width: 100%;
  }

  .presentation-project-head {
    align-items: stretch;
    flex-direction: column;
  }

  .presentation-project-head .primary {
    width: 100%;
  }

  .presentation-project-grid {
    grid-template-columns: 1fr;
  }

  .presentation-project-card-head {
    grid-template-columns: 1fr;
  }

  .presentation-card-edit-button {
    width: 100%;
  }

  .presentation-flow-board,
  .presentation-manage-metrics {
    grid-template-columns: 1fr;
  }

  .presentation-review-hero {
    align-items: stretch;
    flex-direction: column;
  }

  .presentation-review-list button,
  .presentation-template-columns p {
    grid-template-columns: 1fr;
  }

  .presentation-template-columns p span {
    text-align: left;
  }

  .presentation-workbench {
    grid-template-columns: 1fr;
  }

  .presentation-editor-shell {
    height: auto;
    min-height: auto;
    overflow: visible;
  }

  .presentation-doc-header {
    align-items: stretch;
    flex-direction: column;
  }

  .presentation-doc-title {
    width: 100%;
  }

  .presentation-editor-grid {
    grid-template-columns: 1fr;
  }

  .presentation-slide-navigator {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    grid-template-rows: auto auto auto;
  }

  .presentation-slide-list.google-like {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 8px;
  }

  .presentation-slide-list.google-like .presentation-slide-thumb {
    flex: 0 0 150px;
    margin-bottom: 0;
  }

  .presentation-canvas-workspace {
    min-height: 320px;
    padding: 18px;
  }

  .presentation-format-sidebar {
    border-left: 0;
    border-top: 1px solid var(--line);
  }

  .presentation-editor-toolbar,
  .presentation-presenter-top {
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .presentation-ribbon-tabs button {
    padding: 7px 9px;
  }

  .presentation-ribbon-shape-grid,
  .presentation-ribbon-layout-grid {
    grid-template-columns: repeat(2, minmax(72px, 1fr));
  }

  .presentation-background-setting {
    grid-template-columns: 1fr;
  }

  .presentation-stage-wrap {
    max-width: 100%;
  }

  .presentation-sidebar,
  .presentation-inspector {
    min-width: 0;
  }

  .permission-menu-layout,
  .permission-role-grid,
  .permission-role-search-form,
  .permission-role-row,
  .permission-account-summary,
  .permission-account-summary.permission-account-summary-wide,
  .permission-guide-grid,
  .permission-preview-grid,
  .permission-menu-row {
    grid-template-columns: 1fr;
  }

  .permission-role-row {
    align-items: stretch;
    flex-direction: column;
  }

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

  .permission-org-tree,
  .permission-account-panel,
  .permission-menu-detail {
    height: auto;
  }

  .permission-tree-list,
  .permission-account-list,
  .permission-detail-body {
    max-height: none;
    overflow: visible;
  }

  .permission-section-title,
  .permission-feature-row {
    grid-template-columns: 1fr;
    align-items: start;
  }

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

  .topbar .toolbar {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 10px;
    padding-right: 0;
  }

  .topbar .session-timer {
    top: 10px;
    right: 10px;
    font-size: 13px;
    padding: 10px 14px;
  }

  .request-workbench-head {
    flex-direction: column;
  }

  .request-workbench-stats {
    justify-content: flex-start;
  }

  .request-quick-filter {
    min-width: calc(50% - 4px);
  }

  .date-filter {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .date-filter label {
    grid-column: 1 / -1;
  }

  .date-filter span {
    display: none;
  }

  .date-filter input,
  .date-filter button {
    width: 100%;
    min-width: 0;
    padding-left: 8px;
    padding-right: 8px;
  }

  .comment-replies {
    margin-left: 12px;
    padding-left: 10px;
  }

  .input-action,
  .collab-row,
  .template-field-row,
  .survey-builder-head,
  .survey-question-card-head,
  .survey-add-row,
  .survey-design-body,
  .survey-field-main,
  .survey-style-controls,
  .survey-theme-grid,
  .survey-condition-controls,
  .org-edit-form,
  .section-board-head,
  .section-board-row {
    grid-template-columns: 1fr;
  }

  .file-inline {
    width: 100%;
  }

  .survey-card-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .survey-card-actions .ghost,
  .survey-card-actions .danger,
  .survey-add-button {
    width: 100%;
    min-height: 44px;
  }

  .survey-save-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .survey-save-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .reservation-compose-single,
  .fixed-reservation-group summary {
    grid-template-columns: 1fr;
  }

  .space-calendar-panel {
    min-height: 0;
  }

  .calendar-wrap {
    height: 560px;
  }

  .calendar-space,
  .calendar-cell {
    min-height: 94px;
  }

  .fixed-reservation-meta {
    text-align: left;
  }

  .section-work-cards {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .scope-tabs {
    width: 100%;
    max-width: 100%;
    flex-wrap: wrap;
    overflow: visible;
    gap: 6px;
  }

  .scope-tab {
    min-width: 96px;
    min-height: 44px;
    padding: 10px 12px;
    font-size: 13px;
  }

  .church-tabs {
    width: 100%;
    max-width: 100%;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    padding-bottom: 8px;
  }

  .church-tab {
    min-height: 44px;
    padding: 10px 12px;
    font-size: 13px;
  }

  .dashboard-tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 6px;
    margin: 12px -16px 14px;
    padding: 0 16px 4px;
    border-bottom: 0;
  }

  .dashboard-tab {
    flex: 0 0 auto;
    min-height: 40px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--panel);
    padding: 8px 10px;
    font-size: 13px;
  }

  .dashboard-tab.active {
    background: rgba(215, 0, 91, 0.08);
  }

  .dashboard-cards {
    gap: 10px;
  }

  .card .value {
    font-size: 24px;
  }

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

  .cards,
  .audit-summary-grid,
  .form-grid,
  .space-finder-form,
  .inline-form,
  .slot-grid,
  .heat-grid,
  .analysis-grid,
  .ai-insight-layout,
  .ai-card-grid,
  .donut-wrap,
  .mini-bar-row,
  .flow-row {
    grid-template-columns: 1fr;
  }

  .request-table-wrap td:first-child {
    min-width: 220px;
  }

  .org-summary,
  .org-child-list,
  .available-space-item,
  .space-edit-form,
  .calendar-filter-form {
    grid-template-columns: 1fr;
  }

  .org-child-row {
    grid-template-columns: minmax(0, 1fr) 42px;
  }

  .org-child-order-actions,
  .org-child-order-button {
    width: 42px;
    min-width: 42px;
  }

  .org-child-order-button {
    min-height: 34px;
  }

  .span-2 {
    grid-column: span 1;
  }

  .echart {
    min-height: 260px;
  }

.echart-graph {
  min-height: 430px;
}

.permission-matrix th,
.permission-matrix td {
  text-align: center;
  vertical-align: middle;
}

.permission-matrix th:first-child,
.permission-matrix td:first-child {
  text-align: left;
  min-width: 180px;
}

.permission-check {
  justify-content: center;
  white-space: nowrap;
}

}

@media (max-width: 760px) {
  .branch-dash-kpi-grid,
  .branch-dash-analysis-grid,
  .branch-dash-equation,
  .branch-dash-month-deltas,
  .branch-dash-item-grid,
  .branch-dash-item-summary,
  .branch-dash-suggestion-grid,
  .training-kpi-grid,
  .training-drill-grid,
  .training-meta-grid,
  .training-upload-form,
  .training-meta-form,
  .training-enrollment-add-form,
  .training-education-create-form,
  .training-education-edit-form,
  .training-row-edit-form {
    grid-template-columns: 1fr;
  }

  .training-panel,
  .training-kpi-card,
  .branch-dash-panel,
  .branch-dash-kpi-card,
  .branch-dash-item-card {
    padding: 18px;
  }

  .branch-dash-item-head,
  .branch-dash-forecast-head,
  .branch-dash-insights-controls,
  .branch-dash-education-drilldown > div:first-child,
  .training-detail-head,
  .training-chart-head,
  .training-upload-actions,
  .training-meta-actions,
  .training-form-submit,
  .training-cumulative-toolbar,
  .training-cumulative-pager,
  .training-row-edit-actions,
  .training-check-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .branch-dash-insights-controls,
  .branch-dash-select-field,
  .branch-dash-select-field select,
  .branch-dash-toggle {
    width: 100%;
  }

  .branch-dash-select-field {
    align-items: stretch;
    flex-direction: column;
  }

  .branch-dash-forecast-copy {
    grid-template-columns: 1fr;
  }

  .branch-dash-funnel-step {
    grid-template-columns: 1fr;
  }

  .branch-dash-funnel-step strong {
    text-align: left;
  }

  .branch-dash-quadrants {
    inset: 14px 10px 34px 42px;
  }

  .branch-dash-quadrants span {
    max-width: 118px;
    font-size: 10px;
  }

  .training-member-add-form,
  .training-member-edit-form,
  .training-member-bulk-form,
  .training-check-session-form,
  .training-check-list {
    grid-template-columns: 1fr;
  }

  .training-check-counter-wrap {
    justify-items: start;
  }

  .training-table-wrap {
    width: 100%;
    overflow-x: auto;
  }

  .training-trend-chart {
    min-height: 260px;
  }
}

@media (max-width: 480px) {
  .ai-floating {
    right: 12px;
    bottom: 12px;
  }

  .ai-floating.expanded {
    right: auto;
    bottom: auto;
    inset: auto;
  }

  .ai-panel {
    width: calc(100vw - 24px);
    max-height: calc(100vh - 92px);
    padding: 14px;
  }

  .ai-floating.expanded .ai-panel {
    width: calc(100vw - 16px);
    height: calc(100vh - 16px);
    max-height: calc(100vh - 16px);
  }

  .ai-bubble {
    max-width: 96%;
  }

  .toast-stack {
    right: 12px;
    bottom: 82px;
    width: calc(100vw - 24px);
  }

  .main {
    padding: 12px;
  }

  .sidebar {
    padding: 12px;
  }

  .nav-group {
    grid-template-columns: 1fr;
  }

  .topbar h2 {
    font-size: 22px;
  }

  .panel,
  .card {
    padding: 14px;
  }

  .date-filter {
    grid-template-columns: 1fr;
  }

  .dashboard-tab,
  .scope-tab {
    font-size: 12px;
  }

  .echart {
    min-height: 230px;
  }

  .echart-wide {
    min-height: 260px;
  }

  .echart-graph {
    min-height: 360px;
  }

  .type-distribution-list {
    max-height: 320px;
  }

  .type-distribution-row {
    grid-template-columns: minmax(0, 1fr) 44px 38px;
  }

  .rating-choice-list {
    grid-template-columns: 1fr;
  }

  .rating-choice-list span {
    justify-content: flex-start;
    padding: 0 12px;
  }

  .finance-account-form,
  .case-modal-grid {
    grid-template-columns: 1fr;
  }

  .liaison-edit-form {
    grid-template-columns: 1fr;
  }

  .finance-account-item,
  .case-modal-head {
    align-items: stretch;
    flex-direction: column;
  }

  .case-modal-backdrop {
    padding: 8px;
  }

  .presentation-workbench {
    grid-template-columns: 1fr;
  }

  .presentation-editor-toolbar,
  .presentation-presenter-top {
    grid-template-columns: 1fr;
    display: grid;
    align-items: stretch;
  }

  .presentation-stage-wrap {
    max-width: 100%;
  }

  .presentation-sidebar,
  .presentation-inspector {
    min-width: 0;
  }
}

/* --- segmented-datetime --- */
.segmented-datetime-control {
  width: 100%;
}

.segmented-datetime {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-sizing: border-box;
}

.segmented-datetime:focus-within {
  border-color: var(--brand);
  outline: 2px solid var(--brand);
  outline-offset: 1px;
}

.segmented-datetime-segment {
  min-width: 2ch;
  padding: 3px 2px;
  border-radius: 5px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  cursor: text;
  outline: none;
}

.segmented-datetime-segment[data-datetime-segment="year"] {
  min-width: 4ch;
}

.segmented-datetime-segment:focus {
  color: var(--brand);
  background: var(--soft);
}

.segmented-datetime-separator {
  color: var(--muted);
  user-select: none;
}

.segmented-datetime-space {
  margin-right: 8px;
}

