:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --surface: #ffffff;
  --surface-2: #eef2f5;
  --ink: #111318;
  --muted: #687382;
  --line: #dce3ea;
  --nav: #101217;
  --nav-soft: #1b1f27;
  --accent: #00a7b7;
  --accent-strong: #007988;
  --green: #1f9d6f;
  --amber: #bd7616;
  --rose: #d24444;
  --violet: #6f58d9;
  --shadow: 0 20px 50px rgba(17, 19, 24, 0.08);
  --radius: 8px;
  --sidebar-width: 280px;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(0, 167, 183, 0.05), transparent 32%),
    var(--bg);
  color: var(--ink);
  font-family:
    Inter, "Segoe UI", "Noto Sans", "PingFang TC", "Microsoft JhengHei",
    Arial, sans-serif;
  font-size: 15px;
  line-height: 1.45;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(244, 246, 248, 0.92);
  backdrop-filter: blur(12px);
}

.login-screen[hidden] {
  display: none;
}

.login-card {
  display: grid;
  width: min(440px, 100%);
  gap: 18px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card p,
.login-card small {
  color: var(--muted);
}

.login-language {
  justify-self: end;
}

.compact-brand {
  color: var(--ink);
}

.compact-brand .brand-mark {
  background: rgba(0, 167, 183, 0.1);
}

.app-shell.is-locked {
  pointer-events: none;
  user-select: none;
  filter: blur(3px);
}

.app-shell[hidden] {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 28px;
  padding: 24px 18px;
  background: var(--nav);
  color: #f7fafc;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand {
  display: grid;
  grid-template-columns: 44px 1fr;
  gap: 12px;
  align-items: center;
  min-height: 50px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid rgba(0, 167, 183, 0.65);
  border-radius: 8px;
  background: rgba(0, 167, 183, 0.12);
  color: #66f1ff;
  font-weight: 800;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 15px;
}

.brand span {
  margin-top: 3px;
  color: #93a0ad;
  font-size: 12px;
}

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

.nav-item {
  display: grid;
  grid-template-columns: 30px minmax(0, 1fr);
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #c6d0da;
  text-align: left;
}

.nav-item:hover,
.nav-item.is-active {
  border-color: rgba(0, 167, 183, 0.35);
  background: var(--nav-soft);
  color: #ffffff;
}

.nav-icon {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  color: #66f1ff;
}

.sidebar-status {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  color: #aab5bf;
  font-size: 13px;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(31, 157, 111, 0.16);
}

.main-area {
  min-width: 0;
  padding: 26px 30px 44px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 78px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 25px;
  font-weight: 760;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.topbar-controls,
.toolbar,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.language-switch,
.segmented {
  display: inline-flex;
  gap: 2px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.language-switch button,
.segmented button {
  min-width: 48px;
  height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.account-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  padding-left: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.account-chip .icon-button {
  height: 34px;
  min-height: 34px;
  border-radius: 6px;
}

.language-switch button.is-active,
.segmented button.is-active {
  background: var(--ink);
  color: #ffffff;
}

.view {
  display: none;
}

.view.is-active {
  display: block;
}

.view-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.view-heading p {
  max-width: 720px;
  margin-bottom: 0;
  color: var(--muted);
}

.payroll-job-progress {
  margin: -4px 0 18px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.payroll-job-progress-copy {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
}

.payroll-job-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 4px;
  background: #e5edf1;
}

.payroll-job-progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--accent);
  transition: width 180ms ease;
}

.batch-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
}

.batch-pill strong {
  color: var(--ink);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card,
.panel,
.approval-step,
.report-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
}

.metric-card {
  display: grid;
  min-height: 112px;
  padding: 16px;
  align-content: space-between;
}

.metric-card span,
.metric-card small {
  color: var(--muted);
}

.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
  line-height: 1.1;
}

.metric-card[data-tone="green"] strong {
  color: var(--green);
}

.metric-card[data-tone="amber"] strong {
  color: var(--amber);
}

.metric-card[data-tone="rose"] strong {
  color: var(--rose);
}

.metric-card[data-tone="violet"] strong {
  color: var(--violet);
}

.dashboard-summary-panel {
  margin-bottom: 16px;
}

.sync-status-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.sync-card {
  min-height: 96px;
}

.sync-layout {
  grid-template-columns: minmax(0, 1.1fr) minmax(340px, 0.75fr);
}

.split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 0.8fr);
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

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

.panel-title span {
  color: var(--muted);
  font-size: 13px;
}

.inner-panel-title {
  margin-top: 18px;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(170px, 1fr));
  gap: 10px;
}

.action-button {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  min-height: 58px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  text-align: left;
}

.action-button span {
  display: grid;
  width: 26px;
  height: 26px;
  place-items: center;
  border-radius: 6px;
  background: rgba(0, 167, 183, 0.12);
  color: var(--accent-strong);
  font-weight: 800;
}

.action-button.warning span {
  background: rgba(210, 68, 68, 0.12);
  color: var(--rose);
}

.action-button:hover,
.ghost-button:hover,
.primary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.workflow {
  display: grid;
  gap: 8px;
}

.workflow-step {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.step-index {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.workflow-step.is-done .step-index {
  background: rgba(31, 157, 111, 0.13);
  color: var(--green);
}

.workflow-step.is-current .step-index {
  background: rgba(0, 167, 183, 0.15);
  color: var(--accent-strong);
}

.workflow-step small {
  color: var(--muted);
}

.field {
  display: grid;
  gap: 7px;
}

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

.field-hint {
  min-height: 16px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}

input:disabled {
  cursor: not-allowed;
}

.date-input-with-picker {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 6px;
  min-width: 0;
}

.date-picker-button {
  display: inline-grid;
  min-width: 38px;
  min-height: 38px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--accent-strong);
  font-size: 18px;
  font-weight: 800;
}

.date-picker-button:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(0, 167, 183, 0.1);
}

.date-picker-popover {
  position: fixed;
  z-index: 180;
  width: min(320px, calc(100vw - 16px));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: 0 18px 45px rgba(17, 19, 24, 0.18);
}

.date-picker-popover[hidden] {
  display: none;
}

.date-picker-header,
.date-picker-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.date-picker-header {
  margin-bottom: 10px;
}

.date-picker-selectors {
  display: grid;
  grid-template-columns: minmax(84px, 1fr) minmax(90px, 1fr);
  flex: 1;
  gap: 6px;
}

.date-picker-selectors select {
  min-height: 34px;
  padding: 0 7px;
  font-size: 13px;
}

.date-picker-weekdays,
.date-picker-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 4px;
}

.date-picker-weekdays {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.date-picker-day,
.date-picker-month {
  min-height: 32px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font-size: 13px;
}

.date-picker-day:hover:not(:disabled),
.date-picker-month:hover:not(:disabled) {
  border-color: var(--accent);
  background: rgba(0, 167, 183, 0.08);
}

.date-picker-day.is-selected,
.date-picker-month.is-selected {
  background: var(--accent);
  color: #ffffff;
  font-weight: 800;
}

.date-picker-day:disabled,
.date-picker-month:disabled {
  cursor: not-allowed;
  opacity: 0.4;
}

.date-picker-empty {
  min-height: 32px;
}

.date-picker-month-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
}

.date-picker-footer {
  justify-content: flex-end;
  margin-top: 10px;
}

.date-picker-footer .ghost-button {
  min-height: 30px;
  padding: 4px 9px;
  font-size: 12px;
}

.compact-field {
  min-width: 145px;
}

input,
select {
  width: 100%;
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  padding: 0 11px;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 167, 183, 0.14);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.employee-detail-panel {
  margin-bottom: 16px;
}

.detail-search-field {
  max-width: 360px;
  margin-bottom: 14px;
}

.employee-detail-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 10px;
}

.employee-detail-grid .detail-item {
  display: grid;
  gap: 5px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.employee-detail-grid .detail-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.employee-detail-grid .detail-item strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 14px;
}

.employee-detail-grid .detail-empty {
  grid-column: 1 / -1;
  color: var(--muted);
  font-weight: 700;
}

.approval-history-detail {
  margin-top: 14px;
}

.approval-history-detail .detail-item strong {
  white-space: pre-wrap;
}

.request-link {
  border: 0;
  background: transparent;
  color: var(--accent-strong);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  padding: 0;
  text-align: left;
}

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

.import-issue-panel {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}

.compact-title {
  margin-bottom: 0;
}

.compact-title h4 {
  margin: 0;
  font-size: 15px;
}

.form-actions {
  grid-column: span 5;
  justify-content: flex-end;
}

.change-request-panel {
  margin-bottom: 16px;
}

.change-form,
.password-form,
.account-form {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 14px;
  align-items: end;
}

.password-form,
.account-form {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  margin-bottom: 16px;
}

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

.account-form .role-field {
  grid-column: span 2;
}

.role-checkbox-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 8px;
  min-width: 0;
}

.role-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 760;
  cursor: pointer;
}

.role-checkbox input {
  width: 16px;
  height: 16px;
  accent-color: var(--accent);
  flex: 0 0 auto;
}

.role-checkbox span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.role-checkbox.is-selected {
  border-color: rgba(0, 167, 183, 0.42);
  background: rgba(0, 167, 183, 0.1);
}

.role-checkbox:has(input:checked) {
  border-color: rgba(0, 167, 183, 0.42);
  background: rgba(0, 167, 183, 0.1);
}

.role-checkbox:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(0, 167, 183, 0.14);
}

.role-checkbox.is-disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.role-edit-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.role-edit-actions small {
  min-width: 0;
}

.role-edit-actions button {
  flex: 0 0 auto;
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.role-edit-actions [data-action="saveUserRoles"] {
  border-color: rgba(31, 157, 111, 0.36);
  color: var(--green);
}

.role-edit-actions [data-action="cancelUserRoles"] {
  color: var(--muted);
}

.primary-button,
.ghost-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 38px;
  border-radius: 8px;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.primary-button {
  border: 1px solid var(--ink);
  background: var(--ink);
  color: #ffffff;
  padding: 0 14px;
  font-weight: 760;
}

.ghost-button {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--ink);
  padding: 0 13px;
  font-weight: 700;
}

.icon-button {
  width: 36px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--accent-strong);
  font-weight: 900;
}

.table-shell {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.list-pagination {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  padding-top: 12px;
}

.list-pagination span {
  color: var(--muted);
  font-size: 0.875rem;
}

table {
  width: 100%;
  min-width: 840px;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: #f9fbfc;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

tbody tr:hover {
  background: #fbfdfe;
}

.summary-total-row td {
  background: #f3f8fa;
  font-weight: 750;
}

.summary-total-row:hover {
  background: #f3f8fa;
}

.production-dashboard-panel {
  margin-bottom: 14px;
}

.production-dashboard-shell table {
  min-width: 1760px;
}

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

.production-master-form .wide-field,
.production-master-form .form-actions {
  grid-column: 1 / -1;
}

.production-master-form .form-actions {
  justify-content: flex-end;
}

.production-dashboard-shell th:nth-child(-n + 6),
.production-dashboard-shell td:nth-child(-n + 6) {
  position: sticky;
  z-index: 2;
  background: var(--surface);
}

.production-dashboard-shell th:nth-child(-n + 6) {
  z-index: 4;
}

.production-dashboard-shell th:nth-child(1),
.production-dashboard-shell td:nth-child(1) {
  left: 0;
  min-width: 78px;
  max-width: 78px;
}

.production-dashboard-shell th:nth-child(2),
.production-dashboard-shell td:nth-child(2) {
  left: 78px;
  min-width: 132px;
  max-width: 132px;
}

.production-dashboard-shell th:nth-child(3),
.production-dashboard-shell td:nth-child(3) {
  left: 210px;
  min-width: 82px;
  max-width: 82px;
}

.production-dashboard-shell th:nth-child(4),
.production-dashboard-shell td:nth-child(4) {
  left: 292px;
  min-width: 92px;
  max-width: 92px;
}

.production-dashboard-shell th:nth-child(5),
.production-dashboard-shell td:nth-child(5) {
  left: 384px;
  min-width: 96px;
  max-width: 96px;
}

.production-dashboard-shell th:nth-child(6),
.production-dashboard-shell td:nth-child(6) {
  left: 480px;
  min-width: 96px;
  max-width: 96px;
  box-shadow: 8px 0 12px rgba(15, 23, 42, 0.08);
}

.production-dashboard-shell .summary-total-row td:nth-child(-n + 6) {
  background: #f3f8fa;
}

td strong {
  display: block;
}

td small {
  color: var(--muted);
}

.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 24px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge.green {
  background: rgba(31, 157, 111, 0.13);
  color: var(--green);
}

.badge.amber {
  background: rgba(189, 118, 22, 0.13);
  color: var(--amber);
}

.badge.rose {
  background: rgba(210, 68, 68, 0.13);
  color: var(--rose);
}

.badge.violet {
  background: rgba(111, 88, 217, 0.13);
  color: var(--violet);
}

.sync-warning-list,
.file-ledger,
.sync-config-grid {
  display: grid;
  gap: 10px;
}

.sync-trace-panel {
  border-color: rgba(16, 135, 151, 0.32);
}

.sync-trace-security {
  margin: 0 0 14px;
  color: var(--muted);
}

.sync-trace-list {
  display: grid;
  gap: 8px;
  max-height: 480px;
  overflow: auto;
}

.sync-trace-event {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(150px, 0.7fr) minmax(260px, 2fr);
  gap: 12px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
}

.sync-trace-event strong,
.sync-trace-event span,
.sync-trace-event small {
  overflow-wrap: anywhere;
}

.sync-trace-event small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.sync-credential-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.sync-sms-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.8fr);
  gap: 16px;
  align-items: end;
  border-color: rgba(203, 134, 21, 0.42);
  background: rgba(203, 134, 21, 0.06);
}

.sync-sms-panel h3,
.sync-sms-panel p {
  margin: 0;
}

.sync-sms-panel p,
.sync-sms-panel small {
  color: var(--muted);
}

.sync-sms-panel p {
  margin-top: 6px;
}

.sync-sms-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.sync-sms-form label {
  display: grid;
  gap: 6px;
}

.sync-sms-form input {
  min-width: 0;
}

.sync-credential-form .form-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  align-items: end;
}

.checkbox-field {
  display: flex;
  min-height: 42px;
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.checkbox-field input {
  width: auto;
}

.config-status {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
}

.sync-warning,
.file-row,
.sync-config-card {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.sync-warning {
  grid-template-columns: minmax(0, 1fr) auto 32px;
  align-items: center;
}

.sync-warning-content {
  min-width: 0;
}

.sync-warning-content strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-warning.critical {
  border-color: rgba(210, 68, 68, 0.32);
  background: rgba(210, 68, 68, 0.05);
}

.sync-warning span,
.file-row span,
.file-row small,
.sync-config-card span,
.empty-state {
  color: var(--muted);
  font-size: 13px;
}

.sync-warning-content span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  white-space: normal;
}

.sync-warning > .badge {
  max-width: 92px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-warning > .badge.amber {
  color: var(--amber);
}

.sync-warning > .badge.rose {
  color: var(--rose);
}

.sync-warning-delete {
  width: 28px;
  min-height: 28px;
  padding: 0;
  color: var(--rose);
  line-height: 1;
}

.file-row {
  grid-template-columns: minmax(120px, 0.8fr) minmax(0, 1fr) minmax(0, 1fr);
  align-items: center;
  min-width: 0;
}

.file-row > div {
  min-width: 0;
}

.file-row code {
  display: block;
  max-width: 100%;
  white-space: normal;
  word-break: break-word;
  overflow-wrap: anywhere;
  color: var(--ink);
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 12px;
}

.sync-config-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

.sync-config-card strong {
  font-size: 16px;
}

.sync-config-card.editable {
  gap: 10px;
}

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

.sync-config-inline input {
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.sync-config-inline .ghost-button {
  min-height: 40px;
  padding: 0 12px;
}

.empty-state {
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.upload-panel {
  display: grid;
  align-content: start;
}

.upload-zone {
  display: grid;
  min-height: 170px;
  place-items: center;
  padding: 18px;
  border: 1px dashed #aebcca;
  border-radius: 8px;
  background: #fbfdfe;
  text-align: center;
}

.upload-zone input {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.upload-zone span {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: rgba(0, 167, 183, 0.12);
  color: var(--accent-strong);
  font-size: 24px;
  font-weight: 900;
}

.upload-zone strong {
  margin-top: 8px;
}

.upload-zone small {
  color: var(--muted);
}

.face-photo-panel {
  display: grid;
  gap: 16px;
}

.face-photo-upload-form {
  display: grid;
  gap: 12px;
}

.face-photo-upload-form .upload-zone {
  min-height: 150px;
}

.face-photo-issues {
  padding: 14px 16px;
  border: 1px solid rgba(220, 38, 38, 0.32);
  border-radius: 8px;
  background: rgba(254, 226, 226, 0.62);
  color: #991b1b;
}

.face-photo-issues strong {
  display: block;
  margin-bottom: 8px;
}

.face-photo-issues ul {
  display: grid;
  gap: 6px;
  margin: 0;
  padding-left: 20px;
}

.face-photo-task-title {
  margin-top: 4px;
}

.face-photo-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.compact-action {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 12px;
  text-decoration: none;
}

.face-photo-panel .compact-table table {
  min-width: 980px;
}

.cloud-api-face-panel {
  margin-bottom: 16px;
}

.cloud-api-export-note {
  margin: 0;
  color: var(--muted);
}

.cloud-api-table-shell {
  max-width: 100%;
  box-shadow: none;
}

.cloud-api-table-shell .sync-job-table {
  table-layout: fixed;
}

.cloud-api-table-shell .sync-job-table th,
.cloud-api-table-shell .sync-job-table td {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

.cloud-api-batch-table {
  min-width: 940px !important;
}

.cloud-api-batch-table th:nth-child(1),
.cloud-api-batch-table td:nth-child(1) {
  width: 180px;
}

.cloud-api-batch-table th:nth-child(2),
.cloud-api-batch-table td:nth-child(2) {
  width: 190px;
}

.cloud-api-batch-table th:nth-child(3),
.cloud-api-batch-table td:nth-child(3),
.cloud-api-batch-table th:nth-child(4),
.cloud-api-batch-table td:nth-child(4),
.cloud-api-batch-table th:nth-child(5),
.cloud-api-batch-table td:nth-child(5) {
  width: 82px;
}

.cloud-api-batch-table th:nth-child(6),
.cloud-api-batch-table td:nth-child(6) {
  width: 110px;
}

.cloud-api-batch-table th:nth-child(7),
.cloud-api-batch-table td:nth-child(7) {
  width: 150px;
}

.cloud-api-exception-table,
.cloud-api-employee-table {
  min-width: 920px !important;
}

.cloud-api-face-table {
  min-width: 1040px !important;
}

.cloud-api-face-table th:nth-child(1),
.cloud-api-face-table td:nth-child(1) {
  width: 180px;
}

.cloud-api-face-table th:nth-child(2),
.cloud-api-face-table td:nth-child(2) {
  width: 240px;
}

.cloud-api-face-table th:nth-child(3),
.cloud-api-face-table td:nth-child(3),
.cloud-api-face-table th:nth-child(4),
.cloud-api-face-table td:nth-child(4),
.cloud-api-face-table th:nth-child(5),
.cloud-api-face-table td:nth-child(5),
.cloud-api-face-table th:nth-child(6),
.cloud-api-face-table td:nth-child(6) {
  width: 90px;
}

.cloud-api-face-table th:nth-child(7),
.cloud-api-face-table td:nth-child(7) {
  width: 260px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.import-status {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
  color: var(--muted);
  font-size: 13px;
}

.import-status strong {
  color: var(--ink);
}

.import-status > span:first-child {
  display: grid;
  gap: 2px;
  min-width: 0;
}

.import-status small {
  text-align: right;
}

.import-status .badge {
  flex: 0 0 auto;
}

.import-warning-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.import-warning-list[hidden] {
  display: none;
}

.warning-title,
.warning-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(189, 118, 22, 0.28);
  border-radius: 8px;
  background: rgba(189, 118, 22, 0.08);
}

.warning-row strong,
.warning-row small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.warning-row small {
  color: var(--muted);
}

.upload-panel.is-locked .upload-zone {
  opacity: 0.48;
  pointer-events: none;
}

.module-lock-note {
  display: grid;
  gap: 4px;
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.module-lock-note strong {
  color: var(--ink);
}

.module-lock-note small {
  color: var(--muted);
}

.check-list {
  display: grid;
  gap: 9px;
  margin: 14px 0 0;
  padding: 0;
  list-style: none;
}

.check-list li {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  align-items: start;
  color: var(--muted);
}

.check-list li::before {
  content: "✓";
  display: grid;
  width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: rgba(31, 157, 111, 0.13);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.check-list li.blocker::before {
  content: "!";
  background: rgba(210, 68, 68, 0.13);
  color: var(--rose);
}

.rule-grid,
.report-grid,
.summary-grid,
.mini-metrics,
.approval-grid {
  display: grid;
  gap: 12px;
}

.rule-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.rule-card {
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.rule-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.rule-card strong {
  font-size: 18px;
}

.rule-card p {
  margin: 10px 0;
  color: var(--muted);
}

.time-editor {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
  margin-bottom: 10px;
}

.time-editor label {
  display: grid;
  gap: 5px;
}

.time-editor label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}

.time-editor button {
  grid-column: 1 / -1;
}

.time-editor button,
.parameter-row button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.rule-card footer {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.mini-metrics {
  grid-template-columns: repeat(5, minmax(140px, 1fr));
  margin-bottom: 16px;
}

.mini-stat {
  min-height: 84px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

.mini-stat strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.row-actions button {
  min-height: 30px;
  padding: 0 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
}

.formula-stack {
  display: grid;
  gap: 10px;
}

.formula-stack code {
  display: block;
  overflow-wrap: anywhere;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101217;
  color: #d9fbff;
  white-space: normal;
}

.summary-grid {
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  min-width: 0;
}

#payrollDetailGrid {
  grid-template-columns: repeat(auto-fit, minmax(min(150px, 100%), 1fr));
  width: 100%;
}

.wide-summary {
  grid-column: 1 / -1;
  width: 100%;
  min-width: 0;
}

.summary-cell {
  min-height: 92px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
  overflow-wrap: anywhere;
}

.summary-cell span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.summary-cell strong {
  display: block;
  margin-top: 7px;
  font-size: 22px;
}

.approval-grid {
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  margin-bottom: 16px;
}

.approval-step {
  min-height: 130px;
  padding: 18px;
}

.approval-step span {
  color: var(--accent-strong);
  font-weight: 900;
}

.approval-step strong {
  display: block;
  margin-top: 16px;
  font-size: 18px;
}

.approval-step small {
  display: inline-flex;
  margin-top: 10px;
  color: var(--muted);
}

.approval-step button {
  width: 100%;
  min-height: 34px;
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.approval-step.is-done {
  border-color: rgba(31, 157, 111, 0.45);
}

.report-grid {
  grid-template-columns: repeat(4, minmax(190px, 1fr));
}

.report-card {
  display: grid;
  min-height: 132px;
  padding: 16px;
  align-content: space-between;
}

.report-card strong {
  display: block;
  font-size: 16px;
}

.report-card span {
  color: var(--muted);
}

.parameter-list,
.role-list {
  display: grid;
  gap: 10px;
}

.parameter-row,
.role-row,
.permission-toggle-row,
.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.parameter-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(150px, 0.7fr) minmax(140px, 0.5fr) auto;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(150px, 0.8fr) minmax(260px, 1.1fr) minmax(145px, 0.48fr) minmax(180px, 0.56fr) auto;
}

.user-row button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--rose);
  font-weight: 800;
}

.user-row [data-action="resetUserPassword"] {
  color: var(--ink);
}

.parameter-row small,
.role-row small,
.permission-toggle-row small,
.user-row small {
  display: block;
  color: var(--muted);
}

.permission-toggle-row button {
  min-height: 36px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.permission-toggle-row button.is-enabled {
  border-color: rgba(190, 99, 12, 0.32);
  color: var(--amber);
}

.user-permission-list {
  display: grid;
  gap: 10px;
}

.factory-site-list {
  display: grid;
  gap: 10px;
}

.factory-site-row {
  display: grid;
  grid-template-columns: minmax(110px, 0.35fr) minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.factory-site-row button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.user-row select {
  max-width: 220px;
}

.org-add-row {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 14px;
}

.org-tree-list {
  display: grid;
  gap: 12px;
}

.org-node {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdfe;
}

.org-node header,
.org-team-editor {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.org-node header strong {
  display: block;
  font-size: 17px;
}

.org-node header small {
  color: var(--muted);
}

.org-node button,
.org-team-editor button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 800;
}

.org-node header button {
  color: var(--rose);
}

.org-team-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.team-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 30px;
  padding: 4px 8px;
  border: 1px solid rgba(34, 211, 238, 0.28);
  border-radius: 999px;
  background: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.team-chip small {
  color: var(--muted);
  font-weight: 700;
}

.team-chip button {
  width: 22px;
  min-height: 22px;
  padding: 0;
  border-radius: 999px;
  color: var(--rose);
  line-height: 1;
}

.org-team-editor input {
  min-width: 0;
  flex: 1;
}

.compact-table table {
  min-width: 720px;
}

.import-issue-source-value {
  max-width: 240px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.compact-table .sync-job-table {
  table-layout: fixed;
  min-width: 620px;
}

.sync-job-table th:nth-child(1),
.sync-job-table td:nth-child(1) {
  width: 22%;
}

.sync-job-table th:nth-child(2),
.sync-job-table td:nth-child(2) {
  width: 17%;
}

.sync-job-table th:nth-child(3),
.sync-job-table td:nth-child(3) {
  width: 28%;
}

.sync-job-table th:nth-child(4),
.sync-job-table td:nth-child(4) {
  width: 15%;
}

.sync-job-table th:nth-child(5),
.sync-job-table td:nth-child(5) {
  width: 12%;
}

.sync-job-table th:nth-child(6),
.sync-job-table td:nth-child(6) {
  width: 12%;
}

.sync-job-table th:nth-child(1),
.sync-job-table td:nth-child(1) {
  width: 19%;
}

.sync-job-table th:nth-child(3),
.sync-job-table td:nth-child(3) {
  width: 25%;
}

.sync-job-table td > span:not(.badge),
.sync-job-table td small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-job-table th {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sync-job-table .badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .sync-trace-event {
    grid-template-columns: 1fr;
  }
}

.toast-region {
  position: fixed;
  right: 22px;
  top: 22px;
  z-index: 120;
  display: grid;
  gap: 10px;
  width: min(420px, calc(100vw - 44px));
  pointer-events: none;
}

.toast {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 12px;
  background: #ffffff;
  box-shadow: var(--shadow);
  pointer-events: auto;
  animation: toastIn 0.18s ease-out;
}

.toast.is-closing {
  opacity: 0;
  transform: translateY(-8px);
  transition:
    opacity 0.16s ease,
    transform 0.16s ease;
}

.toast-icon {
  display: inline-flex;
  width: 28px;
  height: 28px;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  background: rgba(0, 167, 183, 0.12);
  color: var(--accent-strong);
  font-weight: 900;
}

.toast-copy {
  min-width: 0;
}

.toast strong {
  display: block;
  margin-bottom: 2px;
  color: var(--ink);
  font-size: 14px;
}

.toast small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.toast.error {
  border-left-color: var(--rose);
}

.toast.error .toast-icon {
  background: rgba(221, 58, 68, 0.12);
  color: var(--rose);
}

.toast.success {
  border-left-color: var(--green);
}

.toast.success .toast-icon {
  background: rgba(15, 157, 119, 0.12);
  color: var(--green);
}

.toast.warning {
  border-left-color: var(--amber);
}

.toast.warning .toast-icon {
  background: rgba(179, 107, 0, 0.12);
  color: var(--amber);
}

.toast-close {
  width: 26px;
  min-height: 26px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 18px;
  line-height: 1;
}

.toast-close:hover {
  background: #eef5f7;
  color: var(--ink);
}

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

.interactive-auth-dialog {
  width: min(1120px, calc(100vw - 32px));
  max-width: none;
  max-height: calc(100vh - 32px);
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #ffffff;
  box-shadow: 0 24px 80px rgba(13, 22, 36, 0.32);
}

.interactive-auth-dialog::backdrop {
  background: rgba(9, 16, 25, 0.62);
}

.interactive-auth-shell {
  display: grid;
  gap: 14px;
  max-height: calc(100vh - 32px);
  padding: 22px;
  overflow: auto;
}

.interactive-auth-header,
.interactive-auth-footer,
.interactive-auth-sms {
  display: flex;
  gap: 14px;
  align-items: center;
  justify-content: space-between;
}

.interactive-auth-header h2 {
  margin: 0;
  font-size: 20px;
}

.interactive-auth-header p,
.interactive-auth-footer small {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.interactive-auth-status {
  min-height: 22px;
  padding: 10px 12px;
  border-left: 3px solid var(--cyan);
  color: var(--muted);
  background: #f4fafb;
}

.interactive-auth-status[data-status="captcha_required"] {
  border-left-color: var(--amber);
  background: #fff9eb;
  color: #805000;
}

.interactive-auth-status[data-status="sms_required"] {
  border-left-color: var(--violet);
  background: #f5f1ff;
  color: #513399;
}

.interactive-auth-status[data-status="authorized"] {
  border-left-color: var(--green);
  background: #eefaf4;
  color: #08724f;
}

.interactive-auth-browser {
  position: relative;
  min-height: 360px;
  overflow: auto;
  border: 1px solid var(--line);
  background: #edf3f5;
  cursor: crosshair;
}

.interactive-auth-browser img {
  display: block;
  width: 100%;
  min-width: 720px;
  height: auto;
  user-select: none;
  -webkit-user-drag: none;
}

.interactive-auth-empty {
  display: grid;
  min-height: 360px;
  place-items: center;
  color: var(--muted);
}

.interactive-auth-sms {
  justify-content: flex-start;
}

.interactive-auth-sms label {
  display: grid;
  gap: 6px;
  flex: 1;
  max-width: 460px;
  color: var(--muted);
  font-weight: 700;
}

.interactive-auth-footer {
  align-items: flex-end;
}

.interactive-auth-footer small {
  max-width: 640px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .sidebar {
    padding: 20px 12px;
  }

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

  .brand div:not(.brand-mark),
  .nav-item span:last-child,
  .sidebar-status span:last-child {
    display: none;
  }

  .nav-item {
    grid-template-columns: 1fr;
    justify-items: center;
  }

  .metric-grid,
  .sync-status-grid,
  .employee-detail-grid,
  .report-grid {
    grid-template-columns: repeat(2, minmax(170px, 1fr));
  }

  .form-grid {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

  .change-form,
  .password-form,
  .account-form {
    grid-template-columns: repeat(2, minmax(150px, 1fr));
  }

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

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

/*
 * Some mobile browsers can keep a wider layout viewport when the page is
 * opened from an in-app browser or desktop-site mode. Use a tablet-sized
 * breakpoint so the application never retains the desktop sidebar column on
 * a phone-sized screen.
 */
@media (max-width: 1024px) {
  .app-shell {
    display: block;
    width: 100%;
    min-width: 0;
  }

  .sidebar {
    position: relative;
    width: 100%;
    max-width: 100%;
    height: auto;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 14px 12px;
    -webkit-overflow-scrolling: touch;
  }

  .brand,
  .sidebar-status {
    display: none;
  }

  .nav-list {
    display: flex;
    min-width: max-content;
    width: max-content;
  }

  .nav-item {
    width: 46px;
  }

  .main-area {
    width: 100%;
    max-width: 100%;
    padding: 20px 16px 34px;
  }

  .topbar,
  .view-heading {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    min-width: 0;
  }

  .topbar-controls,
  .view-heading .toolbar {
    width: 100%;
    min-width: 0;
  }

  .split-layout,
  .employee-detail-grid,
  .approval-grid {
    grid-template-columns: 1fr;
  }

  .file-row,
  .sync-config-grid {
    grid-template-columns: 1fr;
  }

  .mini-metrics,
  .rule-grid,
  .summary-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }

  .user-row {
    grid-template-columns: 1fr;
    align-items: stretch;
  }
}

@media (max-width: 680px) {
  .metric-grid,
  .sync-status-grid,
  .mini-metrics,
  .rule-grid,
  .summary-grid,
  .report-grid,
  .form-grid,
  .change-form,
  .password-form,
  .account-form,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .form-actions {
    grid-column: span 1;
    justify-content: stretch;
  }

  .wide-field {
    grid-column: span 1;
  }

  .account-form .role-field {
    grid-column: span 1;
  }

  .role-checkbox-grid {
    grid-template-columns: 1fr;
  }

  .parameter-row,
  .user-row,
  .factory-site-row,
  .sync-warning,
  .sync-sms-panel,
  .sync-sms-form,
  .time-editor {
    grid-template-columns: 1fr;
  }

  .org-add-row,
  .org-node header,
  .org-team-editor {
    display: grid;
    grid-template-columns: 1fr;
  }

  .primary-button,
  .ghost-button {
    width: 100%;
  }

  .view-heading .toolbar,
  .topbar-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

  .sync-warning {
    min-width: 0;
  }

  .interactive-auth-shell {
    padding: 16px;
  }

  .interactive-auth-header,
  .interactive-auth-footer,
  .interactive-auth-sms {
    align-items: stretch;
    flex-direction: column;
  }

  .interactive-auth-sms label {
    max-width: none;
  }

  .interactive-auth-browser {
    min-height: 260px;
  }

  .table-shell {
    max-width: 100%;
    -webkit-overflow-scrolling: touch;
  }
}
