@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500&display=swap');

:root {
  --bg: #ffffff;
  --bg-elevated: #ffffff;
  --bg-subtle: #f8fafc;
  --bg-muted: #f1f5f9;
  --bg-hover: #f1f5f9;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;
  --text: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;
  --navy: #0f172a;
  --navy-mid: #1e293b;
  --navy-soft: #334155;
  --accent: #1e3a5f;
  --accent-hover: #152a45;
  --accent-muted: #e8eef4;
  --accent-border: #c5d0dc;
  --success: #166534;
  --success-bg: #f0fdf4;
  --warning: #92400e;
  --warning-bg: #fffbeb;
  --danger: #991b1b;
  --danger-bg: #fef2f2;
  --sidebar-width: 252px;
  --detail-width: 460px;
  --radius: 6px;
  --radius-md: 8px;
  --radius-lg: 10px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.05);
  --shadow: 0 1px 3px rgba(15, 23, 42, 0.08), 0 4px 12px rgba(15, 23, 42, 0.04);
  --shadow-lg: 0 8px 30px rgba(15, 23, 42, 0.08);
  --transition: 0.18s ease;
}

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

html { -webkit-font-smoothing: antialiased; }

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  font-size: 14px;
  min-height: 100vh;
  overflow-x: hidden;
}

#country-page,
#login-page,
#app-page {
  position: relative;
  z-index: 1;
}

.hidden { display: none !important; }

/* Subtle grid — no color blobs */
.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
}

.ambient-bg::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--border) 1px, transparent 1px),
    linear-gradient(90deg, var(--border) 1px, transparent 1px);
  background-size: 64px 64px;
  opacity: 0.35;
}

/* ─── Country landing ─── */
#country-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2.5rem;
  position: relative;
  z-index: 1;
}

.landing-brand {
  text-align: center;
  margin-bottom: 2.5rem;
}

.landing-brand .logo-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 56px;
  height: 56px;
  border-radius: var(--radius-md);
  background: var(--navy);
  margin-bottom: 1.25rem;
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.02em;
}

#country-page h1 {
  font-size: 2.25rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

#country-page .landing-tagline {
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

#country-page > p:not(.landing-tagline) {
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.country-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(155px, 1fr));
  gap: 0.75rem;
  max-width: 760px;
  width: 100%;
}

.country-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1rem;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  color: var(--navy-mid);
  text-align: center;
  box-shadow: var(--shadow-sm);
}

.country-btn:hover {
  border-color: var(--navy-soft);
  background: var(--bg-subtle);
  color: var(--navy);
}

.country-btn:active {
  background: var(--bg-muted);
}

/* ─── Login ─── */
#login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  position: relative;
  z-index: 1;
}

.login-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow-lg);
}

.login-card .login-logo {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--navy);
  margin-bottom: 0.35rem;
}

.login-card h1 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.2rem;
}

.login-card .subtitle {
  color: var(--text-muted);
  margin-bottom: 1.25rem;
  font-size: 0.875rem;
}

.login-card .country-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  background: var(--accent-muted);
  color: var(--accent);
  padding: 0.35rem 0.85rem;
  border-radius: var(--radius);
  font-size: 0.75rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  border: 1px solid var(--accent-border);
}

.login-card .country-badge::before {
  content: '';
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--accent);
}

.login-hint {
  margin-top: 1.25rem;
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.65;
  padding: 0.85rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.link-muted {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.link-muted:hover { color: var(--navy); }

/* ─── Forms ─── */
.form-group { margin-bottom: 1rem; }

.form-group label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--bg);
  color: var(--text);
  transition: var(--transition);
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--navy-soft);
  box-shadow: 0 0 0 3px rgba(30, 58, 95, 0.12);
}

.form-group input::placeholder { color: var(--text-muted); }

/* ─── Buttons ─── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: var(--transition);
}

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

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

.btn-secondary {
  background: var(--bg);
  color: var(--navy-mid);
  border: 1px solid var(--border-strong);
}

.btn-secondary:hover {
  background: var(--bg-subtle);
  border-color: var(--navy-soft);
}

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

.btn-danger:hover { background: #7f1d1d; }

.btn-sm { padding: 0.4rem 0.75rem; font-size: 0.75rem; }
.btn-block { width: 100%; }

/* ─── App shell ─── */
#app-page {
  display: flex;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
  background: var(--bg-subtle);
  color: var(--text);
  isolation: isolate;
}

.sidebar {
  width: var(--sidebar-width);
  background: var(--navy);
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  z-index: 10;
}

.sidebar-header {
  padding: 1.35rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.sidebar-header .logo {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  color: #fff;
}

.sidebar-header .meta {
  font-size: 0.68rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 0.35rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.sidebar-nav {
  flex: 1;
  padding: 0.75rem 0.65rem;
  overflow-y: auto;
}

.nav-section {
  padding: 1rem 0.75rem 0.35rem;
  font-size: 0.62rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.35);
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.6rem 0.85rem;
  margin: 1px 0;
  border-radius: var(--radius-md);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.72);
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  transition: var(--transition);
}

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

.nav-item.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-weight: 600;
}

.nav-item .badge {
  margin-left: auto;
  background: #fff;
  color: var(--navy);
  font-size: 0.62rem;
  font-weight: 700;
  padding: 0.1rem 0.45rem;
  border-radius: 100px;
  min-width: 18px;
  text-align: center;
}

.sidebar-footer {
  padding: 1.15rem 1.25rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

.sidebar-footer .user-name {
  font-weight: 600;
  font-size: 0.8125rem;
  color: #fff;
}

.sidebar-footer .user-role {
  color: rgba(255, 255, 255, 0.45);
  text-transform: capitalize;
  font-size: 0.72rem;
  margin-top: 0.1rem;
}

.sidebar-footer .btn-secondary {
  background: transparent;
  color: rgba(255, 255, 255, 0.8);
  border-color: rgba(255, 255, 255, 0.2);
}

.sidebar-footer .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

/* ─── Main ─── */
.main-area {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  overflow: hidden;
  background: var(--bg-subtle);
  color: var(--text);
  position: relative;
  z-index: 1;
}

.workspace {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  height: 100%;
}

.workspace-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.5rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  z-index: 2;
}

.topbar h2 {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--navy);
  letter-spacing: -0.01em;
}

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

.content-split {
  display: flex;
  flex: 1;
  min-height: 0;
  min-width: 0;
  overflow: hidden;
  background: var(--bg);
}

.list-panel {
  flex: 1 1 50%;
  min-width: 0;
  max-width: none;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-right: 1px solid var(--border);
}

.list-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.list-body.cards-grid,
.list-body.list-items {
  overflow-y: auto;
}

.list-toolbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.85rem 1.15rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
  flex-shrink: 0;
}

.list-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
  padding: 0.25rem 0.5rem;
  background: var(--bg-muted);
  border-radius: 4px;
  border: 1px solid var(--border);
}

.list-toolbar input {
  flex: 1;
  min-width: 120px;
  padding: 0.5rem 0.85rem 0.5rem 2.25rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8125rem;
  background: var(--bg);
  color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242 1.1a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 0.75rem center;
  transition: var(--transition);
}

.list-toolbar input:focus {
  outline: none;
  border-color: var(--navy-soft);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06);
}

.list-items {
  flex: 1;
  overflow-y: auto;
  scrollbar-width: thin;
}

.list-empty {
  padding: 2rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-align: center;
}

/* ─── Lead list rows ─── */
.list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  padding: 0.85rem 1rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
  position: relative;
  background: var(--bg);
  color: var(--text);
}

.list-item:hover { background: var(--bg-subtle); }

.list-item.selected {
  background: var(--accent-muted);
}

.list-item.selected::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 3px;
  background: var(--navy);
}

.list-item-avatar {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  background: var(--navy);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
}

.list-item.selected .list-item-avatar {
  background: var(--accent);
}

.list-item-body { flex: 1; min-width: 0; }

.list-item-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
}

.list-item .name,
.list-item-name {
  font-weight: 600;
  font-size: 0.875rem;
  color: #0f172a;
  line-height: 1.3;
}

.list-item-value {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-secondary);
  white-space: nowrap;
}

.list-item .sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.45rem;
}

.pill {
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  text-transform: capitalize;
}

.pill-muted {
  background: var(--bg-muted);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.pill.status-new { background: #f1f5f9; color: #475569; }
.pill.status-answered { background: var(--success-bg); color: var(--success); }
.pill.status-opportunity { background: #dbeafe; color: #1d4ed8; }
.pill.status-lost { background: var(--danger-bg); color: var(--danger); }
.pill[class*="status-no_answer"] { background: var(--warning-bg); color: var(--warning); }

/* ─── List Leads: compact rows + status groups ─── */
.list-item-compact {
  align-items: stretch;
  padding: 0.65rem 0.85rem;
  gap: 0.65rem;
  background: #ffffff;
  color: #0f172a;
}

.list-item-compact.checked { background: #f0f9ff; }

.list-check {
  display: flex;
  align-items: center;
  padding: 0.15rem 0.25rem 0 0;
  flex-shrink: 0;
  cursor: pointer;
  position: relative;
  z-index: 3;
}

.list-check input {
  width: 17px;
  height: 17px;
  accent-color: var(--navy);
  cursor: pointer;
  pointer-events: auto;
}

.select-all-label {
  display: flex;
  align-items: center;
  flex-shrink: 0;
  padding-right: 0.25rem;
}

.select-all-label input { width: 16px; height: 16px; accent-color: var(--navy); }

.lead-select-quick {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
}

.btn-xs {
  padding: 0.2rem 0.45rem;
  font-size: 0.68rem;
  line-height: 1.2;
  min-height: 0;
}

.list-item-open { cursor: pointer; flex: 1; min-width: 0; }

.list-item-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
}

.list-item-name {
  flex: 1;
  min-width: 0;
  font-weight: 600;
  font-size: 0.875rem;
  color: #0f172a;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.list-item-icons {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  flex-shrink: 0;
}

.list-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  text-decoration: none;
  transition: var(--transition);
}

.list-icon-btn:hover {
  background: var(--accent-muted);
  color: var(--accent);
  border-color: #93c5fd;
}

.list-icon-phone:hover { color: #16a34a; border-color: #86efac; background: #f0fdf4; }

.list-icon-email:hover { color: var(--accent); border-color: #93c5fd; background: #eff6ff; }

.list-icon-svg {
  width: 14px;
  height: 14px;
  display: block;
}

.list-item-contact {
  font-size: 0.78rem;
  margin-top: 0.2rem;
  line-height: 1.4;
}

.link-call, .link-email {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.link-call:hover, .link-email:hover { text-decoration: underline; }

.contact-muted { color: var(--text-muted); font-style: italic; }

.status-group { border-bottom: 1px solid var(--border); }

.status-group-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--border);
  border-left: none;
  border-right: none;
  border-top: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: filter 0.15s ease;
}

.status-group-header:hover {
  filter: brightness(0.97);
}

.status-group-chevron {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.65;
  transition: transform 0.2s ease;
}

.status-group.collapsed .status-group-chevron {
  transform: rotate(-90deg);
}

.status-group.collapsed .status-group-items {
  display: none;
}

.status-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.status-group-count {
  margin-left: auto;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.1rem 0.45rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.65);
}

.status-group-new .status-group-header { background: #f1f5f9; color: #334155; }
.status-group-new .status-group-dot { background: #64748b; }

.status-group-no_answer .status-group-header { background: #fff7ed; color: #9a3412; }
.status-group-no_answer .status-group-dot { background: #ea580c; }

.status-group-answered .status-group-header { background: #ecfdf5; color: #047857; }
.status-group-answered .status-group-dot { background: #10b981; }

.status-group-opportunity .status-group-header { background: #eff6ff; color: #1d4ed8; }
.status-group-opportunity .status-group-dot { background: #3b82f6; }

.status-group-lost .status-group-header { background: #fef2f2; color: #b91c1c; }
.status-group-lost .status-group-dot { background: #ef4444; }

.status-group-items .list-item:last-child { border-bottom: none; }

.waiting-list-sub,
.waiting-card-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Waiting Dates — grouped by pay urgency */
.waiting-group {
  border-bottom: 1px solid var(--border);
}

.waiting-group:last-child {
  border-bottom: none;
}

.waiting-group-header {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 2;
}

.waiting-group-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.waiting-group--overdue .waiting-group-dot { background: #ef4444; }
.waiting-group--soon .waiting-group-dot { background: #f59e0b; }
.waiting-group--upcoming .waiting-group-dot { background: #3b82f6; }
.waiting-group--looking .waiting-group-dot { background: #eab308; }
.waiting-group--unset .waiting-group-dot { background: #94a3b8; }
.waiting-group--done .waiting-group-dot { background: #10b981; }
.waiting-group--done .waiting-group-header { background: #ecfdf5; }
.waiting-group--cancelled .waiting-group-dot { background: #94a3b8; }
.waiting-group--cancelled .waiting-group-header { background: #f1f5f9; }

.waiting-status-pill {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.12rem 0.4rem;
  border-radius: 4px;
  margin-left: 0.35rem;
  vertical-align: middle;
}

.waiting-status-pill--done {
  background: #d1fae5;
  color: #047857;
  border: 1px solid #6ee7b7;
}

.waiting-status-pill--cancelled {
  background: #f1f5f9;
  color: #64748b;
  border: 1px solid #e2e8f0;
}

.waiting-action-bar {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  padding: 0.85rem 1rem;
  margin: 0 1rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  flex-shrink: 0;
}

.waiting-action-bar--triple {
  grid-template-columns: repeat(3, 1fr);
}

.btn-waiting-done,
.btn-waiting-cancel {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

.btn-waiting-done {
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
  border-color: #6ee7b7;
  color: #065f46;
}

.btn-waiting-done:hover {
  background: #d1fae5;
  box-shadow: var(--shadow-sm);
}

.btn-waiting-cancel {
  background: linear-gradient(135deg, #fff 0%, #fef2f2 100%);
  border-color: #fecaca;
  color: #991b1b;
}

.btn-waiting-cancel:hover {
  background: #fee2e2;
  box-shadow: var(--shadow-sm);
}

.btn-waiting-other {
  background: linear-gradient(135deg, #fffbeb 0%, #fef3c7 100%);
  border-color: #fcd34d;
  color: #92400e;
}

.btn-waiting-other:hover {
  background: #fef3c7;
  box-shadow: var(--shadow-sm);
}

.btn-waiting-other .waiting-action-icon {
  background: #f59e0b;
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
}

.waiting-modal-card--other {
  border-color: #fcd34d;
  background: linear-gradient(180deg, #fffbeb 0%, var(--bg-subtle) 100%);
}

.waiting-complete-value--muted {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.waiting-action-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  font-size: 1.1rem;
  font-weight: 700;
  flex-shrink: 0;
}

.btn-waiting-done .waiting-action-icon {
  background: #10b981;
  color: #fff;
}

.btn-waiting-cancel .waiting-action-icon {
  background: #ef4444;
  color: #fff;
}

.waiting-action-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.waiting-action-text strong {
  font-size: 0.85rem;
}

.waiting-action-text small {
  font-size: 0.68rem;
  opacity: 0.85;
  font-weight: 500;
}

.waiting-closed-banner {
  margin: 0 1rem 0.75rem;
  padding: 0.85rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  flex-shrink: 0;
}

.waiting-closed-banner--done {
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.waiting-closed-banner--cancelled {
  background: #f8fafc;
  border-color: #e2e8f0;
}

.waiting-closed-banner-title {
  display: block;
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--navy);
  margin-bottom: 0.25rem;
}

.waiting-closed-banner-meta {
  display: inline-block;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-right: 0.65rem;
}

.waiting-closed-banner-notes {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.waiting-modal-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
}

.waiting-modal-card--done {
  border-color: #a7f3d0;
  background: linear-gradient(180deg, #f0fdf4 0%, var(--bg-subtle) 100%);
}

.waiting-modal-card--cancel {
  border-color: #fecaca;
  background: linear-gradient(180deg, #fffbfb 0%, var(--bg-subtle) 100%);
}

.waiting-complete-summary {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
  padding: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.waiting-complete-summary-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.waiting-complete-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.waiting-complete-value {
  font-size: 1.35rem;
  font-weight: 700;
  color: #047857;
  font-variant-numeric: tabular-nums;
}

.waiting-amount-input {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  font-family: inherit;
  color: var(--navy);
}

.waiting-partial-panel {
  margin: 0.75rem 0 1rem;
  padding: 0.85rem;
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-md);
}

.waiting-partial-panel.hidden {
  display: none;
}

.waiting-partial-option {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  cursor: pointer;
}

.waiting-partial-option input {
  margin-top: 0.2rem;
  width: 18px;
  height: 18px;
  accent-color: #d97706;
  flex-shrink: 0;
}

.waiting-partial-option-body strong {
  display: block;
  font-size: 0.85rem;
  color: #92400e;
  margin-bottom: 0.2rem;
}

.waiting-partial-option-body p {
  margin: 0;
  font-size: 0.75rem;
  color: #a16207;
  line-height: 1.4;
}

.waiting-partial-math {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.65rem;
  padding-top: 0.65rem;
  border-top: 1px dashed #fcd34d;
  font-size: 0.8rem;
  color: #92400e;
}

.waiting-partial-arrow {
  font-weight: 700;
  color: #d97706;
}

.waiting-group--overdue .waiting-group-header { background: #fef2f2; }
.waiting-group--soon .waiting-group-header { background: #fffbeb; }
.waiting-group--upcoming .waiting-group-header { background: #eff6ff; }
.waiting-group--looking .waiting-group-header { background: #fefce8; }

.waiting-group-titles {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.waiting-group-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--navy);
}

.waiting-group-hint {
  font-size: 0.68rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.waiting-group-count {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-muted);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.1rem 0.45rem;
  flex-shrink: 0;
}

.waiting-group-items {
  display: flex;
  flex-direction: column;
}

.waiting-card {
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  background: var(--bg);
  transition: background 0.12s ease;
  -webkit-tap-highlight-color: transparent;
}

.waiting-card:last-child {
  border-bottom: none;
}

.waiting-card:hover {
  background: var(--bg-subtle);
}

.waiting-card.selected {
  background: #eff6ff;
  box-shadow: inset 3px 0 0 var(--navy);
}

.waiting-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.65rem;
}

.waiting-card-name {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--navy);
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.waiting-card-amount {
  font-weight: 700;
  font-size: 0.88rem;
  color: #047857;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.waiting-card .activity-datetime-grid {
  margin: 0.5rem 0 0;
}

.waiting-list-intro {
  margin: 0;
  padding: 0.45rem 0.85rem 0.5rem;
  font-size: 0.72rem;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.activity-datetime-grid--compact {
  grid-template-columns: 1fr;
  margin: 0.5rem 0 0;
  padding: 0.55rem 0.65rem;
}

.activity-datetime-grid--compact .activity-dt-clock--date {
  font-size: 1.1rem;
}

.activity-dt-clock--date {
  font-family: 'IBM Plex Mono', monospace;
}

.schedule-hero-time--date {
  font-size: 1.75rem;
  letter-spacing: -0.02em;
}

.schedule-hero .activity-dt-relative {
  margin-top: 0.45rem;
}

.schedule-datetime-row--date-only {
  grid-template-columns: 1fr;
}

.schedule-datetime-row.hidden {
  display: none;
}

.waiting-pay-mode-segment {
  flex-shrink: 0;
}

.activity-datetime-grid--single {
  grid-template-columns: 1fr;
}

.waiting-pay-card {
  margin: 0 1rem 0.75rem;
  flex-shrink: 0;
}

.waiting-pay-card--looking {
  opacity: 0.92;
}

.waiting-pay-preview {
  margin-top: 0.5rem;
}

.waiting-pay-preview .activity-datetime-grid {
  margin: 0;
}

.schedule-pay-looking {
  margin-top: 0.75rem;
  padding-top: 0.65rem;
  border-top: 1px solid var(--border);
}

.detail-meta-grid--waiting {
  margin-bottom: 0;
}

.pill-waiting-date {
  background: #dbeafe;
  color: #1d4ed8;
  border: 1px solid #93c5fd;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}

.pill-looking {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fcd34d;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  white-space: nowrap;
}

.waiting-looking-toggle {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  cursor: pointer;
  min-height: 2.25rem;
  padding: 0.35rem 0;
}

.waiting-looking-toggle input {
  width: 16px;
  height: 16px;
  accent-color: var(--navy);
}

.bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  background: var(--navy);
  color: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.bulk-bar.hidden { display: none !important; }

.bulk-count { font-size: 0.75rem; font-weight: 600; margin-right: 0.35rem; }

.bulk-select {
  font-family: inherit;
  font-size: 0.75rem;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid rgba(255, 255, 255, 0.35);
  background-color: #fff;
  color: var(--text);
  color-scheme: light;
}

.bulk-select option,
.bulk-select optgroup {
  background-color: #fff;
  color: var(--text);
}

.bulk-bar .btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.25);
}

.bulk-bar .btn-secondary:hover { background: rgba(255, 255, 255, 0.2); }

.bulk-bar .btn-danger { border: none; }

.btn-ghost { background: transparent !important; }

.field-readonly .readonly-value {
  font-size: 0.875rem;
  color: var(--navy);
  padding: 0.45rem 0;
}

.stat-card-wide { grid-column: span 2; }

.stat-card-full { grid-column: 1 / -1; }

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

/* Lead tags */
.lead-tag {
  display: inline-flex;
  align-items: center;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 0.2rem 0.55rem;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
  flex-shrink: 0;
}

.lead-tag-sm {
  font-size: 0.6rem;
  padding: 0.12rem 0.4rem;
}

.lead-tag--recovery {
  background: #dbeafe;
  color: #1d4ed8;
  border-color: #93c5fd;
}

.lead-tag--investment {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
}

.lead-tag--bank_generation {
  background: #e0f2fe;
  color: #0369a1;
  border-color: #7dd3fc;
}

.lead-tag--other {
  background: #ffedd5;
  color: #c2410c;
  border-color: #fdba74;
}

.detail-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.meta-cell .lost-stage-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid #fecaca;
}

.meta-cell {
  padding: 0.85rem 1rem;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.meta-cell:nth-child(2n) { border-right: none; }
.meta-cell:nth-last-child(-n+2) { border-bottom: none; }

.meta-cell-span {
  grid-column: 1 / -1;
  border-right: none;
  border-bottom: none;
}

.meta-label {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.meta-input,
.meta-select {
  width: 100%;
  font-family: inherit;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.45rem 0.55rem;
  background: var(--bg-subtle);
}

.meta-select {
  appearance: none;
  padding-right: 1.75rem;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6L8 9.5 11.5 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.meta-select option,
.meta-select optgroup,
.lead-tag-select option {
  background-color: #fff;
  color: var(--text);
}

.meta-input:focus,
.meta-select:focus {
  outline: none;
  border-color: var(--navy-soft);
  background: var(--bg);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.06);
}

.meta-readonly {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--navy);
}

.lead-tag-select {
  width: 100%;
  appearance: none;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.4rem 2rem 0.4rem 0.75rem;
  border-radius: 6px;
  border: 1px solid transparent;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%2364748b' viewBox='0 0 16 16'%3E%3Cpath d='M4.5 6L8 9.5 11.5 6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}

.lead-tag-select--recovery { background-color: #dbeafe; color: #1d4ed8; border-color: #93c5fd; }
.lead-tag-select--investment { background-color: #fee2e2; color: #b91c1c; border-color: #fca5a5; }
.lead-tag-select--bank_generation { background-color: #e0f2fe; color: #0369a1; border-color: #7dd3fc; }
.lead-tag-select--other { background-color: #ffedd5; color: #c2410c; border-color: #fdba74; }

.lead-tag-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.list-item-row .lead-tag-sm {
  margin-left: 0.15rem;
}

@media (max-width: 520px) {
  .stat-card-wide { grid-column: span 1; }
  .detail-stats { grid-template-columns: 1fr 1fr; }
}

.btn-call {
  flex-shrink: 0;
  align-self: center;
  background: #16a34a !important;
  color: #fff !important;
  border: none;
  text-decoration: none;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  white-space: nowrap;
}

.btn-call:hover { background: #15803d !important; color: #fff !important; }

.btn-call-footer { text-decoration: none; }

.detail-hero {
  flex-wrap: wrap;
}

/* ─── Detail panel (right) ─── */
.detail-panel {
  flex: 1 1 var(--detail-width);
  width: var(--detail-width);
  min-width: 300px;
  max-width: 480px;
  background: var(--bg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 24px rgba(15, 23, 42, 0.06);
  position: relative;
}

.detail-close-btn {
  display: none;
}

.detail-mobile-bar {
  display: none;
  flex-shrink: 0;
  padding: 0.65rem 0.85rem;
  padding-top: max(0.65rem, env(safe-area-inset-top));
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 20;
}

.detail-mobile-back {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.5rem;
  margin: -0.35rem -0.5rem;
  border: none;
  background: transparent;
  color: var(--navy);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  border-radius: var(--radius-md);
  -webkit-tap-highlight-color: transparent;
}

.detail-mobile-back:hover,
.detail-mobile-back:focus-visible {
  background: var(--bg-subtle);
  outline: none;
}

.detail-mobile-back-icon {
  font-size: 1.15rem;
  line-height: 1;
}

.detail-panel-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 199;
  pointer-events: auto;
}

.detail-panel-backdrop.hidden {
  display: none !important;
}

.detail-panel.empty {
  background: var(--bg-subtle);
}

.detail-view {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
  flex: 1;
}

.detail-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 3rem 2rem;
  height: 100%;
  min-height: 320px;
  color: var(--text-muted);
}

.detail-empty-graphic {
  color: var(--border-strong);
  margin-bottom: 1.25rem;
}

.detail-empty-state h4 {
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 0.5rem;
}

.detail-empty-state p {
  font-size: 0.8125rem;
  line-height: 1.6;
  max-width: 260px;
}

.detail-loading {
  font-size: 0.875rem;
  color: var(--text-muted);
  padding: 2rem;
}

/* Hero */
.detail-hero {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.35rem 1.5rem;
  background: var(--navy);
  color: #fff;
  flex-shrink: 0;
}

.detail-hero-avatar {
  width: 52px;
  height: 52px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.detail-hero-avatar.opp {
  background: rgba(255, 255, 255, 0.12);
}

.detail-hero-info { flex: 1; min-width: 0; }

.detail-hero-name {
  width: 100%;
  font-family: inherit;
  font-size: 1.2rem;
  font-weight: 600;
  color: #fff;
  background: transparent;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 0 0 0.2rem;
  margin-bottom: 0.35rem;
}

.detail-hero-name:focus {
  outline: none;
  border-bottom-color: rgba(255, 255, 255, 0.5);
}

.detail-hero-name::placeholder { color: rgba(255, 255, 255, 0.4); }

.detail-hero-sub {
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.65);
}

/* Stats row */
.detail-stats {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 0;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg);
}

.stat-card {
  padding: 0.85rem 1rem;
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.stat-card:last-child { border-right: none; }

.stat-label {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-input,
.stat-select,
.stat-assign select {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 0.35rem 0.5rem;
  background: var(--bg-subtle);
}

.stat-input:focus,
.stat-select:focus,
.stat-assign select:focus {
  outline: none;
  border-color: var(--navy-soft);
  background: var(--bg);
}

.stat-assign select { font-size: 0.8rem; font-weight: 500; }

/* Scrollable form area */
.detail-scroll {
  flex: 1 1 auto;
  overflow-y: auto;
  min-height: 0;
  padding: 1.25rem 1.5rem 0.5rem;
  background: var(--bg-subtle);
}

.detail-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.detail-section-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.field-grid--stack {
  grid-template-columns: 1fr;
}

.field-full { grid-column: 1 / -1; }

.detail-field label {
  font-size: 0.65rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
  display: block;
  margin-bottom: 0.35rem;
}

.detail-contact-row {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.detail-contact-row input,
.detail-contact-row .readonly-value {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-contact-row .readonly-value a {
  overflow-wrap: anywhere;
  word-break: break-word;
}

.detail-copy-btn {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-subtle);
  color: var(--text-secondary);
  cursor: pointer;
  font-family: inherit;
  transition: var(--transition);
}

.detail-copy-btn:hover {
  background: var(--bg-muted);
  color: var(--navy);
  border-color: var(--border-strong);
}

.detail-copy-svg {
  width: 15px;
  height: 15px;
  display: block;
}

.detail-field input,
.detail-field select,
.detail-field textarea,
.notes-area {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8125rem;
  background: var(--bg);
  color: var(--text);
  transition: var(--transition);
}

.detail-field input:focus,
.detail-field select:focus,
.notes-area:focus {
  outline: none;
  border-color: var(--navy-soft);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.06);
}

.input-readonly {
  background: var(--bg-muted) !important;
  color: var(--text-secondary);
  cursor: not-allowed;
}

.notes-area {
  min-height: 120px;
  resize: vertical;
  line-height: 1.5;
}

.detail-timestamp {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  padding: 0.5rem 0 1rem;
}

/* Footer actions */
.detail-footer {
  display: flex;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  background: var(--bg);
  flex-shrink: 0;
  flex-wrap: wrap;
}

.detail-footer .btn { flex: 1; min-width: 100px; }

.btn-danger.btn-outline {
  background: var(--bg);
  color: var(--danger);
  border: 1px solid var(--danger);
  flex: 0 1 auto;
}

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

.detail-field { margin-bottom: 0; }

/* ─── Opportunities ─── */
.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.75rem;
  padding: 1.15rem;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  background: var(--bg-subtle);
  align-content: start;
}

.opp-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: var(--shadow-sm);
}

.opp-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow);
}

.opp-card.selected {
  border-color: var(--navy-soft);
  background: var(--accent-muted);
  box-shadow: var(--shadow);
}

.opp-card .title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.65rem;
  color: var(--navy);
}

.opp-card .value {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.02em;
}

.opp-card .stage {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-secondary);
  margin-top: 0.65rem;
  text-transform: capitalize;
  border: 1px solid var(--border);
}

/* ─── Opportunities pipeline (Pipedrive-style) ─── */
.pipeline-main {
  overflow: hidden;
  color: #0f172a;
}

.pipeline-page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
  background: #dce3ec;
  overflow: hidden;
  color: #0f172a;
  position: relative;
  z-index: 1;
}

.pipeline-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pipeline-toolbar h2 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0;
}

.pipeline-toolbar-actions {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.pipeline-search {
  min-width: 180px;
  padding: 0.45rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.8125rem;
}

.pipeline-board-wrap {
  flex: 1 1 auto;
  min-height: 400px;
  height: 0;
  overflow-x: auto;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  background: #dce3ec;
}

.pipeline-board {
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  gap: 12px;
  padding: 12px;
  min-height: 400px;
  width: max-content;
  min-width: 100%;
  box-sizing: border-box;
}

.pipeline-col {
  flex: 0 0 272px;
  width: 272px;
  display: flex;
  flex-direction: column;
  min-height: 360px;
  background: #eef2f7;
  border-radius: 10px;
  border: 1px solid #94a3b8;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.12);
}

.pipeline-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.7rem 0.85rem;
  border-radius: 9px 9px 0 0;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  flex-shrink: 0;
  color: #0f172a;
}

.pipeline-col-title {
  line-height: 1.25;
  color: inherit;
}

.pipeline-col-count {
  font-size: 0.65rem;
  font-weight: 700;
  min-width: 1.25rem;
  text-align: center;
  padding: 0.15rem 0.4rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
}

.pipeline-head--interested { background: #e2e8f0; color: #334155; }
.pipeline-head--on_whatsapp { background: #bbf7d0; color: #166534; }
.pipeline-head--evidence_send { background: #fde68a; color: #92400e; }
.pipeline-head--account_created { background: #bae6fd; color: #075985; }
.pipeline-head--contract_signed { background: #ddd6fe; color: #5b21b6; }
.pipeline-head--agreed_for_payment { background: #a7f3d0; color: #047857; }
.pipeline-head--lost { background: #fee2e2; color: #991b1b; }
.pipeline-head--new { background: #f1f5f9; color: #334155; }
.pipeline-head--no_answer { background: #fff7ed; color: #9a3412; }
.pipeline-head--answered { background: #ecfdf5; color: #047857; }
.pipeline-head--opportunity { background: #eff6ff; color: #1d4ed8; }

.pipeline-col[data-status-group="lost"] {
  border-color: #fca5a5;
  background: #fef2f2;
}

.pipeline-col[data-status-group="lost"] .pipeline-col-body {
  background: #fff5f5;
  border-top-color: #fecaca;
}

.pipeline-bulk-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  padding: 0.55rem 1rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.pipeline-bulk-bar.hidden {
  display: none !important;
}

.pipeline-count {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  white-space: nowrap;
}

.pipeline-select-all {
  margin-right: 0.15rem;
}

.lead-pipeline-card {
  position: relative;
  padding-top: 1.85rem;
}

.lead-pipeline-card.checked {
  border-color: #3b82f6;
  background: #f0f9ff;
}

.pipeline-card-check {
  position: absolute;
  top: 0.5rem;
  left: 0.55rem;
  display: flex;
  align-items: center;
  cursor: pointer;
  z-index: 2;
}

.pipeline-card-check input {
  width: 15px;
  height: 15px;
  accent-color: var(--navy);
  cursor: pointer;
}

.pipeline-card-tags {
  margin-bottom: 0.35rem;
}

.pipeline-card-icons {
  display: flex;
  gap: 0.25rem;
  margin-bottom: 0.25rem;
}

.pipeline-card-icons .list-icon-btn {
  width: 26px;
  height: 26px;
}

.stat-card .stat-select,
.stat-card .lead-tag-select {
  width: 100%;
  font-size: 0.8125rem;
}

.stat-tag {
  display: flex;
  align-items: center;
  min-height: 2rem;
}

.pipeline-col[data-stage="lost"] {
  border-color: #fca5a5;
  background: #fef2f2;
}

.pipeline-col[data-stage="lost"] .pipeline-col-body {
  background: #fff5f5;
  border-top-color: #fecaca;
}

.lost-stage-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.4rem 0.65rem;
  border-radius: var(--radius);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.8125rem;
  font-weight: 600;
  border: 1px solid #fecaca;
}

.pipeline-col-body {
  flex: 1;
  min-height: 280px;
  overflow-y: auto;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #ffffff;
  border-radius: 0 0 9px 9px;
  border-top: 1px solid #cbd5e1;
  transition: background 0.15s, box-shadow 0.15s;
}

.pipeline-col-body.drag-over {
  background: #eff6ff;
  box-shadow: inset 0 0 0 2px #3b82f6;
}

.pipeline-drop-hint {
  font-size: 0.72rem;
  color: #64748b;
  text-align: center;
  padding: 1.5rem 0.5rem;
  border: 1px dashed #94a3b8;
  border-radius: 8px;
  margin: 4px 0;
  background: #f8fafc;
}

.pipeline-card {
  background: #ffffff;
  border: 1px solid #94a3b8;
  border-radius: 8px;
  padding: 0.75rem 0.85rem;
  cursor: grab;
  box-shadow: 0 2px 6px rgba(15, 23, 42, 0.14);
  transition: box-shadow 0.15s ease, border-color 0.15s ease;
  color: #0f172a;
  opacity: 1;
  visibility: visible;
}

.pipeline-card:hover {
  border-color: #475569;
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.18);
}

.pipeline-card.selected {
  border-color: var(--navy);
  box-shadow: 0 0 0 2px rgba(15, 23, 42, 0.15);
}

.pipeline-card.dragging {
  opacity: 0.5;
  cursor: grabbing;
}

.pipeline-card-title {
  font-weight: 600;
  font-size: 0.8125rem;
  color: #0f172a;
  line-height: 1.35;
  margin-bottom: 0.35rem;
}

.pipeline-card-value {
  font-size: 0.875rem;
  font-weight: 700;
  color: #0f172a;
}

.pipeline-card-sub {
  font-size: 0.72rem;
  color: #475569;
  margin-top: 0.25rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pipeline-detail-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.35);
  z-index: 500;
}

.pipeline-detail-backdrop.hidden {
  display: none !important;
}

.pipeline-detail {
  position: fixed;
  top: 0;
  right: 0;
  width: min(420px, 100vw);
  height: 100vh;
  background: var(--bg);
  border-left: 1px solid var(--border);
  box-shadow: -8px 0 32px rgba(15, 23, 42, 0.15);
  z-index: 501;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.pipeline-detail.hidden {
  display: none !important;
}

.pipeline-detail .detail-view {
  height: 100%;
  min-width: 0;
}

.pipeline-detail .detail-scroll {
  min-width: 0;
}

.pipeline-detail .detail-section {
  overflow: hidden;
}

.view-toggle {
  display: flex;
  background: var(--bg-muted);
  border-radius: var(--radius-md);
  padding: 2px;
  border: 1px solid var(--border);
}

.view-toggle button {
  padding: 0.4rem 0.85rem;
  border: none;
  background: transparent;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-muted);
  border-radius: 5px;
  transition: var(--transition);
}

.view-toggle button.active {
  background: var(--bg);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

/* ─── Scheduled activities (Notifications) ─── */
.activities-workspace .activities-topbar {
  align-items: flex-start;
}

.topbar-sub {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-weight: 400;
}

.activities-scroll {
  padding: 1rem 1.35rem 2rem;
  overflow-y: auto;
  flex: 1;
}

.activities-empty {
  text-align: center;
  padding: 3rem 1.5rem;
  color: var(--text-muted);
}

.activities-empty-hint {
  margin-top: 0.5rem;
  font-size: 0.85rem;
}

.activity-group {
  margin-bottom: 1.75rem;
}

.activity-group-head {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  margin-bottom: 0.65rem;
  padding: 0.55rem 0.65rem;
  border: none;
  border-bottom: 2px solid var(--border);
  background: var(--bg-subtle);
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: background 0.15s ease;
}

.activity-group-head:hover {
  background: var(--bg-hover);
}

.activity-group-head .status-group-chevron {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.2s ease;
}

.activity-group.collapsed .status-group-chevron {
  transform: rotate(-90deg);
}

.activity-group.collapsed .activity-group-list,
.activity-group.collapsed .activity-group-empty {
  display: none;
}

.activity-group-title {
  flex: 1;
  margin: 0;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy);
}

.activity-group-count {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  flex-shrink: 0;
}

.activity-group--overdue .activity-group-head {
  border-bottom-color: rgba(220, 38, 38, 0.35);
  background: rgba(254, 242, 242, 0.6);
}

.activity-group--today .activity-group-head {
  border-bottom-color: rgba(14, 165, 233, 0.35);
  background: rgba(224, 242, 254, 0.5);
}

.activity-group--done .activity-group-head {
  border-bottom-color: rgba(34, 197, 94, 0.3);
  background: rgba(240, 253, 244, 0.5);
}

.activity-group-empty {
  font-size: 0.8125rem;
  color: var(--text-muted);
  padding: 0.5rem 0;
}

.activity-group--empty .activity-group-empty {
  display: none;
}

.activity-group-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.activities-now-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.35rem 1rem;
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a5f 100%);
  border-radius: var(--radius-md);
  color: #fff;
}

.activities-now-label {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.85;
}

.activities-now-clock {
  font-size: 1.5rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  line-height: 1.2;
}

.activities-now-meta {
  font-size: 0.75rem;
  opacity: 0.9;
  font-family: 'IBM Plex Mono', monospace;
}

.activity-card {
  display: block;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  cursor: pointer;
  transition: var(--transition);
}

.activity-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.activity-card--overdue {
  border-left: 4px solid var(--danger);
  background: var(--danger-bg);
}

.activity-card--done {
  opacity: 0.88;
  cursor: default;
}

.activity-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.activity-card-top-actions {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-shrink: 0;
}

.activity-type-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
}

.activity-type-icon {
  font-size: 0.85rem;
  line-height: 1;
}

.activity-type-badge--call { background: #dcfce7; color: #166534; }
.activity-type-badge--email { background: #dbeafe; color: #1e40af; }
.activity-type-badge--vault_balance { background: #f3e8ff; color: #6b21a8; }
.activity-type-badge--bank_balance { background: #e0f2fe; color: #075985; }
.activity-type-badge--document { background: #ffedd5; color: #9a3412; }

.activity-status-badge {
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
}

.activity-status-badge--overdue { background: var(--danger); color: #fff; }
.activity-status-badge--today { background: #fef3c7; color: #92400e; }
.activity-status-badge--done { background: var(--bg-muted); color: var(--text-muted); }

.activity-task-headline {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--navy);
  margin: 0 0 0.25rem;
  line-height: 1.3;
}

.activity-task-detail {
  font-size: 0.8rem;
  color: var(--text-secondary);
  margin: 0 0 0.75rem;
  line-height: 1.4;
}

.activity-datetime-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
  margin: 0.75rem 0;
  padding: 0.75rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.activity-datetime-col {
  min-width: 0;
}

.activity-datetime-col--client {
  border-left: 1px solid var(--border);
  padding-left: 0.65rem;
}

.activity-datetime-col--unknown {
  padding-left: 0.65rem;
  border-left: 1px dashed var(--border);
}

.activity-dt-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--navy);
  margin-bottom: 0.15rem;
}

.activity-dt-sublabel {
  display: block;
  font-size: 0.65rem;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
  line-height: 1.35;
}

.activity-dt-day {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.1rem;
}

.activity-dt-clock {
  display: block;
  font-size: 1.35rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--navy);
  line-height: 1.2;
}

.activity-dt-full {
  display: block;
  font-size: 0.68rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
  font-family: 'IBM Plex Mono', monospace;
  line-height: 1.35;
}

.activity-dt-relative {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--navy-soft);
  background: var(--accent-muted);
  padding: 0.15rem 0.4rem;
  border-radius: 4px;
}

.activity-dt-relative.is-overdue {
  background: var(--danger-bg);
  color: var(--danger);
}

.activity-dt-unknown {
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.activity-contact-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  align-items: baseline;
  font-size: 0.8125rem;
  margin-top: 0.25rem;
}

.activity-type-pill {
  display: inline-block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  margin-bottom: 0.3rem;
}

.activity-type-pill--call { background: #dcfce7; color: #166534; }
.activity-type-pill--email { background: #dbeafe; color: #1e40af; }
.activity-type-pill--vault_balance { background: #f3e8ff; color: #6b21a8; }
.activity-type-pill--bank_balance { background: #e0f2fe; color: #075985; }
.activity-type-pill--document { background: #ffedd5; color: #9a3412; }

.activity-type-select {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  background: var(--bg);
}

.schedule-when-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.25rem;
}

.schedule-when-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

.schedule-when-title {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--navy);
}

.schedule-tz-segment {
  display: inline-flex;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 2px;
  gap: 2px;
}

.schedule-tz-seg {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.35rem 0.65rem;
  border-radius: 5px;
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.2;
}

.schedule-tz-seg small {
  font-size: 0.6rem;
  font-weight: 500;
  opacity: 0.85;
}

.schedule-tz-seg:has(input:checked) {
  background: var(--bg);
  color: var(--navy);
  box-shadow: var(--shadow-sm);
}

.schedule-tz-seg input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.schedule-tz-seg--off {
  padding: 0.35rem 0.5rem;
  font-size: 0.65rem;
  color: var(--text-muted);
  cursor: default;
}

.schedule-hero {
  text-align: center;
  padding: 0.85rem 0.5rem;
  margin-bottom: 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.schedule-hero-mode {
  display: block;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.schedule-hero-day {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.schedule-hero-time {
  display: block;
  font-size: 2.25rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--navy);
  line-height: 1.1;
  margin: 0.15rem 0;
}

.schedule-hero-full {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
}

.schedule-hero-empty {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.schedule-datetime-row {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 0.65rem;
  margin-bottom: 0.65rem;
}

.schedule-field label {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.schedule-field input[type="date"],
.schedule-field input[type="time"] {
  width: 100%;
  padding: 0.65rem 0.75rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  color: var(--navy);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  background: var(--bg);
}

.schedule-field input:focus {
  outline: none;
  border-color: var(--navy-soft);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.schedule-tz-preview {
  padding: 0.55rem 0.65rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.75rem;
  line-height: 1.5;
}

.schedule-preview-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 0.5rem;
  margin-bottom: 0.25rem;
}

.schedule-preview-row:last-child {
  margin-bottom: 0;
}

.schedule-preview-key {
  font-weight: 700;
  color: var(--navy);
  min-width: 5.5rem;
}

.schedule-tz-preview em {
  font-style: normal;
  color: var(--text-muted);
  font-size: 0.7rem;
}

@media (max-width: 480px) {
  .schedule-datetime-row {
    grid-template-columns: 1fr;
  }
  .schedule-tz-segment {
    width: 100%;
    justify-content: stretch;
  }
  .schedule-tz-seg {
    flex: 1;
  }
  .schedule-hero-time {
    font-size: 1.85rem;
  }
}

.modal:has(.schedule-when-card),
.modal:has(.waiting-pay-card) {
  max-width: 560px;
}

.activity-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0;
  line-height: 1.35;
}

.btn-activity-done {
  flex-shrink: 0;
  background: var(--bg);
  color: var(--navy);
  border: 1px solid var(--border-strong);
  font-size: 0.7rem;
  padding: 0.3rem 0.55rem;
}

.btn-activity-done:hover {
  background: var(--accent-muted);
  border-color: var(--navy-soft);
}

.activity-contact-name {
  font-weight: 600;
  color: var(--text);
}

.activity-reach-sep {
  color: var(--text-muted);
  margin: 0 0.25rem;
}

.activity-agenda-box {
  margin-top: 0.65rem;
  padding: 0.55rem 0.65rem;
  background: var(--bg);
  border: 1px dashed var(--border);
  border-radius: var(--radius);
}

.activity-agenda-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.activity-meta {
  color: var(--text-muted);
  font-size: 0.75rem;
}

.activity-reach {
  font-size: 0.8rem;
  margin-top: 0.25rem;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.activity-agenda {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin: 0;
  line-height: 1.45;
}

.activity-outcome {
  font-size: 0.78rem;
  color: var(--text);
  margin: 0.45rem 0 0;
  padding: 0.5rem 0.65rem;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  line-height: 1.45;
}

.activity-outcome-label {
  display: block;
  font-size: 0.6rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.2rem;
}

.activity-duration {
  font-size: 0.65rem;
  color: var(--text-muted);
}

.activity-group--alerts {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

@media (max-width: 520px) {
  .activity-datetime-grid {
    grid-template-columns: 1fr;
  }
  .activity-datetime-col--client,
  .activity-datetime-col--unknown {
    border-left: none;
    padding-left: 0;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
  }
  .activity-card-top {
    flex-wrap: wrap;
  }
  .activities-now-bar {
    flex-direction: column;
    align-items: flex-start;
  }
}

.modal-lead {
  font-size: 0.875rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.notif-list {
  padding: 1.35rem;
  overflow-y: auto;
  flex: 1;
}

.notif-item {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.1rem 1.15rem;
  margin-bottom: 0.65rem;
  cursor: pointer;
  transition: var(--transition);
}

.notif-item:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.notif-item.unread {
  border-left: 3px solid var(--navy);
  background: var(--accent-muted);
}

.notif-item .title {
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--navy);
}

.notif-item .msg {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin: 0.3rem 0;
  line-height: 1.5;
}

.notif-item .time {
  font-size: 0.7rem;
  color: var(--text-muted);
  font-family: 'IBM Plex Mono', monospace;
}

/* ─── Webhooks ─── */
.webhook-page {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
  background: var(--bg);
}

.webhook-page > p {
  color: var(--text-secondary);
  line-height: 1.6;
  max-width: 680px;
  font-size: 0.875rem;
}

.webhook-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 0.75rem;
}

.webhook-card:hover { border-color: var(--border-strong); }

.webhook-card h4 {
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--navy);
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.webhook-card .url {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: var(--accent);
  word-break: break-all;
  padding: 0.45rem 0.65rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 0.45rem 0;
}

.events-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin: 0.5rem 0;
}

.event-tag {
  font-size: 0.65rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  background: var(--bg-muted);
  border-radius: 4px;
  color: var(--text-secondary);
  font-family: 'IBM Plex Mono', monospace;
  border: 1px solid var(--border);
}

.log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8rem;
  margin-top: 1rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
}

.log-table th,
.log-table td {
  padding: 0.65rem 0.9rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.log-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--bg-subtle);
}

.log-table tr:last-child td { border-bottom: none; }

.mail-error-box,
.mail-setup-alert .mail-error-detail {
  margin-top: 0.65rem;
}

.mail-error-title {
  font-weight: 600;
  color: var(--danger, #b91c1c);
  margin: 0 0 0.5rem;
}

.mail-error-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin: 0.75rem 0 0.35rem;
}

.mail-error-detail {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  line-height: 1.45;
  background: #1e293b;
  color: #f1f5f9;
  padding: 0.75rem 0.9rem;
  border-radius: var(--radius);
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0;
}

.mail-error-hints {
  margin: 0.65rem 0 0 1.1rem;
  padding: 0;
  font-size: 0.82rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.mail-setup-alert .mail-error-detail {
  background: var(--bg-subtle);
  color: var(--navy);
  border: 1px solid var(--border);
}

.titan-preset-btns {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.titan-preset-hint code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8em;
}

.webhook-page h3 {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin: 1.35rem 0 0.75rem;
}

.webhook-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.webhook-tab {
  font-size: 0.8rem;
  font-weight: 500;
  padding: 0.45rem 0.9rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.webhook-tab:hover {
  border-color: var(--border-strong);
  color: var(--navy);
}

.webhook-tab.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.webhook-hero {
  background: linear-gradient(135deg, var(--navy) 0%, #1a3a5c 55%, #0d2840 100%);
  color: #fff;
  border-radius: var(--radius-md);
  padding: 1.5rem 1.75rem;
  margin-bottom: 1.5rem;
}

.webhook-hero h3 {
  margin: 0 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
  text-transform: none;
  letter-spacing: normal;
  color: #fff;
}

.webhook-hero p {
  margin: 0;
  font-size: 0.875rem;
  line-height: 1.55;
  opacity: 0.92;
  max-width: 720px;
}

.webhook-doc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.webhook-doc-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
}

.webhook-doc-card h4 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--navy);
  margin: 0 0 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.webhook-doc-card p {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.5;
  margin: 0 0 0.75rem;
}

.webhook-doc-card .wh-badge {
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
  background: var(--bg-muted);
  color: var(--text-muted);
}

.webhook-code-block {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  line-height: 1.5;
  background: #0f172a;
  color: #e2e8f0;
  border-radius: var(--radius);
  padding: 1rem 1.1rem;
  overflow-x: auto;
  margin: 0.75rem 0;
  white-space: pre-wrap;
  word-break: break-all;
}

.webhook-code-block.light {
  background: var(--bg-subtle);
  color: var(--navy);
  border: 1px solid var(--border);
}

.webhook-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-secondary);
  margin: 1.5rem 0 0.75rem;
}

.webhook-inbound-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.webhook-inbound-card.inactive {
  opacity: 0.65;
}

.webhook-inbound-card h4 {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  color: var(--navy);
  text-transform: capitalize;
}

.webhook-endpoint-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin: 0.65rem 0;
}

.webhook-endpoint-row .url {
  flex: 1;
  min-width: 200px;
  margin: 0;
}

.webhook-token-row {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.5rem;
}

.webhook-token-row code {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--accent);
}

.webhook-event-catalog {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.webhook-event-row {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 0.75rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 0.8rem;
}

.webhook-event-row code {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.72rem;
  color: var(--accent);
}

.webhook-event-row .evt-desc {
  color: var(--text-secondary);
}

@media (max-width: 640px) {
  .webhook-event-row {
    grid-template-columns: 1fr;
  }
}

/* ─── Settings ─── */
.settings-page {
  padding: 1.5rem;
  max-width: 820px;
  overflow-y: auto;
  flex: 1;
  background: var(--bg);
}

.settings-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.35rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow-sm);
}

.settings-section h3 {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  color: var(--navy);
}

.settings-section ul {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  line-height: 1.65;
  padding-left: 1.15rem;
}

.settings-form {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.85rem 1rem;
}

.settings-grid--single {
  grid-template-columns: 1fr;
}

.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 0;
}

.settings-field--full {
  grid-column: 1 / -1;
}

.settings-field label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.settings-field input[type="text"],
.settings-field input[type="email"],
.settings-field input[type="password"] {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--navy);
  background: var(--bg);
}

.settings-field input:focus {
  outline: none;
  border-color: var(--navy-soft);
  box-shadow: 0 0 0 3px rgba(15, 23, 42, 0.08);
}

.settings-masked-pass {
  display: flex;
  align-items: center;
  min-height: 2.35rem;
  padding: 0.55rem 0.75rem;
  font-size: 1.1rem;
  letter-spacing: 0.2em;
  color: var(--navy);
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  user-select: none;
  font-family: 'IBM Plex Mono', monospace;
}

.settings-field-hint {
  margin: 0;
  font-size: 0.72rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.settings-role-line {
  margin: 0.85rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.settings-section-desc {
  margin: -0.35rem 0 0.85rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.settings-section--subtle {
  background: var(--bg-subtle);
}

.settings-section--readonly .readonly-value {
  min-height: 2.35rem;
  padding: 0.55rem 0.65rem;
  background: var(--bg-muted);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  color: var(--navy);
}

.settings-section-lead {
  margin: -0.35rem 0 0.85rem;
}

.settings-section--preferences {
  border-color: var(--navy-soft);
  background: linear-gradient(180deg, #f8fafc 0%, var(--bg) 100%);
}

.settings-preferences-layout {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  align-items: flex-start;
}

.settings-photo-block {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.settings-photo-block > label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.settings-photo-preview {
  width: 112px;
  height: 112px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border);
  background: var(--bg-muted);
  display: flex;
  align-items: center;
  justify-content: center;
}

.settings-photo-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-photo-initials {
  font-size: 2rem;
  font-weight: 700;
  color: var(--navy);
}

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

.settings-field--currency {
  flex: 1;
  min-width: 220px;
}

.settings-field--currency select {
  width: 100%;
  max-width: 320px;
  padding: 0.55rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-family: inherit;
  font-size: 0.875rem;
  color: var(--navy);
  background: var(--bg);
}

.profile-avatar--img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: inherit;
}

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

.settings-section-head h3 {
  margin: 0;
  padding: 0;
  border: none;
}

.settings-country-scopes {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.35rem 0.75rem;
}

.settings-region-grid {
  max-width: 600px;
}

.modal-section-label {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--navy);
  margin: 0.75rem 0 0.25rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.users-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.users-table th,
.users-table td {
  padding: 0.75rem 0.5rem;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.users-table th {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  background: var(--bg-subtle);
}

.users-table-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.admin-users-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}

.admin-users-toolbar input {
  flex: 1;
  min-width: 200px;
  max-width: 320px;
}

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

.admin-users-table .users-table-email {
  max-width: 200px;
  word-break: break-all;
}

.admin-users-table .users-table-countries {
  max-width: 160px;
  font-size: 0.78rem;
}

.users-table-actions {
  white-space: nowrap;
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.users-table-empty {
  text-align: center;
  color: var(--text-muted);
  padding: 1.5rem !important;
}

.admin-user-row-self {
  background: var(--accent-muted, rgba(59, 130, 246, 0.06));
}

.admin-you-badge {
  font-size: 0.62rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--accent, #3b82f6);
  margin-left: 0.25rem;
}

.admin-roles-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.admin-role-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.85rem 1rem;
  background: var(--surface);
}

.admin-role-card p {
  margin: 0.5rem 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.45;
}

.admin-integration-links {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.admin-integrations-section #settings-msgrush-section {
  margin-bottom: 0;
  border: none;
  padding: 0;
  box-shadow: none;
}

.role-badge {
  font-size: 0.62rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.role-admin {
  background: var(--warning-bg);
  color: var(--warning);
  border: 1px solid #fde68a;
}

.role-it {
  background: var(--accent-muted);
  color: var(--accent);
  border: 1px solid var(--accent-border);
}

.role-agent {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bbf7d0;
}

.status-badge { text-transform: capitalize; }

.status-new {
  background: var(--bg-muted);
  color: var(--navy-soft);
  border: 1px solid var(--border);
}

.status-contacted {
  background: var(--warning-bg);
  color: var(--warning);
}

.status-qualified {
  background: var(--success-bg);
  color: var(--success);
}

/* ─── Modal ─── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  width: 90%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal h3 {
  margin-bottom: 1.15rem;
  font-weight: 600;
  font-size: 1rem;
  color: var(--navy);
}

.modal-hint {
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 1rem;
  line-height: 1.5;
}

.required-mark {
  color: var(--danger);
  font-weight: 700;
}

.btn-mark-lost {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid #fecaca;
  font-weight: 600;
}

.btn-mark-lost:hover {
  background: #fee2e2;
  border-color: #f87171;
  color: #991b1b;
}

.lost-reason-banner {
  margin: 0 1.25rem 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--danger-bg);
  border: 1px solid #fecaca;
  border-radius: var(--radius-md);
}

.lost-reason-label {
  display: block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--danger);
  margin-bottom: 0.35rem;
}

.lost-reason-text {
  font-size: 0.875rem;
  color: #7f1d1d;
  line-height: 1.45;
  white-space: pre-wrap;
}

.modal-actions {
  display: flex;
  gap: 0.5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.checkbox-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.checkbox-group label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 500;
  padding: 0.35rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  color: var(--text-secondary);
  background: var(--bg);
}

.checkbox-group label:hover {
  border-color: var(--navy-soft);
  background: var(--bg-subtle);
}

/* ─── Toast ─── */
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--navy);
  color: #fff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.8125rem;
  font-weight: 500;
  z-index: 2000;
  box-shadow: var(--shadow-lg);
  animation: slideIn 0.25s ease;
}

.toast.error {
  background: var(--danger);
}

@keyframes slideIn {
  from { transform: translateY(12px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ─── Soft popup notifications (bottom-right) ─── */
.soft-notify-stack {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 2100;
  display: flex;
  flex-direction: column-reverse;
  gap: 0.65rem;
  max-width: min(360px, calc(100vw - 2rem));
  pointer-events: none;
}

.soft-notify {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.85rem 0.9rem;
  background: rgba(255, 255, 255, 0.97);
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: var(--radius-lg);
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.12), 0 2px 8px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(12px);
  pointer-events: auto;
  opacity: 0;
  transform: translateX(16px) translateY(8px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

.soft-notify--in {
  opacity: 1;
  transform: translateX(0) translateY(0);
}

.soft-notify--out {
  opacity: 0;
  transform: translateX(12px) translateY(4px);
}

.soft-notify--clickable {
  cursor: pointer;
}

.soft-notify--clickable:hover {
  border-color: rgba(14, 165, 233, 0.35);
  box-shadow: 0 10px 36px rgba(14, 165, 233, 0.15);
}

.soft-notify--activity {
  border-left: 3px solid #f59e0b;
}

.soft-notify--mail {
  border-left: 3px solid var(--accent);
}

.soft-notify-icon-wrap {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-subtle);
  color: var(--accent);
}

.soft-notify--activity .soft-notify-icon-wrap {
  background: rgba(245, 158, 11, 0.12);
  color: #d97706;
}

.soft-notify-icon {
  width: 1.15rem;
  height: 1.15rem;
}

.soft-notify-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding-right: 0.25rem;
}

.soft-notify-title {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--navy);
  line-height: 1.3;
}

.soft-notify-message {
  font-size: 0.78rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

.soft-notify-close {
  flex-shrink: 0;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 1.2rem;
  line-height: 1;
  padding: 0 0.15rem;
  cursor: pointer;
  border-radius: var(--radius);
  margin: -0.15rem -0.1rem 0 0;
}

.soft-notify-close:hover {
  color: var(--navy);
  background: var(--bg-hover);
}

@media (max-width: 480px) {
  .soft-notify-stack {
    left: 1rem;
    right: 1rem;
    max-width: none;
  }
}

.full-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
}

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 100px;
}

/* ─── Mobile shell ─── */
.mobile-bar,
.sidebar-backdrop {
  display: none;
}

.mobile-bar {
  align-items: center;
  gap: 0.75rem;
  padding: 0.65rem 1rem;
  padding-top: max(0.65rem, env(safe-area-inset-top));
  background: var(--navy);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  flex-shrink: 0;
  z-index: 50;
}

.mobile-menu-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  margin: -0.35rem 0 -0.35rem -0.35rem;
  border: none;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
}

.mobile-menu-btn:active {
  background: rgba(255, 255, 255, 0.18);
}

.mobile-bar-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.sidebar-open {
  overflow: hidden;
}

/* ─── Tablet (landscape / small laptop) ─── */
@media (max-width: 1100px) {
  .content-split {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }

  .list-panel {
    flex: 0 0 min(40vh, 340px);
    max-width: 100%;
    min-height: 180px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }

  .detail-panel {
    flex: 1 1 auto;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    min-height: 50vh;
    box-shadow: none;
    border-left: none;
  }

  .detail-panel.empty {
    display: none;
  }

  .detail-panel:not(.empty) {
    position: fixed;
    inset: 0;
    z-index: 201;
    min-height: 100dvh;
    min-height: 100vh;
    border: none;
    padding-top: 0;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: none;
  }

  .detail-mobile-bar {
    display: block;
  }

  .detail-panel-backdrop:not(.hidden) {
    display: block;
  }

  .pipeline-detail .detail-mobile-bar {
    display: block;
  }

  .pipeline-col {
    flex: 0 0 248px;
    width: 248px;
  }
}

@media (max-width: 900px) {
  #country-page h1 { font-size: 1.85rem; }

  .country-grid {
    grid-template-columns: repeat(2, 1fr);
    max-width: 100%;
  }

  .topbar {
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.75rem 1rem;
  }

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

  .topbar-actions .btn {
    flex: 1;
    min-width: 0;
  }

  .pipeline-toolbar {
    flex-wrap: wrap;
    padding: 0.65rem 1rem;
  }

  .pipeline-toolbar-actions {
    width: 100%;
    flex-wrap: wrap;
  }

  .pipeline-search {
    flex: 1;
    min-width: 0;
  }

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

  .modal {
    width: 94%;
    max-width: none;
    margin: 0.5rem;
    max-height: calc(100dvh - 1rem);
    max-height: calc(100vh - 1rem);
  }
}

/* ─── Tablet portrait & phone ─── */
@media (max-width: 768px) {
  #app-page {
    flex-direction: column;
    height: 100dvh;
    height: 100vh;
  }

  .mobile-bar {
    display: flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 280;
    background: rgba(15, 23, 42, 0.55);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.22s ease;
  }

  body.sidebar-open .sidebar-backdrop {
    opacity: 1;
    pointer-events: auto;
  }

  body.sidebar-open .sidebar-backdrop.hidden {
    display: block !important;
  }

  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(288px, 88vw);
    max-width: 100%;
    transform: translateX(-105%);
    transition: transform 0.25s ease;
    z-index: 290;
    box-shadow: 8px 0 32px rgba(0, 0, 0, 0.25);
    padding-bottom: env(safe-area-inset-bottom);
  }

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

  .main-area {
    flex: 1;
    min-height: 0;
    width: 100%;
  }

  .workspace {
    height: 100%;
  }

  .list-panel {
    flex: 1 1 auto;
    min-height: 0;
    max-height: none;
  }

  .detail-panel.empty {
    display: none;
  }

  .list-toolbar {
    flex-wrap: wrap;
    padding: 0.65rem 0.85rem;
    gap: 0.5rem;
  }

  .list-toolbar input {
    flex: 1 1 100%;
    min-width: 0;
    order: 2;
  }

  .list-count {
    order: 3;
  }

  .select-all-label {
    order: 1;
  }

  .bulk-bar {
    flex-wrap: wrap;
    gap: 0.4rem;
    padding: 0.65rem 0.85rem;
  }

  .bulk-bar .btn,
  .bulk-bar select {
    flex: 1 1 auto;
    min-height: 40px;
  }

  .list-item {
    padding: 0.85rem 1rem;
    min-height: 52px;
  }

  .list-icon-btn {
    width: 40px;
    height: 40px;
  }

  .nav-item {
    min-height: 44px;
    padding: 0.7rem 1rem;
    font-size: 0.875rem;
  }

  .detail-footer {
    flex-direction: column;
    padding: 0.85rem 1rem;
    padding-bottom: max(0.85rem, env(safe-area-inset-bottom));
    gap: 0.45rem;
  }

  .detail-footer .btn {
    width: 100%;
    min-height: 44px;
    flex: none;
  }

  .detail-hero {
    padding-right: 3rem;
  }

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

  .detail-meta-grid .meta-cell-span {
    grid-column: 1 / -1;
  }

  .pipeline-main {
    height: 100%;
  }

  .pipeline-page {
    height: 100%;
  }

  .pipeline-board-wrap {
    min-height: 0;
    flex: 1;
  }

  .pipeline-col {
    flex: 0 0 min(78vw, 260px);
    width: min(78vw, 260px);
    min-height: 280px;
  }

  .pipeline-detail {
    width: 100%;
    max-width: 100%;
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
  }

  .pipeline-detail-backdrop {
    background: rgba(15, 23, 42, 0.5);
  }

  .activities-now-bar {
    flex-direction: column;
    align-items: flex-start;
  }

  .activity-datetime-grid {
    grid-template-columns: 1fr;
  }

  .activity-datetime-col--client,
  .activity-datetime-col--unknown {
    border-left: none;
    padding-left: 0;
    padding-top: 0.65rem;
    border-top: 1px solid var(--border);
  }

  .activity-card-top {
    flex-wrap: wrap;
  }

  .activity-card-top-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .schedule-when-header {
    flex-direction: column;
    align-items: stretch;
  }

  .schedule-tz-segment {
    width: 100%;
  }

  .schedule-tz-seg {
    flex: 1;
  }

  .schedule-datetime-row {
    grid-template-columns: 1fr;
  }

  .schedule-hero-time {
    font-size: 1.75rem;
  }

  #country-page {
    padding: 1.5rem 1rem;
    padding-top: max(1.5rem, env(safe-area-inset-top));
  }

  .country-grid {
    grid-template-columns: 1fr;
    width: 100%;
    max-width: 360px;
  }

  .country-btn {
    min-height: 48px;
    font-size: 0.95rem;
  }

  #login-page {
    padding: 1rem;
    align-items: flex-start;
    padding-top: max(2rem, env(safe-area-inset-top));
  }

  .login-card {
    width: 100%;
    max-width: 400px;
    margin: 0 auto;
  }

  .modal-overlay {
    align-items: flex-end;
    padding: 0;
  }

  .modal {
    width: 100%;
    max-width: 100%;
    margin: 0;
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    max-height: 92dvh;
    max-height: 92vh;
    padding: 1.25rem 1rem;
    padding-bottom: max(1.25rem, env(safe-area-inset-bottom));
  }

  .modal-actions {
    flex-direction: column-reverse;
    gap: 0.45rem;
  }

  .modal-actions .btn {
    width: 100%;
    min-height: 44px;
  }

  .toast {
    left: 0.75rem;
    right: 0.75rem;
    bottom: max(0.75rem, env(safe-area-inset-bottom));
    max-width: none;
    text-align: center;
  }
}

/* ─── Small phone ─── */
@media (max-width: 480px) {
  .stat-card-wide { grid-column: span 1; }

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

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

  .meta-cell {
    border-right: none;
  }

  .meta-cell:nth-child(2n) {
    border-right: none;
  }

  .detail-field,
  .field-grid {
    grid-template-columns: 1fr !important;
  }

  .field-full {
    grid-column: 1 / -1;
  }

  .topbar h2 {
    font-size: 0.95rem;
  }

  .pipeline-toolbar h2 {
    font-size: 1rem;
  }

  .activity-card {
    padding: 0.85rem;
  }

  .btn-activity-done {
    min-height: 40px;
    padding: 0.45rem 0.65rem;
  }

  .webhook-page {
    padding: 1rem;
  }

  .settings-page {
    padding: 1rem;
  }

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

  .settings-country-scopes {
    grid-template-columns: 1fr;
  }

  .waiting-action-bar,
  .waiting-action-bar--triple {
    grid-template-columns: 1fr;
    margin: 0 0.75rem;
  }

  .waiting-closed-banner {
    margin: 0 0.75rem 0.65rem;
  }
}

/* SMS (MSG Rush) */
.sms-page {
  padding: 1.25rem 1.5rem 2rem;
}

.sms-provider-tag {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  margin-right: 0.5rem;
}

.sms-loading {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.sms-alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
  line-height: 1.45;
}

.sms-alert--warn {
  background: rgba(234, 179, 8, 0.12);
  border: 1px solid rgba(234, 179, 8, 0.35);
  color: var(--text);
}

.sms-alert--error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.sms-alert-hint {
  display: block;
  margin-top: 0.5rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.sms-stats-panel {
  margin-bottom: 1rem;
}

.sms-stats-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.sms-stats-head h3 {
  margin: 0;
}

.sms-stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 0.65rem;
  margin-bottom: 1rem;
}

.sms-stats-by-user h4 {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
}

.sms-stat-user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.82rem;
}

.sms-stat-user-row:last-child {
  border-bottom: none;
}

.sms-stat-user-meta {
  color: var(--text-muted);
  white-space: nowrap;
}

.sms-history-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem 1.25rem;
  margin-bottom: 0.75rem;
}

.sms-filter-label {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.sms-filter-label select {
  min-width: 140px;
  font-size: 0.88rem;
  text-transform: none;
  font-weight: 400;
}

.sms-panel-head h3 {
  margin: 0 0 0.25rem;
}

.sms-history-table-wrap {
  overflow-x: auto;
  margin-top: 0.5rem;
}

.sms-cell-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.sms-col-msg {
  max-width: 220px;
}

.sms-col-to {
  min-width: 130px;
}

.sms-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.sms-stat-card {
  flex: 1;
  min-width: 140px;
  max-width: 220px;
  padding: 1rem 1.15rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.sms-stat-label {
  display: block;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

.sms-stat-value {
  font-size: 1.35rem;
  font-weight: 600;
}

.sms-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 1.15rem 1.25rem;
  margin-bottom: 1.25rem;
}

.sms-panel h3 {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
}

.sms-panel--inline h3 {
  margin-bottom: 0.75rem;
}

.sms-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.sms-field-full {
  grid-column: 1 / -1;
}

.sms-textarea {
  resize: vertical;
  min-height: 4rem;
  font-family: inherit;
}

.sms-form-actions {
  margin-top: 1rem;
  display: flex;
  gap: 0.5rem;
}

.sms-rate-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.sms-rate-row .input {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
}

.sms-rate-result {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.sms-history-table td:nth-child(4) {
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sms-delivery-note {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.45;
}

.sms-status-sent {
  color: var(--success, #16a34a);
  font-weight: 600;
}

.sms-status-failed {
  color: var(--danger, #dc2626);
  font-weight: 600;
}

.sms-operator {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.sms-error-detail {
  display: block;
  font-size: 0.75rem;
  color: var(--danger, #dc2626);
}

@media (max-width: 768px) {
  .sms-page {
    padding: 1rem;
  }

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

/* Mail Inbox */
.mail-main {
  background: var(--bg-subtle);
  padding: 0 !important;
}

.mail-workspace {
  display: flex;
  flex-direction: column;
  min-height: 0;
  height: 100%;
  background: var(--bg-subtle);
}

.mail-shell {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* —— Sidebar —— */
.mail-sidebar {
  flex-shrink: 0;
  width: 220px;
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #0f2744 0%, #132f4c 100%);
  color: #e2e8f0;
  border-right: 1px solid rgba(255, 255, 255, 0.06);
}

.mail-sidebar-brand {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 1.15rem 1rem 0.85rem;
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
}

.mail-sidebar-brand-icon {
  display: flex;
  width: 1.35rem;
  height: 1.35rem;
  color: #38bdf8;
}

.mail-sidebar-brand-icon svg {
  width: 100%;
  height: 100%;
}

.mail-sidebar-compose {
  margin: 0 0.75rem 1rem;
  width: calc(100% - 1.5rem);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  font-weight: 600;
  box-shadow: 0 4px 14px rgba(14, 165, 233, 0.35);
}

.mail-sidebar-folders {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  padding: 0 0.5rem;
}

.mail-sidebar-folder {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: none;
  border-radius: var(--radius-md);
  background: transparent;
  color: #94a3b8;
  font-size: 0.88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s, color 0.15s;
}

.mail-sidebar-folder:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}

.mail-sidebar-folder.active {
  background: rgba(56, 189, 248, 0.18);
  color: #fff;
  font-weight: 600;
}

.mail-sidebar-folder.active .mail-sidebar-folder-icon {
  color: #38bdf8;
}

.mail-sidebar-folder-icon {
  display: flex;
  width: 1.15rem;
  height: 1.15rem;
  flex-shrink: 0;
  color: inherit;
}

.mail-sidebar-folder-icon svg {
  width: 100%;
  height: 100%;
}

.mail-sidebar-section {
  margin-top: auto;
  padding: 1rem 0.75rem 0.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.mail-sidebar-section-title {
  display: block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #64748b;
  margin-bottom: 0.5rem;
  padding: 0 0.25rem;
}

.mail-sidebar-accounts {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.mail-sidebar-account,
.mail-sidebar-account-single {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.45rem 0.5rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: #cbd5e1;
  font-size: 0.78rem;
  text-align: left;
  cursor: pointer;
}

.mail-sidebar-account:hover {
  background: rgba(255, 255, 255, 0.06);
}

.mail-sidebar-account.active {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.mail-sidebar-account-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #64748b;
  flex-shrink: 0;
}

.mail-sidebar-account.active .mail-sidebar-account-dot {
  background: #38bdf8;
}

.mail-sidebar-account-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mail-sidebar-no-account {
  font-size: 0.75rem;
  color: #64748b;
  margin: 0;
  padding: 0.25rem;
}

.mail-sidebar-footer {
  padding: 0.5rem 0.75rem 1rem;
}

.mail-sidebar-refresh {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  width: 100%;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: var(--radius);
  background: transparent;
  color: #94a3b8;
  font-size: 0.8rem;
  cursor: pointer;
}

.mail-sidebar-refresh:hover {
  background: rgba(255, 255, 255, 0.06);
  color: #f1f5f9;
}

/* —— Main content —— */
.mail-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  background: var(--bg);
}

.mail-content-header {
  padding: 1rem 1.25rem 0.65rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.mail-content-title {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--navy);
}

.mail-content-sub {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.mail-panels {
  display: flex;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.user-mailbox-slot {
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  background: var(--surface-alt, rgba(0, 0, 0, 0.02));
}

.user-mailbox-slot-label {
  margin: 0 0 0.5rem;
  font-size: 0.85rem;
}

.settings-mailbox-block {
  margin-bottom: 1.25rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.settings-mailbox-block:last-child {
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-mailbox-title {
  margin: 0 0 0.75rem;
  font-size: 0.95rem;
}

.pipeline-assignee-bar {
  padding: 0.65rem 1rem;
  margin: 0 0 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-alt, rgba(0, 0, 0, 0.02));
}

.pipeline-main .pipeline-assignee-bar {
  margin: 0 1rem 0.75rem;
}

.assignee-filter-inner {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.assignee-filter-label {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  padding-top: 0.35rem;
  flex-shrink: 0;
}

.assignee-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  flex: 1;
}

.assignee-chip {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.78rem;
  padding: 0.28rem 0.55rem;
  border-radius: 999px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.assignee-chip:hover {
  border-color: var(--accent, #3b82f6);
}

.assignee-chip.active {
  background: var(--accent-muted, rgba(59, 130, 246, 0.12));
  border-color: var(--accent, #3b82f6);
  color: var(--accent, #3b82f6);
  font-weight: 600;
}

.assignee-chip-count {
  font-size: 0.7rem;
  font-weight: 700;
  opacity: 0.85;
}

.assignee-filter-hint {
  margin: 0.45rem 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.list-assignee {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 500;
}

.list-assignee--unassigned {
  color: var(--warning, #b45309);
  font-style: italic;
}

.list-item-assignee,
.pipeline-card-assignee,
.waiting-card-assignee {
  margin-top: 0.2rem;
}

.mail-admin-bar {
  margin: 0 1rem 0.75rem;
  padding: 0.85rem 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--accent-muted, rgba(59, 130, 246, 0.06));
}

.mail-admin-inner {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.mail-readonly-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent, #3b82f6);
}

.mail-admin-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem 1rem;
  align-items: flex-end;
}

.mail-admin-label {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.mail-admin-label select {
  min-width: 130px;
  font-size: 0.85rem;
  text-transform: none;
  font-weight: 400;
}

.mail-admin-label.hidden {
  display: none;
}

.mail-admin-hint {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.mail-admin-warn {
  margin: 0 1rem 0.5rem;
  font-size: 0.8rem;
  color: var(--warning, #b45309);
}

.mail-item-owner {
  font-size: 0.68rem;
  color: var(--accent, #3b82f6);
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.mail-deleted-tag {
  color: var(--warning, #b45309);
  font-weight: 700;
  text-transform: uppercase;
  font-size: 0.6rem;
}

.mail-meta--owner {
  padding: 0.65rem 0.75rem;
  margin-bottom: 0.75rem;
  background: var(--surface-alt, rgba(0, 0, 0, 0.03));
  border-radius: 6px;
  font-size: 0.85rem;
}

.mail-readonly-note {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-style: italic;
}

.mail-list-panel {
  flex: 0 0 min(380px, 38%);
  max-width: 420px;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--bg-subtle);
  border-right: 1px solid var(--border);
}

.mail-list-toolbar {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}

.mail-search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.5rem 0.9rem;
  font-size: 0.85rem;
  background: var(--bg-subtle);
}

.mail-search-input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--bg);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.12);
}

.mail-list-scroll {
  flex: 1;
  overflow-y: auto;
  min-height: 0;
}

.mail-list-item {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  width: 100%;
  text-align: left;
  padding: 0.85rem 0.75rem;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  cursor: pointer;
  color: inherit;
  font: inherit;
  transition: background 0.12s ease;
}

.mail-list-item:hover {
  background: var(--bg-hover);
}

.mail-list-item.active {
  background: linear-gradient(90deg, rgba(14, 165, 233, 0.1) 0%, transparent 100%);
  box-shadow: inset 3px 0 0 var(--accent);
}

.mail-item-avatar {
  flex-shrink: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--navy) 0%, #1e4a6e 100%);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mail-item-content {
  flex: 1;
  min-width: 0;
}

.mail-item-unread .mail-item-from,
.mail-item-unread .mail-item-subject {
  font-weight: 600;
  color: var(--navy);
}

.mail-unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  margin-right: 0.35rem;
  vertical-align: middle;
}

.mail-item-top {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.78rem;
  margin-bottom: 0.15rem;
}

.mail-item-from {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  color: var(--text-secondary);
}

.mail-item-date {
  color: var(--text-muted);
  flex-shrink: 0;
  font-size: 0.72rem;
}

.mail-item-subject {
  font-size: 0.88rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--navy);
}

.mail-item-preview {
  font-size: 0.75rem;
  color: var(--text-muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-top: 0.2rem;
}

.mail-list-footer {
  padding: 0.75rem;
  text-align: center;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}

.mail-load-more {
  width: 100%;
}

.mail-skeleton-item {
  display: flex;
  gap: 0.65rem;
  padding: 0.85rem 0.75rem;
  border-bottom: 1px solid var(--border);
  animation: mail-skeleton-pulse 1.2s ease-in-out infinite;
}

.mail-skeleton-avatar {
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
}

.mail-skeleton-lines {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  padding-top: 0.15rem;
}

.mail-skeleton-line {
  height: 0.65rem;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--border) 0%, var(--bg-hover) 50%, var(--border) 100%);
  background-size: 200% 100%;
}

.mail-skeleton-line.w80 { width: 80%; }
.mail-skeleton-line.w55 { width: 55%; }

@keyframes mail-skeleton-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.55; }
}

.mail-compose-overlay {
  position: fixed;
  inset: 0;
  z-index: 1200;
  background: rgba(15, 23, 42, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.mail-compose-overlay.hidden {
  display: none;
}

.mail-compose-panel {
  width: min(720px, 100%);
  max-height: min(92vh, 860px);
  display: flex;
  flex-direction: column;
  background: var(--bg);
  border-radius: var(--radius-lg);
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.2);
  border: 1px solid var(--border);
  overflow: hidden;
}

.mail-compose-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.mail-compose-header h3 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--navy);
}

.mail-compose-from {
  margin: 0.25rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.mail-compose-close {
  border: none;
  background: transparent;
  font-size: 1.5rem;
  line-height: 1;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius);
}

.mail-compose-close:hover {
  background: var(--bg-hover);
  color: var(--navy);
}

.mail-compose-fields {
  padding: 0.75rem 1.25rem 1rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
  min-height: 0;
}

.mail-compose-row {
  display: grid;
  grid-template-columns: 4.5rem 1fr;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--border);
}

.mail-compose-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.mail-compose-input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.35rem 0;
  font-size: 0.9rem;
}

.mail-compose-input:focus {
  outline: none;
}

.mail-compose-toggle-cc {
  border: none;
  background: none;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.35rem 0;
}

.mail-compose-cc-block.hidden {
  display: none;
}

.mail-compose-editor-wrap {
  flex: 1;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  margin-top: 0.5rem;
}

.mail-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: #fff;
  min-height: 200px;
}

.mail-editor-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.5rem;
  background: var(--bg-subtle);
  border-bottom: 1px solid var(--border);
}

.mail-editor-btn {
  border: none;
  background: transparent;
  color: var(--text-secondary);
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mail-editor-btn:hover {
  background: var(--bg-hover);
  color: var(--navy);
}

.mail-editor-sep {
  width: 1px;
  height: 1.25rem;
  background: var(--border);
  margin: 0 0.2rem;
}

.mail-editor-body {
  flex: 1;
  min-height: 180px;
  padding: 0.85rem 1rem;
  font-size: 0.95rem;
  line-height: 1.55;
  overflow-y: auto;
  outline: none;
}

.mail-editor-body:empty::before {
  content: attr(data-placeholder);
  color: var(--text-muted);
  pointer-events: none;
}

.mail-editor-body ul,
.mail-editor-body ol {
  margin: 0.5rem 0;
  padding-left: 1.5rem;
}

.mail-editor-body a {
  color: var(--accent);
}

.mail-compose-footer {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg-subtle);
}

.required-mark {
  color: var(--danger);
}

.mail-list-empty,
.mail-loading,
.mail-error {
  padding: 2rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  text-align: center;
}

.mail-error {
  color: var(--danger);
}

.mail-detail-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  background: #f1f5f9;
}

.mail-detail-panel.empty {
  align-items: center;
  justify-content: center;
  background: var(--bg);
}

.mail-detail-backdrop {
  display: none;
}

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

.mail-empty-icon {
  display: flex;
  justify-content: center;
  width: 3rem;
  height: 3rem;
  margin: 0 auto 0.75rem;
  opacity: 0.35;
  color: var(--text-muted);
}

.mail-empty-icon svg {
  width: 100%;
  height: 100%;
}

/* —— Reading pane —— */
.mail-read {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.mail-read-header {
  flex-shrink: 0;
  padding: 1rem 1.5rem 1.1rem;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 0 rgba(15, 23, 42, 0.04);
}

.mail-read-back {
  display: none;
  border: none;
  background: var(--bg-subtle);
  color: var(--navy);
  width: 2rem;
  height: 2rem;
  border-radius: var(--radius);
  font-size: 1.1rem;
  cursor: pointer;
  margin-bottom: 0.5rem;
}

.mail-read-header-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.85rem;
}

.mail-read-sender {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  min-width: 0;
}

.mail-read-avatar {
  flex-shrink: 0;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mail-read-sender-text {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  min-width: 0;
}

.mail-read-from {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--navy);
}

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

.mail-read-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

.mail-read-subject {
  margin: 0 0 0.5rem;
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.3;
  color: var(--navy);
  word-break: break-word;
}

.mail-read-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.mail-read-date {
  font-weight: 500;
}

.mail-read-mailbox {
  padding: 0.15rem 0.5rem;
  background: var(--bg-subtle);
  border-radius: 999px;
  font-size: 0.72rem;
}

.mail-read-recipients {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.65rem 0.85rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  font-size: 0.82rem;
}

.mail-recipient-row {
  display: flex;
  gap: 0.5rem;
  line-height: 1.4;
}

.mail-recipient-label {
  flex-shrink: 0;
  width: 2rem;
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.mail-recipient-value {
  color: var(--text);
  word-break: break-word;
}

.mail-read-owner {
  margin-top: 0.65rem;
  font-size: 0.78rem;
  color: var(--accent);
}

.mail-read-owner-badge {
  display: inline-block;
  margin-right: 0.35rem;
  padding: 0.1rem 0.4rem;
  background: rgba(14, 165, 233, 0.12);
  border-radius: 4px;
  font-weight: 700;
  font-size: 0.65rem;
  text-transform: uppercase;
}

.mail-read-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem 2rem;
  min-height: 0;
}

.mail-read-toolbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.75rem;
}

.mail-read-toolbar-label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.mail-read-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
  overflow: hidden;
}

.mail-read-card--plain {
  padding: 0;
}

.mail-read-card--plain .mail-body--plain {
  padding: 1.25rem 1.5rem;
  margin: 0;
  border: none;
  background: transparent;
}

.mail-detail-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  padding: 3rem;
  color: var(--text-muted);
}

.mail-loading-spinner {
  width: 1.25rem;
  height: 1.25rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: mail-spin 0.7s linear infinite;
}

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

.mail-detail-inner {
  padding: 0;
  overflow: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.mail-detail-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 1.25rem 1.5rem 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--bg-subtle);
}

.mail-detail-header-main {
  display: flex;
  gap: 0.85rem;
  align-items: flex-start;
  flex: 1;
  min-width: 0;
}

.mail-detail-avatar {
  flex-shrink: 0;
  width: 2.75rem;
  height: 2.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent) 0%, #6366f1 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mail-detail-subject {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.35;
  color: var(--navy);
  word-break: break-word;
}

.mail-detail-header-text {
  min-width: 0;
  flex: 1;
}

.mail-detail-from-line {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.mail-detail-from-name {
  font-weight: 500;
  color: var(--navy);
}

.mail-detail-date-sep,
.mail-detail-date {
  color: var(--text-muted);
  font-weight: 400;
}

.mail-detail-actions {
  display: flex;
  gap: 0.5rem;
  flex-shrink: 0;
}

.mail-meta-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.35rem 1rem;
  margin: 0;
  padding: 1rem 1.5rem;
  font-size: 0.82rem;
  border-bottom: 1px solid var(--border);
}

.mail-meta-grid dt {
  margin: 0;
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.mail-meta-grid dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}

.mail-meta-card {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.25rem 0.75rem;
  margin: 0 1.5rem;
  padding: 0.75rem 1rem;
  font-size: 0.8rem;
  background: var(--bg-subtle);
  border-radius: var(--radius);
  border: 1px solid var(--border);
}

.mail-meta-card--owner {
  margin-top: 0.75rem;
}

.mail-meta-label {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.68rem;
  text-transform: uppercase;
}

.mail-muted {
  color: var(--text-muted);
}

.mail-body-section {
  flex: 1;
  padding: 1rem 1.5rem 1.5rem;
  min-height: 0;
}

.mail-body-view-toggle {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
}

.mail-view-btn {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.3rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  color: var(--text-secondary);
  cursor: pointer;
}

.mail-view-btn.active {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}

.mail-body-frame {
  display: block;
  width: 100%;
  min-height: 320px;
  border: none;
  background: #fff;
}

.mail-body--plain {
  font-size: 0.95rem;
  line-height: 1.6;
  color: var(--navy);
  padding: 1rem 1.15rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  word-break: break-word;
}

.mail-setup-alert {
  padding: 1.25rem;
  margin: 1rem;
  border-radius: var(--radius-md);
  background: rgba(234, 179, 8, 0.08);
  border: 1px solid rgba(234, 179, 8, 0.35);
  font-size: 0.9rem;
  line-height: 1.45;
}

@media (max-width: 900px) {
  .mail-shell {
    flex-direction: column;
  }

  .mail-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding-bottom: 0.5rem;
  }

  .mail-sidebar-brand,
  .mail-sidebar-section,
  .mail-sidebar-footer {
    display: none;
  }

  .mail-sidebar-compose {
    margin: 0.5rem 0.5rem 0.5rem 0.75rem;
    width: auto;
    flex: 0 0 auto;
  }

  .mail-sidebar-folders {
    flex-direction: row;
    flex: 1;
    padding: 0.5rem;
    overflow-x: auto;
  }

  .mail-sidebar-folder {
    flex-shrink: 0;
    width: auto;
  }

  .mail-list-panel {
    flex: 0 0 auto;
    max-width: none;
    width: 100%;
    max-height: 45vh;
  }

  .mail-panels {
    flex-direction: column;
  }
}

@media (max-width: 1100px) {
  .mail-read-back {
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  .mail-detail-backdrop:not(.hidden) {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 199;
    background: rgba(15, 23, 42, 0.4);
  }

  .mail-detail-panel:not(.empty) {
    position: fixed;
    inset: 0;
    z-index: 200;
    max-width: none;
    width: 100%;
  }
}

/* Team Chat */
.chat-main {
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-workspace {
  display: flex;
  flex-direction: column;
  height: 100%;
  min-height: 0;
}

.chat-topbar {
  align-items: center;
}

.chat-topbar .chat-topbar-title h2 {
  margin: 0;
}

.chat-channel-desc {
  margin: 0.2rem 0 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 400;
}

.chat-member-avatars {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.chat-header-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid var(--bg);
  margin-left: -6px;
}

.chat-header-avatar:first-child {
  margin-left: 0;
}

.chat-header-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted, rgba(59, 130, 246, 0.2));
  color: var(--accent, #3b82f6);
  font-size: 0.65rem;
  font-weight: 700;
}

.chat-header-more {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 0.35rem;
}

.chat-layout {
  display: flex;
  flex: 1;
  min-height: 0;
  margin: 0 1rem 1rem;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  background: var(--surface);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.chat-channels-sidebar {
  width: 220px;
  flex-shrink: 0;
  border-right: 1px solid var(--border);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-channels-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0.85rem;
  border-bottom: 1px solid var(--border);
}

.chat-channels-title {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.chat-channels-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.35rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.chat-channel-item {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  width: 100%;
  text-align: left;
  padding: 0.5rem 0.65rem;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: inherit;
  font: inherit;
  cursor: pointer;
  font-size: 0.9rem;
}

.chat-channel-item:hover {
  background: rgba(255, 255, 255, 0.05);
}

.chat-channel-item.active {
  background: var(--accent-muted, rgba(59, 130, 246, 0.15));
  color: var(--accent, #3b82f6);
  font-weight: 600;
}

.chat-channel-hash {
  opacity: 0.55;
  font-weight: 600;
}

.chat-channel-name {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-channel-default,
.chat-channel-public {
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  background: var(--surface);
  padding: 0.1rem 0.35rem;
  border-radius: 4px;
  flex-shrink: 0;
}

.chat-channel-public {
  color: var(--accent, #3b82f6);
  background: var(--accent-muted, rgba(59, 130, 246, 0.12));
}

.chat-members-picker.hidden {
  display: none;
}

.chat-member-checkboxes {
  max-height: 200px;
  overflow-y: auto;
  margin-top: 0.5rem;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.chat-member-checkboxes label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  font-size: 0.88rem;
}

.chat-channel-archived {
  font-size: 0.65rem;
  color: var(--danger, #dc2626);
}

.chat-channels-empty {
  padding: 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.chat-main-panel {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.chat-shell {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  border: none;
  border-radius: 0;
  margin: 0;
  background: var(--surface);
  overflow: hidden;
  box-shadow: none;
}

.chat-manage-list {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  max-height: 50vh;
  overflow-y: auto;
}

.chat-manage-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  padding: 0.65rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 8px;
}

.chat-manage-row-inactive {
  opacity: 0.65;
}

.chat-manage-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

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

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 1rem 0.85rem 0.5rem;
  min-height: 300px;
  max-height: calc(100vh - 280px);
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.chat-empty,
.chat-loading,
.chat-error {
  color: var(--text-muted);
  text-align: center;
  padding: 3rem 1rem;
  font-size: 0.95rem;
}

.chat-error {
  color: var(--danger, #dc2626);
}

.chat-msg-row {
  display: flex;
  gap: 0.65rem;
  padding: 0.35rem 0.5rem;
  border-radius: 8px;
  position: relative;
}

.chat-msg-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.chat-msg-row-grouped {
  padding-top: 0.1rem;
}

.chat-msg-row-own {
  flex-direction: row-reverse;
}

.chat-msg-row-own .chat-msg-body-col {
  align-items: flex-end;
}

.chat-msg-row-own .chat-msg-meta {
  flex-direction: row-reverse;
}

.chat-msg-avatar-col {
  flex-shrink: 0;
  width: 40px;
}

.chat-avatar {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
  display: block;
}

.chat-avatar-initials {
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent, #3b82f6), #6366f1);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 700;
}

.chat-avatar-spacer {
  visibility: hidden;
}

.chat-msg-body-col {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  max-width: min(720px, 85%);
}

.chat-msg-row-own .chat-msg-body-col {
  margin-left: auto;
}

.chat-msg-meta {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.35rem 0.5rem;
  margin-bottom: 0.2rem;
  line-height: 1.2;
}

.chat-msg-author {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--text);
}

.chat-msg-meta .role-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
}

.chat-msg-time {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

.chat-edited {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-style: italic;
}

.chat-msg-bubble {
  padding: 0.65rem 0.9rem;
  border-radius: 4px 14px 14px 14px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 0.94rem;
  line-height: 1.5;
  word-break: break-word;
  color: var(--text);
}

.chat-msg-row-own .chat-msg-bubble {
  background: var(--accent, #3b82f6);
  color: #fff;
  border-color: transparent;
  border-radius: 14px 4px 14px 14px;
}

.chat-msg-row-grouped .chat-msg-bubble {
  margin-top: 0;
}

.chat-reactions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.35rem;
}

.chat-reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
  font-size: 0.85rem;
  cursor: pointer;
  color: inherit;
  transition: background 0.15s, border-color 0.15s;
}

.chat-reaction-pill:hover {
  border-color: var(--accent, #3b82f6);
  background: var(--accent-muted, rgba(59, 130, 246, 0.12));
}

.chat-reaction-pill.is-active {
  border-color: var(--accent, #3b82f6);
  background: var(--accent-muted, rgba(59, 130, 246, 0.18));
}

.chat-reaction-count {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-weight: 600;
}

.chat-msg-toolbar {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.25rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.chat-msg-row:hover .chat-msg-toolbar,
.chat-msg-row:focus-within .chat-msg-toolbar {
  opacity: 1;
}

.chat-toolbar-btn,
.chat-toolbar-emoji {
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.78rem;
  padding: 0.2rem 0.4rem;
  border-radius: 6px;
  cursor: pointer;
}

.chat-toolbar-emoji {
  font-size: 1rem;
  padding: 0.15rem 0.25rem;
}

.chat-toolbar-btn:hover,
.chat-toolbar-emoji:hover {
  background: var(--bg);
  color: var(--text);
}

.chat-reaction-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.35rem;
  padding: 0.45rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--bg);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
}

.chat-reaction-picker.hidden {
  display: none;
}

.chat-picker-emoji {
  border: none;
  background: transparent;
  font-size: 1.25rem;
  padding: 0.25rem;
  border-radius: 6px;
  cursor: pointer;
  line-height: 1;
}

.chat-picker-emoji:hover {
  background: var(--accent-muted, rgba(59, 130, 246, 0.15));
  transform: scale(1.15);
}

.chat-edit-box {
  width: 100%;
}

.chat-edit-input {
  width: 100%;
  min-height: 4rem;
  font-family: inherit;
  font-size: 0.94rem;
  padding: 0.55rem 0.75rem;
  border: 1px solid var(--accent, #3b82f6);
  border-radius: 8px;
  background: var(--bg);
  color: inherit;
  resize: vertical;
}

.chat-edit-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.chat-composer {
  border-top: 1px solid var(--border);
  background: var(--bg);
  padding: 0.65rem 0.85rem 0.85rem;
}

.chat-composer-tools {
  margin-bottom: 0.45rem;
}

.chat-emoji-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.2rem;
}

.chat-emoji-insert {
  border: 1px solid var(--border);
  background: var(--surface);
  border-radius: 8px;
  font-size: 1.1rem;
  padding: 0.2rem 0.45rem;
  cursor: pointer;
  line-height: 1;
  transition: transform 0.1s, background 0.15s;
}

.chat-emoji-insert:hover {
  background: var(--accent-muted, rgba(59, 130, 246, 0.12));
  transform: scale(1.08);
}

.chat-composer-row {
  display: flex;
  gap: 0.65rem;
  align-items: flex-end;
}

.chat-composer-avatar {
  flex-shrink: 0;
}

.chat-composer-avatar .chat-avatar {
  width: 36px;
  height: 36px;
  border-radius: 8px;
}

.chat-composer textarea {
  flex: 1;
  resize: none;
  min-height: 2.75rem;
  max-height: 9rem;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: inherit;
}

.chat-composer textarea:focus {
  outline: 2px solid var(--accent, #3b82f6);
  outline-offset: 0;
  border-color: transparent;
}

.chat-composer #chat-send-btn {
  flex-shrink: 0;
  align-self: flex-end;
  min-width: 4.5rem;
}

@media (max-width: 900px) {
  .chat-layout {
    flex-direction: column;
    margin: 0 0.5rem 0.5rem;
  }

  .chat-channels-sidebar {
    width: 100%;
    border-right: none;
    border-bottom: 1px solid var(--border);
    max-height: 140px;
  }

  .chat-channels-list {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 0.5rem;
  }

  .chat-channel-item {
    flex-shrink: 0;
    width: auto;
    max-width: 160px;
  }
}

@media (max-width: 768px) {
  .chat-layout {
    margin: 0 0.5rem 0.5rem;
    border-radius: 10px;
  }

  .chat-messages {
    max-height: calc(100vh - 260px);
    padding: 0.65rem 0.35rem;
  }

  .chat-msg-body-col {
    max-width: 92%;
  }

  .chat-msg-toolbar {
    opacity: 1;
  }

  .chat-member-avatars {
    display: none;
  }
}

/* --- Agent dashboard --- */
.dashboard-main {
  background: var(--bg-subtle);
}

.agent-dashboard-workspace {
  min-height: 100%;
}

.agent-dashboard-scroll {
  padding: 1.25rem 1.5rem 2.5rem;
  max-width: 1200px;
  margin: 0 auto;
}

.agent-dashboard-loading {
  padding: 3rem;
  text-align: center;
  color: var(--text-muted);
}

.dash-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg, var(--navy) 0%, #1e3a5f 55%, #2d4a6f 100%);
  border-radius: var(--radius-lg);
  color: #fff;
  box-shadow: var(--shadow-lg);
}

.dash-hero-eyebrow {
  font-size: 0.8rem;
  opacity: 0.85;
  margin-bottom: 0.2rem;
}

.dash-hero-title {
  font-size: 1.75rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.dash-hero-date {
  font-size: 0.82rem;
  opacity: 0.8;
  margin-top: 0.35rem;
}

.dash-hero-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.dash-hero-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  color: #fff;
}

.dash-hero-actions .btn-primary {
  background: #fff;
  color: var(--navy);
  border-color: #fff;
}

.dash-kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.dash-kpi-grid--5 {
  grid-template-columns: repeat(5, 1fr);
}

.dash-kpi-grid--6 {
  grid-template-columns: repeat(6, 1fr);
}

.dash-kpi-grid--7 {
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
}

.dash-hero--master {
  background: linear-gradient(135deg, #0f172a 0%, #1a365d 40%, #7c2d12 100%);
}

.dash-secondary-grid--4 {
  grid-template-columns: repeat(4, 1fr);
}

.dash-stage-fill--country {
  background: linear-gradient(90deg, #b45309 0%, #d97706 100%);
}

.dash-commission-badge--master {
  background: #fff7ed;
  border-color: #fdba74;
}

.dash-commission-badge--master strong {
  color: #c2410c;
}

.dash-kpi-card--commission {
  border-color: #86efac;
  background: linear-gradient(160deg, #f0fdf4 0%, #ecfdf5 100%);
}

.dash-kpi-card--commission .dash-kpi-value {
  color: var(--success);
  font-size: 1.35rem;
}

.dash-hero-commission {
  font-size: 0.78rem;
  opacity: 0.9;
  margin-top: 0.45rem;
}

.dash-hero-commission strong {
  font-weight: 700;
}

.dash-kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}

.dash-kpi-card--accent {
  border-color: var(--accent-border);
  background: var(--accent-muted);
}

.dash-kpi-card--value .dash-kpi-value {
  font-size: 1.35rem;
}

.dash-kpi-card--warn {
  border-color: #fecaca;
  background: var(--danger-bg);
}

.dash-kpi-card--warn .dash-kpi-value {
  color: var(--danger);
}

.dash-kpi-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.dash-kpi-value {
  font-size: 1.65rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--navy);
  line-height: 1.15;
}

.dash-kpi-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.dash-secondary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.dash-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.2rem;
  box-shadow: var(--shadow-sm);
}

.dash-panel--wide {
  margin-bottom: 1.25rem;
}

.dash-panel-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.85rem;
}

.dash-mini-stats {
  display: flex;
  gap: 1rem;
}

.dash-mini-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  padding: 0.65rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
}

.dash-mini-val {
  font-size: 1.4rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--navy);
}

.dash-mini-lbl {
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

.dash-pay-stats {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
}

.dash-pay-line {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.dash-pay-line strong {
  font-family: 'IBM Plex Mono', monospace;
  color: var(--navy);
  font-size: 0.85rem;
}

.dash-pay-line--today strong {
  color: var(--success);
}

.dash-pay-line--overdue strong {
  color: var(--danger);
}

.dash-pay-line--commission strong {
  color: var(--success);
}

.dash-payments-section {
  margin-bottom: 1.25rem;
}

.dash-payments-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.dash-payments-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.dash-commission-badge {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  padding: 0.55rem 0.85rem;
  background: var(--success-bg);
  border: 1px solid #86efac;
  border-radius: var(--radius-md);
}

.dash-commission-badge-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.dash-commission-badge strong {
  font-size: 1.35rem;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--success);
}

.dash-commission-summary {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.65rem;
  margin-bottom: 1.1rem;
}

.dash-commission-stat {
  padding: 0.75rem 0.85rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.dash-commission-stat-lbl {
  display: block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.dash-commission-stat strong {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1rem;
  color: var(--navy);
}

.dash-commission-stat--warn {
  background: var(--warning-bg);
  border-color: #fde68a;
}

.dash-commission-stat--warn strong {
  color: var(--warning);
}

.dash-commission-stat--success {
  background: var(--success-bg);
  border-color: #86efac;
}

.dash-commission-stat--success strong {
  color: var(--success);
}

.dash-pay-groups {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.dash-pay-group-head {
  margin-bottom: 0.55rem;
}

.dash-pay-group-title {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--navy);
}

.dash-pay-group-hint {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.dash-payments-all-btn {
  margin-top: 0.25rem;
}

.dash-commission-tag {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.1rem 0.35rem;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--success);
  background: var(--success-bg);
  border-radius: 4px;
}

.dash-inbox-stat {
  margin-bottom: 0.75rem;
  font-size: 0.88rem;
  color: var(--text-secondary);
}

.dash-inbox-count {
  font-size: 1.75rem;
  font-weight: 700;
  font-family: 'IBM Plex Mono', monospace;
  color: var(--navy);
  display: block;
  margin-bottom: 0.15rem;
}

.dash-stage-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.dash-stage-row {
  display: grid;
  grid-template-columns: 8.5rem 1fr 2rem;
  align-items: center;
  gap: 0.65rem;
}

.dash-stage-label {
  font-size: 0.78rem;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-stage-track {
  height: 8px;
  background: var(--bg-muted);
  border-radius: 99px;
  overflow: hidden;
}

.dash-stage-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #3d5a80 100%);
  border-radius: 99px;
  min-width: 4px;
  transition: width 0.35s ease;
}

.dash-stage-count {
  font-size: 0.78rem;
  font-weight: 600;
  font-family: 'IBM Plex Mono', monospace;
  text-align: right;
  color: var(--navy);
}

.dash-empty-inline {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.dash-today-section {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.35rem 1.35rem;
  box-shadow: var(--shadow);
}

.dash-today-header {
  margin-bottom: 1.1rem;
  padding-bottom: 0.85rem;
  border-bottom: 2px solid var(--navy);
}

.dash-today-title {
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  color: var(--navy);
}

.dash-today-sub {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}

.dash-today-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.25rem;
}

.dash-today-col-title {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 0.65rem;
}

.dash-today-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.dash-today-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  width: 100%;
  text-align: left;
  padding: 0.75rem 0.85rem;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition), transform 0.12s ease;
  font: inherit;
  color: inherit;
}

.dash-today-row:hover {
  background: var(--bg-hover);
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

.dash-today-row--overdue {
  border-color: #fecaca;
  background: var(--danger-bg);
}

.dash-today-icon {
  width: 2.25rem;
  height: 2.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-muted);
  border-radius: var(--radius-md);
  font-size: 1rem;
  flex-shrink: 0;
}

.dash-today-icon--pay {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 0.9rem;
  background: var(--success-bg);
  color: var(--success);
}

.dash-today-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.dash-today-title {
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--navy);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.dash-today-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.dash-today-chevron {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.dash-today-empty {
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 1rem;
  background: var(--bg-subtle);
  border-radius: var(--radius-md);
  border: 1px dashed var(--border);
}

.dash-link {
  background: none;
  border: none;
  padding: 0;
  color: var(--accent);
  font: inherit;
  font-size: inherit;
  cursor: pointer;
  text-decoration: underline;
}

@media (max-width: 1024px) {
  .dash-kpi-grid,
  .dash-kpi-grid--5,
  .dash-kpi-grid--6,
  .dash-kpi-grid--7 {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-secondary-grid,
  .dash-secondary-grid--4 {
    grid-template-columns: 1fr;
  }
  .dash-commission-summary {
    grid-template-columns: repeat(2, 1fr);
  }
  .dash-pay-groups {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .agent-dashboard-scroll {
    padding: 1rem 0.75rem 2rem;
  }
  .dash-hero {
    padding: 1.15rem 1.2rem;
  }
  .dash-hero-title {
    font-size: 1.4rem;
  }
  .dash-kpi-grid,
  .dash-kpi-grid--5,
  .dash-kpi-grid--6,
  .dash-kpi-grid--7 {
    grid-template-columns: 1fr;
  }
  .dash-commission-summary {
    grid-template-columns: 1fr;
  }
  .dash-today-columns {
    grid-template-columns: 1fr;
  }
  .dash-stage-row {
    grid-template-columns: 6.5rem 1fr 1.75rem;
  }
}

/* Login 2FA */
.login-2fa-hint {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin: 0 0 1rem;
  text-align: center;
}

/* Settings 2FA */
.settings-2fa-status { margin: 0.5rem 0 1rem; }
.settings-2fa-setup,
.settings-2fa-disable {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}
.settings-2fa-qr-wrap {
  display: flex;
  justify-content: center;
  margin: 1rem 0;
  padding: 0.75rem;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.settings-2fa-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; align-items: center; }
.badge-ok {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bbf7d0;
}

/* CSV import docs */
.import-csv-docs {
  max-height: 50vh;
  overflow: auto;
  font-size: 0.85rem;
}
.import-docs-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.75rem 0;
  font-size: 0.8rem;
}
.import-docs-table th,
.import-docs-table td {
  border: 1px solid var(--border);
  padding: 0.4rem 0.5rem;
  text-align: left;
  vertical-align: top;
}
.import-docs-table th {
  background: var(--bg-muted);
  font-weight: 600;
}
.import-docs-table code {
  font-size: 0.78rem;
  white-space: nowrap;
}

/* Admin activity logs */
.audit-logs-workspace .topbar-sub {
  margin: 0.25rem 0 0;
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 400;
}
.audit-summary { margin-bottom: 1rem; }
.audit-kpi {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}
.audit-kpi-card {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.audit-kpi-card--warn {
  border-color: #fecaca;
  background: var(--danger-bg);
}
.audit-kpi-value {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1.1;
}
.audit-kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.card-panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}
.audit-filters-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem 1rem;
}
.audit-filters-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border);
}
.audit-log-list { padding: 0.5rem; }
.audit-log-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 0.65rem;
  background: var(--bg);
}
.audit-log-row--fail {
  border-left: 3px solid var(--danger);
  background: #fffbfb;
}
.audit-log-row--ok {
  border-left: 3px solid #86efac;
}
.audit-log-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}
.audit-status-pill,
.audit-category-pill {
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}
.audit-status-pill--ok {
  background: var(--success-bg);
  color: var(--success);
}
.audit-status-pill--fail {
  background: var(--danger-bg);
  color: var(--danger);
}
.audit-category-pill {
  background: var(--bg-muted);
  color: var(--text-secondary);
}
.audit-log-time {
  margin-left: auto;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.audit-log-action {
  margin: 0 0 0.35rem;
  font-size: 1rem;
  font-weight: 600;
}
.audit-log-who {
  font-size: 0.88rem;
  color: var(--text-secondary);
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem 0.75rem;
  align-items: center;
}
.audit-log-email { color: var(--text-muted); }
.audit-log-ip {
  font-family: var(--font-mono, monospace);
  font-size: 0.78rem;
  color: var(--text-muted);
}
.audit-log-details {
  margin-top: 0.65rem;
  font-size: 0.85rem;
}
.audit-log-details summary {
  cursor: pointer;
  color: var(--accent);
  font-weight: 500;
}
.audit-details-json {
  margin: 0.5rem 0 0;
  padding: 0.65rem;
  background: var(--bg-muted);
  border-radius: var(--radius);
  font-size: 0.75rem;
  overflow-x: auto;
  max-height: 200px;
  white-space: pre-wrap;
  word-break: break-word;
}
.audit-empty {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
}
.audit-empty--error { color: var(--danger); }
.audit-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.5rem 0 1rem;
}
.audit-page-info { font-size: 0.88rem; color: var(--text-muted); }
.audit-page-btns { display: flex; gap: 0.5rem; }

.mail-admin-warn {
  margin: 0 0 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid #fcd34d;
  background: var(--warning-bg);
  border-radius: var(--radius-md);
  font-size: 0.88rem;
  color: var(--warning);
}
.mail-admin-warn-title {
  margin: 0 0 0.5rem;
  font-weight: 600;
  color: var(--text);
}
.mail-admin-warn-list {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--text-secondary);
}
.mail-admin-warn-list li { margin-bottom: 0.35rem; }
.mail-admin-warn-hints {
  margin: 0.35rem 0 0;
  padding-left: 1rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

@media (max-width: 900px) {
  .audit-kpi { grid-template-columns: repeat(2, 1fr); }
  .audit-filters-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 520px) {
  .audit-kpi { grid-template-columns: 1fr; }
  .audit-filters-grid { grid-template-columns: 1fr; }
}
