﻿:root {
  --brand: #148392;
  --brand-strong: #0f6f7b;
  --brand-soft: rgba(20, 131, 146, 0.14);
  --success: #24b47e;
  --warning: #d49b16;
  --danger: #d85d5d;
  --radius-sm: 8px;
  --radius-md: 12px;
  --rail-width: 84px;
  --sidebar-width: 288px;
  --sidebar-collapsed: 78px;
  --topbar-height: 76px;
  --shadow-soft: 0 22px 70px rgba(10, 30, 36, 0.14);
  font-size: 16px;
}

html[data-theme="light"] {
  --bg: #f4f8f8;
  --surface: #ffffff;
  --surface-raised: #fdfefe;
  --surface-muted: #eef5f5;
  --border: rgba(15, 48, 54, 0.12);
  --text: #13282d;
  --text-muted: #687c82;
  --text-soft: #8da0a5;
  --rail-bg: #102a2f;
  --rail-text: #d8eeee;
  --sidebar-bg: #ffffff;
  --input-bg: #f3f8f8;
}

html[data-theme="dark"] {
  --bg: #101617;
  --surface: #182122;
  --surface-raised: #1f2a2c;
  --surface-muted: #243234;
  --border: rgba(222, 245, 247, 0.1);
  --text: #eef7f8;
  --text-muted: #a7b8bc;
  --text-soft: #74898e;
  --rail-bg: #0b1112;
  --rail-text: #d9eeee;
  --sidebar-bg: #151d1f;
  --input-bg: #202c2e;
  --shadow-soft: 0 22px 70px rgba(0, 0, 0, 0.36);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at 18% 8%, var(--brand-soft), transparent 28rem),
    linear-gradient(140deg, var(--bg), var(--surface-muted));
  color: var(--text);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

body.has-open-modal {
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input {
  font: inherit;
}

svg {
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.portal-shell {
  display: grid;
  grid-template-columns: var(--rail-width) var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
}

.module-rail {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100vh;
  padding: 18px 12px;
  background: var(--rail-bg);
  color: var(--rail-text);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
}

.brand-mark,
.brand-symbol {
  display: grid;
  place-items: center;
}

.brand-mark {
  position: relative;
  width: 60px;
  height: 60px;
  margin-bottom: 18px;
  color: #ffffff;
}

.brand-logo {
  position: relative;
  z-index: 1;
  width: 58px;
  height: auto;
  filter: drop-shadow(0 10px 24px rgba(0, 0, 0, 0.28));
}

.brand-symbol {
  z-index: 1;
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--brand), #1ba2a2);
  font-weight: 800;
}

.brand-pulse {
  position: absolute;
  inset: 6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(20, 131, 146, 0.24), rgba(20, 131, 146, 0.04) 72%, transparent 74%);
}

.module-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 100%;
}

.module-button,
.icon-button {
  display: grid;
  place-items: center;
  border: 0;
  cursor: pointer;
}

.module-button {
  position: relative;
  width: 100%;
  height: 48px;
  border-radius: var(--radius-sm);
  color: rgba(236, 250, 250, 0.74);
  background: transparent;
  text-decoration: none;
}

.module-button svg,
.icon-button svg {
  width: 21px;
  height: 21px;
}

.module-button:hover,
.module-button.is-active {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.module-button.is-active::before {
  content: "";
  position: absolute;
  left: -12px;
  width: 4px;
  height: 28px;
  border-radius: 0 6px 6px 0;
  background: var(--brand);
}

.rail-footer {
  display: grid;
  gap: 10px;
  width: 100%;
  margin-top: auto;
}

.rail-footer::before {
  content: "";
  display: block;
  width: 34px;
  height: 1px;
  margin: 0 auto 4px;
  background: rgba(255, 255, 255, 0.14);
}

.icon-button {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.module-rail .icon-button {
  color: var(--rail-text);
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.1);
}

.rail-action-button {
  display: grid;
  place-items: center;
  width: 100%;
  height: 44px;
  border: 0;
  border-radius: var(--radius-sm);
  color: rgba(236, 250, 250, 0.68);
  background: transparent;
  cursor: pointer;
}

.rail-menu-group {
  position: relative;
  width: 100%;
}

.rail-action-button svg {
  width: 21px;
  height: 21px;
}

.rail-action-button:hover,
.rail-settings-button:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.rail-settings-button svg {
  width: 24px;
  height: 24px;
}

.rail-popover-menu {
  position: absolute;
  left: calc(100% + 14px);
  bottom: 0;
  z-index: 40;
  display: grid;
  gap: 6px;
  min-width: 220px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background:
    linear-gradient(180deg, color-mix(in srgb, var(--surface-raised) 88%, transparent), var(--surface)),
    var(--surface);
  box-shadow: var(--shadow-soft);
}

.rail-popover-menu[hidden] {
  display: none;
}

.rail-popover-link,
.rail-popover-button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--radius-sm);
  color: var(--text);
  background: transparent;
  font-weight: 700;
  text-align: left;
}

.rail-popover-link:hover,
.rail-popover-button:hover {
  background: var(--brand-soft);
}

.rail-popover-form {
  margin: 0;
}

.rail-popover-danger {
  color: var(--danger);
}

.rail-menu-group.is-open .rail-action-button {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.1);
}

.rail-footer .icon-button {
  width: 100%;
  height: 44px;
}

.module-sidebar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  flex-direction: column;
  height: 100vh;
  padding: 22px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--border);
  box-shadow: var(--shadow-soft);
  transition: width 180ms ease, padding 180ms ease;
}

.portal-shell[data-sidebar-state="collapsed"] {
  grid-template-columns: var(--rail-width) var(--sidebar-collapsed) minmax(0, 1fr);
}

.portal-shell[data-sidebar-state="collapsed"] .module-sidebar {
  padding: 18px 12px;
  overflow: hidden;
}

.portal-shell[data-sidebar-state="collapsed"] .sidebar-head h1,
.portal-shell[data-sidebar-state="collapsed"] .sidebar-head .eyebrow,
.portal-shell[data-sidebar-state="collapsed"] .sidebar-search input,
.portal-shell[data-sidebar-state="collapsed"] .context-link,
.portal-shell[data-sidebar-state="collapsed"] .context-section-label,
.portal-shell[data-sidebar-state="collapsed"] .sidebar-card div {
  display: none;
}

.sidebar-head,
.topbar,
.panel-heading,
.login-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

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

.sidebar-head h1,
.topbar-title strong,
.panel-heading h3,
.login-card h2 {
  margin: 0;
  color: var(--text);
}

.sidebar-head h1 {
  font-size: 1.55rem;
}

.sidebar-search {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 46px;
  margin: 24px 0;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  background: var(--input-bg);
}

.sidebar-search svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sidebar-search input {
  min-width: 0;
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}

.context-nav {
  min-height: 0;
  overflow: auto;
  padding-right: 4px;
}

.module-menu {
  display: none;
}

.module-menu.is-active {
  display: grid;
  gap: 8px;
}

.context-link {
  display: flex;
  align-items: center;
  min-height: 42px;
  padding: 0 12px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-weight: 700;
}

.context-section-label {
  display: block;
  margin: 14px 10px 4px;
  color: var(--text-soft);
  font-size: 0.68rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.module-menu .context-section-label:first-child {
  margin-top: 0;
}

.context-link:hover,
.context-link.is-active {
  color: var(--text);
  background: var(--brand-soft);
}

.context-link.is-hidden {
  display: none;
}

.context-section-label.is-hidden {
  display: none;
}

.sidebar-card {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: auto;
  padding: 14px;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.sidebar-card strong,
.sidebar-card small {
  display: block;
}

.sidebar-card small {
  color: var(--text-muted);
}

.status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  flex: 0 0 auto;
  border-radius: 999px;
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(36, 180, 126, 0.14);
}

.status-dot.muted {
  background: var(--warning);
  box-shadow: 0 0 0 4px rgba(212, 155, 22, 0.16);
}

.portal-main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: var(--topbar-height);
  padding: 16px 28px;
  background: color-mix(in srgb, var(--bg) 78%, transparent);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(18px);
}

.topbar-title {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar-title span,
.account-chip span,
.metric-card span,
.panel-label {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.topbar-search,
.ghost-button,
.primary-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  cursor: pointer;
  font-weight: 800;
}

.topbar-search {
  gap: 8px;
  min-width: 156px;
  height: 42px;
  color: var(--text-muted);
  background: var(--surface);
}

.topbar-search svg {
  width: 18px;
  height: 18px;
}

.notification-button span {
  position: absolute;
  top: -5px;
  right: -5px;
  display: grid;
  place-items: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--brand);
  font-size: 0.68rem;
  font-weight: 900;
}

.account-chip {
  min-width: 150px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  border: 1px solid var(--border);
}

.account-chip strong {
  display: block;
  max-width: 180px;
  overflow: hidden;
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ghost-button {
  height: 42px;
  padding: 0 16px;
  color: var(--text);
  background: var(--surface);
}

.content-surface {
  padding: 28px;
}

.settings-page-shell {
  display: grid;
  gap: 22px;
  max-width: 760px;
}

.settings-admin-shell {
  display: grid;
  gap: 22px;
}

.settings-admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(320px, 0.9fr);
  gap: 20px;
  align-items: start;
}

.settings-list-card,
.settings-editor-card,
.settings-result-card {
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--surface), var(--surface-raised));
  box-shadow: var(--shadow-soft);
}

.settings-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.settings-card-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.settings-card-head h2,
.settings-card-head h3 {
  margin: 4px 0 0;
}

.settings-filter-form {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.settings-filter-row,
.settings-form-grid,
.settings-form-actions,
.settings-inline-actions,
.settings-lookup-grid {
  display: grid;
  gap: 12px;
}

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

.settings-form-grid.two-columns {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.settings-form-actions {
  grid-template-columns: repeat(2, max-content);
  justify-content: start;
}

.settings-inline-actions {
  grid-template-columns: repeat(2, max-content);
  align-items: center;
}

.settings-input,
.settings-textarea,
.settings-select {
  width: 100%;
  min-height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--input-bg);
  outline: 0;
}

.settings-textarea {
  min-height: 120px;
  padding: 14px;
  resize: vertical;
}

.settings-input:focus,
.settings-textarea:focus,
.settings-select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.settings-checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--text-muted);
  font-weight: 700;
}

.settings-checkbox-row input {
  margin-right: 8px;
  accent-color: var(--brand);
}

.settings-permission-form {
  display: grid;
  gap: 18px;
}

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

.settings-permission-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface-raised);
}

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

.settings-permission-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: flex-start;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.settings-permission-option input {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--brand);
}

.settings-permission-option strong,
.settings-permission-option small {
  display: block;
}

.settings-permission-option small {
  margin-top: 3px;
  color: var(--text-muted);
}

.settings-table-wrap {
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.settings-table {
  width: 100%;
  border-collapse: collapse;
}

.settings-table th,
.settings-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
}

.settings-table th {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: color-mix(in srgb, var(--surface-muted) 70%, transparent);
}

.settings-table tbody tr:last-child td {
  border-bottom: 0;
}

.settings-table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.config-envio-table {
  min-width: 1960px;
}

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

.config-envio-cell-form {
  margin: 0;
}

.config-envio-cell-form .settings-select {
  min-width: 130px;
  padding: 0.55rem 0.65rem;
}

.settings-mini-button,
.settings-delete-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 800;
  cursor: pointer;
}

.settings-mini-button {
  color: var(--text);
  background: var(--surface);
}

.settings-delete-button {
  color: var(--danger);
  background: rgba(216, 93, 93, 0.08);
}

.settings-status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--success);
  font-weight: 800;
}

.whatsapp-qr-modal {
  width: min(520px, 100%);
}

.whatsapp-qr-modal-body {
  display: grid;
  justify-items: center;
  gap: 16px;
  margin: 18px 0 22px;
  text-align: center;
}

.whatsapp-qr-timer {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-muted);
  font-weight: 800;
}

.whatsapp-qr-image {
  width: 260px;
  max-width: 100%;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.settings-status::before {
  content: "";
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: currentColor;
}

.settings-status.is-inactive {
  color: var(--warning);
}

.settings-meta {
  display: block;
  margin-top: 4px;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.settings-empty {
  padding: 28px 18px;
  color: var(--text-muted);
  text-align: center;
}

.settings-form-note {
  color: var(--text-muted);
  font-size: 0.92rem;
}

.settings-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(4, 12, 14, 0.62);
  backdrop-filter: blur(10px);
}

.settings-modal-backdrop[hidden] {
  display: none;
}

.settings-modal {
  width: min(780px, 100%);
  max-height: min(86vh, 920px);
  overflow: auto;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background:
    linear-gradient(180deg, var(--surface), var(--surface-raised)),
    var(--surface);
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.34);
}

.settings-modal-wide {
  width: min(980px, 100%);
}

.settings-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.settings-modal-head h2 {
  margin: 0;
}

.settings-modal-close {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--surface-muted);
  font-size: 1.4rem;
  font-weight: 900;
  line-height: 1;
}

.settings-result-grid {
  display: grid;
  gap: 14px;
}

.settings-result-item {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.settings-result-item span {
  display: block;
  margin-bottom: 4px;
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 900;
  text-transform: uppercase;
}

.settings-page-hero h1 {
  margin: 0;
  font-size: 2rem;
}

.settings-page-hero p:last-child {
  max-width: 680px;
  margin: 12px 0 0;
  color: var(--text-muted);
}

.settings-form-card {
  padding: 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, var(--surface), var(--surface-raised));
  box-shadow: var(--shadow-soft);
}

.settings-form-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.field-hint {
  margin-top: -4px;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.form-alert {
  margin-bottom: 18px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-weight: 700;
}

.form-alert.success {
  color: #0b5f4d;
  background: rgba(36, 180, 126, 0.16);
  border-color: rgba(36, 180, 126, 0.28);
}

.form-alert.error {
  color: #ffffff;
  background: var(--danger);
  border-color: rgba(216, 93, 93, 0.48);
}

.dashboard-hero,
.workspace-panel,
.metric-card,
.login-card,
.login-brand-panel {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.dashboard-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 340px);
  gap: 22px;
  margin-bottom: 22px;
  padding: 28px;
  border-radius: var(--radius-md);
}

.dashboard-hero h2 {
  max-width: 820px;
  margin: 0;
  color: var(--text);
  font-size: 2rem;
  line-height: 1.14;
}

.embedded-app-frame {
  display: block;
  width: 100%;
  height: calc(100vh - var(--topbar-height));
  border: 0;
  background: #ffffff;
}

.portal-shell[data-active-module="dashboard"],
.portal-shell[data-active-module="attendance"] {
  grid-template-columns: var(--rail-width) minmax(0, 1fr);
}

.portal-shell[data-active-module="dashboard"] .module-sidebar,
.portal-shell[data-active-module="attendance"] .module-sidebar {
  display: none;
}

.portal-shell[data-active-module="dashboard"] .portal-main,
.portal-shell[data-active-module="attendance"] .portal-main {
  grid-column: 2;
}

.portal-shell[data-active-module="attendance"] .content-surface {
  min-height: calc(100vh - var(--topbar-height));
  padding: 0;
}

.portal-shell[data-active-module="attendance"] .topbar {
  display: none;
}

.portal-shell[data-active-module="attendance"] .embedded-app-frame {
  height: 100vh;
  border: 0;
  background: #ffffff;
}

.hero-copy {
  max-width: 760px;
  margin: 14px 0 0;
  color: var(--text-muted);
}

.hero-panel {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 20px;
  border-radius: var(--radius-md);
  color: var(--text);
  background: linear-gradient(135deg, var(--brand-soft), var(--surface-muted));
  border: 1px solid var(--border);
}

.hero-panel strong {
  overflow: hidden;
  font-size: 1.15rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.hero-panel small,
.metric-card small,
.activity-list small,
.module-list span,
.channel-list small {
  color: var(--text-muted);
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.metric-card {
  display: grid;
  gap: 8px;
  min-height: 132px;
  padding: 20px;
  border-radius: var(--radius-md);
}

.metric-card strong {
  color: var(--text);
  font-size: 1.9rem;
}

.metric-card.accent {
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand), #0c5963);
}

.metric-card.accent span,
.metric-card.accent small,
.metric-card.accent strong {
  color: #ffffff;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(280px, 0.75fr);
  gap: 18px;
}

.campaign-shell {
  display: grid;
  gap: 22px;
}

.campaign-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 28px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background:
    radial-gradient(circle at 10% 0, rgba(20, 131, 146, 0.18), transparent 34%),
    linear-gradient(135deg, var(--surface), var(--surface-muted));
  box-shadow: var(--shadow-soft);
}

.campaign-hero h2 {
  margin: 0;
  color: var(--text);
  font-size: 2rem;
}

.campaign-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.campaign-chart-panel {
  min-height: 340px;
}

.campaign-bars {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: end;
  gap: 12px;
  min-height: 250px;
  margin-top: 20px;
}

.campaign-bar-item {
  display: grid;
  gap: 8px;
  justify-items: center;
  min-width: 0;
}

.campaign-bar-track {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: end;
  width: 100%;
  height: 170px;
  border-radius: 999px;
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.campaign-bar-fill {
  display: block;
  width: 100%;
  border-radius: 999px;
  background: linear-gradient(180deg, var(--brand), #0c5963);
}

.campaign-bar-item strong,
.campaign-list-row strong,
.campaign-progress-item strong,
.campaign-empty-state strong {
  color: var(--text);
}

.campaign-bar-item small,
.campaign-list-row span,
.campaign-list-row small,
.campaign-progress-item span,
.campaign-progress-item small,
.campaign-report-card p,
.campaign-empty-state p {
  color: var(--text-muted);
}

.campaign-progress-list,
.campaign-list {
  display: grid;
  gap: 12px;
  margin-top: 18px;
}

.campaign-progress-item,
.campaign-list-row,
.campaign-empty-state {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
}

.campaign-progress-track {
  overflow: hidden;
  height: 9px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--border) 60%, transparent);
}

.campaign-progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--brand), #24b47e);
}

.campaign-list-row {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
}

.campaign-list-row div {
  display: grid;
  gap: 3px;
}

.campaign-list-row em {
  justify-self: end;
  padding: 6px 9px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
  font-style: normal;
  font-weight: 900;
}

.campaign-report-grid {
  display: grid;
  gap: 18px;
}

.campaign-report-card {
  display: grid;
  gap: 16px;
}

.campaign-report-filters {
  margin: 0;
}

.campaign-avatar,
.campaign-avatar-placeholder {
  width: 42px;
  height: 42px;
  border-radius: 999px;
}

.campaign-avatar {
  object-fit: cover;
  border: 1px solid var(--border);
}

.campaign-avatar-placeholder {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--brand) 18%, transparent);
  color: var(--brand-strong);
  font-weight: 900;
  letter-spacing: 0.03em;
}

.settings-table tr.is-muted td {
  opacity: 0.65;
}

.workspace-panel {
  padding: 22px;
  border-radius: var(--radius-md);
}

.module-overview {
  grid-row: span 2;
}

.panel-badge {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--brand);
  background: var(--brand-soft);
  font-weight: 900;
}

.module-list,
.channel-list {
  display: grid;
  gap: 10px;
  margin-top: 20px;
}

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

.module-list div,
.channel-list div {
  display: grid;
  gap: 4px;
  min-height: 74px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.module-list strong,
.channel-list strong,
.activity-list strong {
  color: var(--text);
}

.activity-list {
  display: grid;
  gap: 14px;
  margin: 18px 0 0;
  padding: 0;
  list-style: none;
}

.activity-list li {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 12px;
}

.activity-list li > span {
  width: 10px;
  height: 10px;
  margin-top: 6px;
  border-radius: 50%;
  background: var(--brand);
}

.channel-list div {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}

.channel-list small {
  grid-column: 2;
}

.auth-body {
  min-height: 100vh;
}

.auth-shell {
  display: grid;
  min-height: 100vh;
  padding: 28px;
}

.login-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(360px, 440px);
  gap: 28px;
  width: min(1120px, 100%);
  margin: auto;
}

.login-brand-panel,
.login-card {
  border-radius: 18px;
}

.login-brand-panel {
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  min-height: 620px;
  padding: 42px;
  overflow: hidden;
  background:
    linear-gradient(145deg, rgba(20, 131, 146, 0.92), rgba(10, 41, 47, 0.96)),
    var(--brand);
  color: #ffffff;
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: auto;
  font-size: 1.3rem;
}

.login-brand-logo {
  width: 92px;
  height: auto;
  filter: drop-shadow(0 20px 34px rgba(0, 0, 0, 0.26));
}

.login-brand-copy {
  display: grid;
  gap: 2px;
}

.login-brand-copy strong {
  font-size: 1.5rem;
  letter-spacing: 0.02em;
}

.login-brand-copy small {
  color: rgba(255, 255, 255, 0.72);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-brand-panel .eyebrow,
.login-brand-panel p,
.login-brand-panel h1 {
  color: #ffffff;
}

.login-brand-panel h1 {
  max-width: 700px;
  margin: 0;
  font-size: 2.35rem;
  line-height: 1.1;
}

.login-brand-panel p:not(.eyebrow) {
  max-width: 640px;
  margin: 18px 0 0;
  color: rgba(255, 255, 255, 0.78);
}

.login-highlights {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

.login-highlights span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  font-weight: 800;
}

.login-card {
  align-self: center;
  padding: 30px;
}

.auth-alert {
  margin: 18px 0;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  color: #ffffff;
  background: var(--danger);
}

.login-form {
  display: grid;
  gap: 16px;
  margin-top: 24px;
}

.field-group {
  display: grid;
  gap: 8px;
  color: var(--text);
  font-weight: 800;
}

.field-group input {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  background: var(--input-bg);
  outline: 0;
}

.field-group input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px var(--brand-soft);
}

.check-row {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-muted);
  font-weight: 700;
}

.check-row input {
  width: 18px;
  height: 18px;
  accent-color: var(--brand);
}

.primary-action {
  height: 50px;
  color: #ffffff;
  background: var(--brand);
  border-color: var(--brand);
}

.primary-action:hover,
.ghost-button:hover,
.icon-button:hover,
.topbar-search:hover {
  filter: brightness(1.04);
}

.mobile-menu-button {
  display: none;
}

@media (max-width: 1180px) {
  .portal-shell {
    grid-template-columns: var(--rail-width) minmax(0, 1fr);
  }

  .module-sidebar {
    position: fixed;
    left: var(--rail-width);
    width: var(--sidebar-width);
    transform: translateX(0);
  }

  .portal-shell[data-sidebar-state="collapsed"] .module-sidebar {
    transform: translateX(calc(-1 * var(--sidebar-width)));
  }

  .portal-main {
    grid-column: 2;
  }

  .mobile-menu-button {
    display: grid;
  }

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

  .dashboard-grid,
  .campaign-dashboard-grid,
  .dashboard-hero,
  .campaign-hero,
  .login-shell,
  .settings-admin-grid,
  .settings-permission-grid,
  .settings-filter-row,
  .settings-form-grid.two-columns {
    grid-template-columns: 1fr;
  }

  .login-brand-panel {
    min-height: 360px;
  }
}

@media (max-width: 760px) {
  .portal-shell,
  .portal-shell[data-sidebar-state="collapsed"] {
    grid-template-columns: 1fr;
  }

  .module-rail {
    position: fixed;
    inset: auto 0 0;
    flex-direction: row;
    width: 100%;
    height: 72px;
    padding: 8px 10px;
    border-right: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
  }

  .brand-mark,
  .rail-footer {
    display: none;
  }

  .module-nav {
    flex-direction: row;
    gap: 6px;
    overflow-x: auto;
  }

  .module-button {
    min-width: 48px;
  }

  .module-button.is-active::before {
    left: 10px;
    bottom: -8px;
    width: 28px;
    height: 4px;
    border-radius: 6px 6px 0 0;
  }

  .module-sidebar {
    left: 0;
    width: min(320px, calc(100vw - 24px));
  }

  .portal-main {
    grid-column: 1;
    padding-bottom: 82px;
  }

  .topbar {
    padding: 12px 16px;
  }

  .topbar-actions {
    gap: 8px;
  }

  .topbar-search,
  .account-chip {
    display: none;
  }

  .content-surface,
  .auth-shell {
    padding: 16px;
  }

  .dashboard-hero,
  .workspace-panel,
  .metric-card,
  .campaign-hero,
  .login-card,
  .login-brand-panel,
  .settings-list-card,
  .settings-editor-card,
  .settings-result-card,
  .settings-form-card {
    padding: 18px;
  }

  .dashboard-hero h2,
  .campaign-hero h2,
  .login-brand-panel h1 {
    font-size: 1.65rem;
  }

  .metric-grid,
  .module-list {
    grid-template-columns: 1fr;
  }

  .campaign-hero {
    align-items: flex-start;
    flex-direction: column;
  }

  .campaign-bars {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .campaign-list-row {
    grid-template-columns: 1fr;
  }

  .campaign-list-row em {
    justify-self: start;
  }

  .embedded-app-frame {
    min-height: calc(100vh - 250px);
  }
}

