:root {
  --navy: #12324a;
  --navy-deep: #0b263b;
  --green: #08786d;
  --green-bright: #0d9c8b;
  --gold: #f3bd4a;
  --ink: #142332;
  --muted: #667985;
  --line: #d8e2e7;
  --surface: #ffffff;
  --surface-soft: #f6faf9;
  --page: #eef3f5;
  --danger: #b42318;
  --success: #0f7d4c;
  --warning: #9a5b00;
  --shadow: 0 12px 36px rgba(18, 50, 74, 0.12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  min-height: 100%;
  background: var(--page);
}

body {
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  -webkit-font-smoothing: antialiased;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(8, 120, 109, 0.2);
  outline-offset: 2px;
}

.view {
  min-height: 100vh;
  min-height: 100svh;
}

.login-page {
  min-height: 100vh;
  min-height: 100svh;
  padding: 0 18px calc(24px + env(safe-area-inset-bottom));
  background:
    linear-gradient(
      180deg,
      var(--navy) 0,
      var(--navy) 330px,
      var(--page) 330px,
      var(--page) 100%
    );
}

.login-shell {
  width: min(100%, 440px);
  margin: 0 auto;
  padding-top: calc(32px + env(safe-area-inset-top));
}

.brand-block {
  display: flex;
  align-items: center;
  padding: 0 6px 28px;
  color: #fff;
}

.brand-icon {
  flex: 0 0 auto;
  width: 72px;
  height: 72px;
  margin-right: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
  box-shadow: 0 14px 30px rgba(4, 21, 33, 0.26);
}

.brand-copy {
  min-width: 0;
}

.brand-copy h1,
.brand-copy p,
.card-heading h2,
.card-heading p,
.section-heading h2,
.section-heading p,
.modal-head h2,
.modal-head p {
  margin: 0;
}

.brand-copy h1 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
}

.brand-copy p {
  margin-top: 6px;
  color: #bdd9d4;
  font-size: 14px;
  line-height: 1.5;
}

.login-card {
  padding: 30px 22px 24px;
  border: 1px solid rgba(216, 226, 231, 0.96);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.card-heading h2 {
  font-size: 26px;
  font-weight: 800;
  line-height: 1.25;
}

.card-heading p {
  margin-top: 7px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.form-stack {
  display: grid;
  gap: 18px;
}

.login-card .form-stack {
  margin-top: 24px;
}

.field {
  min-width: 0;
}

.field > label,
.field-heading label {
  display: block;
  color: #223544;
  font-size: 14px;
  font-weight: 700;
  line-height: 1.4;
}

.field-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.field > label {
  margin-bottom: 8px;
}

.input-wrap,
.select-wrap {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 50px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.input-wrap:focus-within,
.select-wrap:focus-within {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(8, 120, 109, 0.09);
}

.input-wrap input,
.input-wrap textarea,
.select-wrap select {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--ink);
}

.input-wrap input,
.select-wrap select {
  height: 50px;
  padding: 0 14px;
  font-size: 16px;
}

.input-wrap textarea {
  min-height: 92px;
  padding: 13px 14px;
  resize: vertical;
  line-height: 1.55;
}

.input-wrap input::placeholder,
.input-wrap textarea::placeholder {
  color: #91a1aa;
}

.textarea-wrap {
  align-items: stretch;
}

.select-wrap {
  position: relative;
}

.select-wrap::after {
  content: "";
  position: absolute;
  top: 50%;
  right: 16px;
  width: 7px;
  height: 7px;
  border-right: 2px solid #6a7d88;
  border-bottom: 2px solid #6a7d88;
  pointer-events: none;
  transform: translateY(-70%) rotate(45deg);
}

.select-wrap select {
  padding-right: 42px;
  appearance: none;
}

.text-button,
.icon-button,
.ghost-button {
  border: 0;
  background: transparent;
}

.text-button {
  min-height: 34px;
  padding: 4px 0 4px 12px;
  color: var(--green);
  font-size: 13px;
  font-weight: 700;
}

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

.captcha-image-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 122px;
  height: 50px;
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f6;
}

.captcha-image-button img {
  display: none;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.captcha-image-button img.is-ready {
  display: block;
}

.captcha-image-button span {
  color: var(--muted);
  font-size: 13px;
}

.captcha-image-button img.is-ready + span {
  display: none;
}

.primary-button,
.secondary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 50px;
  padding: 0 20px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 800;
  line-height: 1;
  transition: transform 0.16s ease, opacity 0.16s ease, background 0.16s ease;
}

.primary-button {
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--green), var(--green-bright));
  color: #fff;
  box-shadow: 0 10px 22px rgba(8, 120, 109, 0.2);
}

.secondary-button {
  border: 1px solid #cbd8de;
  background: #fff;
  color: var(--navy);
}

.primary-button:active,
.secondary-button:active,
.ghost-button:active,
.icon-button:active,
.text-button:active {
  transform: translateY(1px);
}

.primary-button:disabled {
  cursor: default;
  background: #8db9b3;
  box-shadow: none;
  opacity: 1;
}

.primary-button.danger {
  background: var(--danger);
  box-shadow: 0 10px 22px rgba(180, 35, 24, 0.18);
}

.error-box {
  padding: 11px 13px;
  border-left: 4px solid var(--danger);
  border-radius: 8px;
  background: #fff3f1;
  color: var(--danger);
  font-size: 14px;
  line-height: 1.55;
}

.trust-row {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 18px;
  color: #71828d;
  font-size: 13px;
}

.trust-dot {
  width: 7px;
  height: 7px;
  margin-right: 8px;
  border-radius: 50%;
  background: #20a37f;
  box-shadow: 0 0 0 4px rgba(32, 163, 127, 0.1);
}

.page-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 22px;
  color: #7b8d97;
  font-size: 12px;
  line-height: 1.5;
}

.footer-sep {
  margin: 0 9px;
  color: #b2bec5;
}

.dashboard-view {
  background:
    linear-gradient(180deg, var(--navy) 0, var(--navy) 116px, var(--page) 116px, var(--page) 100%);
}

.app-header {
  position: sticky;
  z-index: 20;
  top: 0;
  padding-top: env(safe-area-inset-top);
  background: rgba(18, 50, 74, 0.96);
  color: #fff;
  backdrop-filter: blur(12px);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: min(100%, 860px);
  min-height: 72px;
  margin: 0 auto;
  padding: 10px 16px;
}

.app-brand {
  display: flex;
  align-items: center;
  min-width: 0;
}

.app-brand img {
  width: 42px;
  height: 42px;
  margin-right: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
}

.app-brand div {
  min-width: 0;
}

.app-brand strong,
.app-brand span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.app-brand strong {
  font-size: 16px;
  font-weight: 800;
}

.app-brand span {
  margin-top: 3px;
  color: #bdd9d4;
  font-size: 12px;
}

.header-actions {
  display: flex;
  flex: 0 0 auto;
}

.ghost-button {
  min-width: 58px;
  min-height: 38px;
  margin-left: 8px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.dashboard-main {
  width: min(100%, 860px);
  margin: 0 auto;
  padding: 18px 14px calc(34px + env(safe-area-inset-bottom));
}

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

.stat-card {
  padding: 18px 8px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  text-align: center;
}

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

.stat-card strong {
  color: var(--green);
  font-size: 28px;
  line-height: 1.2;
}

.stat-card strong.vip {
  color: var(--navy);
}

.stat-card strong.monthly {
  color: #2666aa;
}

.stat-card span {
  margin-top: 6px;
  color: var(--muted);
  font-size: 12px;
}

.search-panel,
.result-section {
  margin-top: 14px;
  padding: 20px 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.section-heading h2 {
  color: var(--ink);
  font-size: 18px;
  font-weight: 800;
}

.section-heading p {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.search-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 9px;
  margin-top: 16px;
}

.search-form input {
  width: 100%;
  min-width: 0;
  height: 48px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: var(--surface-soft);
  color: var(--ink);
  font-size: 16px;
}

.search-form input:focus {
  border-color: var(--green);
  background: #fff;
  box-shadow: 0 0 0 4px rgba(8, 120, 109, 0.09);
}

.compact {
  min-height: 48px;
  padding: 0 16px;
  white-space: nowrap;
}

.result-section {
  padding-bottom: 4px;
}

.result-heading {
  margin-bottom: 14px;
}

.vehicle-list {
  display: grid;
  gap: 12px;
}

.vehicle-card {
  padding: 17px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 6px 18px rgba(18, 50, 74, 0.06);
}

.vehicle-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.vehicle-plate {
  font-size: 24px;
  font-weight: 900;
  line-height: 1.2;
  word-break: break-all;
}

.vehicle-owner {
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
  word-break: break-word;
}

.status-badge {
  flex: 0 0 auto;
  padding: 6px 10px;
  border-radius: 999px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.vehicle-meta {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  padding-top: 13px;
  border-top: 1px solid #edf2f4;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.vehicle-meta strong {
  color: var(--ink);
  font-weight: 700;
}

.vehicle-meta .remaining {
  color: var(--warning);
  font-weight: 800;
}

.vehicle-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 15px;
}

.vehicle-actions button {
  min-height: 44px;
  font-size: 14px;
}

.empty-state {
  padding: 46px 12px;
  color: var(--muted);
  font-size: 14px;
  text-align: center;
}

.modal {
  position: fixed;
  z-index: 100;
  inset: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(5, 20, 31, 0.58);
}

.modal-sheet {
  position: relative;
  z-index: 1;
  width: min(100%, 680px);
  max-height: min(92vh, 820px);
  max-height: min(92svh, 820px);
  overflow-y: auto;
  padding-bottom: env(safe-area-inset-bottom);
  border-radius: 8px 8px 0 0;
  background: var(--surface);
  box-shadow: 0 -18px 50px rgba(5, 20, 31, 0.2);
  animation: sheet-in 0.22s ease-out;
}

.compact-sheet {
  max-width: 560px;
}

@keyframes sheet-in {
  from {
    opacity: 0;
    transform: translateY(24px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.modal-head {
  position: sticky;
  z-index: 2;
  top: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 20px 18px 15px;
  border-bottom: 1px solid #edf2f4;
  background: rgba(255, 255, 255, 0.97);
}

.modal-head h2 {
  font-size: 21px;
  font-weight: 800;
}

.modal-head p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.icon-button {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  padding: 0 0 3px;
  border-radius: 8px;
  background: #f1f5f6;
  color: #516671;
  font-size: 27px;
  line-height: 1;
}

.modal-body {
  padding: 20px 18px 22px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.monthly-fields {
  display: grid;
  gap: 18px;
}

.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 4px;
}

.modal-actions button {
  width: 100%;
}

.renew-summary,
.renew-next {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  font-size: 14px;
}

.renew-summary span,
.renew-next span {
  color: var(--muted);
}

.renew-summary strong,
.renew-next strong {
  color: var(--ink);
  text-align: right;
}

.renew-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}

.renew-options button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-size: 15px;
  font-weight: 800;
}

.renew-options button.is-selected {
  border-color: var(--green);
  background: var(--green);
  color: #fff;
}

.renew-next {
  margin-bottom: 18px;
  border-color: #ebcf8f;
  background: #fff9e9;
}

.renew-next strong {
  color: var(--warning);
}

.confirm-modal {
  align-items: center;
  padding: 18px;
}

.confirm-card {
  position: relative;
  z-index: 1;
  width: min(100%, 420px);
  padding: 22px 18px 18px;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 22px 60px rgba(5, 20, 31, 0.26);
}

.confirm-card h2 {
  margin: 0;
  font-size: 21px;
  font-weight: 800;
}

.confirm-card p {
  margin: 12px 0 20px;
  color: #435763;
  font-size: 14px;
  line-height: 1.65;
  white-space: pre-line;
}

.toast {
  position: fixed;
  z-index: 200;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  width: max-content;
  max-width: calc(100% - 36px);
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(15, 37, 53, 0.94);
  color: #fff;
  box-shadow: 0 12px 30px rgba(5, 20, 31, 0.22);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
  transform: translateX(-50%);
}

@media (max-width: 640px) {
  .login-page {
    background:
      linear-gradient(
        180deg,
        var(--navy) 0,
        var(--navy) 305px,
        var(--page) 305px,
        var(--page) 100%
      );
  }

  .app-header-inner {
    min-height: 66px;
    padding-right: 12px;
    padding-left: 12px;
  }

  .app-brand img {
    width: 38px;
    height: 38px;
  }

  .app-brand strong {
    font-size: 14px;
  }

  .ghost-button {
    min-width: 50px;
    padding: 0 9px;
    font-size: 12px;
  }

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

  .search-form input {
    grid-column: 1 / -1;
  }

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

@media (min-width: 760px) {
  .modal {
    align-items: center;
  }

  .modal-sheet {
    border-radius: 8px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
