/* NGT DB CRM — neumorphic sign-in page. */
body {
  min-height: 100vh; min-height: 100dvh;
  display: grid; place-items: center; align-content: center; gap: 22px;
  padding: clamp(16px, 3.5vw, 40px);
  overflow-x: hidden;
}
/* Ambient light pool + vignette: the pool sits where the light is. */
body::before {
  content: ""; position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background:
    radial-gradient(circle 70vmax at calc(50% - var(--sx) * 36%) calc(50% - var(--sy) * 36%), var(--glow), transparent 62%),
    radial-gradient(140% 120% at 50% 42%, transparent 52%, var(--vignette));
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 100; pointer-events: none; opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix type='saturate' values='0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
.label, .switch-label, .dial-cap, .caps, .page-foot {
  text-shadow: calc(var(--sx) * 1px) calc(var(--sy) * 1px) 0 var(--engrave);
}

/* Shell */
.shell {
  --d: 18px;
  position: relative; z-index: 1;
  width: min(1020px, 100%);
  display: grid;
  grid-template-columns: minmax(0, .92fr) minmax(0, 1.08fr);
  grid-template-rows: auto 1fr;
  grid-template-areas: "brand auth" "inst auth";
  border-radius: 40px;
  background: var(--bg);
  box-shadow: var(--raise);
  animation: extrude 1.3s var(--ease) both;
}
@keyframes extrude { from { --depth: 0; transform: translateY(6px); } to { --depth: 1; transform: none; } }

.brandbar { grid-area: brand; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 36px 44px 0; }
.brand { display: inline-flex; align-items: center; gap: 14px; min-width: 0; }
.logo { --d: 4px; flex: none; width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; background: var(--bg); box-shadow: var(--raise); }
.logo-core { --d: 2.5px; width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; box-shadow: var(--press); }
.logo-core::after { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px 1px var(--accent-glow); }
.wordmark { font: 500 22px/1 var(--f-display); letter-spacing: -.02em; white-space: nowrap; }
.wordmark em { font-style: italic; color: var(--accent-ink); }

/* Switch (theme / follow cursor) */
.switch { display: inline-flex; align-items: center; gap: 12px; margin: -4px; padding: 4px; border: 0; border-radius: 999px; background: none; color: var(--muted); font: inherit; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.switch-track { --d: 3px; position: relative; flex: none; width: 56px; height: 30px; border-radius: 999px; background: var(--bg); box-shadow: var(--press); }
.switch-track::before { content: ""; position: absolute; left: 12px; top: 50%; width: 6px; height: 6px; margin-top: -3px; border-radius: 50%; background: var(--faint); opacity: .4; transition: background-color .3s, box-shadow .3s, opacity .3s; }
.switch-thumb { --d: 3px; position: absolute; top: 4px; left: 4px; width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--bg); color: var(--muted); box-shadow: var(--raise); transition: transform .5s var(--spring), color .3s, box-shadow var(--shadow-t) var(--ease); }
.switch-thumb .ic { width: 12px; height: 12px; stroke-width: 2; }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(26px); color: var(--accent-ink); }
.switch[aria-checked="true"] .switch-track::before { background: var(--accent); opacity: 1; box-shadow: 0 0 8px 1px var(--accent-glow); }
.switch-theme .i-moon, .switch-theme[aria-checked="true"] .i-sun { display: none; }
.switch-theme[aria-checked="true"] .i-moon { display: block; }
.switch-label { font: 500 10.5px/1.2 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }

/* Light dial */
.instrument { grid-area: inst; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 26px 44px 42px; text-align: center; }
.dial { --dial: 236px; position: relative; flex: none; width: var(--dial); height: var(--dial); border-radius: 50%; cursor: grab; touch-action: none; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; }
.dial.is-dragging { cursor: grabbing; }
.dial:focus-visible { outline-offset: 6px; }
.dial-ticks { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; filter: drop-shadow(calc(var(--sx) * 1px) calc(var(--sy) * 1px) 0 var(--engrave)); }
.dial-ticks line { stroke: var(--faint); stroke-width: 1.5; stroke-linecap: round; }
.dial-ticks line.major { stroke: var(--muted); stroke-width: 2.2; }
.dial-groove { --d: 6px; position: absolute; inset: 9%; border-radius: 50%; background: var(--bg); box-shadow: var(--press); }
.dial-trail { position: absolute; inset: 0; border-radius: 50%; background: conic-gradient(from calc((var(--beta) - 60) * 1deg), transparent, var(--accent-glow) 60deg, transparent 120deg); -webkit-mask: radial-gradient(closest-side, transparent 69%, #000 72%, #000 96%, transparent 99%); mask: radial-gradient(closest-side, transparent 69%, #000 72%, #000 96%, transparent 99%); }
.dial-knob { --d: 9px; position: absolute; inset: 21%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; border-radius: 50%; background-color: var(--bg); background-image: radial-gradient(circle at calc(50% - var(--sx) * 24%) calc(50% - var(--sy) * 24%), var(--spec), transparent 65%); box-shadow: var(--raise); pointer-events: none; }
.dial-cap, .dial-dir { font: 500 max(9px, calc(var(--dial) * .038))/1 var(--f-mono); letter-spacing: .2em; text-transform: uppercase; padding-left: .2em; }
.dial-cap { color: var(--muted); }
.dial-dir { color: var(--accent-ink); }
.dial-deg { font: 500 calc(var(--dial) * .118)/1 var(--f-mono); letter-spacing: -.04em; font-variant-numeric: tabular-nums; color: var(--text); }
.dial-arm { position: absolute; inset: 0; transform: rotate(calc(var(--beta) * 1deg)); pointer-events: none; }
.dial-sun { position: absolute; left: 50%; top: 15%; width: 6.4%; height: 6.4%; border-radius: 50%; transform: translate(-50%, -50%); background: radial-gradient(circle at 38% 35%, #fff7e8 0 18%, var(--accent) 62%); box-shadow: 0 0 10px 2px var(--accent-glow), 0 0 28px 8px var(--accent-glow); }
.dial-notch { position: absolute; left: 50%; top: 24.5%; width: 1.3%; height: 4.6%; border-radius: 999px; transform: translateX(-50%); background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.caption { display: grid; justify-items: center; gap: 12px; max-width: 34ch; }
.caption-title { margin: 0; font: 450 24px/1.15 var(--f-display); letter-spacing: -.02em; }
.caption-title em { font-style: italic; color: var(--accent-ink); }
.caption-text { margin: 0; font-size: 14px; color: var(--muted); }
.caption .switch { margin-top: 6px; }

/* Auth panel */
.auth { grid-area: auth; position: relative; min-width: 0; padding: 56px 56px 48px; display: flex; flex-direction: column; justify-content: center; }
.auth::before { content: ""; position: absolute; left: 0; top: 44px; bottom: 44px; width: 1px; background: var(--line); box-shadow: calc(var(--sx) * 1px) 0 0 var(--engrave); }
.stage { --bleed: 24px; margin: calc(var(--bleed) * -1); padding: var(--bleed); }
.stage.is-morphing { overflow: hidden; }
.stack { display: flex; flex-direction: column; gap: 20px; }
.view:not([hidden]) .stack > * { animation: rise .6s var(--ease) both; animation-delay: calc(var(--i, 0) * 50ms); }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } }
.view-head { display: grid; gap: 8px; margin-bottom: 4px; }
.view-head.center { justify-items: center; text-align: center; }
.title { margin: 0; font: 450 clamp(30px, 3.4vw, 40px)/1.06 var(--f-display); letter-spacing: -.028em; }
.title em { font-style: italic; color: var(--accent-ink); padding-right: .04em; }
.sub { margin: 0; font-size: 15px; color: var(--muted); }
.sub strong { color: var(--text); font-weight: 600; overflow-wrap: anywhere; }

/* Fields */
.field { display: flex; flex-direction: column; min-width: 0; }
.label { display: inline-flex; align-items: center; gap: 9px; margin-bottom: 10px; font: 500 10.5px/1.2 var(--f-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.label::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--faint); opacity: .5; transition: background-color .3s, box-shadow .3s, opacity .3s; }
.field:focus-within .label::before { background: var(--accent); opacity: 1; box-shadow: 0 0 6px 1px var(--accent-glow); }
.field.is-valid .label::before { background: var(--success); opacity: 1; box-shadow: none; }
.field.is-invalid .label::before { background: var(--danger); opacity: 1; box-shadow: none; }
.control { --d: 4.5px; position: relative; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 8px 0 18px; border-radius: 17px; background: var(--bg); box-shadow: var(--press); outline: 2px solid transparent; outline-offset: 3px; transition: box-shadow var(--shadow-t) var(--ease), outline-color .2s; }
.control:focus-within { --d: 5.5px; outline-color: var(--ring); }
.field.is-invalid .control { outline-color: var(--danger); }
.control > .ic { color: var(--faint); transition: color .25s; }
.control:focus-within > .ic:first-child { color: var(--accent-ink); }
.control input { flex: 1; min-width: 0; height: 100%; margin: 0; padding: 0; border: 0; background: transparent; color: var(--text); font: 500 16px/1.2 var(--f-ui); caret-color: var(--accent-ink); outline: none; }
.control input::placeholder { color: var(--faint); opacity: 1; font-weight: 400; }
.control input[type="password"]:not(:placeholder-shown) { letter-spacing: .12em; }
.control input:focus-visible { outline: none; }
.control input:-webkit-autofill, .control input:-webkit-autofill:hover, .control input:-webkit-autofill:focus { -webkit-text-fill-color: var(--text); caret-color: var(--accent-ink); transition: background-color 600000s 0s, color 600000s 0s; }
.control input:autofill { filter: none; }
.control > .ic-ok { width: 18px; height: 18px; margin-right: 10px; color: var(--success); opacity: 0; transform: scale(.5); transition: opacity .25s, transform .35s var(--spring); }
.field.is-valid .control > .ic-ok { opacity: 1; transform: none; }
.peek { --d: 2.5px; flex: none; width: 40px; height: 40px; display: grid; place-items: center; border: 0; border-radius: 13px; background: var(--bg); color: var(--muted); box-shadow: var(--raise); cursor: pointer; transition: box-shadow var(--shadow-t) var(--ease), color .2s; -webkit-tap-highlight-color: transparent; }
.peek:hover { color: var(--text); }
.peek[aria-pressed="true"] { box-shadow: var(--press); color: var(--accent-ink); }
.peek .ic { width: 18px; height: 18px; }
.peek .i-eye-off, .peek[aria-pressed="true"] .i-eye { display: none; }
.peek[aria-pressed="true"] .i-eye-off { display: block; }
.msg-wrap { display: grid; grid-template-rows: 0fr; transition: grid-template-rows .3s var(--ease); }
.field.is-invalid .msg-wrap { grid-template-rows: 1fr; }
.msg-in { min-height: 0; overflow: hidden; }
.msg { margin: 0; padding-top: 9px; font-size: 13px; font-weight: 500; color: var(--danger); }
.caps { display: flex; align-items: center; gap: 7px; margin: 10px 0 0; font: 500 10.5px/1.2 var(--f-mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent-ink); }
.caps .ic { width: 14px; height: 14px; }

.row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; }
.check { display: inline-flex; align-items: flex-start; gap: 12px; font-size: 14px; line-height: 1.45; color: var(--muted); cursor: pointer; }
.check input { --d: 3px; flex: none; width: 22px; height: 22px; margin: 0; display: grid; place-items: center; border-radius: 7px; background: var(--bg); box-shadow: var(--press); cursor: pointer; -webkit-appearance: none; appearance: none; transition: box-shadow var(--shadow-t) var(--ease); }
.check input::before { content: ""; width: 12px; height: 12px; background: var(--accent-ink); clip-path: polygon(4% 62%, 38% 96%, 98% 28%, 84% 14%, 38% 68%, 18% 48%); transform: scale(0); transition: transform .35s var(--spring); }
.check input:checked::before { transform: scale(1); }
.link { padding: 0; border: 0; border-radius: 4px; background: none; color: var(--accent-ink); font: inherit; font-size: 14px; font-weight: 600; text-decoration: none; cursor: pointer; }
.link:hover { text-decoration: underline; text-decoration-thickness: 1.5px; text-underline-offset: 3px; }

/* Button */
.btn { --d: 6px; position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 10px; height: 56px; padding: 0 24px; border: 0; border-radius: 17px; background: var(--bg); color: var(--text); font: 600 15px/1 var(--f-ui); letter-spacing: .01em; box-shadow: var(--raise); cursor: pointer; user-select: none; -webkit-user-select: none; -webkit-tap-highlight-color: transparent; transition: box-shadow var(--shadow-t) var(--ease), transform .2s var(--ease), color .2s, background-color .3s; }
.btn:hover { --d: 7px; }
.btn:active, .btn.is-busy { --d: 5px; box-shadow: var(--press); transform: scale(.992); }
.btn .ic { width: 19px; height: 19px; transition: transform .3s var(--ease), opacity .2s; }
.btn-label { transition: opacity .2s; }
.btn-primary { width: 100%; margin-top: 4px; --rim-hi: var(--accent-rim-hi); --rim-lo: var(--accent-rim-lo); background: var(--accent); color: var(--on-accent); box-shadow: var(--raise), calc(var(--sx) * 6px) calc(var(--sy) * 10px) 28px -12px var(--accent-glow); }
.btn-primary:hover .btn-ic { transform: translateX(4px); }
.btn-primary:active, .btn-primary.is-busy { --sh: var(--accent-press-sh); --hl: var(--accent-press-hl); box-shadow: var(--press), 0 0 0 0 transparent; }
.spinner { position: absolute; inset: 0; width: 22px; height: 22px; margin: auto; border: 2.5px solid currentColor; border-right-color: transparent; border-radius: 50%; opacity: 0; pointer-events: none; transition: opacity .2s; }
.btn.is-busy { cursor: progress; }
.btn.is-busy .spinner { opacity: 1; animation: spin .75s linear infinite; }
.btn.is-busy .btn-label, .btn.is-busy .ic { opacity: 0; }
@keyframes spin { to { transform: rotate(360deg); } }

.alert { --d: 3px; display: flex; align-items: flex-start; gap: 10px; padding: 13px 16px; border-radius: 15px; background: var(--bg); box-shadow: var(--press); color: var(--danger); font-size: 14px; font-weight: 500; line-height: 1.45; }
.alert .ic { width: 18px; height: 18px; margin-top: 1px; }

/* Success */
.seal { --d: 8px; width: 104px; height: 104px; margin: 6px auto 4px; display: grid; place-items: center; border-radius: 50%; background: var(--bg); box-shadow: var(--raise); }
.seal-core { --d: 4px; width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; box-shadow: var(--press); color: var(--accent-ink); }
.seal-core .ic { width: 30px; height: 30px; stroke-width: 2.4; stroke-dasharray: 22; stroke-dashoffset: 22; filter: drop-shadow(0 0 6px var(--accent-glow)); }
.view:not([hidden]) .seal-core .ic { animation: draw .55s .15s var(--ease) forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }
.progress { --d: 2.5px; height: 14px; padding: 4px; border-radius: 999px; background: var(--bg); box-shadow: var(--press); }
.progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--accent); box-shadow: 0 0 10px var(--accent-glow); }
.view:not([hidden]) .progress i { animation: fill .85s .1s var(--ease) forwards; }
@keyframes fill { to { width: 100%; } }

.page-foot { position: relative; z-index: 1; margin: 0; text-align: center; font: 400 10.5px/1.8 var(--f-mono); letter-spacing: .04em; color: var(--muted); }

.toast { --d: 6px; position: fixed; left: 50%; bottom: 24px; z-index: 50; display: flex; align-items: center; gap: 12px; width: max-content; max-width: calc(100vw - 32px); padding: 14px 20px 14px 16px; border-radius: 18px; background: var(--bg); color: var(--text); font-size: 14px; font-weight: 500; box-shadow: var(--raise); opacity: 0; transform: translate(-50%, calc(100% + 40px)); transition: transform .55s var(--spring), opacity .3s, box-shadow var(--shadow-t) var(--ease); pointer-events: none; }
.toast.is-on { opacity: 1; transform: translate(-50%, 0); }
.toast .led { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px 1px var(--accent-glow); }

/* Responsive */
@media (min-width: 960px) and (max-height: 760px) {
  .dial { --dial: 196px; }
  .brandbar { padding-top: 30px; }
  .instrument { gap: 20px; padding-bottom: 30px; }
  .auth { padding-top: 34px; padding-bottom: 30px; }
  .stack { gap: 16px; }
  .control, .btn { height: 52px; }
}
@media (max-width: 959.98px) {
  .shell { width: min(560px, 100%); grid-template-columns: minmax(0, 1fr); grid-template-rows: auto; grid-template-areas: "brand" "auth" "inst"; border-radius: 34px; }
  .brandbar { padding: 28px 32px 0; }
  .auth { padding: 30px 32px 34px; }
  .auth::before { display: none; }
  .instrument { position: relative; flex-direction: row; gap: 26px; padding: 30px 32px 34px; text-align: left; }
  .instrument::before { content: ""; position: absolute; top: 0; left: 32px; right: 32px; height: 1px; background: var(--line); box-shadow: 0 calc(var(--sy) * 1px) 0 var(--engrave); }
  .dial { --dial: 168px; }
  .caption { justify-items: start; }
  .caption-title { font-size: 22px; }
}
@media (max-width: 519.98px) {
  .shell { --d: 12px; border-radius: 30px; }
  .brandbar { padding: 22px 22px 0; }
  .auth { padding: 24px 22px 28px; }
  .stage { --bleed: 18px; }
  .instrument { flex-direction: column; padding: 28px 22px 30px; text-align: center; }
  .instrument::before { left: 22px; right: 22px; }
  .caption { justify-items: center; }
  .dial { --dial: 196px; }
}
@media (max-width: 419.98px) { .switch-theme .switch-label { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip-path: inset(50%); } }
@media (max-width: 359.98px) {
  .brandbar { padding: 20px 18px 0; }
  .auth { padding: 22px 16px 24px; }
  .stage { --bleed: 14px; }
  .instrument { padding: 26px 16px 28px; }
  .instrument::before { left: 16px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .btn.is-busy .spinner { animation-duration: 1.2s !important; animation-iteration-count: infinite !important; }
}
@media (forced-colors: active) {
  .shell, .control, .btn, .alert, .toast, .switch-track, .switch-thumb, .progress, .peek, .dial-groove, .dial-knob, .check input, .seal { border: 1px solid CanvasText; }
  .dial-sun, .dial-notch, .logo-core::after { forced-color-adjust: none; background: Highlight; }
}
