:root {
  color-scheme: light;
  /* Same HALX palette as styles.css (see the note on --volt vs --brand there). */
  --bg: #f2f2ed;
  --panel: #ffffff;
  --border: #e4e4dc;
  --text: #0e100c;
  --muted: #676a62;
  --label: #3a3d36;
  --brand: #0e100c;
  --brand-muted: #e9f8c2;
  --warn: #a15c07;
  --warn-bg: #fcf1de;
  --danger: #c8321e;
  --danger-bg: #fceae6;
  --ok: #1e7f3c;
  --ok-bg: #e5f3e8;
  --volt: #bbf028;
  --volt-hover: #aee31a;
  --on-volt: #0e100c;
  --ring: 0 0 0 3px rgba(187, 240, 40, 0.55);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0b0c0a;
    --panel: #141612;
    --border: #272b23;
    --text: #edeee8;
    --muted: #969a8f;
    --label: #c5c8bf;
    --brand: #bbf028;
    --brand-muted: rgba(187, 240, 40, 0.12);
    --warn: #f5b84a;
    --warn-bg: rgba(245, 184, 74, 0.12);
    --danger: #ff7b6b;
    --danger-bg: rgba(255, 123, 107, 0.12);
    --ok: #7ddb8a;
    --ok-bg: rgba(125, 219, 138, 0.12);
    --ring: 0 0 0 3px rgba(187, 240, 40, 0.28);
}
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b0c0a;
  --panel: #141612;
  --border: #272b23;
  --text: #edeee8;
  --muted: #969a8f;
  --label: #c5c8bf;
  --brand: #bbf028;
  --brand-muted: rgba(187, 240, 40, 0.12);
  --warn: #f5b84a;
  --warn-bg: rgba(245, 184, 74, 0.12);
  --danger: #ff7b6b;
  --danger-bg: rgba(255, 123, 107, 0.12);
  --ok: #7ddb8a;
  --ok-bg: rgba(125, 219, 138, 0.12);
  --ring: 0 0 0 3px rgba(187, 240, 40, 0.28);
}

body.auth-body {
  margin: 0;
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Inter, Roboto, "Helvetica Neue", sans-serif;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

::selection { background: var(--volt); color: var(--on-volt); }

/* Brand hero — always ink, in both themes (the HALX sign's black bracket). The oversized mark
   bleeding off the corner is a CSS mask of the logo, so it needs no image asset. */
.auth-brand-panel {
  background:
    radial-gradient(620px 420px at 88% 105%, rgba(187, 240, 40, 0.16), transparent 65%),
    #0e100c;
  color: #f2f2ed;
  padding: 48px 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  isolation: isolate;
}
.auth-brand-panel::before {
  content: "";
  position: absolute;
  z-index: -1;
  /* Fixed 560px/-150px/-170px was tuned for a panel noticeably wider than this ~1.05fr column ever
     is at a typical laptop window width (e.g. 1414×823 total) — there the panel itself is only
     ~700px wide, so the fixed-size mark bled in far enough to sit directly behind (and, with light
     text on a bright lime fill, effectively wash out) the end of .auth-brand-copy's tagline. Sizing
     and positioning the mark as a share of the PANEL's own box (not the viewport) keeps it
     corner-anchored and proportionally smaller on a narrower panel, while still capping at the
     original 560px on a wide one. Checked at 1280/1414/1440 total window widths. */
  width: min(560px, 52%);
  height: min(560px, 52%);
  right: -14%;
  bottom: -18%;
  background: #bbf028;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M9 0H31A9 9 0 0 1 40 9V58H9A9 9 0 0 1 0 49V9A9 9 0 0 1 9 0ZM55 0H77A9 9 0 0 1 86 9V49A9 9 0 0 1 77 58H46V9A9 9 0 0 1 55 0ZM9 64H40V91A9 9 0 0 1 31 100H9A9 9 0 0 1 0 91V73A9 9 0 0 1 9 64ZM46 64H91A9 9 0 0 1 100 73V91A9 9 0 0 1 91 100H55A9 9 0 0 1 46 91ZM40 58A4.4 4.4 0 0 0 46 58A4.4 4.4 0 0 0 46 64A4.4 4.4 0 0 0 40 64A4.4 4.4 0 0 0 40 58Z'/%3E%3C/svg%3E") center / contain no-repeat;
          mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cpath d='M9 0H31A9 9 0 0 1 40 9V58H9A9 9 0 0 1 0 49V9A9 9 0 0 1 9 0ZM55 0H77A9 9 0 0 1 86 9V49A9 9 0 0 1 77 58H46V9A9 9 0 0 1 55 0ZM9 64H40V91A9 9 0 0 1 31 100H9A9 9 0 0 1 0 91V73A9 9 0 0 1 9 64ZM46 64H91A9 9 0 0 1 100 73V91A9 9 0 0 1 91 100H55A9 9 0 0 1 46 91ZM40 58A4.4 4.4 0 0 0 46 58A4.4 4.4 0 0 0 46 64A4.4 4.4 0 0 0 40 64A4.4 4.4 0 0 0 40 58Z'/%3E%3C/svg%3E") center / contain no-repeat;
  opacity: 0.96;
}
/* Fine architectural grid over the hero (concrete-panel seams), fading toward the mark. */
.auth-brand-panel::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -2;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(160deg, #000 10%, transparent 75%);
          mask-image: linear-gradient(160deg, #000 10%, transparent 75%);
}
.auth-brand-mark { display: flex; align-items: center; gap: 14px; z-index: 1; color: #f2f2ed; }
.auth-logo { width: 34px; height: 34px; color: #bbf028; display: inline-flex; }
.auth-logo svg { display: block; width: 100%; height: 100%; }
.auth-brand-mark .brand-word { display: block; width: 92px; height: 15px; }
.auth-brand-mark span[data-i18n] {
  font-size: 11px; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase;
  color: #8c9086; padding-left: 14px; border-left: 1px solid rgba(255, 255, 255, 0.14);
}
.auth-brand-copy { z-index: 1; max-width: 440px; margin-bottom: 120px; }
.auth-brand-copy h1 { font-size: 42px; line-height: 1.08; letter-spacing: -0.035em; font-weight: 700; margin: 0 0 18px; }
.auth-brand-copy p { font-size: 15.5px; line-height: 1.6; color: rgba(242, 242, 237, 0.68); margin: 0; }
.auth-brand-foot {
  z-index: 1; align-self: flex-start; display: inline-flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.02em; color: #f2f2ed;
  padding: 7px 12px; border-radius: 999px; background: rgba(14, 16, 12, 0.72);
  border: 1px solid rgba(255, 255, 255, 0.1); -webkit-backdrop-filter: blur(8px); backdrop-filter: blur(8px);
}
.auth-brand-foot::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #bbf028; box-shadow: 0 0 0 3px rgba(187, 240, 40, 0.2); }

.auth-form-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--bg);
}

.auth-card {
  width: 100%;
  max-width: 400px;
}
.auth-card h2 { font-size: 30px; font-weight: 700; letter-spacing: -0.03em; margin: 0 0 8px; color: var(--text); }
.auth-card .auth-subtitle { color: var(--muted); font-size: 15px; margin: 0 0 32px; }

.auth-notice {
  background: var(--warn-bg);
  color: var(--warn);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 20px;
}
.auth-error {
  background: var(--danger-bg);
  color: var(--danger);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 13px;
  margin-bottom: 20px;
  display: none;
}
.auth-error.visible { display: block; }

.auth-field { margin-bottom: 16px; }
.auth-field label { display: block; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); margin-bottom: 7px; }
/* FSKLZM-119: helper text under a sign-up field. */
.auth-field-hint { display: block; margin-top: 6px; font-size: 12px; line-height: 1.4; color: var(--muted); }
.auth-field input {
  /* border-box, not the CSS default (content-box) — otherwise the 14px+14px padding and the
     border get added ON TOP of the 100% width instead of being carved out of it, so the input
     renders wider than its own container. Harmless for a single full-width field (it just
     overflows the card's own edge by a few px, easy to miss), but in `.auth-row`'s two-field
     layout that overflow ate the entire gap between them and then some — the two boxes visually
     overlapped by ~17px, which is the actual "glued together" bug, separate from (and on top of)
     the earlier flex min-width fix. */
  box-sizing: border-box;
  width: 100%;
  padding: 13px 15px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 15px;
  font-family: inherit;
  background: var(--panel);
  color: var(--text);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.auth-field input:focus { outline: none; border-color: var(--brand); box-shadow: var(--ring); }
/* Per-field validation (validateField() in auth.js) — a red border on the one field that's
   actually wrong, plus a short reason right under it, instead of one generic banner at the top of
   the form that leaves the cashier hunting for which field it means. */
.auth-field input.input-error { border-color: var(--danger); }
.auth-field input.input-error:focus { border-color: var(--danger); box-shadow: 0 0 0 3px var(--danger-bg); }
.auth-field-error { color: var(--danger); font-size: 12px; margin-top: 5px; display: none; }
.auth-field-error.visible { display: block; }
.auth-row { display: flex; gap: 12px; }
/* min-width: 0 overrides the flex default (min-width: auto), which otherwise sizes a flex item to
   its content's natural width — a long typed value (e.g. an email address) would refuse to shrink
   to its ~50% share of the row and visually overflow into the field next to it. */
.auth-row .auth-field { flex: 1; min-width: 0; }

.auth-submit {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: var(--volt);
  color: var(--on-volt);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 8px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.5) inset, 0 -1px 0 rgba(14, 16, 12, 0.12) inset, 0 6px 18px -6px rgba(120, 160, 10, 0.5);
  transition: background 0.12s ease, transform 0.08s ease;
}
.auth-submit:hover:not(:disabled) { background: var(--volt-hover); }
.auth-submit:active:not(:disabled) { transform: translateY(1px); }
.auth-submit:disabled { background: var(--brand-muted); color: var(--muted); box-shadow: none; cursor: not-allowed; }

.auth-switch { margin-top: 24px; font-size: 14px; color: var(--muted); text-align: center; }
.auth-switch a {
  color: var(--text); font-weight: 700; text-decoration: underline;
  text-decoration-color: var(--volt); text-decoration-thickness: 2px; text-underline-offset: 4px;
}
.auth-switch a:hover { text-decoration-color: currentColor; }

/* FSKLZM-174: the "Kyçu si Inspektor ATK" entry under the form — an outlined secondary button so it
   reads as a separate door, not a second submit; and its plain-text "back" link. */
.auth-secondary {
  width: 100%;
  padding: 12px;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}
.auth-secondary:hover { border-color: var(--brand); }
.auth-secondary:focus-visible, .auth-link-button:focus-visible { outline: none; box-shadow: var(--ring); }
.auth-link-button {
  display: block;
  margin: 16px auto 0;
  border: none;
  background: none;
  color: var(--muted);
  font-family: inherit;
  font-size: 14px;
  cursor: pointer;
}
.auth-link-button:hover { color: var(--text); }
.auth-link-button[hidden] { display: none; }

.auth-corner-actions {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 5;
  display: flex;
  gap: 8px;
}

.auth-theme-toggle {
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 8px 14px;
  font-size: 13px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: border-color 0.12s ease;
}
.auth-theme-toggle:hover { border-color: var(--brand); }

.lang-dropdown { position: relative; }
.lang-dropdown-caret { font-size: 10px; opacity: 0.7; }
.lang-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 20;
  min-width: 140px;
  margin: 0;
  padding: 4px;
  list-style: none;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 9px;
  box-shadow: 0 14px 36px -14px rgba(14, 16, 12, 0.3), 0 2px 6px rgba(14, 16, 12, 0.06);
}
.lang-dropdown-menu li { margin: 0; }
.lang-dropdown-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.lang-dropdown-menu button:hover { background: var(--brand-muted); }
.lang-dropdown-menu button.active { font-weight: 700; }
.lang-dropdown-menu button.active::after { content: "✓"; margin-left: auto; }

/* Narrow screens: the hero collapses to a short ink header band (logo only) above the form,
   instead of disappearing — the brand still greets the user on a phone. */
@media (max-width: 860px) {
  body.auth-body { grid-template-columns: 1fr; grid-template-rows: auto auto 1fr; }
  .auth-brand-panel { padding: 22px 20px; min-height: 0; }
  .auth-brand-panel::before { width: 180px; height: 180px; right: -40px; bottom: -80px; }
  .auth-brand-copy, .auth-brand-foot { display: none; }
  /* The fixed corner controls would sit on top of the logo band here — drop them into the flow
     as their own row between the band and the form instead (grid `order`). */
  .auth-brand-panel { order: 1; }
  .auth-corner-actions { order: 2; position: static; justify-content: flex-end; padding: 12px 16px 0; background: var(--bg); }
  .auth-form-panel { order: 3; }
  .auth-form-panel { align-items: flex-start; padding: 20px 16px 40px; }
  .auth-card h2 { font-size: 26px; }
}
@media (max-width: 520px) {
  .auth-brand-mark span[data-i18n] { display: none; }
}

/* FSKLZM-140: "Kyçu si punonjës" toggle on login.html — reveals the username field for a staff
   login; the owner's own NUI + password flow looks and behaves exactly as before when left unchecked. */
.auth-staff-toggle { margin: -8px 0 18px; }
.auth-staff-toggle label { display: flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); cursor: pointer; }
.auth-staff-toggle input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--brand); cursor: pointer; }
