:root {
  --color-bg: #fff9f0;
  --color-card: #ffffff;
  --color-primary: #5b3a8e;
  --color-accent: #f28c28;
  --color-secondary: #e9ddf5;
  --color-text: #29252d;
  --color-text-muted: #6e6577;
  --radius: 14px;

  --font-heading: "Fredoka", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-body: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  /* These represent real dashboard light colours (not decorative brand
     colours), so they're intentionally not tied to the palette above. */
  --light-blue: #2b6cb0;
  --light-green: #2f855a;
  --light-amber: #c05621;
  --light-red: #c53030;

  /* Stop/service stay red/amber for safety clarity; info reuses the brand palette. */
  --severity-stop-bg: #fdecec;
  --severity-stop-text: #c53030;
  --severity-service-bg: #fdf1e3;
  --severity-service-text: #c05621;
  --severity-info-bg: var(--color-secondary);
  --severity-info-text: var(--color-primary);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: var(--font-body);
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
.home-card-title {
  font-family: var(--font-heading);
  font-weight: 600;
}

.page {
  max-width: 480px;
  margin: 0 auto;
  padding: 24px 20px 40px;
  min-height: 100dvh;
}

.page-header {
  text-align: center;
  padding: 16px 0 16px;
}

.page-header h1 {
  margin: 0 0 6px;
}

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

.logo-visual {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 2.1rem;
  line-height: 1;
  color: var(--color-primary);
}

.logo-o {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 0.72em;
  height: 0.72em;
  margin: 0 0.02em;
  position: relative;
  top: 0.06em;
}

.logo-o svg {
  width: 100%;
  height: 100%;
}

.tagline {
  margin: 0;
  color: var(--color-text-muted);
  font-size: 1rem;
}

/* Install banner */

.install-banner[hidden] {
  display: none;
}

.install-banner {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: var(--severity-info-bg);
  color: var(--severity-info-text);
  border-radius: var(--radius);
  padding: 14px 14px 14px 16px;
  margin-bottom: 20px;
  font-size: 0.88rem;
  line-height: 1.45;
}

.install-banner-content {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  flex: 1;
  flex-wrap: wrap;
}

.install-banner-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.install-banner-icon svg {
  width: 100%;
  height: 100%;
}

.install-banner-action {
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 7px 18px;
  cursor: pointer;
}

.install-banner-close {
  background: none;
  border: none;
  color: var(--severity-info-text);
  font-size: 1.3rem;
  line-height: 1;
  padding: 0 0 0 4px;
  cursor: pointer;
  flex-shrink: 0;
}

/* Warning light grid */

.category-heading {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-muted);
  margin: 28px 4px 10px;
}

.category-heading:first-child {
  margin-top: 12px;
}

.tile-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 10px;
}

.tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  background: var(--color-card);
  border: none;
  border-radius: var(--radius);
  padding: 14px 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  font-family: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.tile:active {
  transform: scale(0.97);
}

.tile-icon {
  width: 34px;
  height: 34px;
}

.tile-icon svg {
  width: 100%;
  height: 100%;
}

.tile-name {
  font-size: 0.78rem;
  line-height: 1.25;
  text-align: center;
  color: var(--color-text);
}

/* Detail overlay */

body.overlay-open {
  overflow: hidden;
}

.detail-overlay {
  position: fixed;
  inset: 0;
  background: var(--color-bg);
  z-index: 20;
  overflow-y: auto;
}

.detail-panel {
  max-width: 480px;
  margin: 0 auto;
  padding: 16px 20px 40px;
  min-height: 100dvh;
}

.detail-close {
  background: none;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-primary);
  padding: 10px 4px;
  margin: 0 0 8px -4px;
  cursor: pointer;
}

.detail-icon {
  width: 72px;
  height: 72px;
  margin: 8px auto 16px;
}

.detail-icon svg {
  width: 100%;
  height: 100%;
}

#detail-content h1 {
  font-size: 1.4rem;
  text-align: center;
  margin: 0 0 12px;
}

#detail-content h2 {
  font-size: 0.95rem;
  margin: 22px 0 6px;
}

#detail-content p {
  color: var(--color-text-muted);
  line-height: 1.55;
  margin: 0;
}

.severity-badge {
  display: block;
  width: fit-content;
  margin: 0 auto;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
}

.severity-stop {
  background: var(--severity-stop-bg);
  color: var(--severity-stop-text);
}

.severity-service {
  background: var(--severity-service-bg);
  color: var(--severity-service-text);
}

.severity-info {
  background: var(--severity-info-bg);
  color: var(--severity-info-text);
}

.model-note {
  background: var(--color-secondary);
  border-radius: 10px;
  padding: 12px 14px;
  margin-top: 22px !important;
  font-size: 0.9rem;
}

/* Home sections */

.home-card {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: var(--color-card);
  border: none;
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  -webkit-tap-highlight-color: transparent;
}

.home-card:active {
  transform: scale(0.98);
}

.home-card-icon {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  color: var(--color-accent);
}

.home-card-icon svg {
  width: 100%;
  height: 100%;
}

.home-card-text {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.home-card-title {
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--color-primary);
}

.home-card-subtitle {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.home-card-chevron {
  font-size: 1.6rem;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.section-back {
  display: block;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  color: var(--color-primary);
  padding: 10px 4px;
  margin: 0 0 8px -4px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.section-title {
  font-size: 1.2rem;
  margin: 0 0 18px;
  color: var(--color-primary);
}

/* Reg lookup */

.lookup-form {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 20px;
}

.lookup-label {
  font-size: 0.95rem;
  color: var(--color-text-muted);
  margin-bottom: 14px;
}

.plate-input {
  width: 100%;
  max-width: 280px;
  font-family: Arial, Helvetica, sans-serif;
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.08em;
  text-align: center;
  text-transform: uppercase;
  color: #1a1a1a;
  background: #ffd23f;
  border: 2px solid #1a1a1a;
  border-radius: 8px;
  padding: 12px 10px;
}

.plate-input::placeholder {
  color: rgba(26, 26, 26, 0.45);
}

.lookup-submit {
  margin-top: 18px;
  background: var(--color-accent);
  color: #fff;
  border: none;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  padding: 12px 28px;
  cursor: pointer;
}

.result-card {
  background: var(--color-card);
  border-radius: var(--radius);
  padding: 20px;
  margin-top: 20px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
  text-align: center;
}

.result-plate {
  display: inline-block;
  background: #ffd23f;
  border: 1.5px solid #1a1a1a;
  border-radius: 6px;
  padding: 3px 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: #1a1a1a;
  margin: 0 0 10px;
}

.result-title {
  margin: 0 0 14px;
  font-size: 1.2rem;
  color: var(--color-primary);
}

.result-facts {
  display: flex;
  justify-content: center;
  gap: 28px;
  margin: 0;
}

.result-fact dt {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-muted);
  margin-bottom: 4px;
}

.result-fact dd {
  margin: 0;
  font-weight: 600;
}

.result-note {
  margin: 16px 0 0;
  font-size: 0.8rem;
  color: var(--color-text-muted);
}

.result-card-error p {
  margin: 0;
  color: var(--severity-stop-text);
}

.result-card-loading p {
  margin: 0;
  color: var(--color-text-muted);
}

.mot-valid {
  color: var(--light-green);
}

.mot-overdue {
  color: var(--severity-stop-text);
}
