/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

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

:root {
  --bg: #f4f8f9;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --border: #dee7e9;
  /* Nova Lib palette — derived from the logo */
  --primary: #1a6e7c;          /* deep teal — "NOVA LIB" wordmark + outer infinity */
  --primary-hover: #134f5b;
  --primary-soft: #e1f2f4;     /* very light teal — backgrounds */
  --primary-border: #b9dde0;
  --accent: #4ab9b5;           /* lighter teal — inner figure on the logo */
  --accent-soft: #d8eeec;
  --error: #b91c1c;
  --error-bg: #fee2e2;
  --success: #166534;
  --success-bg: #dcfce7;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(15, 23, 42, 0.08);
  --radius: 14px;
  --radius-sm: 10px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-size: 16px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Layout ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  color: var(--primary);
}

.brand__img {
  height: 44px;
  width: auto;
  display: block;
  /* Logo file has a white background — blends into the white topbar. */
}

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

.topbar__tag {
  font-size: 13px;
  color: var(--muted);
  background: var(--primary-soft);
  color: var(--primary);
  padding: 4px 10px;
  border-radius: 999px;
  font-weight: 600;
}

.container {
  flex: 1;
  width: 100%;
  max-width: 560px;
  margin: 0 auto;
  padding: 20px 16px 32px;
}

.footer {
  text-align: center;
  padding: 16px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Card ---------- */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 22px 18px 18px;
}

.card__title {
  font-size: 22px;
  margin: 0 0 4px;
}

.card__subtitle {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Form ---------- */
.field {
  display: flex;
  flex-direction: column;
  margin-bottom: 14px;
}

.field label {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

.field input {
  font: inherit;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  transition: border-color 0.15s, box-shadow 0.15s;
  width: 100%;
  min-height: 44px; /* good tap target */
}

.field input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(26, 110, 124, 0.18);
}

.field input:disabled {
  background: #f1f5f9;
  color: var(--muted);
}

.row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0;
}

@media (min-width: 480px) {
  .row {
    grid-template-columns: 1fr 1.4fr;
    gap: 14px;
  }
}

/* ---------- Buttons ---------- */
.actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}

.actions--split {
  margin-top: 18px;
}

@media (min-width: 480px) {
  .actions--split {
    flex-direction: row;
  }
  .actions--split .btn {
    flex: 1;
  }
}

.btn {
  font: inherit;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s,
    transform 0.05s;
  min-height: 46px;
  text-align: center;
}

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

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

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

.btn--ghost {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}

.btn--ghost:hover:not(:disabled) {
  background: var(--primary-soft);
}

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

.btn[aria-busy="true"] {
  position: relative;
  color: transparent;
}

.btn[aria-busy="true"]::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  top: 50%;
  left: 50%;
  margin: -9px 0 0 -9px;
  border: 2px solid #ffffffaa;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

.btn--ghost[aria-busy="true"]::after {
  border-color: var(--primary);
  border-top-color: transparent;
}

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

/* ---------- Quote box ---------- */
.quote {
  margin-top: 20px;
  padding: 16px;
  background: var(--primary-soft);
  border-radius: var(--radius-sm);
  border: 1px solid var(--primary-border);
}

.quote__row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 0;
}

.quote__row + .quote__row {
  border-top: 1px dashed var(--primary-border);
}

.quote__label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}

.quote__value {
  font-weight: 600;
}

.quote__price {
  font-size: 24px;
  font-weight: 700;
  color: var(--primary);
}

/* ---------- Alerts ---------- */
.alert {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 500;
}

.alert--error {
  background: var(--error-bg);
  color: var(--error);
  border: 1px solid #fecaca;
}

.alert--success {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid #bbf7d0;
}

/* ---------- Misc ---------- */
.legal {
  font-size: 12px;
  color: var(--muted);
  text-align: center;
  margin: 16px 6px 0;
  line-height: 1.5;
}

/* ---------- Custom autocomplete dropdown ---------- */
.ac-host {
  position: relative;
}

.ac-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
}

.ac-item {
  padding: 10px 12px;
  cursor: pointer;
  font-size: 14px;
  border-top: 1px solid var(--border);
  /* prevent text selection while clicking */
  user-select: none;
}

.ac-item:first-child {
  border-top: none;
}

.ac-item:hover,
.ac-item--active {
  background: var(--primary-soft);
}

.ac-empty {
  padding: 10px 12px;
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}
