/* Mobile production layout: loaded last so the PC layout remains unchanged above 820px. */
.mobile-menu-toggle,
.mobile-sidebar-backdrop {
  display: none;
}

.employee-account-row[hidden] {
  display: none !important;
}

@media (max-width: 820px) {
  :root {
    --mobile-gutter: 14px;
    --mobile-touch: 44px;
  }

  html,
  body,
  .app-shell {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow-x: hidden;
  }

  body {
    min-height: 100dvh;
    background: #f3f8f6;
  }

  body.mobile-nav-open {
    overflow: hidden;
  }

  .app-shell {
    display: block;
    min-height: 100dvh;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1002;
    width: min(84vw, 320px) !important;
    max-width: 320px;
    padding: 22px 14px calc(20px + env(safe-area-inset-bottom)) !important;
    overflow-y: auto;
    overscroll-behavior: contain;
    transform: translateX(-105%);
    transition: transform .22s ease;
    box-shadow: 18px 0 55px rgba(6, 35, 32, .28);
  }

  body.mobile-nav-open .sidebar {
    transform: translateX(0);
  }

  .sidebar .brand {
    padding: 0 10px !important;
    gap: 10px;
  }

  .sidebar .brand > span:last-child {
    display: inline !important;
    font-size: 23px !important;
    line-height: 1.1;
  }

  .sidebar .workspace {
    margin: 22px 6px 14px;
  }

  .sidebar nav {
    margin-top: 14px;
  }

  .sidebar .nav-item,
  .sidebar .nav-item:not(.active) {
    width: 100%;
    min-height: var(--mobile-touch);
    padding: 12px 14px;
    font-size: 15px !important;
    line-height: 1.35;
    white-space: nowrap;
  }

  .sidebar .nav-item span,
  .sidebar .nav-item:not(.active) span {
    width: 29px;
    font-size: 18px !important;
  }

  .sidebar .signed-in {
    align-items: flex-start;
  }

  .sidebar .signed-in > div:last-child {
    display: block !important;
    min-width: 0;
  }

  .sidebar .signed-in strong,
  .sidebar .signed-in small {
    overflow-wrap: anywhere;
  }

  .mobile-sidebar-backdrop {
    position: fixed;
    inset: 0;
    z-index: 1001;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(11, 39, 36, .56);
    backdrop-filter: blur(2px);
  }

  body.mobile-nav-open .mobile-sidebar-backdrop {
    display: block;
  }

  .main-content {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0;
    margin-left: 0 !important;
    padding: 0 var(--mobile-gutter) calc(70px + env(safe-area-inset-bottom)) !important;
  }

  .topbar {
    position: sticky;
    top: 0;
    z-index: 900;
    display: grid;
    grid-template-columns: var(--mobile-touch) minmax(0, 1fr) auto;
    gap: 11px;
    align-items: center;
    min-height: 70px;
    margin: 0 calc(-1 * var(--mobile-gutter)) 18px;
    padding: 10px var(--mobile-gutter);
    border-bottom: 1px solid #dce7e3;
    background: rgba(243, 248, 246, .96);
    backdrop-filter: blur(12px);
  }

  .topbar > div:not(.top-actions) {
    min-width: 0;
  }

  .topbar .eyebrow {
    margin-bottom: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar h1 {
    overflow: hidden;
    font-size: 24px;
    line-height: 1.15;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .top-actions {
    gap: 6px;
  }

  .top-actions .bell,
  .mobile-menu-toggle {
    width: var(--mobile-touch);
    height: var(--mobile-touch);
    min-width: var(--mobile-touch);
    padding: 0;
    border: 1px solid #d3e2de;
    border-radius: 12px;
    background: #fff;
    color: #184f48;
  }

  .mobile-menu-toggle {
    display: grid;
    place-items: center;
    font-size: 22px;
    cursor: pointer;
  }

  .top-actions .select-role {
    max-width: 86px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  button,
  input,
  select,
  textarea,
  a.outline {
    max-width: 100%;
    min-height: var(--mobile-touch);
  }

  .notice {
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 11px;
    padding: 15px;
  }

  .notice > span {
    width: 38px;
    height: 38px;
  }

  .notice button {
    grid-column: 1 / -1;
    width: 100%;
    min-height: 40px;
    margin: 0;
    border-radius: 10px;
    background: rgba(255, 255, 255, .68);
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }

  .stat-card {
    min-height: 158px;
    padding: 16px;
  }

  .stat-card strong {
    font-size: 24px;
  }

  .two-col {
    grid-template-columns: 1fr !important;
    gap: 12px;
    margin-top: 12px;
  }

  .panel,
  .month-panel,
  .promotion-alert-panel {
    min-width: 0;
    max-width: 100%;
    padding: 16px;
    border-radius: 15px;
  }

  .manager-dashboard-panel,
  .manager-approval-panel,
  .manager-schedule-panel {
    min-height: 0 !important;
  }

  .panel-head,
  .section-head,
  .account-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-items: flex-start;
    gap: 14px;
  }

  .account-head > div:last-child {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    width: 100%;
  }

  .account-head > div:last-child > * {
    width: 100%;
  }

  .panel-head {
    flex-wrap: wrap;
  }

  .panel-head > div,
  .section-head > div:first-child,
  .account-head > div {
    min-width: 0;
  }

  .section-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    margin-bottom: 18px;
  }

  .section-head h2 {
    font-size: 25px;
  }

  .section-actions,
  .expense-head-actions,
  .promotion-actions {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    gap: 8px;
  }

  .section-actions > *,
  .expense-head-actions > *,
  .promotion-actions > * {
    width: 100%;
  }

  .toolbar,
  .expense-toolbar,
  .absence-filters {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    align-items: stretch;
    width: 100%;
    gap: 9px;
    padding: 11px;
  }

  .toolbar > *,
  .expense-toolbar > *,
  .absence-filters > *,
  .search,
  .toolbar select,
  .toolbar button,
  .toolbar a {
    width: 100%;
    min-width: 0;
    margin-left: 0;
  }

  .toolbar .help {
    margin: 2px 0 0;
    padding: 8px 4px 0;
    line-height: 1.55;
  }

  .tab-row {
    width: 100%;
    max-width: 100%;
    margin-bottom: 14px;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
    scrollbar-width: none;
  }

  .tab-row::-webkit-scrollbar {
    display: none;
  }

  .tab {
    flex: 0 0 auto;
    min-height: 40px;
  }

  .month-heading {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 12px;
  }

  .month-heading select {
    width: 100%;
  }

  .month-targets {
    display: grid !important;
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .target-title {
    gap: 8px;
  }

  .target-title h3 {
    font-size: 14px;
  }

  .copy-target {
    min-height: 38px;
  }

  /* Large PC tables become labelled cards on phones. */
  .table-panel {
    padding: 0 !important;
    overflow: visible !important;
    border: 0 !important;
    border-radius: 0 !important;
    background: transparent !important;
    box-shadow: none !important;
  }

  .table-panel table,
  .table-panel tbody,
  .table-panel tr,
  .table-panel td {
    display: block;
    width: 100%;
  }

  .table-panel thead {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
  }

  .table-panel tbody {
    display: grid;
    gap: 11px;
  }

  .table-panel tbody tr {
    overflow: hidden;
    border: 1px solid #dce7e3;
    border-radius: 15px;
    background: #fff;
    box-shadow: 0 6px 20px rgba(27, 69, 63, .055);
  }

  .table-panel tbody td {
    display: grid;
    grid-template-columns: minmax(92px, 36%) minmax(0, 1fr);
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 10px 12px !important;
    border-bottom: 1px solid #edf2f0;
    overflow-wrap: anywhere;
    white-space: normal !important;
  }

  .table-panel tbody td::before {
    content: attr(data-mobile-label);
    color: #657b76;
    font-size: 11px;
    font-weight: 800;
    line-height: 1.35;
  }

  #employeeTable td:nth-child(1)::before,
  #dailyWorkerTable td:nth-child(1)::before,
  #freelancerTable td:nth-child(1)::before { content: '이름'; }
  #employeeTable td:nth-child(2)::before,
  #dailyWorkerTable td:nth-child(2)::before,
  #freelancerTable td:nth-child(2)::before,
  #leaveTable td:nth-child(2)::before { content: '부서'; }
  #employeeTable td:nth-child(3)::before,
  #freelancerTable td:nth-child(3)::before { content: '직책 / 직급'; }
  #dailyWorkerTable td:nth-child(3)::before,
  #employeeTable td:nth-child(4)::before,
  #freelancerTable td:nth-child(4)::before { content: '근무형태'; }
  #employeeTable td:nth-child(5)::before,
  #freelancerTable td:nth-child(5)::before { content: '입사일'; }
  #employeeTable td:nth-child(6)::before { content: '생년월일'; }
  #employeeTable td:nth-child(7)::before { content: '주민등록번호'; }
  #dailyWorkerTable td:nth-child(4)::before,
  #freelancerTable td:nth-child(6)::before { content: '연락처'; }
  #leaveTable td:nth-child(1)::before { content: '성명'; }
  #leaveTable td:nth-child(3)::before { content: '직위'; }
  #leaveTable td:nth-child(4)::before { content: '연차 발생 / 사용 / 잔여'; }
  #leaveTable td:nth-child(5)::before { content: '대휴 발생 / 사용 / 잔여'; }
  #employeeTable td:nth-child(8)::before,
  #dailyWorkerTable td:nth-child(5)::before,
  #freelancerTable td:nth-child(7)::before,
  #leaveTable td:nth-child(6)::before { content: '관리'; }

  body.department-manager #employeeTable td:nth-child(7)::before { content: '작업'; }

  #leave:has([data-leave-tab="requests"].active) #leaveTable td:nth-child(1)::before { content: '사원'; }
  #leave:has([data-leave-tab="requests"].active) #leaveTable td:nth-child(2)::before { content: '부서'; }
  #leave:has([data-leave-tab="requests"].active) #leaveTable td:nth-child(3)::before { content: '휴가 종류'; }
  #leave:has([data-leave-tab="requests"].active) #leaveTable td:nth-child(4)::before { content: '사용 기간'; }
  #leave:has([data-leave-tab="requests"].active) #leaveTable td:nth-child(5)::before { content: '일수'; }
  #leave:has([data-leave-tab="requests"].active) #leaveTable td:nth-child(6)::before { content: '상태'; }
  #leave:has([data-leave-tab="requests"].active) #leaveTable td:nth-child(7)::before { content: '관리'; }

  #leave:has([data-leave-tab="types"].active) #leaveTable td:nth-child(1)::before { content: '휴가 유형'; }
  #leave:has([data-leave-tab="types"].active) #leaveTable td:nth-child(2)::before { content: '구분'; }
  #leave:has([data-leave-tab="types"].active) #leaveTable td:nth-child(3)::before { content: '발생 기준'; }
  #leave:has([data-leave-tab="types"].active) #leaveTable td:nth-child(4)::before { content: '유효기간'; }
  #leave:has([data-leave-tab="types"].active) #leaveTable td:nth-child(5)::before { content: '사용 단위'; }
  #leave:has([data-leave-tab="types"].active) #leaveTable td:nth-child(6)::before { content: '승인 담당'; }
  #leave:has([data-leave-tab="types"].active) #leaveTable td:nth-child(7)::before { content: '설정'; }

  #leave:has([data-leave-tab="calendar"].active) #leaveTable td {
    display: block;
    padding: 12px !important;
    overflow-x: auto;
    overscroll-behavior-inline: contain;
  }

  #leave:has([data-leave-tab="calendar"].active) #leaveTable td::before {
    display: none;
  }

  #leave:has([data-leave-tab="calendar"].active) .calendar-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    min-width: 0;
  }

  #leave:has([data-leave-tab="calendar"].active) .calendar-controls select,
  #leave:has([data-leave-tab="calendar"].active) .calendar-controls .calendar-link {
    width: 100%;
  }

  #leave:has([data-leave-tab="calendar"].active) .calendar-controls .calendar-link {
    grid-column: 1 / -1;
    justify-content: center;
  }

  #leave:has([data-leave-tab="calendar"].active) .calendar-week,
  #leave:has([data-leave-tab="calendar"].active) .leave-calendar {
    min-width: 630px;
  }

  .table-panel tbody td:last-child {
    border-bottom: 0;
  }

  .table-panel tbody td[data-mobile-label=""]::before {
    display: none;
  }

  .table-panel tbody td.mobile-full-cell,
  .table-panel tbody td.empty-table {
    display: block !important;
    padding: 28px 16px !important;
    text-align: center;
  }

  .table-panel tbody td:empty {
    display: none;
  }

  .table-panel .employee-name,
  .table-panel .leave-numbers {
    min-width: 0;
  }

  .table-panel td > button,
  .table-panel td > .outline,
  .table-panel td > .primary {
    width: 100%;
  }

  /* Compact mobile summaries for leave and external-worker records. */
  #leave:has([data-leave-tab="monthly"].active) #leaveTable tr,
  .employment-management-view .table-panel tbody tr {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0 10px;
    padding: 12px;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable td,
  .employment-management-view .table-panel tbody td {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    align-content: center;
    gap: 4px;
    min-height: 0;
    padding: 9px 4px !important;
    border-bottom: 0;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable td::before,
  .employment-management-view .table-panel tbody td::before {
    color: #6b817c;
    font-size: 10px;
    line-height: 1.2;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable td:first-child,
  .employment-management-view .table-panel tbody td:first-child {
    grid-column: 1 / -1;
    display: block;
    padding: 2px 4px 12px !important;
    border-bottom: 1px solid #e7efec;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable td:first-child::before,
  .employment-management-view .table-panel tbody td:first-child::before {
    display: none;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable .employee-name,
  .employment-management-view .table-panel .employee-name {
    gap: 10px;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable .employee-name strong,
  .employment-management-view .table-panel .employee-name strong {
    font-size: 15px;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable td:nth-child(4),
  #leave:has([data-leave-tab="monthly"].active) #leaveTable td:nth-child(5) {
    margin-top: 2px;
    padding: 9px 4px 11px !important;
    border-top: 1px solid #edf3f1;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable .leave-chip {
    display: block;
    width: 100%;
    padding: 8px 7px;
    text-align: center;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable td.other-leave-cell {
    grid-column:1/-1;
    border-top:1px solid #edf3f1;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable td.other-leave-cell::before {
    content:'기타 휴가 발생 / 사용 / 잔여';
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable .other-leave-balances {
    grid-template-columns:repeat(2,minmax(0,1fr));
    min-width:0;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable td:last-child {
    grid-column: 1 / -1;
    padding: 5px 4px 2px !important;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable td:last-child::before {
    display: none;
  }

  #leave:has([data-leave-tab="monthly"].active) #leaveTable td:last-child button {
    min-height: 40px;
  }

  .employment-management-view .section-head {
    margin-bottom: 12px;
  }

  .employment-management-view .section-head > div {
    display: none;
  }

  .employment-management-view .section-head > button {
    width: 100%;
  }

  .employment-management-view .toolbar {
    grid-template-columns: minmax(0, 1fr) auto !important;
    align-items: center;
    padding: 10px !important;
  }

  .employment-management-view .toolbar .search {
    grid-column: auto;
    min-width: 0;
    margin: 0;
  }

  .employment-management-view .employment-count {
    width: auto;
    min-width: 50px;
    min-height: 38px;
    margin: 0;
    padding: 8px 10px;
    text-align: center;
  }

  .employment-management-view table {
    min-width: 0 !important;
  }

  #dailyWorkerTable td:nth-child(4),
  #freelancerTable td:nth-child(6) {
    display: none !important;
  }

  #dailyWorkerTable td:last-child,
  #freelancerTable td:last-child {
    grid-column: 1 / -1;
    padding: 8px 4px 2px !important;
    border-top: 1px solid #edf3f1;
  }

  #dailyWorkerTable td:last-child::before,
  #freelancerTable td:last-child::before {
    display: none;
  }

  .employment-management-view .employment-actions {
    display: grid !important;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    white-space: normal;
  }

  .employment-management-view .employment-actions button {
    width: 100%;
    min-height: 40px;
  }

  #leave > .section-head {
    margin-bottom: 12px;
  }

  #leave > .section-head > div:first-child {
    display: none;
  }

  #leave .toolbar {
    grid-template-columns: repeat(6, minmax(0, 1fr)) !important;
  }

  #leave .toolbar > select {
    grid-column: span 2;
    padding-inline: 8px;
  }

  #leave .toolbar > .search,
  #leave .toolbar > .help {
    grid-column: 1 / -1;
  }

  #leave .toolbar > button {
    grid-column: span 3;
  }

  .expense-grid {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 11px;
  }

  #expenses .expense-home-toolbar {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  }

  #expenses .expense-home-toolbar #expenseHomeReset,
  #expenses .expense-home-toolbar .expense-period-label {
    grid-column: 1 / -1;
  }

  #expenses .expense-home-toolbar .expense-period-label {
    text-align: center;
  }

  .expense-category {
    padding: 17px;
  }

  .expense-table-wrap {
    max-width: 100%;
    overflow: visible;
  }

  .expense-table,
  .expense-table tbody,
  .expense-table tr,
  .expense-table td {
    display: block;
    width: 100%;
  }

  .expense-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .expense-table tbody {
    display: grid;
    gap: 11px;
  }

  .expense-table tbody tr {
    overflow: hidden;
    border: 1px solid #dce7e3;
    border-radius: 14px;
    background: #fff;
  }

  .expense-table tbody td {
    display: grid;
    grid-template-columns: minmax(88px, 34%) minmax(0, 1fr);
    gap: 10px;
    align-items: center;
    min-height: 44px;
    padding: 10px 12px;
    border-bottom: 1px solid #edf2f0;
    overflow-wrap: anywhere;
    white-space: normal;
  }

  .expense-table tbody td::before {
    color: #657b76;
    font-size: 11px;
    font-weight: 800;
  }

  .expense-table tbody td:nth-child(1)::before { content: '지출일'; }
  .expense-table tbody td:nth-child(2)::before { content: '금액'; }
  .expense-table tbody td:nth-child(3)::before { content: '사용 부서'; }
  .expense-table tbody td:nth-child(4)::before { content: '사용처'; }
  .expense-table tbody td:nth-child(5)::before { content: '결제수단'; }
  .expense-table tbody td:nth-child(6)::before { content: '내용'; }
  .expense-table tbody td:nth-child(7)::before { content: '등록자'; }
  .expense-table tbody td:nth-child(8)::before { content: '관리'; }

  .expense-table tbody td:last-child {
    border-bottom: 0;
  }

  .expense-table tbody td[colspan] {
    display: block;
    padding: 28px 14px;
    text-align: center;
  }

  .expense-table tbody td[colspan]::before {
    display: none;
  }

  .expense-table tbody td > button {
    width: 100%;
  }

  .expense-card,
  .account-card {
    width: calc(100vw - 16px) !important;
    max-height: calc(100dvh - 16px);
    padding: 18px;
    border-radius: 16px;
  }

  .expense-form,
  .account-form,
  .form-grid,
  .detail-dialog .form-grid,
  .document-grid,
  .resignation-form-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .expense-form .wide,
  .account-form .wide,
  .form-grid .wide {
    grid-column: auto !important;
  }

  .department-list > div,
  .permission-row,
  .request-row,
  .schedule {
    align-items: flex-start;
    flex-wrap: wrap;
    gap: 9px;
  }

  .department-list > div > span,
  .permission-row > span:last-child,
  .request-row > span,
  .schedule > span {
    width: 100%;
    margin-left: 0 !important;
  }

  .department-list > div > div,
  .department-list > div > div button {
    flex: 1 1 auto;
  }

  dialog,
  #resignationDetailDialog,
  .leave-entry-dialog {
    width: calc(100vw - 16px) !important;
    max-width: none !important;
    max-height: calc(100dvh - 16px) !important;
    margin: auto !important;
    border-radius: 18px !important;
  }

  dialog > form,
  dialog > .detail-dialog,
  .leave-entry-dialog .detail-dialog {
    max-height: calc(100dvh - 16px);
    padding: 18px 15px 22px !important;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  .dialog-head {
    position: sticky;
    top: -18px;
    z-index: 4;
    margin: -18px -15px 18px !important;
    padding: 18px 15px 14px;
    border-bottom: 1px solid #e7eeeb;
    background: #fff;
  }

  .dialog-actions,
  .resignation-dialog-actions {
    position: sticky;
    bottom: -22px;
    z-index: 4;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin: 20px -15px -22px !important;
    padding: 14px 15px calc(14px + env(safe-area-inset-bottom)) !important;
    border-top: 1px solid #e7eeeb;
    background: #fff;
  }

  .dialog-actions > *,
  .resignation-dialog-actions > * {
    width: 100%;
  }

  .detail-grid {
    grid-template-columns: minmax(96px, 34%) minmax(0, 1fr);
  }

  .batch-leave-row {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .batch-leave-row .batch-remove {
    width: 100%;
  }

  .resignation-dialog-head,
  .resignation-dialog-body {
    padding-left: 16px;
    padding-right: 16px;
  }

  .resignation-drop-grid {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .resignation-record {
    grid-template-columns: 40px minmax(0, 1fr) !important;
    padding: 15px 13px;
  }

  .resignation-meta,
  .resignation-detail {
    grid-column: 1 / -1 !important;
  }

  .promotion-layout {
    grid-template-columns: minmax(0, 1fr) !important;
    gap: 14px;
  }

  .promotion-controls,
  .promotion-preview-shell {
    padding: 14px;
  }

  .promotion-preview {
    padding: 24px 18px;
  }

  .promotion-auto-summary,
  .promotion-summary {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .promotion-auto-summary i {
    display: none;
  }

  body > .toast {
    right: auto;
    bottom: calc(12px + env(safe-area-inset-bottom));
    left: 50%;
    width: max-content;
    max-width: calc(100vw - (var(--mobile-gutter) * 2));
    padding: 10px 14px;
    border-radius: 12px;
    font-size: 12px;
    line-height: 1.35;
    text-align: center;
    transform: translate(-50%, 10px);
  }

  body > .toast.show {
    transform: translate(-50%, 0);
  }

  dialog > .dialog-toast {
    right: var(--mobile-gutter);
    bottom: calc(14px + env(safe-area-inset-bottom));
    left: var(--mobile-gutter);
    width: auto;
    max-width: none;
    transform: translateY(12px);
  }

  dialog > .dialog-toast.show {
    transform: translateY(0);
  }

  .auth-card {
    width: calc(100vw - 28px);
    padding: 28px 21px;
  }
}

@media (max-width: 480px) {
  .account-head > div:last-child {
    grid-template-columns: minmax(0, 1fr);
  }

  .account-head > div:last-child > button {
    white-space: nowrap;
  }
}

@media (max-width: 350px) {
  :root {
    --mobile-gutter: 10px;
  }

  .stats-grid,
  .section-actions,
  .expense-head-actions,
  #expenses .expense-home-toolbar,
  .dialog-actions,
  .resignation-dialog-actions {
    grid-template-columns: minmax(0, 1fr) !important;
  }

  .top-actions .bell {
    display: none;
  }

  .topbar {
    grid-template-columns: var(--mobile-touch) minmax(0, 1fr);
  }
}

@media (min-width: 821px) {
  .sidebar {
    transform: none !important;
  }
}

@media (prefers-reduced-motion: reduce) {
  .sidebar {
    transition: none !important;
  }
}
