/* Amber Elite — Receipts PWA
   Brand: Navy #2D2E8E, Red #EE3535
   Fonts: Montserrat (headings), Open Sans (body) — loaded via Google Fonts
*/
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700&family=Open+Sans:wght@400;500;600&display=swap');

:root {
  --navy: #2D2E8E;
  --navy-dark: #1f2070;
  --red: #EE3535;
  --ink: #1a1a1a;
  --ink-soft: #5a5a66;
  --line: #e5e5ec;
  --bg: #f6f6fa;
  --card: #ffffff;
  --success: #1d8a4a;
  --error: #c0392b;
  --radius: 14px;
  --shadow-sm: 0 1px 2px rgba(20, 20, 40, 0.06);
  --shadow-md: 0 4px 24px rgba(20, 20, 40, 0.08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Open Sans', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

h1, h2, h3, .brand__title, .appbar__title {
  font-family: 'Montserrat', system-ui, sans-serif;
  margin: 0;
  letter-spacing: -0.01em;
}

button { font-family: inherit; }

/* ------------------------------------------------------------ Layout */
.container {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px 48px;
}

.stack > * + * { margin-top: 16px; }

/* ------------------------------------------------------------ Brand */
.brand { text-align: center; margin-bottom: 24px; }
.brand__mark {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  background: var(--navy);
  color: #fff;
  font-family: 'Montserrat', sans-serif;
  font-weight: 700;
  font-size: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: 0.02em;
  box-shadow: var(--shadow-sm);
}
.brand__mark--sm { width: 40px; height: 40px; font-size: 16px; border-radius: 10px; }
.brand__title { font-size: 22px; margin-top: 12px; color: var(--ink); }
.brand__sub { color: var(--ink-soft); margin: 4px 0 0; font-size: 14px; }

/* ------------------------------------------------------------ Auth page */
.page--auth {
  display: grid;
  place-items: center;
  min-height: 100dvh;
  padding: 24px 16px;
}
.card {
  width: 100%;
  max-width: 380px;
  background: var(--card);
  border-radius: var(--radius);
  padding: 28px 24px;
  box-shadow: var(--shadow-md);
}

/* ------------------------------------------------------------ App bar */
.appbar {
  background: var(--card);
  border-bottom: 1px solid var(--line);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: max(12px, env(safe-area-inset-top));
  position: sticky;
  top: 0;
  z-index: 10;
}
.appbar__left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.appbar__title { font-size: 17px; line-height: 1.2; }
.appbar__sub { margin: 2px 0 0; font-size: 12px; color: var(--ink-soft); }

/* ------------------------------------------------------------ Form fields */
.field { display: block; }
.field__label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 6px;
  color: var(--ink);
}
.field input,
.field textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card);
  color: var(--ink);
  transition: border-color 120ms, box-shadow 120ms;
}
.field input:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(45, 46, 142, 0.15);
}
.field textarea { resize: vertical; min-height: 80px; }

/* ------------------------------------------------------------ Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background-color 120ms, transform 80ms, opacity 120ms;
  min-height: 48px;
  width: 100%;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--primary { background: var(--navy); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--navy-dark); }
.btn--ghost {
  background: transparent;
  color: var(--ink);
  border-color: var(--line);
  width: auto;
}
.btn--sm { padding: 8px 12px; font-size: 14px; min-height: 36px; }

/* ------------------------------------------------------------ Capture */
.capture {
  position: relative;
  background: var(--card);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  min-height: 220px;
  display: grid;
  place-items: center;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 120ms, background-color 120ms;
}
.capture:hover { border-color: var(--navy); }
.capture--has-image { border-style: solid; padding: 0; cursor: default; }
.capture__empty {
  text-align: center;
  color: var(--ink-soft);
  padding: 32px 16px;
}
.capture__empty svg { color: var(--navy); }
.capture__hint { margin: 8px 0 0; font-size: 14px; }
.capture__preview {
  display: block;
  width: 100%;
  height: auto;
  max-height: 60vh;
  object-fit: contain;
  background: #000;
}
.capture__retake {
  position: absolute;
  top: 8px;
  right: 8px;
  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(4px);
}

/* ------------------------------------------------------------ Status messages */
.error {
  margin: 0;
  padding: 10px 12px;
  background: #fdecea;
  color: var(--error);
  border-radius: 8px;
  font-size: 14px;
}
.success {
  margin: 0;
  padding: 10px 12px;
  background: #e8f5ec;
  color: var(--success);
  border-radius: 8px;
  font-size: 14px;
}

/* ------------------------------------------------------------ Loading state */
.btn--loading {
  position: relative;
  color: transparent !important;
}
.btn--loading::after {
  content: '';
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ Safe areas (iPhone notch) */
@supports (padding: max(0px)) {
  .container { padding-bottom: max(48px, env(safe-area-inset-bottom)); }
}
