.agreement-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  padding: 24px;
  display: grid;
  place-items: center;
  background: rgba(17, 19, 23, 0.52);
  backdrop-filter: blur(8px);
  animation: agreementBackdropIn 220ms ease-out both;
}

.agreement-dialog {
  width: min(620px, 100%);
  max-height: calc(100vh - 48px);
  max-height: calc(100dvh - 48px);
  overflow: auto;
  padding: 28px;
  border: 1px solid #dfe3e8;
  border-radius: 8px;
  outline: 0;
  background: #fff;
  box-shadow: 0 30px 90px rgba(11, 14, 19, 0.24);
  animation: agreementDialogIn 300ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

.agreement-header {
  display: flex;
  align-items: center;
  gap: 11px;
}

.agreement-header p {
  margin: 0;
  color: #2167d9;
  font-size: 11px;
  font-weight: 800;
  line-height: 1.4;
}

.agreement-header h2 {
  margin: 4px 0 0;
  color: #15171b;
  font-size: 21px;
  font-weight: 780;
  line-height: 1.35;
  letter-spacing: 0;
}

.agreement-description {
  margin: 15px 0 0;
  color: #6e7580;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.7;
}

.agreement-list {
  margin-top: 20px;
  display: grid;
  gap: 9px;
}

.agreement-item {
  overflow: hidden;
  border: 1px solid #e0e3e7;
  border-radius: 7px;
  background: #fff;
}

.agreement-summary {
  width: 100%;
  min-height: 45px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  color: #30343a;
  background: #f8f9fa;
  font: inherit;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
  text-align: left;
  text-rendering: inherit;
  -webkit-font-smoothing: inherit;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: color 180ms ease, background-color 180ms ease;
}

.agreement-summary-title {
  min-width: 0;
  font-family: inherit;
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: 0;
}

.agreement-summary:hover {
  color: #174fa8;
  background: #f3f6fa;
}

.agreement-summary:focus-visible {
  outline: 2px solid #2167d9;
  outline-offset: -2px;
}

.agreement-summary:focus:not(:focus-visible) {
  outline: none;
}

.agreement-summary-meta {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.agreement-summary small {
  color: #7d848d;
  font-size: 10px;
  font-weight: 650;
}

.agreement-summary svg {
  width: 14px;
  height: 14px;
  color: #8a919a;
  stroke-width: 1.9;
  transition: transform 260ms cubic-bezier(0.22, 1, 0.36, 1), color 180ms ease;
}

.agreement-item.is-open .agreement-summary {
  color: #174fa8;
  background: #f5f8fc;
}

.agreement-item.is-open .agreement-summary svg {
  color: #2167d9;
  transform: rotate(180deg);
}

.agreement-panel {
  display: grid;
  grid-template-rows: 0fr;
  opacity: 0;
  transition:
    grid-template-rows 280ms cubic-bezier(0.22, 1, 0.36, 1),
    opacity 180ms ease;
}

.agreement-item.is-open .agreement-panel {
  grid-template-rows: 1fr;
  opacity: 1;
}

.agreement-panel-inner {
  min-height: 0;
  overflow: hidden;
}

.agreement-content {
  max-height: 210px;
  overflow: auto;
  padding: 14px;
  border-top: 1px solid #e6e8eb;
  color: #59616c;
  background: #fff;
  font-size: 12px;
  line-height: 1.75;
  white-space: pre-wrap;
}

.agreement-confirm {
  margin-top: 18px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: #4f5661;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.55;
  cursor: pointer;
}

.agreement-confirm input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.agreement-checkbox {
  width: 18px;
  height: 18px;
  margin-top: 1px;
  flex: 0 0 auto;
  display: grid;
  border: 1px solid #cbd0d7;
  border-radius: 4px;
  place-items: center;
  color: transparent;
  background: #fff;
  transition: border-color 160ms ease, color 160ms ease, background-color 160ms ease;
}

.agreement-checkbox svg {
  width: 13px;
  height: 13px;
  stroke-width: 2.3;
}

.agreement-confirm input:checked + .agreement-checkbox {
  border-color: #2167d9;
  color: #fff;
  background: #2167d9;
}

.agreement-confirm input:focus-visible + .agreement-checkbox {
  outline: 2px solid #2167d9;
  outline-offset: 2px;
}

.agreement-error {
  margin: 10px 0 0;
  color: #b63345;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.5;
}

.agreement-actions {
  margin-top: 22px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.agreement-actions button {
  min-width: 128px;
  height: 42px;
  padding: 0 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border-radius: 7px;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
  cursor: pointer;
  transition:
    transform 180ms ease,
    border-color 180ms ease,
    color 180ms ease,
    background-color 180ms ease,
    box-shadow 180ms ease;
}

.agreement-actions svg {
  width: 15px;
  height: 15px;
}

.agreement-signout {
  border: 1px solid #c4384b;
  color: #fff;
  background: #c4384b;
  box-shadow: 0 8px 18px rgba(174, 40, 58, 0.16);
}

.agreement-signout:hover:not(:disabled) {
  border-color: #ac2d40;
  background: #ac2d40;
  box-shadow: 0 10px 22px rgba(174, 40, 58, 0.22);
}

.agreement-signout:hover:not(:disabled),
.agreement-accept:hover:not(:disabled) {
  transform: translateY(-1px);
}

.agreement-actions button:active:not(:disabled) {
  transform: translateY(0);
}

.agreement-signout:focus-visible {
  outline: 2px solid #c4384b;
  outline-offset: 3px;
}

.agreement-accept {
  border: 1px solid #111317;
  color: #fff;
  background: #111317;
  box-shadow: 0 8px 18px rgba(17, 19, 23, 0.13);
}

.agreement-accept:hover:not(:disabled) {
  border-color: #272a30;
  background: #272a30;
  box-shadow: 0 10px 22px rgba(17, 19, 23, 0.2);
}

.agreement-accept:focus-visible {
  outline: 2px solid #2167d9;
  outline-offset: 3px;
}

.agreement-actions button:disabled {
  opacity: 0.52;
  cursor: not-allowed;
}

@media (max-width: 680px) {
  .agreement-backdrop {
    padding: 12px;
  }

  .agreement-dialog {
    max-height: calc(100vh - 24px);
    max-height: calc(100dvh - 24px);
    padding: 22px 18px;
  }

  .agreement-header h2 {
    font-size: 19px;
  }

  .agreement-actions {
    flex-direction: column-reverse;
  }

  .agreement-actions button {
    width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .agreement-backdrop,
  .agreement-dialog,
  .agreement-summary,
  .agreement-summary svg,
  .agreement-panel,
  .agreement-actions button {
    transition: none;
    animation: none;
  }
}

@keyframes agreementBackdropIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes agreementDialogIn {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
