:root {
  color-scheme: light;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #1b2430;
  background: #f5f7fa;
}

* { box-sizing: border-box; }
body { margin: 0; background: #f5f7fa; }
a { color: #165d9d; text-decoration: none; }
a:hover { text-decoration: underline; }
.page-shell { max-width: 1320px; margin: 0 auto; padding: 20px; }
@media (min-width: 1440px) {
  .page-shell.bank-wide-page { max-width: 1800px; }
}
.site-header { display: flex; gap: 12px; align-items: baseline; margin-bottom: 34px; }
.main-nav { display: flex; gap: 12px; }
.main-nav a { color: #4d5968; font-size: .92rem; }
.brand { color: #1b2430; font-weight: 700; font-size: 1.2rem; }
.section-label, .muted { color: #657181; }
.logout-form { margin-left: auto; }
.link-button { min-height: auto; padding: 0; border: 0; background: transparent; color: #165d9d; }
.page-heading { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
h1 { margin: 0 0 7px; font-size: clamp(1.45rem, 3vw, 2rem); }
p { margin: 0; color: #657181; }
.filters, .totals-grid { display: grid; gap: 12px; margin-bottom: 22px; }
.filter-grid, .form-grid { display: grid; gap: 12px; margin-bottom: 22px; }
.filter-grid { grid-template-columns: repeat(4, minmax(140px, 1fr)) auto; align-items: end; }
.filter-grid label, .form-grid label, .form-card > label { display: grid; gap: 6px; color: #4d5968; font-size: .85rem; }
.form-card { display: grid; gap: 14px; margin: 0 0 22px; padding: 18px; background: white; border: 1px solid #dce2e8; border-radius: 8px; }
.form-card h2 { margin: 0; font-size: 1.15rem; }
.form-card input, .form-card select { min-height: 38px; border: 1px solid #c9d2dc; border-radius: 6px; padding: 7px 10px; font: inherit; background: white; }
.form-card [hidden] { display: none !important; }
.form-grid { grid-template-columns: repeat(2, minmax(180px, 1fr)); }
.employee-form { grid-template-columns: minmax(0, 1fr); width: 100%; max-width: 680px; }
.employee-detail { width: 100%; max-width: 960px; }
.employee-detail .page-heading { margin-bottom: 16px; }
.employee-detail .form-card { gap: 10px; margin-bottom: 14px; padding: 14px; }
.employee-detail .inline-form, .employee-detail .binding-form { max-width: 720px; }
.employee-detail .simple-rows, .employee-detail .binding-rows { margin-bottom: 10px; }
.employee-detail .simple-rows li, .employee-detail .binding-rows li { padding: 8px 10px; }
.employee-payroll-history .plain-list { gap: 4px; }
.form-actions { grid-column: 1 / -1; }
.inline-form { display: flex; flex-wrap: wrap; gap: 8px; align-items: end; }
.inline-form input, .inline-form select { flex: 1 1 150px; }
.simple-rows, .binding-rows { display: grid; gap: 8px; margin: 0 0 14px; padding: 0; list-style: none; }
.simple-rows li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 10px 12px; background: #f7f9fb; border-radius: 6px; }
.binding-rows li { display: grid; grid-template-columns: minmax(120px, .7fr) minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 12px; background: #f7f9fb; border-radius: 6px; }
.binding-rows small { color: #657181; white-space: nowrap; }
.binding-form { display: grid; grid-template-columns: repeat(2, minmax(180px, 1fr)) auto; gap: 8px; align-items: end; }
.binding-form label { display: grid; gap: 6px; color: #4d5968; font-size: .85rem; }
.binding-form select { min-height: 38px; border: 1px solid #c9d2dc; border-radius: 6px; padding: 7px 10px; font: inherit; background: white; }
.plain-list { display: grid; gap: 7px; margin: 0; padding-left: 20px; }
.definition-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 14px; margin: 0; }
.definition-list dt { color: #657181; }
.definition-list dd { margin: 0; }
.tag { display: inline-block; margin: 0 4px 4px 0; padding: 2px 6px; color: #4d5968; background: #edf1f5; border-radius: 4px; font-size: .78rem; }
.amount { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.danger-zone { border-color: #e5c3c3; }
.filters { grid-template-columns: repeat(3, minmax(150px, 1fr)) auto auto; align-items: end; }
.payroll-overview-filters { grid-template-columns: repeat(4, minmax(140px, 1fr)) auto auto; }
.employee-history-filters { grid-template-columns: repeat(2, minmax(150px, 1fr)) auto auto; max-width: 720px; }
.filters label { display: grid; gap: 5px; font-size: .85rem; color: #4d5968; }
select, button, .button { min-height: 38px; border: 1px solid #c9d2dc; border-radius: 6px; padding: 7px 10px; font: inherit; background: white; }
button, .button { cursor: pointer; background: #165d9d; border-color: #165d9d; color: white; text-align: center; }
.button.secondary { background: white; color: #165d9d; }
.table-scroll { overflow-x: auto; background: white; border: 1px solid #dce2e8; border-radius: 8px; }
table { width: 100%; min-width: 850px; border-collapse: collapse; font-size: .92rem; }
th, td { padding: 12px 14px; border-bottom: 1px solid #e7ebef; text-align: left; vertical-align: top; }
th { color: #4d5968; background: #fafbfd; font-size: .78rem; letter-spacing: .02em; text-transform: uppercase; }
tbody tr:last-child td { border-bottom: 0; }
.period-row { cursor: pointer; }
.period-row td { padding: 0; transition: background-color .12s ease; }
.period-row-link { display: block; min-height: 44px; padding: 12px 14px; color: inherit; text-decoration: none; }
.period-row:hover td, .period-row:focus-within td { background: #edf5fc; }
.period-row:active td { background: #dcecff; }
.period-row-link:focus-visible { outline: 2px solid #165d9d; outline-offset: -2px; }
.period-row-action { color: #165d9d; }
.number { text-align: right; white-space: nowrap; }
.money { font-variant-numeric: tabular-nums; }
.status { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; }
.status-draft { color: #805b00; background: #fff2c9; }
.status-review { color: #174b83; background: #dcecff; }
.status-approved { color: #21633d; background: #dff5e7; }
.status-paid { color: #4d326e; background: #ecdefb; }
.status-active { color: #21633d; background: #dff5e7; }
.status-inactive { color: #6b5960; background: #f0e8eb; }
.totals-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.totals-grid > div { padding: 14px; background: white; border: 1px solid #dce2e8; border-radius: 8px; }
.totals-grid span { display: block; color: #657181; font-size: .8rem; margin-bottom: 5px; }
.totals-grid strong { font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.overview-totals { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin-bottom: 24px; }
.overview-totals > div { min-height: 98px; padding: 14px; background: white; border: 1px solid #dce2e8; border-radius: 8px; }
.overview-totals span { display: block; color: #657181; font-size: .8rem; margin-bottom: 5px; }
.overview-totals strong { display: block; font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.overview-totals small { display: block; margin-top: 5px; color: #657181; font-size: .76rem; }
.service-summary-section { margin: 0 0 24px; }
.service-summary-section h2 { margin: 0 0 12px; font-size: 1.15rem; }
.service-summary-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(245px, 1fr)); gap: 12px; }
.service-summary-card { display: grid; gap: 7px; padding: 14px; color: inherit; background: white; border: 1px solid #dce2e8; border-radius: 8px; text-decoration: none; }
.service-summary-card:hover { background: #edf5fc; text-decoration: none; }
.service-summary-card:focus-visible { outline: 2px solid #165d9d; outline-offset: 2px; }
.service-summary-title { font-size: 1rem; font-weight: 700; }
.service-summary-card dl { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 12px; margin: 4px 0 0; }
.service-summary-card dl div { min-width: 0; }
.service-summary-card dt { color: #657181; font-size: .74rem; }
.service-summary-card dd { margin: 2px 0 0; font-size: .86rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.payroll-periods-table { min-width: 1000px; }
.quick-periods { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.quick-periods .button { min-height: 34px; }
.revenue-filters { grid-template-columns: repeat(3, minmax(150px, 1fr)) auto auto; max-width: 900px; }
.revenue-filters input, .revenue-filters select { min-height: 38px; border: 1px solid #c9d2dc; border-radius: 6px; padding: 7px 10px; font: inherit; background: white; }
.revenue-completeness { margin: 0 0 22px; }
.revenue-completeness h2 { margin: 0 0 12px; font-size: 1.15rem; }
.revenue-completeness-card { min-height: 82px; cursor: default; }
.revenue-completeness-card strong { font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.revenue-totals { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.revenue-table { min-width: 1120px; }
.expense-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.expense-tabs .button { min-height: 34px; }
.expense-subtabs { display: flex; gap: 14px; margin: 0 0 14px; font-size: .9rem; }
.expense-subtabs a { color: #52616f; text-decoration: none; }
.expense-subtabs a.active { color: #165d9d; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.section-description { margin: 0 0 16px; }
.expense-filters { grid-template-columns: repeat(3, minmax(150px, 1fr)) auto auto; max-width: 1040px; }
.actual-expense-filters, .debt-expense-filters { grid-template-columns: repeat(5, minmax(140px, 1fr)) auto auto; max-width: 1280px; }
.finance-cash-filters { grid-template-columns: repeat(6, minmax(130px, 1fr)) max-content auto auto; max-width: 1400px; }
.expense-filters input, .expense-filters select, .actual-expense-filters input, .actual-expense-filters select, .debt-expense-filters input, .debt-expense-filters select, .finance-cash-filters input, .finance-cash-filters select { min-height: 38px; border: 1px solid #c9d2dc; border-radius: 6px; padding: 7px 10px; font: inherit; background: white; }
.expense-totals { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.expenses-table { min-width: 980px; }
/* Bank operations and unknown transactions share this responsive table layout. */
.bank-operations { min-width: 0; max-width: 100%; }
/* The scroll wrapper is also the query container: sidebar/window changes are local.
   Below 1100px keep all columns reachable via local scrolling. */
.bank-operations > .table-scroll { width: 100%; max-width: 100%; }
.bank-table-container { container: bank-table / inline-size; }
.bank-operations-table {
  table-layout: fixed;
  min-width: 1100px;
}
/* Keep short values compact.  The text columns divide the remaining width by
   content priority instead of equally: purpose, then counterparty, get most. */
.bank-operations-table .bank-select-column { width: 42px; }
.bank-operations-table .bank-date-column { width: 102px; }
.bank-operations-table .bank-account-column { width: 92px; }
.bank-operations-table .bank-type-column { width: 78px; }
.bank-operations-table .bank-amount-column { width: 112px; }
.bank-operations-table .bank-counterparty-column { width: 18.75%; }
.bank-operations-table .bank-purpose-column { width: 25%; }
.bank-operations-table .bank-category-column { width: 17.1875%; }
.bank-operations-table .bank-direction-column { width: 10.9375%; }
.bank-operations-table .bank-status-column { width: 15.625%; }
.bank-operations-table .bank-action-column { width: 12.5%; }
.bank-operations-table th, .bank-operations-table td { padding: 8px 6px; }
.bank-operations-table th { overflow-wrap: anywhere; }
@container bank-table (min-width: 1600px) {
  .bank-operations-table th, .bank-operations-table td { padding: 12px 8px; }
}
/* Without container queries use a viewport approximation (1600px + shell
   padding/borders). Fluid columns and the local-scroll floor still apply. */
@supports not (container-type: inline-size) {
  @media (min-width: 1642px) {
    .bank-operations-table th, .bank-operations-table td { padding: 12px 8px; }
  }
}
.bank-operations-table .bank-date-cell,
.bank-operations-table .bank-account-cell,
.bank-operations-table .bank-type-cell,
.bank-operations-table .bank-amount-cell { white-space: nowrap; }
.bank-operations-table .bank-status-cell { white-space: normal; overflow-wrap: anywhere; }
.bank-account-mask { display: inline-block; white-space: nowrap; }
.bank-operation-status { display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.bank-operations-table .bank-counterparty-cell,
.bank-operations-table .bank-purpose-cell,
.bank-operations-table .bank-category-cell,
.bank-operations-table .bank-direction-cell,
.bank-operations-table .bank-action-cell { white-space: normal; overflow-wrap: anywhere; }
.bank-operations-table .filters { grid-template-columns: minmax(0, 1fr); margin: 12px 0 0; }
.bank-operations-table .filters label { min-width: 0; }
.bank-operations-table .filters input,
.bank-operations-table .filters select,
.bank-operations-table .filters button { min-width: 0; width: 100%; max-width: 100%; }
/* The filter and bulk forms must also fit the Bank card, including long labels. */
.bank-operations > .filters { grid-template-columns: repeat(auto-fit, minmax(min(100%, 180px), 1fr)); }
.bank-operations > .filters > *,
.bank-operations > .filters input,
.bank-operations > .filters select { min-width: 0; max-width: 100%; }
.finance-cash-table-scroll { width: 100%; max-width: 100%; }
.finance-cash-table { min-width: 1510px; table-layout: fixed; }
.finance-cash-table .cash-date-column { width: 185px; }
.finance-cash-table .cash-operation-column { width: 160px; }
.finance-cash-table .cash-category-column { width: 140px; }
.finance-cash-table .cash-service-column { width: 130px; }
.finance-cash-table .cash-employee-column { width: 155px; }
.finance-cash-table .cash-method-column { width: 115px; }
.finance-cash-table .cash-amount-column { width: 105px; }
.finance-cash-table .cash-description-column { width: 220px; }
.finance-cash-table .cash-source-column { width: 95px; }
.finance-cash-table .cash-action-column { width: 180px; }
.finance-cash-table td { overflow-wrap: anywhere; }
.finance-cash-table .cash-date-cell { white-space: nowrap; }
.finance-cash-table .cash-description-cell { white-space: normal; }
.finance-cash-table .cash-action-cell { white-space: normal; }
.cash-cancellation-meta { display: block; margin-top: 4px; color: #657181; font-size: .75rem; line-height: 1.35; text-decoration: none; white-space: normal; overflow-wrap: anywhere; }
.breakdown-line { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: -12px 0 22px; font-size: .86rem; }
.cash-transfer-row td { background: #faf7ed; }
.cancelled-row td { color: #7a828c; background: #f5f6f7; text-decoration: line-through; }
.cancelled-row .revenue-created, .cancelled-row .cash-cancellation-meta { text-decoration: none; }
.check-label { align-self: end; display: flex !important; align-items: center; gap: 6px; min-height: 38px; font-size: .86rem; white-space: nowrap; }
.check-label input { width: auto !important; min-height: auto !important; }
.correction-card { max-width: 720px; padding: 20px; background: white; border: 1px solid #dce2e8; border-radius: 8px; }
.correction-details { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px 20px; margin: 0 0 20px; }
.correction-details div { min-width: 0; }
.correction-details dt { color: #657181; font-size: .78rem; }
.correction-details dd { margin: 3px 0 0; overflow-wrap: anywhere; }
.compact-form { max-width: 520px; }
.compact-form textarea { min-height: 86px; border: 1px solid #c9d2dc; border-radius: 6px; padding: 8px; font: inherit; }
.danger-button { background: #9c2424; }
.revenue-created { display: block; margin-top: 4px; color: #657181; font-size: .75rem; white-space: nowrap; }
.staff-row-number { width: 1%; min-width: 2.25rem; text-align: center; white-space: nowrap; }
.employee-history-section { margin-top: 30px; }
.employee-history-section h2 { margin: 0 0 12px; font-size: 1.2rem; }
.employee-history-table { min-width: 1320px; }
.back-link { display: inline-block; margin-bottom: 16px; }
.empty-state { padding: 20px; background: white; border: 1px solid #dce2e8; border-radius: 8px; }
.login-card { max-width: 420px; margin: 8vh auto; padding: 28px; background: white; border: 1px solid #dce2e8; border-radius: 8px; }
.login-form { display: grid; gap: 15px; margin-top: 24px; }
.login-form label { display: grid; gap: 6px; color: #4d5968; }
.login-form input { min-height: 40px; border: 1px solid #c9d2dc; border-radius: 6px; padding: 7px 10px; font: inherit; }
.form-error { margin-top: 18px; padding: 10px; color: #9c2424; background: #fff0f0; border-radius: 6px; }
.payout-form { display: grid; gap: 6px; min-width: 220px; margin-top: 9px; }
.payout-form label { display: grid; gap: 3px; color: #4d5968; font-size: .75rem; }
.payout-form input { min-width: 0; min-height: 32px; border: 1px solid #c9d2dc; border-radius: 5px; padding: 5px 7px; font: inherit; }
.payout-form .secondary { background: white; color: #165d9d; }
.advance-link { display: block; margin-top: 8px; }
.advance-form { display: grid; gap: 15px; max-width: 520px; padding: 20px; background: white; border: 1px solid #dce2e8; border-radius: 8px; }
.advance-form label { display: grid; gap: 6px; color: #4d5968; }
.advance-form input, .advance-form select, .advance-form textarea { width: 100%; min-height: 40px; border: 1px solid #c9d2dc; border-radius: 6px; padding: 7px 10px; font: inherit; background: white; }
.advance-form input[readonly] { color: #657181; background: #f5f7fa; }
.batch-advance-form { display: grid; gap: 18px; }
.batch-advance-common { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: end; padding: 14px; background: white; border: 1px solid #dce2e8; border-radius: 8px; }
.batch-advance-common label { display: grid; gap: 6px; color: #4d5968; }
.batch-advance-common input, .batch-advance-common select, .batch-advance-form table input, .batch-advance-form table select { width: 100%; min-height: 38px; border: 1px solid #c9d2dc; border-radius: 6px; padding: 6px 8px; font: inherit; background: white; }
.batch-advance-common span { display: block; color: #657181; font-size: .8rem; margin-bottom: 5px; }
.payment-history { margin-top: 30px; }
.payment-history h2 { font-size: 1.2rem; margin: 0 0 12px; }
.totals-grid small { display: block; color: #657181; margin-top: 5px; }

@media (max-width: 760px) {
  .page-shell { padding: 16px; }
  .site-header { margin-bottom: 24px; }
  .filters { grid-template-columns: 1fr; }
  .filter-grid, .form-grid { grid-template-columns: 1fr; }
  .main-nav { gap: 8px; }
  .filters button, .filters .button { width: 100%; }
  .totals-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .revenue-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .expense-totals { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .service-summary-card dl { grid-template-columns: 1fr; }
  .batch-advance-common { grid-template-columns: 1fr; }
  .binding-rows, .binding-form { grid-template-columns: 1fr; }
  .totals-grid strong { font-size: 1rem; }
}

/* Explicit Bank settlement form: long employee/period labels stay contained. */
.bank-link-form { align-items: end; }
.bank-link-form label { min-width: 0; max-width: 100%; }
.bank-link-form select, .bank-link-form input { min-width: 0; max-width: 100%; }

/* Messenger controls stay inside the existing employee card. */
.messenger-statuses { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px 24px; margin: 0 0 18px; }
.messenger-statuses dt { color: #657181; font-size: .85rem; }
.messenger-statuses dd { margin: 5px 0 0; overflow-wrap: anywhere; }
.messenger-settings, .messenger-confirm { display: grid; gap: 14px; margin-top: 20px; max-width: 620px; }
.messenger-settings label, .messenger-confirm label { display: flex; gap: 9px; align-items: center; }
.messenger-settings label.messenger-channel { display: grid; gap: 6px; }
.messenger-settings select { width: 100%; min-height: 40px; border: 1px solid #c9d2dc; border-radius: 6px; padding: 7px 10px; font: inherit; background: white; }
.messenger-settings input[type=checkbox], .messenger-confirm input[type=checkbox] { flex: none; width: 17px; min-height: 17px; height: 17px; margin: 0; padding: 0; }
.messenger-settings button, .messenger-confirm button { justify-self: start; }
.messenger-code { padding: 14px; margin: 16px 0; background: #edf5ff; border: 1px solid #bdd5f0; border-radius: 6px; }
.messenger-code code { display: block; padding: 10px; background: white; overflow-wrap: anywhere; user-select: all; }
@media (max-width: 600px) { .messenger-statuses { grid-template-columns: 1fr; } }
#messengers .form-grid label { min-width: 0; }
#messengers .form-grid select { min-width: 0; max-width: 100%; width: 100%; }

.messenger-connection, .messenger-effective { display: block; margin-top: 5px; font-size: .85rem; color: #657181; }

/* The invitation is generated locally and shown only in its issuing response. */
.messenger-max-invitation { display: flex; align-items: flex-start; gap: 24px; }
.messenger-max-invitation > div { flex: 1; min-width: 0; }
.messenger-max-invitation ol { padding-left: 22px; line-height: 1.55; }
.messenger-max-invitation li + li { margin-top: 5px; }
.messenger-max-invitation details { margin: 14px 0; }
.messenger-max-invitation details summary { cursor: pointer; }
.messenger-max-invitation [data-max-open] { display: inline-flex; align-items: center; }
.messenger-max-qr { flex: none; max-width: 100%; height: auto; background: white; border-radius: 6px; }
.messenger-max-status { margin-top: 16px; }
.messenger-max-invitation [hidden] { display: none; }
@media (max-width: 600px) {
  .messenger-max-invitation { flex-direction: column-reverse; align-items: stretch; }
  .messenger-max-qr { align-self: center; width: 240px; }
}

/* Payroll plans: fixed cells, independent event states, detail below the month. */
.plan-filters { margin-bottom: 20px; }
.plan-month-nav { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 22px 0 16px; }
.plan-month-nav h2 { margin: 0; font-size: 1.35rem; }
.plan-legend { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.plan-status { display: inline-block; padding: 6px 10px; border-radius: 7px; font-size: .82rem; font-weight: 600; line-height: 1.35; }
.plan-completed { color: #12623a; background: #e2f4e9; }
.plan-pending { color: #795500; background: #fff2bd; }
.plan-overdue { color: #a12626; background: #fce5e5; }
.plan-calendar-scroll { overflow-x: auto; border: 1px solid #dce1e8; border-radius: 12px; background: white; }
.plan-weekdays, .plan-month-grid { display: grid; grid-template-columns: repeat(7,minmax(0,1fr)); min-width: 680px; }
.plan-weekdays { background: #f0f3f8; }
.plan-weekdays span { padding: 12px; font-size: .8rem; font-weight: 600; color: #657181; }
.plan-month-grid { grid-auto-rows: 128px; gap: 1px; background: #e3e7ed; }
.plan-day { display: flex; flex-direction: column; gap: 5px; box-sizing: border-box; min-width: 0; height: 128px; padding: 9px; background: white; color: #263140; text-decoration: none; overflow: hidden; }
.plan-day:hover { background: #f3f7fc; text-decoration: none; }
.plan-day:focus-visible { outline: 3px solid #315d95; outline-offset: -3px; }
.plan-day.plan-selected { box-shadow: inset 0 0 0 2px #315d95; background: #f6f9fe; }
.plan-day.plan-blank { background: #f7f8fb; }
.plan-day-number { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-weight: 600; }
.plan-day-number small { font-size: .65rem; color: #315d95; font-weight: 500; }
.plan-today .plan-day-number { color: #315d95; }
.plan-mini { display: block; padding: 4px 6px; border-radius: 5px; min-width: 0; line-height: 1.2; }
.plan-mini-name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: .78rem; }
.plan-mini small { display: block; font-size: .67rem; margin-top: 2px; }
.plan-day-count { font-size: .82rem; color: #46556a; }
.plan-day-section { margin-top: 28px; scroll-margin-top: 18px; }
.plan-event { margin: 14px 0; padding: 20px; border: 1px solid #dce1e8; border-radius: 10px; background: white; }
.plan-event-heading { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; }
.plan-event h3 { margin: 0; font-size: 1.05rem; }
.plan-event p { margin: 10px 0; }
.plan-service { color: #657181; font-size: .9rem; }
.plan-mark-form { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; margin-top: 18px; }
.plan-mark-form .muted { font-size: .82rem; }
.plan-history { border-top: 1px solid #e3e7ed; margin-top: 18px; padding-top: 14px; font-size: .82rem; color: #657181; }
.plan-history h4 { margin: 0 0 8px; font-size: .82rem; }
.plan-history ul { margin: 0; padding-left: 18px; line-height: 1.6; }
.plan-footnote { margin-top: 22px; font-size: .82rem; }
@media (max-width: 760px) {
  .plan-month-nav { flex-wrap: wrap; }
  .plan-month-nav h2 { order: -1; flex-basis: 100%; text-align: center; }
  .plan-event { padding: 15px; }
}

/* Dashboard only: compact upcoming plans, retaining existing status colors. */
.plan-upcoming-list { display: grid; gap: 12px; }
.plan-upcoming-item { min-width: 0; }
.plan-upcoming-heading { display: flex; align-items: baseline; justify-content: space-between; gap: 8px 12px; }
.plan-upcoming-title { min-width: 0; overflow-wrap: anywhere; font-weight: 600; line-height: 1.4; }
.plan-upcoming-heading .plan-status { flex-shrink: 0; padding: 3px 7px; white-space: nowrap; }
.plan-upcoming-period { margin-top: 3px; font-size: .85rem; line-height: 1.4; overflow-wrap: anywhere; }
@media (max-width: 360px) {
  .plan-upcoming-heading { gap: 8px; }
  .plan-upcoming-heading .plan-status { font-size: .75rem; }
}

/* Binding status is distinct from channel permissions and delivery settings. */
.staff-notifications .messenger-icons { display: inline-flex; align-items: center; gap: 8px; white-space: nowrap; }
.staff-notifications .messenger-icon { display: inline-flex; align-items: center; justify-content: center; box-sizing: border-box; width: 32px; height: 32px; border-radius: 8px; color: #64748b; background: #f1f5f9; border: 1px solid #e2e8f0; }
.staff-notifications .messenger-icon svg { display: block; flex: none; }
.staff-notifications .messenger-icon--telegram.is-connected { color: #087abf; background: #e6f4ff; border-color: #c9e7fb; }
.staff-notifications .messenger-icon--max.is-connected { color: #7041c6; background: #f1eaff; border-color: #e1d4fa; }
.staff-notifications .messenger-icon:focus-visible { outline: 2px solid #315d95; outline-offset: 3px; }
.staff-notifications { white-space: nowrap; }

@media (max-width: 760px) {
  .staff-list-page .site-header { flex-wrap: wrap; }
  .staff-list-page .main-nav { order: 3; flex-basis: 100%; flex-wrap: wrap; }
  .staff-list-page .page-heading { flex-wrap: wrap; }
}
