/* ── Reset & tokens ─────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { min-height: 100%; }

:root {
  --ink: #0f172a;
  --ink-soft: #334155;
  --muted: #64748b;
  --faint: #94a3b8;
  --border: #e2e8f0;
  --surface: #ffffff;
  --surface-soft: #f8fafc;

  --primary: #ff7a00;
  --primary-dark: #d95400;
  --primary-soft: #fff1e2;
  --accent-purple: #532085;
  --accent-yellow: #ffcd00;

  --success: #16a34a;
  --success-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --info: #1d4ed8;
  --info-soft: #dbeafe;
  --neutral-soft: #f1f5f9;

  --radius-lg: 26px;
  --radius-md: 16px;
  --radius-sm: 11px;
  --radius-pill: 999px;

  --shadow-card: 0 1px 2px rgba(15, 23, 42, 0.04), 0 24px 48px -20px rgba(217, 84, 0, 0.26);
  --shadow-soft: 0 8px 20px -8px rgba(15, 23, 42, 0.12);

  --ease: cubic-bezier(.22, 1, .36, 1);
}

body {
  font-family: "Sora", -apple-system, BlinkMacSystemFont, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(760px 420px at 12% -8%, rgba(255, 122, 0, 0.14), transparent 60%),
    radial-gradient(680px 420px at 108% 12%, rgba(83, 32, 133, 0.08), transparent 55%),
    linear-gradient(180deg, #fbf8f5 0%, #f3ece5 100%);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--primary); color: #fff; }

/* ── Shell / layout ─────────────────────────────────────────────────────── */
.app-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}

.app-header {
  display: flex;
  justify-content: center;
  padding: 22px 20px 6px;
}

.brand { display: flex; flex-direction: column; align-items: center; gap: 4px; }

.brand__logo {
  height: 62px;
  width: auto;
  display: block;
  filter: drop-shadow(0 6px 14px rgba(217, 84, 0, 0.28));
}

.brand__tag {
  font-family: "Space Mono", monospace;
  font-size: 0.66rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
  position: relative;
  padding-top: 4px;
}
.brand__tag::before {
  content: "";
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 22px;
  height: 2px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--primary), var(--accent-yellow));
}

.app-main {
  flex: 1;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 22px 16px 40px;
}

.stage {
  width: 100%;
  max-width: 440px;
  position: relative;
}


/* ── Card ────────────────────────────────────────────────────────────────── */
.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 30px 26px 28px;
  animation: card-in 0.42s var(--ease);
}

.card.hidden { display: none; }

@keyframes card-in {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.card__icon {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
}
.card__icon svg { width: 26px; height: 26px; }
.card__icon--brand {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 10px 20px -8px rgba(217, 84, 0, 0.5);
}

.card__eyebrow {
  font-family: "Space Mono", monospace;
  font-size: 0.7rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--primary);
  margin-bottom: 6px;
}

.card__title {
  font-size: 1.42rem;
  font-weight: 800;
  line-height: 1.22;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.card__subtitle {
  font-size: 0.9rem;
  line-height: 1.5;
  color: var(--muted);
  margin-bottom: 20px;
}

.card__foot {
  text-align: center;
  font-size: 0.76rem;
  color: var(--faint);
  margin-top: 20px;
}

.section-label {
  font-family: "Space Mono", monospace;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 12px;
}

/* ── Back button ────────────────────────────────────────────────────────── */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: none;
  background: none;
  padding: 0;
  margin-bottom: 18px;
  font-family: "Sora", sans-serif;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: color 0.15s;
}
.btn-back svg { width: 17px; height: 17px; }
.btn-back:hover { color: var(--primary); }

/* ── Form fields ────────────────────────────────────────────────────────── */
.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }

.field label {
  font-family: "Space Mono", monospace;
  font-size: 0.71rem;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.field__hint {
  align-self: flex-end;
  font-size: 0.72rem;
  color: var(--faint);
}

.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap__icon {
  position: absolute;
  left: 14px;
  width: 19px;
  height: 19px;
  color: var(--faint);
  pointer-events: none;
  transition: color 0.15s;
}
.input-wrap:focus-within .input-wrap__icon { color: var(--primary); }

.field-input {
  width: 100%;
  height: 50px;
  padding: 0 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: "Sora", sans-serif;
  font-size: 1rem;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  background: var(--surface-soft);
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}
.input-wrap .field-input { padding-left: 44px; }

.field-input::placeholder { color: var(--faint); }

.field-input:focus {
  outline: none;
  border-color: var(--primary);
  background: var(--surface);
  box-shadow: 0 0 0 4px var(--primary-soft);
}

textarea.field-input { height: auto; min-height: 92px; padding: 12px 16px; resize: vertical; line-height: 1.45; }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: none;
  border-radius: var(--radius-pill);
  padding: 15px 22px;
  font-family: "Sora", sans-serif;
  font-size: 0.94rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: transform 0.15s var(--ease), box-shadow 0.15s, opacity 0.15s, background 0.15s;
}
.btn--block { width: 100%; }
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; }

.btn--primary {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  box-shadow: 0 12px 24px -10px rgba(217, 84, 0, 0.55);
}
.btn--primary:hover { box-shadow: 0 14px 28px -8px rgba(217, 84, 0, 0.62); }

.btn--ghost {
  color: var(--ink-soft);
  background: var(--surface);
  border: 1.5px solid var(--border);
}
.btn--ghost:hover { border-color: var(--faint); }

.btn svg { width: 19px; height: 19px; flex-shrink: 0; }
.btn__chevron { margin-left: -2px; }

.btn__spinner { display: none; }
.btn.is-loading .btn__label,
.btn.is-loading .btn__chevron { visibility: hidden; }
.btn.is-loading .btn__spinner {
  display: block;
  position: absolute;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, 0.35);
  border-top-color: #fff;
  animation: spin 0.7s linear infinite;
}
.btn--ghost.is-loading .btn__spinner {
  border-color: rgba(255, 122, 0, 0.22);
  border-top-color: var(--primary);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Alerts / notices ───────────────────────────────────────────────────── */
.alert {
  display: none;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  line-height: 1.4;
  margin-bottom: 16px;
  border: 1px solid transparent;
}
.alert.is-visible { display: flex; animation: alert-in 0.25s var(--ease); }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: 1px; }
.alert--error   { background: var(--danger-soft);  color: #991b1b; border-color: rgba(220, 38, 38, 0.18); }
.alert--success { background: var(--success-soft); color: #14532d; border-color: rgba(22, 163, 74, 0.18); }
.alert--info    { background: var(--info-soft);    color: #1e3a8a; border-color: rgba(29, 78, 216, 0.16); }

@keyframes alert-in {
  from { opacity: 0; transform: translateY(-4px); }
  to   { opacity: 1; transform: translateY(0); }
}

.notice {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
  border: 1px dashed var(--border);
  color: var(--ink-soft);
  font-size: 0.85rem;
  line-height: 1.45;
  margin-bottom: 4px;
}
.notice svg { width: 19px; height: 19px; flex-shrink: 0; color: var(--muted); margin-top: 1px; }

/* ── Operation picker ───────────────────────────────────────────────────── */
.op-list { display: flex; flex-direction: column; gap: 10px; }
.op-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  padding: 15px 16px;
  cursor: pointer;
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}
.op-item:hover { border-color: var(--primary); box-shadow: var(--shadow-soft); transform: translateY(-1px); }
.op-item:active { transform: translateY(0) scale(0.99); }
.op-item__name { font-weight: 700; font-size: 0.95rem; color: var(--ink); }
.op-item__meta { font-size: 0.78rem; color: var(--muted); margin-top: 2px; }
.op-item__chevron { width: 18px; height: 18px; color: var(--faint); flex-shrink: 0; }

/* ── Detail header ──────────────────────────────────────────────────────── */
.det-head { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.det-head__icon {
  width: 52px;
  height: 52px;
  border-radius: 15px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.det-head__icon svg { width: 26px; height: 26px; }
.det-head__icon--ok   { background: var(--success-soft); color: var(--success); }
.det-head__icon--wait { background: var(--info-soft);    color: var(--info); }
.det-head__icon--none { background: var(--neutral-soft); color: var(--muted); }
.det-head__text { min-width: 0; }
.det-head .card__eyebrow,
.det-head .card__title,
.det-head .card__subtitle { margin-bottom: 3px; }
.det-head .card__subtitle { margin-bottom: 0; }

/* ── Badge (status pill, driven by backend colors) ─────────────────────── */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: var(--radius-pill);
  font-size: 0.73rem;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

/* ── Summary ────────────────────────────────────────────────────────────── */
.summary {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 6px 16px;
  background: var(--surface-soft);
  margin-bottom: 18px;
}
.summary__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 11px 0;
  font-size: 0.85rem;
}
.summary__row + .summary__row { border-top: 1px solid rgba(148, 163, 184, 0.22); }
.summary__row dt { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.summary__row dt svg { width: 16px; height: 16px; color: var(--faint); flex-shrink: 0; }
.summary__row dd { font-weight: 700; color: var(--ink); text-align: right; }

/* ── Reason form ────────────────────────────────────────────────────────── */
.reason-form { margin-top: 4px; animation: card-in 0.25s var(--ease); }
.reason-form__actions { display: flex; gap: 10px; }
.reason-form__actions .btn { flex: 1; }

/* ── Timeline ───────────────────────────────────────────────────────────── */
.timeline { list-style: none; position: relative; padding-left: 22px; }
.timeline::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}
.timeline-item { position: relative; padding-bottom: 18px; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
  content: "";
  position: absolute;
  left: -22px;
  top: 3px;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--dot-color, var(--primary));
  box-shadow: 0 0 0 3px var(--surface);
}
.timeline-item__head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.timeline-item__title { font-size: 0.85rem; font-weight: 700; color: var(--ink); }
.timeline-item__date { font-size: 0.73rem; color: var(--faint); margin-top: 2px; }

/* ── Buttons row inside action blocks ───────────────────────────────────── */
#blocoNova, #blocoTroca { margin-bottom: 4px; }

.hidden { display: none !important; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .app-main { padding: 14px 12px 32px; }
  .card { padding: 26px 20px 24px; border-radius: 22px; }
  .card__title { font-size: 1.28rem; }
}

@media (min-width: 481px) {
  .app-main { align-items: center; padding-top: 40px; }
}
