:root {
  --bg: #f6f5f2;
  --surface: #ffffff;
  --text: #1c1917;
  --text-muted: #78716c;
  --border: #e7e5e4;
  --border-focus: #1b3855;
  --brand: #1b3855;
  --brand-hover: #143044;
  --accent: #2d6a4f;
  --accent-soft: #ecfdf3;
  --accent-border: #bbf7d0;
  --warning-soft: #fffbeb;
  --warning-border: #fde68a;
  --shadow-sm: 0 1px 2px rgba(28, 25, 23, 0.04);
  --shadow-md: 0 4px 24px rgba(28, 25, 23, 0.06);
  --radius: 12px;
  --radius-sm: 8px;
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --max-width: 720px;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.page {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 3rem 1.25rem 4rem;
}

/* Header */
.site-header {
  text-align: center;
  margin-bottom: 2.5rem;
}

.site-logo {
  display: inline-flex;
  align-items: center;
  gap: 0.625rem;
  text-decoration: none;
  color: var(--text);
  margin-bottom: 0.75rem;
}

.site-logo img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}

.site-logo span {
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.site-tagline {
  margin: 0;
  font-size: 1.0625rem;
  color: var(--text-muted);
  max-width: 28rem;
  margin-inline: auto;
}

/* Card / form */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 1.75rem;
}

.panel-section + .panel-section {
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}

.panel-label {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.form-row {
  display: grid;
  gap: 1rem;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.field label {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
}

.field input[type="text"],
.field input[type="number"],
.select-wrap select,
.field .select-input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  font: inherit;
  font-size: 1rem;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
}

.select-wrap {
  position: relative;
}

.select-wrap select,
.field .select-input {
  appearance: none;
  -webkit-appearance: none;
  cursor: pointer;
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%2378716c' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.25rem;
}

.input-prefix-wrap {
  display: flex;
  align-items: stretch;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.input-prefix-wrap:focus-within {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(27, 56, 85, 0.1);
  background: var(--surface);
}

.input-prefix {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  padding: 0.625rem 0 0.625rem 0.875rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  user-select: none;
  white-space: nowrap;
}

.field .input-prefix-wrap input[type="number"] {
  flex: 1;
  min-width: 0;
  border: none;
  border-radius: 0;
  padding: 0.625rem 0.875rem 0.625rem 0.375rem;
  background: transparent;
  box-shadow: none;
}

.field .input-prefix-wrap input[type="number"]:focus {
  border: none;
  box-shadow: none;
  background: transparent;
}

.field input:focus,
.select-wrap select:focus,
.field .select-input:focus {
  outline: none;
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(27, 56, 85, 0.1);
  background-color: var(--surface);
}

.select-wrap select:focus,
.field .select-input:focus {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%231b3855' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
}

.field input::placeholder {
  color: #a8a29e;
}

.field input[type="number"]::-webkit-outer-spin-button,
.field input[type="number"]::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.field input[type="number"] {
  -moz-appearance: textfield;
}

.field-hint {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.field-hint--subtle {
  font-size: 0.75rem;
  color: #a8a29e;
}

.field-hint--tax {
  margin: 0.5rem 0 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg);
  border-radius: var(--radius-sm);
  line-height: 1.45;
}

.field-hint--tax.is-active {
  color: var(--text);
  background: #f0fdf4;
  border: 1px solid #bbf7d0;
}

.field-error {
  font-size: 0.8125rem;
  color: #b91c1c;
}

.us-state-field {
  margin-bottom: 0.25rem;
}

.locale-banner {
  font-size: 0.875rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 1rem;
  margin-bottom: 1.25rem;
  text-align: center;
}

.locale-banner strong {
  color: var(--text);
}

.checkbox-field {
  display: flex;
  align-items: flex-start;
  gap: 0.625rem;
  margin-top: 0.25rem;
}

.checkbox-field input[type="checkbox"] {
  width: 1.125rem;
  height: 1.125rem;
  margin: 0.125rem 0 0;
  accent-color: var(--brand);
  flex-shrink: 0;
}

.checkbox-field label {
  font-size: 0.875rem;
  color: var(--text-muted);
  cursor: pointer;
  line-height: 1.4;
}

.btn-primary {
  display: block;
  width: 100%;
  margin-top: 1.5rem;
  padding: 0.75rem 1.25rem;
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #fff;
  background: var(--brand);
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

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

.btn-primary:active {
  transform: scale(0.99);
}

/* Results */
.results {
  margin-top: 2.5rem;
}

.results-heading {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin: 0 0 1rem;
}

.rate-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

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

.rate-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
}

.rate-card .value {
  display: block;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.rate-card .unit {
  display: block;
  font-size: 0.8125rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}

.rate-card .label {
  display: block;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
}

.rate-note {
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--warning-soft);
  border: 1px solid var(--warning-border);
  border-radius: var(--radius-sm);
  padding: 0.625rem 0.875rem;
  margin-bottom: 1.5rem;
}

.rate-note strong {
  color: var(--text);
  font-weight: 600;
}

/* Item list */
.items-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.items-panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.items-panel-header h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.items-panel-header p {
  margin: 0.25rem 0 0;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.item-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.item-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem 1rem;
  padding: 0.875rem 1.25rem;
  border-bottom: 1px solid var(--border);
  align-items: baseline;
}

.item-row:last-child {
  border-bottom: none;
}

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

.item-name {
  font-weight: 500;
  font-size: 0.9375rem;
}

.item-price {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.item-time {
  grid-column: 1 / -1;
  font-size: 0.875rem;
  color: var(--accent);
  font-weight: 500;
}

@media (min-width: 480px) {
  .item-time {
    grid-column: auto;
    text-align: right;
  }
}

/* Custom item highlight */
.custom-panel {
  margin-top: 1.5rem;
  background: var(--accent-soft);
  border: 1px solid var(--accent-border);
  border-radius: var(--radius);
  overflow: hidden;
}

.custom-panel .items-panel-header {
  border-bottom-color: var(--accent-border);
  background: rgba(255, 255, 255, 0.5);
}

.custom-panel .item-row {
  border-bottom-color: var(--accent-border);
  background: rgba(255, 255, 255, 0.35);
}

/* Footer */
.site-footer {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
  text-align: center;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.site-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
  text-decoration: underline;
}

.site-footer nav {
  margin-top: 0.375rem;
}

.site-footer nav a + a::before {
  content: "·";
  margin: 0 0.5rem;
  text-decoration: none;
}

/* Legal pages */
.legal-page {
  max-width: 560px;
}

.legal-page h1 {
  font-size: 1.75rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 1.25rem;
}

.legal-page p {
  color: var(--text-muted);
  margin: 0 0 1rem;
  line-height: 1.65;
}

.legal-page a {
  color: var(--brand);
}

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--brand);
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

.hidden {
  display: none !important;
}

.panel-label-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

/* Install button */
.install-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  margin-top: 1rem;
  padding: 0.5rem 0.875rem;
  font: inherit;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.install-btn:hover {
  border-color: var(--brand);
  background: #fff;
}

/* Popular lookups */
.popular-section {
  margin-bottom: 1.25rem;
}

.popular-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.popular-chip {
  padding: 0.375rem 0.75rem;
  font: inherit;
  font-size: 0.8125rem;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.popular-chip:hover {
  border-color: var(--brand);
  background: #fff;
}

/* Share card */
.share-section {
  margin-bottom: 1.5rem;
}

.share-card {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.share-card-inner {
  background: linear-gradient(145deg, #1b3855 0%, #143044 100%);
  color: #fff;
  padding: 1.75rem;
  text-align: center;
}

.share-card-brand {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  opacity: 0.9;
  margin-bottom: 1.25rem;
}

.share-card-brand img {
  border-radius: 6px;
}

.share-card-kicker {
  margin: 0;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  opacity: 0.65;
}

.share-card-item {
  margin: 0.375rem 0 0;
  font-size: 1.375rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.share-card-price {
  margin: 0.25rem 0 0;
  font-size: 1rem;
  opacity: 0.75;
}

.share-card-time {
  margin: 1rem 0 0;
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #a7f3d0;
}

.share-card-time--large {
  font-size: 2.25rem;
}

.share-card-context {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  opacity: 0.65;
}

.share-card-url {
  margin: 1.25rem 0 0;
  font-size: 0.75rem;
  letter-spacing: 0.04em;
  opacity: 0.45;
}

.share-actions {
  display: flex;
  gap: 0.625rem;
  margin-top: 0.875rem;
}

.btn-secondary {
  flex: 1;
  padding: 0.625rem 1rem;
  font: inherit;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--brand);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.btn-secondary:hover {
  border-color: var(--brand);
}

.btn-secondary:disabled {
  opacity: 0.7;
  cursor: default;
}

/* iOS install modal */
.install-modal {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 1rem;
  background: rgba(28, 25, 23, 0.4);
}

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

.install-modal-content {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-md);
}

.install-modal-content h2 {
  margin: 0 0 1rem;
  font-size: 1.125rem;
  font-weight: 600;
}

.install-steps {
  margin: 0 0 1.25rem;
  padding-left: 1.25rem;
  color: var(--text-muted);
  font-size: 0.9375rem;
  line-height: 1.6;
}

.install-steps strong {
  color: var(--text);
}
