/* Página de abertura de chamado */
:root {
  --danger: #c2410c;
  --danger-soft: #fff1e8;
}
@media (prefers-color-scheme: dark) {
  :root { --danger: #fb923c; --danger-soft: #3a1d0e; }
}

[hidden] { display: none !important; }

.ticket-page { padding: 56px 0 88px; }
.ticket-layout { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: start; }
@media (max-width: 900px) { .ticket-layout { grid-template-columns: 1fr; gap: 32px; } }

.ticket-intro { position: sticky; top: 96px; }
@media (max-width: 900px) { .ticket-intro { position: static; } }
.ticket-intro h1 { font-size: clamp(32px, 4.6vw, 48px); line-height: 1.08; letter-spacing: -0.03em; margin: 0 0 16px; }
.ticket-intro .lead { color: var(--ink-soft); font-size: 18px; margin: 0 0 28px; }
.intro-points { list-style: none; margin: 0 0 24px; padding: 0; display: grid; gap: 12px; }
.intro-points li { display: flex; gap: 12px; align-items: center; color: var(--ink-soft); font-size: 16px; }
.intro-points svg { width: 20px; height: 20px; flex: none; fill: none; stroke: var(--accent); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.intro-faq { font-size: 15px; color: var(--ink-soft); }

.ticket-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: clamp(20px, 4vw, 36px);
  box-shadow: 0 1px 2px rgb(15 28 46 / 4%), 0 12px 32px -12px rgb(15 28 46 / 12%);
}

/* Stepper */
.stepper { list-style: none; margin: 0 0 14px; padding: 0; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.stepper li { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-soft); cursor: default; }
.stepper li span {
  width: 28px; height: 28px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font: 600 13px var(--mono);
  border: 1.5px solid var(--line); background: var(--bg);
  transition: background .25s, border-color .25s, color .25s;
}
.stepper li em { font-style: normal; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stepper li.is-active { color: var(--ink); font-weight: 600; }
.stepper li.is-active span { border-color: var(--accent); color: var(--accent); }
.stepper li.is-done { cursor: pointer; }
.stepper li.is-done span { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.stepper li.is-done:hover em { text-decoration: underline; }
@media (max-width: 520px) { .stepper li:not(.is-active) em { display: none; } }

.progress { height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; margin-bottom: 28px; }
.progress-bar { height: 100%; width: 25%; background: var(--accent); border-radius: 4px; transition: width .35s ease; }

/* Etapas */
.step { border: 0; margin: 0; padding: 0; min-width: 0; }
.step legend { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 20px; padding: 0; }
.js .step { display: none; }
.js .step.is-active { display: block; animation: step-in .3s ease; }
@keyframes step-in { from { opacity: 0; transform: translateX(12px); } to { opacity: 1; transform: none; } }
.js .step.is-active.from-left { animation-name: step-in-left; }
@keyframes step-in-left { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }

/* Sem JavaScript: mostra tudo em uma página só */
html:not(.js) .stepper, html:not(.js) .progress, html:not(.js) #btn-next,
html:not(.js) #btn-back, html:not(.js) .step[data-step="4"] { display: none !important; }
html:not(.js) .step + .step { margin-top: 36px; }
html:not(.js) #btn-submit { display: inline-flex !important; }

/* Cartões de categoria */
.cat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.cat { position: relative; cursor: pointer; }
.cat input { position: absolute; opacity: 0; pointer-events: none; }
.cat-body {
  display: grid; grid-template-columns: auto 1fr; column-gap: 12px; align-items: start;
  padding: 14px; height: 100%;
  border: 1.5px solid var(--line); border-radius: 12px; background: var(--bg);
  transition: border-color .15s, background .15s, transform .15s;
}
.cat-ico { grid-row: span 2; font-size: 22px; line-height: 1.2; }
.cat-body strong { font-size: 15px; line-height: 1.3; }
.cat-body small { color: var(--ink-soft); font-size: 13px; line-height: 1.35; }
.cat:hover .cat-body { border-color: var(--ink-soft); transform: translateY(-1px); }
.cat input:focus-visible + .cat-body { outline: 2px solid var(--accent); outline-offset: 2px; }
.cat input:checked + .cat-body { border-color: var(--accent); background: var(--accent-soft); }

.hint-box {
  margin-top: 16px; padding: 12px 16px; font-size: 15px;
  background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 8px;
  animation: step-in .25s ease;
}

/* Campos */
.field { margin-bottom: 20px; }
.field label, .field .label { display: block; font-weight: 600; font-size: 15px; margin-bottom: 6px; }
.req, .opt { font-weight: 400; font-size: 12px; color: var(--ink-soft); margin-left: 6px; }
input[type="text"], input[type="email"], input[type="tel"], textarea {
  width: 100%; font: inherit; font-size: 16px; color: var(--ink);
  background: var(--bg); border: 1.5px solid var(--line); border-radius: 10px;
  padding: 11px 14px; transition: border-color .15s, box-shadow .15s;
}
textarea { resize: vertical; min-height: 140px; line-height: 1.5; }
input:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.is-invalid input, .is-invalid textarea { border-color: var(--danger); }
.field-help { font-size: 13px; color: var(--ink-soft); margin: 6px 0 0; }
.field-error { font-size: 13px; color: var(--danger); margin: 6px 0 0; }
.field-foot { display: flex; justify-content: space-between; gap: 12px; }
.counter { margin-left: auto; font: 12px var(--mono); color: var(--ink-soft); padding-top: 6px; }
.counter.is-near { color: var(--danger); }

.segmented { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.segmented label { position: relative; margin: 0; cursor: pointer; }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented span {
  display: block; text-align: center; padding: 10px 8px;
  border: 1.5px solid var(--line); border-radius: 10px; background: var(--bg);
  font-weight: 600; font-size: 15px; transition: border-color .15s, background .15s;
}
.segmented small { display: block; font-weight: 400; font-size: 12px; color: var(--ink-soft); }
.segmented input:checked + span { border-color: var(--accent); background: var(--accent-soft); }
.segmented input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

.check { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.check input { width: 18px; height: 18px; margin-top: 3px; accent-color: var(--accent); flex: none; }

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

/* Revisão */
.review { display: grid; grid-template-columns: max-content 1fr; gap: 10px 20px; margin: 0 0 16px; font-size: 15px; }
.review dt { color: var(--ink-soft); }
.review dd { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 520px) { .review { grid-template-columns: 1fr; gap: 2px; } .review dd { margin-bottom: 10px; } }

.form-alert { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 12px 14px; font-size: 15px; }

/* Barra de ações */
.actions-bar { display: flex; align-items: center; gap: 12px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.actions-bar #btn-next, .actions-bar #btn-submit { margin-left: auto; }
.draft-note { font-size: 13px; color: var(--ink-soft); }
.btn { cursor: pointer; font-family: inherit; }
.btn[disabled] { opacity: .6; cursor: progress; }
.btn-sm { padding: 6px 12px; font-size: 14px; }
.btn .spinner { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Sucesso */
.success { text-align: center; padding: 16px 0 8px; outline: none; }
.success h2 { font-size: 28px; margin: 12px 0 4px; letter-spacing: -0.02em; }
.success p { color: var(--ink-soft); margin: 4px 0; }
.success-mark svg { width: 72px; height: 72px; fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.success-mark circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .6s ease forwards; }
.success-mark path { stroke-dasharray: 36; stroke-dashoffset: 36; animation: draw .35s .5s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.protocol { display: inline-flex; align-items: center; gap: 10px; margin: 12px 0 20px; padding: 10px 10px 10px 18px; background: var(--bg); border: 1.5px dashed var(--accent); border-radius: 12px; }
.protocol code { background: none; padding: 0; font-size: 22px; font-weight: 700; letter-spacing: 0.04em; color: var(--ink); }
.success-sub { max-width: 44ch; margin: 0 auto 24px !important; font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
  .success-mark circle, .success-mark path { stroke-dashoffset: 0; }
}
