:root {
  --ink: #101828;
  --muted: #667085;
  --line: #d8e0e8;
  --panel: #ffffff;
  --page: #eef3f7;
  --teal: #123f46;
  --blue: #155eef;
  --cyan: #2f8f9d;
  --gold: #ffcf4a;
  --red: #e31b23;
  --green: #12805c;
  --shadow: 0 18px 45px rgba(16, 24, 40, 0.10);
  --soft-shadow: 0 10px 28px rgba(16, 24, 40, 0.08);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  background:
    radial-gradient(circle at 18% 12%, rgba(47, 143, 157, 0.16), transparent 30%),
    linear-gradient(135deg, #edf4f8 0%, #f8fafc 48%, #eaf1f5 100%);
}

.login-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 20% 15%, rgba(255, 207, 74, .18), transparent 28%),
    radial-gradient(circle at 80% 8%, rgba(47, 143, 157, .28), transparent 30%),
    linear-gradient(135deg, #07171d, #123f46 58%, #061014);
}

.login-gate.is-unlocked {
  display: none;
}

.login-card {
  display: grid;
  gap: 12px;
  width: min(390px, 92vw);
  padding: 30px;
  border: 1px solid rgba(255,255,255,.22);
  border-radius: 22px;
  background: rgba(255,255,255,.13);
  color: #fff;
  box-shadow: 0 28px 80px rgba(0,0,0,.32);
  backdrop-filter: blur(16px);
}

.login-card .brand-mark {
  width: 54px;
  height: 54px;
}

.login-card h1,
.login-card p {
  margin: 0;
}

.login-card small {
  min-height: 18px;
  color: #ffd166;
  font-weight: 800;
}

button,
input,
select {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 318px minmax(0, 1fr);
  min-height: 100vh;
  transition: grid-template-columns 180ms ease;
}

body.sidebar-collapsed .app-shell {
  grid-template-columns: 92px minmax(0, 1fr);
}

.sidebar {
  position: static;
  top: 0;
  min-height: 100vh;
  height: auto;
  background:
    linear-gradient(180deg, rgba(13, 50, 58, 0.96), rgba(9, 30, 36, 0.98)),
    radial-gradient(circle at top left, rgba(255, 207, 74, 0.18), transparent 38%);
  color: #fff;
  padding: 22px;
  overflow: visible;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 12px 0 40px rgba(16, 24, 40, 0.16);
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 24px;
}

.collapse-btn {
  margin-left: auto;
  width: 34px;
  min-height: 34px;
  border: 1px solid rgba(255,255,255,.16);
  border-radius: 10px;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 24px;
}

body.sidebar-collapsed .brand div,
body.sidebar-collapsed .side-menu b,
body.sidebar-collapsed .config-panel {
  display: none;
}

body.sidebar-collapsed .sidebar {
  padding: 20px 16px;
}

body.sidebar-collapsed .brand {
  justify-content: center;
}

body.sidebar-collapsed .collapse-btn {
  position: absolute;
  left: 58px;
  top: 28px;
  width: 28px;
  min-height: 28px;
  font-size: 18px;
  transform: rotate(180deg);
}

.side-menu {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin-bottom: 20px;
}

.side-menu button {
  min-height: 40px;
  padding: 10px 11px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  color: #e8f4f6;
  font-weight: 800;
  text-align: left;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  display: flex;
  align-items: center;
  gap: 10px;
}

.side-menu button span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border-radius: 8px;
  background: rgba(255,255,255,.10);
  color: var(--gold);
  flex: 0 0 24px;
}

body.sidebar-collapsed .side-menu button {
  justify-content: center;
  padding: 10px;
}

body.sidebar-collapsed .side-menu button span {
  width: 34px;
  height: 34px;
}

.side-menu button:hover,
.side-menu button.active {
  background: #fff;
  color: #123f46;
  transform: translateY(-1px);
}

.view-panel {
  display: none;
}

.view-panel.is-active {
  display: block;
}

.summary-grid.view-panel.is-active,
.chart-dashboard.view-panel.is-active,
.toolbar.view-panel.is-active,
.date-strip.view-panel.is-active,
.mini-module-grid.view-panel.is-active {
  display: grid;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--gold);
  color: #0e3038;
  font-weight: 800;
}

.brand h1,
.brand p,
.panel-section h2 {
  margin: 0;
}

.brand h1 {
  font-size: 21px;
}

.brand p {
  color: #b9d1d5;
  margin-top: 3px;
}

.config-panel {
  display: grid;
  gap: 14px;
  min-width: 0;
}

body:not([data-view="settings"]) .config-panel {
  display: none;
}

body.viewer-mode .side-menu button[data-view="settings"],
body.viewer-mode .config-panel,
body.viewer-mode #exportCsv,
body.viewer-mode .employee-editor,
body.viewer-mode .employee-actions,
body.viewer-mode .admin-only {
  display: none !important;
}

body.viewer-mode .sidebar {
  height: auto;
  min-height: 100vh;
}

body.share-mode .side-menu button[data-view="settings"],
body.share-mode .side-menu button[data-view="employees"],
body.share-mode .side-menu button[data-view="sharelinks"],
body.share-mode .config-panel,
body.share-mode #exportCsv,
body.share-mode #changePassword,
body.share-mode #toggleCampaign,
body.share-mode #enableCampaign,
body.share-mode #detailAssigneeToggle,
body.share-mode .employee-editor,
body.share-mode .employee-actions,
body.share-mode .admin-only {
  display: none !important;
}

body.share-mode .header-actions #headerEmployeeFilter {
  display: none;
}

body.share-login-mode #loginUser {
  display: none;
}

body:not(.admin-mode) #changePassword,
body:not(.admin-mode) #logoutButton {
  display: none !important;
}

.panel-section {
  display: grid;
  gap: 13px;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.095);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.08), 0 14px 28px rgba(0,0,0,.12);
  backdrop-filter: blur(14px);
}

.panel-section h2 {
  font-size: 18px;
  color: #e7f7f9;
}

.section-kicker {
  width: fit-content;
  padding: 5px 9px;
  border-radius: 999px;
  background: rgba(255, 207, 74, 0.16);
  color: #ffdf75;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.section-note {
  margin: -4px 0 2px;
  color: #b9d1d5;
  font-size: 13px;
  line-height: 1.45;
}

label {
  display: grid;
  gap: 7px;
  color: inherit;
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  padding: 10px 12px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 18px rgba(0,0,0,.08);
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(255, 207, 74, .18), 0 8px 18px rgba(0,0,0,.08);
}

textarea {
  resize: vertical;
  line-height: 1.4;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-picker {
  display: grid;
  gap: 8px;
  max-height: 330px;
  overflow: auto;
  padding-right: 4px;
}

.field-config-hidden {
  display: none;
}

.advanced-panel {
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
}

.advanced-panel summary {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 16px;
  color: #e7f7f9;
  cursor: pointer;
  font-weight: 900;
}

.advanced-panel summary::after {
  content: "+";
  color: var(--gold);
  font-size: 20px;
}

.advanced-panel[open] summary::after {
  content: "-";
}

.advanced-content {
  display: grid;
  gap: 12px;
  padding: 0 16px 16px;
  min-width: 0;
  overflow: hidden;
}

.advanced-content label,
.advanced-content input,
.advanced-content select,
.advanced-content textarea,
.advanced-content button,
.advanced-content small {
  min-width: 0;
  max-width: 100%;
}

.advanced-content input[type="password"],
.advanced-content input[type="text"] {
  width: 100%;
  box-sizing: border-box;
}

.hero-config .secondary {
  width: 100%;
  white-space: normal;
  line-height: 1.2;
  min-height: 48px;
  overflow-wrap: anywhere;
}

.hero-config .cloud-save-status {
  display: block;
  border-radius: 12px;
  padding: 10px;
  background: rgba(255, 207, 74, .13);
  color: #ffe28a;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.field-option {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 600;
  color: #e8f4f6;
}

.remember-row {
  display: flex;
  align-items: center;
  gap: 9px;
  color: #e8f4f6;
}

.remember-row input {
  width: 18px;
  min-height: 18px;
}

.field-option input {
  width: 18px;
  min-height: 18px;
}

.employee-list {
  display: grid;
  gap: 8px;
  max-height: 190px;
  overflow: auto;
}

.share-link-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid rgba(30, 90, 110, 0.14);
  border-radius: 16px;
  background: #f8fcfd;
}

.share-link-item.is-disabled {
  opacity: 0.58;
  background: #f3f5f6;
}

.share-link-item .danger-soft {
  color: #b42318;
  border-color: rgba(220, 38, 38, 0.3);
  background: #fff5f5;
}

.share-link-item small {
  display: block;
  color: var(--muted);
  margin-top: 4px;
}

.share-url {
  width: 100%;
  margin-top: 8px;
  font-weight: 700;
  color: #0f6472;
  background: #fff;
}

.employee-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1);
}

.employee-item strong,
.employee-item small {
  display: block;
}

.employee-item small {
  margin-top: 3px;
  color: #b9d1d5;
}

.employee-actions {
  display: flex;
  gap: 6px;
  opacity: 1;
  pointer-events: auto;
}

.employee-actions button {
  opacity: 1;
  color: var(--blue);
  background: #fff;
  border: 1px solid var(--line);
}

.employee-actions .employee-edit-btn {
  background: #e0f2fe;
  color: #075985;
  border-color: #7dd3fc;
  font-weight: 1000;
}

.employee-actions .employee-delete-btn {
  background: #fee2e2;
  color: #b91c1c;
  border-color: #fca5a5;
  font-weight: 1000;
}

.cloud-save-status {
  display: block;
  padding: 9px 10px;
  border-radius: 10px;
  background: rgba(255, 207, 74, 0.12);
  color: #ffe39a;
  font-weight: 800;
}

.employee-item button {
  min-height: 34px;
  padding: 0 10px;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

.panel-actions {
  display: grid;
  grid-template-columns: 1fr 82px;
  gap: 10px;
  padding: 8px 0 4px;
}

#resetDemo {
  grid-column: 1 / -1;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 800;
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

button:hover {
  transform: translateY(-1px);
}

.primary {
  background: linear-gradient(135deg, #ffcf4a, #ffb423);
  color: #102f36;
  box-shadow: 0 14px 28px rgba(255, 180, 35, .25);
}

.secondary {
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  border: 1px solid rgba(255,255,255,.14);
}

.danger {
  background: #d92d20;
  color: #fff;
}

.ghost {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--blue);
}

.report-view {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  padding: 28px 30px 36px;
}

.report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
  min-height: 60px;
  padding: 12px 16px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 20px;
  background: rgba(255,255,255,.72);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--cyan);
  font-weight: 800;
  text-transform: uppercase;
}

.report-header h2 {
  margin: 0;
  font-size: 32px;
  letter-spacing: 0;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.header-select {
  width: auto;
  min-width: 132px;
  min-height: 40px;
  color: var(--ink);
  background: #fff;
}

#headerEmployeeFilter {
  min-width: 190px;
}

.header-custom-range {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px;
  border: 1px solid #d7e2ea;
  border-radius: 14px;
  background: rgba(255,255,255,.9);
}

.header-custom-range[hidden] {
  display: none !important;
}

.header-custom-range label {
  display: grid;
  gap: 2px;
  color: #5f6f84;
  font-size: 11px;
  font-weight: 800;
}

.header-custom-range input {
  width: 132px;
  min-height: 34px;
  padding: 6px 8px;
  border: 1px solid #d7e2ea;
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.avatar {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--teal), var(--cyan));
  color: #fff;
  font-weight: 900;
}

.status-pill {
  padding: 10px 12px;
  border-radius: 999px;
  background: #e6f4ef;
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.date-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-bottom: 18px;
  border-radius: 18px;
  overflow: hidden;
  box-shadow: var(--soft-shadow);
  border: 1px solid rgba(255,255,255,.72);
}

.date-strip div {
  display: grid;
  gap: 5px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.82);
  border-right: 1px solid #e7edf2;
}

.date-strip div:last-child {
  background: linear-gradient(135deg, rgba(255,207,74,.22), rgba(47,143,157,.12));
  border-right: 0;
}

.date-strip span,
.summary-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.date-strip strong {
  font-size: 18px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.overview-panel {
  margin-bottom: 18px;
  padding: 20px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 20px;
  background: rgba(255,255,255,.78);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.overview-panel header {
  margin-bottom: 14px;
}

.overview-panel h2 {
  margin: 0;
  font-size: 22px;
}

.insight-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.insight-grid article {
  display: grid;
  gap: 7px;
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid #e5ebf0;
  background: linear-gradient(180deg, #ffffff, #f8fbfc);
  box-shadow: 0 10px 24px rgba(16, 24, 40, 0.06);
}

.insight-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.insight-grid strong {
  font-size: 16px;
  line-height: 1.35;
}

.insight-link,
.lead-link {
  color: #005bd8;
  font-weight: 900;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.progress-board {
  margin-bottom: 18px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 20px;
  background: rgba(255,255,255,.78);
  box-shadow: var(--soft-shadow);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.progress-tabs {
  display: flex;
  gap: 1px;
  background: var(--line);
}

.progress-tabs button {
  flex: 1;
  min-height: 44px;
  border-radius: 0;
  background: #f8fbfc;
  color: var(--muted);
}

.progress-tabs button.active {
  background: var(--teal);
  color: #fff;
}

.optimization-dashboard {
  display: grid;
  gap: 16px;
}

.optimization-hero,
.optimization-table-card {
  border: 1px solid rgba(255, 255, 255, .76);
  border-radius: 22px;
  background: rgba(255, 255, 255, .86);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.optimization-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px;
}

.optimization-hero h3,
.optimization-table-head h3 {
  margin: 0;
  font-size: 24px;
}

.optimization-hero span,
.optimization-table-head p {
  color: var(--muted);
  font-weight: 800;
}

.optimization-controls {
  display: flex;
  align-items: end;
  gap: 10px;
}

.optimization-controls label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.optimization-controls input {
  min-width: 150px;
  height: 44px;
  border: 1px solid #d7e2ea;
  border-radius: 12px;
  padding: 0 14px;
  font-weight: 900;
}

.danger-soft {
  background: #fff1f1;
  color: #bd1f1f;
  border: 1px solid #ffd2d2;
}

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

.optimization-kpis article {
  display: grid;
  gap: 8px;
  padding: 16px;
  border: 1px solid #ffd7d7;
  border-radius: 18px;
  background: linear-gradient(145deg, #fff, #fff1f1);
  box-shadow: 0 16px 34px rgba(185, 28, 28, .08);
}

.optimization-kpis span {
  color: #9f1239;
  font-size: 13px;
  font-weight: 900;
}

.optimization-kpis strong {
  color: #7f1d1d;
  font-size: 28px;
}

.optimization-table-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
}

.danger-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 12px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 1000;
  white-space: nowrap;
}

.optimization-table th {
  background: #dc2626;
}

.optimization-alert-row {
  background: #fff1f2 !important;
}

.optimization-alert-row.is-checked {
  background: #ecfdf5 !important;
  opacity: .9;
}

.optimization-alert-row td {
  border-color: #fecaca;
}

.alert-dot {
  margin-right: 6px;
}

.optimization-owner {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 1000;
}

.optimization-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-width: 220px;
}

.optimization-actions a,
.optimization-actions button {
  min-height: 30px;
  padding: 6px 9px;
  border: 1px solid #fecaca;
  border-radius: 9px;
  background: #fff;
  color: #b91c1c;
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
}

.optimization-actions .checked-action,
.optimization-alert-row.is-checked .danger-badge {
  border-color: #bbf7d0;
  background: #dcfce7;
  color: #047857;
}

.empty-optimization {
  padding: 28px !important;
  text-align: center;
  color: var(--muted);
  font-weight: 900;
}

.scale-dashboard {
  display: grid;
  gap: 16px;
}

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

.scale-kpis article,
.scale-card {
  border: 1px solid rgba(255,255,255,.78);
  background: rgba(255,255,255,.9);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.scale-kpis article {
  display: grid;
  gap: 6px;
  min-height: 112px;
  padding: 16px;
  border-radius: 18px;
}

.scale-kpis span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 1000;
}

.scale-kpis strong {
  color: var(--ink);
  font-size: 28px;
}

.scale-kpis small {
  color: #07826e;
  font-weight: 900;
}

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

.scale-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border-radius: 20px;
}

.scale-wide {
  grid-column: 1 / -1;
}

.scale-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.scale-card-head h3 {
  margin: 0;
  font-size: 20px;
}

.scale-badge,
.score-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 5px 11px;
  border-radius: 999px;
  background: #e0f2fe;
  color: #075985;
  font-size: 12px;
  font-weight: 1000;
  white-space: nowrap;
}

.scale-badge.good,
.score-pill.scale {
  background: #dcfce7;
  color: #047857;
}

.scale-badge.bad,
.score-pill.reduce {
  background: #fee2e2;
  color: #b91c1c;
}

.score-pill.watch {
  background: #fef3c7;
  color: #92400e;
}

.scale-list,
.scale-checklist {
  display: grid;
  gap: 10px;
}

.scale-suggestion,
.scale-check {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #dbe8ef;
  border-radius: 14px;
  background: #f8fcfd;
}

.scale-suggestion.scale {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.scale-suggestion.reduce {
  border-color: #fecaca;
  background: #fff1f2;
}

.scale-suggestion strong,
.scale-check strong {
  display: block;
  margin-bottom: 4px;
}

.scale-suggestion span,
.scale-suggestion small,
.scale-check span {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.scale-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.scale-actions a,
.scale-actions button {
  min-height: 32px;
  padding: 7px 10px;
  border: 1px solid #cfe0e8;
  border-radius: 10px;
  background: #fff;
  color: #0f6b76;
  font-size: 12px;
  font-weight: 1000;
  text-decoration: none;
}

.scale-actions .scale-primary-action {
  border-color: #99f6e4;
  background: #0f766e;
  color: #fff;
}

.scale-actions .scale-danger-action {
  border-color: #fecaca;
  background: #dc2626;
  color: #fff;
}

.scale-score-table th {
  background: #0f766e;
}

.compare-dashboard {
  display: grid;
  gap: 16px;
}

.compare-controls {
  grid-template-columns: minmax(220px, 1.35fr) minmax(220px, 1.35fr) minmax(150px, .75fr) minmax(150px, .75fr) auto;
}

.compare-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.compare-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.78);
  border-radius: 20px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.compare-wide {
  grid-column: 1 / -1;
}

.compare-chart {
  display: grid;
  gap: 12px;
}

.compare-bar-row {
  display: grid;
  grid-template-columns: minmax(120px, .8fr) minmax(160px, 1fr) minmax(92px, auto);
  align-items: center;
  gap: 10px;
}

.compare-bar-label {
  display: grid;
  gap: 2px;
}

.compare-bar-label strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  font-weight: 1000;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compare-bar-label span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.compare-bar-track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8f1f5;
}

.compare-bar-track i {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #119c97, #ffcf4a);
  animation: chartGrow 520ms ease both;
}

.compare-bar-row.lead .compare-bar-track i {
  background: linear-gradient(90deg, #155eef, #7dd3fc);
}

.compare-bar-row.cpl .compare-bar-track i {
  background: linear-gradient(90deg, #7c3aed, #f0abfc);
}

.compare-bar-row b {
  text-align: right;
  font-size: 13px;
}

@keyframes chartGrow {
  from { width: 0; }
}

.compare-table tbody tr {
  cursor: pointer;
}

.compare-table tbody tr:hover,
.compare-table tbody tr.is-selected {
  background: #eefdf9;
}

.compare-table td button {
  border: 0;
  background: transparent;
  color: #0066d9;
  font-weight: 1000;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

.best-cell {
  background: #dcfce7 !important;
  color: #047857;
  font-weight: 1000;
}

.compare-detail-list {
  display: grid;
  gap: 10px;
}

.compare-detail-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #d9e7ee;
  border-radius: 14px;
  background: #f8fcfd;
}

.compare-detail-item a {
  color: #005bd3;
  font-weight: 1000;
}

.compare-detail-item span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.compare-detail-item strong,
.compare-detail-item em {
  white-space: nowrap;
}

.compare-detail-item em {
  color: #0f766e;
  font-style: normal;
  font-weight: 1000;
}

.assistant-dashboard {
  display: grid;
  gap: 16px;
}

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

.assistant-card {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 20px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--soft-shadow);
}

.assistant-card h3 {
  margin: 0;
  font-size: 20px;
}

.assistant-wide {
  grid-column: 1 / -1;
}

.assistant-list {
  display: grid;
  gap: 10px;
}

.assistant-item {
  display: grid;
  gap: 4px;
  padding: 12px;
  border: 1px solid #dbe7ef;
  border-radius: 14px;
  background: #f8fbfc;
}

.assistant-item.good {
  border-color: #bbf7d0;
  background: #ecfdf5;
}

.assistant-item.warn {
  border-color: #fed7aa;
  background: #fff7ed;
}

.assistant-item.note {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.assistant-item.history {
  border-color: #ddd6fe;
  background: #f5f3ff;
}

.assistant-item strong {
  color: var(--ink);
  font-weight: 1000;
}

.assistant-item span,
.assistant-empty {
  color: var(--muted);
  font-weight: 800;
}

.employee-today-group {
  gap: 8px;
}

.employee-project-list {
  display: grid;
  gap: 6px;
}

.employee-project-list span {
  display: block;
  padding-top: 6px;
  border-top: 1px solid #e5eef3;
  line-height: 1.45;
}

.assistant-card textarea,
.assistant-card select,
.assistant-card input {
  width: 100%;
  border: 1px solid #d7e2ea;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 800;
}

.assistant-table th {
  background: #0f766e;
}

.assistant-table td,
.assistant-table th {
  white-space: nowrap;
}

.assistant-notify-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.assistant-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.progress-meter {
  height: 9px;
  background: #edf2f4;
}

#progressFill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--cyan));
  transition: width 180ms ease;
}

.progress-content {
  display: none;
  padding: 14px 16px;
}

.progress-content.active {
  display: block;
}

.scan-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  color: var(--muted);
  font-weight: 800;
}

.scan-stats strong {
  color: var(--ink);
}

.account-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 8px;
  color: var(--muted);
}

.account-chip {
  padding: 10px 12px;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #fbfdfe;
  font-weight: 800;
}

.account-chip small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 600;
}

.activity-log {
  max-height: 120px;
  overflow: auto;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.55;
  white-space: pre-wrap;
}

.done-modal {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: none;
  place-items: center;
  padding: 24px;
  background: rgba(8, 21, 28, 0.56);
  backdrop-filter: blur(8px);
}

.scan-choice-card {
  width: min(560px, calc(100vw - 32px));
}

.scan-choice-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 16px 0 10px;
}

.scan-choice-grid label:first-child {
  grid-column: 1 / -1;
}

.scan-choice-grid label {
  display: grid;
  gap: 6px;
  color: #5f6f84;
  font-size: 12px;
  font-weight: 900;
  text-align: left;
}

.scan-choice-grid input,
.scan-choice-grid select {
  min-height: 42px;
  border: 1px solid #d7e2ea;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 900;
}

.scan-choice-card small {
  display: block;
  margin: 8px 0 16px;
  color: var(--muted);
  font-weight: 800;
}

@media (max-width: 560px) {
  .scan-choice-grid {
    grid-template-columns: 1fr;
  }
}

.detail-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #d7e2ea;
  background: #f8fbfd;
  flex-wrap: wrap;
}

.detail-tool-group {
  position: relative;
}

.detail-tools .secondary.compact {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid #cbd8e2;
  border-radius: 10px;
  background: #fff;
  color: #102033;
  box-shadow: none;
}

.detail-tools .secondary.compact:hover {
  background: #eef7fa;
}

.detail-top-toggle {
  margin-left: auto;
}

.detail-drawer.is-top-collapsed .detail-breakdown,
.detail-drawer.is-top-collapsed .detail-page-center {
  display: none;
}

.detail-drawer.is-top-collapsed .detail-panel header {
  padding-bottom: 10px;
}

.detail-drawer.is-top-collapsed .detail-tools {
  border-bottom: 1px solid var(--line);
}

.detail-popover {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 8;
  display: none;
  width: min(360px, calc(100vw - 40px));
  padding: 14px;
  border: 1px solid #d7e2ea;
  border-radius: 12px;
  background: #fff;
  box-shadow: 0 18px 45px rgba(8, 21, 28, 0.18);
}

.detail-popover.is-open {
  display: block;
}

.detail-popover label {
  display: block;
  margin-bottom: 8px;
  font-weight: 800;
  color: #102033;
}

.detail-popover select {
  width: 100%;
  min-height: 132px;
  border: 1px solid #cbd8e2;
  border-radius: 8px;
  padding: 6px;
}

.detail-popover small {
  display: block;
  margin-top: 8px;
  color: #66758a;
}

.detail-column-picker {
  width: min(440px, calc(100vw - 40px));
}

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

#detailColumnPicker label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid #e1e9ef;
  border-radius: 8px;
  background: #f8fbfd;
  font-size: 13px;
  font-weight: 700;
  color: #344256;
}

#detailColumnPicker input {
  width: 16px;
  height: 16px;
  margin: 0;
}

.employee-tag-cell {
  min-width: 170px;
}

.employee-tag-cell span,
.employee-tag-cell em {
  display: inline-flex;
  align-items: center;
  margin: 2px 4px 2px 0;
  padding: 4px 8px;
  border-radius: 999px;
  background: #e8f7f4;
  color: #0d766f;
  font-size: 12px;
  font-weight: 800;
  font-style: normal;
}

.persona-dashboard {
  display: none;
  animation: sectionIn 260ms ease-out;
}

.persona-hero,
.persona-card,
.persona-kpi-grid article {
  border: 1px solid rgba(255,255,255,.76);
  border-radius: 20px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(16px);
}

.persona-hero {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.persona-hero h2 {
  margin: 0 0 6px;
  font-size: 30px;
}

.persona-hero span {
  color: var(--muted);
  font-weight: 700;
}

.persona-actions {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.persona-actions label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.persona-actions input,
.persona-actions select {
  min-width: min(420px, 48vw);
  min-height: 42px;
  border: 1px solid #d7e2ea;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.persona-actions input {
  min-height: 40px;
}

.persona-actions select {
  max-width: min(520px, 52vw);
}

#personaProjectFilter {
  transition: min-height 180ms ease, box-shadow 180ms ease;
}

#personaProjectFilter[size]:not([size="1"]) {
  min-height: 176px;
  padding: 8px;
  box-shadow: 0 16px 36px rgba(8, 21, 28, .14);
}

.persona-kpi-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(138px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.persona-kpi-grid article {
  display: flex;
  gap: 12px;
  min-height: 108px;
  padding: 16px;
  transform: translateY(8px);
  animation: sectionIn 320ms ease-out forwards;
}

.persona-kpi-grid span {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 auto;
  border-radius: 12px;
  background: #e8fbfc;
  color: #078d94;
  font-weight: 900;
}

.persona-kpi-grid small,
.persona-mini span {
  color: var(--muted);
  font-weight: 800;
}

.persona-kpi-grid strong {
  display: block;
  margin: 5px 0;
  color: var(--ink);
  font-size: 22px;
}

.persona-kpi-grid em {
  color: #0f8b57;
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}

.persona-kpi-grid .down em {
  color: #b7791f;
}

.persona-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr 1fr;
  gap: 16px;
}

.persona-card {
  padding: 16px;
  overflow: hidden;
  border-color: #cfe0e9;
  background:
    linear-gradient(180deg, rgba(255,255,255,.95), rgba(248,252,254,.92));
}

.persona-card header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.persona-card header strong {
  color: var(--ink);
  font-size: 16px;
}

.persona-card header button {
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid #d7e2ea;
  border-radius: 10px;
  background: #fff;
  color: #0b6f76;
  box-shadow: none;
  font-size: 12px;
}

.persona-budget-card {
  grid-row: span 2;
}

.persona-budget-layout {
  display: grid;
  grid-template-columns: minmax(180px, 220px) 1fr;
  gap: 18px;
  align-items: center;
}

.persona-donut {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 1;
  border-radius: 50%;
  animation: chartPop 480ms ease-out;
}

.persona-donut::after {
  content: "";
  position: absolute;
  inset: 23%;
  border-radius: 50%;
  background: #fff;
  box-shadow: inset 0 0 0 1px #edf2f4;
}

.persona-donut span {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.persona-donut strong {
  color: var(--ink);
  font-size: 24px;
}

.persona-legend {
  display: grid;
  gap: 10px;
}

.persona-legend div {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-weight: 800;
}

.persona-legend i {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #0ea5a6;
}

.persona-legend strong {
  color: var(--ink);
}

.persona-bars {
  display: grid;
  gap: 11px;
}

.persona-bar-row {
  display: grid;
  grid-template-columns: minmax(82px, 130px) 1fr minmax(90px, auto);
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  text-align: left;
  box-shadow: none;
}

.persona-bar-row span,
.persona-bar-row strong {
  font-size: 13px;
  font-weight: 900;
}

.persona-bar-row div {
  height: 12px;
  border-radius: 999px;
  background: #e8eff3;
  overflow: hidden;
}

.persona-bar-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0ea5a6, #f7c948);
  animation: barGrow 520ms ease-out;
}

.persona-bar-row.chart-lollipop div {
  position: relative;
  height: 5px;
  overflow: visible;
}

.persona-bar-row.chart-lollipop b::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 14px;
  height: 14px;
  border: 3px solid #fff;
  border-radius: 999px;
  background: #0ea5a6;
  box-shadow: 0 6px 14px rgba(16,32,51,.18);
  transform: translateY(-50%);
}

.persona-bar-row.color-1 b { background: linear-gradient(90deg, #1f93ff, #8bd5ee); }
.persona-bar-row.color-2 b { background: linear-gradient(90deg, #7c3aed, #c4b5fd); }
.persona-bar-row.color-3 b { background: linear-gradient(90deg, #f59e0b, #fde68a); }
.persona-bar-row.color-4 b { background: linear-gradient(90deg, #16a34a, #86efac); }

.persona-analysis-grid {
  display: contents;
}

.persona-mini {
  min-height: 190px;
  padding: 14px;
  border: 1px solid #c8dce7;
  border-radius: 16px;
  background:
    radial-gradient(circle at top right, rgba(14,165,166,.12), transparent 34%),
    linear-gradient(135deg, #fbfffe, #edfafa);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.92), 0 10px 24px rgba(16, 32, 51, .06);
}

.persona-mini.blue {
  background:
    radial-gradient(circle at top right, rgba(31,147,255,.12), transparent 34%),
    linear-gradient(135deg, #fbfdff, #eef5ff);
}

.persona-mini strong {
  color: var(--ink);
  line-height: 1.35;
}

.persona-break-list {
  display: grid;
  gap: 9px;
  margin-top: 8px;
}

.persona-break-list.variant-ring {
  position: relative;
  grid-template-columns: 150px 1fr;
  align-items: center;
  gap: 14px;
}

.persona-break-list.variant-ring::before {
  content: "";
  display: block;
  width: 132px;
  aspect-ratio: 1;
  border-radius: 999px;
  background: conic-gradient(var(--ring-gradient, #0ea5a6 0 100%));
  box-shadow: inset 0 0 0 28px #fff, 0 18px 35px rgba(16,32,51,.10);
  animation: chartPop 460ms ease-out;
  grid-row: 1 / span 8;
}

.persona-break-list.variant-ring > div {
  min-width: 0;
}

.persona-break-list.variant-device {
  gap: 12px;
}

.persona-break-list.variant-device > div {
  padding: 10px 12px;
  border: 1px solid #d9e8ef;
  border-radius: 14px;
  background: rgba(255,255,255,.72);
}

.persona-break-list.variant-device small {
  align-items: center;
}

.persona-break-list.variant-device small b {
  overflow: hidden;
  max-width: 55%;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.persona-break-list.variant-device i {
  height: 10px;
}

.persona-break-list.variant-stack {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.persona-break-list.variant-stack > div {
  padding: 12px;
  border-radius: 14px;
  background: rgba(14,165,166,.08);
}

.persona-break-list.variant-heat {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.persona-break-list.variant-heat > div {
  padding: 10px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(14,165,166,.14), rgba(247,201,72,.22));
}

.persona-break-list.variant-heat i {
  height: 5px;
}

.persona-break-list .color-1 u { background: linear-gradient(90deg, #1f93ff, #8bd5ee); }
.persona-break-list .color-2 u { background: linear-gradient(90deg, #7c3aed, #c4b5fd); }
.persona-break-list .color-3 u { background: linear-gradient(90deg, #f59e0b, #fde68a); }
.persona-break-list .color-4 u { background: linear-gradient(90deg, #16a34a, #86efac); }

.persona-metric-card {
  display: grid;
  min-height: 150px;
  place-content: center;
  gap: 8px;
  border-radius: 18px;
  background:
    radial-gradient(circle at 50% 42%, rgba(14,165,166,.18), transparent 38%),
    linear-gradient(135deg, #f8fffe, #edf8ff);
  text-align: center;
}

.persona-metric-card strong {
  font-size: 36px;
}

.persona-metric-card span {
  color: var(--muted);
  font-weight: 900;
}

.persona-break-list small {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  color: var(--ink);
  font-size: 12px;
  font-weight: 900;
}

.persona-break-list em {
  color: #526176;
  font-style: normal;
  white-space: nowrap;
}

.persona-break-list i {
  display: block;
  height: 8px;
  border-radius: 999px;
  background: #e3edf3;
  overflow: hidden;
}

.persona-break-list u {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0ea5a6, #f7c948);
  animation: barGrow 520ms ease-out;
}

.persona-top-campaign-card {
  grid-column: span 2;
}

.persona-top-campaign {
  display: grid;
  gap: 14px;
}

.persona-top-hero {
  padding: 16px;
  border: 1px solid #c8dce7;
  border-radius: 18px;
  background:
    radial-gradient(circle at top right, rgba(247,201,72,.24), transparent 34%),
    linear-gradient(135deg, #f8fffe, #eefbfc);
}

.persona-top-hero span {
  color: var(--cyan);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.persona-top-hero strong {
  display: block;
  margin: 7px 0 12px;
  color: var(--ink);
  font-size: 20px;
  line-height: 1.25;
}

.persona-top-hero div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.persona-top-hero b {
  padding: 7px 10px;
  border-radius: 999px;
  background: #fff;
  color: #102033;
  box-shadow: 0 8px 18px rgba(16,32,51,.08);
}

.persona-top-hero button,
.persona-top-list button {
  border: 1px solid #c8dce7;
  background: #fff;
  color: #075f66;
  box-shadow: none;
}

.persona-top-list {
  display: grid;
  gap: 9px;
}

.persona-top-list button {
  display: grid;
  grid-template-columns: 30px minmax(160px, 1fr) minmax(100px, .8fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  min-height: 44px;
  padding: 8px 10px;
  text-align: left;
}

.persona-top-list span {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: #e8fbfc;
  color: #08777e;
  font-weight: 900;
}

.persona-top-list p {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 900;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.persona-top-list i {
  height: 8px;
  border-radius: 999px;
  background: #e3edf3;
  overflow: hidden;
}

.persona-top-list u {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #0ea5a6, #f7c948);
}

.persona-table-card {
  margin-top: 16px;
}

.persona-empty,
.persona-loading {
  min-height: 120px;
  display: grid;
  place-items: center;
  border: 1px dashed #c9d8e2;
  border-radius: 14px;
  color: var(--muted);
  font-weight: 800;
  text-align: center;
}

.persona-card.is-zoomed {
  position: fixed;
  inset: 24px;
  z-index: 45;
  overflow: auto;
}

.pdf-section-list {
  display: grid;
  gap: 10px;
  margin: 6px 0 12px;
  text-align: left;
}

.pdf-section-list label {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border: 1px solid #d7e2ea;
  border-radius: 12px;
  background: #f8fbfd;
  color: var(--ink);
}

.pdf-section-list input {
  width: 18px;
  min-height: 18px;
  box-shadow: none;
}

.pdf-actions {
  display: flex;
  justify-content: end;
  gap: 10px;
}

@keyframes chartPop {
  from { transform: scale(.92); opacity: .4; }
  to { transform: scale(1); opacity: 1; }
}

@keyframes barGrow {
  from { width: 0; }
}

.employee-tag-cell em {
  background: #fff3d8;
  color: #9a6400;
}

.done-modal.is-open {
  display: grid;
  animation: doneFade 180ms ease-out;
}

.done-card {
  width: min(520px, 92vw);
  padding: 34px;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(8, 21, 28, 0.28);
  text-align: center;
  animation: donePop 260ms cubic-bezier(.2, .9, .2, 1.1);
}

.done-badge {
  display: grid;
  width: 86px;
  height: 86px;
  margin: 0 auto 18px;
  place-items: center;
  border-radius: 999px;
  background: #e6f4ef;
  box-shadow: 0 0 0 12px rgba(18, 128, 92, 0.1);
}

.done-badge span {
  width: 42px;
  height: 24px;
  border-left: 7px solid var(--green);
  border-bottom: 7px solid var(--green);
  transform: rotate(-45deg) translate(3px, -2px);
}

.loader-ring {
  width: 82px;
  height: 82px;
  margin: 0 auto 18px;
  border: 8px solid #e6f4ef;
  border-top-color: var(--cyan);
  border-radius: 999px;
  animation: spin 900ms linear infinite;
}

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

.done-card p {
  margin: 0 0 6px;
  color: var(--cyan);
  font-weight: 900;
  text-transform: uppercase;
}

.done-card h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.2;
}

.done-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 22px 0;
}

.done-stats span {
  padding: 12px 10px;
  border-radius: 8px;
  background: #f3f7f8;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.done-stats strong {
  display: block;
  color: var(--ink);
  font-size: 20px;
}

@keyframes doneFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes donePop {
  from {
    opacity: 0;
    transform: translateY(18px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes kpiShimmer {
  0% {
    transform: translateX(-130%);
  }
  100% {
    transform: translateX(130%);
  }
}

@keyframes numberPulse {
  0% {
    transform: translateY(2px);
    filter: saturate(1);
  }
  45% {
    color: #07898e;
    text-shadow: 0 8px 24px rgba(0, 167, 173, .22);
  }
  100% {
    transform: translateY(0);
    filter: saturate(1.08);
  }
}

.summary-grid article {
  display: grid;
  gap: 7px;
  padding: 18px;
  border: 1px solid rgba(255,255,255,.74);
  border-radius: 18px;
  background:
    radial-gradient(circle at 88% 18%, rgba(0, 167, 173, .12), transparent 28%),
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(248,251,252,.92));
  box-shadow: var(--soft-shadow);
  position: relative;
  overflow: hidden;
  transform: translateZ(0);
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.summary-grid article::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, var(--cyan), var(--gold));
}

.summary-grid article::after,
.pro-kpi-grid article::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 0%, rgba(255,255,255,.72) 42%, transparent 76%);
  transform: translateX(-130%);
  opacity: 0;
  pointer-events: none;
}

.summary-grid article:hover,
.pro-kpi-grid article:hover {
  transform: translateY(-2px);
  box-shadow: 0 20px 42px rgba(15, 23, 42, .12);
  border-color: rgba(0, 167, 173, .24);
}

.is-refreshing-data .summary-grid article::after,
.is-refreshing-data .pro-kpi-grid article::after {
  animation: kpiShimmer 1.25s ease-in-out infinite;
  opacity: 1;
}

.summary-grid article strong {
  word-break: break-word;
}

.number-counting {
  animation: numberPulse .72s ease both;
}

#refreshView.is-refreshing {
  position: relative;
  color: #07898e;
  border-color: rgba(0, 167, 173, .42);
  box-shadow: 0 12px 28px rgba(0, 167, 173, .14);
}

#refreshView.is-refreshing::after {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-left: 8px;
  border: 2px solid rgba(0, 167, 173, .22);
  border-top-color: #07898e;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}

.chart-dashboard {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: 14px;
  margin-bottom: 18px;
}

.chart-dashboard article,
.lead-truth-panel {
  padding: 18px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 20px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.chart-dashboard header,
.lead-truth-panel header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.chart-dashboard header span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}

.chart-dashboard header strong {
  color: var(--cyan);
  font-size: 13px;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 2fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
}

.bar-track {
  height: 11px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(93, 183, 194, 0.16);
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
}

.donut-card {
  display: grid;
  place-items: center;
  gap: 12px;
  text-align: center;
  color: var(--muted);
  font-weight: 800;
}

.donut {
  width: 150px;
  height: 150px;
  border-radius: 999px;
  background: conic-gradient(var(--cyan) 0deg, var(--cyan) var(--donut-deg, 0deg), #e4ebef var(--donut-deg, 0deg));
  position: relative;
}

.donut::after {
  content: "";
  position: absolute;
  inset: 26px;
  border-radius: 999px;
  background: var(--panel);
}


.summary-grid strong {
  font-size: 24px;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) 220px 220px;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 18px;
  background: rgba(255,255,255,.78);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.toolbar label {
  color: var(--ink);
}

.table-card {
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 20px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.employee-dashboard,
.accounts-dashboard {
  margin-bottom: 14px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 20px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--soft-shadow);
  overflow: hidden;
  backdrop-filter: blur(18px);
}

.mini-module-grid {
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 18px;
}

.mini-module-grid article {
  padding: 20px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 20px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--soft-shadow);
}

.mini-module-grid span,
.share-kpis span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.mini-module-grid strong {
  display: block;
  margin-top: 8px;
  font-size: 28px;
}

.mini-module-grid p {
  color: var(--muted);
  line-height: 1.45;
}

.report-builder {
  padding: 20px;
  border: 1px solid rgba(255,255,255,.72);
  border-radius: 22px;
  background: rgba(255,255,255,.82);
  box-shadow: var(--soft-shadow);
  backdrop-filter: blur(18px);
}

.report-builder > header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.report-builder h2,
.payment-panel h3 {
  margin: 0;
}

.report-actions,
.report-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.report-tabs {
  margin-bottom: 14px;
  padding: 6px;
  border-radius: 14px;
  background: #eef3f7;
}

.report-tabs button {
  min-height: 38px;
  padding: 0 14px;
  background: transparent;
  color: var(--muted);
}

.report-tabs button.active {
  background: #fff;
  color: var(--teal);
  box-shadow: 0 8px 18px rgba(16, 24, 40, .08);
}

.report-workspace {
  display: none;
}

.report-workspace.active {
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
  gap: 16px;
}

.report-controls {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 16px;
  border-radius: 18px;
  background: #f7fafc;
  border: 1px solid #e4ebef;
}

.report-controls label {
  color: var(--ink);
}

.report-column-picker {
  display: grid;
  gap: 8px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.report-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 800;
}

.report-check input {
  width: 16px;
  min-height: 16px;
  box-shadow: none;
}

.share-report {
  display: grid;
  gap: 14px;
  padding: 18px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #e4ebef;
}

.share-report-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #edf2f4;
}

.share-report-head h3,
.share-report-head p,
.share-report footer {
  margin: 0;
}

.share-report-head p,
.share-report footer,
.payment-panel p {
  color: var(--muted);
}

.share-kpis {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.share-kpis article {
  padding: 14px;
  border-radius: 14px;
  background: #f7fafc;
  border: 1px solid #e4ebef;
}

.share-kpis strong {
  display: block;
  margin-top: 6px;
  font-size: 20px;
}

.share-chart {
  display: grid;
  gap: 9px;
}

.share-chart-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 2fr auto;
  gap: 10px;
  align-items: center;
  font-size: 13px;
  font-weight: 800;
}

.share-chart-row div {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #eaf0f4;
}

.share-chart-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--cyan), var(--gold));
}

.payment-panel {
  padding: 18px;
  border-radius: 18px;
  background: #fff;
  border: 1px solid #e4ebef;
}

.agency-overview {
  display: grid;
  gap: 14px;
}

.agency-filter-card {
  display: grid;
  grid-template-columns: repeat(3, 1fr) 140px;
  gap: 14px;
  align-items: end;
  padding: 16px;
  border: 1px solid #dfe7ee;
  border-radius: 10px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--soft-shadow);
}

.agency-filter-card label {
  color: var(--ink);
  font-size: 12px;
}

.agency-filter-card input {
  box-shadow: none;
  border-color: #dfe7ee;
}

.agency-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.agency-tabs button {
  background: #fff;
  border: 1px solid #dfe7ee;
  color: var(--ink);
  box-shadow: var(--soft-shadow);
}

.agency-tabs button.active {
  background: linear-gradient(135deg, #02a7ad, #00b7b0);
  color: #fff;
}

.pro-kpi-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 14px;
}

.pro-kpi-grid article {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 76px;
  padding: 14px;
  border: 1px solid #dfe7ee;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--soft-shadow);
  position: relative;
  overflow: hidden;
  transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease;
}

.pro-kpi-grid small {
  display: block;
  color: var(--muted);
  font-weight: 800;
}

.pro-kpi-grid strong {
  display: block;
  margin-top: 4px;
  color: #172033;
  font-size: 22px;
}

.pro-icon {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 10px;
  color: #00a7ad;
  background: #e9fbfb;
  font-size: 22px;
  font-weight: 900;
  flex: 0 0 auto;
}

.pro-chart-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr 1fr;
  gap: 14px;
}

.pro-chart-grid article,
.pro-table-grid article {
  padding: 14px;
  border: 1px solid #dfe7ee;
  border-radius: 10px;
  background: #fff;
  box-shadow: var(--soft-shadow);
}

.pro-chart-grid header,
.pro-table-grid header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.pro-bar-chart,
.pro-split-chart {
  display: grid;
  gap: 11px;
}

.pro-bar-row,
.pro-split-row {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) 2fr auto;
  gap: 10px;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
}

.pro-bar-row div,
.pro-split-row div {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf2f7;
  position: relative;
}

.pro-bar-row b,
.pro-split-row b {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #00a7ad;
}

.pro-split-row {
  grid-template-columns: 70px 1fr 1fr;
}

.pro-split-row b.blue {
  background: #91c9f6;
}

.pro-split-row em {
  position: absolute;
  right: 6px;
  top: -1px;
  color: #334155;
  font-style: normal;
  font-size: 11px;
}

.pro-donut-wrap {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 12px;
  align-items: center;
}

.pro-donut {
  display: grid;
  width: 164px;
  height: 164px;
  place-items: center;
  border-radius: 999px;
  position: relative;
}

.pro-donut::after {
  content: "";
  position: absolute;
  inset: 38px;
  border-radius: 999px;
  background: #fff;
}

.pro-donut span {
  position: relative;
  z-index: 1;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pro-donut strong {
  color: var(--ink);
  font-size: 20px;
}

.pro-legend {
  display: grid;
  gap: 8px;
  font-size: 12px;
}

.pro-legend div {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  gap: 8px;
  align-items: center;
}

.pro-legend i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.pro-table-grid {
  display: grid;
  grid-template-columns: 1fr 1.1fr;
  gap: 14px;
}

.pro-status {
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.pro-status.good {
  color: #047857;
  background: #dcfce7;
}

.pro-status.warn {
  color: #92400e;
  background: #fef3c7;
}

.live-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-left: 4px;
  border-radius: 999px;
  background: #10b981;
}

th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.column-filter-row th,
.detail-filter-row th {
  top: 42px;
  padding: 6px;
  background: #eef3f7;
}

.column-filter-row input,
.detail-filter-row input {
  width: 100%;
  min-width: 92px;
  min-height: 34px;
  padding: 7px 9px;
  border-radius: 9px;
  border: 1px solid #d6e0e7;
  background: #fff;
  box-shadow: none;
  font-size: 12px;
}

.detail-filter-row th {
  top: 45px;
  background: #eaf2f6;
}

tbody tr:nth-child(even) {
  background: #f8fbfc;
}

tbody tr:hover {
  background: #eef8fa;
}

.campaign-total-row th,
.campaign-total-row td {
  position: sticky;
  bottom: 0;
  z-index: 2;
  border-top: 2px solid #0f5fe8;
  background: #fff8d8;
  color: #0f172a;
  font-weight: 950;
}

.campaign-total-row .hot {
  color: #0047b8;
}

.pager {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  padding: 10px 14px 14px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pager button {
  display: inline-grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--blue);
  font-weight: 950;
}

.pager button:disabled {
  opacity: .38;
  cursor: not-allowed;
}

.pager strong {
  color: var(--ink);
}

/* Roomy data tables: show the full 15-row page before pagination. */
#accounts .table-scroll.compact,
#employees .table-scroll.compact,
#campaigns .table-scroll {
  max-height: min(72vh, 820px) !important;
}

#accounts .table-scroll.compact,
#campaigns .table-scroll {
  min-height: min(62vh, 720px);
}

@media (max-width: 900px) {
  #accounts .table-scroll.compact,
  #employees .table-scroll.compact,
  #campaigns .table-scroll {
    min-height: 0;
    max-height: none !important;
  }
}

/* Mobile compact mode: keep controls short and leave more room for data. */
@media (max-width: 720px) {
  .report-view {
    padding: 8px !important;
  }

  .sidebar {
    padding: 8px !important;
    max-height: 54px !important;
  }

  body.mobile-menu-open .sidebar {
    max-height: calc(100vh - 8px) !important;
  }

  .brand {
    min-height: 38px;
    gap: 8px;
  }

  .brand .logo {
    width: 38px;
    height: 38px;
    border-radius: 9px;
    font-size: 13px;
  }

  .brand h1 {
    font-size: 16px;
    line-height: 1.1;
  }

  .brand p,
  .eyebrow,
  .accounts-dashboard header span,
  .employee-dashboard header span {
    display: none !important;
  }

  .collapse-btn {
    width: 34px;
    height: 34px;
  }

  .side-menu {
    gap: 6px;
    margin-top: 8px;
  }

  .side-menu button {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 10px;
    font-size: 13px;
  }

  .report-header {
    display: grid !important;
    grid-template-columns: 1fr;
    gap: 8px;
    min-height: 0;
    margin-bottom: 8px;
    padding: 10px;
    border-radius: 14px;
  }

  .report-header h2 {
    font-size: 22px !important;
    line-height: 1.12;
  }

  .header-actions {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 7px;
  }

  .header-actions .status-pill,
  .header-actions .avatar {
    display: none;
  }

  .header-actions button,
  .header-actions select,
  .header-select,
  #headerEmployeeFilter {
    width: 100%;
    min-width: 0 !important;
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 11px;
    font-size: 13px;
  }

  .toolbar,
  .agency-filter-card {
    gap: 8px;
    padding: 8px !important;
    border-radius: 13px;
  }

  .toolbar label,
  .agency-filter-card label,
  .employee-view-filter {
    font-size: 11px;
  }

  .toolbar input,
  .toolbar select,
  .agency-filter-card input,
  .agency-filter-card select,
  .agency-filter-card button {
    min-height: 38px;
    padding: 8px 10px;
    border-radius: 11px;
    font-size: 13px;
  }

  .accounts-dashboard,
  .employee-dashboard,
  .table-card,
  .agency-overview article {
    border-radius: 14px;
  }

  .accounts-dashboard header,
  .employee-dashboard header {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    padding: 10px;
  }

  .accounts-dashboard h2,
  .employee-dashboard h2 {
    font-size: 18px;
  }

  .employee-page-grid {
    gap: 8px;
    padding: 8px !important;
  }

  .employee-editor,
  .employee-roster {
    padding: 10px;
    border-radius: 12px;
  }

  .table-scroll,
  .table-scroll.compact {
    max-height: none !important;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  table {
    min-width: 760px;
    font-size: 13px;
  }

  body[data-view="campaigns"] #campaigns .table-scroll {
    overflow-x: auto;
    width: 100%;
    max-width: 100%;
    border-radius: 14px;
    -webkit-overflow-scrolling: touch;
  }

  body[data-view="campaigns"] #campaigns table {
    min-width: 1080px !important;
    width: max-content;
    table-layout: auto;
    font-size: 12px;
  }

  body[data-view="campaigns"] #campaigns th,
  body[data-view="campaigns"] #campaigns td {
    padding: 7px 8px;
    line-height: 1.28;
    white-space: normal;
    word-break: normal;
    overflow-wrap: anywhere;
  }

  body[data-view="campaigns"] #campaigns th:nth-child(1),
  body[data-view="campaigns"] #campaigns td:nth-child(1) {
    width: 112px;
    min-width: 112px;
  }

  body[data-view="campaigns"] #campaigns th:nth-child(2),
  body[data-view="campaigns"] #campaigns td:nth-child(2) {
    width: 96px;
    min-width: 96px;
  }

  body[data-view="campaigns"] #campaigns th:nth-child(3),
  body[data-view="campaigns"] #campaigns td:nth-child(3) {
    width: 250px;
    min-width: 250px;
  }

  body[data-view="campaigns"] #campaigns th:nth-child(4),
  body[data-view="campaigns"] #campaigns td:nth-child(4) {
    width: 118px;
    min-width: 118px;
  }

  body[data-view="campaigns"] #campaigns th:nth-child(n+5),
  body[data-view="campaigns"] #campaigns td:nth-child(n+5) {
    width: 96px;
    min-width: 96px;
    text-align: right;
  }

  body[data-view="campaigns"] #campaigns .column-filter-row {
    display: none;
  }

  th,
  td {
    padding: 9px 8px;
  }

  .column-filter-row input {
    min-height: 34px;
    padding: 7px 8px;
    font-size: 12px;
  }

  .pager {
    justify-content: space-between;
    gap: 6px;
    padding: 8px 10px 10px;
    font-size: 12px;
  }

  .pager button {
    width: 32px;
    height: 32px;
  }
}

/* Polish pass: keep dashboard text aligned, readable, and responsive. */
.report-view,
.view-panel,
.persona-dashboard,
.assistant-dashboard,
.optimization-dashboard {
  min-width: 0;
}

.report-header {
  align-items: flex-start;
  gap: 12px;
}

.report-actions,
.header-actions,
.persona-actions,
.optimization-controls,
.assistant-actions {
  min-width: 0;
}

.report-actions > *,
.header-actions > *,
.persona-actions > *,
.optimization-controls > *,
.assistant-actions > * {
  flex-shrink: 0;
}

.report-actions .data-clock,
.header-actions .data-clock,
.data-clock,
.status-pill {
  max-width: 100%;
  white-space: normal;
  line-height: 1.35;
}

.persona-hero {
  align-items: stretch;
  gap: 22px;
}

.persona-hero > div:first-child {
  min-width: min(520px, 100%);
}

.persona-hero h2,
.optimization-hero h3,
.assistant-card h3,
.persona-card header strong {
  line-height: 1.12;
  letter-spacing: 0;
}

.persona-actions {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto auto;
  align-items: end;
  width: min(980px, 100%);
  margin-left: auto;
}

.persona-actions label {
  min-width: 0;
}

.persona-actions input,
.persona-actions select {
  width: 100%;
  min-width: 0;
  max-width: none;
}

.persona-actions button {
  white-space: nowrap;
}

.persona-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  align-items: stretch;
}

.persona-kpi-grid article {
  min-width: 0;
  min-height: 132px;
  align-items: flex-start;
  padding: 18px;
}

.persona-kpi-grid article > div {
  min-width: 0;
  display: grid;
  gap: 5px;
}

.persona-kpi-grid small {
  display: block;
  line-height: 1.25;
}

.persona-kpi-grid strong {
  font-size: clamp(22px, 2vw, 30px);
  line-height: 1.08;
  overflow-wrap: anywhere;
  word-break: normal;
}

.persona-kpi-grid em {
  line-height: 1.25;
}

.persona-grid {
  grid-template-columns: repeat(3, minmax(320px, 1fr));
  align-items: stretch;
}

.persona-card {
  min-width: 0;
  border-radius: 18px;
}

.persona-card header {
  gap: 12px;
}

.persona-card header button {
  white-space: nowrap;
}

.persona-budget-layout {
  display: grid;
  grid-template-columns: minmax(210px, .9fr) minmax(220px, 1fr);
  gap: 22px;
  align-items: center;
}

.persona-donut {
  width: min(260px, 100%);
  aspect-ratio: 1;
  margin-inline: auto;
}

.persona-legend {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.persona-legend div {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr) minmax(116px, auto);
  align-items: center;
  gap: 10px;
}

.persona-legend span {
  min-width: 0;
  line-height: 1.2;
}

.persona-legend strong {
  white-space: nowrap;
  text-align: right;
  font-size: clamp(15px, 1.3vw, 18px);
}

.persona-empty,
.persona-loading {
  min-height: 140px;
  display: grid;
  place-items: center;
  padding: 22px;
  text-align: center;
  line-height: 1.35;
}

.persona-bar-row,
.pro-bar-row,
.pro-split-row {
  min-width: 0;
}

.persona-bar-row span,
.pro-bar-row span,
.pro-split-row span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.table-scroll {
  max-width: 100%;
}

table th,
table td {
  line-height: 1.35;
  vertical-align: middle;
}

table th {
  white-space: normal;
}

table td.number,
table th.number {
  white-space: nowrap;
}

input,
select,
button {
  letter-spacing: 0;
}

@media (max-width: 1380px) {
  .persona-grid {
    grid-template-columns: repeat(2, minmax(300px, 1fr));
  }

  .persona-budget-card {
    grid-column: 1 / -1;
  }
}

@media (max-width: 980px) {
  .report-header,
  .persona-hero,
  .optimization-hero {
    display: grid;
    grid-template-columns: 1fr;
  }

  .persona-actions {
    grid-template-columns: 1fr 1fr;
    margin-left: 0;
  }

  .persona-actions label {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  .persona-actions,
  .persona-grid,
  .persona-budget-layout {
    grid-template-columns: 1fr;
  }

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

  .persona-kpi-grid article {
    min-height: 104px;
    padding: 12px;
    gap: 10px;
  }

  .persona-kpi-grid span {
    width: 32px;
    height: 32px;
  }

  .persona-kpi-grid strong {
    font-size: 20px;
  }

  .persona-legend div {
    grid-template-columns: 10px minmax(0, 1fr);
  }

  .persona-legend strong {
    grid-column: 2;
    text-align: left;
  }
}

@media (max-width: 520px) {
  .persona-kpi-grid {
    grid-template-columns: 1fr;
  }

  .report-actions,
  .header-actions,
  .assistant-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .report-actions > *,
  .header-actions > *,
  .assistant-actions > * {
    width: 100%;
  }
}

/* Persona budget card: keep all labels and money values inside the card. */
.persona-budget-card {
  overflow: visible;
}

.persona-budget-card .persona-budget-layout {
  grid-template-columns: minmax(160px, 0.82fr) minmax(260px, 1.18fr);
  gap: 18px;
  align-items: center;
}

.persona-budget-card .persona-donut {
  width: min(220px, 100%);
  max-width: 220px;
}

.persona-budget-card .persona-legend {
  min-width: 0;
  width: 100%;
  align-content: center;
}

.persona-budget-card .persona-legend div {
  grid-template-columns: 12px minmax(92px, 0.75fr) minmax(112px, 1fr);
  gap: 9px;
  min-width: 0;
}

.persona-budget-card .persona-legend span {
  min-width: 0;
  color: #667085;
  font-size: clamp(13px, 1vw, 15px);
  font-weight: 900;
  overflow-wrap: anywhere;
}

.persona-budget-card .persona-legend strong {
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  text-align: right;
  font-size: clamp(15px, 1.25vw, 20px);
  line-height: 1.14;
}

@media (max-width: 1380px) {
  .persona-budget-card .persona-budget-layout {
    grid-template-columns: minmax(190px, .72fr) minmax(280px, 1.28fr);
  }
}

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

  .persona-budget-card .persona-donut {
    width: min(240px, 68vw);
    max-width: 240px;
  }
}

.employee-dashboard header,
.accounts-dashboard header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px 8px;
}

.employee-dashboard h2,
.accounts-dashboard h2 {
  margin: 0;
  font-size: 20px;
}

.employee-dashboard header span,
.accounts-dashboard header span {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-weight: 700;
}

.employee-view-filter {
  display: grid;
  gap: 6px;
  min-width: 240px;
  max-width: 320px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.employee-view-filter select {
  width: 100%;
  min-height: 44px;
}

.employee-page-grid {
  display: grid;
  grid-template-columns: minmax(260px, .8fr) minmax(320px, 1.2fr);
  gap: 14px;
  padding: 12px 18px 18px;
}

.employee-editor,
.employee-roster {
  padding: 16px;
  border: 1px solid rgba(19, 52, 60, .1);
  border-radius: 18px;
  background: rgba(255,255,255,.74);
}

.employee-editor {
  display: grid;
  gap: 12px;
}

.employee-editor label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.employee-editor input,
.employee-editor textarea {
  width: 100%;
  border: 1px solid #d8e5ea;
  border-radius: 14px;
  padding: 12px 13px;
  background: #fff;
  color: var(--ink);
  font: inherit;
  font-weight: 800;
  text-transform: none;
}

.employee-editor textarea {
  resize: vertical;
  min-height: 128px;
  line-height: 1.45;
}

.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.account-budget-editor {
  display: grid;
  gap: 10px;
}

.account-budget-editor .section-headline {
  margin-bottom: 0;
}

.account-budget-rows {
  display: grid;
  gap: 9px;
}

.account-budget-row {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(120px, .65fr) 42px;
  gap: 8px;
  align-items: center;
}

.account-budget-row button {
  min-height: 42px;
  padding: 0;
  color: #b42318;
  font-size: 20px;
}

.employee-editor p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.section-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.section-headline span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.section-headline strong {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 30px;
  border-radius: 999px;
  background: #e7fbfb;
  color: #047b83;
}

.employee-list-main {
  max-height: 260px;
  overflow: auto;
}

.employee-account-table {
  margin-top: 14px;
  border-top: 1px solid var(--line);
}

.status-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 86px;
  border-radius: 999px;
  padding: 7px 10px;
  background: #fff3d7;
  color: #8a5b00;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.good {
  background: #ddf8e9;
  color: #04703f;
}

.status-pill.bad {
  background: #ffe5e5;
  color: #b42318;
}

.table-scroll.compact {
  max-height: 260px;
}

.table-scroll.compact table {
  min-width: 820px;
}

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 330px);
}

table {
  width: 100%;
  min-width: 760px;
  border-collapse: collapse;
}

#campaigns table,
.detail-table-scroll table {
  min-width: 1180px;
}

thead {
  position: sticky;
  top: 0;
  z-index: 1;
}

th {
  background: var(--blue);
  color: #fff;
  padding: 11px 10px;
  border-right: 1px solid rgba(255, 255, 255, 0.25);
  text-align: left;
  white-space: nowrap;
}

th:nth-child(1),
td:nth-child(1) {
  min-width: 130px;
}

th:nth-child(2),
td:nth-child(2) {
  min-width: 120px;
}

th:nth-child(3),
td:nth-child(3) {
  min-width: 300px;
}

th:nth-child(n + 4),
td:nth-child(n + 4) {
  min-width: 106px;
}

td {
  padding: 10px;
  border-top: 1px solid var(--line);
  border-right: 1px solid var(--line);
  font-size: 14px;
}

tbody tr:nth-child(even) {
  background: #f7fafb;
}

tbody tr.is-warning {
  background: #f9e8d1;
}

td.number,
th.number {
  text-align: right;
}

td.hot {
  font-weight: 900;
  text-align: center;
}

td.hot.hot-zero {
  background: #ff1515;
  color: #fff200;
}

td.hot.hot-good {
  background: #12805c;
  color: #fff;
}

td.hot.hot-mid {
  background: #fff5c7;
  color: #7a5400;
}

a.project-link {
  color: #005bd8;
  font-weight: 800;
}

.detail-drawer {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: none;
  background: rgba(9, 20, 28, 0.72);
  backdrop-filter: blur(6px);
  padding: 18px;
}

.detail-drawer.is-open {
  display: block;
  animation: doneFade 160ms ease-out;
}

.detail-panel {
  width: 100%;
  height: 100%;
  border-radius: 10px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(8, 21, 28, 0.32);
  display: grid;
  grid-template-rows: auto auto auto auto 1fr;
  overflow: hidden;
  animation: donePop 220ms cubic-bezier(.2, .9, .2, 1.04);
}

.detail-panel header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  background: #fff;
}

.detail-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.detail-panel h2 {
  margin: 0 0 6px;
  font-size: 22px;
}

#detailMeta {
  color: var(--muted);
  font-weight: 700;
}

.detail-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: #f7fafb;
}

.detail-breakdown h3 {
  margin: 0 0 10px;
  font-size: 15px;
}

.breakdown-bars {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.detail-page-center {
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(135deg, #f8fcfd, #eef9f8);
}

.detail-page-center-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.detail-page-center-head h3 {
  margin: 2px 0 4px;
  font-size: 17px;
}

#detailPageCenterNote,
.detail-page-center p {
  color: var(--muted);
  font-weight: 700;
}

.detail-page-center-body {
  display: grid;
  gap: 10px;
}

.detail-page-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(120px, 1fr));
  gap: 10px;
}

.detail-page-kpis span,
.detail-page-kpi-button {
  padding: 10px 12px;
  border: 1px solid #d5ebed;
  border-radius: 8px;
  background: #fff;
  color: var(--muted);
  font-weight: 800;
  text-align: left;
}

.detail-page-kpi-button {
  cursor: pointer;
  font-family: inherit;
}

.detail-page-kpi-button:hover {
  border-color: #0ea5a4;
  box-shadow: 0 10px 22px rgba(14, 165, 164, .12);
}

.detail-page-kpis strong,
.detail-page-kpi-button strong {
  display: block;
  color: var(--ink);
  font-size: 22px;
}

.detail-page-grid {
  display: grid;
  grid-template-columns: minmax(220px, .8fr) repeat(2, minmax(260px, 1fr));
  gap: 10px;
}

.detail-page-grid article {
  min-width: 0;
  padding: 12px;
  border: 1px solid #d5ebed;
  border-radius: 8px;
  background: rgba(255, 255, 255, .88);
}

.detail-page-grid h4 {
  margin: 0 0 10px;
  font-size: 14px;
}

.page-chip-row,
.page-mini-row {
  display: grid;
  gap: 3px;
  padding: 8px 0;
  border-top: 1px solid #eef4f6;
  color: var(--ink);
  text-decoration: none;
}

.page-chip-row {
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
}

.page-chip-row img,
.page-chip-row > span {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #dff7f6;
}

.page-chip-row em,
.page-mini-row em,
.page-mini-row span {
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

button.page-mini-row {
  width: 100%;
  border: 0;
  background: transparent;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
}

.lead-popup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid #d5e7ee;
  border-radius: 12px;
  background: #fff;
}

.lead-popup-actions span {
  color: var(--muted);
  font-weight: 800;
}

.lead-popup-table {
  max-height: 560px;
  overflow: auto;
}

.lead-popup-table td {
  vertical-align: top;
  white-space: normal;
  min-width: 130px;
}

.detail-page-warning {
  padding: 10px 12px;
  border: 1px solid #ffe1a8;
  border-radius: 8px;
  background: #fff7dd;
  color: #8a5b00;
  font-weight: 800;
}

.detail-page-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--cyan);
}

.mini-loader {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 4px solid #dff3f1;
  border-top-color: var(--cyan);
  animation: spin 700ms linear infinite;
}

.breakdown-row {
  display: grid;
  grid-template-columns: 90px minmax(100px, 1fr) 46px;
  gap: 8px;
  align-items: center;
}

.breakdown-track {
  height: 9px;
  border-radius: 999px;
  background: #e4ebef;
  overflow: hidden;
}

.breakdown-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--cyan);
}

.detail-table-scroll {
  overflow: auto;
  height: 100%;
}

.detail-table-scroll table {
  min-width: 1360px;
}

.ad-thumb {
  width: 112px;
  height: 112px;
  object-fit: cover;
  border-radius: 7px;
  border: 1px solid var(--line);
  background: #f3f6f8;
}

.empty-media {
  display: grid;
  width: 112px;
  height: 112px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.ad-copy {
  min-width: 420px;
  max-width: 560px;
  white-space: normal;
}

.ad-copy strong,
.ad-copy span,
.ad-copy a {
  display: block;
}

.ad-copy span {
  margin-top: 4px;
  color: var(--muted);
  line-height: 1.35;
}

.ad-copy a {
  margin-top: 6px;
  color: #005bd8;
  font-weight: 800;
}

/* Responsive overrides: keep every control visible without page-level horizontal clipping. */
.report-view {
  overflow: visible;
}

.report-header,
.header-actions,
.toolbar,
.agency-filter-card {
  flex-wrap: wrap;
}

.header-actions {
  min-width: 0;
}

.header-actions > * {
  flex: 0 1 auto;
}

.toolbar {
  grid-template-columns: minmax(240px, 1fr) minmax(180px, 240px) minmax(180px, 240px);
}

.agency-filter-card {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.pro-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

.pro-chart-grid,
.pro-table-grid {
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.pro-donut-wrap {
  grid-template-columns: minmax(140px, 170px) minmax(180px, 1fr);
}

.pro-bar-row,
.pro-split-row {
  grid-template-columns: minmax(120px, 1fr) minmax(140px, 2fr) auto;
}

.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: auto;
}

@media (max-width: 1320px) {
  .app-shell {
    grid-template-columns: 240px minmax(0, 1fr);
  }

  .report-view {
    padding: 18px;
  }

  .pro-chart-grid,
  .pro-table-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 920px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    max-height: 76px;
    overflow: hidden;
  }

  body.mobile-menu-open .sidebar {
    max-height: calc(100vh - 10px);
    overflow: auto;
  }

  .report-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar,
  .agency-filter-card,
  .pro-donut-wrap,
  .detail-page-grid,
  .detail-page-kpis {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .report-view,
  .sidebar {
    padding: 12px;
  }

  .pro-bar-row,
  .pro-split-row {
    grid-template-columns: 1fr;
  }

  .pro-kpi-grid,
  .pro-chart-grid,
  .pro-table-grid {
    grid-template-columns: 1fr;
  }

  .account-budget-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 1060px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    max-height: none;
  }

  .summary-grid,
  .insight-grid,
  .chart-dashboard,
  .mini-module-grid,
  .employee-page-grid,
  .report-workspace.active,
  .agency-filter-card,
  .pro-kpi-grid,
  .pro-chart-grid,
  .pro-table-grid,
  .date-strip {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 720px) {
  .app-shell {
    display: block;
  }

  .report-view,
  .sidebar {
    padding: 18px;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 30;
    height: auto;
    max-height: 72px;
    overflow: hidden;
    border-right: 0;
    border-bottom: 1px solid rgba(255,255,255,.14);
  }

  body.mobile-menu-open .sidebar {
    max-height: calc(100vh - 10px);
    overflow: auto;
  }

  .brand {
    margin-bottom: 0;
  }

  body.mobile-menu-open .brand {
    margin-bottom: 18px;
  }

  .collapse-btn {
    transform: rotate(-90deg);
  }

  body.mobile-menu-open .collapse-btn {
    transform: rotate(90deg);
  }

  .side-menu,
  .config-panel {
    display: none;
  }

  body.mobile-menu-open .side-menu,
  body.mobile-menu-open .config-panel {
    display: grid;
  }

  body.mobile-menu-open:not([data-view="settings"]) .config-panel {
    display: none;
  }

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

  .report-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .summary-grid,
  .insight-grid,
  .chart-dashboard,
  .mini-module-grid,
  .report-workspace.active,
  .share-kpis,
  .agency-filter-card,
  .agency-tabs,
  .pro-kpi-grid,
  .pro-chart-grid,
  .pro-table-grid,
  .pro-donut-wrap,
  .detail-breakdown,
  .date-strip,
  .toolbar,
  .employee-page-grid,
  .grid-2,
  .panel-actions {
    grid-template-columns: 1fr;
  }

  .report-header h2 {
    font-size: 24px;
  }

  .pro-kpi-grid strong {
    font-size: 20px;
  }

  .pro-bar-row,
  .pro-split-row {
    grid-template-columns: 1fr;
  }
}

/* Final layout guard: never clip the dashboard horizontally; stack instead. */
.report-view {
  overflow: visible !important;
}

.pro-kpi-grid {
  grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)) !important;
}

.agency-filter-card {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)) !important;
}

.pro-chart-grid,
.pro-table-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 360px), 1fr)) !important;
}

.toolbar {
  grid-template-columns: minmax(220px, 1fr) repeat(2, minmax(160px, 220px)) !important;
}

@media (max-width: 980px) {
  .toolbar,
  .agency-filter-card,
  .pro-chart-grid,
  .pro-table-grid,
  .pro-donut-wrap {
    grid-template-columns: 1fr !important;
  }
}

/* Hard tab mode: each left-menu item owns a separate screen. */
body[data-view] .report-view > .view-panel {
  display: none !important;
}

body[data-view="overview"] #overviewPro,
body[data-view="overview"] .progress-board[data-view-panel~="overview"],
body[data-view="overview"] #overview {
  display: block !important;
}

body[data-view="overview"] .mini-module-grid,
body[data-view="overview"] .chart-dashboard {
  display: grid !important;
}

body[data-view="accounts"] .toolbar,
body[data-view="accounts"] .date-strip,
body[data-view="campaigns"] .toolbar,
body[data-view="campaigns"] .date-strip {
  display: grid !important;
}

body[data-view="accounts"] #accounts,
body[data-view="campaigns"] #campaigns,
body[data-view="optimization"] #optimization,
body[data-view="pagecenter"] #pageCenter,
body[data-view="scale"] #scaleCenter,
body[data-view="compare"] #employeeCompare,
body[data-view="assistant"] #assistantPanel,
body[data-view="persona"] #persona,
body[data-view="employees"] #employees,
body[data-view="sharelinks"] #shareLinks,
body[data-view="reports"] #reports,
body[data-view="settings"] .progress-board[data-view-panel~="settings"] {
  display: block !important;
}

body[data-view="pagecenter"] #pageCenter {
  display: grid !important;
}

@media (max-width: 900px) {
  .optimization-hero {
    display: grid;
  }

  .optimization-controls {
    display: grid;
    grid-template-columns: 1fr;
  }

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

  .scale-kpis,
  .compare-kpis,
  .scale-grid {
    grid-template-columns: 1fr;
  }

  .compare-controls,
  .compare-grid {
    grid-template-columns: 1fr;
  }

  .compare-bar-row,
  .compare-detail-item {
    grid-template-columns: 1fr;
  }

  .compare-bar-row b {
    text-align: left;
  }

  .scale-suggestion {
    align-items: stretch;
    flex-direction: column;
  }

  .scale-actions {
    justify-content: flex-start;
  }

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

  .assistant-notify-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .optimization-kpis {
    grid-template-columns: 1fr;
  }

  .optimization-hero h3,
  .optimization-table-head h3 {
    font-size: 20px;
  }
}

@media (max-width: 1180px) {
  .persona-kpi-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

  .persona-budget-card {
    grid-column: 1 / -1;
    grid-row: auto;
  }
}

@media (max-width: 760px) {
  .persona-hero,
  .persona-actions,
  .persona-budget-layout {
    display: grid;
    grid-template-columns: 1fr;
  }

  .persona-actions input,
  .persona-actions select {
    min-width: 0;
    width: 100%;
  }

  .persona-kpi-grid,
  .persona-grid,
  .persona-analysis-grid {
    grid-template-columns: 1fr;
  }

  .persona-top-campaign-card {
    grid-column: auto;
  }

  .persona-top-list button {
    grid-template-columns: 28px 1fr auto;
  }

  .persona-top-list i {
    grid-column: 2 / -1;
  }

  .persona-hero h2 {
    font-size: 24px;
  }

  .persona-bar-row {
    grid-template-columns: 76px 1fr;
  }

  .persona-bar-row strong {
    grid-column: 2;
  }
}

@media print {
  body.printing-persona .sidebar,
  body.printing-persona .report-header,
  body.printing-persona .report-view > .view-panel:not(#persona) {
    display: none !important;
  }

  body.printing-persona .report-view,
  body.printing-persona .app-shell {
    display: block !important;
    padding: 0 !important;
    margin: 0 !important;
    background: #fff !important;
  }

  body.printing-persona #persona {
    display: block !important;
  }

  body.printing-persona .persona-hero,
  body.printing-persona .persona-card,
  body.printing-persona .persona-kpi-grid article {
    box-shadow: none !important;
    break-inside: avoid;
    background: #fff !important;
  }

  body.printing-persona .persona-card header button,
  body.printing-persona .persona-actions button {
    display: none !important;
  }

  body.printing-persona .pdf-skip,
  body.printing-persona.pdf-hide-kpis #personaKpis {
    display: none !important;
  }
}

body[data-view="reports"] .report-header {
  display: none !important;
}

body[data-view="reports"] .report-builder {
  margin-top: 0 !important;
}

#reports,
.removed-view,
.side-menu button[data-view="reports"] {
  display: none !important;
}

/* Mobile sidebar fix: closed menu must not reserve full viewport height. */
@media (max-width: 720px) {
  .app-shell {
    min-height: 0 !important;
  }

  .sidebar {
    min-height: 54px !important;
    height: 54px !important;
    max-height: 54px !important;
    overflow: hidden !important;
  }

  body.mobile-menu-open .sidebar {
    height: auto !important;
    max-height: calc(100vh - 8px) !important;
    overflow: auto !important;
  }

  .brand {
    height: 38px !important;
  }

  .header-custom-range {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
    padding: 6px;
  }

  .header-custom-range input {
    width: 100%;
    min-width: 0;
  }
}

/* Final persona budget fix: show metrics first and chart below without clipped numbers. */
.persona-budget-card,
.persona-budget-card * {
  min-width: 0;
}

.persona-budget-card {
  overflow: hidden;
}

.persona-budget-card .persona-budget-layout {
  display: grid;
  grid-template-columns: 1fr !important;
  gap: 16px;
  align-items: start;
}

.persona-budget-card .persona-donut {
  width: min(270px, 72%) !important;
  max-width: 270px;
  justify-self: center;
  order: 2;
}

.persona-budget-card .persona-legend {
  order: 1;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  width: 100%;
  min-width: 0;
  overflow: visible;
}

.persona-budget-card .persona-legend div {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  gap: 6px 8px;
  align-items: start;
  padding: 10px 12px;
  border: 1px solid #d9e8ef;
  border-radius: 14px;
  background: rgba(255, 255, 255, .78);
}

.persona-budget-card .persona-legend span {
  min-width: 0;
  overflow-wrap: anywhere;
  line-height: 1.15;
  font-size: clamp(13px, 1vw, 15px);
}

.persona-budget-card .persona-legend strong {
  grid-column: 2;
  min-width: 0;
  max-width: 100%;
  white-space: normal !important;
  overflow-wrap: anywhere;
  word-break: break-word;
  text-align: left;
  line-height: 1.14;
  font-size: clamp(16px, 1.35vw, 22px);
}

@media (max-width: 1280px) {
  .persona-budget-card .persona-donut {
    width: min(250px, 70vw) !important;
    max-width: 250px;
  }
}

@media (max-width: 620px) {
  .persona-budget-card .persona-legend div {
    grid-template-columns: 10px minmax(0, 1fr) !important;
  }

  .persona-budget-card .persona-legend {
    grid-template-columns: 1fr;
  }
}

/* Page Center */
.page-center-dashboard {
  display: grid;
  gap: 16px;
}

.page-center-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 6px;
  background: rgba(255, 255, 255, .72);
  border: 1px solid #d9e8ef;
  border-radius: 18px;
}

.page-center-tabs button {
  border: 0;
  border-radius: 14px;
  padding: 12px 16px;
  background: transparent;
  color: #64748b;
  font-weight: 800;
  white-space: nowrap;
}

.page-center-tabs button.active {
  background: linear-gradient(135deg, #0ea5a6, #1d4ed8);
  color: #fff;
  box-shadow: 0 10px 26px rgba(14, 165, 166, .22);
}

.page-center-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.page-center-card,
.page-bulk-card,
.page-health-card {
  border: 1px solid #d6e8ef;
  border-radius: 22px;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 16px 38px rgba(15, 23, 42, .07);
  padding: 18px;
}

.page-center-card h3,
.page-bulk-card h3 {
  margin: 0 0 12px;
  color: #0f172a;
}

.page-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.page-card-head h3 {
  margin-bottom: 0;
}

.page-card-head > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.page-lead-focus {
  background: linear-gradient(135deg, rgba(240, 253, 250, .95), rgba(255, 255, 255, .9));
}

.page-lead-total {
  display: block;
  margin: 8px 0 2px;
  font-size: clamp(32px, 5vw, 56px);
  line-height: 1;
  color: #0f766e;
}

.page-lead-focus > small {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
  font-weight: 800;
}

.page-mini {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.page-mini img,
.page-mini > span {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  flex: 0 0 auto;
  object-fit: cover;
  background: #dff7f5;
  display: grid;
  place-items: center;
  color: #0f766e;
  font-weight: 900;
}

.page-mini div,
.page-row-mini {
  min-width: 0;
}

.page-mini strong,
.page-row-mini b {
  display: block;
  color: #0f172a;
  overflow-wrap: anywhere;
}

.page-mini small,
.page-row-mini small,
.page-row-mini span {
  display: block;
  color: #64748b;
  line-height: 1.4;
  overflow-wrap: anywhere;
}

.page-row-mini {
  padding: 12px 0;
  border-bottom: 1px solid #e6eef3;
}

.page-row-mini:last-child {
  border-bottom: 0;
}

.page-health-grid,
.page-post-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
}

.page-health-card.ok {
  border-color: #b8eadf;
  background: linear-gradient(145deg, #f7fffd, #eefcf8);
}

.page-health-card.warning {
  border-color: #fde68a;
  background: linear-gradient(145deg, #fffdf2, #fff7d6);
}

.page-health-card.danger {
  border-color: #fecaca;
  background: linear-gradient(145deg, #fff7f7, #fee2e2);
}

.page-health-lines {
  display: grid;
  gap: 8px;
  margin: 14px 0;
  color: #64748b;
}

.page-health-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 8px 12px;
  font-weight: 900;
  background: #dcfce7;
  color: #047857;
}

.page-health-badge.warning {
  background: #fef3c7;
  color: #a16207;
}

.page-health-badge.danger {
  background: #fee2e2;
  color: #b91c1c;
}

.page-post-card {
  border: 1px solid #d9e8ef;
  border-radius: 18px;
  background: #fff;
  padding: 12px;
  display: grid;
  gap: 10px;
}

.page-post-card img,
.page-post-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  border-radius: 14px;
  background: #eef6f8;
  display: grid;
  place-items: center;
  color: #64748b;
  font-weight: 800;
}

.page-post-card p {
  margin: 0;
  color: #334155;
  line-height: 1.45;
  max-height: 7.5em;
  overflow: auto;
}

.page-post-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.page-post-stats span {
  border-radius: 999px;
  background: #eef6f8;
  padding: 8px 10px;
  color: #0f766e;
  font-weight: 800;
}

.page-bulk-section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.page-bulk-section-head h4 {
  margin: 0;
}

.page-bulk-section-head > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-bulk-pages {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.bulk-page-option {
  display: grid;
  grid-template-columns: 18px 34px minmax(0, 1fr);
  grid-template-areas:
    "check avatar name"
    "check avatar id";
  align-items: center;
  column-gap: 10px;
  row-gap: 2px;
  border: 1px solid #d9e8ef;
  border-radius: 12px;
  background: #fff;
  padding: 8px 10px;
  color: #0f172a;
  font-weight: 800;
  cursor: pointer;
}

.bulk-page-option:hover {
  border-color: #0ea5a4;
  box-shadow: 0 10px 22px rgba(14, 165, 164, .1);
}

.bulk-page-option.is-selected {
  border-color: #0ea5a4;
  background: #ecfdfb;
}

.bulk-page-option input {
  grid-area: check;
  width: 16px !important;
  height: 16px !important;
  min-height: 16px !important;
  margin: 0;
  padding: 0;
  accent-color: #0ea5a4;
}

.bulk-page-option span {
  grid-area: avatar;
}

.bulk-page-option img,
.bulk-page-option i {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 10px;
  background: #e6f8f6;
  object-fit: cover;
  color: #0f766e;
  font-size: 11px;
  font-style: normal;
}

.bulk-page-option b {
  grid-area: name;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bulk-page-option em {
  grid-area: id;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

.bulk-selected-count {
  display: inline-flex;
  margin: 0 0 10px;
  border-radius: 999px;
  background: #fff7db;
  color: #925f00;
  padding: 6px 10px;
  font-weight: 900;
}

.bulk-post-status {
  min-height: 50px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fffaf0;
  color: var(--muted);
  font-weight: 900;
}

.bulk-progress {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border: 1px solid #bdeee9;
  border-radius: 14px;
  background: #f0fdfa;
  color: var(--teal);
}

.bulk-progress.done {
  border-color: #bbf7d0;
  background: #ecfdf5;
  color: #047857;
}

.bulk-progress > span:not(.mini-loader) {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--teal);
  color: #fff;
  font-weight: 1000;
}

.bulk-progress b {
  display: block;
  color: var(--ink);
}

.bulk-progress small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-weight: 800;
}

.bulk-result-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.bulk-result-list a,
.bulk-result-error {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

.bulk-result-list a:hover {
  border-color: var(--teal);
  box-shadow: 0 10px 22px rgba(14, 165, 164, 0.12);
}

.bulk-result-list span,
.bulk-result-error span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.bulk-result-error {
  border-color: #fecdd3;
  background: #fff1f2;
  color: #991b1b;
}

[data-page-publish]:disabled {
  cursor: not-allowed;
  opacity: 0.68;
}

.page-bulk-card {
  display: grid;
  gap: 14px;
}

.page-bulk-layout {
  display: grid;
  grid-template-columns: minmax(280px, .8fr) minmax(320px, 1fr);
  gap: 16px;
  align-items: start;
}

.page-bulk-layout section {
  min-width: 0;
  border: 1px solid #d9e8ef;
  border-radius: 18px;
  background: #f8fcfd;
  padding: 14px;
}

.page-bulk-layout h4 {
  margin: 0 0 10px;
  color: #0f172a;
}

.page-bulk-card textarea,
.page-bulk-card input,
.page-bulk-card select {
  width: 100%;
}

.page-media-box small {
  display: block;
  margin-top: 10px;
  color: #64748b;
  font-weight: 700;
}

.media-drop {
  display: grid;
  gap: 8px;
  min-height: 132px;
  place-items: center;
  text-align: center;
  border: 2px dashed #b7d5df;
  border-radius: 18px;
  background: linear-gradient(135deg, #fff, #eefafa);
  cursor: pointer;
}

.media-drop input {
  max-width: 220px;
}

.media-drop span {
  color: #0f766e;
  font-weight: 900;
}

.media-drop strong {
  color: #0f172a;
  overflow-wrap: anywhere;
}

.conversation-row {
  width: 100%;
  border: 0;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.conversation-row:hover {
  background: #f1fbfb;
}

.page-message-modal {
  z-index: 42;
}

.page-message-panel {
  width: min(920px, calc(100vw - 28px));
  height: min(760px, calc(100vh - 28px));
  margin: 0 auto;
  grid-template-rows: auto 1fr;
}

.page-message-body {
  overflow: auto;
  padding: 18px;
  display: grid;
  gap: 12px;
  background: #f3f8fa;
}

.message-bubble {
  max-width: 760px;
  border: 1px solid #d5e7ee;
  border-radius: 16px;
  background: #fff;
  padding: 12px 14px;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .06);
}

.message-bubble strong,
.message-bubble small {
  display: block;
}

.message-bubble p {
  margin: 7px 0;
  white-space: pre-wrap;
  line-height: 1.45;
}

.message-attachments {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
}

.message-attachments a {
  border-radius: 999px;
  background: #e6f8f6;
  padding: 7px 10px;
  color: #0f766e;
  font-weight: 900;
}

.page-center-empty {
  border: 1px dashed #bdd6e3;
  border-radius: 18px;
  padding: 24px;
  color: #64748b;
  font-weight: 800;
  background: rgba(255, 255, 255, .62);
}

@media (max-width: 860px) {
  .page-center-grid {
    grid-template-columns: 1fr;
  }

  .page-center-hero .optimization-controls {
    grid-template-columns: 1fr;
  }

  .page-bulk-layout {
    grid-template-columns: 1fr;
  }
}
