:root {
  --staff-indigo: var(--work-action);
  --staff-indigo-dark: var(--action-hover);
  --staff-ink: var(--work-ink);
  --staff-muted: var(--work-muted);
  --staff-canvas: #f5f7fc;
  --staff-surface: #fff;
  --staff-line: var(--work-rule);
  --staff-tint: var(--work-wash);
}

body:has(.app-shell),body:has(.login-shell) {
  color: var(--staff-ink);
  background: var(--staff-canvas);
}

/* Compact staff sign-in */
.login-shell {
  min-height: 100dvh;
  grid-template-columns: 1fr;
  place-items: center;
  padding: 96px 24px 48px;
  background: linear-gradient(180deg,#f8f9fd,#f3f5fb);
}

.login-header {
  position: absolute;
  inset: 0 0 auto;
  height: 72px;
  padding: 0 clamp(22px,5vw,72px);
  border-bottom: 1px solid var(--staff-line);
  background: rgba(255,255,255,.84);
  backdrop-filter: blur(14px);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.login-brand {
  color: var(--staff-ink);
  display: flex;
  align-items: center;
  gap: 11px;
  font-weight: 850;
  font-size: 18px;
  text-decoration: none;
  letter-spacing: -.03em;
}

.login-panel {
  width: min(100%,460px);
  min-height: 0;
  padding: 34px 36px 30px;
  border: 1px solid var(--staff-line);
  border-radius: var(--panel-radius);
  background: #fff;
  box-shadow: 0 18px 50px rgba(29,39,73,.09);
}

.login-panel-inner {
  width: 100%;
}

.login-context {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--staff-indigo);
  font-size: 13px;
  font-weight: 780;
}

.login-panel h1 {
  margin: 0;
  color: var(--staff-ink);
  font-size: 30px;
  line-height: 1.15;
  letter-spacing: -.04em;
}

.login-panel .lede {
  margin: 9px 0 27px;
  color: var(--staff-muted);
  font-size: 14px;
}

.login-panel .field>span {
  color: #3b4561;
}

.login-panel .input {
  border-color: #dce1ed;
  background: #fbfcff;
}

.login-panel .input:focus {
  border-color: var(--staff-indigo);
  box-shadow: 0 0 0 3px rgba(81,70,213,.1);
}

.login-submit {
  margin-top: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
}

.login-shell .button-primary {
  background: var(--staff-indigo);
}

.login-shell .button-primary:hover {
  background: var(--staff-indigo-dark);
}

.login-shell .portal-back {
  width: max-content;
  margin: 24px auto 0;
  color: var(--staff-muted);
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  text-decoration: none;
}

.login-shell .portal-back svg {
  transform: rotate(180deg);
}

.language-picker {
  min-height: 38px;
  padding-left: 10px;
  border: 1px solid var(--staff-line);
  border-radius: 10px;
  color: var(--staff-muted);
  background: #fff;
  display: flex;
  align-items: center;
}

.language-picker .select {
  min-height: 36px;
  padding-left: 7px;
  border: 0;
  background-color: transparent;
  box-shadow: none;
}

.demo-box {
  margin-top: 24px;
  padding: 16px;
  border: 1px solid;
  border-radius: 12px;
  border-color: var(--staff-line);
  background: var(--staff-canvas);
}

/* Navigation shell */
.app-shell {
  grid-template-columns: 248px minmax(0,1fr);
  background: var(--staff-canvas);
}

.sidebar {
  padding: 22px 16px 18px;
  color: #fff;
  background: var(--work-ink);
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.top-brand {
  padding: 0 7px;
  font-size: 17px;
}

.sidebar .brand-sign {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  box-shadow: none;
}

.sidebar-label {
  margin: 31px 10px 10px;
  color: #8f99b4;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .1em;
  text-transform: uppercase;
}

.sidebar-close {
  display: none;
  border: 0;
  color: #fff;
  background: transparent;
}

.nav {
  gap: 4px;
}

.nav-button {
  min-height: 45px;
  padding: 10px 11px;
  border-radius: 9px;
  color: #aeb6ca;
  gap: 11px;
  font-size: 14px;
}

.nav-button:hover {
  color: #fff;
  background: rgba(255,255,255,.07);
}

.nav-button.active {
  color: #fff;
  background: var(--staff-indigo);
  box-shadow: none;
}

.nav-icon {
  color: currentColor;
}

.nav-icon svg {
  width: 19px;
  height: 19px;
}

.nav-chevron {
  margin-left: auto;
  opacity: 0;
  display: grid;
}

.nav-button.active .nav-chevron {
  opacity: .8;
}

.user-card {
  padding: 12px;
  border-color: rgba(255,255,255,.1);
  border-radius: 12px;
  background: rgba(255,255,255,.045);
}

.avatar {
  color: #fff;
  background: var(--staff-indigo);
  border-radius: 9px;
}

.user-meta span {
  color: #929cb3;
  text-transform: none;
}

.logout-link {
  padding-top: 11px;
  color: #aeb6ca;
  display: flex;
  align-items: center;
  gap: 8px;
}

.logout-link:hover {
  color: #fff;
}

.topbar {
  min-height: 66px;
  padding: 10px clamp(20px,3.5vw,48px);
  border-color: var(--staff-line);
  background: #fff;
}

.top-actions {
  gap: 10px;
}

.top-actions .language-picker {
  background: var(--staff-canvas);
}

.refresh-button {
  gap: 7px;
  color: var(--staff-ink);
  border-color: var(--staff-line);
  background: #fff;
}

.page {
  width: min(100%,1400px);
  padding: 28px clamp(20px,3.5vw,48px) 64px;
}

.page-head {
  margin-bottom: 24px;
  align-items: center;
}

.page-head h1 {
  color: var(--staff-ink);
  font-size: clamp(25px,3vw,34px);
  letter-spacing: -.035em;
}

.page-head p {
  margin-top: 9px;
  color: var(--staff-muted);
}

.workpool-page .page-head {
  margin-bottom: 14px;
}

.workpool-refresh {
  width: 44px;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
}
.workpool-refresh.button-soft,
.staff-dashboard .button-soft {
  color: var(--work-action);
  background: var(--work-wash);
  border-radius: var(--control-radius);
}

.compact-task-list {
  grid-template-columns: 1fr;
  gap: 0;
  border-top: 1px solid var(--staff-line);
  background: #fff;
}

.compact-task-card {
  min-width: 0;
  min-height: 68px;
  padding: 0;
  border: 0;
  border-bottom: 1px solid var(--staff-line);
  border-radius: 0;
  display: grid;
  grid-template-columns: minmax(0,1fr) auto;
  align-items: stretch;
  overflow: hidden;
}

.task-card-detail {
  min-width: 0;
  padding: 8px 12px;
  border: 0;
  color: inherit;
  background: transparent;
  text-align: left;
  cursor: pointer;
  display: grid;
  align-content: center;
  gap: 3px;
}

.task-card-detail:focus-visible { background: var(--work-wash); }
@media (hover: hover) {
  .task-card-detail:hover { background: var(--work-wash); }
}

.task-card-country {
  color: var(--staff-ink);
  font-size: 15px;
  font-weight: 650;
}

.task-card-meta {
  min-width: 0;
  color: var(--staff-muted);
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.task-card-subject {
  color: var(--staff-muted);
  font-size: 11px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-card-heading {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 3px 8px;
  justify-content: space-between;
}

.task-card-heading .money {
  color: var(--staff-indigo);
  font-size: 13px;
  font-weight: 600;
}

.task-card-amount { min-width: 0; display: grid; justify-items: end; line-height: 1.1; }
.task-card-amount small { max-width: 145px; color: var(--staff-muted); font-size: 9px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.task-card-meta .badge {
  min-height: auto;
  padding: 0;
  background: transparent;
  font-size: 11px;
  font-weight: 550;
}

.task-card-meta .badge::before {
  width: 4px;
  height: 4px;
}

.compact-task-card .countdown {
  justify-self: start;
  margin: 0;
  padding: 5px 8px;
  border-radius: 8px;
  white-space: nowrap;
}

.compact-task-card .countdown strong {
  font-size: 14px;
}

.task-card-actions {
  margin: 0 !important;
  padding: 6px 10px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.task-card-actions .button {
  min-height: 44px;
  border-radius: var(--control-radius);
}

.task-card-actions [data-action="claim"] {
  min-width: 72px;
}

.page-actions .button,.staff-dashboard .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.staff-dashboard .button-primary, .workpool-page .button-primary {
  background: var(--work-action);
  border-radius: var(--control-radius);
}
.workpool-page .button-primary { background: var(--pool-action); }

/* Role-specific action queues */
.staff-metrics {
  margin-bottom: 20px;
  grid-template-columns: repeat(3,minmax(0,1fr));
  gap: 0;
  border-block: 1px solid var(--work-rule);
}

.staff-metrics .metric {
  min-height: 104px;
  padding: 16px 18px;
  border: 0;
  border-radius: 0;
  background: var(--staff-surface);
  box-shadow: none;
}

.staff-metrics .metric-label {
  color: var(--staff-muted);
  font-size: 12px;
}

.staff-metrics .metric-value {
  margin-top: auto;
  color: var(--staff-ink);
  font-size: 34px;
}

.staff-metrics .metric + .metric { border-inline-start: 1px solid var(--work-rule); }

.staff-metrics .metric:first-child .metric-value {
  color: var(--staff-indigo);
}
.staff-metrics .metric:first-child .metric-label {
  color: var(--staff-muted);
}

.staff-action-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 12px;
}

.staff-action-grid .staff-focus {
  margin-bottom: 0;
}

.staff-performance table {
  width: 100%;
  text-align: start;
  border-collapse: collapse;
  font-size: 14px;
}
.staff-performance th, .staff-performance td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--work-rule);
  text-align: start;
}
.staff-performance thead th, .performance-label {
  color: var(--work-muted);
  font-size: 12px;
  font-weight: 500;
}
.performance-label { display: none; }
.performance-earnings .money { display: block; }
@media (max-width: 700px) {
  .staff-performance thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
  }
  .staff-performance tbody, .performance-label { display: block; }
  .staff-performance tbody tr {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px 6px;
    padding: 12px;
    border-top: 1px solid var(--work-rule);
  }
  .staff-performance tbody :is(th, td) { padding: 0; border: 0; overflow-wrap: anywhere; }
  .staff-performance tbody th { grid-column: span 2; align-self: center; }
  .staff-performance .performance-earnings { grid-area: 1 / 3 / 2 / 5; text-align: end; }
}

.staff-dashboard .panel {
  border: 0;
  border-radius: 0;
  background: #fff;
  box-shadow: none;
  overflow: hidden;
}

.staff-focus {
  margin-bottom: 12px;
}

.staff-queue-empty {
  min-height: 46px;
  margin: 0;
  padding: 13px 16px;
  color: var(--staff-muted);
  border-top: 1px solid var(--staff-line);
  font-size: 13px;
}

.staff-task-empty {
  margin: 0;
  padding: 12px 16px;
  color: var(--staff-muted);
}

.staff-priority {
  border-top: 2px solid var(--staff-indigo) !important;
}

.staff-dashboard .panel-head {
  min-height: 58px;
  padding: 10px 14px;
  align-items: center;
  border-bottom-color: var(--staff-line);
}
.staff-dashboard .panel-head + .compact-task-list, .staff-dashboard .staff-queue-empty {
  border-top: 0;
}

.panel-heading {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 9px;
}

.panel-heading-icon {
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: var(--control-radius);
  color: var(--staff-indigo);
  background: var(--staff-tint);
  display: grid;
  place-items: center;
}

.panel-heading h2 {
  color: var(--staff-ink);
}

.panel-heading p {
  color: var(--staff-muted);
}

.currency-totals {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  margin-top: 4px;
}

.currency-total {
  color: var(--staff-indigo);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.settlement-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 14px;
  border-top: 1px solid var(--staff-line);
}

.settlement-summary .currency-total {
  padding: 8px 11px;
  border-radius: 9px;
  background: var(--staff-tint);
  font-size: 15px;
}

@media (max-width:800px) {
  .sidebar {
    width: min(86vw,290px);
  }
  .sidebar-close {
    display: grid;
    place-items: center;
  }
  .menu-scrim {
    background: rgba(14,21,43,.5);
  }
  .topbar {
    min-height: 62px;
  }
  .mobile-brand {
    color: var(--staff-ink);
  }
  .mobile-brand .brand-sign {
    width: 30px;
    height: 30px;
  }
  .mobile-menu {
    color: var(--staff-ink);
    border-color: var(--staff-line);
    background: #fff;
  }
  .page {
    padding-top: 26px;
  }
}

@media (max-width:600px) {
  .login-shell {
    padding: 88px 14px 28px;
  }
  .login-header {
    height: 64px;
    padding: 0 16px;
  }
  .login-header .language-picker svg {
    display: none;
  }
  .login-header .language-picker {
    padding-left: 0;
  }
  .login-panel {
    padding: 27px 22px 24px;
    border-radius: var(--panel-radius);
  }
  .login-panel h1 {
    font-size: 27px;
  }
  .staff-metrics {
    grid-template-columns: repeat(3,minmax(0,1fr));
  }
  .page {
    padding: 12px 10px 38px;
  }
  .page-head {
    margin-bottom: 10px;
    flex-direction: row;
    align-items: center;
    gap: 10px;
  }
  .page-head h1 {
    font-size: 22px;
  }
  .page-head p {
    display: none;
  }
  .page-actions {
    width: auto;
    margin-left: auto;
    flex: 0 0 auto;
  }
  .page-actions .workpool-refresh {
    flex: 0 0 44px;
  }
  .compact-task-list {
    gap: 0;
  }
  .compact-task-card {
    min-height: 74px;
  }
  .task-card-detail {
    padding: 8px 10px;
  }
  .task-card-actions {
    padding: 5px 8px;
    justify-content: center;
    flex-direction: column;
  }
  .task-card-actions .button {
    width: 68px;
    min-width: 68px;
    min-height: 44px;
    padding: 6px;
  }
  .staff-dashboard-worker .staff-metrics {
    margin-bottom: 10px;
  }
  .staff-dashboard-worker .staff-metrics .metric {
    min-height: 58px;
    padding: 8px 10px;
  }
  .workpool-page .page-head {
    min-height: 44px;
    margin-bottom: 8px;
  }
  .staff-dashboard-worker .staff-metrics .metric-value {
    font-size: 22px;
  }
  .staff-dashboard-worker .staff-focus {
    margin-bottom: 10px;
  }
  .staff-task-section.panel .panel-head {
    padding: 9px 10px;
    align-items: center;
    flex-direction: row;
  }
  .staff-task-section .panel-heading-icon {
    display: none;
  }
  .staff-task-section.panel .panel-head>.button {
    width: auto;
    min-height: 44px;
  }
  .staff-metrics .metric {
    min-height: 86px;
    padding: 12px;
    overflow-wrap: anywhere;
  }
  .staff-metrics .metric-value {
    font-size: 28px;
  }
  .staff-dashboard .panel-head {
    min-height: 54px;
    align-items: center;
    flex-direction: row;
    padding: 5px 8px 5px 12px;
    gap: 8px;
  }
  .staff-dashboard .panel-head>.button {
    width: auto;
    min-width: 68px;
    min-height: 44px;
    margin-left: auto;
    padding: 6px 9px;
  }
  .staff-dashboard:not(.staff-dashboard-worker) .staff-metrics {
    margin-bottom: 10px;
  }
  .staff-dashboard:not(.staff-dashboard-worker) .staff-metrics .metric {
    min-height: 66px;
    padding: 9px 10px;
  }
  .staff-dashboard:not(.staff-dashboard-worker) .staff-metrics .metric-value {
    font-size: 23px;
  }
  .staff-dashboard:not(.staff-dashboard-worker) .currency-totals {
    display: none;
  }
  .top-actions .language-picker {
    border: 0;
    padding-left: 0;
  }
  .top-actions .language-picker svg {
    display: none;
  }
  .top-actions .compact-select {
    max-width: 112px;
  }
}
.form-notice { grid-column: 1 / -1; margin: 0; padding: 12px 14px; border-radius: 10px; background: var(--surface-2); color: var(--muted); }

/* Admin-only payment configuration */
.payment-settings-page {
  max-width: 980px;
}

.payment-settings-panel {
  padding: clamp(20px,3vw,30px);
}

.payment-settings-form {
  display: grid;
  grid-template-columns: repeat(2,minmax(0,1fr));
  gap: 22px 24px;
}

.payment-settings-form .field small,
.payment-check small {
  color: var(--staff-muted);
  font-size: 12px;
  font-weight: 500;
  line-height: 1.45;
}

.payment-settings-form .field {
  gap: 7px;
}

.payment-check {
  min-height: 74px;
  padding: 14px 16px;
  border: 1px solid var(--staff-line);
  border-radius: 11px;
  background: var(--staff-tint);
  display: flex;
  align-items: flex-start;
  gap: 11px;
  cursor: pointer;
}

.payment-check input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--staff-indigo);
}

.payment-check span {
  display: grid;
  gap: 4px;
}

.payment-settings-form .form-actions {
  grid-column: 1 / -1;
  padding-top: 2px;
}

.payment-callbacks {
  margin-top: 20px;
  padding: clamp(20px,3vw,30px);
}

.payment-url-row {
  padding: 14px 0;
  border-top: 1px solid var(--staff-line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.payment-url-row > div {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.payment-url-row code {
  color: #4c5670;
  font-size: 13px;
  overflow-wrap: anywhere;
}

@media (max-width: 700px) {
  .payment-settings-form { grid-template-columns: 1fr; }
  .payment-settings-form .form-actions { grid-column: auto; }
  .payment-url-row { align-items: flex-start; flex-direction: column; }
}
.country-rules { grid-column: 1 / -1; display: grid; gap: 12px; }
.country-rules > h3 { margin: 0; }
.country-rule { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 11rem), 1fr)); gap: 10px; min-width: 0; margin: 0; padding: 10px 14px 14px; border: 1px solid var(--line); border-radius: 12px; }
.country-rule legend { padding: 0 6px; font-weight: 700; }
.country-rules[hidden], .country-rule[hidden] { display: none; }
.team-filters { padding: 0 20px 20px; display: grid; grid-template-columns: minmax(220px,2fr) repeat(3,minmax(150px,1fr)) auto; align-items: end; gap: 12px; }
.team-filters .field { min-width: 0; gap: 6px; }
.team-filter-actions { display: flex; gap: 8px; white-space: nowrap; }
.team-edit-button { white-space: nowrap; word-break: keep-all; }
.team-person-id { max-width: 28rem; overflow-wrap: anywhere; word-break: break-word; }
@media (max-width: 1050px) { .team-filters { grid-template-columns: repeat(2,minmax(0,1fr)); } .team-filter-actions { grid-column: 1 / -1; } }
@media (max-width: 700px) { .team-filters { padding: 0 10px 12px; grid-template-columns: 1fr; } .team-filter-actions { grid-column: auto; } .team-filter-actions .button { flex: 1 1 0; } .team-table-wrap { max-width: 100%; } .team-directory .data-table { min-width: 760px; } .team-person-id { max-width: 180px; } }
.payout-value { position: relative; min-width: 0; }
.payout-value input { padding-inline-end: 4rem; }
.payout-value [data-country-rule-unit] { position: absolute; inset-inline-end: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

/* Order tables become stacked cards on phones so every row's actions stay
   reachable without horizontal scrolling. Desktop keeps the table. */
@media (max-width: 700px) {
  .order-table-wrap { overflow-x: visible; }
  .order-table { min-width: 0; }
  .order-table thead { display: none; }
  .order-table, .order-table tbody { display: block; }
  .order-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 12px;
    padding: 14px 16px;
    border-top: 1px solid var(--line);
  }
  .order-table tr:hover td { background: none; }
  .order-table td {
    grid-column: 1 / -1;
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    min-width: 0;
    padding: 0;
    border-top: 0;
    text-align: right;
  }
  .order-table td[data-label]::before {
    content: attr(data-label);
    flex: none;
    color: var(--muted);
    font-size: 12px;
    font-weight: 400;
    text-align: left;
  }
  .order-table td .cell-title { font-weight: 600; }
  .order-table .order-cell-id { grid-column: 1; grid-row: 1; display: block; text-align: left; }
  .order-table .order-cell-status { grid-column: 2; grid-row: 1; align-self: start; }
  .order-table .order-cell-actions { display: block; margin-top: 4px; }
  .order-table .order-cell-actions .action-row { display: flex; flex-wrap: wrap; gap: 8px; }
  .order-table .order-cell-actions .button { flex: 1 1 0; min-height: 40px; justify-content: center; }
}

/* Business clock note: every staff time is shown in UTC+7. */
.time-zone-note { display: inline-flex; align-items: center; gap: 6px; padding: 0 4px; color: var(--muted); font-size: 13px; white-space: nowrap; }
.time-zone-note .time-zone-short { display: none; }
@media (max-width: 760px) {
  .time-zone-note { gap: 4px; padding: 0; font-size: 12px; }
  .time-zone-note .time-zone-full { display: none; }
  .time-zone-note .time-zone-short { display: inline; }
}
@media (max-width: 760px) {
  .topbar .mobile-brand > span:not(.brand-sign) { white-space: nowrap; }
}
/* Narrow phones: keep the logo, drop the brand text so the UTC+7 note and
   the language picker fit on one row. */
@media (max-width: 400px) {
  .topbar .mobile-brand > span:not(.brand-sign) { display: none; }
}
