:root {
  --brand: #012353;
  --brand-2: #0d4a88;
  --bg: #eef3f8;
  --panel: #ffffff;
  --line: #d7e2ec;
  --ink: #17212b;
  --muted: #64727f;
  --green: #26735d;
  --amber: #b36a12;
  --red: #b94335;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: linear-gradient(180deg, #e7eef6 0, #f7fafc 340px);
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  padding: 9px 13px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: var(--brand-2);
}

button.secondary-button {
  background: #fff;
  color: var(--brand);
  border-color: var(--line);
}

button.secondary-button:hover {
  border-color: var(--brand);
  background: #edf5ff;
}

button:disabled {
  cursor: wait;
  opacity: 0.72;
}

label {
  display: grid;
  gap: 7px;
  color: #34404c;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  color: var(--ink);
  padding: 10px 11px;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(1, 35, 83, 0.14);
}

.login-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--brand), #0b4a8f);
  padding: 22px;
}

.login-card {
  width: min(460px, 100%);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 28px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.login-card img {
  width: 100%;
  max-height: 82px;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 18px;
}

.login-card label {
  color: rgba(255, 255, 255, 0.82);
  margin-top: 12px;
}

.login-card button {
  width: 100%;
  margin-top: 16px;
  background: #fff;
  color: var(--brand);
}

#loginMessage,
#settingsMessage {
  min-height: 22px;
  color: #b94335;
  font-weight: 800;
}

.app-header {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background: var(--brand);
  color: #fff;
  padding: 12px clamp(18px, 4vw, 42px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand img {
  width: 210px;
  height: 42px;
  object-fit: contain;
  object-position: left center;
}

.brand span {
  color: #bdd9ff;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.brand h1 {
  margin: 2px 0 0;
  font-size: 25px;
}

.app-header nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.app-header nav button {
  border-color: rgba(255, 255, 255, 0.22);
  background: #fff;
  color: var(--brand);
}

.page {
  display: none;
  padding: 20px clamp(18px, 4vw, 42px) 42px;
}

.page.active {
  display: block;
}

#dashboardPage {
  display: none;
  grid-template-columns: minmax(340px, 0.72fr) minmax(520px, 1fr);
  gap: 20px;
}

#dashboardPage.active {
  display: grid;
}

.panel,
.report-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 16px 44px rgba(1, 35, 83, 0.09);
}

.panel {
  padding: 18px;
}

.form-panel {
  align-self: start;
}

.module-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 16px;
}

.module-switch button {
  background: #fff;
  color: var(--brand);
  border-color: var(--line);
}

.module-switch button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

h2 {
  margin: 0 0 14px;
  font-size: 18px;
}

.grid {
  display: grid;
  gap: 12px;
}

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

.form-panel textarea,
.form-panel label {
  margin-top: 12px;
}

.hint-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
  margin-top: 12px;
}

.chip-row,
.domain-cards {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.chip-row button {
  min-height: 34px;
  background: #fff;
  color: var(--brand);
  border-color: var(--line);
  padding: 7px 10px;
}

.actions,
.link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.compact-actions button {
  flex: 1 1 170px;
}

.report-filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(150px, 0.3fr) minmax(160px, 0.35fr) minmax(130px, 0.25fr) auto;
  gap: 10px;
  align-items: end;
  margin-bottom: 10px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.summary-card,
.customer-card,
.reminder-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f7fbff);
  padding: 12px;
}

.summary-card strong {
  display: block;
  color: var(--brand);
  font-size: 28px;
  line-height: 1;
}

.summary-card span,
.customer-card span,
.reminder-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-top: 6px;
}

.customer-cards,
.reminder-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin: 10px 0;
}

.customer-card {
  cursor: pointer;
  text-align: left;
  color: var(--ink);
}

.customer-card:hover {
  border-color: var(--brand);
}

.reminder-list:empty,
.customer-cards:empty,
.summary-grid:empty {
  display: none;
}

.link-row a {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--brand);
  padding: 7px 10px;
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.score-card {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 20px;
  align-items: center;
  padding: 22px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(120deg, #fff, #edf5ff);
}

.score-ring {
  --score: 0;
  --score-color: var(--green);
  width: 112px;
  aspect-ratio: 1;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background:
    radial-gradient(circle at center, #fff 58%, transparent 59%),
    conic-gradient(var(--score-color) calc(var(--score) * 1%), #dfe7eb 0);
}

.score-ring strong {
  font-size: 30px;
}

.score-ring span {
  margin-top: 34px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  position: absolute;
}

.score-card span {
  color: #8aa2b6;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.score-card p {
  color: var(--muted);
  line-height: 1.55;
}

.risk-bars {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
}

.risk-bar {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f7fbff);
  padding: 11px 12px;
}

.risk-bar div {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 13px;
  font-weight: 900;
}

.risk-track {
  height: 8px;
  border-radius: 99px;
  background: #dfe7eb;
  overflow: hidden;
  margin-top: 8px;
}

.risk-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--bar-color, var(--brand));
  background: linear-gradient(90deg, var(--bar-color, var(--brand)), color-mix(in srgb, var(--bar-color, var(--brand)) 72%, #ffffff));
}

.report-output {
  padding: 18px 22px 26px;
  display: grid;
  gap: 12px;
}

.report-cover {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand), #0b4a8f);
  color: #fff;
  padding: 20px;
  -webkit-print-color-adjust: exact;
  print-color-adjust: exact;
}

.report-logo {
  width: min(260px, 100%);
  height: 50px;
  display: block;
  object-fit: contain;
  object-position: left center;
  margin-bottom: 18px;
}

.report-cover span {
  color: #bdd9ff;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.report-cover h2 {
  margin: 8px 0;
  font-size: 28px;
}

.report-cover p {
  color: rgba(255, 255, 255, 0.84);
}

.pdf-company-line {
  margin-top: 14px;
  font-size: 12px;
}

.report-cover .badge {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: rgba(255, 255, 255, 0.22);
}

.signature-block {
  min-height: 120px;
}

.signature-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.signature-line {
  border-top: 1px solid var(--line);
  padding-top: 10px;
  color: var(--muted);
  font-weight: 900;
}

.pdf-footer {
  color: var(--muted);
  font-size: 10px;
}

.report-block {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}

.report-block p,
.report-block li {
  color: #42515a;
  line-height: 1.55;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #edf4fb;
  padding: 6px 9px;
  font-size: 12px;
  font-weight: 900;
}

.module-badge {
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--brand);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 900;
}

.domain-card {
  flex: 1 1 190px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
}

.domain-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.domain-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-top: 5px;
}

.domain-card select,
.presence-card select {
  min-height: 34px;
  margin-top: 10px;
  padding: 6px 8px;
  font-size: 12px;
  font-weight: 800;
}

.domain-card small {
  display: block;
  color: #8aa2b6;
  font-size: 11px;
  font-weight: 900;
  margin-top: 6px;
}

.presence-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.presence-card {
  min-height: 76px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #fff, #f7fbff);
  padding: 12px;
}

.presence-card strong,
.presence-card span {
  display: block;
}

.presence-card span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-top: 4px;
}

.presence-card a {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
  text-decoration: none;
  padding: 4px 8px;
  margin-top: 8px;
}

.design-upload {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  padding: 12px;
  margin-top: 12px;
}

.design-gallery,
.design-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.design-image-card,
.design-report-grid figure {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  margin: 0;
}

.design-image-card img,
.design-report-grid img {
  width: 100%;
  aspect-ratio: 4 / 3;
  display: block;
  object-fit: contain;
  background: #eef3f8;
}

.design-image-card div,
.design-report-grid figcaption {
  padding: 10px;
}

.design-image-card strong,
.design-image-card span {
  display: block;
}

.design-image-card span,
.empty-note {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.design-image-card button {
  min-height: 32px;
  margin-top: 8px;
  padding: 6px 10px;
  font-size: 12px;
}

.design-report-grid figcaption {
  color: var(--brand);
  font-size: 12px;
  font-weight: 900;
}

.table button {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
}

.table select {
  min-height: 32px;
  padding: 5px 8px;
  font-size: 12px;
}

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

.status-line {
  min-height: 22px;
  color: var(--muted);
  font-weight: 800;
}

.status-line[data-type="working"] {
  color: var(--brand);
}

.status-line[data-type="success"] {
  color: var(--green);
}

.status-line[data-type="error"] {
  color: var(--red);
}

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

.table th,
.table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 0;
  text-align: left;
}

.settings-grid {
  display: grid;
  grid-template-columns: minmax(320px, 0.9fr) minmax(420px, 1fr);
  gap: 20px;
}

@media (max-width: 980px) {
  #dashboardPage.active,
  .settings-grid,
  .report-filters,
  .summary-grid,
  .customer-cards,
  .reminder-list {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .brand {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .brand img {
    width: min(100%, 310px);
  }

  .grid.two,
  .risk-bars,
  .presence-cards,
  .design-gallery,
  .design-report-grid,
  .score-card {
    grid-template-columns: 1fr;
  }
}

@media print {
  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .app-header,
  .form-panel,
  .actions {
    display: none;
  }

  #dashboardPage.active {
    display: block;
    padding: 0;
  }

  .report-panel {
    border: 0;
    box-shadow: none;
  }
}
