/* ItinereHub MCP consent page. Served under a strict CSP: no inline styles, no external fonts or images. */

:root {
  --brand: #0046ad;
  --brand-dark: #003580;
  --ink: #14213d;
  --muted: #4a5568;
  --line: #cfd8e3;
  --surface: #ffffff;
  --page: #f3f6fb;
  --danger: #b42318;
  --danger-bg: #fef3f2;
  --warn-ink: #7a2e0b;
  --warn-bg: #fff4e5;
  --warn-line: #b54708;
  --focus: #0b5fff;
  --radius: 12px;
  color-scheme: light;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  font-size: 1rem;
  line-height: 1.5;
}

/* ---- Layout ---- */

.page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 1.5rem 1rem 2.5rem;
}

.page:focus {
  outline: none;
}

.card {
  width: 100%;
  max-width: 26rem;
  padding: 1.75rem 1.5rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 1px 2px rgb(20 33 61 / 6%), 0 6px 20px rgb(20 33 61 / 6%);
}

.card-wide {
  max-width: 34rem;
}

.logo {
  display: block;
  width: 3rem;
  height: auto;
  margin: 0 0 1.25rem;
}

h1 {
  margin: 0 0 0.5rem;
  font-size: 1.375rem;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

h2.section-title {
  margin: 1.5rem 0 0.5rem;
  font-size: 1rem;
  line-height: 1.4;
}

h1:focus,
.status:focus {
  outline: none;
}

p {
  margin: 0 0 1rem;
}

.lead {
  color: var(--muted);
  overflow-wrap: anywhere;
}

.who {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.75rem;
  margin-bottom: 0;
  overflow-wrap: anywhere;
}

.note {
  margin: 1.25rem 0 1rem;
  padding: 0.75rem 1rem;
  background: var(--page);
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.9375rem;
}

.hint,
.status {
  color: var(--muted);
  font-size: 0.9375rem;
}

/* ---- Form ---- */

.field {
  margin-bottom: 1rem;
}

label {
  display: block;
  margin-bottom: 0.25rem;
  font-weight: 600;
}

input[type="email"],
input[type="password"] {
  display: block;
  width: 100%;
  min-height: 2.75rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid #8795a8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font: inherit;
}

/* ---- Buttons ---- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  min-width: 2.75rem;
  padding: 0.5rem 1.25rem;
  border: 2px solid var(--brand);
  border-radius: 8px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:hover:not([disabled]) {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.btn-secondary {
  background: #fff;
  color: var(--brand);
}

.btn-secondary:hover:not([disabled]) {
  background: var(--page);
}

.btn-block {
  display: flex;
  width: 100%;
}

.btn[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.link {
  min-height: 2.75rem;
  padding: 0 0.25rem;
  border: 0;
  background: none;
  color: var(--brand);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.link[disabled] {
  opacity: 0.6;
  cursor: not-allowed;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
}

.actions .btn {
  flex: 1 1 8rem;
}

/* ---- Permissions ---- */

.perms {
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.perms li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  padding: 0.75rem 1rem;
}

.perms li + li {
  border-top: 1px solid var(--line);
}

.perm-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.tag {
  flex: none;
  padding: 0.125rem 0.625rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--page);
  color: var(--ink);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

/* Change and "See and change" stand out; the tag text is always shown, so colour is never the only cue. */
.tag-change,
.tag-see_change {
  border-color: var(--warn-line);
  background: var(--warn-bg);
  color: var(--warn-ink);
  font-weight: 700;
}

.tag-other {
  border-style: dashed;
}

/* ---- Trips ---- */

.trips {
  margin-top: 1rem;
  padding: 0.25rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.trips summary {
  display: flex;
  align-items: center;
  min-height: 2.75rem;
  font-weight: 600;
  cursor: pointer;
}

.trips[open] summary {
  margin-bottom: 0.25rem;
}

.trip-list {
  min-width: 0;
  max-height: 18rem;
  margin: 0 0 0.5rem;
  padding: 0;
  border: 0;
  overflow-y: auto;
}

.trip-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-height: 2.75rem;
  margin: 0;
  font-weight: 400;
  cursor: pointer;
}

.trip-option input {
  flex: none;
  width: 1.25rem;
  height: 1.25rem;
  margin: 0;
}

.trip-name {
  min-width: 0;
  overflow-wrap: anywhere;
}

.trip-dates {
  display: block;
  color: var(--muted);
  font-size: 0.875rem;
}

/* ---- Messages ---- */

.error {
  margin: 0.5rem 0 0;
  padding: 0.75rem 1rem;
  border: 1px solid var(--danger);
  border-radius: 8px;
  background: var(--danger-bg);
  color: var(--danger);
  font-weight: 600;
}

.error:empty {
  display: none;
}

/* ---- Loading ---- */

.spinner {
  width: 2rem;
  height: 2rem;
  margin: 0 0 1rem;
  border: 3px solid var(--line);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

/* ---- Helpers ---- */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

[hidden] {
  display: none !important;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

/* ---- Right to left (Arabic) ---- */

[dir="rtl"] .actions {
  justify-content: flex-start;
}

/* ---- Small screens ---- */

@media (max-width: 26rem) {
  .page {
    padding: 0.75rem 0.75rem 2rem;
  }

  .card {
    padding: 1.25rem 1rem;
  }

  .actions {
    flex-direction: column-reverse;
  }

  .actions .btn {
    flex: none;
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .spinner {
    animation: none;
    border-top-color: var(--brand);
    border-right-color: var(--brand);
  }
}

@media (forced-colors: active) {
  .tag,
  .btn,
  .error {
    border: 2px solid CanvasText;
  }
}
