/* WeDo Connect web app – the mobile app's design (src/theme/tokens.ts) for the browser.
   Paper tone, brand navy, Inter, hairlines instead of cards, organisation color edges. */

@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Inter';
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url('/assets/fonts/inter-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --brand: #1b2e5e;
  --brand-pressed: #14234a;
  --brand-soft: #e3e5ea;
  --paper: #f5f2ed;
  --paper-deep: #ebe7df;
  --ink: #17150f;
  --ink-soft: #3a372f;
  --ink-muted: #6e6a60;
  --ink-subtle: #8a857a;
  --ink-faint: #c4bfb4;
  --line: #ddd8ce;
  --line-soft: #e7e2d9;
  --danger: #c62a22;
  --green: #8dc63f;
  --gutter: 20px;
  --sidebar: 248px;
  --column: 760px;
  --tabbar-h: 64px;
  color-scheme: light;
}

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

html {
  -webkit-text-size-adjust: 100%;
  scroll-padding-top: 12px;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

body.modal-open {
  overflow: hidden;
}

h1, h2, h3, p, fieldset, figure {
  margin: 0;
}

fieldset {
  border: 0;
  padding: 0;
  min-width: 0;
}

legend {
  padding: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: 0;
  padding: 0;
  cursor: pointer;
}

button:disabled {
  cursor: default;
}

img {
  display: block;
  max-width: 100%;
}

:focus-visible {
  outline: 2px solid var(--brand);
  outline-offset: 2px;
  border-radius: 6px;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.icon {
  flex: none;
  display: block;
}

/* Type scale (Text variants of the app) ---------------------------------- */

.display { font-size: 32px; font-weight: 800; line-height: 37px; letter-spacing: -0.9px; color: var(--ink); }
.title { font-size: 25px; font-weight: 700; line-height: 30px; letter-spacing: -0.4px; color: var(--ink); }
.heading { font-size: 18px; font-weight: 700; line-height: 24px; letter-spacing: -0.4px; color: var(--ink); }
.body { font-size: 15px; line-height: 23px; color: var(--ink-soft); }
.strong { font-size: 15px; font-weight: 600; line-height: 21px; color: var(--ink); }
.meta { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 1.2px; color: var(--ink-subtle); line-height: 16px; }
.caption { font-size: 13px; line-height: 18px; color: var(--ink-muted); }
.numeral { font-weight: 800; letter-spacing: -0.9px; line-height: 1; font-variant-numeric: tabular-nums; }

.brand { color: var(--brand); }
.danger { color: var(--danger) !important; }
.muted { color: var(--ink-muted); }
.ink { color: var(--ink); }
.faint { color: var(--ink-faint); }
.semibold { font-weight: 600; }
.bold { font-weight: 700; }
.medium { font-weight: 500; }
.center { text-align: center; }
.pre { white-space: pre-line; }
.min-w-0 { min-width: 0; }

.truncate { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; min-width: 0; }
.clamp-2, .clamp-3, .clamp-6 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.clamp-2 { -webkit-line-clamp: 2; }
.clamp-3 { -webkit-line-clamp: 3; }
.clamp-6 { -webkit-line-clamp: 6; }

/* Spacing helpers --------------------------------------------------------- */

.gutter { padding-left: var(--gutter); padding-right: var(--gutter); }
.stack-1, .stack-3, .stack-4, .stack-6 { display: flex; flex-direction: column; }
.stack-1 { gap: 4px; }
.stack-3 { gap: 12px; }
.stack-4 { gap: 16px; }
.stack-6 { gap: 24px; }
.pb-1 { padding-bottom: 4px; }
.pb-2 { padding-bottom: 8px; }
.pb-3 { padding-bottom: 12px; }
.pb-10 { padding-bottom: 40px; }
.pt-4 { padding-top: 16px; }
.pt-16 { padding-top: 64px; }
.mt-2 { margin-top: 8px; }
.pad-y { display: block; padding: 8px 0; }

.hairline { height: 1px; background: var(--line); flex: none; }
.hairline.strong { height: 1.5px; background: var(--ink); }

/* Layout ------------------------------------------------------------------ */

.screen {
  width: 100%;
  max-width: var(--column);
  margin: 0 auto;
  padding-bottom: 32px;
  min-height: 100vh;
  min-height: 100dvh;
}

body.is-tab .screen {
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 24px);
}

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: none;
  background: var(--paper);
  border-top: 1px solid var(--line);
  padding-bottom: max(env(safe-area-inset-bottom), 8px);
}

body.is-tab .tabbar {
  display: flex;
}

.tabbar-brand {
  display: none;
}

.tab {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 2px 4px;
  color: var(--ink-subtle);
  font-size: 11px;
}

.tab.active {
  color: var(--brand);
  font-weight: 600;
}

.tab-label {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

@media (max-width: 420px) {
  .tab-label { font-size: 0; }
  .tab-label::after { content: attr(data-short); font-size: 11px; }
}

@media (min-width: 900px) {
  body:not(.is-bare) {
    padding-left: var(--sidebar);
  }

  .tabbar,
  body.is-tab .tabbar {
    display: flex;
    flex-direction: column;
    gap: 2px;
    top: 0;
    right: auto;
    width: var(--sidebar);
    border-top: 0;
    border-right: 1px solid var(--line);
    padding: 22px 14px;
  }

  .tabbar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 10px 22px;
  }

  .tab {
    flex: none;
    flex-direction: row;
    gap: 12px;
    padding: 10px 12px;
    border-radius: 12px;
    font-size: 15px;
  }

  .tab:hover { background: var(--paper-deep); }
  .tab .icon { width: 21px; height: 21px; }
  .tab-label { font-size: 15px; }
  .tab-label::after { content: none; }

  .screen,
  body.is-tab .screen {
    padding-top: 16px;
    padding-bottom: 56px;
  }
}

/* Brand lockups ----------------------------------------------------------- */

.brand-lockup,
.tabbar-brand {
  color: var(--ink);
}

.brand-lockup { display: flex; align-items: center; gap: 10px; }
.brand-lockup span, .tabbar-brand span { display: flex; flex-direction: column; }
.brand-lockup b, .tabbar-brand b { font-size: 22px; font-weight: 800; line-height: 24px; letter-spacing: -0.4px; }
.brand-lockup small, .tabbar-brand small { font-size: 13px; font-weight: 500; letter-spacing: 0.5px; color: var(--brand); margin-top: -2px; }

/* Headers ----------------------------------------------------------------- */

.screen-header { padding: 12px var(--gutter) 12px; display: flex; flex-direction: column; gap: 4px; }
.screen-header-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.actions { display: flex; gap: 8px; align-items: center; }

.start-header { display: flex; align-items: center; justify-content: space-between; padding: 12px var(--gutter) 8px; }
.avatar-link { display: block; border-radius: 50%; }

.detail-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px var(--gutter) 8px;
}

.detail-header.overlay {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 5;
}

.screen { position: relative; }

/* Buttons ----------------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  transition: background-color 0.15s;
}

.btn:disabled { opacity: 0.4; }
.btn[aria-busy='true'] { opacity: 1; }
.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--brand-pressed); }
.btn-outline { border: 1px solid rgba(27, 46, 94, 0.25); color: var(--brand); }
.btn-outline:hover { background: var(--brand-soft); }
.btn-ghost { color: var(--brand); }
.btn-ghost:hover { background: var(--paper-deep); }
.btn-danger-solid { background: var(--danger); color: #fff; }

.icon-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--ink);
  flex: none;
  transition: background-color 0.15s;
}

.icon-btn.outline { border: 1px solid var(--line); }
.icon-btn.outline:hover { background: var(--paper-deep); }
.icon-btn.solid { background: var(--brand); color: var(--paper); }
.icon-btn.on-image { border: 0; background: rgba(245, 242, 237, 0.9); }

.text-btn { font-size: 14px; font-weight: 700; color: var(--brand); align-self: flex-start; }
.text-btn.danger { font-size: 13px; }

.link-strong {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  font-weight: 700;
  color: var(--brand);
  align-self: flex-start;
}

.more-link { display: inline-block; padding: 16px 0; font-size: 15px; font-weight: 700; color: var(--brand); }

.bookmark { color: var(--ink-faint); padding: 2px; border-radius: 6px; }
.bookmark.active { color: var(--brand); }
.bookmark:hover { color: var(--brand); }
.icon-btn .bookmark { padding: 0; }

.spinner {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2.5px solid rgba(23, 21, 15, 0.15);
  border-top-color: var(--ink);
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

.spinner.small { width: 16px; height: 16px; border-width: 2px; border-color: rgba(255, 255, 255, 0.35); border-top-color: #fff; }
.btn-outline .spinner.small, .btn-ghost .spinner.small { border-color: rgba(27, 46, 94, 0.25); border-top-color: var(--brand); }

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

/* Rows -------------------------------------------------------------------- */

.list { display: flex; flex-direction: column; }

.row {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
}

.row-link {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: stretch;
  gap: 12px;
}

a.row-link:hover .row-title, .event-row .row-link:hover .row-title { color: var(--brand); }
.row.row-link { align-items: stretch; }
.row.compact { padding: 14px 0; align-items: center; }

.edge { width: 3px; border-radius: 3px; flex: none; align-self: stretch; }

.row-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; padding: 2px 0; }
.row-title { font-size: 17px; font-weight: 700; line-height: 22px; letter-spacing: -0.4px; color: var(--ink); }

.numeral.small { width: 46px; flex: none; text-align: center; font-size: 30px; line-height: 38px; }
.numeral.large { font-size: 52px; line-height: 54px; }

.org-line { display: flex; align-items: center; gap: 6px; min-width: 0; }
.dot { width: 6px; height: 6px; border-radius: 50%; flex: none; }

.thumb { width: 64px; height: 64px; border-radius: 10px; object-fit: cover; background: var(--paper-deep); flex: none; }
.chevron { color: var(--ink-faint); display: flex; align-items: center; flex: none; }

.org-logo { flex: none; position: relative; overflow: hidden; display: inline-flex; align-items: center; justify-content: center; font-weight: 800; letter-spacing: -0.3px; }
/* the logo covers the initials tile; when it fails to load the tile shows */
.org-logo img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; background: var(--paper-deep); }

.org-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 0;
  margin: 0 var(--gutter);
  border-bottom: 1px solid var(--line);
}

.org-row:hover .row-title { color: var(--brand); }

.list-row {
  width: 100%;
  min-height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.list-row .list-icon { color: var(--ink-soft); display: flex; }
.list-row .list-icon.danger { color: var(--danger); }
a.list-row:hover .strong, button.list-row:hover .strong { color: var(--brand); }
button.list-row:hover .strong.danger { color: var(--danger); }

.managed-row .row-title:hover { color: var(--brand); }
.item-actions { display: flex; gap: 20px; padding-top: 8px; }
.item-actions button, .item-actions a { font-size: 13px; }

/* Start ------------------------------------------------------------------- */

.logo-row-wrap { display: flex; flex-direction: column; gap: 8px; padding: 8px 0 16px; }

.logo-row {
  display: flex;
  gap: 16px;
  overflow-x: auto;
  padding: 0 var(--gutter);
  scrollbar-width: none;
}

.logo-row::-webkit-scrollbar { display: none; }

.logo-item { width: 60px; flex: none; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.logo-ring { border: 2px solid transparent; border-radius: 50%; padding: 2.5px; display: block; }
.logo-name { font-size: 11px; font-weight: 500; color: var(--ink-muted); max-width: 60px; }
.logo-all { width: 59px; height: 59px; border-radius: 50%; border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; color: var(--brand); }
.logo-item:hover .logo-all { background: var(--paper-deep); }

.start-heading { margin-top: 20px; }
.start-offers { margin-top: 40px; }

/* Events ------------------------------------------------------------------ */

.day { padding-top: 20px; }
.day-header { display: flex; align-items: baseline; gap: 8px; padding-bottom: 8px; }

.footer-toggle { display: block; width: 100%; padding: 24px 0; font-size: 14px; font-weight: 600; color: var(--ink-muted); }

/* Organisations ----------------------------------------------------------- */

.count-row { display: flex; flex-direction: column; gap: 8px; padding-top: 4px; }
.count-row .caption { align-self: flex-end; min-height: 18px; }

.directory { position: relative; padding-bottom: 24px; }
.directory.with-index { padding-right: 18px; }

.letter {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--paper);
  padding: 16px var(--gutter) 4px;
  color: var(--ink);
}

.alphabet {
  position: fixed;
  right: max(4px, calc((100vw - var(--column)) / 2 - 28px));
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  z-index: 3;
}

.alphabet button { width: 22px; font-size: 10.5px; font-weight: 700; line-height: 15px; color: var(--ink-subtle); }
.alphabet button.off { color: rgba(196, 191, 180, 0.6); }
.alphabet button:hover { color: var(--brand); }

@media (min-width: 900px) {
  .alphabet { right: max(8px, calc((100vw - var(--sidebar) - var(--column)) / 2 - 30px)); }
}

/* Offers ------------------------------------------------------------------ */

.segmented { display: flex; padding: 4px; border-radius: 999px; background: var(--paper-deep); }
.segmented button { flex: 1; height: 36px; border-radius: 999px; font-size: 14px; font-weight: 700; color: var(--ink-muted); }
.segmented button.selected { background: var(--brand); color: #fff; }

/* Chips and search -------------------------------------------------------- */

.chip {
  height: 36px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  white-space: nowrap;
  flex: none;
}

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

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  margin: 0 calc(-1 * var(--gutter));
  padding: 0 var(--gutter);
  scrollbar-width: none;
}

.chip-row::-webkit-scrollbar { display: none; }
.chip-wrap { display: flex; flex-wrap: wrap; gap: 8px; }

.search-field {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: #fff;
  cursor: text;
}

.search-field:focus-within { border-color: var(--brand); }
.search-field .brand { color: var(--brand); }

.search-field input {
  flex: 1;
  min-width: 0;
  height: 46px;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 15px;
  color: var(--ink);
  -webkit-appearance: none;
  appearance: none;
}

.search-field input::-webkit-search-cancel-button { display: none; }
.search-field input::placeholder { color: var(--ink-subtle); }
.clear { color: var(--ink-faint); display: flex; }
.clear:hover { color: var(--ink-muted); }

/* States ------------------------------------------------------------------ */

.state { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 64px 0; }
.state.empty { gap: 12px; padding: 56px 32px; text-align: center; }
.state.empty .btn { margin-top: 8px; }

/* Details ----------------------------------------------------------------- */

.hero { width: 100%; aspect-ratio: 1 / 0.72; max-height: 480px; background: var(--paper-deep); overflow: hidden; }
.hero img { width: 100%; height: 100%; object-fit: cover; }

@media (min-width: 900px) {
  .hero { border-radius: 0 0 16px 16px; }
}

.detail { display: flex; flex-direction: column; gap: 24px; padding-top: 20px; padding-bottom: 48px; overflow-wrap: anywhere; }
.meta-line { display: flex; align-items: center; gap: 8px; }
.meta-line .bar { width: 3px; height: 16px; border-radius: 3px; flex: none; }

.topic-tags { display: flex; flex-wrap: wrap; gap: 4px 16px; }
.topic-tag { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--ink-soft); }
.topic-tag .square { width: 8px; height: 8px; border-radius: 2px; }

.date-block { display: flex; align-items: center; gap: 16px; }

.organiser-link { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.organiser-link:hover .strong { color: var(--brand); }

.section { display: flex; flex-direction: column; gap: 12px; }
.section-label { padding-top: 8px; }
.expandable { display: flex; flex-direction: column; gap: 8px; }
.tag-list { font-size: 15px; font-weight: 500; line-height: 21px; color: var(--ink); white-space: pre-wrap; }

.org-head { display: flex; align-items: center; gap: 16px; padding-top: 4px; }
.org-head h1, .org-head h2 { overflow-wrap: anywhere; }

/* Welcome ----------------------------------------------------------------- */

.welcome {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  max-width: 480px;
  margin: 0 auto;
  padding-bottom: max(env(safe-area-inset-bottom), 16px);
}

body.is-bare .screen { max-width: none; padding: 0; }

.welcome-dots {
  position: fixed;
  left: 0;
  right: 0;
  top: 0;
  height: 45vh;
  background: url('/assets/img/dots.jpg') top right / cover;
  opacity: 0.5;
  z-index: 0;
}

.welcome-dots::after {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(to bottom left, rgba(245, 242, 237, 0) 10%, rgba(245, 242, 237, 0.7) 50%, var(--paper) 80%),
    linear-gradient(to bottom, rgba(245, 242, 237, 0) 55%, var(--paper) 100%);
}

@media (min-width: 900px) {
  .welcome-dots { height: 55vh; opacity: 0.45; background-size: 540px auto; background-repeat: repeat-x; }
  /* the sidebar already carries the logo */
  .start-header .brand-lockup { visibility: hidden; }
}

.welcome-brand {
  position: relative;
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  padding: 0 32px 40px;
  text-align: center;
}

.wordmark { display: flex; flex-direction: column; align-items: center; color: var(--brand); }
.wordmark span { font-size: 40px; font-weight: 800; line-height: 44px; letter-spacing: -0.9px; }
.wordmark small { font-size: 14px; font-weight: 600; text-transform: uppercase; letter-spacing: 5px; }

.welcome-actions { position: relative; display: flex; flex-direction: column; gap: 12px; padding: 0 var(--gutter) 16px; }
.welcome-actions .btn { width: 100%; }

/* Modal sheets ------------------------------------------------------------ */

.modal-layer { position: fixed; inset: 0; z-index: 40; display: flex; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(23, 21, 15, 0.35); }

.sheet {
  position: relative;
  width: 100%;
  height: 100%;
  background: var(--paper);
  display: flex;
  flex-direction: column;
  animation: sheet-in 0.22s ease-out;
}

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

@media (min-width: 640px) {
  .modal-layer { align-items: center; justify-content: center; padding: 24px; }
  .sheet { max-width: 560px; height: auto; max-height: min(860px, calc(100dvh - 48px)); border-radius: 24px; overflow: hidden; box-shadow: 0 24px 60px rgba(23, 21, 15, 0.18); }
}

.form-screen { display: flex; flex-direction: column; min-height: 0; flex: 1; }

.form-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(18px + env(safe-area-inset-top)) var(--gutter) 12px;
}

@media (min-width: 640px) {
  .form-header { padding-top: 22px; }
}

.form-header .title:focus { outline: none; }

.form-body { flex: 1; overflow-y: auto; padding: 8px var(--gutter) 32px; display: flex; flex-direction: column; gap: 24px; -webkit-overflow-scrolling: touch; }
.form-fields { display: flex; flex-direction: column; gap: 24px; }

.form-footer {
  display: flex;
  flex-direction: column;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 12px var(--gutter) max(env(safe-area-inset-bottom), 16px);
  background: var(--paper);
}

.form-footer .btn { width: 100%; }

.shake { animation: shake 0.3s ease-in-out; }

@keyframes shake {
  17% { transform: translateX(-8px); }
  33% { transform: translateX(8px); }
  50% { transform: translateX(-6px); }
  67% { transform: translateX(6px); }
  83% { transform: translateX(-3px); }
}

.success-icon { color: var(--green); }

/* Form fields ------------------------------------------------------------- */

.field { display: flex; flex-direction: column; gap: 6px; }
.field > legend.meta { margin-bottom: 10px; }
.field-label { font-size: 14px; font-weight: 600; color: var(--ink); }

.field-box {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 48px;
  padding: 0 16px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: var(--paper-deep);
  color: var(--ink-subtle);
}

.field-box:focus-within { border-color: var(--brand); color: var(--brand); }
.field-box.invalid { border-color: var(--danger); }
.field-box.multiline { height: auto; align-items: flex-start; padding: 12px 16px; }
.field-box.multiline .icon { margin-top: 2px; }

.field-box input,
.field-box textarea {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
}

.field-box input { height: 46px; }
.field-box textarea { min-height: 96px; resize: vertical; line-height: 22px; }
.field-box input::placeholder, .field-box textarea::placeholder { color: var(--ink-faint); }

.line-input {
  height: 44px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  font: inherit;
  font-size: 16px;
  color: var(--ink);
  outline: 0;
  width: 100%;
  border-radius: 0;
}

.line-input:focus { border-color: var(--brand); }
.line-input.invalid, .line-row.invalid { border-color: var(--danger); }
.line-row { display: flex; align-items: center; border-bottom: 1px solid var(--line); }
.line-row:focus-within { border-color: var(--brand); }
.line-input.bare { border: 0; }
.field-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }

.swatches { display: flex; flex-wrap: wrap; gap: 12px; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 2px solid transparent; display: flex; align-items: center; justify-content: center; }
.swatch.selected { border-color: var(--ink); }
.swatch span { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; color: var(--paper); }

.image-pick {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  overflow: hidden;
  border-radius: 12px;
  border: 1px dashed var(--line);
  background: var(--paper-deep);
  cursor: pointer;
}

.image-pick.square { width: 112px; height: 112px; }
.image-pick:hover { border-color: var(--ink-faint); }
.image-pick:focus-within { outline: 2px solid var(--brand); outline-offset: 2px; }
.image-pick img { width: 100%; height: 100%; object-fit: cover; }
.image-empty { display: flex; flex-direction: column; align-items: center; gap: 6px; color: var(--ink-subtle); }
.image-busy { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(245, 242, 237, 0.7); }

/* Dialog and toast -------------------------------------------------------- */

dialog.confirm {
  border: 0;
  border-radius: 20px;
  padding: 24px;
  width: min(400px, calc(100vw - 32px));
  background: var(--paper);
  color: var(--ink);
  box-shadow: 0 24px 60px rgba(23, 21, 15, 0.22);
}

dialog.confirm::backdrop { background: rgba(23, 21, 15, 0.4); }
dialog.confirm form { display: flex; flex-direction: column; gap: 12px; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.confirm-actions .btn { height: 44px; padding: 0 20px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 20px);
  transform: translate(-50%, 12px);
  max-width: calc(100vw - 32px);
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
  overflow-wrap: anywhere;
}

.toast.show { opacity: 1; transform: translate(-50%, 0); }

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