:root {
  --bg: #fafafa;
  --card: #ffffff;
  --text: #1a1a1a;
  --muted: #6b7280;
  --border: #e2e4e9;
  --brand: #2563eb;
  --brand-dark: #1d4ed8;

  --hints-disabled: #ADAEB1;
  --password-placeholder: #707176;

  --ok: #1F879F;
  --err: #EF5455;
  --err-ring: #EF545533;
  --background: #FDEEE9;
  --text-color: #124E5D;
  --button-color: #115C6F;
}

/* * { box-sizing: border-box; } */

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  /* font-family: 'Open Sans'; */
  margin: 16px;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: var(--background);
}

h1 {
  font-size: 25px;
  margin: 0 0 .35rem;
  font-weight: 800;
  color: var(--text-color);
}

p {
  font-size: 14px;
  margin: 0 0 .35rem;
  font-weight: 600;
  color: var(--text-color);
}

label {
  display: block;
  font-size: .85rem;
  font-weight: 600;
  margin-bottom: .4rem;
}

.main {
  width: 90vh;
  height: 100vh;
  max-width: 328px;
  display:flex;
  flex-direction: column;
}
.logo {
  margin: 16px auto ;
  padding-right: 16px;
  padding-left: 16px;
  margin-bottom: 10px;
  width: 328;
  height: 64;
  opacity: 1;
  gap: 10px;
  padding-right: 16px;
  max-height: 70px;
}

.subtitle {
  color: var(--muted);
  font-size: .9rem;
  margin: 0 0 1.5rem;
}

.field {
  margin-bottom: 1rem;
}

/* Reserve space so the form's content (rules, message) clears the fixed
   bottom button instead of hiding behind it. */
#reset-form {
  padding-bottom: 96px;
}

/* Positioning context so the icon can sit inside the input. */
.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

/* Leading lock icon, vertically centered and overlaid on the left of the input.
   Masked (not an <img>) so its color comes from background-color and can flip to
   --err on error. pointer-events:none so clicks/taps still land on the field. */
.input-icon {
  position: absolute;
  left: .85rem;
  width: 24px;
  height: 24px;
  pointer-events: none;
  background-color: var(--button-color);
  -webkit-mask: url("assets/Icon=Lock.svg") center / contain no-repeat;
          mask: url("assets/Icon=Lock.svg") center / contain no-repeat;
}

/* Floating label: starts as a placeholder sitting over the text, then lifts and
   shrinks once the field is focused or filled. Aligned with the input text
   (clears the lock icon) and click-through so taps reach the field. */
.input-wrap label {
  position: absolute;
  left: 2.6rem;
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  color: var(--password-placeholder);
  pointer-events: none;
  transition: top .15s ease, font-size .15s ease, color .15s ease;
}

/* Lifted state: field focused, or holding text (placeholder no longer shown). */
.field-input:focus ~ label,
.field-input:not(:placeholder-shown) ~ label {
  top: .5rem;
  font-size: 11px;
  color: #525258;
}

/* Hide the native placeholder text — the label fills that role visually, but
   the attribute stays so :placeholder-shown can detect the empty state. */
.field-input::placeholder {
  color: transparent;
}

/* Class-based (not input[type=password]) so styling survives the show/hide
   toggle flipping the type to "text". */
.field-input {
  width: 100%;
  /* top padding leaves room for the floating label; left/right clear the lock
     icon and the toggle button. */
  padding: 1.5rem 2.6rem .5rem;
  font-size: 1rem;

  border: 2px solid var(--border);
  border-radius: 10px;
  outline: none;
  transition: border-color .15s;
  -webkit-appearance: none;
  /* keep the padding inside the 100% width (the global reset is commented out). */
  box-sizing: border-box;
}

.field-input:focus {
  border-color: var(--button-color);
}

/* Error state: thicker red border, a soft ring around it (tracking the same
   corner radius) and both in-field icons tinted --err. Set by JS on the wrap
   when that field fails validation. */
.input-wrap.field-error .field-input {
  border: 2px solid var(--err);
  box-shadow: 0 0 0 3px var(--err-ring);
}

.input-wrap.field-error .input-icon,
.input-wrap.field-error .toggle-icon {
  background-color: var(--err);
}

/* Trailing show/hide toggle. Overrides the global `button` rule (which is
   full-width and brand-colored) so it stays a small icon button inside the field. */
.toggle-visibility {
  position: absolute;
  right: .5rem;
  width: auto;
  padding: .35rem;
  background: none;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
}

.toggle-visibility:hover:not(:disabled) {
  background: none;
}

/* Masked like the lock icon so it can be tinted; JS swaps the mask-image
   between the show/hide assets when toggled. */
.toggle-icon {
  width: 1.2rem;
  height: 1.2rem;
  display: block;
  background-color: var(--button-color);
  -webkit-mask: url("assets/Icon=Show.svg") center / contain no-repeat;
          mask: url("assets/Icon=Show.svg") center / contain no-repeat;
}

.rules {
  list-style: none;
  padding: 0;
  margin: .25rem 0 1.25rem;
  font-size: .82rem;
}

.rules li {
  display: flex;
  align-items: flex-start;
  gap: .5rem;
  /* Dormant (not reached yet by the chained check): neutral disabled color. */
  color: var(--hints-disabled);
  padding: .15rem 0;
}

/* The match rule stays hidden until a mismatch reveals it. The attribute
   selector outranks `.rules li { display: flex }`, so [hidden] actually hides. */
.rules li[hidden] {
  display: none;
}

/* Text + icon color by state: dormant until the rule is reached, then ok/err.
   The icon fills with currentColor, so the two follow the same token. */
.rules li.met {
  color: var(--ok);
}

.rules li.error {
  color: var(--err);
}

/* Inlined in the markup (not a mask) so the glyph is a transparent cut-out in a
   currentColor disc. Only one of the pair is shown per state. */
.rule-icon {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 1px;
}

.rule-icon-alert,
.rules li.error .rule-icon-ok {
  display: none;
}

.rules li.error .rule-icon-alert {
  display: block;
}

/* Symbol definitions only — never rendered in place. */
.icon-defs {
  display: none;
}

button {
  width: 328px;
  height: 52px;
  padding-right: 24px;
  padding-left: 24px;
  font-size: 16px;
  font-weight: 600;
  background-color: var(--button-color);
  color: var(--background);
  border: none;
  border-radius: 16px;
  cursor: pointer;
  transition: background .15s;
}

/* Bottom CTA pinned to the bottom of the screen (mobile style). Centered to the
   viewport so it lines up with .main. Both the submit button and the result-screen
   link share this. Only one is ever visible (the other lives in a hidden panel). */
.password-button,
.button-link {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  width: 328px;
  max-width: calc(100% - 32px);
}

.password-button {
  box-shadow: 0px 0.5px 4px 0px #00000040;
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

/* Result panels (success / expired) that replace the form. Hidden by default;
   a state class on .main reveals the matching one. Fills the column and centers
   the illustration; padding-bottom clears the fixed bottom button. */
.result-view {
  display: none;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: start;
  justify-content: start;
  text-align: start;
  padding-bottom: 96px;
}

.result-image {
  width: 240px;
  max-width: 100%;
  height: auto;
  margin-bottom: 1.5rem;
}

/* An anchor styled to match the submit button (width/position come from the
   shared bottom-CTA rule above). */
.button-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  font-size: 16px;
  font-weight: 600;
  background-color: var(--button-color);
  color: var(--background);
  border-radius: 16px;
  text-decoration: none;
  box-sizing: border-box;
}

/* In a result state, hide the form + the page's own heading/copy and show the
   matching panel. Direct children only — a result panel has its own h1/p. */
.main.state-success > #reset-form,
.main.state-success > h1,
.main.state-success > p,
.main.state-expired > #reset-form,
.main.state-expired > h1,
.main.state-expired > p {
  display: none;
}

.main.state-success #success-view,
.main.state-expired #expired-view {
  display: flex;
}

.message {
  margin-top: 1rem;
  padding: .75rem .85rem;
  border-radius: 10px;
  font-size: .88rem;
  display: none;
}

.message.show {
  display: block;
}

.message.error {
  background: #fef2f2;
  color: var(--err);
}

.message.success {
  background: #f0fdf4;
  color: var(--ok);
}
