:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --ink: #16202a;
  --muted: #627084;
  --line: #dfe5ee;
  --primary: #0b6bcb;
  --primary-strong: #084f9d;
  --accent: #0f9f7f;
  --warning: #bf6b04;
  --danger: #c6362f;
  --shadow: 0 16px 42px rgba(22, 32, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.auth-page {
  display: grid;
  place-items: center;
  padding: 24px;
  background: #101a26;
}

.auth-shell {
  width: min(520px, 100%);
}

.auth-card {
  display: grid;
  gap: 24px;
  border-radius: 8px;
  padding: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.auth-card .brand {
  color: var(--ink);
}

.auth-copy,
.auth-note,
.auth-status {
  color: var(--muted);
}

.auth-form {
  display: grid;
  gap: 14px;
}

.auth-form label,
.config-form label,
.settings-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.auth-form input,
.config-form input,
.config-form select,
.settings-form input,
.settings-form select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fbfcff;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 264px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 24px 18px;
  background: #101a26;
  color: #edf4ff;
  overflow-y: auto;
}

.brand,
.tenant-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 8px;
  background: #ffffff;
  color: var(--primary-strong);
  font-weight: 800;
}

.brand small,
.tenant-card small {
  display: block;
  color: #a9b7c8;
}

.nav-list {
  display: grid;
  gap: 4px;
}

.nav-item {
  width: 100%;
  border: 0;
  border-radius: 8px;
  padding: 10px 12px;
  background: transparent;
  color: #c9d6e6;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  background: #223248;
  color: #ffffff;
}

.tenant-card {
  align-items: flex-start;
  flex-direction: column;
  margin-top: auto;
  padding: 16px;
  border: 1px solid #2d4058;
  border-radius: 8px;
  background: #162336;
}

.tenant-card span {
  color: #a9b7c8;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.app-shell {
  margin-left: 264px;
  padding: 28px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 28px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 3vw, 2.6rem);
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

h3 {
  margin-bottom: 0;
  font-size: 1rem;
}

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

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px;
  background: var(--surface);
}

.user-chip span {
  padding: 0 6px;
  color: var(--muted);
  font-weight: 700;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: min(360px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  background: var(--surface);
}

.search-box span {
  color: var(--muted);
  font-size: 0.8rem;
}

.search-box input,
.topbar select,
.content-studio input,
.content-studio select {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.topbar select,
.content-studio input,
.content-studio select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
}

.primary-action,
.ghost-button,
.segmented button,
.mini-action,
.site-actions button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 700;
}

.primary-action {
  background: var(--primary);
  color: #ffffff;
}

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

.ghost-button,
.site-actions button {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--primary-strong);
}

.mini-action {
  min-height: 32px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--primary-strong);
  font-size: 0.82rem;
}

.config-help {
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  color: #9a3412;
  font-size: 0.84rem;
  line-height: 1.45;
  padding: 10px 12px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.section-head p {
  max-width: 760px;
  margin-bottom: 0;
  color: var(--muted);
}

.status-pill {
  white-space: nowrap;
  border: 1px solid #bfe8dc;
  border-radius: 999px;
  padding: 10px 14px;
  background: #e9fbf5;
  color: #08624f;
}

.metric-grid,
.module-grid,
.analytics-grid,
.dashboard-grid,
.team-layout,
.content-studio,
.crm-layout,
.settings-grid {
  display: grid;
  gap: 16px;
}

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

.metric,
.panel,
.feature-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.metric,
.feature-card,
.panel {
  padding: 18px;
}

.metric span,
.feature-card span,
.muted {
  color: var(--muted);
}

.metric strong {
  display: block;
  margin: 8px 0 4px;
  font-size: 2rem;
}

.metric small {
  color: var(--accent);
  font-weight: 700;
}

.dashboard-grid,
.team-layout,
.content-studio,
.analytics-grid,
.crm-layout {
  grid-template-columns: minmax(0, 1.5fr) minmax(300px, 0.8fr);
}

.large-panel {
  min-width: 0;
}

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

.panel-head.subhead {
  margin-top: 18px;
}

.issue-list,
.request-board,
.event-timeline {
  display: grid;
  gap: 12px;
}

.issue,
.request,
.event-timeline article {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcff;
}

.issue-priority,
.request-status {
  border-radius: 999px;
  padding: 6px 10px;
  font-size: 0.78rem;
  font-weight: 800;
}

.status-urgent {
  background: #fff0ed;
  color: var(--danger);
}

.status-pending {
  background: #fff7e8;
  color: var(--warning);
}

.status-closed {
  background: #e9fbf5;
  color: #08745d;
}

.funnel {
  display: grid;
  gap: 14px;
}

.funnel div {
  display: grid;
  gap: 7px;
}

.funnel span {
  position: relative;
  display: block;
  overflow: hidden;
  border-radius: 999px;
  padding: 9px 12px;
  background: #eef3f8;
  color: var(--ink);
}

.funnel span::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: var(--value);
  background: rgba(11, 107, 203, 0.16);
}

.funnel strong {
  justify-self: end;
}

.task-list,
.stack-list {
  display: grid;
  gap: 12px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.task-list li,
.stack-list li {
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  color: var(--muted);
}

.stack-list li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 10px;
}

.task-list li:last-child,
.stack-list li:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}

.task-list strong,
.stack-list strong {
  color: var(--ink);
}

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

.overview-modules {
  margin-bottom: 16px;
}

.feature-card {
  display: grid;
  gap: 10px;
  min-height: 150px;
}

.segmented {
  display: inline-flex;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.segmented button {
  border-radius: 0;
  background: transparent;
  color: var(--muted);
}

.segmented button.active {
  background: var(--primary);
  color: #ffffff;
}

.request {
  grid-template-columns: 1fr auto auto;
}

.request p {
  margin: 4px 0 0;
  color: var(--muted);
}

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

.kanban div {
  display: grid;
  align-content: start;
  gap: 10px;
  min-height: 210px;
  border-radius: 8px;
  padding: 12px;
  background: #f4f7fb;
}

.kanban span {
  border-radius: 8px;
  padding: 10px;
  background: #ffffff;
  color: var(--muted);
}

.search-panel label,
.content-studio label {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  color: var(--muted);
  font-weight: 700;
}

.search-panel {
  margin-bottom: 16px;
}

.filter-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 12px;
}

.filter-grid input,
.filter-grid select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fbfcff;
  color: var(--ink);
}

.citizen-list {
  display: grid;
  gap: 12px;
}

.citizen-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fbfcff;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fbfcff;
  color: var(--muted);
  text-align: center;
}

.citizen-topline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.citizen-topline span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.citizen-topline b {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: 999px;
  background: #e9fbf5;
  color: #08745d;
}

.citizen-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 16px;
  margin: 0;
}

.citizen-card dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.citizen-card dd {
  margin: 3px 0 0;
}

.field-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.field-cloud span {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 7px 10px;
  background: #f4f7fb;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
}

.field-cloud.compact {
  margin-top: 0;
}

.workflow {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.workflow span {
  position: relative;
  border: 1px solid #bcd4ef;
  border-radius: 8px;
  padding: 12px;
  background: #eaf2ff;
  color: var(--primary-strong);
  font-weight: 800;
  text-align: center;
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.calendar-grid span {
  min-height: 130px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
  color: var(--muted);
}

.calendar-grid strong {
  display: block;
  margin-top: 16px;
  color: var(--ink);
}

.inner-grid {
  margin-top: 14px;
}

.settings-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 16px;
}

.social-config-panel {
  margin-top: 16px;
}

.config-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.config-form {
  display: grid;
  align-content: start;
  gap: 12px;
}

.import-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.5fr) minmax(240px, 1fr) auto;
  align-items: end;
  gap: 14px;
}

.import-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

.import-form input,
.import-form select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fbfcff;
  color: var(--ink);
}

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

.checkbox-grid {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.checkbox-grid label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fbfcff;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.user-table {
  display: grid;
  gap: 8px;
}

.table-row {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1.4fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfcff;
}

.table-head {
  background: #eef3f8;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.table-row strong {
  border-radius: 999px;
  padding: 6px 10px;
  background: #e9fbf5;
  color: #08745d;
  font-size: 0.82rem;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 32px));
  transform: translateY(18px);
  border-radius: 8px;
  padding: 14px 16px;
  background: #101a26;
  color: #ffffff;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.draft-box {
  min-height: 220px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  background: #fbfcff;
  color: var(--ink);
  line-height: 1.55;
}

.publish-row,
.site-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 14px;
}

.event-timeline article {
  grid-template-columns: 82px 1fr;
  align-items: start;
}

.event-timeline span {
  border-radius: 8px;
  padding: 10px;
  background: #eaf2ff;
  color: var(--primary-strong);
  font-weight: 800;
  text-align: center;
}

.event-timeline p {
  grid-column: 2;
  margin-bottom: 0;
  color: var(--muted);
}

.website-preview {
  min-height: 420px;
  display: grid;
  align-items: end;
  border-radius: 8px;
  padding: 28px;
  background:
    linear-gradient(90deg, rgba(8, 25, 43, 0.82), rgba(8, 25, 43, 0.35)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='1200' height='680' viewBox='0 0 1200 680'%3E%3Crect width='1200' height='680' fill='%23d9e7f5'/%3E%3Cg fill='%23b7cce1'%3E%3Crect x='40' y='370' width='1120' height='150' rx='12'/%3E%3Crect x='90' y='260' width='240' height='170' rx='12'/%3E%3Crect x='380' y='210' width='180' height='220' rx='12'/%3E%3Crect x='610' y='280' width='210' height='150' rx='12'/%3E%3Crect x='875' y='225' width='245' height='205' rx='12'/%3E%3C/g%3E%3Cg fill='%2385a9c9'%3E%3Ccircle cx='185' cy='500' r='44'/%3E%3Ccircle cx='315' cy='500' r='44'/%3E%3Ccircle cx='455' cy='500' r='44'/%3E%3Ccircle cx='595' cy='500' r='44'/%3E%3Ccircle cx='735' cy='500' r='44'/%3E%3Ccircle cx='875' cy='500' r='44'/%3E%3Ccircle cx='1015' cy='500' r='44'/%3E%3C/g%3E%3C/svg%3E") center/cover;
  color: #ffffff;
}

.website-preview section {
  max-width: 620px;
}

.website-preview h3 {
  margin-bottom: 10px;
  font-size: 2rem;
}

.bar-chart {
  display: flex;
  align-items: end;
  gap: 16px;
  height: 260px;
  padding-top: 18px;
}

.bar-chart span {
  position: relative;
  display: grid;
  align-items: end;
  justify-items: center;
  flex: 1;
  height: var(--height);
  min-height: 40px;
  border-radius: 8px 8px 0 0;
  background: linear-gradient(180deg, #0b6bcb, #0f9f7f);
}

.bar-chart b {
  transform: translateY(28px);
  color: var(--muted);
  font-size: 0.82rem;
}

@media (max-width: 1100px) {
  .metric-grid,
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dashboard-grid,
  .team-layout,
  .content-studio,
  .analytics-grid,
  .crm-layout,
  .config-layout {
    grid-template-columns: 1fr;
  }

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

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

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

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

@media (max-width: 760px) {
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
    width: auto;
    gap: 12px;
    padding: 14px;
  }

  .brand {
    align-items: center;
  }

  .brand-mark {
    width: 38px;
    height: 38px;
  }

  .nav-list {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
  }

  .nav-item {
    flex: 0 0 auto;
    width: auto;
    white-space: nowrap;
  }

  .tenant-card {
    display: flex;
    flex-direction: row;
    align-items: center;
    margin-top: 0;
    padding: 10px 12px;
  }

  .app-shell {
    margin-left: 0;
    padding: 18px;
  }

  .topbar,
  .section-head {
    flex-direction: column;
  }

  .topbar-actions,
  .search-box,
  .user-chip,
  .topbar select,
  .primary-action {
    width: 100%;
  }

  .metric-grid,
  .module-grid,
  .kanban,
  .filter-grid,
  .workflow,
  .calendar-grid,
  .citizen-card dl,
  .settings-grid,
  .settings-form,
  .import-form,
  .checkbox-grid,
  .table-row,
  .stack-list li {
    grid-template-columns: 1fr;
  }

  .issue,
  .request {
    grid-template-columns: 1fr;
  }

  .status-pill {
    white-space: normal;
  }
}
