/* MaxCRM — modern, mobile-friendly */

:root {
  --bg: #0f1419;
  --bg-elevated: #1a2332;
  --bg-panel: #162032;
  --border: #2a3a4f;
  --border-focus: #3b82f6;
  --text: #e8eef6;
  --text-muted: #8b9cb3;
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --accent: #10b981;
  --accent-soft: rgba(16, 185, 129, 0.15);
  --danger: #ef4444;
  --danger-hover: #dc2626;
  --warning: #f59e0b;
  --registered: #6366f1;
  --deposit: #10b981;
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --font: "Inter", system-ui, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  min-height: 100vh;
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(59, 130, 246, 0.12), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(16, 185, 129, 0.08), transparent);
}

.app {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem 1rem 3rem;
}

/* Header */
.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.header-brand {
  display: flex;
  align-items: center;
  gap: 0.875rem;
}

.logo {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--accent));
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 700;
  color: #fff;
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
}

.header h1 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 0.1rem;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.stat-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-card.accent {
  border-color: rgba(16, 185, 129, 0.4);
  background: linear-gradient(145deg, var(--bg-elevated), rgba(16, 185, 129, 0.08));
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stat-value {
  font-size: 1.4rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-card.accent .stat-value {
  color: var(--accent);
}

/* Panels */
.panel {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.25rem;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.panel-header h2 {
  font-size: 1.05rem;
  font-weight: 600;
}

.muted {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.panel-header-clients {
  flex-wrap: wrap;
  align-items: flex-start;
}

.panel-header-left {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  min-width: 0;
}

.export-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.btn-export {
  background: rgba(59, 130, 246, 0.12);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.35);
  white-space: nowrap;
}

.btn-export:hover {
  background: rgba(59, 130, 246, 0.22);
  border-color: var(--primary);
  color: #fff;
}

.btn-export:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* Filters */
.filter-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.field label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="search"],
input[type="tel"],
input[type="number"],
input[type="date"],
input[type="datetime-local"],
textarea,
select {
  width: 100%;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-size: 0.9rem;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

input::placeholder {
  color: #5a6b80;
}

select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%238b9cb3' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10l-5 5z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

.checkbox-field {
  margin-top: 0.25rem;
}

.checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--text);
  cursor: pointer;
}

.checkbox-label input {
  width: 1.1rem;
  height: 1.1rem;
  accent-color: var(--primary);
}

.initial-deposit-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem;
  padding: 0.75rem;
  margin-top: 0.5rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1rem;
  border-radius: var(--radius-sm);
  border: none;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s, box-shadow 0.15s;
  white-space: nowrap;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.btn-ghost:hover {
  background: var(--bg-elevated);
  color: var(--text);
}

.btn-danger {
  background: var(--danger);
  color: #fff;
}

.btn-danger:hover {
  background: var(--danger-hover);
}

.btn-sm {
  padding: 0.35rem 0.7rem;
  font-size: 0.8rem;
}

.btn-icon {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0.15rem 0.4rem;
  border-radius: 6px;
}

.btn-icon:hover {
  background: var(--bg);
  color: var(--text);
}

.btn-action {
  padding: 0.3rem 0.55rem;
  font-size: 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
}

.btn-action:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.btn-action.danger:hover {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-action.success:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* Table */
.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 -0.25rem;
  padding: 0 0.25rem;
}

.clients-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  min-width: 720px;
}

.clients-table th {
  text-align: left;
  padding: 0.65rem 0.75rem;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
}

.clients-table td {
  padding: 0.75rem;
  border-bottom: 1px solid rgba(42, 58, 79, 0.6);
  vertical-align: middle;
}

.clients-table tbody tr:hover {
  background: rgba(59, 130, 246, 0.06);
}

.username-cell {
  font-weight: 600;
  color: var(--text);
}

.phone-cell {
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 600;
}

.badge-registered {
  background: rgba(99, 102, 241, 0.2);
  color: #a5b4fc;
}

.badge-source {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
}

.badge-deposit {
  background: var(--accent-soft);
  color: #6ee7b7;
}

.actions-cell {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.empty-state {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--text-muted);
}

.hidden {
  display: none !important;
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(5, 10, 18, 0.75);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 1.5rem 1rem;
  z-index: 1000;
  overflow-y: auto;
}

.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 440px;
  padding: 1.25rem 1.35rem 1.35rem;
  margin: auto 0;
  animation: modalIn 0.2s ease;
}

.modal-wide {
  max-width: 560px;
}

.modal-sm {
  max-width: 380px;
}

@keyframes modalIn {
  from {
    opacity: 0;
    transform: translateY(-12px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.1rem;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal form .field {
  margin-bottom: 0.9rem;
}

.modal-client-name {
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--accent);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  margin-top: 1.25rem;
}

.confirm-msg {
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* Detail modal */
.detail-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.detail-meta-item {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.65rem 0.8rem;
  border: 1px solid var(--border);
}

.detail-meta-item span {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.detail-meta-item strong {
  font-size: 0.95rem;
}

.history-title {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.65rem;
}

.history-list {
  list-style: none;
  max-height: 280px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  gap: 0.75rem;
}

.history-item:last-child {
  border-bottom: none;
}

.history-amount {
  font-weight: 700;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

.history-date {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.history-empty {
  color: var(--text-muted);
  font-size: 0.9rem;
  padding: 1rem 0;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

/* Toast */
.toast {
  pointer-events: none;
  position: fixed;
  bottom: 1.5rem;
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: var(--text);
  border: 1px solid var(--border);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow);
  z-index: 2000;
  font-size: 0.9rem;
  font-weight: 500;
  animation: toastIn 0.25s ease;
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

/* Responsive */
@media (max-width: 900px) {
  .stats {
    grid-template-columns: repeat(2, 1fr);
  }

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

@media (max-width: 560px) {
  .app {
    padding: 1rem 0.75rem 2.5rem;
  }

  .header h1 {
    font-size: 1.25rem;
  }

  .logo {
    width: 40px;
    height: 40px;
    font-size: 1.15rem;
  }

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

  .stat-value {
    font-size: 1.2rem;
  }

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

  .initial-deposit-fields {
    grid-template-columns: 1fr;
  }

  .detail-meta {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 1rem;
  }

  .header .btn-primary {
    width: 100%;
  }

  .panel-header-clients {
    flex-direction: column;
    align-items: stretch;
  }

  .export-actions {
    width: 100%;
  }

  .export-actions .btn-export {
    flex: 1 1 calc(50% - 0.25rem);
    justify-content: center;
    text-align: center;
  }
}

/* ─── Auth / Login ─────────────────────────────────────── */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.25rem;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.75rem 1.5rem;
  box-shadow: var(--shadow);
}

.login-brand {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-brand .logo {
  margin: 0 auto 0.75rem;
}

.login-hint {
  margin-top: 1.25rem;
  padding: 0.85rem 1rem;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.login-hint strong {
  display: block;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.login-hint code {
  background: var(--bg);
  padding: 0.1rem 0.4rem;
  border-radius: 4px;
  color: #93c5fd;
  font-size: 0.9rem;
}

.sync-note {
  margin-top: 0.65rem;
  font-size: 0.78rem;
}

.login-error {
  color: #fca5a5;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  margin-bottom: 0.75rem;
}

.btn-block {
  width: 100%;
  margin-top: 0.25rem;
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  justify-content: flex-end;
}

.user-chip {
  font-size: 0.8rem;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.3rem 0.75rem;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-chip strong {
  color: var(--text);
}

/* Admin panel */
.admin-modal {
  max-width: 960px;
}

.admin-sync-note {
  margin-bottom: 1rem;
  font-size: 0.8rem;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(180px, 280px) 1fr;
  gap: 1.25rem;
  align-items: start;
}

.admin-list-pane,
.admin-form-pane {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.85rem;
}

.admin-form-pane h4,
.admin-list-pane h4 {
  font-size: 0.95rem;
  margin-bottom: 0.5rem;
}

.agent-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  max-height: 420px;
  overflow: auto;
}

.agent-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.55rem 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  cursor: pointer;
  text-align: left;
  width: 100%;
  font-family: inherit;
  color: var(--text);
}

.agent-list-item:hover,
.agent-list-item.active {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.12);
}

.agent-list-item .agent-meta {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.agent-list-item .agent-name {
  font-weight: 600;
  font-size: 0.9rem;
}

.agent-list-item .agent-status {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.agent-list-item .agent-status.off {
  color: #fca5a5;
}

.perm-section {
  margin-top: 1rem;
}

.perm-section h5 {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  font-weight: 600;
}

.perm-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.35rem 0.75rem;
}

.perm-grid .checkbox-label {
  font-size: 0.82rem;
}

.masked {
  letter-spacing: 0.08em;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }

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

@media (max-width: 560px) {
  .header-actions {
    width: 100%;
  }

  .header-actions .btn-primary {
    width: 100%;
  }

  .user-chip {
    max-width: 100%;
  }
}


.field-label {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
  display: block;
  margin-bottom: 0.35rem;
}

.field-hint {
  display: block;
  font-size: 0.72rem;
  margin-top: 0.25rem;
}

.radio-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
}

.radio-label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--text);
}

.radio-label input {
  width: 1.05rem;
  height: 1.05rem;
  accent-color: var(--primary);
}


.import-help {
  font-size: 0.82rem;
  margin-bottom: 0.85rem;
  line-height: 1.45;
}

.import-map {
  font-size: 0.82rem;
  margin: 0.75rem 0;
  padding: 0.65rem 0.75rem;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  line-height: 1.45;
}

.import-preview-wrap {
  max-height: 240px;
  margin-bottom: 0.75rem;
}

.import-summary {
  margin: 0.75rem 0;
  padding: 0.75rem;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  line-height: 1.5;
}


.daily-filter-grid {
  margin-bottom: 1rem;
  grid-template-columns: repeat(auto-fill, minmax(170px, 220px));
}

@media (max-width: 560px) {
  .daily-filter-grid,
  .call-filter-grid {
    grid-template-columns: 1fr 1fr;
    gap: 0.6rem;
  }
  .daily-filter-grid .f-wide,
  .call-filter-grid .f-wide {
    grid-column: 1 / -1;
  }
  .daily-filter-grid input[type="date"],
  .call-filter-grid input[type="date"] {
    min-width: 0;
    padding-left: 0.5rem;
    padding-right: 0.4rem;
  }
}

/* Remark */
textarea.remark-input {
  resize: vertical;
  min-height: 4.5rem;
  line-height: 1.4;
}

.field-error {
  color: #f87171;
  font-size: 0.8rem;
  margin-top: 0.3rem;
}

.clients-table td.remark-cell {
  min-width: 140px;
  max-width: 260px;
  white-space: pre-wrap;
  word-break: break-word;
}

.detail-meta-item.detail-remark {
  grid-column: 1 / -1;
}

.detail-meta-item.detail-remark strong {
  font-weight: 500;
  white-space: pre-wrap;
  word-break: break-word;
}

.history-list + .history-title,
.history-empty + .history-title {
  margin-top: 1rem;
}

.daily-history-item {
  flex-direction: column;
  align-items: stretch;
  gap: 0.3rem;
}

.daily-history-top {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-weight: 600;
  font-size: 0.85rem;
}

.daily-history-remark {
  font-size: 0.85rem;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-word;
}

/* Theme toggle */
.theme-toggle {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  padding: 2px;
}

.theme-btn {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.theme-btn:hover {
  color: var(--text);
}

.theme-btn.active {
  background: var(--primary);
  color: #fff;
}

/* ─── Light theme ─────────────────────────────────────── */
html[data-theme="light"] {
  color-scheme: light;
  --bg: #f3f6fb;
  --bg-elevated: #ffffff;
  --bg-panel: #ffffff;
  --border: #d9e0ea;
  --border-focus: #2563eb;
  --text: #0f172a;
  --text-muted: #5b6b80;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --accent: #059669;
  --accent-soft: rgba(5, 150, 105, 0.12);
  --danger: #dc2626;
  --danger-hover: #b91c1c;
  --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

html[data-theme="dark"] {
  color-scheme: dark;
}

html[data-theme="light"] body {
  background-image:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(37, 99, 235, 0.08), transparent),
    radial-gradient(ellipse 60% 40% at 90% 10%, rgba(5, 150, 105, 0.06), transparent);
}

html[data-theme="light"] .logo {
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.25);
}

html[data-theme="light"] .btn-export {
  background: rgba(37, 99, 235, 0.08);
  color: #1d4ed8;
  border-color: rgba(37, 99, 235, 0.3);
}

html[data-theme="light"] .btn-export:hover {
  background: var(--primary);
  color: #fff;
}

html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder {
  color: #94a3b8;
}

html[data-theme="light"] .clients-table td {
  border-bottom-color: #e6ebf2;
}

html[data-theme="light"] .clients-table tbody tr:hover {
  background: rgba(37, 99, 235, 0.04);
}

html[data-theme="light"] .badge-registered {
  background: rgba(99, 102, 241, 0.12);
  color: #4338ca;
}

html[data-theme="light"] .badge-source {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

html[data-theme="light"] .badge-deposit {
  color: #047857;
}

html[data-theme="light"] .modal-overlay {
  background: rgba(15, 23, 42, 0.45);
}

html[data-theme="light"] .toast {
  background: #0f172a;
  color: #f8fafc;
  border-color: #0f172a;
}

html[data-theme="light"] .login-error,
html[data-theme="light"] .agent-list-item .agent-status.off,
html[data-theme="light"] .field-error {
  color: #b91c1c;
}

html[data-theme="light"] .stat-card.accent {
  border-color: rgba(5, 150, 105, 0.35);
  background: linear-gradient(145deg, #ffffff, rgba(5, 150, 105, 0.06));
}

/* Agent view: Daily Entry form inline on the page */
.agent-entry-section {
  margin-bottom: 1rem;
}

.modal.agent-inline {
  max-width: none;
  border: none;
  box-shadow: none;
  padding: 0;
  margin: 0;
  background: transparent;
  animation: none;
}

.modal.agent-inline #btnCloseDailyModal {
  display: none;
}

.agent-role-note {
  margin: 0.5rem 0 0.75rem;
}

.daily-history-agent {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.clients-table td.agent-cell {
  white-space: nowrap;
  font-weight: 600;
}

/* View tabs */
.view-tabs {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 1rem;
  padding: 0.25rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 999px;
  width: fit-content;
  max-width: 100%;
}

.view-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  padding: 0.45rem 1.1rem;
  border-radius: 999px;
  cursor: pointer;
}

.view-tab.active {
  background: var(--primary);
  color: #fff;
}

/* Calling */
.call-add {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  align-items: center;
  margin-bottom: 1rem;
}

.call-upload {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
}

.call-file-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.call-file-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.call-manual {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 9.5rem));
  gap: 0.5rem;
  align-items: center;
}

.call-manual input,
.call-manual select {
  width: 100%;
  min-width: 0;
}

.call-manual .btn {
  align-self: stretch;
}

.call-filter-grid {
  margin-bottom: 0.75rem;
}

.call-table select,
.call-table input[type="text"] {
  min-width: 9rem;
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
}

.call-table input.call-remark {
  min-width: 12rem;
}

.call-table td {
  vertical-align: middle;
}

.call-table .call-phone a {
  color: var(--primary);
  text-decoration: none;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.call-table .call-when {
  white-space: nowrap;
  color: var(--text-muted);
  font-size: 0.82rem;
}

.call-table tr.call-pending td:first-child {
  box-shadow: inset 3px 0 0 var(--warning);
}

.call-history-row td {
  background: var(--bg);
}

.call-history {
  list-style: none;
  display: grid;
  gap: 0.35rem;
  font-size: 0.82rem;
}

.call-history li {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
}

.call-history .h-when {
  color: var(--text-muted);
  white-space: nowrap;
}

.call-history .h-status {
  font-weight: 600;
}

.call-more {
  display: flex;
  justify-content: center;
  margin-top: 0.75rem;
}

.badge-call {
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .call-manual {
    width: 100%;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .view-tabs {
    width: 100%;
  }
  .view-tab {
    flex: 1;
    padding: 0.45rem 0.4rem;
    font-size: 0.85rem;
    white-space: nowrap;
  }
}

/* Sub tabs (agent: New Entry / My Entries, All / Saved) */
.sub-tabs {
  display: flex;
  gap: 0.3rem;
  padding: 0.2rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  width: fit-content;
  max-width: 100%;
}

#agentDailyTabs {
  position: sticky;
  top: 0.5rem;
  z-index: 50;
  margin-bottom: 0.75rem;
  box-shadow: var(--shadow);
}

.sub-tab {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.4rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
}

.sub-tab.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.sub-tabs-inline {
  margin-left: auto;
}

/* Inline form message above Save */
.form-msg {
  margin: 0.25rem 0 0.5rem;
  padding: 0.55rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-weight: 600;
  color: #f87171;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.form-msg.ok {
  color: var(--accent);
  background: var(--accent-soft);
  border-color: rgba(16, 185, 129, 0.35);
}

html[data-theme="light"] .form-msg:not(.ok) {
  color: #b91c1c;
}

input.input-error,
textarea.input-error,
select.input-error {
  border-color: var(--danger) !important;
}

.clients-table tr.row-new td {
  background: var(--accent-soft);
}

.call-table tr.call-saved td:first-child {
  box-shadow: inset 3px 0 0 var(--accent);
}

/* Daily / calling lists as cards on phones (agent + admin) */
@media (max-width: 640px) {
  #agentDailyTabs {
    width: 100%;
  }
  #agentDailyTabs .sub-tab {
    flex: 1;
  }
  .sub-tabs-inline {
    margin-left: 0;
    width: 100%;
  }
  .sub-tabs-inline .sub-tab {
    flex: 1;
  }
  .daily-table,
  .call-table {
    min-width: 0;
    width: 100%;
  }
  .daily-table thead,
  .call-table thead {
    display: none;
  }
  .daily-table tbody,
  .call-table tbody {
    display: grid;
    gap: 0.6rem;
  }
  .daily-table tr,
  .call-table tr {
    display: block;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.55rem 0.7rem;
    background: var(--bg-elevated);
  }
  .daily-table td,
  .call-table td {
    display: flex;
    gap: 0.75rem;
    justify-content: space-between;
    align-items: center;
    padding: 0.25rem 0;
    border: none;
    max-width: none;
    min-width: 0;
    text-align: right;
    white-space: normal;
    word-break: break-word;
    background: transparent !important;
    box-shadow: none !important;
  }
  .daily-table td::before,
  .call-table td::before {
    content: attr(data-label);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    text-align: left;
    flex-shrink: 0;
  }
  .call-table td[data-label=""]::before {
    content: none;
  }
  .daily-table tr.row-new {
    border-color: var(--accent);
    background: var(--accent-soft);
  }
  .call-table tr.call-pending {
    border-left: 3px solid var(--warning);
  }
  .call-table tr.call-saved {
    border-left: 3px solid var(--accent);
  }
  .call-table select,
  .call-table input[type="text"] {
    min-width: 0;
    width: 62%;
  }
  .call-table td.call-save {
    justify-content: flex-end;
    padding-top: 0.4rem;
  }
  .call-table td.call-save .btn {
    width: 100%;
  }
  #dailySection .table-wrap,
  #callingSection .table-wrap {
    overflow-x: visible;
  }
  .call-table td.actions-cell {
    justify-content: flex-end;
  }
  .call-table tr.call-history-row td {
    display: block;
    text-align: left;
  }
  .daily-table td.remark-cell,
  .call-table td.remark-cell {
    white-space: pre-wrap;
  }
}

/* ─── Show/hide password ─────────────────────────────── */
.pw-wrap {
  position: relative;
  display: block;
}
.pw-wrap input {
  width: 100%;
  padding-right: 46px !important;
}
.pw-toggle {
  position: absolute;
  top: 50%;
  right: 4px;
  transform: translateY(-50%);
  width: 38px;
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  -webkit-tap-highlight-color: transparent;
}
.pw-toggle:hover,
.pw-toggle.on {
  color: var(--primary);
}
.pw-toggle:focus-visible {
  outline: 2px solid var(--border-focus);
}
input::-ms-reveal { display: none; }

/* ─── Calling sheets ─────────────────────────────────── */
.call-sheets {
  margin-bottom: 1rem;
}
.call-sheets-head {
  font-size: 0.85rem;
  font-weight: 700;
  margin-bottom: 0.4rem;
}
#callSheetList {
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.call-sheet-day {
  grid-column: 1 / -1;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-top: 0.35rem;
}
.call-sheet {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  text-align: left;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.call-sheet.is-done {
  border-left-color: var(--accent);
}
.call-sheet:hover,
.call-sheet:focus-visible {
  border-color: var(--primary);
  outline: none;
}
.cs-main {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 0;
  flex: 1;
}
.cs-name {
  font-weight: 600;
  font-size: 0.9rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.cs-meta {
  font-size: 0.78rem;
}
.cs-side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.3rem;
  flex-shrink: 0;
}
.cs-count {
  font-size: 0.8rem;
  font-weight: 700;
  white-space: nowrap;
}
.cs-bar {
  display: block;
  width: 64px;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  overflow: hidden;
}
.cs-bar i {
  display: block;
  height: 100%;
  background: var(--accent);
}
.call-sheet-bar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.9rem;
  padding: 0.55rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  min-width: 0;
}
.call-sheet-bar .btn {
  flex-shrink: 0;
}
.call-sheet-bar-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.call-sheet-bar-info strong {
  font-size: 0.92rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.call-sheet-bar-info .muted {
  font-size: 0.78rem;
}
@media (max-width: 640px) {
  #callSheetList {
    grid-template-columns: 1fr;
  }
}

/* ─── Follow-up ──────────────────────────────────────── */
.fu-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
}
.fu-row input,
.fu-row select {
  min-width: 0;
  width: 100%;
}
.call-fu-btn {
  white-space: nowrap;
}
.call-fu-btn.has-fu {
  color: var(--primary);
  border-color: rgba(59, 130, 246, 0.45);
  font-weight: 600;
}
.call-fu-edit {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.4rem;
  margin-top: 0.4rem;
  min-width: 15rem;
}
.call-fu-edit.hidden {
  display: none;
}
.call-fu-edit input,
.call-table .call-fu-edit select {
  min-width: 0;
  width: 100%;
  font-size: 0.85rem;
}
.call-fu-err {
  grid-column: 1 / -1;
  margin: 0;
}
.call-history .h-fu {
  font-size: 0.8rem;
}
.follow-table .fu-when {
  white-space: nowrap;
  font-weight: 600;
}
@media (max-width: 640px) {
  .call-table td.call-fu {
    flex-wrap: wrap;
  }
  .call-table td.call-fu .call-fu-edit {
    flex-basis: 100%;
    min-width: 0;
  }
  .call-table .call-fu-edit select,
  .call-table .call-fu-edit input {
    width: 100%;
  }
  .follow-table .fu-when {
    white-space: normal;
  }
}

/* ─── Masters ────────────────────────────────────────── */
.master-form {
  display: grid;
  gap: 0.75rem;
  max-width: 26rem;
  margin-bottom: 1.1rem;
}
.master-form .form-msg {
  margin: 0;
}
.master-form .btn {
  justify-self: start;
}
.master-list {
  list-style: none;
  display: grid;
  gap: 0.45rem;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}
.master-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--primary);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}
.master-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}
.master-name,
.master-user {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.master-name {
  font-weight: 600;
  font-size: 0.92rem;
}
.master-item .btn-action {
  flex-shrink: 0;
}
#mastersSection .empty-state {
  padding: 1.25rem 0 0.5rem;
}
@media (max-width: 640px) {
  .master-form {
    max-width: none;
  }
  .master-form .btn {
    justify-self: stretch;
  }
  .master-list {
    grid-template-columns: 1fr;
  }
}
.call-table td.call-master-cell select {
  min-width: 11.5rem;
}
.clients-table td[data-col="master"] {
  white-space: nowrap;
}
@media (max-width: 640px) {
  .call-table td.call-master-cell select {
    min-width: 0;
  }
}

/* ─── Admin Follow-ups: per-agent counts ─────────────── */
.fu-agent-counts {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0 0 0.85rem;
}
.fu-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  max-width: 100%;
  min-width: 0;
  padding: 0.3rem 0.35rem 0.3rem 0.7rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg-elevated);
  color: var(--text);
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.fu-chip:hover,
.fu-chip:focus-visible {
  border-color: var(--primary);
}
.fu-chip-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.fu-chip-count {
  min-width: 1.5rem;
  padding: 0.05rem 0.45rem;
  border-radius: 999px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
  font-size: 0.78rem;
  text-align: center;
}
.fu-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
}
.fu-chip.active .fu-chip-count {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

/* ─── Tab labels: full on wide screens, short on phones ─ */
.view-tab .tab-short {
  display: none;
}

/* ─── Unsuccessful withdrawals ───────────────────────── */
.wd-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  max-width: 40rem;
  margin-bottom: 1.1rem;
}
.wd-form .field {
  min-width: 0;
}
.wd-form .form-msg {
  grid-column: 1 / -1;
  margin: 0;
}
.wd-form .btn {
  justify-self: start;
}
.wd-form select:disabled {
  opacity: 0.7;
  cursor: not-allowed;
}
.wd-sub-tabs {
  margin-bottom: 0.9rem;
}
.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  white-space: nowrap;
}
html[data-theme="light"] .badge-pending {
  color: #b45309;
}
.wd-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
  gap: 0.6rem;
}
.wd-card {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  min-width: 0;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-left: 3px solid var(--warning);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
}
.wd-card.is-solved {
  border-left-color: var(--accent);
}
.wd-card.row-new {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.wd-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.75rem;
  min-width: 0;
}
.wd-uid {
  font-weight: 700;
  overflow-wrap: anywhere;
}
.wd-amt {
  font-weight: 700;
  white-space: nowrap;
  color: var(--accent);
}
.wd-line {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.85rem;
  min-width: 0;
}
.wd-k {
  color: var(--text-muted);
  font-weight: 600;
  flex-shrink: 0;
}
.wd-v {
  text-align: right;
  overflow-wrap: anywhere;
  min-width: 0;
}
.wd-remark .wd-v {
  white-space: pre-wrap;
}
.wd-card .wd-solve {
  align-self: flex-end;
  margin-top: 0.2rem;
}
.wd-table td.wd-amt-cell {
  white-space: nowrap;
  font-weight: 600;
}
@media (max-width: 640px) {
  .view-tabs {
    gap: 0.15rem;
  }
  .view-tab {
    flex: 1 1 auto;
    padding: 0.45rem 0.25rem;
  }
  .view-tab .tab-full {
    display: none;
  }
  .view-tab .tab-short {
    display: inline;
  }
  .wd-form {
    grid-template-columns: minmax(0, 1fr);
  }
  .wd-form .btn {
    justify-self: stretch;
  }
  .wd-sub-tabs {
    width: 100%;
  }
  .wd-sub-tabs .sub-tab {
    flex: 1;
  }
  .wd-list {
    grid-template-columns: minmax(0, 1fr);
  }
  .wd-card .wd-solve {
    align-self: stretch;
  }
  #wdSection .table-wrap {
    overflow-x: visible;
  }
  .wd-table td.actions-cell {
    justify-content: flex-end;
  }
  .wd-table td.actions-cell .btn {
    width: 100%;
  }
}

/* ─── Withdrawal media ───────────────────────────────── */
.wd-media-field {
  grid-column: 1 / -1;
  align-items: flex-start;
}
.field label.wd-media-btn {
  position: relative;
  overflow: hidden;
  cursor: pointer;
  align-self: flex-start;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text);
}
.wd-media-btn input[type="file"] {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
  font-size: 0;
}
.file-offscreen {
  position: fixed;
  left: -9999px;
  top: 0;
  width: 1px;
  height: 1px;
  opacity: 0;
}
.wd-files {
  list-style: none;
  margin: 0.4rem 0 0;
  padding: 0;
  display: grid;
  gap: 0.35rem;
  width: 100%;
}
.wd-file {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.3rem 0.3rem 0.3rem 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  font-size: 0.85rem;
}
.wd-file-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.wd-file-size {
  flex-shrink: 0;
  font-size: 0.78rem;
}
.wd-file-x {
  flex-shrink: 0;
  width: 1.9rem;
  height: 1.9rem;
}
.media-ext {
  flex-shrink: 0;
  padding: 0.05rem 0.35rem;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.15);
  color: var(--primary);
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.media-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  min-width: 0;
}
.wd-card .media-chips {
  margin-top: 0.15rem;
}
.media-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  max-width: 100%;
  min-width: 0;
  padding: 0.25rem 0.55rem 0.25rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 0.8rem;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.media-chip:hover,
.media-chip:focus-visible {
  border-color: var(--primary);
}
.media-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 11rem;
}
.media-add {
  padding: 0.25rem 0.6rem;
}
.wd-table td.media-cell .media-chips {
  max-width: 16rem;
}
.media-modal {
  max-width: 760px;
}
.media-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 8rem;
  margin: 0.5rem 0 0.75rem;
}
.media-stage img {
  display: block;
  max-width: 100%;
  max-height: 70vh;
  border-radius: var(--radius-sm);
  object-fit: contain;
  background: #fff;
}
.media-stage p {
  margin: 0;
}

/* ─── Follow-up done / overdue ───────────────────────── */
.badge-overdue {
  margin-left: 0.4rem;
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  white-space: nowrap;
}
html[data-theme="light"] .badge-overdue {
  color: #b91c1c;
}
.follow-table td.fu-done-at {
  white-space: nowrap;
  font-size: 0.85rem;
}
@media (max-width: 640px) {
  .wd-card .media-chips {
    width: 100%;
  }
  .media-name {
    max-width: 9.5rem;
  }
  .wd-table td.media-cell .media-chips {
    max-width: 70%;
    justify-content: flex-end;
  }
  .follow-table td.fu-act {
    justify-content: flex-end;
    padding-top: 0.4rem;
  }
  .follow-table td.fu-act .btn {
    width: 100%;
  }
  .follow-table td.fu-done-at {
    white-space: normal;
  }
  .follow-table tr.fu-overdue {
    border-left: 3px solid var(--danger);
  }
}

/* ─── 6 view tabs: 2 rows (3 + 3) on narrow phones ───── */
@media (max-width: 560px) {
  .view-tabs {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.2rem;
    border-radius: 16px;
  }
  .view-tab {
    min-width: 0;
    padding: 0.5rem 0.25rem;
    border-radius: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}
.master-btns {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}
.call-assign {
  display: grid;
  gap: 0.6rem;
}
.call-assign-head {
  font-weight: 600;
  font-size: 0.92rem;
}
.assign-tag {
  display: block;
  margin-top: 0.15rem;
  font-size: 0.7rem;
  color: var(--primary);
  white-space: nowrap;
}
