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

:root {
  --bg:        #eef2f7;
  --card:      #ffffff;
  --primary:   #4f6cf7;
  --primary-h: #3a55e0;
  --success:   #10b981;
  --danger:    #ef4444;
  --text:      #1e293b;
  --muted:     #64748b;
  --border:    #e2e8f0;
  --radius:    12px;
  --shadow:    0 4px 24px rgba(0,0,0,.10);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 48px;
}

[x-cloak] { display: none !important; }

/* Скрываем контент до инициализации Alpine */
.card { opacity: 0; animation: fadeIn .2s .05s forwards; }
@keyframes fadeIn { to { opacity: 1; } }

/* ── Card ─────────────────────────────────────────────── */
.card {
  width: 100%;
  max-width: 520px;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

/* ── Header ───────────────────────────────────────────── */
.header {
  background: linear-gradient(135deg, #4f6cf7, #7c3aed);
  color: #fff;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.header__title {
  font-size: 1.05rem;
  font-weight: 600;
  letter-spacing: .01em;
}

.date-chip {
  background: rgba(255,255,255,.2);
  border: none;
  color: #fff;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: .85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .15s;
  white-space: nowrap;
}
.date-chip:hover { background: rgba(255,255,255,.3); }

/* ── Progress bar ─────────────────────────────────────── */
.progress-bar {
  display: flex;
  padding: 12px 20px 0;
  gap: 5px;
}
.progress-bar__dot {
  flex: 1;
  height: 4px;
  border-radius: 2px;
  background: var(--border);
  transition: background .3s;
}
.progress-bar__dot.done  { background: var(--success); }
.progress-bar__dot.active { background: var(--primary); }

/* ── Summary ──────────────────────────────────────────── */
.summary {
  padding: 14px 20px 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: .85rem;
}
.summary-row__label { color: var(--muted); }
.summary-row__value { font-weight: 500; text-align: right; max-width: 65%; word-break: break-word; }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 14px 0 0;
}

/* ── Step content ─────────────────────────────────────── */
.step {
  padding: 20px 20px 0;
}

.question {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 14px;
  line-height: 1.4;
}

/* Amount input */
.amount-row {
  display: flex;
  gap: 8px;
}
.input-amount {
  flex: 1;
  font-size: 1.4rem;
  font-weight: 500;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  transition: border-color .15s;
}
.input-amount:focus { border-color: var(--primary); }

/* Comment input */
.input-text {
  width: 100%;
  font-size: 1rem;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  outline: none;
  margin-bottom: 10px;
  transition: border-color .15s;
}
.input-text:focus { border-color: var(--primary); }

/* Options grid */
.options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.btn-option {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  font-size: .88rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: border-color .15s, background .15s, transform .1s;
  line-height: 1.3;
  word-break: break-word;
}
.btn-option:hover  { border-color: var(--primary); background: #f0f4ff; }
.btn-option:active { transform: scale(.97); }

/* ── Buttons ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: var(--radius);
  font-size: .92rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: background .15s, transform .1s, opacity .15s;
}
.btn:active  { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn--primary   { background: var(--primary); color: #fff; }
.btn--primary:hover:not(:disabled) { background: var(--primary-h); }

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

.btn--secondary { background: var(--bg); color: var(--text); border: 2px solid var(--border); }
.btn--secondary:hover { border-color: var(--primary); }

.btn--ghost     { background: transparent; color: var(--muted); padding: 8px 12px; }
.btn--ghost:hover { color: var(--text); }

.btn--full { width: 100%; }

/* ── Navigation bar ───────────────────────────────────── */
.nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px 20px;
}

/* ── Comment row ──────────────────────────────────────── */
.comment-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── Done / error states ──────────────────────────────── */
.done-block {
  padding: 32px 20px;
  text-align: center;
}
.done-icon   { font-size: 3rem; margin-bottom: 12px; }
.done-title  { font-size: 1.2rem; font-weight: 600; margin-bottom: 6px; }
.done-sub    { color: var(--muted); font-size: .9rem; margin-bottom: 20px; }

.error-msg {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: .88rem;
  margin-top: 8px;
}

.spinner {
  display: inline-block;
  width: 20px; height: 20px;
  border: 3px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Date picker overlay ──────────────────────────────── */
.overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
}
.picker-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 24px;
  width: 300px;
  box-shadow: var(--shadow);
}
.picker-card h3 { margin-bottom: 14px; font-size: 1rem; }
.input-date {
  width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 1rem;
  margin-bottom: 14px;
  outline: none;
}
.input-date:focus { border-color: var(--primary); }
.picker-actions { display: flex; gap: 8px; justify-content: flex-end; }

/* ── Header right group ───────────────────────────────── */
.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* ── User chip (logout) ───────────────────────────────── */
.user-chip {
  background: rgba(255,255,255,.15);
  border: none;
  color: #fff;
  border-radius: 20px;
  padding: 5px 12px;
  font-size: .82rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 5px;
  transition: background .15s;
  white-space: nowrap;
  max-width: 130px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-chip:hover { background: rgba(255,255,255,.28); }

/* ── Auth form ────────────────────────────────────────── */
.auth-form {
  padding: 28px 24px 24px;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.auth-title {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: var(--text);
}

.auth-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-bottom: 14px;
}

.auth-label {
  font-size: .82rem;
  font-weight: 500;
  color: var(--muted);
}

/* ── Password show/hide ───────────────────────────────── */
.pwd-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.pwd-wrap .input-text {
  width: 100%;
  padding-right: 42px;
  margin-bottom: 0;
}
.pwd-toggle {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  padding: 2px 4px;
  color: var(--muted);
  transition: color .15s;
  user-select: none;
}
.pwd-toggle:hover { color: var(--text); }

.auth-switch {
  margin-top: 18px;
  text-align: center;
  font-size: .85rem;
  color: var(--muted);
}

.auth-link {
  background: none;
  border: none;
  color: var(--primary);
  font-size: .85rem;
  font-weight: 500;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.auth-link:hover { color: var(--primary-h); }

/* ── Admin button ─────────────────────────────────────── */
.admin-row {
  padding: 0 20px 16px;
  display: flex;
  justify-content: flex-end;
}
.btn--admin {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: .78rem;
  cursor: pointer;
  padding: 4px 6px;
}
.btn--admin:hover { color: var(--text); }
