/* Reusable pieces: brand, buttons, form fields, alerts, toasts */

.brand {
  display: inline-flex; align-items: center; gap: 10px;
  font-family: var(--font-display); font-weight: 750; font-size: 1.3rem;
  letter-spacing: -0.02em; color: var(--ink); text-decoration: none;
}
.brand:hover { color: var(--ink); }
.brand-light, .brand-light:hover { color: #fff; }

/* Buttons */
.btn {
  --btn-bg: transparent; --btn-fg: var(--ink); --btn-bd: transparent;
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 44px; padding: 10px 20px;
  background: var(--btn-bg); color: var(--btn-fg);
  border: 1.5px solid var(--btn-bd); border-radius: var(--r-control);
  font-weight: 650; font-size: var(--fs-1); line-height: 1.2; text-decoration: none;
  cursor: pointer; position: relative;
  transition: background-color .15s, border-color .15s, transform .15s var(--ease-out), box-shadow .15s;
}
.btn:hover { color: var(--btn-fg); }
.btn:active { transform: translateY(1px); }
.btn-primary { --btn-bg: var(--turmeric); --btn-fg: var(--ink); box-shadow: 0 1px 0 rgba(0,0,0,.08), inset 0 -2px 0 rgba(0,0,0,.08); }
.btn-primary:hover { --btn-bg: #FFC21F; }
.btn-quiet { --btn-fg: #fff; --btn-bd: rgba(255,255,255,.35); }
.btn-quiet:hover { --btn-bd: #fff; background: rgba(255,255,255,.06); }
.btn-ghost { --btn-bd: var(--line); --btn-bg: var(--surface); }
.btn-ghost:hover { --btn-bd: var(--ink-2); }
.btn-sm { min-height: 38px; padding: 7px 14px; font-size: var(--fs-0); }
.btn-lg { min-height: 52px; padding: 14px 26px; font-size: var(--fs-2); }
.btn-block { width: 100%; }

.btn .spinner {
  display: none; width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(19,34,28,.25); border-top-color: var(--ink);
  animation: spin .7s linear infinite;
}
.btn.is-busy { pointer-events: none; }
.btn.is-busy .spinner { display: inline-block; }
.btn.is-busy .btn-label { opacity: .7; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Form fields */
.field { display: grid; align-content: start; gap: 6px; margin-bottom: var(--s-4); min-width: 0; }
.field > span { font-size: var(--fs-0); font-weight: 600; color: var(--ink-2); }
.field > span em { font-style: normal; font-weight: 400; color: var(--muted); margin-left: 4px; }
.field input, .field select, .admin input, .admin select {
  width: 100%; min-height: 46px; padding: 10px 12px;
  background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-control);
  transition: border-color .15s, box-shadow .15s;
}
.field select {
  appearance: none; padding-right: 36px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%2333433C' stroke-width='1.8'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center;
}
.field input:hover, .field select:hover { border-color: #B9C5BE; }
.field input:focus, .field select:focus { outline: none; border-color: var(--leaf-600); box-shadow: 0 0 0 3px rgba(29,104,82,.18); }
.field input[aria-invalid="true"], .field select[aria-invalid="true"] { border-color: var(--state-void); }
.field-error { color: var(--state-void); font-size: var(--fs-0); min-height: 0; }
.field-error:empty { display: none; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 var(--s-4); }
@media (max-width: 520px) { .field-row { grid-template-columns: 1fr; } }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: var(--fs-1); color: var(--ink-2); margin: 2px 0 var(--s-5); cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--leaf-700); flex: none; }

.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }

.form-alert { padding: 10px 14px; border-radius: var(--r-control); font-size: var(--fs-1); margin: 0 0 var(--s-4); }
.form-alert.is-error { background: #FBE9E7; color: #8E241C; }
.form-alert.is-ok { background: var(--state-free-bg); color: #0F5C37; }

/* Toasts (bottom of the page, for network problems) */
.toast-stack { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 90; display: grid; gap: 8px; width: min(92vw, 420px); }
.toast { background: var(--ink); color: #fff; padding: 12px 16px; border-radius: var(--r-control); font-size: var(--fs-1); box-shadow: var(--shadow-paper); }

/* Simple message page (download link expired, no-JS fallback) */
.message-page { min-height: 100vh; display: grid; place-items: center; padding: var(--gutter); background: var(--leaf-800); }
.message-card { background: var(--surface); border-radius: var(--r-card); padding: clamp(24px, 5vw, 48px); max-width: 560px; width: 100%; box-shadow: var(--shadow-device); }
.message-card .brand { margin-bottom: var(--s-6); }
.message-card h1 { font-size: var(--fs-4); margin-bottom: var(--s-4); }
.message-card ul { padding-left: 1.2em; margin-bottom: var(--s-4); color: var(--state-void); }
