/* WEB-79 (§ 312k): the cancellation pages. Layout only; every component
   (.tn-btn, .input, .label, .alert) comes from portal.css, every colour from
   tokens.css. Marnie's draft of 06.11. is the content reference, not a
   stylesheet to copy. */

/* Same gutter as .page-header (portal.css), so the body lines up under its
   own H1 like every other portal page. */
.cancel-contract {
  max-width: 720px;
  padding: 0 30px 40px;
  margin-top: 8px;
}

.cancel-contract__intro,
.cancel-contract__hint {
  color: var(--text-muted);
  margin: 0 0 20px 0;
  max-width: 640px;
}

.cancel-contract__form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-width: 0;
}

/* There is no global box-sizing reset (CLAUDE.md): without this the
   width:100% inputs spill past their block by their padding. */
.cancel-contract .input,
.cancel-contract textarea,
.cancel-contract select {
  box-sizing: border-box;
  max-width: 100%;
}

.cancel-contract__block {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card-surface);
  padding: 20px 22px;
  min-width: 0;
}

.cancel-contract__block h2 {
  display: flex;
  align-items: baseline;
  gap: 8px;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 14px 0;
}

.cancel-contract__step {
  color: var(--text-tertiary);
  font-weight: 500;
}

.cancel-contract__choice {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 6px 0;
  cursor: pointer;
}

.cancel-contract__field {
  margin-top: 14px;
}

.cancel-contract__field--first {
  margin-top: 0;
}

.cancel-contract__date {
  max-width: 220px;
}

.cancel-contract__note {
  color: var(--text-tertiary);
  font-size: 0.85rem;
  margin: 6px 0 0 0;
}

.cancel-contract__error {
  color: var(--danger-text);
  font-size: 0.9rem;
  margin: 6px 0 12px 0;
}

/* The script focuses the first error so a screen reader announces it and the
   page scrolls to it; it is text, not a control, so no ring around it. */
.cancel-contract__error:focus {
  outline: none;
}

.cancel-contract__submit {
  align-self: flex-start;
  box-sizing: border-box;
}

/* The honeypot: out of sight and out of the tab order, never display:none
   (some bots skip fields they can tell are hidden). */
.cancel-contract__hp {
  position: absolute;
  left: -10000px;
  width: 1px;
  height: 1px;
  overflow: hidden;
}

/* --- the tiered selection ------------------------------------------------ */

.cancel-level {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}

/* Without category pills the first pane opens the block: no rule above it. */
.cancel-own > .cancel-level:first-child {
  margin-top: 0;
  padding-top: 0;
  border-top: 0;
}

.cancel-level__q {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin: 0 0 10px 0;
}

/* Pills: a segmented choice (radio or checkbox), the category that stays a
   pill by the CSS rules. The native input stays focusable but invisible. */
.cancel-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cancel-pill {
  position: relative;
  cursor: pointer;
}

.cancel-pill input {
  position: absolute;
  opacity: 0;
  width: 1px;
  height: 1px;
}

.cancel-pill span {
  display: inline-block;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 0.9rem;
  color: var(--text-muted);
  transition: background var(--transition), color var(--transition), border-color var(--transition);
}

.cancel-pill span small {
  opacity: 0.7;
  margin-left: 4px;
}

.cancel-pill input:checked + span {
  background: linear-gradient(90deg, var(--btn-from), var(--btn-to));
  border-color: transparent;
  color: var(--btn-text);
}

.cancel-pill--check input:checked + span {
  background: transparent;
  border-color: var(--action);
  color: var(--text);
}

.cancel-pill input:focus-visible + span {
  outline: 2px solid var(--input-border-focus);
  outline-offset: 2px;
}

/* Options: one contract each, a radio with its name and details. */
.cancel-opts {
  display: grid;
  gap: 8px;
}

.cancel-opt {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  border: 1px solid var(--input-border);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  cursor: pointer;
  background: var(--input-bg);
}

.cancel-opt input {
  margin-top: 3px;
  accent-color: var(--action);
  flex: none;
}

.cancel-opt:has(input:checked) {
  border-color: var(--action);
}

.cancel-opt--other {
  margin-top: 12px;
  background: transparent;
  border-style: dashed;
}

.cancel-opt__body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.cancel-opt__title {
  font-weight: 600;
  color: var(--text);
}

.cancel-opt__detail {
  font-size: 0.85rem;
  color: var(--text-tertiary);
}

.cancel-opt__markets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cancel-tag {
  border: 1px solid var(--hairline);
  border-radius: var(--radius-sm);
  padding: 1px 8px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.cancel-general--nested {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--hairline);
}

/* --- the page after the click (S3) and the window ------------------------ */

.cancel-received__time {
  font-weight: 700;
  font-size: 1.1rem;
}

.cancel-received__record,
.cancel-received__notice {
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  background: var(--card-surface);
  padding: 20px 22px;
  margin: 20px 0;
}

.cancel-received__record h2,
.cancel-received__notice h2 {
  font-size: 1.05rem;
  margin: 0 0 12px 0;
}

.cancel-received__record dl {
  display: grid;
  grid-template-columns: minmax(140px, max-content) 1fr;
  gap: 8px 18px;
  margin: 0;
}

.cancel-received__record dt {
  color: var(--text-muted);
}

.cancel-received__record dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.cancel-received__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cancel-notice__ack {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 18px 0;
}

.cancel-notice__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

@media (max-width: 560px) {
  .cancel-contract__block {
    padding: 16px;
  }
  .cancel-received__record dl {
    grid-template-columns: 1fr;
  }
  .cancel-received__record dd {
    margin-bottom: 6px;
  }
}

/* "Als PDF sichern" = the browser's print dialog: print the record only. */
@media print {
  .sidebar, .main-header, .messages-container, .cancel-received__actions,
  .portal-footer, .page-header + .alert { display: none !important; }
  .main-content { margin: 0 !important; width: 100% !important; }
  body, .cancel-received__record, .cancel-received__notice {
    background: #fff !important;
    color: #000 !important;
  }
  .cancel-received__record dt { color: #333 !important; }
}
