:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-muted: #f8fafc;
  --text: #172033;
  --muted: #667085;
  --border: #e4e7ec;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eff6ff;
  --danger: #dc2626;
  --danger-soft: #fef2f2;
  --warning: #d97706;
  --warning-soft: #fffbeb;
  --success: #059669;
  --success-soft: #ecfdf5;
  --purple: #7c3aed;
  --sidebar: #101828;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, .05);
  --shadow-md: 0 8px 24px rgba(16, 24, 40, .10);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
html { scrollbar-gutter: stable; }
html.modal-open, body.modal-open {
  overflow: hidden !important;
  overscroll-behavior: none;
}
body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.1fr .9fr;
  background: var(--surface);
}
.login-visual {
  position: relative;
  overflow: hidden;
  padding: clamp(40px, 7vw, 100px);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: white;
  background:
    radial-gradient(circle at 15% 15%, rgba(96, 165, 250, .3), transparent 32%),
    radial-gradient(circle at 85% 80%, rgba(124, 58, 237, .24), transparent 35%),
    linear-gradient(145deg, #0f172a, #162c5b 62%, #1e3a8a);
}
.login-visual::after {
  content: "";
  position: absolute;
  width: 420px;
  height: 420px;
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 50%;
  right: -190px;
  top: 12%;
  box-shadow: 0 0 0 70px rgba(255,255,255,.025), 0 0 0 145px rgba(255,255,255,.018);
}
.brand-mark {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  z-index: 1;
  flex: 0 0 auto;
}
.brand-mark img,
.mobile-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}
.brand-mark.small { width: 44px; height: 44px; }
.login-visual > div { z-index: 1; }
.eyebrow { display: block; font-size: 11px; font-weight: 800; letter-spacing: .13em; color: #7c8aa5; margin-bottom: 8px; }
.login-visual .eyebrow { color: #93c5fd; }
.login-visual h1 { font-size: clamp(36px, 4vw, 62px); line-height: 1.04; letter-spacing: -.04em; max-width: 760px; margin: 12px 0 24px; }
.login-visual p { max-width: 650px; font-size: 18px; line-height: 1.65; color: #cbd5e1; }
.login-features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.login-features div { padding: 18px; border: 1px solid rgba(255,255,255,.12); border-radius: 14px; background: rgba(255,255,255,.06); backdrop-filter: blur(8px); }
.login-features strong, .login-features span { display: block; }
.login-features span { margin-top: 5px; font-size: 12px; color: #cbd5e1; }
.login-panel { display: grid; place-items: center; padding: 32px; }
.auth-card { width: min(430px, 100%); }
.auth-header { margin-bottom: 30px; }
.auth-header h2 { font-size: 30px; letter-spacing: -.03em; margin: 0 0 8px; }
.auth-header p { color: var(--muted); line-height: 1.5; margin: 0; }
.mobile-logo { display: none; }

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.field > span { font-size: 13px; font-weight: 700; color: #344054; }
.field input, .field select, .field textarea, .select-control {
  width: 100%;
  border: 1px solid #d0d5dd;
  border-radius: 10px;
  background: white;
  color: var(--text);
  padding: 11px 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 120px; }
.field input:focus, .field select:focus, .field textarea:focus, .select-control:focus, .search-box:focus-within {
  border-color: #84adff;
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .10);
}
.field small { text-align: right; color: var(--muted); }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 46px; }
.icon-button {
  border: 0;
  background: transparent;
  color: #667085;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
}
.icon-button:hover { background: #f2f4f7; color: #344054; }
.inside-input { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); }
.auth-options { display: flex; justify-content: space-between; align-items: center; gap: 20px; font-size: 13px; margin: 2px 0 22px; }
.checkbox-label { display: flex; align-items: center; gap: 7px; color: var(--muted); }
.checkbox-label input { accent-color: var(--primary); }
.link-button { border: 0; padding: 0; color: var(--primary); font-weight: 700; background: transparent; }
.link-button:hover { text-decoration: underline; }
.button {
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 10px 15px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  transition: .15s ease;
  white-space: nowrap;
}
.button:disabled { opacity: .6; cursor: wait; }
.button-primary { color: white; background: var(--primary); box-shadow: var(--shadow-sm); }
.button-primary:hover { background: var(--primary-dark); }
.button-secondary { color: #344054; background: white; border-color: #d0d5dd; }
.button-secondary:hover { background: #f9fafb; }
.button-danger { color: white; background: var(--danger); }
.button-danger:hover { background: #b91c1c; }
.button-full { width: 100%; min-height: 44px; }
.form-error { color: #b42318; background: #fef3f2; border: 1px solid #fecdca; border-radius: 9px; padding: 10px 12px; font-size: 13px; margin: 12px 0 0; }

.app-view { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  background: var(--sidebar);
  color: white;
  padding: 22px 14px;
  display: flex;
  flex-direction: column;
  z-index: 20;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 30px; }
.sidebar-brand strong, .sidebar-brand span { display: block; }
.sidebar-brand span { color: #98a2b3; font-size: 12px; margin-top: 2px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 6px; }
.nav-item {
  border: 0;
  background: transparent;
  color: #98a2b3;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  text-align: left;
  font-weight: 600;
}
.nav-item:hover, .nav-item.active { color: white; background: #1d2939; }
.nav-icon { width: 22px; text-align: center; font-size: 18px; }
.sidebar-footer { margin-top: auto; border-top: 1px solid #344054; padding-top: 18px; }
.user-card { display: flex; align-items: center; gap: 10px; min-width: 0; }
.avatar { flex: 0 0 auto; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; color: white; font-size: 13px; font-weight: 800; background: linear-gradient(135deg, #7c3aed, #2563eb); }
.user-details { flex: 1; min-width: 0; }
.user-details strong, .user-details span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-details strong { font-size: 13px; }
.user-details span { font-size: 11px; color: #98a2b3; margin-top: 2px; }
.sidebar .icon-button { color: #98a2b3; }
.sidebar .icon-button:hover { background: #1d2939; color: white; }

.main-content { min-width: 0; padding: 30px; }
.topbar { display: flex; justify-content: space-between; gap: 24px; align-items: flex-end; margin-bottom: 24px; }
.topbar h1 { font-size: 30px; letter-spacing: -.03em; margin: 0; }
.topbar p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }
.topbar-actions { display: flex; gap: 10px; }
.mobile-menu { display: none; }
.metrics-grid { display: grid; grid-template-columns: repeat(4, minmax(170px, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card { display: flex; align-items: center; gap: 13px; padding: 17px; background: white; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.metric-icon { width: 42px; height: 42px; display: grid; place-items: center; border-radius: 11px; font-weight: 800; }
.metric-icon.blue { color: #2563eb; background: #eff6ff; }
.metric-icon.amber { color: #d97706; background: #fffbeb; }
.metric-icon.purple { color: #7c3aed; background: #f5f3ff; }
.metric-icon.green { color: #059669; background: #ecfdf5; }
.metric-card span, .metric-card strong { display: block; }
.metric-card span { color: var(--muted); font-size: 12px; }
.metric-card strong { margin-top: 3px; font-size: 21px; letter-spacing: -.02em; }

.toolbar { display: flex; gap: 10px; align-items: center; margin-bottom: 18px; }
.search-box { flex: 1; min-width: 220px; display: flex; align-items: center; gap: 8px; border: 1px solid #d0d5dd; background: white; border-radius: 10px; padding: 0 12px; transition: .15s; }
.search-box span { color: #98a2b3; font-size: 20px; }
.search-box input { width: 100%; border: 0; outline: 0; padding: 11px 0; color: var(--text); }
.select-control { width: auto; min-width: 155px; padding: 10px 12px; }
.toolbar > .link-button { padding: 8px; font-size: 13px; }

.kanban-board { display: grid; grid-template-columns: repeat(4, minmax(260px, 1fr)); gap: 14px; align-items: start; overflow-x: auto; padding-bottom: 10px; }
.kanban-column { min-width: 260px; background: #eef1f6; border: 1px solid #e2e7ef; border-radius: 14px; overflow: hidden; }
.kanban-column > header { display: flex; justify-content: space-between; align-items: center; padding: 14px 14px 11px; }
.kanban-column > header > div { display: flex; align-items: center; gap: 8px; }
.column-header-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; min-width: 0; }
.bulk-column-select { display: inline-flex; align-items: center; gap: 5px; padding: 4px 7px; border: 1px solid #bfdbfe; border-radius: 7px; background: #eff6ff; color: #1d4ed8; font-size: 10px; font-weight: 800; line-height: 1; cursor: pointer; white-space: nowrap; }
.bulk-column-select input { width: 13px; height: 13px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.bulk-column-select:has(input:disabled) { opacity: .48; cursor: default; }
.kanban-column h2 { font-size: 13px; margin: 0; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; }
.status-dot.new { background: #2563eb; }
.status-dot.analysis { background: #7c3aed; }
.status-dot.waiting { background: #d97706; }
.status-dot.done { background: #059669; }
.column-count { font-size: 11px; font-weight: 800; color: #667085; border-radius: 999px; background: #dde3ec; padding: 3px 8px; }
.column-body { padding: 0 9px 9px; min-height: 430px; transition: background .15s; }
.column-body.drag-over { background: #dbeafe; }

.request-card {
  position: relative;
  background: white;
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 13px;
  margin-bottom: 9px;
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: transform .15s, box-shadow .15s, border-color .15s;
}
.request-card:hover { transform: translateY(-1px); box-shadow: 0 7px 18px rgba(16, 24, 40, .08); border-color: #cbd5e1; }
.request-card.dragging { opacity: .5; transform: rotate(1deg); }
.request-card.oldest { border: 1px solid #f59e0b; box-shadow: 0 0 0 2px rgba(245, 158, 11, .12); }
.request-card.oldest::before { content: "MAIS ANTIGA"; position: absolute; right: 10px; top: -8px; padding: 2px 7px; border-radius: 99px; color: #92400e; background: #fef3c7; font-size: 8px; font-weight: 800; letter-spacing: .05em; }
.request-card.age-warning { border-left: 4px solid #f59e0b; }
.request-card.age-critical { border-left: 4px solid #dc2626; background: linear-gradient(90deg, #fff7f7, white 22%); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.card-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 7px; border-radius: 6px; font-size: 9px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.tag.programacao { color: #1d4ed8; background: #eff6ff; }
.tag.cancelamento { color: #b42318; background: #fef3f2; }
.tag.urgente { color: #b42318; background: #fee4e2; }
.tag.alta { color: #b54708; background: #fffaeb; }
.tag.normal { color: #344054; background: #f2f4f7; }
.tag.baixa { color: #027a48; background: #ecfdf3; }
.card-time { color: #667085; font-size: 10px; font-weight: 700; white-space: nowrap; }
.card-time.critical { color: #b42318; }
.card-title { font-size: 13px; line-height: 1.35; margin: 0 0 5px; }
.card-client { color: #475467; font-size: 12px; margin: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.program-card-client { display: grid; gap: 3px; min-width: 0; }
.program-card-client .card-client { white-space: normal; overflow: visible; text-overflow: clip; line-height: 1.35; }
.card-cnpj { margin: 0; color: #475467; font-size: 11px; font-weight: 700; line-height: 1.35; white-space: nowrap; }
.card-cnpj span { color: #667085; font-weight: 600; }
.card-description { color: #667085; font-size: 11px; line-height: 1.45; margin: 9px 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.card-footer { display: flex; align-items: center; justify-content: space-between; gap: 8px; border-top: 1px solid #f2f4f7; padding-top: 9px; margin-top: 9px; }
.card-person { min-width: 0; display: flex; align-items: center; gap: 6px; font-size: 10px; color: #667085; }
.card-person .mini-avatar { width: 22px; height: 22px; flex: 0 0 auto; border-radius: 50%; color: white; display: grid; place-items: center; font-size: 8px; font-weight: 800; background: #475467; }
.card-person span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-link { color: #2563eb; text-decoration: none; font-size: 11px; font-weight: 700; }
.card-link:hover { text-decoration: underline; }
.column-empty { padding: 30px 12px; text-align: center; color: #98a2b3; font-size: 12px; border: 1px dashed #cbd5e1; border-radius: 9px; }

.empty-state { text-align: center; background: white; border: 1px solid var(--border); border-radius: 14px; padding: 60px 20px; }
.empty-state > div { font-size: 34px; color: #98a2b3; }
.empty-state h2 { margin: 12px 0 5px; font-size: 18px; }
.empty-state p { color: var(--muted); margin: 0; font-size: 13px; }

.modal { border: 0; border-radius: 16px; padding: 0; width: min(760px, calc(100vw - 30px)); color: var(--text); box-shadow: 0 24px 70px rgba(16, 24, 40, .26); overscroll-behavior: contain; }
.modal::backdrop { background: rgba(15, 23, 42, .58); backdrop-filter: blur(2px); }
.modal-small { width: min(450px, calc(100vw - 30px)); }
.modal-content { padding: 24px; }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; border-bottom: 1px solid var(--border); padding-bottom: 16px; margin-bottom: 20px; }
.modal-header h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
.modal-help { color: var(--muted); line-height: 1.5; margin: -4px 0 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-span-2 { grid-column: 1 / -1; }
.modal-actions { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-top: 1px solid var(--border); padding-top: 18px; margin-top: 6px; }
.modal-actions-right, .modal-actions-end { display: flex; gap: 9px; margin-left: auto; }
.request-audit { background: var(--surface-muted); border: 1px solid var(--border); border-radius: 10px; padding: 12px; margin: 0 0 16px; color: var(--muted); font-size: 11px; line-height: 1.6; }

.toast-container {
  position: fixed;
  inset: 18px 18px auto auto;
  z-index: 2147483647;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: min(420px, calc(100vw - 36px));
  max-height: calc(100vh - 36px);
  margin: 0;
  padding: 0;
  border: 0;
  background: transparent;
  overflow: visible;
  pointer-events: none;
}
.toast-container[popover]:not(:popover-open) { display: none; }
.toast { width: 100%; min-width: 0; max-width: 420px; padding: 12px 14px; border-radius: 10px; color: #344054; background: white; border: 1px solid var(--border); box-shadow: var(--shadow-md); animation: toast-in .2s ease; font-size: 13px; pointer-events: auto; }
.toast.success { border-left: 4px solid #059669; }
.toast.error { border-left: 4px solid #dc2626; }
.toast.warning { border-left: 4px solid #d97706; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

.loading-card { height: 155px; border-radius: 11px; margin-bottom: 9px; background: linear-gradient(90deg, #e8ecf2 25%, #f4f6f8 50%, #e8ecf2 75%); background-size: 200% 100%; animation: shimmer 1.25s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

@media (max-width: 1180px) {
  .metrics-grid { grid-template-columns: repeat(2, 1fr); }
  .toolbar { flex-wrap: wrap; }
  .search-box { flex-basis: 100%; }
}
@media (max-width: 900px) {
  .login-view { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .mobile-logo { display: grid; place-items: center; width: 58px; height: 58px; margin-bottom: 25px; }
  .app-view { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: -260px; width: 248px; transition: left .2s ease; }
  .sidebar.open { left: 0; box-shadow: 20px 0 50px rgba(16,24,40,.25); }
  .mobile-menu { display: inline-grid; margin-right: 8px; vertical-align: middle; }
  .main-content { padding: 22px; }
}
@media (max-width: 640px) {
  .login-panel { padding: 22px; }
  .main-content { padding: 16px; }
  .topbar { align-items: flex-start; flex-direction: column; }
  .topbar-actions { width: 100%; }
  .topbar-actions .button { flex: 1; }
  .metrics-grid { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { padding: 12px; }
  .metric-icon { display: none; }
  .metric-card strong { font-size: 18px; }
  .toolbar .select-control { flex: 1; min-width: 140px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-span-2 { grid-column: auto; }
  .modal-content { padding: 18px; }
  .modal-actions { align-items: stretch; flex-direction: column-reverse; }
  .modal-actions-right { width: 100%; }
  .modal-actions-right .button { flex: 1; }
  .modal-actions > .button-danger { width: 100%; }
}

/* Campos dinâmicos de programação e cancelamento */
.modal { width: min(920px, calc(100vw - 30px)); max-height: calc(100vh - 30px); overflow-y: auto; }
.modal-small { width: min(450px, calc(100vw - 30px)); }
.dynamic-section { margin-top: 2px; }
.nested-grid { width: 100%; }
.form-section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 16px;
  padding: 14px 16px;
  border: 1px solid #dbe5f3;
  border-radius: 11px;
  background: #f8fbff;
}
.form-section-heading h3 { margin: 0; font-size: 15px; }
.form-section-heading .eyebrow { margin-bottom: 4px; }
.form-section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.demand-heading { margin-top: 4px; background: #faf9ff; border-color: #e7e2fb; }
.cancellation-heading { background: #fff9f8; border-color: #fee4e2; }
.button-small { padding: 8px 11px; font-size: 12px; }
.cancellation-entry {
  margin-bottom: 18px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fbfcfe;
}
.cancellation-entry-actions { display: flex; justify-content: flex-end; }
.cancellation-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 6px 0 12px;
}
.cancellation-list-heading h3 { margin: 0; font-size: 15px; }
.cancellation-list-heading .eyebrow { margin-bottom: 4px; }
.cancellation-list-count {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  color: #344054;
  background: #f2f4f7;
  font-size: 12px;
  font-weight: 800;
}
.cancellation-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 18px; }
.cancellation-empty-state {
  padding: 22px 18px;
  border: 1px dashed #cbd5e1;
  border-radius: 12px;
  color: var(--muted);
  background: #fbfcfe;
  text-align: center;
  font-size: 13px;
}
.cancellation-item { border: 1px solid var(--border); border-radius: 12px; background: #fbfcfe; padding: 14px; }
.cancellation-item-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.cancellation-item-header strong { font-size: 13px; }
.cancellation-item-data { display: grid; grid-template-columns: minmax(180px, .7fr) minmax(240px, 1.3fr); gap: 12px 18px; }
.cancellation-data-field { min-width: 0; }
.cancellation-data-field > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.cancellation-data-field > strong { display: block; overflow-wrap: anywhere; color: var(--text); font-size: 13px; }
.cancellation-reason-display { grid-column: 1 / -1; }
.cancellation-reason-display p { margin: 0; color: var(--text); font-size: 13px; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.remove-cancellation-item { border: 0; color: var(--danger); background: transparent; font-size: 12px; font-weight: 700; padding: 5px 7px; border-radius: 7px; }
.remove-cancellation-item:hover { background: var(--danger-soft); }
.button-copy { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }
.button-copy:hover { background: #dbeafe; }
.modal-actions-left { display: flex; align-items: center; gap: 9px; }
.card-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.card-copy-button { border: 0; border-radius: 7px; padding: 5px 7px; color: #1d4ed8; background: #eff6ff; font-size: 10px; font-weight: 800; }
.card-copy-button:hover { background: #dbeafe; }

@media (max-width: 640px) {
  .form-section-heading { flex-direction: column; }
  .form-section-heading .button { width: 100%; }
  .cancellation-entry-actions .button { width: 100%; }
  .cancellation-list-heading { align-items: flex-start; }
  .cancellation-item-data { grid-template-columns: 1fr; }
  .cancellation-reason-display { grid-column: auto; }
  .modal-actions-left { width: 100%; }
  .modal-actions-left .button { flex: 1; }
  .card-footer { align-items: flex-start; }
  .card-actions { flex-direction: column; align-items: flex-end; }
}


/* Cancelamento v3: um único cadastro fixo e somente a lista cresce */
.cancellation-entry-fixed {
  position: relative;
  border: 2px solid #c7d7fe;
  border-radius: 16px;
  background: #f7f9ff;
  padding: 18px;
  margin-bottom: 24px;
}
.fixed-entry-label {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #dbe4ff;
}
.fixed-entry-label > span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: white;
  font-weight: 800;
}
.fixed-entry-label strong,
.fixed-entry-label small { display: block; }
.fixed-entry-label strong { color: var(--text); font-size: 14px; }
.fixed-entry-label small { color: var(--muted); margin-top: 2px; }
.cancellation-list-heading p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }
.cancellation-empty-state {
  display: flex;
  flex-direction: column;
  gap: 5px;
  text-align: center;
  border: 1px dashed #b8c4da;
  background: #fafbfe;
  padding: 22px;
}
.cancellation-empty-state strong { color: var(--text); }
.cancellation-empty-state span { color: var(--muted); font-size: 13px; }
.cancellation-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: white;
}
.cancellation-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
  font-size: 13px;
}
.cancellation-table th {
  padding: 11px 12px;
  text-align: left;
  color: var(--muted);
  background: #f7f9fc;
  border-bottom: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.cancellation-table td {
  padding: 12px;
  vertical-align: top;
  border-bottom: 1px solid #edf0f5;
  color: var(--text);
}
.cancellation-table tbody tr:last-child td { border-bottom: 0; }
.cancellation-table tbody tr:hover { background: #fafcff; }
.cancellation-row-number { width: 36px; color: var(--muted) !important; font-weight: 800; }
.cancellation-row-reason { min-width: 250px; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.45; }
.cancellation-row-action { width: 76px; text-align: right; }
.cancellation-entry-actions .button { min-width: 230px; }
@media (max-width: 640px) {
  .cancellation-entry-fixed { padding: 14px; }
  .cancellation-entry-actions .button { width: 100%; min-width: 0; }
}


/* Central de ajuda */
.nav-divider { height: 1px; background: #344054; margin: 8px 10px; }
.help-modal {
  width: min(1080px, calc(100vw - 30px));
  max-height: calc(100dvh - 30px);
  overflow: hidden;
}
.help-modal-content {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: min(760px, calc(100dvh - 30px));
  max-height: calc(100dvh - 30px);
  padding: 0;
  overflow: hidden;
}
.help-modal-header { flex: 0 0 auto; padding: 24px 26px 18px; margin: 0; }
.help-modal-header p { max-width: 760px; margin: 7px 0 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.help-layout {
  display: grid;
  grid-template-columns: 245px minmax(0, 1fr);
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  overflow: hidden;
}
.help-menu { min-height: 0; padding: 18px 14px; background: #f7f9fc; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 7px; overflow-y: auto; }
.help-tab { width: 100%; border: 1px solid transparent; border-radius: 11px; background: transparent; color: #475467; padding: 11px; display: flex; align-items: center; gap: 10px; text-align: left; transition: .15s ease; }
.help-tab:hover { background: white; border-color: var(--border); }
.help-tab.active { color: #1d4ed8; background: white; border-color: #bfdbfe; box-shadow: var(--shadow-sm); }
.help-tab-icon { width: 31px; height: 31px; flex: 0 0 auto; border-radius: 9px; display: grid; place-items: center; background: #e9eef7; font-weight: 800; }
.help-tab.active .help-tab-icon { color: white; background: var(--primary); }
.help-tab strong, .help-tab small { display: block; }
.help-tab strong { font-size: 12px; }
.help-tab small { margin-top: 2px; color: #98a2b3; font-size: 10px; font-weight: 500; }
.help-content { min-width: 0; min-height: 0; padding: 24px 26px 30px; overflow-y: auto; overscroll-behavior: contain; background: white; }
.help-section { display: none; animation: helpFade .18s ease; }
.help-section.active { display: block; }
@keyframes helpFade { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.help-section-title { display: flex; align-items: center; gap: 13px; margin-bottom: 20px; }
.help-section-number { width: 42px; height: 42px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; color: #1d4ed8; background: #eff6ff; font-size: 12px; font-weight: 800; }
.help-section-title h3 { margin: 2px 0 0; font-size: 20px; letter-spacing: -.02em; }
.help-steps { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 11px; }
.help-step { display: flex; align-items: flex-start; gap: 11px; padding: 14px; border: 1px solid var(--border); border-radius: 12px; background: #fff; }
.help-step > span, .help-cancellation-flow article > span { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; color: white; background: var(--primary); font-size: 11px; font-weight: 800; }
.help-step strong, .help-step p, .help-cancellation-flow strong, .help-cancellation-flow p { display: block; }
.help-step strong, .help-cancellation-flow strong { font-size: 12px; }
.help-step p, .help-cancellation-flow p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.help-notice, .help-warning { margin-top: 16px; padding: 14px 16px; border-radius: 11px; }
.help-notice { color: #1e3a8a; background: #eff6ff; border: 1px solid #bfdbfe; }
.help-warning { color: #92400e; background: #fffbeb; border: 1px solid #fde68a; }
.help-notice strong, .help-warning strong { font-size: 12px; }
.help-notice p, .help-warning p { margin: 4px 0 0; font-size: 11px; line-height: 1.55; }
.help-card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; margin-top: 16px; }
.help-info-card { display: flex; align-items: flex-start; gap: 10px; padding: 13px; border: 1px solid var(--border); border-radius: 11px; }
.help-card-icon { width: 31px; height: 31px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 9px; font-weight: 800; }
.help-card-icon.blue { color: #2563eb; background: #eff6ff; }
.help-card-icon.purple { color: #7c3aed; background: #f5f3ff; }
.help-card-icon.green { color: #059669; background: #ecfdf5; }
.help-info-card strong { display: block; font-size: 11px; }
.help-info-card p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.help-form-block { margin-top: 14px; border: 1px solid var(--border); border-radius: 13px; overflow: hidden; }
.help-form-block-title { display: flex; align-items: center; gap: 10px; padding: 13px 15px; background: #f7f9fc; border-bottom: 1px solid var(--border); }
.help-form-block-title > span { width: 28px; height: 28px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 8px; color: #1d4ed8; background: #dbeafe; font-size: 11px; font-weight: 800; }
.help-form-block-title strong, .help-form-block-title small { display: block; }
.help-form-block-title strong { font-size: 12px; }
.help-form-block-title small { margin-top: 2px; color: var(--muted); font-size: 10px; }
.help-field-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.help-field-list.single-column { grid-template-columns: 1fr; }
.help-field-list > div { padding: 13px 15px; border-right: 1px solid #edf0f5; border-bottom: 1px solid #edf0f5; }
.help-field-list > div:nth-child(2n) { border-right: 0; }
.help-field-list.single-column > div { border-right: 0; }
.help-field-list > div:nth-last-child(-n+2) { border-bottom: 0; }
.help-field-list.single-column > div:last-child { border-bottom: 0; }
.help-field-list .help-field-wide { grid-column: 1 / -1; border-right: 0; }
.help-field-list strong { display: block; color: #344054; font-size: 11px; }
.help-field-list p { margin: 4px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.help-example { margin-top: 15px; padding: 15px; border-radius: 12px; color: #344054; background: #f8fafc; border-left: 4px solid #2563eb; }
.help-example-label { display: block; margin-bottom: 8px; color: #1d4ed8; font-size: 9px; font-weight: 800; letter-spacing: .06em; }
.help-example p { margin: 6px 0; font-size: 11px; line-height: 1.55; }
.help-cancellation-flow { display: grid; gap: 7px; }
.help-cancellation-flow article { display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px; border: 1px solid var(--border); border-radius: 11px; }
.help-flow-arrow { padding-left: 27px; color: #98a2b3; font-weight: 800; }
.help-status-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 14px; }
.help-status-grid article { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; border: 1px solid var(--border); border-radius: 11px; }
.help-status-grid .status-dot { flex: 0 0 auto; margin-top: 4px; }
.help-status-grid strong { display: block; font-size: 11px; }
.help-status-grid p { margin: 4px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.help-modal-actions { flex: 0 0 auto; position: relative; z-index: 2; margin: 0; padding: 14px 24px; background: #f7f9fc; }
.help-modal-actions > span { color: var(--muted); font-size: 11px; }

@media (max-width: 800px) {
  .help-layout { grid-template-columns: 1fr; max-height: none; }
  .help-menu { flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--border); padding: 10px; }
  .help-tab { min-width: 165px; }
  .help-content { padding: 20px 18px 26px; }
  .help-modal-header { padding: 20px 18px 16px; }
}
@media (max-width: 640px) {
  .topbar-actions { flex-wrap: wrap; }
  #top-help-button { display: none; }
  .help-steps, .help-card-grid, .help-status-grid, .help-field-list { grid-template-columns: 1fr; }
  .help-field-list > div, .help-field-list > div:nth-child(2n), .help-field-list > div:nth-last-child(-n+2) { border-right: 0; border-bottom: 1px solid #edf0f5; }
  .help-field-list > div:last-child { border-bottom: 0; }
  .help-modal-actions { align-items: stretch; flex-direction: column; }
  .help-modal-actions .button { width: 100%; }
}


/* Validação de CPF e CNPJ */
.cpf-cnpj-input.input-invalid {
  border-color: #dc2626;
  background: #fff7f7;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, .08);
}
.cpf-cnpj-input.input-valid { border-color: #16a34a; }


/* Validação visível de CPF/CNPJ */
.field-validation-message {
  display: block;
  min-height: 16px;
  margin-top: -2px;
  color: #b42318 !important;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.35;
  text-align: left !important;
}
.field-validation-message[hidden] { display: none; }
.cpf-cnpj-input.input-invalid:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 4px rgba(220, 38, 38, .10);
}

/* Anexos */
.attachment-field { margin-bottom: 20px; }
.attachment-picker {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px;
  border: 1px dashed #b9c3d3;
  border-radius: 11px;
  background: #f8fafc;
}
.attachment-picker-button { cursor: pointer; flex: 0 0 auto; }
.attachment-picker-button.disabled { opacity: .5; pointer-events: none; }
.attachment-picker-button.processing { opacity: .7; pointer-events: none; }
.attachment-picker-help strong, .attachment-picker-help small { display: block; }
.attachment-picker-help strong { color: #344054; font-size: 12px; }
.attachment-picker-help small { margin-top: 3px; color: var(--muted); font-size: 10px; text-align: left; }
.attachment-list { display: grid; gap: 8px; margin-top: 9px; }
.attachment-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: white;
}
.attachment-item.pending { background: #f8fbff; border-color: #bfdbfe; }
.attachment-icon {
  width: 36px;
  height: 36px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 9px;
  color: #1d4ed8;
  background: #eff6ff;
  font-size: 9px;
  font-weight: 800;
}
.attachment-info { flex: 1; min-width: 0; }
.attachment-info a, .attachment-info strong, .attachment-open-link {
  display: block;
  overflow: hidden;
  color: #344054;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.attachment-info a { color: #1d4ed8; text-decoration: none; }
.attachment-info a:hover { text-decoration: underline; }
.attachment-open-link { width: 100%; padding: 0; border: 0; background: transparent; color: #1d4ed8; cursor: pointer; text-align: left; }
.attachment-open-link:hover { text-decoration: underline; }
.attachment-open-link:disabled { cursor: wait; opacity: .65; }
.attachment-info small { display: block; margin-top: 3px; color: var(--muted); font-size: 10px; text-align: left; }
.attachment-empty { padding: 10px 12px; border-radius: 9px; color: var(--muted); background: #f8fafc; font-size: 11px; }
.attachment-counter { color: var(--muted); font-size: 10px; font-weight: 700; text-align: right; }
.tag.attachment { color: #475467; background: #f2f4f7; }

/* Confirmação de exclusão */
.confirm-dialog-content { padding: 27px; text-align: center; }
.confirm-dialog-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #b42318;
  background: #fee4e2;
  border: 8px solid #fef3f2;
  font-size: 25px;
  font-weight: 800;
}
.confirm-dialog-copy h2 { margin: 5px 0 8px; font-size: 23px; }
.confirm-dialog-copy p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.confirm-dialog-warning {
  margin-top: 18px;
  padding: 13px 14px;
  border: 1px solid #fecdca;
  border-radius: 10px;
  color: #912018;
  background: #fef3f2;
  text-align: left;
}
.confirm-dialog-warning strong, .confirm-dialog-warning span { display: block; }
.confirm-dialog-warning strong { font-size: 12px; }
.confirm-dialog-warning span { margin-top: 3px; font-size: 10px; line-height: 1.5; }
.confirm-dialog-actions { justify-content: center; margin-top: 20px; }

@media (max-width: 640px) {
  .attachment-picker { align-items: stretch; flex-direction: column; }
  .attachment-picker-button { width: 100%; }
  .confirm-dialog-actions { flex-direction: column-reverse; }
  .confirm-dialog-actions .button { width: 100%; }
}


/* Telefone com DDD: feedback visual para fixo e celular */
.phone-input.input-invalid {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.12);
}

.phone-input.input-valid {
  border-color: #16a34a;
}

.phone-input.input-invalid:focus {
  border-color: #dc2626;
  box-shadow: 0 0 0 3px rgba(220, 38, 38, 0.16);
}

/* ==============================
   Administracao de usuarios v10
   ============================== */
.app-section { min-width: 0; }
.metric-icon.gray { color: #475467; background: #f2f4f7; }

.invite-loading {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface-muted);
  text-align: center;
  font-size: 13px;
}
.invite-role-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 10px;
  background: #eff6ff;
}
.invite-role-summary span { color: #475467; font-size: 12px; }
.invite-role-summary strong { color: #1d4ed8; font-size: 13px; }
.invite-back-button { display: block; margin: 18px auto 0; }

.user-metrics-grid { grid-template-columns: repeat(4, minmax(170px, 1fr)); }
.users-toolbar { margin-bottom: 16px; }
.users-panel {
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: white;
  box-shadow: var(--shadow-sm);
}
.users-table-wrap { overflow-x: auto; }
.users-table { width: 100%; border-collapse: collapse; min-width: 860px; }
.users-table th {
  padding: 13px 16px;
  color: #667085;
  background: #f8fafc;
  border-bottom: 1px solid var(--border);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .05em;
  text-align: left;
  text-transform: uppercase;
}
.users-table td {
  padding: 15px 16px;
  border-bottom: 1px solid #edf0f5;
  vertical-align: middle;
}
.users-table tbody tr:last-child td { border-bottom: 0; }
.users-table tbody tr:hover { background: #fafcff; }
.user-identity { display: flex; align-items: center; gap: 11px; min-width: 220px; }
.user-list-avatar {
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: linear-gradient(135deg, #7c3aed, #2563eb);
  font-size: 12px;
  font-weight: 800;
}
.user-list-avatar.pending { color: #92400e; background: #fef3c7; }
.user-identity strong, .user-identity span { display: block; }
.user-identity strong { color: #344054; font-size: 13px; }
.user-identity span { max-width: 300px; margin-top: 3px; color: var(--muted); font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role-badge, .user-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 10px;
  font-weight: 800;
  white-space: nowrap;
}
.user-role-badge.admin { color: #5b21b6; background: #f5f3ff; }
.user-role-badge.solicitante { color: #1d4ed8; background: #eff6ff; }
.user-status-badge.active { color: #047857; background: #ecfdf5; }
.user-status-badge.inactive { color: #b42318; background: #fef3f2; }
.user-status-badge.pending { color: #92400e; background: #fffbeb; }
.user-date { color: #667085; font-size: 11px; line-height: 1.45; }
.user-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; min-width: 255px; }
.user-action-button {
  border: 1px solid #d0d5dd;
  border-radius: 8px;
  padding: 7px 9px;
  color: #344054;
  background: white;
  font-size: 10px;
  font-weight: 700;
}
.user-action-button:hover { border-color: #98a2b3; background: #f9fafb; }
.user-action-button.danger { color: #b42318; border-color: #fecdca; background: #fffafa; }
.user-action-button.success { color: #047857; border-color: #a6f4c5; background: #f6fef9; }
.user-action-button.primary { color: #1d4ed8; border-color: #bfdbfe; background: #f8fbff; }
.user-action-button:disabled { opacity: .45; cursor: not-allowed; }
.users-empty-state { padding: 52px 20px; text-align: center; }
.users-empty-state > div { width: 52px; height: 52px; margin: 0 auto 12px; display: grid; place-items: center; border-radius: 14px; color: #2563eb; background: #eff6ff; font-size: 24px; }
.users-empty-state h2 { margin: 0; font-size: 18px; }
.users-empty-state p { margin: 7px 0 0; color: var(--muted); font-size: 12px; }

.user-dialog .modal-content { max-width: 520px; }
.invite-result { text-align: center; }
.invite-success-icon {
  width: 54px;
  height: 54px;
  margin: 0 auto 13px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--success);
  font-size: 24px;
  font-weight: 800;
}
.invite-result h3 { margin: 0 0 6px; font-size: 22px; }
.invite-result > p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.invite-result .field { text-align: left; }
.invite-result input { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 11px; }
.invite-expiration { margin: -4px 0 18px; color: var(--muted); font-size: 11px; }
.user-self-note { margin: -5px 0 16px; padding: 10px 12px; color: #1e3a8a; background: #eff6ff; border: 1px solid #bfdbfe; border-radius: 9px; font-size: 11px; line-height: 1.5; }

@media (max-width: 1100px) {
  .user-metrics-grid { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
}
@media (max-width: 760px) {
  .users-toolbar { align-items: stretch; flex-direction: column; }
  .users-toolbar .select-control { width: 100%; }
  .user-metrics-grid { grid-template-columns: 1fr; }
  .users-table { min-width: 760px; }
}

/* Versão 11: TEF Elgin e alteração de senha */
.tag.tef_elgin { color: #0f766e; background: #ecfdf5; }
.tef-heading { background: #f0fdfa; border-color: #99f6e4; }
.field > span small { font-weight: 500; color: #667085; }
.check-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #475467;
  font-size: 13px;
  margin: 2px 0 8px;
}
.check-row input { accent-color: var(--primary); }
.password-show-row { width: fit-content; }

/* Controle individual de cancelamentos realizados no CRM */
.tag.crm-progress { color: #9a3412; background: #fff7ed; }
.tag.crm-progress.complete { color: #027a48; background: #ecfdf3; }
.cancellation-table { min-width: 980px; }
.cancellation-list-row.crm-cancelled { background: #f6fef9; }
.cancellation-list-row.crm-cancelled:hover { background: #ecfdf3; }
.cancellation-list-row.crm-cancelled .cancellation-row-number { color: #039855 !important; }
.cancellation-row-crm { min-width: 205px; }
.crm-status-control {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  padding: 6px 10px;
  border: 1px solid #d0d5dd;
  border-radius: 9px;
  background: #fff;
  color: #475467;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  user-select: none;
  transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
}
.crm-status-control:hover { border-color: #98a2b3; box-shadow: 0 1px 3px rgba(16, 24, 40, .08); }
.crm-status-control.checked { border-color: #75e0a7; background: #ecfdf3; color: #027a48; }
.crm-status-control input { width: 16px; height: 16px; margin: 0; accent-color: #12b76a; cursor: pointer; }
.crm-status-control input:disabled { cursor: wait; }
.crm-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}
.crm-status-badge.complete { color: #027a48; background: #ecfdf3; }
.crm-status-badge.pending { color: #b54708; background: #fffaeb; }
.crm-status-meta { display: block; margin-top: 5px; color: #667085; font-size: 10px; line-height: 1.35; }


/* Versão 13: lista de cancelamentos sem rolagem horizontal */
.cancellation-table-wrap {
  overflow-x: hidden;
}
.cancellation-table {
  width: 100%;
  min-width: 0;
  table-layout: fixed;
}
.cancellation-table th,
.cancellation-table td {
  min-width: 0;
  overflow-wrap: anywhere;
  word-break: normal;
}
.cancellation-table th:nth-child(1),
.cancellation-table td:nth-child(1) { width: 4%; }
.cancellation-table th:nth-child(2),
.cancellation-table td:nth-child(2) { width: 16%; }
.cancellation-table th:nth-child(3),
.cancellation-table td:nth-child(3) { width: 19%; }
.cancellation-table th:nth-child(4),
.cancellation-table td:nth-child(4) { width: 29%; }
.cancellation-table th:nth-child(5),
.cancellation-table td:nth-child(5) { width: 24%; }
.cancellation-table th:nth-child(6),
.cancellation-table td:nth-child(6) { width: 8%; }
.cancellation-row-reason,
.cancellation-row-crm {
  min-width: 0;
}
.crm-status-control {
  width: 100%;
  box-sizing: border-box;
  align-items: flex-start;
  white-space: normal;
}
.crm-status-control span {
  min-width: 0;
  line-height: 1.25;
}
.cancellation-row-action {
  width: auto;
  padding-left: 6px !important;
  padding-right: 6px !important;
}
.remove-cancellation-item {
  max-width: 100%;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .cancellation-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }
  .cancellation-table,
  .cancellation-table tbody,
  .cancellation-table tr,
  .cancellation-table td {
    display: block;
    width: 100% !important;
  }
  .cancellation-table thead {
    display: none;
  }
  .cancellation-table tbody {
    display: grid;
    gap: 12px;
  }
  .cancellation-table .cancellation-list-row {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
  }
  .cancellation-table .cancellation-list-row.crm-cancelled {
    background: #f6fef9;
  }
  .cancellation-table td {
    display: grid;
    grid-template-columns: minmax(105px, 34%) 1fr;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid #edf0f5;
    text-align: left;
  }
  .cancellation-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
  }
  .cancellation-table td:last-child {
    border-bottom: 0;
  }
  .cancellation-row-number {
    color: var(--text) !important;
  }
  .cancellation-row-action {
    padding: 10px 12px !important;
  }
  .crm-status-control {
    width: fit-content;
    max-width: 100%;
  }
}


/* Versao 14: modal de cancelamentos amplo e tabela sem compressao */
#request-dialog.request-dialog-cancellation {
  width: min(1280px, calc(100vw - 36px));
}

#request-dialog.request-dialog-cancellation .modal-content {
  padding-left: 28px;
  padding-right: 28px;
}

#request-dialog.request-dialog-cancellation .cancellation-table-wrap {
  overflow-x: visible;
}

#request-dialog.request-dialog-cancellation .cancellation-table {
  width: 100%;
  min-width: 0;
  table-layout: auto;
}

#request-dialog.request-dialog-cancellation .cancellation-table th,
#request-dialog.request-dialog-cancellation .cancellation-table td {
  overflow-wrap: normal;
  word-break: normal;
}

#request-dialog.request-dialog-cancellation .cancellation-table th:nth-child(1),
#request-dialog.request-dialog-cancellation .cancellation-table td:nth-child(1) {
  width: 44px;
}

#request-dialog.request-dialog-cancellation .cancellation-table th:nth-child(2),
#request-dialog.request-dialog-cancellation .cancellation-table td:nth-child(2) {
  width: 168px;
  white-space: nowrap;
}

#request-dialog.request-dialog-cancellation .cancellation-table th:nth-child(3),
#request-dialog.request-dialog-cancellation .cancellation-table td:nth-child(3) {
  width: 190px;
}

#request-dialog.request-dialog-cancellation .cancellation-table th:nth-child(4),
#request-dialog.request-dialog-cancellation .cancellation-table td:nth-child(4) {
  min-width: 300px;
}

#request-dialog.request-dialog-cancellation .cancellation-table th:nth-child(5),
#request-dialog.request-dialog-cancellation .cancellation-table td:nth-child(5) {
  width: 230px;
  min-width: 230px;
}

#request-dialog.request-dialog-cancellation .cancellation-table th:nth-child(6),
#request-dialog.request-dialog-cancellation .cancellation-table td:nth-child(6) {
  width: 104px;
  min-width: 104px;
}

#request-dialog.request-dialog-cancellation .crm-status-control {
  width: 100%;
  align-items: center;
  white-space: nowrap;
}

#request-dialog.request-dialog-cancellation .crm-status-control span {
  white-space: nowrap;
  line-height: 1.2;
}

#request-dialog.request-dialog-cancellation .cancellation-row-action {
  padding-left: 10px !important;
  padding-right: 10px !important;
  text-align: center;
}

#request-dialog.request-dialog-cancellation .remove-cancellation-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 84px;
  max-width: none;
  padding: 7px 10px;
  border: 1px solid #fda29b;
  border-radius: 8px;
  color: #b42318;
  background: #fff;
  white-space: nowrap;
  overflow-wrap: normal;
  line-height: 1;
}

#request-dialog.request-dialog-cancellation .remove-cancellation-item:hover {
  border-color: #f97066;
  background: #fef3f2;
}

@media (max-width: 1080px) {
  #request-dialog.request-dialog-cancellation {
    width: min(920px, calc(100vw - 24px));
  }

  #request-dialog.request-dialog-cancellation .modal-content {
    padding-left: 20px;
    padding-right: 20px;
  }

  #request-dialog.request-dialog-cancellation .cancellation-table-wrap {
    overflow: visible;
    border: 0;
    background: transparent;
  }

  #request-dialog.request-dialog-cancellation .cancellation-table,
  #request-dialog.request-dialog-cancellation .cancellation-table tbody,
  #request-dialog.request-dialog-cancellation .cancellation-table tr,
  #request-dialog.request-dialog-cancellation .cancellation-table td {
    display: block;
    width: 100% !important;
    min-width: 0 !important;
  }

  #request-dialog.request-dialog-cancellation .cancellation-table thead {
    display: none;
  }

  #request-dialog.request-dialog-cancellation .cancellation-table tbody {
    display: grid;
    gap: 12px;
  }

  #request-dialog.request-dialog-cancellation .cancellation-table .cancellation-list-row {
    overflow: hidden;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;
  }

  #request-dialog.request-dialog-cancellation .cancellation-table .cancellation-list-row.crm-cancelled {
    background: #f6fef9;
  }

  #request-dialog.request-dialog-cancellation .cancellation-table td {
    display: grid;
    grid-template-columns: minmax(125px, 30%) 1fr;
    gap: 12px;
    padding: 11px 14px;
    border-bottom: 1px solid #edf0f5;
    text-align: left;
    white-space: normal;
  }

  #request-dialog.request-dialog-cancellation .cancellation-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 10px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .04em;
  }

  #request-dialog.request-dialog-cancellation .cancellation-table td:last-child {
    border-bottom: 0;
  }

  #request-dialog.request-dialog-cancellation .crm-status-control {
    width: fit-content;
    max-width: 100%;
  }

  #request-dialog.request-dialog-cancellation .cancellation-row-action {
    padding: 11px 14px !important;
    text-align: left;
  }
}


/* Versao 16: impede que o scroll do modal movimente a pagina ao fundo */
dialog[open] {
  overscroll-behavior: contain;
}

.modal-content,
.help-modal-content,
#request-dialog .modal-content {
  overscroll-behavior-y: contain;
}

/* =========================================================
   Versao 17: rolagem independente em cada coluna do Kanban
   ========================================================= */
@media (min-width: 901px) {
  .app-view {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
  }

  .main-content {
    height: 100vh;
    min-height: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
  }

  #kanban-view:not([hidden]) {
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    flex-direction: column;
  }

  #kanban-view > .topbar,
  #kanban-view > .metrics-grid,
  #kanban-view > .toolbar {
    flex: 0 0 auto;
  }

  #kanban-view > .kanban-board {
    flex: 1 1 auto;
    min-height: 0;
    align-items: stretch;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 0;
  }

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

  #kanban-view .kanban-column > header {
    flex: 0 0 auto;
  }

  #kanban-view .column-body {
    flex: 1 1 auto;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
  }

  #users-view:not([hidden]) {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

/* Scroll discreto e individual em cada etapa. */
.column-body {
  scrollbar-width: thin;
  scrollbar-color: #b8c1cf transparent;
}

.column-body::-webkit-scrollbar {
  width: 8px;
}

.column-body::-webkit-scrollbar-track {
  background: transparent;
}

.column-body::-webkit-scrollbar-thumb {
  background: #b8c1cf;
  border: 2px solid #eef1f6;
  border-radius: 999px;
}

.column-body::-webkit-scrollbar-thumb:hover {
  background: #98a2b3;
}


/* =========================================================
   Versao 18: identificacao automatica da versao publicada
   ========================================================= */
.sidebar-footer {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.app-version-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
  padding: 10px 11px;
  border: 1px solid #344054;
  border-radius: 10px;
  color: #d0d5dd;
  background: rgba(255,255,255,.035);
  cursor: help;
}

.app-version-main {
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.app-version-main span {
  color: #98a2b3;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .09em;
}

.app-version-main strong {
  color: #fff;
  font-size: 12px;
  white-space: nowrap;
}

.app-version-details {
  min-width: 0;
  overflow: hidden;
  color: #98a2b3;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* =========================================================
   Versao 19: bloqueio, comentarios, notificacoes e gestao
   ========================================================= */

.kanban-board { grid-template-columns: repeat(5, minmax(245px, 1fr)); }
.status-dot.blocked { background: #dc2626; }
.tag.comments { color: #155eef; background: #eff6ff; }
.tag.blocked { color: #b42318; background: #fef3f2; }
.metric-icon.red { color: #b42318; background: #fef3f2; }

.notification-anchor { position: relative; }
.notification-button { position: relative; }
.notification-badge {
  display: inline-grid;
  min-width: 19px;
  height: 19px;
  place-items: center;
  margin-left: 4px;
  padding: 0 5px;
  border-radius: 999px;
  color: white;
  background: #dc2626;
  font-size: 9px;
  font-weight: 800;
}
.notification-popover {
  position: fixed;
  z-index: 950;
  top: 78px;
  right: 30px;
  width: min(390px, calc(100vw - 24px));
  max-height: min(620px, calc(100vh - 105px));
  overflow: hidden;
  border: 1px solid var(--border);
  border-radius: 15px;
  background: white;
  box-shadow: 0 22px 55px rgba(16, 24, 40, .22);
}
.notification-popover > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 17px;
  border-bottom: 1px solid var(--border);
}
.notification-popover h2 { margin: 2px 0 0; font-size: 18px; }
.notification-list { max-height: 470px; overflow-y: auto; overscroll-behavior: contain; }
.notification-item {
  width: 100%;
  display: flex;
  gap: 10px;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid #eef1f5;
  background: white;
  text-align: left;
}
.notification-item:hover { background: #f8fafc; }
.notification-item.unread { background: #f5f8ff; }
.notification-dot { width: 8px; height: 8px; flex: 0 0 auto; margin-top: 5px; border-radius: 50%; background: transparent; }
.notification-item.unread .notification-dot { background: #2563eb; }
.notification-copy { min-width: 0; }
.notification-copy strong, .notification-copy span, .notification-copy small { display: block; }
.notification-copy strong { color: #101828; font-size: 12px; }
.notification-copy span { margin-top: 4px; color: #475467; font-size: 11px; line-height: 1.45; }
.notification-copy small { margin-top: 6px; color: #98a2b3; font-size: 9px; }
.notification-empty { padding: 40px 22px; text-align: center; }
.notification-empty strong, .notification-empty span { display: block; }
.notification-empty strong { font-size: 13px; }
.notification-empty span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.notification-footer-button {
  width: 100%;
  padding: 12px;
  border: 0;
  border-top: 1px solid var(--border);
  color: #2563eb;
  background: white;
  font-size: 11px;
  font-weight: 700;
}
.notification-footer-button:disabled { color: #98a2b3; cursor: default; }

.request-tabs {
  display: flex;
  gap: 8px;
  margin: -4px 0 20px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.request-tab {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 14px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #667085;
  background: transparent;
  font-size: 12px;
  font-weight: 700;
}
.request-tab:hover:not(:disabled) { color: #344054; background: #f8fafc; }
.request-tab.active { color: #1d4ed8; border-color: #bfdbfe; background: #eff6ff; }
.request-tab:disabled { opacity: .5; cursor: not-allowed; }
.request-tab-count { display: inline-grid; min-width: 20px; height: 20px; place-items: center; padding: 0 5px; border-radius: 999px; color: #475467; background: #e8edf5; font-size: 9px; }
.request-tab.active .request-tab-count { color: #1d4ed8; background: white; }
.request-tab-panel[hidden] { display: none !important; }
.comments-panel { min-height: 480px; }
.comments-header { margin-bottom: 15px; }
.comments-header h3 { margin: 3px 0 0; font-size: 18px; }
.comments-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.comments-list {
  max-height: 390px;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 4px 2px 4px 0;
  scrollbar-width: thin;
}
.comment-item { display: flex; gap: 10px; margin-bottom: 12px; }
.comment-avatar { width: 32px; height: 32px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: white; background: #475467; font-size: 9px; font-weight: 800; }
.comment-item.own .comment-avatar { background: #2563eb; }
.comment-body { flex: 1; min-width: 0; padding: 11px 13px; border: 1px solid var(--border); border-radius: 12px; background: #f8fafc; }
.comment-item.own .comment-body { border-color: #bfdbfe; background: #f8fbff; }
.comment-body header { display: flex; justify-content: space-between; gap: 12px; }
.comment-body header strong { color: #344054; font-size: 11px; }
.comment-body header span { color: #98a2b3; font-size: 9px; white-space: nowrap; }
.comment-body p { margin: 8px 0 0; color: #344054; font-size: 12px; line-height: 1.55; }
.comment-mention { margin-top: 9px; padding-top: 8px; border-top: 1px solid #e4e7ec; color: #2563eb; font-size: 9px; }
.comments-empty { padding: 55px 20px; border: 1px dashed #cbd5e1; border-radius: 12px; text-align: center; }
.comments-empty strong, .comments-empty span { display: block; }
.comments-empty strong { font-size: 13px; }
.comments-empty span { margin-top: 5px; color: var(--muted); font-size: 11px; }
.comment-composer { margin-top: 16px; padding: 16px; border: 1px solid var(--border); border-radius: 13px; background: white; }
.comment-composer .field { margin-bottom: 12px; }
.comment-actions { display: flex; justify-content: flex-end; }

.reports-toolbar { align-items: flex-end; }
.compact-field { display: flex; flex-direction: column; gap: 5px; color: #475467; font-size: 10px; font-weight: 700; }
.compact-field input { min-width: 145px; padding: 10px 12px; border: 1px solid #d0d5dd; border-radius: 10px; color: #101828; -webkit-text-fill-color: #101828; background: white; font-weight: 600; color-scheme: light; }
.compact-field input[type="date"]::-webkit-datetime-edit,
.compact-field input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.compact-field input[type="date"]::-webkit-datetime-edit-text,
.compact-field input[type="date"]::-webkit-datetime-edit-month-field,
.compact-field input[type="date"]::-webkit-datetime-edit-day-field,
.compact-field input[type="date"]::-webkit-datetime-edit-year-field { color: inherit; }
.compact-field input[type="date"]::-webkit-calendar-picker-indicator { cursor: pointer; opacity: .8; }
.indicator-metrics-grid { grid-template-columns: repeat(3, minmax(170px, 1fr)); }
.reports-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; padding-bottom: 20px; }
.report-card { border: 1px solid var(--border); border-radius: 14px; background: white; box-shadow: var(--shadow-sm); overflow: hidden; }
.report-card > header { padding: 17px 18px; border-bottom: 1px solid var(--border); }
.report-card h2 { margin: 3px 0 0; font-size: 16px; }
.report-card-wide { grid-column: 1 / -1; }
.report-bars { padding: 17px 18px; }
.report-bar-row { margin-bottom: 17px; }
.report-bar-row:last-child { margin-bottom: 0; }
.report-bar-label { display: flex; justify-content: space-between; gap: 12px; color: #344054; font-size: 11px; }
.report-bar-track { height: 9px; margin-top: 7px; overflow: hidden; border-radius: 99px; background: #eef2f6; }
.report-bar-track span { display: block; min-width: 2px; height: 100%; border-radius: inherit; background: #2563eb; }
.report-bar-track span.green { background: #059669; }
.report-bar-track span.red { background: #dc2626; }
.report-bar-track span.amber { background: #d97706; }
.report-bar-track span.purple { background: #7c3aed; }
.report-bar-row small { display: block; margin-top: 5px; color: #98a2b3; font-size: 9px; }
.report-table-wrap { overflow-x: auto; }
.report-table { width: 100%; border-collapse: collapse; min-width: 650px; }
.report-table th, .report-table td { padding: 13px 17px; border-bottom: 1px solid #eef1f5; text-align: left; font-size: 11px; }
.report-table th { color: #667085; background: #f8fafc; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; }
.report-table tbody tr:last-child td { border-bottom: 0; }
.report-empty-row { padding: 35px !important; color: #98a2b3; text-align: center !important; }

.archived-panel { overflow: hidden; border: 1px solid var(--border); border-radius: 14px; background: white; box-shadow: var(--shadow-sm); }
.archived-table-wrap { overflow-x: auto; }
.archived-table { width: 100%; min-width: 980px; border-collapse: collapse; }
.archived-table th { padding: 13px 15px; color: #667085; background: #f8fafc; border-bottom: 1px solid var(--border); font-size: 9px; text-align: left; text-transform: uppercase; letter-spacing: .05em; }
.archived-table td { padding: 14px 15px; border-bottom: 1px solid #eef1f5; color: #475467; font-size: 11px; vertical-align: middle; }
.archived-table tbody tr:last-child td { border-bottom: 0; }
.archived-title strong, .archived-title span { display: block; }
.archived-title strong { color: #101828; font-size: 12px; }
.archived-title span { max-width: 360px; margin-top: 4px; color: #667085; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.archived-actions { display: flex; gap: 6px; }
.archive-icon { color: #1d4ed8 !important; background: #eff6ff !important; }

@media (min-width: 901px) {
  #indicators-view:not([hidden]),
  #archived-view:not([hidden]) {
    height: 100%;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

@media (max-width: 1180px) {
  .indicator-metrics-grid { grid-template-columns: repeat(2, minmax(170px, 1fr)); }
}

@media (max-width: 760px) {
  .notification-popover { top: 68px; right: 12px; }
  .reports-toolbar, .archived-toolbar { align-items: stretch; flex-direction: column; }
  .reports-toolbar .select-control, .archived-toolbar .select-control, .compact-field input { width: 100%; }
  .reports-grid { grid-template-columns: 1fr; }
  .report-card-wide { grid-column: auto; }
  .indicator-metrics-grid { grid-template-columns: 1fr 1fr; }
  .request-tabs { position: sticky; top: -18px; z-index: 5; padding-top: 8px; background: white; }
  .comment-body header { align-items: flex-start; flex-direction: column; gap: 3px; }
}

/* =========================================================
   Versao 21: correcao do selo da solicitacao mais antiga
   ========================================================= */
/* O selo ficava parcialmente escondido pelo limite da coluna com scroll. */
.request-card.oldest {
  padding-top: 31px;
}

.request-card.oldest::before {
  top: 9px;
  right: 12px;
  z-index: 3;
}


/* =========================================================
   Versao 25: modo de visualizacao ampliada somente do Kanban
   ========================================================= */
.kanban-expand-button {
  width: 44px;
  min-width: 44px;
  padding-inline: 0;
  font-size: 18px;
}

.kanban-focus-header {
  display: none;
}

body.kanban-focus-mode {
  overflow: hidden;
}

body.kanban-focus-mode .app-view {
  display: block;
  width: 100vw;
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

body.kanban-focus-mode .sidebar {
  display: none !important;
}

body.kanban-focus-mode .main-content {
  width: 100vw;
  height: 100vh;
  padding: 0;
  overflow: hidden;
}

body.kanban-focus-mode #kanban-view:not([hidden]) {
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  background: #f5f7fb;
}

body.kanban-focus-mode #kanban-view > .topbar,
body.kanban-focus-mode #kanban-view > .metrics-grid,
body.kanban-focus-mode #kanban-view > .toolbar,
body.kanban-focus-mode #empty-state {
  display: none !important;
}

body.kanban-focus-mode .kanban-focus-header {
  flex: 0 0 58px;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 8px 16px;
  color: white;
  background: linear-gradient(90deg, #174f8f, #2563a8);
  box-shadow: 0 2px 8px rgba(16, 24, 40, .16);
  z-index: 5;
}

.kanban-focus-title {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.kanban-focus-title img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.kanban-focus-title strong,
.kanban-focus-title span {
  display: block;
}

.kanban-focus-title strong {
  font-size: 15px;
}

.kanban-focus-title span {
  margin-top: 2px;
  color: rgba(255,255,255,.76);
  font-size: 11px;
}

.kanban-focus-exit {
  flex: 0 0 auto;
  border: 1px solid rgba(255,255,255,.55);
  border-radius: 8px;
  padding: 8px 12px;
  color: white;
  background: rgba(255,255,255,.10);
  font-weight: 700;
}

.kanban-focus-exit:hover {
  background: rgba(255,255,255,.20);
}

body.kanban-focus-mode #kanban-board {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  padding: 12px;
  gap: 12px;
  grid-template-columns: repeat(5, minmax(270px, 1fr));
  align-items: stretch;
  overflow-x: auto;
  overflow-y: hidden;
  background: #f5f7fb;
  scrollbar-gutter: stable;
}

body.kanban-focus-mode #kanban-board .kanban-column {
  height: 100%;
  min-height: 0;
  min-width: 270px;
  border-radius: 10px;
  display: flex;
  flex-direction: column;
}

body.kanban-focus-mode #kanban-board .kanban-column > header {
  flex: 0 0 auto;
  padding: 13px 13px 10px;
  background: #eef1f6;
}

body.kanban-focus-mode #kanban-board .column-body {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
}

@media (max-width: 900px) {
  .kanban-expand-button {
    width: 42px;
    min-width: 42px;
  }

  body.kanban-focus-mode .kanban-focus-header {
    min-height: 54px;
    padding: 7px 10px;
  }

  .kanban-focus-title span {
    display: none;
  }

  .kanban-focus-exit {
    padding: 8px 10px;
    font-size: 12px;
  }

  body.kanban-focus-mode #kanban-board {
    padding: 9px;
    grid-template-columns: repeat(5, minmax(285px, 88vw));
  }
}

/* ===== Versão 26: produtividade, segurança e tema ===== */
.compact-button { padding: 9px 12px; }
.saved-filter-select { min-width: 160px; }
.bulk-actions-bar {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  margin: -4px 0 14px; padding: 12px 14px; border: 1px solid #bfdbfe;
  border-radius: 12px; background: #eff6ff;
}
.bulk-actions-bar > div { margin-right: auto; }
.bulk-actions-bar strong, .bulk-actions-bar span { display: block; }
.bulk-actions-bar span { margin-top: 2px; font-size: 12px; color: var(--muted); }
.bulk-card-check {
  display: flex; align-items: center; gap: 6px; margin: -2px 0 8px; padding: 7px 9px;
  border: 1px solid #bfdbfe; border-radius: 8px; background: #eff6ff; font-size: 11px; font-weight: 700;
}
.bulk-card-check input { accent-color: var(--primary); }
.request-card.bulk-selected { outline: 3px solid rgba(37,99,235,.28); border-color: #3b82f6; }
.tag.squad { color: #075985; background: #e0f2fe; border-color: #bae6fd; }
:root[data-theme="dark"] .tag.squad { color: #bae6fd; background: #0c4a6e; border-color: #0369a1; }
.tag.paused { color: #9a3412; background: #ffedd5; }
.inline-field-row { display: flex; gap: 8px; align-items: stretch; }
.inline-field-row select { flex: 1; }
.history-list { display: flex; flex-direction: column; gap: 12px; max-height: 56vh; overflow-y: auto; padding: 4px; }
.history-item { display: grid; grid-template-columns: 34px minmax(0,1fr); gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface); }
.history-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: var(--primary); background: var(--primary-soft); font-weight: 800; }
.history-copy header { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; }
.history-copy header span { color: var(--muted); }
.history-copy p { margin: 6px 0 0; color: var(--text); font-size: 13px; line-height: 1.5; }
.template-list { display: flex; flex-direction: column; gap: 8px; margin-top: 16px; max-height: 320px; overflow-y: auto; }
.template-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-muted); }
.template-item p { margin: 4px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.comparison-list { display: grid; gap: 10px; }
.comparison-row { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; }
.comparison-row small { grid-column: 1/-1; color: var(--muted); }
.security-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 16px; }
.security-grid .report-card-wide { grid-column: 1/-1; }
.security-copy { padding: 17px 18px 18px; color: var(--muted); line-height: 1.6; }
.security-copy p { margin: 0 0 12px; }
.security-copy p:last-child { margin-bottom: 0; }
.shortcut-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.shortcut-grid > div { display: flex; align-items: center; gap: 10px; padding: 9px; border: 1px solid var(--border); border-radius: 9px; }
kbd { min-width: 68px; padding: 4px 7px; border: 1px solid #cbd5e1; border-bottom-width: 2px; border-radius: 6px; background: var(--surface-muted); text-align: center; font-family: inherit; font-size: 11px; font-weight: 800; }
.metric-icon.cyan { color: #0369a1; background: #e0f2fe; }
.button.active { color: white; border-color: var(--primary); background: var(--primary); }

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1220;
  --surface: #111b2e;
  --surface-muted: #162238;
  --text: #e5edf8;
  --muted: #9aa9bf;
  --border: #26354c;
  --primary-soft: #172c52;
  --danger-soft: #3b1820;
  --warning-soft: #3a2a0d;
  --success-soft: #0e3329;
  --sidebar: #07101f;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.25);
  --shadow-md: 0 12px 28px rgba(0,0,0,.34);
}
:root[data-theme="dark"] body,
:root[data-theme="dark"] .main-content,
:root[data-theme="dark"] .login-panel { background: var(--bg); color: var(--text); }
:root[data-theme="dark"] .login-view,
:root[data-theme="dark"] .metric-card,
:root[data-theme="dark"] .toolbar,
:root[data-theme="dark"] .kanban-column,
:root[data-theme="dark"] .request-card,
:root[data-theme="dark"] .modal-content,
:root[data-theme="dark"] .report-card,
:root[data-theme="dark"] .users-panel,
:root[data-theme="dark"] .archived-panel,
:root[data-theme="dark"] .notification-popover { background: var(--surface); color: var(--text); border-color: var(--border); }
:root[data-theme="dark"] .kanban-column > header,
:root[data-theme="dark"] .column-body,
:root[data-theme="dark"] .column-empty,
:root[data-theme="dark"] .request-audit,
:root[data-theme="dark"] .help-form-block,
:root[data-theme="dark"] .help-info-card { background: var(--surface-muted); border-color: var(--border); }
:root[data-theme="dark"] .field > span,
:root[data-theme="dark"] h1,
:root[data-theme="dark"] h2,
:root[data-theme="dark"] h3,
:root[data-theme="dark"] strong { color: var(--text); }

:root[data-theme="dark"] .compact-field { color: #cbd5e1; }
:root[data-theme="dark"] .compact-field input[type="date"] {
  color: #f8fafc;
  -webkit-text-fill-color: #f8fafc;
  background: #0f1a2d;
  border-color: #334155;
  color-scheme: dark;
}
:root[data-theme="dark"] .compact-field input[type="date"]::-webkit-calendar-picker-indicator {
  filter: none;
  opacity: .9;
}
:root[data-theme="dark"] .field input,
:root[data-theme="dark"] .field select,
:root[data-theme="dark"] .field textarea,
:root[data-theme="dark"] .select-control,
:root[data-theme="dark"] .search-box,
:root[data-theme="dark"] .button-secondary { color: var(--text); background: #0f1a2d; border-color: var(--border); }
:root[data-theme="dark"] .button-secondary:hover,
:root[data-theme="dark"] .icon-button:hover { background: #1b2a42; }
:root[data-theme="dark"] .request-card { box-shadow: 0 4px 12px rgba(0,0,0,.22); }
:root[data-theme="dark"] .bulk-actions-bar,
:root[data-theme="dark"] .bulk-card-check,
:root[data-theme="dark"] .bulk-column-select { background: #12294b; border-color: #244f83; color: #bfdbfe; }
:root[data-theme="dark"] body.kanban-focus-mode #kanban-board { background: var(--bg); }

@media (max-width: 1100px) {
  .toolbar { flex-wrap: wrap; }
  .saved-filter-select { min-width: 140px; }
  .security-grid { grid-template-columns: 1fr; }
  .security-grid .report-card-wide { grid-column: auto; }
}
@media (max-width: 700px) {
  .shortcut-grid { grid-template-columns: 1fr; }
  .bulk-actions-bar { align-items: stretch; }
  .bulk-actions-bar > * { width: 100%; }
  .inline-field-row { flex-direction: column; }
}


/* =========================================================
   Versao 28: contraste completo em dialogos e Central de Ajuda
   ========================================================= */
:root[data-theme="dark"] dialog,
:root[data-theme="dark"] .modal,
:root[data-theme="dark"] .modal-content,
:root[data-theme="dark"] .help-modal-content {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}

:root[data-theme="dark"] .modal-header,
:root[data-theme="dark"] .modal-actions,
:root[data-theme="dark"] .request-tabs,
:root[data-theme="dark"] .help-modal-header,
:root[data-theme="dark"] .help-modal-actions {
  border-color: var(--border);
}

:root[data-theme="dark"] .form-section-heading,
:root[data-theme="dark"] .demand-heading,
:root[data-theme="dark"] .cancellation-heading,
:root[data-theme="dark"] .tef-heading,
:root[data-theme="dark"] .cancellation-entry,
:root[data-theme="dark"] .cancellation-entry-fixed,
:root[data-theme="dark"] .cancellation-empty-state,
:root[data-theme="dark"] .cancellation-item,
:root[data-theme="dark"] .attachment-picker,
:root[data-theme="dark"] .attachment-item,
:root[data-theme="dark"] .attachment-item.pending,
:root[data-theme="dark"] .attachment-empty,
:root[data-theme="dark"] .comment-body,
:root[data-theme="dark"] .comment-item.own .comment-body,
:root[data-theme="dark"] .comment-composer,
:root[data-theme="dark"] .comments-empty,
:root[data-theme="dark"] .request-audit,
:root[data-theme="dark"] .template-list > *,
:root[data-theme="dark"] .confirm-dialog-warning {
  color: var(--text);
  background: var(--surface-muted);
  border-color: var(--border);
}

:root[data-theme="dark"] .form-section-heading h3,
:root[data-theme="dark"] .form-section-heading p,
:root[data-theme="dark"] .attachment-picker-help strong,
:root[data-theme="dark"] .attachment-info strong,
:root[data-theme="dark"] .attachment-open-link,
:root[data-theme="dark"] .comment-body header strong,
:root[data-theme="dark"] .comment-body p,
:root[data-theme="dark"] .cancellation-reason-display p,
:root[data-theme="dark"] .fixed-entry-label strong {
  color: var(--text);
}

:root[data-theme="dark"] .field input:disabled,
:root[data-theme="dark"] .field select:disabled,
:root[data-theme="dark"] .field textarea:disabled,
:root[data-theme="dark"] .select-control:disabled {
  opacity: 1;
  color: #dbe7f7;
  -webkit-text-fill-color: #dbe7f7;
  background: #17243a;
  border-color: #34445d;
  cursor: not-allowed;
}

:root[data-theme="dark"] .request-tab {
  color: #aebcd0;
}
:root[data-theme="dark"] .request-tab:hover:not(:disabled) {
  color: var(--text);
  background: #1b2a42;
}
:root[data-theme="dark"] .request-tab.active {
  color: #bfdbfe;
  background: #17345f;
  border-color: #315f9b;
}
:root[data-theme="dark"] .request-tab-count,
:root[data-theme="dark"] .request-tab.active .request-tab-count {
  color: #dbeafe;
  background: #243651;
}

:root[data-theme="dark"] .help-menu,
:root[data-theme="dark"] .help-modal-actions,
:root[data-theme="dark"] .help-form-block-title {
  background: #0f1a2d;
  border-color: var(--border);
}
:root[data-theme="dark"] .help-content {
  color: var(--text);
  background: var(--surface);
}
:root[data-theme="dark"] .help-tab {
  color: #b7c4d7;
}
:root[data-theme="dark"] .help-tab:hover {
  color: var(--text);
  background: #17243a;
  border-color: var(--border);
}
:root[data-theme="dark"] .help-tab.active {
  color: #bfdbfe;
  background: #17345f;
  border-color: #315f9b;
  box-shadow: none;
}
:root[data-theme="dark"] .help-tab-icon {
  color: #c8d5e8;
  background: #243651;
}
:root[data-theme="dark"] .help-tab.active .help-tab-icon {
  color: white;
  background: var(--primary);
}
:root[data-theme="dark"] .help-step,
:root[data-theme="dark"] .help-cancellation-flow article,
:root[data-theme="dark"] .help-status-grid article,
:root[data-theme="dark"] .help-form-block,
:root[data-theme="dark"] .help-info-card,
:root[data-theme="dark"] .shortcut-grid > div,
:root[data-theme="dark"] .help-example {
  color: var(--text);
  background: var(--surface-muted);
  border-color: var(--border);
}
:root[data-theme="dark"] .help-field-list > div {
  border-color: var(--border);
}
:root[data-theme="dark"] .help-field-list strong,
:root[data-theme="dark"] .help-step strong,
:root[data-theme="dark"] .help-status-grid strong,
:root[data-theme="dark"] .help-info-card strong,
:root[data-theme="dark"] .help-example,
:root[data-theme="dark"] .help-example p {
  color: var(--text);
}
:root[data-theme="dark"] .help-field-list p,
:root[data-theme="dark"] .help-step p,
:root[data-theme="dark"] .help-status-grid p,
:root[data-theme="dark"] .help-info-card p,
:root[data-theme="dark"] .help-modal-header p,
:root[data-theme="dark"] .help-modal-actions > span,
:root[data-theme="dark"] .help-tab small {
  color: var(--muted);
}
:root[data-theme="dark"] .help-notice {
  color: #bfdbfe;
  background: #12294b;
  border-color: #244f83;
}
:root[data-theme="dark"] .help-warning {
  color: #fde68a;
  background: #3a2a0d;
  border-color: #795a18;
}
:root[data-theme="dark"] .help-section-number,
:root[data-theme="dark"] .help-form-block-title > span {
  color: #bfdbfe;
  background: #17345f;
}
:root[data-theme="dark"] kbd {
  color: #dbeafe;
  background: #0f1a2d;
  border-color: #475a77;
}

:root[data-theme="dark"] .cancellation-table-wrap,
:root[data-theme="dark"] .cancellation-table,
:root[data-theme="dark"] .report-table,
:root[data-theme="dark"] .users-table,
:root[data-theme="dark"] .archived-table {
  color: var(--text);
  background: var(--surface);
  border-color: var(--border);
}
:root[data-theme="dark"] .cancellation-table th,
:root[data-theme="dark"] .report-table th,
:root[data-theme="dark"] .users-table th,
:root[data-theme="dark"] .archived-table th {
  color: #aebcd0;
  background: #0f1a2d;
  border-color: var(--border);
}
:root[data-theme="dark"] .cancellation-table td,
:root[data-theme="dark"] .report-table td,
:root[data-theme="dark"] .users-table td,
:root[data-theme="dark"] .archived-table td {
  color: var(--text);
  border-color: var(--border);
}
:root[data-theme="dark"] .cancellation-table tbody tr:hover,
:root[data-theme="dark"] .users-table tbody tr:hover {
  background: #17243a;
}

:root[data-theme="dark"] .toast {
  color: var(--text);
  background: #17243a;
  border-color: var(--border);
}

@media (max-width: 640px) {
  :root[data-theme="dark"] .request-tabs {
    background: var(--surface);
  }
}


/* Versão 31: grupos de usuários */
.field[hidden], .invite-role-summary[hidden] { display: none !important; }
.users-table .tag.squad { white-space: nowrap; }

/* Versão 32: inicialização sem piscar a tela de login */
body.auth-pending {
  overflow: hidden;
}
body.auth-pending .login-view,
body.auth-pending .app-view {
  display: none !important;
}
.app-bootstrap {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--text);
  background: var(--bg);
}
body:not(.auth-pending) .app-bootstrap {
  display: none !important;
}
.app-bootstrap-card {
  display: flex;
  width: min(360px, 100%);
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 30px 24px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  text-align: center;
}
.app-bootstrap-card img {
  width: 58px;
  height: 58px;
  object-fit: contain;
  margin-bottom: 4px;
}
.app-bootstrap-card strong {
  font-size: 16px;
}
.app-bootstrap-card span {
  color: var(--muted);
  font-size: 13px;
}
.app-bootstrap-spinner {
  width: 28px;
  height: 28px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: app-bootstrap-spin .75s linear infinite;
}
@keyframes app-bootstrap-spin {
  to { transform: rotate(360deg); }
}

/* A visualização ampliada nunca mantém ações em massa ativas. */
body.kanban-focus-mode #bulk-actions-bar {
  display: none !important;
}


/* Versão 35: opção PIX no TEF */
.tef-pix-choice {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 14px 15px;
  border: 1px solid #a7f3d0;
  border-radius: 11px;
  background: #ecfdf5;
  color: #065f46;
  cursor: pointer;
}
.tef-pix-choice input {
  width: 18px;
  height: 18px;
  margin: 1px 0 0;
  flex: 0 0 auto;
  accent-color: var(--primary);
}
.tef-pix-choice span { display: grid; gap: 3px; }
.tef-pix-choice strong { color: inherit; font-size: 13px; }
.tef-pix-choice small { color: #047857; font-size: 11px; line-height: 1.45; }
.field-counter { align-self: flex-end; color: var(--muted); font-size: 10px; }
:root[data-theme="dark"] .tef-pix-choice {
  color: #a7f3d0;
  background: #063c36;
  border-color: #0f766e;
}
:root[data-theme="dark"] .tef-pix-choice small { color: #99f6e4; }


/* =========================================================
   Versao 37: abas fixas e mensagens globais acima dos modais
   ========================================================= */
#request-dialog .request-tabs {
  position: sticky;
  top: 0;
  z-index: 18;
  margin: -4px -24px 20px;
  padding: 8px 24px 10px;
  background: var(--surface);
  box-shadow: 0 10px 18px -18px rgba(15, 23, 42, .55);
}

@media (max-width: 640px) {
  .toast-container {
    inset: 12px 12px auto auto;
    width: calc(100vw - 24px);
  }

  #request-dialog .request-tabs {
    margin-right: -18px;
    margin-left: -18px;
    padding-right: 18px;
    padding-left: 18px;
  }
}

:root[data-theme="dark"] #request-dialog .request-tabs {
  background: var(--surface);
  box-shadow: 0 10px 18px -18px rgba(0, 0, 0, .9);
}

/* v46 - melhorias adicionais de segurança */
.password-policy-hint { display: block; margin-top: 6px; text-align: left !important; line-height: 1.45; }
.captcha-slot { min-height: 66px; display: flex; align-items: center; justify-content: center; margin: 4px 0 10px; overflow: hidden; }
.captcha-slot[hidden] { display: none; }
.security-card-actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0 10px; }
.security-control-list p { display: flex; gap: 9px; align-items: flex-start; }
.security-control-ok,
.security-control-info { display: inline-grid; place-items: center; flex: 0 0 22px; width: 22px; height: 22px; border-radius: 999px; font-weight: 800; line-height: 1; }
.security-control-ok { background: rgba(22, 163, 74, .14); color: #15803d; }
.security-control-info { background: rgba(37, 99, 235, .13); color: #2563eb; }
.security-confirm-row { align-items: flex-start; line-height: 1.5; }
.security-confirm-row input { margin-top: 4px; flex: 0 0 auto; }
.mfa-qr-wrap { display: grid; justify-items: center; gap: 12px; padding: 16px; border: 1px solid var(--border); border-radius: 16px; background: var(--surface-soft); }
.mfa-qr-wrap img { width: min(230px, 70vw); min-height: 180px; object-fit: contain; background: #fff; border-radius: 10px; padding: 8px; }
.mfa-qr-wrap code { max-width: 100%; padding: 8px 10px; border-radius: 8px; background: var(--surface); color: var(--text); overflow-wrap: anywhere; user-select: all; }
#mfa-challenge-code,
#mfa-enrollment-code { text-align: center; font-size: 1.35rem; letter-spacing: .35em; font-weight: 700; }
#backup-purpose { resize: vertical; min-height: 110px; }
#reauth-dialog .modal-help,
#backup-dialog .modal-help { line-height: 1.55; }

@media (max-width: 520px) {
  .captcha-slot { transform-origin: left top; }
  .security-card-actions .button { width: 100%; }
}

/* v47 - aceite obrigatorio da politica e termo de uso */
.legal-terms-dialog {
  width: min(980px, calc(100vw - 28px));
  max-width: none;
}
.legal-terms-content {
  width: min(940px, 100%);
  max-height: min(92vh, 920px);
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 24px;
}
.legal-terms-header { flex: 0 0 auto; }
.legal-terms-header h2 { margin-bottom: 5px; }
.legal-terms-alert {
  display: flex;
  flex-wrap: wrap;
  gap: 5px 10px;
  padding: 11px 14px;
  border: 1px solid rgba(217, 119, 6, .34);
  border-radius: 12px;
  background: rgba(245, 158, 11, .10);
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}
.legal-terms-alert strong { color: #b45309; }
.legal-terms-frame {
  width: 100%;
  min-height: 340px;
  flex: 1 1 480px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.legal-terms-actions { display: grid; gap: 9px; flex: 0 0 auto; }
.legal-terms-scroll-hint {
  margin: 0;
  padding: 8px 10px;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}
.legal-terms-scroll-hint.ready { color: #15803d; background: rgba(22, 163, 74, .10); }
.legal-check {
  align-items: flex-start;
  margin: 0;
  color: var(--text);
  font-size: 12px;
  line-height: 1.45;
}
.legal-check input { margin-top: 3px; flex: 0 0 auto; }
.legal-terms-buttons { justify-content: space-between; margin-top: 3px; }
.legal-terms-dialog[data-legal-required="true"]::backdrop { background: rgba(5, 12, 24, .82); }
:root[data-theme="dark"] .legal-terms-alert strong { color: #fbbf24; }

@media (max-width: 680px) {
  .legal-terms-content { padding: 17px; max-height: 96vh; }
  .legal-terms-frame { min-height: 300px; flex-basis: 390px; }
  .legal-terms-buttons { flex-direction: column-reverse; }
  .legal-terms-buttons .button { width: 100%; }
}

/* v48 - projetos, formulários e colunas configuráveis */
.kanban-board {
  grid-template-columns: repeat(var(--kanban-column-count, 5), minmax(245px, 1fr));
  grid-auto-flow: column;
  grid-auto-columns: minmax(245px, 1fr);
}
.column-header-actions { display: flex; align-items: center; gap: 8px; }
.column-rule-badge {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 6px;
  border-radius: 999px;
  color: #92400e;
  background: #fef3c7;
  font-size: 8px;
  font-weight: 800;
  letter-spacing: .02em;
  white-space: nowrap;
}
.column-rule-badge.done { color: #166534; background: #dcfce7; }
.status-dot.cyan { background: #06b6d4; }
.status-dot.gray { background: #64748b; }
.kanban-column.column-cyan { border-top: 3px solid #06b6d4; }
.kanban-column.column-gray { border-top: 3px solid #64748b; }
.tag.custom-project { color: #6d28d9; background: #ede9fe; }

.config-panel,
.projects-panel,
.columns-panel {
  margin: 0 24px 28px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.config-item-title { display: grid; gap: 4px; }
.config-item-title small { max-width: 420px; color: var(--muted); line-height: 1.4; }
.config-actions { display: flex; flex-wrap: wrap; gap: 7px; align-items: center; }
.config-dialog { width: min(980px, calc(100vw - 28px)); max-width: none; }
.config-dialog .modal-content { max-height: min(92vh, 950px); overflow: auto; }
.config-section {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}
.config-section > h3 { margin: 0 0 5px; font-size: 15px; }
.config-section > p { margin: 0 0 14px; color: var(--muted); font-size: 11px; line-height: 1.5; }
.config-checkbox-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.config-checkbox {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}
.config-checkbox.compact { padding: 10px; }
.config-checkbox input { margin-top: 3px; flex: 0 0 auto; }
.config-checkbox strong,
.config-checkbox small { display: block; }
.config-checkbox strong { font-size: 12px; }
.config-checkbox small { margin-top: 3px; color: var(--muted); font-size: 10px; line-height: 1.4; }
.standard-field-config { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: stretch; }
.standard-field-config .config-checkbox { height: 100%; }
.standard-field-required { min-width: 132px; }

.project-fields-builder { display: grid; gap: 12px; }
.project-field-builder-row {
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
}
.project-field-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin-top: 27px;
  border-radius: 9px;
  color: #1d4ed8;
  background: #dbeafe;
  font-size: 11px;
  font-weight: 800;
}
.project-field-content {
  min-width: 0;
  display: grid;
  gap: 12px;
}
.project-field-inputs {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(190px, .72fr) minmax(280px, 1.28fr);
  gap: 12px;
  align-items: start;
}
.project-field-inputs .field { min-width: 0; }
.project-field-inputs textarea { min-height: 96px; resize: vertical; }
.project-field-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.project-field-required {
  min-width: 220px;
  flex: 1 1 280px;
}
.field-row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex: 0 0 auto;
  flex-wrap: wrap;
  gap: 6px;
}
.field-row-actions .compact-button { min-height: 40px; }
.project-field-insert-button { min-width: 124px; }
.project-field-builder-row.is-inserted {
  border-color: #86efac;
  box-shadow: 0 0 0 2px rgba(34, 197, 94, .10);
}
.field-row-actions .button-secondary { min-width: 40px; padding-inline: 11px; }
.field-row-actions button:disabled { opacity: .4; cursor: not-allowed; }
.config-builder-empty {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 12px;
  color: var(--muted);
  background: var(--surface);
  font-size: 11px;
  text-align: center;
}
.project-form-preview {
  padding: 14px;
  border: 1px dashed #93c5fd;
  border-radius: 12px;
  background: rgba(219, 234, 254, .22);
}
.dynamic-section {
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}
.dynamic-section-header { margin-bottom: 14px; }
.dynamic-section-header h3 { margin: 0; font-size: 16px; }
.dynamic-section-header p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.5; }
.field-counter { display: block; margin-top: 4px; color: var(--muted); font-size: 9px; text-align: right; }

.columns-admin-list { display: grid; gap: 10px; }
.column-admin-card {
  display: grid;
  grid-template-columns: 76px 14px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 13px;
  background: var(--surface);
}
.column-admin-card.archived { opacity: .72; background: var(--surface-soft); }
.column-admin-order { display: flex; align-items: center; gap: 8px; }
.column-admin-order > strong { width: 28px; text-align: center; }
.column-admin-order > div { display: grid; gap: 3px; }
.column-admin-order button {
  width: 26px;
  height: 23px;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
}
.column-admin-order button:disabled { opacity: .35; cursor: not-allowed; }
.column-admin-copy { min-width: 0; }
.column-admin-copy > strong,
.column-admin-copy > span { display: block; }
.column-admin-copy > strong { font-size: 13px; }
.column-admin-copy > span { margin-top: 3px; color: var(--muted); font-size: 10px; }
.column-admin-rules { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 7px; }
.column-admin-rules span { padding: 3px 7px; border-radius: 999px; color: #475467; background: var(--surface-soft); font-size: 9px; font-weight: 700; }

@media (max-width: 980px) {
  .project-field-inputs { grid-template-columns: 1fr; }
  .project-field-number { margin-top: 27px; }
  .column-admin-card { grid-template-columns: 64px 14px minmax(0, 1fr); }
  .column-admin-card .config-actions { grid-column: 3; }
}

@media (max-width: 700px) {
  .config-panel,
  .projects-panel,
  .columns-panel { margin-inline: 12px; padding: 12px; }
  .config-checkbox-grid { grid-template-columns: 1fr; }
  .standard-field-config { grid-template-columns: 1fr; }
  .project-field-builder-row { grid-template-columns: 1fr; }
  .project-field-number { margin-top: 0; }
  .project-field-footer { align-items: stretch; }
  .project-field-required { min-width: 0; flex-basis: 100%; }
  .field-row-actions { width: 100%; justify-content: flex-start; }
  .field-row-actions [data-project-field-remove] { margin-left: auto; }
  .column-admin-card { grid-template-columns: 54px 12px 1fr; }
  .column-admin-card .config-actions { grid-column: 1 / -1; justify-content: flex-end; }
}

@media (max-width: 460px) {
  .field-row-actions { display: grid; grid-template-columns: minmax(0, 1fr) 40px 40px; }
  .field-row-actions .project-field-insert-button { grid-column: 1 / -1; width: 100%; }
  .field-row-actions [data-project-field-remove] { grid-column: 1 / -1; width: 100%; margin-left: 0; }
}

:root[data-theme="dark"] .column-rule-badge { color: #fcd34d; background: rgba(245, 158, 11, .16); }
:root[data-theme="dark"] .column-rule-badge.done { color: #86efac; background: rgba(34, 197, 94, .14); }
:root[data-theme="dark"] .project-form-preview { background: rgba(37, 99, 235, .10); }
.admin-config-panel {
  margin: 0 24px 28px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.admin-config-help {
  margin-bottom: 14px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 11px;
  color: #1e3a8a;
  background: #eff6ff;
}
.admin-config-help strong { display: block; font-size: 12px; }
.admin-config-help p { margin: 4px 0 0; font-size: 11px; line-height: 1.5; }
.config-table-wrap { overflow-x: auto; }
.config-table { width: 100%; border-collapse: collapse; }
.config-table th,
.config-table td { padding: 12px 10px; border-bottom: 1px solid var(--border); font-size: 11px; text-align: left; vertical-align: middle; }
.config-table th { color: var(--muted); font-size: 9px; letter-spacing: .04em; text-transform: uppercase; }
.config-form-section {
  margin-top: 16px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface-soft);
}
.form-section-heading { display: flex; justify-content: space-between; gap: 14px; align-items: flex-start; margin-bottom: 13px; }
.form-section-heading h3 { margin: 2px 0 0; font-size: 15px; }
.form-section-heading p { margin: 5px 0 0; color: var(--muted); font-size: 10px; line-height: 1.45; }
.standard-field-config-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.standard-field-config {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 11px;
  background: var(--surface);
}
.standard-field-config label { display: flex; gap: 7px; align-items: center; font-size: 11px; font-weight: 700; }
.standard-field-config label:last-child { color: var(--muted); font-weight: 600; }
.standard-field-config input { flex: 0 0 auto; }
:root[data-theme="dark"] .admin-config-help { color: #bfdbfe; background: rgba(37, 99, 235, .13); border-color: rgba(96, 165, 250, .35); }
@media (max-width: 700px) {
  .admin-config-panel { margin-inline: 12px; padding: 12px; }
  .standard-field-config-grid { grid-template-columns: 1fr; }
  .form-section-heading { flex-direction: column; }
  .form-section-heading .button { width: 100%; }
}
