/* ==========================================================================
   BILLIGERDA · Portal interno — app.css
   Editorial light, "ledger paper" aesthetic.
   Warm ivory paper, ink type, chartreuse signal + deep-olive accents.
   ========================================================================== */

:root {
  /* paper surfaces */
  --paper:      #efe9d9;   /* brand panel */
  --paper-2:    #faf7ee;   /* login panel */
  --card:       #ffffff;   /* inputs / raised */

  /* ink-on-paper type */
  --ink:        #221f17;
  --ink-soft:   #5d5747;
  --ink-mid:    #837c69;
  --ink-dim:    #a39c87;

  /* hairlines */
  --line:       rgba(34, 31, 23, .11);
  --line-2:     rgba(34, 31, 23, .20);

  /* signal — chartreuse, used as a FILL */
  --signal:     #d2e63a;
  --signal-2:   #c3d72c;
  --signal-ink: #232800;

  /* deep olive — the same hue, darkened, for TEXT & lines on paper */
  --olive:      #515c10;
  --olive-2:    #3d4609;

  --danger:     #b23a26;
  --danger-bg:  #f4e1da;

  --serif: 'Fraunces', 'Iowan Old Style', Georgia, serif;
  --sans:  'Hanken Grotesk', system-ui, -apple-system, sans-serif;

  --ease: cubic-bezier(.2, .7, .2, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: var(--sans);
  background: var(--paper-2);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--signal); color: var(--signal-ink); }

a { color: inherit; }

:focus-visible {
  outline: 2px solid var(--olive);
  outline-offset: 3px;
  border-radius: 2px;
}

/* ==========================================================================
   Layout — full-height split
   ========================================================================== */

.auth {
  display: grid;
  grid-template-columns: 1.12fr .88fr;
  min-height: 100vh;
}

/* --- left: brand / atmosphere ----------------------------------------- */

.brand {
  position: relative;
  overflow: hidden;
  padding: clamp(2rem, 4vw, 4rem);
  display: flex;
  flex-direction: column;
  background: var(--paper);
  border-right: 1px solid var(--line);
}

/* soft warm light-bloom mesh */
.brand::before {
  content: "";
  position: absolute;
  inset: -30%;
  background:
    radial-gradient(38% 38% at 22% 26%, rgba(210, 230, 58, .40), transparent 70%),
    radial-gradient(46% 46% at 84% 16%, rgba(232, 196, 120, .38), transparent 72%),
    radial-gradient(52% 52% at 72% 90%, rgba(210, 230, 58, .26), transparent 72%);
  filter: blur(12px);
  animation: drift 26s var(--ease) infinite alternate;
  z-index: 0;
}

/* paper grain */
.brand::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='200' height='200'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.6'/%3E%3C/svg%3E");
  opacity: .05;
  mix-blend-mode: multiply;
  pointer-events: none;
  z-index: 1;
}

@keyframes drift {
  0%   { transform: translate(0, 0) scale(1); }
  100% { transform: translate(4%, -3%) scale(1.12); }
}

.brand > * { position: relative; z-index: 2; }

/* faint ledger ruling behind content */
.brand__rule {
  position: absolute;
  inset: 0;
  z-index: 1;
  background-image: repeating-linear-gradient(
    to bottom, transparent 0 47px, var(--line) 47px 48px);
  -webkit-mask-image: linear-gradient(to bottom, transparent, #000 40%, #000 78%, transparent);
          mask-image: linear-gradient(to bottom, transparent, #000 40%, #000 78%, transparent);
}

/* --- brand header --- */

.mark {
  display: flex;
  align-items: center;
  gap: .7rem;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--ink);
  text-decoration: none;
}

.mark__glyph {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  background: var(--signal);
  color: var(--signal-ink);
  border-radius: 7px;
  transform: rotate(-8deg);
  font-size: 15px;
  box-shadow: 0 6px 18px -5px rgba(81, 92, 16, .5);
}

.mark small {
  font-size: 15px;
  color: var(--ink-mid);
  letter-spacing: .22em;
}

/* --- editorial statement --- */

.brand__lead {
  margin-top: auto;
  padding-top: 3rem;
}

.eyebrow {
  font-size: 15px;
  letter-spacing: .26em;
  text-transform: uppercase;
  color: var(--olive);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .8rem;
}
.eyebrow::before {
  content: "";
  width: 26px;
  height: 1px;
  background: var(--olive);
}

.headline {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: clamp(2.3rem, 4.4vw, 3.7rem);
  line-height: 1.04;
  letter-spacing: -.018em;
  margin-top: 1.4rem;
  max-width: 16ch;
  color: var(--ink);
}
.headline em {
  font-style: italic;
  font-weight: 500;
  color: var(--olive);
}

.brand__sub {
  margin-top: 1.5rem;
  max-width: 38ch;
  color: var(--ink-soft);
  font-size: 1rem;
  line-height: 1.6;
}

/* --- ledger index at the foot --- */

.ledger {
  margin-top: 2.8rem;
  border-top: 1px solid var(--line-2);
}

.ledger__row {
  display: flex;
  align-items: baseline;
  gap: 1.1rem;
  padding: .92rem .2rem;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
  color: var(--ink-soft);
  transition: color .35s var(--ease), padding-left .35s var(--ease);
}
.ledger__row:hover {
  color: var(--ink);
  padding-left: .7rem;
}
.ledger__no {
  font-family: var(--serif);
  font-size: .95rem;
  color: var(--olive);
  font-variant-numeric: tabular-nums;
  min-width: 2.2ch;
}
.ledger__row i {
  margin-left: auto;
  color: var(--ink-dim);
  font-size: 15px;
}

/* ==========================================================================
   Right — the login panel
   ========================================================================== */

.panel {
  position: relative;
  background: var(--paper-2);
  display: flex;
  flex-direction: column;
  padding: clamp(2rem, 3.4vw, 3.6rem) clamp(1.6rem, 5vw, 4.6rem);
  box-shadow: -34px 0 70px -50px rgba(34, 31, 23, .45);
}

.panel__top {
  display: flex;
  flex-wrap: nowrap;
  justify-content: space-between;
  align-items: center;
  gap: .8rem;
  font-size: 15px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--ink-mid);
}
.panel__tag {
  min-width: 0;                       /* allow it to shrink instead of wrapping */
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.panel__secure {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .7rem;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  white-space: nowrap;   /* keep "Ligação segura" on one line */
}
.panel__secure i { color: var(--olive); font-size: 15px; }

/* --- form block, vertically centred --- */

.form-wrap {
  margin: auto 0;
  width: 100%;
  max-width: 27rem;
}

.form-head h1 {
  font-family: var(--serif);
  font-optical-sizing: auto;
  font-weight: 400;
  font-size: clamp(2rem, 3.2vw, 2.6rem);
  letter-spacing: -.02em;
  line-height: 1.08;
}
.form-head p {
  margin-top: .7rem;
  color: var(--ink-soft);
  font-size: .96rem;
  line-height: 1.55;
}

/* --- alert --- */

.alert {
  margin-top: 1.6rem;
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  padding: .85rem 1rem;
  border-radius: 10px;
  font-size: 15px;
  line-height: 1.45;
  border: 1px solid rgba(178, 58, 38, .35);
  background: var(--danger-bg);
  color: #8f2f1f;
}
.alert i { margin-top: .15rem; color: var(--danger); }

/* --- brute-force lockout countdown --- */

.lockout {
  margin-top: 1.6rem;
  display: flex;
  gap: .7rem;
  align-items: flex-start;
  padding: .85rem 1rem;
  border-radius: 10px;
  font-size: .95rem;
  line-height: 1.5;
  border: 1px solid var(--line-2);
  background: var(--paper);
  color: var(--ink-soft);
}
.lockout i { margin-top: .15rem; color: var(--olive); }
.lockout strong {
  font-variant-numeric: tabular-nums;
  color: var(--olive-2);
  white-space: nowrap;
}
.lockout.is-clear { border-color: rgba(81, 92, 16, .35); }
.lockout.is-clear i { color: var(--olive-2); }

/* disabled submit while the countdown runs */
.btn:disabled,
.btn[disabled] {
  cursor: not-allowed;
  opacity: .55;
  background: var(--signal);
  box-shadow: none;
  transform: none;
}
.btn:disabled:hover { transform: none; box-shadow: none; }
.btn:disabled::before { display: none; }

/* --- fields --- */

form { margin-top: 1.7rem; }

.field { margin-bottom: 1.15rem; }

.field label {
  display: block;
  font-size: 15px;
  letter-spacing: .15em;
  text-transform: uppercase;
  color: var(--ink-soft);
  margin-bottom: .5rem;
}

.field__box {
  position: relative;
  display: flex;
  align-items: center;
}

.field__box > i {
  position: absolute;
  left: 1rem;
  font-size: 15px;
  color: var(--ink-dim);
  transition: color .25s var(--ease);
  pointer-events: none;
}

.field input {
  width: 100%;
  font-family: var(--sans);
  font-size: 1rem;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-2);
  border-radius: 11px;
  padding: .95rem 1rem .95rem 2.7rem;
  box-shadow: 0 1px 2px rgba(34, 31, 23, .04);
  transition: border-color .25s var(--ease), background .25s var(--ease),
              box-shadow .25s var(--ease);
}
.field input::placeholder { color: var(--ink-dim); }

.field input:hover { border-color: rgba(34, 31, 23, .34); }

.field input:focus {
  outline: none;
  border-color: var(--olive);
  box-shadow: 0 0 0 4px rgba(81, 92, 16, .14);
}
.field__box:focus-within > i { color: var(--olive); }

/* password reveal toggle */
.reveal {
  position: absolute;
  right: .55rem;
  width: 2.2rem;
  height: 2.2rem;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--ink-dim);
  cursor: pointer;
  font-size: 1rem;
  border-radius: 8px;
  transition: color .2s var(--ease), background .2s var(--ease);
}
.reveal:hover { color: var(--ink); background: var(--line); }

/* caps-lock hint */
.caps {
  display: none;
  margin-top: .5rem;
  font-size: 15px;
  color: var(--olive);
  font-weight: 500;
}
.caps.on { display: flex; align-items: center; gap: .4rem; }

/* --- row: remember + help --- */

.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: .3rem 0 1.6rem;
}

.check {
  display: flex;
  align-items: center;
  gap: .55rem;
  cursor: pointer;
  font-size: 15px;
  color: var(--ink-soft);
  user-select: none;
}
.check input { position: absolute; opacity: 0; pointer-events: none; }
.check__box {
  width: 18px;
  height: 18px;
  border: 1px solid var(--line-2);
  border-radius: 5px;
  background: var(--card);
  display: grid;
  place-items: center;
  transition: all .2s var(--ease);
}
.check__box::after {
  content: "\2713";
  font-size: 15px;
  color: var(--signal-ink);
  transform: scale(0);
  transition: transform .2s var(--ease);
}
.check input:checked + .check__box {
  background: var(--signal);
  border-color: var(--signal-2);
}
.check input:checked + .check__box::after { transform: scale(1); }
.check input:focus-visible + .check__box {
  outline: 2px solid var(--olive);
  outline-offset: 2px;
}

.help-link {
  font-size: 15px;
  color: var(--ink-mid);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.help-link:hover { color: var(--olive); border-color: var(--line-2); }

/* --- submit --- */

.btn {
  width: 100%;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 1rem;
  letter-spacing: .01em;
  color: var(--signal-ink);
  background: var(--signal);
  border: 0;
  border-radius: 11px;
  padding: 1rem 1.4rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .6rem;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  transition: transform .18s var(--ease), box-shadow .25s var(--ease),
              background .2s var(--ease);
  box-shadow: 0 12px 26px -12px rgba(81, 92, 16, .6);
}
.btn::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 40%, rgba(255, 255, 255, .65) 50%, transparent 60%);
  transform: translateX(-110%);
  transition: transform .55s var(--ease);
}
.btn:hover {
  background: var(--signal-2);
  transform: translateY(-2px);
  box-shadow: 0 18px 34px -12px rgba(81, 92, 16, .72);
}
.btn:hover::before { transform: translateX(110%); }
.btn:active { transform: translateY(0); }
.btn i { transition: transform .2s var(--ease); }
.btn:hover i { transform: translateX(4px); }

/* --- panel foot --- */

.panel__foot {
  margin-top: 2rem;
  padding-top: 1.4rem;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: .6rem;
  font-size: 15px;
  color: var(--ink-mid);
  line-height: 1.5;
}
.panel__foot i { color: var(--ink-soft); }

/* ==========================================================================
   Entrance choreography
   ========================================================================== */

[data-rise] {
  opacity: 0;
  transform: translateY(14px);
  animation: rise .8s var(--ease) forwards;
}
@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}
[data-rise="1"] { animation-delay: .05s; }
[data-rise="2"] { animation-delay: .14s; }
[data-rise="3"] { animation-delay: .23s; }
[data-rise="4"] { animation-delay: .32s; }
[data-rise="5"] { animation-delay: .41s; }
[data-rise="6"] { animation-delay: .50s; }
[data-rise="7"] { animation-delay: .59s; }

@media (prefers-reduced-motion: reduce) {
  [data-rise] { animation: none; opacity: 1; transform: none; }
  .brand::before { animation: none; }
  .btn::before { display: none; }
}

/* ==========================================================================
   Responsive
   ========================================================================== */

@media (max-width: 940px) {
  .auth { grid-template-columns: 1fr; }
  .brand {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    min-height: 44vh;
  }
  .brand__lead { padding-top: 2rem; }
  .ledger { display: none; }
  .panel { box-shadow: none; }
}

@media (max-width: 560px) {
  .panel__top .panel__tag { display: none; }
  .field-row { flex-wrap: wrap; gap: .8rem; }
}

/* ==========================================================================
   Language switcher · PT / EN — segmented toggle in the login panel top bar
   ========================================================================== */
.panel__top-right {
  display: inline-flex;
  align-items: center;
  gap: .6rem;
  flex: none;              /* the cluster stays on one row, never wraps below */
}
.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  background: var(--card);            /* white track — was blending into the panel */
  border: 1px solid var(--line-2);
  border-radius: 999px;
  flex: none;
}
.lang-switch__opt {
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: .06em;
  text-transform: none;
  color: var(--ink-mid);
  padding: .36rem .68rem;
  border-radius: 999px;
  text-decoration: none;
  transition: color .15s var(--ease), background-color .15s var(--ease);
}
.lang-switch__opt.is-active {
  color: var(--signal-ink);
  background: var(--signal);         /* chartreuse signal fill on the active locale */
}
/* flat colour change only on hover — no motion/shadow (UI preference) */
.lang-switch__opt:not(.is-active):hover { color: var(--olive); }
.lang-switch__opt:focus-visible { outline: 0; box-shadow: 0 0 0 3px rgba(81, 92, 16, .28); }
