/*
 * Shared commercial UI layer for the admin console and customer portal.
 * This file intentionally contains presentation only.
 */

:root {
  color-scheme: light;
  --ui-sidebar-width: 232px;
  --ui-primary: #4f46e5;
  --ui-primary-hover: #4338ca;
  --ui-primary-active: #3730a3;
  --ui-primary-soft: #eef2ff;
  --ui-primary-border: #c7d2fe;
  --ui-page: #f6f7fb;
  --ui-surface: #ffffff;
  --ui-surface-subtle: #f9fafb;
  --ui-surface-muted: #f3f4f6;
  --ui-text: #111827;
  --ui-text-secondary: #4b5563;
  --ui-text-muted: #667085;
  --ui-text-faint: #667085;
  --ui-border: #e5e7eb;
  --ui-border-strong: #d1d5db;
  --ui-sidebar: #111827;
  --ui-sidebar-raised: #1f2937;
  --ui-sidebar-hover: #182132;
  --ui-sidebar-text: #d1d5db;
  --ui-success: #15803d;
  --ui-success-soft: #f0fdf4;
  --ui-success-border: #bbf7d0;
  --ui-danger: #dc2626;
  --ui-danger-dark: #b91c1c;
  --ui-danger-soft: #fef2f2;
  --ui-danger-border: #fecaca;
  --ui-warning: #a16207;
  --ui-warning-soft: #fffbeb;
  --ui-warning-border: #fde68a;
  --ui-radius: 8px;
  --ui-control-radius: 6px;
  --ui-shadow: 0 1px 2px rgba(17, 24, 39, 0.05), 0 4px 12px rgba(17, 24, 39, 0.04);
  --ui-shadow-modal: 0 24px 64px rgba(17, 24, 39, 0.2);
  --ui-focus: 0 0 0 3px rgba(79, 70, 229, 0.16);

  /* Existing admin token aliases. */
  --bg: var(--ui-page);
  --panel: var(--ui-surface);
  --sidebar: var(--ui-sidebar);
  --text: var(--ui-text);
  --muted: var(--ui-text-muted);
  --primary: var(--ui-primary);
  --primary-dark: var(--ui-primary-hover);
  --danger: var(--ui-danger);
  --line: var(--ui-border);
  --shadow: var(--ui-shadow);
  --radius: var(--ui-radius);

  /* Existing customer token aliases. */
  --page: var(--ui-page);
  --surface: var(--ui-surface);
  --surface-muted: var(--ui-surface-subtle);
  --border: var(--ui-border);
  --ink: var(--ui-text);
  --accent: var(--ui-primary);
  --accent-dark: var(--ui-primary-hover);
  --success: var(--ui-success);
  --success-soft: var(--ui-success-soft);
  --danger-soft: var(--ui-danger-soft);
  --warning: var(--ui-warning);
  --warning-soft: var(--ui-warning-soft);
}

* {
  box-sizing: border-box;
  letter-spacing: 0 !important;
}

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--ui-page);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  background: var(--ui-page);
  color: var(--ui-text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  max-width: 100%;
  font: inherit;
}

button {
  touch-action: manipulation;
}

button,
[role="button"],
[data-view],
[data-preset] {
  -webkit-tap-highlight-color: transparent;
}

::selection {
  color: var(--ui-text);
  background: #dfe3ff;
}

:focus {
  outline: none;
}

:focus-visible {
  outline: 2px solid var(--ui-primary);
  outline-offset: 2px;
}

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

input:read-only:not([type="date"]),
textarea:read-only {
  color: var(--ui-text-secondary);
  background: var(--ui-surface-muted);
}

body.ui-modal-open {
  overflow: hidden;
}

/* Remove legacy decorative effects without removing the login image asset. */
.sidebar .nav-item.active,
.attendance-live-box,
.metric-highlight,
.soft-btn.primary,
.bottom-nav-item.active,
.login-screen::before {
  background-image: none !important;
}

/* Admin shell */
.app-shell {
  min-height: 100dvh;
  background: var(--ui-page);
}

.sidebar {
  position: fixed;
  z-index: 40;
  inset: 0 auto 0 0;
  width: var(--ui-sidebar-width);
  padding: 16px 12px 24px;
  overflow-x: hidden;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--ui-sidebar);
  border-right: 1px solid #263244;
  scrollbar-width: thin;
  scrollbar-color: #374151 transparent;
}

.sidebar::-webkit-scrollbar {
  width: 6px;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #374151;
  border-radius: 6px;
}

.logo {
  min-height: 56px;
  margin: 0 0 10px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #ffffff;
  opacity: 1;
}

.logo::before {
  width: 9px;
  height: 28px;
  flex: 0 0 9px;
  background: var(--ui-primary);
  border-radius: 3px;
  box-shadow: none;
}

.logo::after {
  color: #ffffff;
  font-size: 17px;
  font-weight: 750;
  line-height: 1.25;
}

.nav-section-label {
  padding: 16px 12px 7px;
  color: #7f8ba0;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
  text-transform: none;
}

.sidebar .nav-item {
  position: relative;
  min-height: 46px;
  padding: 0 12px;
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--ui-sidebar-text);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--ui-control-radius);
  box-shadow: none;
  cursor: pointer;
  user-select: none;
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.sidebar .nav-item::before {
  left: 0;
  top: 11px;
  bottom: 11px;
  width: 3px;
  background: transparent;
  border-radius: 0 3px 3px 0;
}

.sidebar .nav-item:hover {
  color: #ffffff;
  background: var(--ui-sidebar-hover);
  border-color: #2d3a4e;
}

.sidebar .nav-item.active {
  color: #ffffff;
  background: var(--ui-sidebar-raised);
  border-color: #344156;
  box-shadow: none;
}

.sidebar .nav-item.active::before {
  background: var(--ui-primary);
}

.sidebar .nav-item:focus-visible {
  outline-color: #a5b4fc;
  outline-offset: -2px;
}

.sidebar .nav-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  color: currentColor;
  background: #151f30;
  border: 1px solid #374151;
  border-radius: 6px;
  box-shadow: none;
}

.sidebar .nav-item.active .nav-icon {
  background: #171d34;
  border-color: #6366f1;
}

.nav-text {
  min-width: 0;
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.3;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.main-content {
  min-width: 0;
  min-height: 100dvh;
  margin-left: var(--ui-sidebar-width);
  padding: 0 28px 40px;
  background: var(--ui-page);
}

.topbar {
  position: sticky;
  z-index: 30;
  top: 0;
  min-height: 65px;
  margin: 0 -28px 24px;
  padding: 12px 28px;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--ui-surface);
  border-bottom: 1px solid var(--ui-border);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.topbar-left {
  min-width: 0;
}

.icon-btn {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ui-text-secondary);
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-control-radius);
  box-shadow: none;
}

.avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

.avatar-wrap,
.profile-avatar {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  box-shadow: none;
}

.role-badge,
.attendance-status {
  min-height: 34px;
  padding: 6px 10px;
  display: inline-flex;
  align-items: center;
  color: var(--ui-text-secondary);
  background: var(--ui-surface-subtle);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-control-radius);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.role-badge {
  color: var(--ui-primary-active);
  background: var(--ui-primary-soft);
  border-color: var(--ui-primary-border);
}

.attendance-topbar {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}

.attendance-live-box {
  min-width: 128px;
  padding: 7px 11px;
  color: #ffffff;
  background: var(--ui-primary);
  border: 1px solid var(--ui-primary);
  border-radius: var(--ui-control-radius);
  box-shadow: none;
}

.attendance-live-label {
  font-size: 10px;
  line-height: 1;
  opacity: 0.84;
}

.attendance-live-time {
  margin-top: 4px;
  font-size: 19px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.attendance-running-bar {
  color: var(--ui-primary-active);
  background: var(--ui-primary-soft);
  border: 1px solid var(--ui-primary-border);
  border-radius: var(--ui-control-radius);
}

.attendance-running-bar.muted {
  color: var(--ui-text-muted);
  background: var(--ui-surface-muted);
  border-color: var(--ui-border);
}

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

.page-head > div:first-child {
  min-width: 0;
}

.page-title {
  margin: 0;
  color: var(--ui-text);
  font-size: 22px;
  font-weight: 750;
  line-height: 1.3;
}

.page-subtitle {
  max-width: 760px;
  margin-top: 5px;
  color: var(--ui-text-muted);
  font-size: 13px;
  line-height: 1.55;
}

.page-head-actions {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.ui-last-updated {
  display: block;
  margin-top: 4px;
  color: var(--ui-text-faint);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  white-space: nowrap;
}

/* Controls and forms */
.btn,
.soft-btn,
.primary-button,
.secondary-button,
.text-button {
  --ui-busy-color: var(--ui-primary);
  min-height: 38px;
  padding: 0 14px;
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--ui-text-secondary);
  background: var(--ui-surface);
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-control-radius);
  box-shadow: none;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  white-space: nowrap;
  transition: color 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.btn {
  height: 38px;
}

.btn-sm {
  min-height: 32px;
  height: 32px;
  padding: 0 10px;
  font-size: 12px;
}

.btn:hover,
.secondary-button:hover {
  color: var(--ui-text);
  background: var(--ui-surface-subtle);
  border-color: #9ca3af;
  transform: none;
}

.btn-primary,
.soft-btn.primary,
.primary-button {
  --ui-busy-color: #ffffff;
  color: #ffffff;
  background: var(--ui-primary);
  border-color: var(--ui-primary);
}

.btn-primary:hover,
.soft-btn.primary:hover,
.primary-button:hover {
  color: #ffffff;
  background: var(--ui-primary-hover);
  border-color: var(--ui-primary-hover);
}

.btn-primary:active,
.soft-btn.primary:active,
.primary-button:active {
  background: var(--ui-primary-active);
  border-color: var(--ui-primary-active);
}

.btn-primary-outline {
  color: var(--ui-primary-active);
  background: var(--ui-primary-soft);
  border-color: var(--ui-primary-border);
}

.btn-danger,
.soft-btn.danger {
  --ui-busy-color: #ffffff;
  color: #ffffff;
  background: var(--ui-danger);
  border-color: var(--ui-danger);
}

.btn-danger:hover,
.soft-btn.danger:hover {
  color: #ffffff;
  background: var(--ui-danger-dark);
  border-color: var(--ui-danger-dark);
}

.btn-ghost-danger {
  color: var(--ui-danger-dark);
  background: var(--ui-surface);
  border-color: var(--ui-danger-border);
}

.soft-btn.warning {
  color: var(--ui-warning);
  background: var(--ui-warning-soft);
  border-color: var(--ui-warning-border);
}

.soft-btn {
  width: 100%;
  height: 42px;
  padding: 0 10px;
  color: var(--ui-text-secondary);
  background: var(--ui-surface-muted);
  border-color: var(--ui-border);
}

.soft-btn small {
  font-size: 10px;
  font-weight: 650;
}

.input,
.select,
.field input,
.date-filter input {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  color: var(--ui-text);
  background: var(--ui-surface);
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--ui-control-radius);
  box-shadow: none;
  outline: none;
  font-size: 14px;
  line-height: 1.4;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}

.input:hover,
.select:hover,
.field input:hover,
.date-filter input:hover {
  border-color: #9ca3af;
}

.input:focus,
.select:focus,
.field input:focus,
.date-filter input:focus {
  border-color: var(--ui-primary);
  box-shadow: var(--ui-focus);
}

.form-row,
.form-item,
.field {
  min-width: 0;
}

.form-row {
  margin-bottom: 15px;
}

.form-item label,
.login-label,
.field span,
.date-filter label span {
  display: block;
  margin: 0 0 7px;
  color: var(--ui-text-secondary);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

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

.form-item.span-2 {
  grid-column: 1 / -1;
}

.hint-text,
.permission-note {
  color: var(--ui-text-muted);
  font-size: 12px;
  line-height: 1.55;
}

.permission-note {
  color: var(--ui-primary-active);
  font-weight: 700;
}

/* Password visibility enhancement, added without moving or renaming inputs. */
.ui-password-field {
  position: relative;
}

.ui-password-field .ui-password-input {
  padding-right: 48px !important;
}

.ui-password-toggle {
  position: absolute;
  z-index: 2;
  right: 7px;
  bottom: 6px;
  width: 30px;
  height: 30px;
  min-width: 30px;
  min-height: 30px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ui-text-muted);
  background: transparent;
  border: 0;
  border-radius: 5px;
  cursor: pointer;
}

.ui-password-toggle:hover {
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
}

.ui-password-toggle::before {
  content: "";
  width: 16px;
  height: 10px;
  border: 1.5px solid currentColor;
  border-radius: 50% / 60%;
}

.ui-password-toggle::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
}

.ui-password-toggle[aria-pressed="true"] {
  color: var(--ui-primary);
  background: var(--ui-primary-soft);
}

/* Cards, summaries, and status */
.panel,
.summary-tile,
.summary-card,
.dashboard-card,
.role-scope-panel,
.list-toolbar,
.app-card,
.worklog-summary-card,
.worklog-table-wrap,
.worklog-mobile-card {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
}

.panel {
  padding: 18px;
}

.panel-head {
  padding: 15px 16px;
  border-color: var(--ui-border);
}

.panel-head h2,
.worklog-section-title {
  color: var(--ui-text);
  font-size: 15px;
  font-weight: 750;
  line-height: 1.35;
}

.panel-head p {
  color: var(--ui-text-muted);
  line-height: 1.5;
}

.summary-strip {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.summary-tile {
  min-height: 86px;
  padding: 14px 15px;
}

.summary-tile span,
.dashboard-card-label,
.metric-label {
  color: var(--ui-text-muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
}

.summary-tile b,
.dashboard-card-value,
.metric-value {
  color: var(--ui-text);
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.summary-tile b {
  margin-top: 9px;
  font-size: 21px;
}

.summary-tile em {
  margin-top: 7px;
  color: var(--ui-text-faint);
  font-size: 11px;
}

.summary-tile-danger,
.dashboard-card.danger {
  background: var(--ui-danger-soft);
  border-color: var(--ui-danger-border);
}

.summary-tile-danger b,
.dashboard-card.danger .dashboard-card-value,
.balance-danger,
.balance-debt,
.amount-negative {
  color: var(--ui-danger-dark) !important;
}

.summary-tile-warning {
  background: var(--ui-warning-soft);
  border-color: var(--ui-warning-border);
}

.summary-tile-warning b,
.balance-warning {
  color: var(--ui-warning) !important;
}

.role-scope-panel {
  grid-template-columns: minmax(140px, 180px) minmax(0, 1fr) auto;
  padding: 14px 16px;
}

.scope-title {
  color: var(--ui-text);
  font-size: 15px;
  font-weight: 750;
}

.scope-body {
  color: var(--ui-text-muted);
}

.scope-tags span,
.tag,
.metric-chip {
  min-height: 26px;
  padding: 4px 9px;
  display: inline-flex;
  align-items: center;
  color: var(--ui-primary-active);
  background: var(--ui-primary-soft);
  border: 1px solid var(--ui-primary-border);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.25;
}

.tag-success,
.amount-positive {
  color: var(--ui-success) !important;
}

.tag-success {
  background: var(--ui-success-soft);
  border-color: var(--ui-success-border);
}

.dashboard-grid {
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.dashboard-card {
  min-height: 112px;
  padding: 15px;
}

.dashboard-card-value {
  margin-top: 10px;
  font-size: 23px;
}

.dashboard-card-note {
  margin-top: 9px;
  color: var(--ui-text-faint);
  line-height: 1.4;
}

.dashboard-card-clickable {
  transition: border-color 120ms ease, background-color 120ms ease;
}

.dashboard-card-clickable:hover,
.quick-action:hover {
  background: #fafaff;
  border-color: var(--ui-primary-border);
  box-shadow: var(--ui-shadow);
  transform: none;
}

.dashboard-card-clickable:focus-visible {
  outline-color: var(--ui-primary);
}

.dashboard-card-clickable .dashboard-card-note::after,
.dashboard-list-row strong {
  color: var(--ui-primary);
}

.dashboard-columns {
  gap: 16px;
}

.dashboard-panel {
  padding: 0;
}

.dashboard-list-row {
  padding: 12px 16px;
  border-color: var(--ui-border);
}

.dashboard-list-row b,
.quick-action b,
.card-title {
  color: var(--ui-text);
}

.dashboard-list-row span,
.quick-action span,
.card-sub,
.card-text,
.metric-inline {
  color: var(--ui-text-muted);
}

.quick-action {
  min-height: 64px;
  border-color: var(--ui-border);
  border-radius: var(--ui-control-radius);
  transition: border-color 120ms ease, background-color 120ms ease;
}

.list-toolbar {
  padding: 13px 14px;
}

.toolbar-main {
  gap: 8px;
}

.toolbar-main .input,
.toolbar-main .btn,
.team-search-toolbar .input,
.team-search-toolbar .btn {
  height: 38px;
}

.metric-box {
  padding: 11px;
  background: var(--ui-surface-subtle);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-control-radius);
}

.app-card .metric-box {
  padding: 8px 0;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.app-card-grid.two .metric-box:nth-child(even) {
  padding-left: 12px;
  border-left: 1px solid var(--ui-border);
}

.metric-value {
  font-size: 19px;
}

.metric-value.small {
  font-size: 13px;
  line-height: 1.45;
}

.app-card {
  padding: 14px;
}

.app-card-head {
  min-width: 0;
  margin-bottom: 12px;
}

.app-card-head > :first-child,
.card-title,
.card-title.with-avatar,
.card-title.with-avatar > span,
.card-sub {
  min-width: 0;
  max-width: 100%;
}

.app-card-head > :first-child {
  flex: 1 1 auto;
}

.card-title,
.card-title.with-avatar > span,
.card-sub {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.app-card-head > .metric-chip {
  min-width: 0;
  max-width: 48%;
  flex: 0 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
}

.app-card-grid {
  gap: 8px;
  margin-bottom: 12px;
}

.app-action-row {
  gap: 8px;
}

.timer-value,
.timer-mobile,
.attendance-live-time {
  font-variant-numeric: tabular-nums;
}

.timer-value {
  color: var(--ui-text);
  font-size: 17px;
  font-weight: 750;
}

.timer-label,
.timer-sub,
.balance-hint {
  color: var(--ui-text-muted);
}

.team-group-row td {
  color: var(--ui-text-secondary) !important;
  background: var(--ui-surface-subtle) !important;
  border-color: var(--ui-border) !important;
}

.team-group-row td::before {
  background: var(--ui-primary);
}

.team-search-panel {
  padding: 0;
}

.search-result-table {
  max-width: 100%;
  overflow: auto;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: none;
}

/* Tables */
.table-panel {
  width: 100%;
  max-width: 100%;
  padding: 0;
  overflow-x: auto;
  overflow-y: hidden;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
  -webkit-overflow-scrolling: touch;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--ui-surface);
}

.table thead th {
  position: sticky;
  z-index: 2;
  top: 0;
  height: 44px;
  padding: 0 14px;
  color: var(--ui-text-secondary);
  background: var(--ui-surface-subtle);
  border-bottom: 1px solid var(--ui-border);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left;
  white-space: nowrap;
}

.table tbody td {
  min-height: 54px;
  height: 54px;
  padding: 10px 14px;
  color: var(--ui-text);
  background: var(--ui-surface);
  border-bottom: 1px solid var(--ui-border);
  font-size: 13px;
  line-height: 1.45;
  vertical-align: middle;
}

.table tbody tr:nth-child(even) td {
  background: #fdfdfe;
}

.table tbody tr:hover td {
  background: var(--ui-surface-subtle);
}

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

#view-users .table {
  min-width: 900px;
}

#view-team .table {
  min-width: 920px;
}

#view-staff .table {
  min-width: 1320px;
}

.action-group {
  gap: 6px;
  align-items: center;
}

.action-group .btn-sm {
  min-width: 46px;
  border-radius: var(--ui-control-radius);
}

.action-group .btn-sm.btn-primary {
  color: var(--ui-primary-active);
  background: var(--ui-primary-soft);
  border-color: var(--ui-primary-border);
}

.action-group .btn-sm.btn-danger {
  color: #ffffff;
  background: var(--ui-danger);
  border-color: var(--ui-danger);
}

/* Empty, loading, pagination, and feedback */
.empty-state,
.app-empty,
.worklog-empty,
.dashboard-empty,
.loading {
  min-height: 116px;
  padding: 40px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--ui-text-faint);
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: none;
  font-size: 13px;
  line-height: 1.5;
  text-align: center;
}

.table-panel > .empty-state {
  border: 0;
  border-radius: 0;
}

.dashboard-panel .dashboard-empty {
  min-height: 88px;
  background: transparent;
  border: 0;
  border-radius: 0;
}

.loading {
  gap: 10px;
}

.loading::before {
  content: "";
  width: 16px;
  height: 16px;
  flex: 0 0 16px;
  border: 2px solid var(--ui-primary-border);
  border-top-color: var(--ui-primary);
  border-radius: 50%;
  animation: ui-system-spin 800ms linear infinite;
}

.pager,
.pager-bar {
  min-height: 54px;
  padding: 10px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ui-text-muted);
  background: var(--ui-surface);
  border-top: 1px solid var(--ui-border);
  font-size: 12px;
}

.pager-actions,
.pager > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pager-actions .btn,
.pager .compact {
  min-width: 72px;
}

.toast {
  z-index: 100;
  max-width: min(440px, calc(100vw - 32px));
  padding: 10px 14px;
  color: #ffffff;
  background: #1f2937;
  border: 1px solid #374151;
  border-radius: var(--ui-control-radius);
  box-shadow: 0 10px 28px rgba(17, 24, 39, 0.18);
  font-size: 13px;
  font-weight: 650;
  line-height: 1.45;
  text-align: center;
}

/* Existing request code owns aria-busy; this layer only represents it. */
button[aria-busy="true"],
button.ui-is-busy {
  color: transparent !important;
  cursor: wait;
  pointer-events: none;
}

button[aria-busy="true"]::before,
button.ui-is-busy::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 15px;
  height: 15px;
  margin: -8px 0 0 -8px;
  border: 2px solid var(--ui-busy-color);
  border-right-color: transparent;
  border-radius: 50%;
  animation: ui-system-spin 700ms linear infinite;
}

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

/* Modals */
.modal-mask {
  z-index: 80;
  background: rgba(17, 24, 39, 0.5);
}

.modal {
  z-index: 81;
  width: min(760px, calc(100vw - 32px));
  max-height: min(88vh, 860px);
  overflow: hidden;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: 10px;
  box-shadow: var(--ui-shadow-modal);
}

.modal-header {
  min-height: 58px;
  padding: 14px 18px;
  background: var(--ui-surface);
  border-color: var(--ui-border);
}

.modal-title {
  min-width: 0;
  color: var(--ui-text);
  font-size: 16px;
  font-weight: 750;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.modal-close,
.worklog-close {
  width: 34px;
  height: 34px;
  min-width: 34px;
  min-height: 34px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ui-text-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--ui-control-radius);
  box-shadow: none;
  font-size: 23px;
  line-height: 1;
}

.modal-close:hover,
.worklog-close:hover {
  color: var(--ui-text);
  background: var(--ui-surface-muted);
  border-color: var(--ui-border);
}

.modal-body {
  max-height: calc(min(88vh, 860px) - 118px);
  padding: 18px;
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.modal-footer {
  min-height: 58px;
  padding: 10px 18px;
  background: var(--ui-surface-subtle);
  border-color: var(--ui-border);
}

.modal.worklog-modal {
  width: min(1360px, calc(100vw - 48px));
  max-height: 92vh;
  background: var(--ui-page);
  border-radius: 10px;
}

.worklog-page {
  background: var(--ui-page);
}

.worklog-page-title {
  color: var(--ui-text);
  font-size: 21px;
  font-weight: 750;
}

.worklog-page-sub,
.worklog-mobile-sub,
.worklog-mobile-meta,
.pager-info {
  color: var(--ui-text-muted);
}

.worklog-income {
  color: var(--ui-success);
}

.worklog-fee {
  color: var(--ui-danger-dark);
}

.kv-line {
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  background: var(--ui-surface-subtle);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
}

.bill-reconciliation-line,
.reconciliation-line {
  color: #166534;
  background: var(--ui-success-soft);
  border-color: var(--ui-success-border);
  border-left-color: var(--ui-success);
  border-radius: var(--ui-control-radius);
}

.bill-audit-hint {
  color: #854d0e;
  background: var(--ui-warning-soft);
  border-color: var(--ui-warning-border);
}

/* Admin login */
.login-screen {
  padding: 24px clamp(24px, 10vw, 168px) 24px 24px;
  background-color: #e9edf4;
}

.login-screen::before {
  background: rgba(17, 24, 39, 0.28);
}

.login-card {
  width: min(400px, 100%);
  padding: 28px;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(255, 255, 255, 0.9);
  border-radius: var(--ui-radius);
  box-shadow: 0 18px 48px rgba(17, 24, 39, 0.2);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.login-title {
  margin-bottom: 22px;
  color: var(--ui-text);
  font-size: 26px;
  font-weight: 750;
  line-height: 1.3;
  text-shadow: none;
}

.login-card .input,
.login-card .btn {
  height: 42px;
  border-radius: var(--ui-control-radius);
}

/* Customer portal */
.login-view {
  min-height: 100dvh;
  padding: 24px 16px;
  background: var(--ui-page);
}

.login-panel {
  width: min(100%, 400px);
  padding: 28px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
}

.brand-avatar,
.header-brand img {
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-control-radius);
}

.brand-name,
.header-brand span {
  color: var(--ui-text-muted);
}

.login-panel h1 {
  margin: 5px 0 24px;
  color: var(--ui-text);
  font-size: 23px;
  font-weight: 750;
  line-height: 1.3;
}

.login-panel .primary-button {
  width: 100%;
  min-height: 44px;
}

.form-message {
  color: var(--ui-danger-dark);
}

.portal {
  min-height: 100dvh;
  background: var(--ui-page);
}

.app-header {
  background: var(--ui-surface);
  border-color: var(--ui-border);
}

.header-inner {
  width: min(100%, 1200px);
  min-height: 64px;
  padding: 8px 20px;
}

.header-brand strong {
  color: var(--ui-text);
  font-size: 15px;
  font-weight: 750;
}

.text-button {
  min-height: 36px;
  padding: 0 10px;
  color: var(--ui-primary);
  background: transparent;
  border-color: transparent;
}

.text-button:hover {
  color: var(--ui-primary-hover);
  background: var(--ui-primary-soft);
  border-color: transparent;
}

.content {
  width: min(100%, 1200px);
  padding: 20px 20px 48px;
}

.account-band {
  min-height: 62px;
  border-color: var(--ui-border);
}

.identity span,
.identity em {
  color: var(--ui-text-muted);
}

.identity strong {
  color: var(--ui-text);
  font-size: 17px;
  font-weight: 750;
}

.status-badge {
  color: var(--ui-success);
  background: var(--ui-success-soft);
  border-color: var(--ui-success-border);
}

.status-badge.running {
  color: var(--ui-warning);
  background: var(--ui-warning-soft);
  border-color: var(--ui-warning-border);
}

.status-badge.overdue {
  color: var(--ui-danger-dark);
  background: var(--ui-danger-soft);
  border-color: var(--ui-danger-border);
}

.balance-band {
  margin: 18px 0 24px;
  padding: 20px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-left: 4px solid var(--ui-success);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
}

.balance-band.overdue {
  border-left-color: var(--ui-danger);
}

.balance-band > div:first-child > span,
.balance-details span {
  color: var(--ui-text-muted);
}

.balance-band strong {
  color: var(--ui-success);
  font-size: 32px;
  font-weight: 750;
  font-variant-numeric: tabular-nums;
}

.balance-band.overdue strong {
  color: var(--ui-danger-dark);
}

.balance-details div {
  border-color: var(--ui-border);
}

.section-head h2 {
  color: var(--ui-text);
  font-size: 18px;
  font-weight: 750;
}

.section-head p {
  color: var(--ui-text-muted);
}

.section-actions {
  gap: 8px;
}

.preset-tabs {
  background: var(--ui-surface-muted);
  border-color: var(--ui-border-strong);
  border-radius: var(--ui-control-radius);
}

.preset-tabs button {
  min-width: 68px;
  color: var(--ui-text-muted);
  border-color: var(--ui-border-strong);
  font-size: 12px;
}

.preset-tabs button:hover {
  color: var(--ui-text);
  background: var(--ui-surface-subtle);
}

.preset-tabs button.active {
  color: var(--ui-primary-active);
  background: var(--ui-surface);
  box-shadow: inset 0 -2px 0 var(--ui-primary);
}

.date-filter {
  background: var(--ui-surface);
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
}

.table-wrap {
  max-width: 100%;
  overflow: auto;
  background: var(--ui-surface);
  border-color: var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
  -webkit-overflow-scrolling: touch;
}

.table-wrap table {
  min-width: 1050px;
  border-collapse: separate;
  border-spacing: 0;
}

.table-wrap th,
.table-wrap td {
  padding: 11px 12px;
  border-color: var(--ui-border);
  font-size: 12px;
  line-height: 1.45;
}

.table-wrap th {
  color: var(--ui-text-secondary);
  background: var(--ui-surface-subtle);
  font-weight: 700;
}

.table-wrap tbody tr:hover td {
  background: var(--ui-surface-subtle);
}

.record-running {
  background: var(--ui-warning-soft);
}

.record-card {
  padding: 14px;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--ui-radius);
  box-shadow: var(--ui-shadow);
}

.record-card.running {
  background: var(--ui-warning-soft);
  border-color: var(--ui-warning-border);
}

.record-card-title,
.record-grid b {
  color: var(--ui-text);
}

.record-card-time,
.record-grid span,
.record-note {
  color: var(--ui-text-muted);
}

.record-note {
  border-color: var(--ui-border);
}

.records-section > .loading,
.records-section > .empty-state {
  margin-top: 16px;
}

/* Desktop refinements */
@media (min-width: 1600px) {
  .main-content {
    padding-right: 32px;
    padding-left: 32px;
  }

  .topbar {
    margin-right: -32px;
    margin-left: -32px;
    padding-right: 32px;
    padding-left: 32px;
  }

  .dashboard-card {
    min-height: 116px;
  }
}

@media (min-width: 921px) {
  #menuBtn {
    display: none;
  }

  .sidebar {
    transform: none !important;
  }

  .mobile-only,
  .mobile-brand,
  .mobile-bottom-nav {
    display: none !important;
  }

  .desktop-only {
    display: block !important;
  }
}

@media (min-width: 921px) and (max-width: 1200px) {
  .topbar {
    flex-wrap: wrap;
  }

  .attendance-topbar {
    order: 4;
    width: 100%;
    padding-top: 9px;
    border-top: 1px solid var(--ui-border);
  }

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

/* Tablet and mobile admin shell */
@media (max-width: 920px) {
  .desktop-only {
    display: none !important;
  }

  .mobile-only {
    display: block;
  }

  .sidebar {
    width: min(82vw, 288px);
    padding-top: calc(env(safe-area-inset-top, 0px) + 16px);
    transform: translateX(-100%);
    transition: transform 160ms ease;
  }

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

  .mobile-sidebar-open::after {
    z-index: 35;
    background: rgba(17, 24, 39, 0.5);
  }

  .main-content {
    margin-left: 0;
    padding: 0 14px calc(92px + env(safe-area-inset-bottom, 0px));
  }

  .topbar {
    margin: 0 -14px 18px;
    padding: calc(8px + env(safe-area-inset-top, 0px)) 14px 10px;
    flex-wrap: wrap;
    background: var(--ui-surface);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  #menuBtn {
    display: inline-flex;
  }

  .mobile-brand {
    min-width: 0;
    display: block;
  }

  .mobile-brand-title {
    overflow: hidden;
    color: var(--ui-text);
    font-size: 15px;
    font-weight: 750;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .mobile-brand-sub {
    color: var(--ui-text-muted);
    font-size: 10px;
  }

  .role-badge {
    display: none;
  }

  .attendance-topbar {
    order: 5;
    width: 100%;
    padding: 9px 0 2px;
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 6px;
    overflow-x: visible;
    border-top: 1px solid var(--ui-border);
    scrollbar-width: none;
    overscroll-behavior-x: contain;
  }

  .attendance-topbar::-webkit-scrollbar {
    display: none;
  }

  .attendance-topbar > * {
    flex: 0 0 auto;
  }

  .attendance-topbar .attendance-status {
    width: 100%;
    flex: 1 1 100%;
  }

  .attendance-topbar .btn {
    flex: 1 1 90px;
  }

  .page-head {
    flex-direction: column;
    gap: 12px;
  }

  .page-head-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .page-head-actions .btn {
    flex: 1 1 120px;
  }

  .role-scope-panel {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .scope-tags {
    justify-content: flex-start;
  }

  .summary-strip,
  .summary-grid,
  .summary-grid.four,
  .summary-grid.five,
  .worklog-summary-grid,
  .worklog-summary-grid.six {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

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

  .list-toolbar {
    display: block;
  }

  .toolbar-main,
  .mobile-app-toolbar,
  .team-search-toolbar {
    display: grid !important;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .toolbar-main .input,
  .mobile-app-toolbar .stretch,
  .team-search-toolbar .stretch {
    width: 100%;
    min-width: 0;
    grid-column: 1 / -1;
  }

  .toolbar-main .btn,
  .mobile-app-toolbar .btn,
  .team-search-toolbar .btn,
  .mobile-app-toolbar .select {
    width: 100%;
  }

  .toolbar-meta {
    margin-top: 9px;
  }

  .panel {
    border-radius: var(--ui-radius);
  }

  .mobile-bottom-nav {
    position: fixed;
    z-index: 50;
    right: 10px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    left: 10px;
    min-height: 66px;
    padding: 6px;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(0, 1fr));
    gap: 4px;
    background: var(--ui-surface);
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    box-shadow: 0 8px 24px rgba(17, 24, 39, 0.14);
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  .bottom-nav-item {
    min-width: 0;
    min-height: 52px;
    padding: 5px 3px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--ui-text-muted);
    background: transparent;
    border: 0;
    border-radius: var(--ui-control-radius);
    font-size: 10px;
    font-weight: 700;
  }

  .bottom-nav-item span {
    font-size: 16px;
    line-height: 1;
  }

  .bottom-nav-item b {
    max-width: 100%;
    overflow: hidden;
    font-size: 10px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .bottom-nav-item.active {
    color: var(--ui-primary-active);
    background: var(--ui-primary-soft);
  }

  .bottom-nav-item:focus-visible {
    outline-offset: -2px;
  }

  .modal.worklog-modal {
    width: 100%;
    max-width: none;
    height: 100dvh;
    max-height: none;
    border: 0;
    border-radius: 0;
  }

  .modal.worklog-modal .worklog-page {
    height: 100dvh;
    max-height: none;
  }

  .worklog-page {
    padding: 16px 14px 24px;
  }

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

@media (max-width: 768px) {
  .header-inner {
    min-height: 58px;
    padding: 7px 14px;
  }

  .content {
    padding: 14px 12px calc(38px + env(safe-area-inset-bottom, 0px));
  }

  .balance-band {
    margin: 12px 0 20px;
    padding: 16px;
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .balance-band strong {
    font-size: 28px;
  }

  .balance-details {
    padding-top: 12px;
    border-top: 1px solid var(--ui-border);
  }

  .balance-details div {
    padding: 0;
    border-left: 0;
  }

  .preset-tabs {
    width: 100%;
  }

  .preset-tabs button {
    flex: 1 0 25%;
    min-width: 64px;
    padding: 0 8px;
  }

  .date-filter {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 12px;
  }

  .filter-actions {
    grid-column: 1 / -1;
  }

  .filter-actions button {
    flex: 1;
  }

  .table-wrap {
    display: none;
  }

  .record-cards {
    display: block;
  }
}

@media (max-width: 640px) {
  .main-content {
    padding-right: 12px;
    padding-left: 12px;
  }

  .topbar {
    margin-right: -12px;
    margin-left: -12px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .attendance-topbar {
    width: calc(100vw - 24px);
  }

  .page-title {
    font-size: 20px;
  }

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

  .form-item.span-2 {
    grid-column: auto;
  }

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

  .app-action-row.grid4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .app-card-grid.two .metric-box:nth-child(even) {
    padding-left: 10px;
  }

  .app-action-row.grid3 {
    grid-template-columns: 1fr;
  }

  .modal:not(.worklog-modal) {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    max-width: none;
    max-height: 90dvh;
    transform: none;
    border-right: 0;
    border-bottom: 0;
    border-left: 0;
    border-radius: 12px 12px 0 0;
  }

  .modal:not(.worklog-modal) .modal-body {
    max-height: calc(90dvh - 116px);
    padding: 16px;
  }

  .modal-footer {
    padding: 10px 16px calc(10px + env(safe-area-inset-bottom, 0px));
  }

  .modal-footer .btn {
    flex: 1;
  }

  .login-screen {
    padding: 16px;
    justify-content: center;
  }

  .login-card {
    padding: 24px 20px;
  }

  .login-title {
    font-size: 23px;
  }

  .login-panel {
    padding: 24px 20px;
  }

  .login-panel h1 {
    font-size: 21px;
  }

  .section-head {
    align-items: flex-start;
  }

  .section-actions {
    justify-content: flex-end;
  }

  .record-card-head {
    gap: 8px;
  }
}

@media (max-width: 390px) {
  .summary-strip,
  .summary-grid,
  .summary-grid.two,
  .summary-grid.four,
  .summary-grid.five,
  .worklog-summary-grid,
  .worklog-summary-grid.six {
    grid-template-columns: 1fr;
  }

  .toolbar-main,
  .mobile-app-toolbar,
  .team-search-toolbar {
    grid-template-columns: 1fr !important;
  }

  .toolbar-main .input,
  .mobile-app-toolbar .stretch,
  .team-search-toolbar .stretch {
    grid-column: auto;
  }

  .identity {
    display: grid;
    gap: 1px;
  }

  .identity strong,
  .identity em {
    max-width: 58vw;
  }

  .balance-details,
  .record-grid {
    grid-template-columns: 1fr;
  }

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

  .filter-actions {
    grid-column: auto;
  }

  .section-head {
    flex-direction: column;
  }

  .section-actions {
    width: 100%;
  }

  .section-actions .secondary-button {
    flex: 1;
  }

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

  .pager > div {
    width: 100%;
  }

  .pager button {
    flex: 1;
  }
}

@media (max-width: 340px) {
  .main-content,
  .content {
    padding-right: 10px;
    padding-left: 10px;
  }

  .topbar {
    margin-right: -10px;
    margin-left: -10px;
    padding-right: 10px;
    padding-left: 10px;
    overflow-x: clip;
  }

  .attendance-topbar {
    width: calc(100vw - 20px);
  }

  .mobile-brand-sub {
    display: none;
  }

  .logout-btn {
    min-width: 58px;
    padding: 0 10px;
  }

  .balance-band strong {
    font-size: 26px;
  }
}

/* Keep the mobile work-action bar inside the viewport after the compact shell rules. */
@media (max-width: 640px) {
  .topbar-work-actions.attendance-topbar {
    width: calc(100vw - 24px);
    max-width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 6px;
    overflow: hidden;
    white-space: normal;
  }

  .topbar-work-actions.attendance-topbar > * {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    flex: initial;
  }

  .topbar-work-actions.attendance-topbar .attendance-status,
  .topbar-work-actions.attendance-topbar .attendance-live-box {
    grid-column: 1 / -1;
  }

  .topbar-work-actions.attendance-topbar .btn {
    width: 100%;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Cross-viewport layout fixes. */

.topbar > .spacer {
  min-width: 0;
}

.topbar-work-actions {
  min-width: 0;
  flex: 0 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.topbar-work-actions > * {
  flex: 0 0 auto;
}

.topbar-work-actions .attendance-status {
  min-height: 32px;
  padding: 4px 8px;
}

.topbar-work-actions .attendance-live-box {
  min-width: 116px;
  padding: 5px 9px;
}

.topbar-work-actions .attendance-live-time {
  font-size: 17px;
}

.topbar-work-actions .btn {
  min-height: 32px;
  height: 32px;
  padding-right: 9px;
  padding-left: 9px;
  font-size: 12px;
}

.topbar-account-actions {
  min-width: max-content;
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: nowrap;
  white-space: nowrap;
}

.topbar-account-actions > * {
  flex: 0 0 auto;
}

.topbar-account-actions .logout-btn {
  min-width: 58px;
}

.dashboard-grid > *,
.dashboard-card,
.dashboard-card-label,
.dashboard-card-value,
.dashboard-card-note {
  min-width: 0;
  max-width: 100%;
}

.dashboard-card-label,
.dashboard-card-value,
.dashboard-card-note {
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (min-width: 1201px) {
  .topbar {
    flex-wrap: nowrap;
  }

  .topbar-work-actions {
    overflow: visible;
  }
}

@media (max-width: 920px) {

  .topbar-account-actions {
    margin-left: auto;
  }

  .topbar-work-actions {
    flex: 1 1 100%;
    justify-content: flex-start;
  }

  .topbar-work-actions .btn,
  .attendance-topbar .btn {
    width: auto;
    min-width: 86px;
    max-width: none;
    flex: 1 1 90px;
    overflow: visible;
    text-overflow: clip;
    white-space: nowrap;
  }

  #view-staff .app-card-head > .metric-chip {
    display: none;
  }
}

@media (max-width: 640px) {
  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 9px;
  }

  .dashboard-card {
    min-height: 104px;
    padding: 12px;
  }

  .dashboard-card-value {
    font-size: 19px;
    line-height: 1.22;
  }
}

@media (max-width: 390px) {

  .dashboard-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .dashboard-card {
    padding: 11px;
  }

  .dashboard-card-value {
    margin-top: 8px;
    font-size: 18px;
  }

  .dashboard-card-note {
    margin-top: 7px;
    font-size: 10px;
  }
}

@media (max-width: 340px) {

  .dashboard-card {
    padding: 10px;
  }

  .dashboard-card-value {
    font-size: 17px;
  }
}

@media (min-width: 921px) {
  #view-staff .table {
    width: 100%;
    min-width: 1000px;
    table-layout: fixed;
  }

  #view-staff .table th:nth-child(2),
  #view-staff .table td:nth-child(2) {
    display: none;
  }

  #view-staff .table th,
  #view-staff .table td {
    padding-right: 10px;
    padding-left: 10px;
  }

  #view-staff .table th:nth-child(1),
  #view-staff .table td:nth-child(1) {
    width: 14%;
  }

  #view-staff .table th:nth-child(3),
  #view-staff .table td:nth-child(3) {
    width: 15%;
  }

  #view-staff .table th:nth-child(4),
  #view-staff .table td:nth-child(4) {
    width: 8%;
  }

  #view-staff .table th:nth-child(5),
  #view-staff .table td:nth-child(5) {
    width: 11%;
  }

  #view-staff .table th:nth-child(6),
  #view-staff .table td:nth-child(6),
  #view-staff .table th:nth-child(7),
  #view-staff .table td:nth-child(7),
  #view-staff .table th:nth-child(8),
  #view-staff .table td:nth-child(8) {
    width: 10%;
  }

  #view-staff .table th:nth-child(9),
  #view-staff .table td:nth-child(9) {
    width: 22%;
  }

  #view-staff .staff-name-cell,
  #view-staff .staff-name-cell span,
  #view-staff .truncate-cell {
    min-width: 0;
    max-width: 100%;
  }

  #view-staff .staff-name-cell span {
    overflow-wrap: anywhere;
  }

  #view-staff .truncate-cell {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  #view-staff .staff-actions {
    width: 100%;
    max-width: none;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 5px;
    overflow: visible;
  }

  #view-staff .staff-actions .btn-sm {
    width: 100%;
    min-width: 0;
    min-height: 28px;
    height: 28px;
    padding-right: 5px;
    padding-left: 5px;
    overflow: visible;
    white-space: nowrap;
  }
}
