:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #64748b;
  --border: #dbe2ea;
  --primary: #2f6fed;
  --primary-hover: #255bd2;
  --secondary-bg: #f1f5f9;
  --secondary-hover: #e2e8f0;
  --shadow: 0 6px 18px rgba(15, 23, 42, 0.06);
  --radius: 12px;
  --topbar-h: 84px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
}

html {
  scroll-padding-top: calc(var(--topbar-h) + 16px);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.container {
  width: 100%;
  max-width: 1160px;
  margin: 0 auto;
  padding: 0 20px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

.topbar-inner {
  min-height: 84px;
  padding: 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-wrap{ display:flex; align-items:center; }
.brand-link{
  display:block;
  text-decoration:none;
  color: var(--text);
}

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

.brand-logo{
  height: 56px;
  width: auto;
  display:block;
}
.brand-slogan{
  font-size: 0.92rem;
  color: var(--text);
  font-weight: 700;
  line-height: 1.1;
  margin-top: 6px;
}

.brand {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: 0.01em;
}

.nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.nav a {
  text-decoration: none;
  color: var(--muted);
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 0.95rem;
}

.nav a:hover {
  color: var(--text);
  background: var(--secondary-bg);
}

main.container {
  padding-top: 20px;
  padding-bottom: 26px;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
}

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

p,
ol,
ul {
  margin-top: 0;
  margin-bottom: 0;
}

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

.filters-grid {
  display: grid;
  gap: 10px;
}

.filters-row-1 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.filters-row-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.filters-row-3 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.plate-row{
  display:flex;
  align-items:center;
  gap:14px;
  margin-top:12px;
}

.plate-label{
  min-width:220px;
  font-weight:700;
  color: var(--text);
}

.is-hidden{
  display:none !important;
}

input,
select,
button {
  font: inherit;
}

input,
select {
  width: 100%;
  height: 40px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: #fff;
  color: var(--text);
  padding: 0 12px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

input:focus,
select:focus {
  border-color: #8fb1ff;
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.16);
}

.actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}

.btn {
  height: 38px;
  padding: 0 14px;
  border-radius: 9px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.15s ease, border-color 0.15s ease;
}

.btn:active {
  transform: translateY(1px);
}

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

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

.btn-secondary {
  background: var(--secondary-bg);
  color: var(--text);
  border-color: var(--border);
}

.btn-secondary:hover {
  background: var(--secondary-hover);
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.pagination {
  margin-top: 12px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  color: var(--muted);
}

.pagination--wide{
  justify-content: flex-start;
  gap: 12px;
}

#numbers-table {
  overflow-x: auto;
}

.table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 580px;
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}

.table th,
.table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  font-size: 0.94rem;
}

.table th {
  background: #f8fafc;
  color: #334155;
  font-weight: 600;
}

.table tr:nth-child(even) td {
  background: #fbfdff;
}

.table tbody tr:hover td {
  background: #eef4ff;
}

.table tr:last-child td {
  border-bottom: 0;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chip {
  border: 1px solid var(--border);
  background: var(--secondary-bg);
  color: #334155;
  border-radius: 999px;
  padding: 7px 12px;
  cursor: pointer;
}

.chip:hover {
  background: #e2ebff;
  border-color: #c2d4ff;
}

.muted{
  color: var(--muted);
  margin: 0 0 12px;
}

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

.advice-card{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.advice-card h3{
  margin: 0 0 10px;
  font-size: 1rem;
}

.howto-steps {
  display: grid;
  gap: 12px;
}

.howto-step {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.howto-step h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.howto-step p {
  margin: 0 0 8px;
}

.howto-step ul {
  margin: 0;
  padding-left: 18px;
  color: var(--text);
}

.howto-step a {
  text-decoration: none;
}

.howto-step a:hover {
  text-decoration: underline;
}

.footer {
  border-top: 1px solid var(--border);
  background: #f8fafc;
  color: var(--muted);
  margin-top: 6px;
}

.footer .container {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.meta-info {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

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

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

  .plate-row{
    flex-direction:column;
    align-items:flex-start;
  }

  .plate-label{
    min-width:0;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 14px;
  }

  .topbar-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 12px 0;
  }

  .nav {
    width: 100%;
  }

  .nav a {
    padding: 6px 8px;
  }

  .card {
    padding: 14px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .filters-row-1,
  .filters-row-2,
  .filters-row-3 {
    grid-template-columns: 1fr;
  }

  .actions,
  .pagination {
    flex-direction: column;
    align-items: stretch;
  }

  .actions .btn,
  .pagination .btn,
  #trendPeriod,
  #searchBtn,
  #prevPageBtn,
  #nextPageBtn,
  #trendReloadBtn {
    width: 100%;
  }

  #pageInfo,
  #totalInfo {
    display: block;
    text-align: center;
  }

  .footer .container {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (max-width: 900px){
  .advice-grid{
    grid-template-columns: 1fr;
  }
}

/* --- UA license plate style --- */
.plate-scale {
  width: 100%;
  max-width: 760px;
  display: flex;
  justify-content: flex-start;
  --plate-scale: min(1, calc(100% / 520));
}

.plate-wrap,
.plate-wrap * {
  box-sizing: border-box;
}

.plate-wrap {
  width: 520px;
  height: 112px;
  max-width: none;
  transform-origin: left center;
  transform: scale(var(--plate-scale));
  display: flex;
  align-items: stretch;
  border: 2px solid #0f172a;
  border-radius: 14px;
  background: #fff;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.08);
}

.plate-eu {
  width: 78px;
  min-width: 78px;
  height: 112px;
  background: #0b3a7a;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  padding: 12px 10px;
}

.plate-flag {
  width: 44px;
  height: 30px;
  border-radius: 4px;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
  background: linear-gradient(#1b66d1 0 50%, #ffd400 50% 100%);
}

.plate-ua {
  color: #fff;
  font-weight: 800;
  letter-spacing: 0.08em;
  font-size: 20px;
  line-height: 1;
  margin-top: 10px;
}

.plate-body {
  height: 112px;
  width: calc(520px - 78px);
  display: grid;
  grid-template-columns: 1fr 2fr 1fr;
  border-left: 2px solid #0f172a;
}

.plate-field {
  position: relative;
  min-width: 0;
  height: 112px;
  min-height: 112px;
  display: flex;
  align-items: stretch;
  background: #fff;
  border-left: 2px solid #0f172a;
}

.plate-field:first-child {
  border-left: 0;
}

.plate-cells {
  min-width: 0;
  width: 100%;
  height: 112px;
  display: grid;
}

.plate-field[data-cells="2"] .plate-cells {
  grid-template-columns: repeat(2, 1fr);
}

.plate-field[data-cells="4"] .plate-cells {
  grid-template-columns: repeat(4, 1fr);
}

.plate-cell {
  border-right: 1px solid rgba(15, 23, 42, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-weight: 900;
  color: #1f2937;
  text-transform: uppercase;
}

.plate-cell:last-child {
  border-right: 0;
}

.plate-cell.is-hint {
  color: rgba(15, 23, 42, 0.42);
  font-weight: 800;
}

.plate-input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0 !important;
  background: transparent !important;
  color: transparent !important;
  caret-color: transparent !important;
  outline: none !important;
  text-transform: uppercase;
  padding: 0 18px !important;
}

.plate-field:focus-within {
  background: #eef4ff;
}

.plate-input::-webkit-calendar-picker-indicator {
  opacity: 0;
  display: none;
}

.plate-input {
  background-image: none !important;
}

.plate-clear {
  position: absolute;
  z-index: 6;
  right: 10px;
  top: 10px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: rgba(255, 255, 255, 0.92);
  color: #0f172a;
  font-weight: 900;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.plate-field.has-value .plate-clear,
.plate-field:focus-within .plate-clear {
  display: flex;
}

.plate-clear:hover {
  background: #f1f5f9;
}

.plate-field[data-cells="2"] .plate-cell {
  font-size: 48px;
}

.plate-field[data-cells="4"] .plate-cell {
  font-size: 54px;
}

@media (max-width: 740px) {
  .plate-scale {
    max-width: 100%;
  }
}

.plate-note{
  margin-top:6px;
  font-size:0.82rem;
  color: var(--muted);
  display:flex;
  align-items:flex-start;
  gap:8px;
  line-height:1.35;
  max-width: 320px;
}
.plate-note-text{
  flex: 1 1 auto;
  min-width: 0;
}
.hint-icon{
  color: var(--muted);
  flex: 0 0 auto;
  margin-top:2px;
}
.hint-x{
  font-weight:700;
  color: inherit;
  white-space: nowrap;
}

@media (max-width: 520px){
  .topbar-inner{ min-height: 68px; padding: 10px 0; }
  .brand-logo{ height: 40px; }
  .brand-slogan{ font-size: 0.88rem; margin-top: 4px; }
}

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

.benefit-card{
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  background: #fff;
}

.benefit-title{
  font-weight: 800;
  font-size: 0.98rem;
  margin-bottom: 6px;
}

.benefit-text{
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.3;
}

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

@media (max-width: 560px){
  .benefits-grid{ grid-template-columns: 1fr; }
}
