* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f5f7fb;
  color: #1c2430;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 20px;
}

.container.narrow {
  max-width: 520px;
}

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

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

/* Unified portal page header (title + nav row + actions), shared by every
   logged-in portal page via .has-portal-chrome. The public landing has no
   .has-portal-chrome, so its header is untouched. */
.has-portal-chrome .header {
  flex-wrap: wrap;
  align-items: center;
  row-gap: 18px;
  margin-bottom: 28px;
}

.has-portal-chrome .header > div:not(.header-actions) {
  flex: 1 1 100%;
}

.has-portal-chrome .header h1 {
  margin: 0 0 6px;
}

.has-portal-chrome .header > div:not(.header-actions) p {
  margin: 0;
  max-width: 78ch;
}

.has-portal-chrome .header-actions {
  flex: 1 1 100%;
  width: 100%;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  padding-top: 16px;
  border-top: 1px solid #e2e8f0;
}

.has-portal-chrome .portal-nav {
  flex-wrap: wrap;
  gap: 6px;
}

.has-portal-chrome .portal-nav a {
  padding: 7px 14px;
  border-radius: 999px;
  font-weight: 500;
  line-height: 1;
  color: #334155;
  text-decoration: none;
  transition:
    background-color 0.15s ease,
    color 0.15s ease;
}

.has-portal-chrome .portal-nav a:hover {
  background: #eef2ff;
  color: #1f5fff;
  text-decoration: none;
}

.has-portal-chrome .portal-nav a.active {
  background: #1f5fff;
  color: #fff;
  text-decoration: none;
}

.has-portal-chrome .lang-selector {
  margin-left: auto;
  gap: 6px;
}

.has-portal-chrome .header-actions #logout-btn {
  white-space: nowrap;
  padding: 5px 12px;
  font-size: 13px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.panel {
  background: #fff;
  border: 1px solid #d9dfeb;
  border-radius: 10px;
  padding: 20px;
}

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

label {
  display: grid;
  gap: 6px;
  font-size: 14px;
}

input,
textarea,
button {
  font: inherit;
}

input,
textarea {
  border: 1px solid #b9c5db;
  border-radius: 8px;
  padding: 10px 12px;
  background: #fff;
}

textarea {
  resize: vertical;
  min-height: 120px;
}

.contact-turnstile {
  min-height: 65px;
}

.public-legal-disclaimer {
  margin: 24px 0 0;
  padding: 14px 16px;
  font-size: 12px;
  line-height: 1.55;
  color: #64748b;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
}

button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  background: #1f5fff;
  color: #fff;
}

button.secondary {
  background: #6b778c;
}

.muted {
  color: #5a6474;
}

.portal-chrome {
  background: #fff;
  border-bottom: 1px solid #d9dfeb;
}

.portal-chrome-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0;
  display: block;
}

/* Wide brand banner across the top (the artwork carries the logo, tagline,
   ".ar" and the seascape extended to both sides). */
.portal-topbanner {
  display: block;
  width: 100%;
  height: auto;
}

body.has-portal-chrome {
  padding-top: 0;
}

.portal-user {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 2px;
  line-height: 1.25;
  max-width: 100%;
}

.portal-user-company {
  font-size: 13px;
  font-weight: 700;
  color: #163c8a;
  letter-spacing: 0.02em;
}

.portal-user-email {
  font-size: 12px;
}

/* Signed-in user badge relocated into the header actions: own line, aligned to
   the right above the language flags + sign-out, slightly larger. */
.header-actions .portal-user--header {
  flex: 1 1 100%;
  width: 100%;
  flex-direction: column;
  align-items: flex-end;
  text-align: right;
  gap: 1px;
  margin-bottom: 2px;
}

.portal-user--header .portal-user-company {
  font-size: 15px;
}

.portal-user--header .portal-user-email {
  font-size: 13px;
}

/* ── Generic app modal (used for noon report quick-view) ── */

.app-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
}

.app-modal.open {
  display: block;
}

.app-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 20, 40, 0.5);
}

.app-modal-dialog {
  position: relative;
  max-width: 920px;
  margin: 4vh auto;
  background: #fff;
  border-radius: 12px;
  max-height: 92vh;
  overflow: auto;
  box-shadow: 0 16px 48px rgba(10, 20, 40, 0.3);
}

.app-modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: #fff;
  border-bottom: 1px solid #e2e8f0;
}

.app-modal-close {
  border: none;
  background: transparent;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  color: #475569;
  padding: 0 6px;
}

.app-modal-close:hover {
  color: #0f172a;
}

.app-modal-body {
  padding: 16px 20px;
}

/* ── Shared portal footer (light, tones matching the top banner) ── */

.portal-footer {
  margin-top: 48px;
  background: linear-gradient(180deg, #f4f8fe 0%, #dbe7fa 100%);
  border-top: 1px solid #cbd9f1;
  color: #334155;
}

.portal-footer-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 24px;
  font-size: 13px;
}

.portal-footer-brand {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.portal-footer-company {
  font-weight: 700;
  color: #163c8a;
  letter-spacing: 0.02em;
}

.portal-footer-tag {
  font-size: 12px;
  color: #5b6b86;
}

.portal-footer-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.portal-footer-links a {
  color: #1f5fff;
  text-decoration: none;
  font-weight: 500;
}

.portal-footer-links a:hover {
  text-decoration: underline;
}

.portal-footer-legal {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  color: #5b6b86;
  font-size: 12px;
}

.portal-footer-sep {
  opacity: 0.45;
}

@media (max-width: 640px) {
  .portal-footer-inner {
    flex-direction: column;
    text-align: center;
    justify-content: center;
  }

  .portal-footer-brand {
    align-items: center;
  }
}

.report-date-hint {
  margin: 0 0 8px;
  font-size: 13px;
}

.message {
  min-height: 22px;
  margin: 10px 0 0;
  color: #163c8a;
}

.message.error {
  color: #b42318;
}

.code-block {
  background: #0f1720;
  color: #d8e1ee;
  border-radius: 8px;
  padding: 14px;
  overflow: auto;
  min-height: 160px;
}

.files-list {
  margin: 16px 0 0;
  padding-left: 18px;
}

.files-list li {
  margin-bottom: 10px;
}

.file-name {
  display: block;
  font-weight: 600;
  word-break: break-word;
}

.file-meta {
  display: block;
  font-size: 12px;
  color: #5a6474;
}

/* ── Setup / enrolamiento TOTP ── */

.setup-hidden {
  display: none;
}

.qr-wrapper {
  display: flex;
  justify-content: center;
  padding: 16px 0;
}

.qr-img {
  width: 220px;
  height: 220px;
  border: 1px solid #d9dfeb;
  border-radius: 10px;
}

.setup-uri {
  font-size: 11px;
  word-break: break-all;
  white-space: pre-wrap;
  min-height: unset;
  padding: 10px 12px;
}

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

.setup-back {
  text-align: center;
  margin-top: 4px;
}

.setup-success {
  font-size: 56px;
  text-align: center;
  color: #1b8a4e;
  line-height: 1;
}

details > summary {
  cursor: pointer;
  font-size: 13px;
  user-select: none;
}

/* ── Public site header (index + login) ── */

.public-site-header {
  background: #fff;
  border-bottom: 1px solid #d9dfeb;
  margin-bottom: 24px;
}

.public-site-header-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding-top: 20px;
  padding-bottom: 20px;
}

.public-brand {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: #163c8a;
}

.public-brand a {
  color: inherit;
  text-decoration: none;
}

.public-brand-link {
  display: block;
  color: inherit;
  text-decoration: none;
}

.public-tagline {
  margin: 4px 0 0;
  font-size: 13px;
  max-width: 420px;
}

.public-hero h1 {
  margin-top: 0;
}

.public-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin: 20px 0 12px;
}

a.button-link {
  display: inline-block;
  padding: 10px 16px;
  border-radius: 8px;
  background: #1f5fff;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
}

a.button-link.secondary {
  background: #e8eef8;
  color: #163c8a;
}

.public-profile-hint {
  font-size: 14px;
  margin-top: 16px;
}

.public-profile-hint a {
  color: #1f5fff;
}

/* ── Portal nav + language selector (jorge-site preferredLanguage pattern) ── */

.portal-nav {
  display: flex;
  gap: 10px;
  align-items: center;
}

.portal-nav a {
  color: #1f5fff;
  text-decoration: none;
  font-size: 14px;
}

.portal-nav a.active {
  font-weight: 700;
  text-decoration: underline;
}

.lang-selector {
  display: flex;
  gap: 4px;
}

/* Language buttons rendered as flags (the EN/ES text is hidden and the flag
   is shown via ::before, keyed on the data-lang-btn attribute). */
.lang-btn {
  min-width: 2.5rem;
  min-height: 2.5rem;
  padding: 4px 8px;
  font-size: 0;
  line-height: 1;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.lang-btn::before {
  font-size: 1.2rem;
  line-height: 1;
  pointer-events: none;
}

.lang-btn[data-lang-btn="en"]::before {
  content: "🇬🇧";
}

.lang-btn[data-lang-btn="es"]::before {
  content: "🇪🇸";
}

.lang-btn.lang-active {
  background: transparent;
  outline: 2px solid #1f5fff;
  outline-offset: 1px;
}

/* ── Noon Reports ── */

.report-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}

.report-filters label {
  min-width: 140px;
}

.table-wrap {
  overflow-x: auto;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.report-table th,
.report-table td {
  border-bottom: 1px solid #e3e8f2;
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.report-table th {
  background: #f0f4fb;
  font-weight: 600;
}

.report-back {
  margin: 0 0 12px;
}

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

.report-section h2 {
  margin-top: 0;
}

.nr-voyage-panel .nr-voyage-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
}

.nr-voyage-msg {
  margin-top: 8px;
}

.nr-voyage-msg.error {
  color: #b91c1c;
}

.report-subhead {
  margin: 16px 0 8px;
  font-size: 15px;
  color: #3a4658;
}

.report-dl {
  display: grid;
  gap: 8px;
  margin: 0;
}

.report-field {
  display: grid;
  grid-template-columns: minmax(180px, 34%) 1fr;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid #eef2f8;
}

.report-field dt {
  margin: 0;
  color: #5a6474;
  font-size: 13px;
}

.report-field dd {
  margin: 0;
  font-size: 14px;
  word-break: break-word;
}

.report-warnings {
  margin: 0;
  padding-left: 18px;
}

.report-warnings .warn-warning {
  color: #9a6700;
}

.report-warnings .warn-error {
  color: #b42318;
}

.compliance-note {
  background: #fff8e6;
  border: 1px solid #f0d58a;
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 13px;
  color: #6b4f00;
}
