:root {
  font-family: system-ui, sans-serif;
  color: #193244;
  background: #f0f4f7;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
}
main {
  max-width: 1000px;
  margin: 32px auto;
  padding: 24px;
}
header,
.actions {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: space-between;
}
h1 {
  font-size: 28px;
}
h2 {
  font-size: 20px;
}
form,
details,
.card,
#result {
  background: white;
  border: 1px solid #dce4ea;
  padding: 24px;
  border-radius: 12px;
  margin: 20px 0;
}
label {
  display: inline-flex;
  flex-direction: column;
  gap: 6px;
  vertical-align: top;
  margin: 8px 12px 8px 0;
  width: min(100%, 280px);
  font-size: 14px;
}
input {
  padding: 11px;
  border: 1px solid #a9bac5;
  border-radius: 5px;
  font: inherit;
}
button {
  padding: 12px 18px;
  border: 0;
  border-radius: 6px;
  background: #076a92;
  color: white;
  cursor: pointer;
  font: inherit;
}
button:disabled {
  opacity: 0.5;
  cursor: wait;
}
button:focus-visible,
input:focus-visible,
summary:focus-visible {
  outline: 3px solid #efb64c;
  outline-offset: 3px;
}
summary {
  cursor: pointer;
  font-weight: 600;
}
iframe {
  width: 100%;
  height: 750px;
  border: 1px solid #ddd;
  margin-top: 20px;
}
#login {
  max-width: 420px;
  margin: 40px auto;
}
#login label {
  width: 100%;
}
[hidden] {
  display: none !important;
}
.actions {
  justify-content: flex-start;
}
@media (max-width: 600px) {
  main {
    padding: 12px;
    margin: 12px auto;
  }
  header {
    align-items: flex-start;
  }
  form,
  details,
  .card,
  #result {
    padding: 16px;
  }
  label {
    width: 100%;
  }
  iframe {
    height: 500px;
  }
}

dialog {
  width: min(440px, calc(100% - 32px));
  max-height: calc(100dvh - 40px);
  padding: 0;
  border: 1px solid #dce4ea;
  border-radius: 20px;
  color: inherit;
  box-shadow: 0 24px 80px #102b4350;
}
dialog::backdrop { background: #102b4399; backdrop-filter: blur(4px); }
.feedback-content { border: 0; margin: 0; padding: 32px; text-align: center; }
.feedback-icon {
  display: grid; place-items: center; width: 60px; height: 60px;
  margin: 0 auto 20px; border-radius: 50%; background: #e2f4ed;
  color: #16704e; font-size: 30px; font-weight: 700;
}
dialog[data-kind="error"] .feedback-icon { background: #fff0e9; color: #ad411c; }
dialog[data-kind="confirm"] .feedback-icon { background: #e5f2fa; color: #076a92; }
.feedback-content h2 { margin: 0 0 12px; font-size: 23px; }
.feedback-content p { line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; color: #526575; }
.feedback-actions { display: flex; justify-content: center; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.feedback-actions button { min-width: 120px; border-radius: 10px; }
.button-secondary { background: #eaf0f4; color: #193244; }
@media (prefers-reduced-motion: no-preference) {
  dialog[open] { animation: feedback-enter 160ms ease-out; }
  @keyframes feedback-enter { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }
}

#inline-error { color: #9e3a10; white-space: pre-wrap; }
#inline-error:empty { display: none; }

/* Currency fields retain their labels while the keyboard is open on mobile. */
input { min-width: 0; min-height: 48px; font-size: 16px; width: 100%; }
button, summary { min-height: 44px; }
.amount-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.amount-fields label { width: 100%; margin: 0; min-width: 0; }
.money-input { display: flex; align-items: center; border: 1px solid #a9bac5; border-radius: 8px; overflow: hidden; background: white; }
.money-input > span { padding-left: 12px; color: #526575; font-size: 14px; font-weight: 600; flex-shrink: 0; }
.money-input input { border: 0; background: transparent; font-variant-numeric: tabular-nums; }
.money-input:focus-within { outline: 3px solid #efb64c; outline-offset: 3px; }
.money-input input:focus-visible { outline: none; }
.field-hint { color: #526575; font-size: 14px; line-height: 1.5; }
p { overflow-wrap: anywhere; }
@media (max-width: 600px) {
  .amount-fields { grid-template-columns: minmax(0, 1fr); }
  label { margin-right: 0; }
  header { gap: 12px; }
  h1 { font-size: 24px; }
  #logout { flex-shrink: 0; padding: 10px 12px; }
  .actions { flex-direction: column; align-items: stretch; gap: 12px; }
  #amounts > button, #config > button, #test-mail, #login > button { width: 100%; }
  #config { padding: 0; border: 0; }
  iframe { height: 65dvh; min-height: 320px; }
  .feedback-content { padding: 24px 20px; }
}
