/* MDView login theme - design tokens follow SRS-MDVIEW-001 section 4.2 */
:root {
  --md-primary: #2563EB; --md-primary-600: #1D4ED8; --md-accent: #7C3AED;
  --md-bg: #FFFFFF; --md-surface: #F8FAFC; --md-text: #0F172A; --md-muted: #64748B; --md-line: #E2E8F0; --md-line-strong: #CBD5E1;
  --md-success: #16A34A; --md-warning: #D97706; --md-danger: #DC2626;
  --md-card: rgba(255,255,255,.82); --md-input-bg: #FFFFFF; --md-ring: rgba(37,99,235,.22);
  --md-grad: linear-gradient(135deg, #2563EB 0%, #4F46E5 55%, #6D28D9 100%);
  --md-font: 'Inter', 'Noto Sans Thai', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --md-serif: 'Source Serif 4', 'Noto Serif Thai', Georgia, serif;
  --md-mono: 'JetBrains Mono', ui-monospace, 'Cascadia Code', Consolas, monospace;
  --md-r-sm: 6px; --md-r-md: 10px; --md-r-lg: 16px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --md-primary: #60A5FA; --md-primary-600: #93C5FD; --md-accent: #A78BFA;
    --md-bg: #0F172A; --md-surface: #1E293B; --md-text: #E2E8F0; --md-muted: #94A3B8; --md-line: #334155; --md-line-strong: #475569;
    --md-success: #4ADE80; --md-warning: #FBBF24; --md-danger: #F87171;
    --md-card: rgba(30,41,59,.78); --md-input-bg: #0F172A; --md-ring: rgba(96,165,250,.28);
    color-scheme: dark;
  }
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body.md-body { font-family: var(--md-font); font-size: 16px; line-height: 1.6; color: var(--md-text); background: var(--md-bg);
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
:lang(th) body.md-body, html[lang="th"] body.md-body { line-height: 1.7; }
a { color: var(--md-primary); text-decoration: none; font-weight: 500; border-radius: 4px; }
a:hover { color: var(--md-primary-600); text-decoration: underline; text-underline-offset: 3px; }
a:focus-visible, button:focus-visible, input:focus-visible { outline: 3px solid var(--md-ring); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ================= page grid ================= */
.md-page { display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(460px, 1fr); min-height: 100vh; }
@media (max-width: 1080px) { .md-page { grid-template-columns: 1fr; } .md-showcase { display: none; } }

/* ================= showcase (left) ================= */
.md-showcase { position: relative; overflow: hidden; color: #E2E8F0; background: #060A18; isolation: isolate; }
.md-mesh, .md-grid { position: absolute; inset: 0; z-index: -1; }
.md-blob { position: absolute; border-radius: 50%; filter: blur(70px); opacity: .55; animation: md-drift 22s ease-in-out infinite alternate; }
.md-blob-1 { width: 520px; height: 520px; left: -140px; top: -120px; background: #2563EB; }
.md-blob-2 { width: 460px; height: 460px; right: -160px; top: 28%; background: #7C3AED; animation-delay: -7s; opacity: .45; }
.md-blob-3 { width: 380px; height: 380px; left: 22%; bottom: -180px; background: #0EA5E9; animation-delay: -13s; opacity: .32; }
@keyframes md-drift { 0% { transform: translate(0, 0) scale(1); } 50% { transform: translate(40px, 30px) scale(1.08); } 100% { transform: translate(-30px, 50px) scale(.96); } }
.md-grid { background-image: linear-gradient(rgba(148,163,184,.07) 1px, transparent 1px), linear-gradient(90deg, rgba(148,163,184,.07) 1px, transparent 1px);
  background-size: 44px 44px; -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%); mask-image: radial-gradient(ellipse at 50% 40%, #000 30%, transparent 75%); }
.md-show-inner { position: relative; height: 100%; min-height: 100vh; display: flex; flex-direction: column; gap: 28px; padding: 40px clamp(32px, 4.5vw, 64px) 48px; }

/* brand */
.md-brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none !important; }
.md-logo { display: block; flex: none; filter: drop-shadow(0 8px 18px rgba(79,70,229,.45)); }
.md-brand-name { font-size: 22px; font-weight: 700; letter-spacing: -.02em; line-height: 1.1; }
.md-brand-name small { display: block; font-size: 12.5px; font-weight: 500; letter-spacing: 0; opacity: .72; margin-top: 2px; }
.md-brand-light { color: #F8FAFC; }
.md-brand-mobile { display: none; color: var(--md-text); }
.md-brand-mobile .md-brand-name { font-size: 20px; }
@media (max-width: 1080px) { .md-brand-mobile { display: inline-flex; } }

/* stage with document card + floating chips */
.md-stage { position: relative; width: min(560px, 100%); margin: auto auto 0; padding: 34px 0 40px; }
.md-doc { position: relative; border-radius: 18px; background: linear-gradient(180deg, rgba(15,23,42,.86), rgba(15,23,42,.74));
  border: 1px solid rgba(148,163,184,.2); box-shadow: 0 40px 80px -30px rgba(2,6,23,.9), 0 0 0 1px rgba(255,255,255,.03) inset, 0 1px 0 rgba(255,255,255,.08) inset;
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); overflow: hidden; }
.md-doc-bar { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-bottom: 1px solid rgba(148,163,184,.14); background: rgba(2,6,23,.35); }
.md-dots { display: inline-flex; gap: 6px; } .md-dots i { width: 10px; height: 10px; border-radius: 50%; background: #334155; }
.md-dots i:nth-child(1) { background: #F87171; } .md-dots i:nth-child(2) { background: #FBBF24; } .md-dots i:nth-child(3) { background: #4ADE80; }
.md-tab { display: inline-flex; align-items: center; gap: 8px; font: 500 12.5px/1 var(--md-mono); color: #CBD5E1; padding: 7px 10px; border-radius: 8px; background: rgba(148,163,184,.1); }
.md-tab-ico { font: 700 10px/1 var(--md-font); color: #93C5FD; background: rgba(37,99,235,.22); padding: 3px 4px; border-radius: 4px; }
.md-toggle { position: relative; margin-left: auto; display: inline-grid; grid-template-columns: 1fr 1fr; padding: 3px; border-radius: 999px; background: rgba(2,6,23,.55); border: 1px solid rgba(148,163,184,.18); }
.md-toggle b { position: relative; z-index: 1; font-size: 11.5px; font-weight: 600; padding: 4px 11px; text-align: center; color: #94A3B8; transition: color .2s; }
.md-toggle-thumb { position: absolute; top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 999px; background: var(--md-grad); box-shadow: 0 4px 12px -2px rgba(79,70,229,.6);
  animation: md-thumb 14s ease-in-out infinite; }
.md-toggle .t-src { animation: md-lbl-src 14s infinite; } .md-toggle .t-ren { animation: md-lbl-ren 14s infinite; }
@keyframes md-thumb { 0%, 45% { transform: translateX(0); } 50%, 95% { transform: translateX(100%); } 100% { transform: translateX(0); } }
@keyframes md-lbl-src { 0%, 45% { color: #fff; } 50%, 95% { color: #94A3B8; } 100% { color: #fff; } }
@keyframes md-lbl-ren { 0%, 45% { color: #94A3B8; } 50%, 95% { color: #fff; } 100% { color: #94A3B8; } }

.md-doc-body { position: relative; height: 296px; }
.md-src, .md-render { position: absolute; inset: 0; margin: 0; padding: 20px 24px; }
.md-src { font: 400 13.5px/1.75 var(--md-mono); color: #CBD5E1; white-space: pre; overflow: hidden; animation: md-src 14s ease-in-out infinite; }
.md-src i { font-style: normal; }
.md-src .l { display: inline-block; min-width: 1ch; clip-path: inset(0 100% 0 0); animation: md-type 14s steps(28, end) infinite both; }
.md-src .l1 { animation-delay: .2s; } .md-src .l2 { animation-delay: .7s; } .md-src .l3 { animation-delay: 1.1s; } .md-src .l4 { animation-delay: 1.4s; }
.md-src .l5 { animation-delay: 1.9s; } .md-src .l6 { animation-delay: 2.3s; } .md-src .l7 { animation-delay: 2.8s; } .md-src .l8 { animation-delay: 3.2s; } .md-src .l9 { animation-delay: 3.7s; }
@keyframes md-type { 0% { clip-path: inset(0 100% 0 0); } 4% { clip-path: inset(0 0 0 0); } 100% { clip-path: inset(0 0 0 0); } }
@keyframes md-src { 0%, 44% { opacity: 1; transform: none; } 49%, 96% { opacity: 0; transform: translateY(-6px); } 100% { opacity: 1; } }
.tk-h { color: #A78BFA; font-weight: 500; } .tk-ht { color: #F8FAFC; font-weight: 500; } .tk-q { color: #64748B; } .tk-f { color: #64748B; }
.tk-s { color: #86EFAC; } .tk-li { color: #FBBF24; } .tk-b { color: #F472B6; } .tk-cmd { color: #93C5FD; font-style: normal; }

.md-render { opacity: 0; color: #CBD5E1; font-size: 14.5px; animation: md-render 14s ease-in-out infinite; }
@keyframes md-render { 0%, 46% { opacity: 0; transform: translateY(8px); } 52%, 94% { opacity: 1; transform: none; } 100% { opacity: 0; } }
.md-render h3 { font: 700 25px/1.2 var(--md-serif); color: #F8FAFC; margin: 0 0 8px; letter-spacing: -.01em; }
.md-render h4 { font: 600 16px/1.3 var(--md-font); color: #E2E8F0; margin: 14px 0 8px; }
.md-render blockquote { margin: 0; padding: 2px 0 2px 12px; border-left: 3px solid #7C3AED; color: #A5B4FC; font-style: italic; font-size: 14px; }
.md-code { display: flex; align-items: center; justify-content: space-between; gap: 10px; font: 400 13px/1 var(--md-mono); color: #E2E8F0; background: #0B1220;
  border: 1px solid rgba(148,163,184,.16); border-radius: 10px; padding: 12px 14px; }
.md-code i { font-style: normal; }
.md-code-lang { order: 2; font: 600 10px/1 var(--md-font); letter-spacing: .08em; text-transform: uppercase; color: #64748B; }
.md-tasks { list-style: none; padding: 0; margin: 12px 0 0; display: grid; gap: 7px; }
.md-tasks li { display: flex; align-items: center; gap: 9px; position: relative; }
.md-cb { width: 16px; height: 16px; border-radius: 5px; border: 1.5px solid #475569; flex: none; }
.md-tasks li.done { color: #64748B; text-decoration: line-through; }
.md-tasks li.done .md-cb { border-color: transparent; background: #2563EB url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.5l2.5 2.5L12 5.5' fill='none' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center/14px no-repeat; }
.md-tasks mark { background: linear-gradient(transparent 55%, rgba(167,139,250,.45) 55%); color: #F8FAFC; padding: 0 2px; }
.md-note-dot { width: 9px; height: 9px; border-radius: 50%; background: #A78BFA; box-shadow: 0 0 0 4px rgba(167,139,250,.2); margin-left: 4px; animation: md-pulse 2.4s ease-out infinite; }
@keyframes md-pulse { 0% { box-shadow: 0 0 0 0 rgba(167,139,250,.55); } 100% { box-shadow: 0 0 0 10px rgba(167,139,250,0); } }

.md-float { position: absolute; z-index: 2; border-radius: 14px; background: rgba(15,23,42,.82); border: 1px solid rgba(148,163,184,.22);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); box-shadow: 0 24px 48px -20px rgba(2,6,23,.85); animation: md-float 7s ease-in-out infinite; }
@keyframes md-float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.md-toc { top: 92px; right: -44px; display: grid; gap: 4px; padding: 12px 14px; min-width: 168px; font-size: 12.5px; animation-delay: -2s; }
.md-float-title { font-size: 10.5px; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: #64748B; margin-bottom: 2px; }
.md-toc-item { color: #94A3B8; padding: 3px 0 3px 10px; border-left: 2px solid #334155; }
.md-toc-item.is-active { color: #F8FAFC; border-left-color: #60A5FA; font-weight: 600; }
.md-sticky { left: -38px; bottom: 6px; width: 200px; padding: 12px 14px 12px 16px; display: grid; gap: 2px; font-size: 12.5px; color: #E9D5FF;
  background: linear-gradient(160deg, rgba(76,29,149,.9), rgba(49,46,129,.86)); border-color: rgba(167,139,250,.35); animation-delay: -4.5s; }
.md-sticky b { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #C4B5FD; }
.md-sticky-pin { position: absolute; top: 12px; left: 0; width: 3px; height: 26px; border-radius: 0 3px 3px 0; background: #A78BFA; }
.md-sync { right: -18px; bottom: -4px; display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; animation-delay: -1s; }
.md-sync b { display: block; font-size: 14px; color: #F8FAFC; line-height: 1.1; }
.md-sync small { display: block; font-size: 11.5px; color: #94A3B8; }
.md-ring { width: 36px; height: 36px; transform: rotate(-90deg); }
.md-ring circle { fill: none; stroke-width: 4; } .md-ring .bg { stroke: #1E293B; }
.md-ring .fg { stroke: url(#none); stroke: #60A5FA; stroke-linecap: round; stroke-dasharray: 94.25; stroke-dashoffset: 35.8; animation: md-ring 14s ease-in-out infinite; }
@keyframes md-ring { 0% { stroke-dashoffset: 94.25; } 30%, 100% { stroke-dashoffset: 35.8; } }
@media (max-width: 1320px) { .md-toc { right: -12px; } .md-sticky { left: -14px; } .md-sync { right: -8px; } }

/* hero copy */
.md-hero-copy { max-width: 560px; margin: 0 auto auto; width: min(560px, 100%); }
.md-eyebrow { display: inline-flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; letter-spacing: .04em; color: #C7D2FE; padding: 6px 12px 6px 10px;
  border-radius: 999px; background: rgba(99,102,241,.14); border: 1px solid rgba(129,140,248,.32); }
.md-eyebrow::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: #60A5FA; box-shadow: 0 0 10px #60A5FA; }
.md-hero-title { font-family: var(--md-serif); font-size: clamp(28px, 2.7vw, 40px); line-height: 1.22; margin: 16px 0 12px; font-weight: 700; letter-spacing: -.015em;
  background: linear-gradient(100deg, #FFFFFF 0%, #E0E7FF 45%, #C4B5FD 100%); -webkit-background-clip: text; background-clip: text; color: transparent; }
.md-hero-sub { font-size: 15.5px; color: #A8B3C7; margin: 0 0 20px; }
.md-feats { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 18px; font-size: 14px; color: #CBD5E1; }
.md-feats li { display: flex; align-items: center; gap: 10px; }
.fi { width: 30px; height: 30px; flex: none; border-radius: 9px; background: rgba(96,165,250,.12); border: 1px solid rgba(96,165,250,.22); position: relative; }
.fi::after { content: ''; position: absolute; inset: 7px; background: #93C5FD; -webkit-mask: var(--i) center/contain no-repeat; mask: var(--i) center/contain no-repeat; }
.fi-toc { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Cpath d='M4 6h16M8 12h12M8 18h12M4 12h.01M4 18h.01'/%3E%3C/svg%3E"); }
.fi-math { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M18 4H6l6 8-6 8h12'/%3E%3C/svg%3E"); }
.fi-note { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 20h9M16.5 3.5a2.1 2.1 0 0 1 3 3L7 19l-4 1 1-4z'/%3E%3C/svg%3E"); }
.fi-sync { --i: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 12a9 9 0 0 1-15.4 6.4L3 16M3 12a9 9 0 0 1 15.4-6.4L21 8M21 3v5h-5M3 21v-5h5'/%3E%3C/svg%3E"); }
.fi-math::after, .fi-note::after { background: #C4B5FD; }
.fi-math, .fi-note { background: rgba(167,139,250,.12); border-color: rgba(167,139,250,.25); }

@media (prefers-reduced-motion: reduce) {
  .md-blob, .md-float, .md-toggle-thumb, .md-toggle b, .md-src, .md-src .l, .md-render, .md-ring .fg, .md-note-dot { animation: none !important; }
  .md-src { opacity: 0; } .md-render { opacity: 1; } .md-toggle-thumb { transform: translateX(100%); } .md-toggle .t-ren { color: #fff; }
}

/* ================= form side (right) ================= */
.md-main { position: relative; display: flex; flex-direction: column; min-height: 100vh; padding: 24px clamp(18px, 5vw, 64px) 22px; isolation: isolate;
  background: radial-gradient(900px 480px at 100% -5%, color-mix(in srgb, var(--md-primary) 10%, transparent), transparent 62%),
              radial-gradient(700px 420px at -10% 105%, color-mix(in srgb, var(--md-accent) 9%, transparent), transparent 60%), var(--md-bg); }
.md-main::before { content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none; opacity: .5;
  background-image: radial-gradient(color-mix(in srgb, var(--md-muted) 22%, transparent) 1px, transparent 1px); background-size: 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000, transparent 45%); mask-image: linear-gradient(180deg, #000, transparent 45%); }
.md-topbar { display: flex; align-items: center; gap: 14px; min-height: 44px; }
.md-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; font-size: 14px; color: var(--md-muted); font-weight: 500; }
.md-back:hover { color: var(--md-text); text-decoration: none; }
.md-back-arrow { transition: transform .2s; } .md-back:hover .md-back-arrow { transform: translateX(-3px); }
@media (max-width: 1080px) { .md-back { display: none; } }
.md-lang { margin-left: auto; display: inline-flex; padding: 4px; gap: 2px; border-radius: 999px; background: var(--md-surface); border: 1px solid var(--md-line); }
.md-lang a { min-width: 52px; min-height: 36px; display: inline-grid; place-items: center; padding: 0 14px; border-radius: 999px; font-size: 13.5px; font-weight: 600; color: var(--md-muted); transition: background .2s, color .2s; }
.md-lang a:hover { text-decoration: none; color: var(--md-text); }
.md-lang a.is-active { background: var(--md-grad); color: #fff; box-shadow: 0 6px 14px -6px rgba(79,70,229,.6); }

.md-card { width: 100%; max-width: 448px; margin: auto; padding: 38px 38px 30px; background: var(--md-card); border: 1px solid var(--md-line); border-radius: 24px;
  backdrop-filter: blur(18px) saturate(140%); -webkit-backdrop-filter: blur(18px) saturate(140%);
  box-shadow: 0 1px 2px rgba(15,23,42,.04), 0 30px 70px -32px rgba(15,23,42,.35), 0 0 0 1px rgba(255,255,255,.4) inset; animation: md-in .35s ease-out both; }
@media (prefers-color-scheme: dark) { .md-card { box-shadow: 0 30px 70px -30px rgba(0,0,0,.7), 0 1px 0 rgba(255,255,255,.05) inset; } }
@keyframes md-in { from { transform: translateY(10px); } to { transform: none; } }
@media (max-width: 520px) { .md-card { padding: 28px 20px 22px; border-radius: 20px; } .md-main { padding-top: 16px; } }
.md-card-header h1 { font-family: var(--md-serif); font-size: 32px; line-height: 1.2; margin: 0 0 8px; font-weight: 700; letter-spacing: -.02em; }
.md-card-header h1.md-h1-sm { font-size: 26px; }
.md-sub { margin: 0 0 24px; color: var(--md-muted); font-size: 15px; line-height: 1.6; }
.md-required { font-size: 13px; color: var(--md-muted); margin: 4px 0 14px; }
.required { color: var(--md-danger); margin-left: 2px; }
.md-username { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 10px; margin: 6px 0 20px; border-radius: 14px; background: var(--md-surface); border: 1px solid var(--md-line); }
.md-username label { flex: 1; font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.md-username a { font-size: 14px; padding: 8px 12px; border-radius: 10px; }
.md-username a:hover { background: var(--md-bg); text-decoration: none; }
.md-avatar { width: 34px; height: 34px; border-radius: 50%; display: inline-grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff; background: var(--md-grad); flex: none; }

/* fields */
.md-group { margin-bottom: 18px; }
.md-label-wrap { display: flex; align-items: baseline; gap: 2px; }
.md-label { display: block; font-size: 14px; font-weight: 600; margin-bottom: 7px; color: var(--md-text); }
.md-input, select.md-input, textarea.md-input { width: 100%; height: 48px; padding: 0 15px; font: inherit; font-size: 16px; color: var(--md-text); background: var(--md-input-bg);
  border: 1.5px solid var(--md-line); border-radius: 12px; outline: none; transition: border-color .15s, box-shadow .15s, background .15s; }
textarea.md-input { height: auto; min-height: 96px; padding: 12px 15px; }
.md-input::placeholder { color: color-mix(in srgb, var(--md-muted) 75%, transparent); }
.md-input:hover { border-color: var(--md-line-strong); }
.md-input:focus { border-color: var(--md-primary); box-shadow: 0 0 0 4px var(--md-ring); }
.md-input[aria-invalid="true"] { border-color: var(--md-danger); box-shadow: 0 0 0 4px color-mix(in srgb, var(--md-danger) 14%, transparent); }
.md-input:-webkit-autofill { -webkit-text-fill-color: var(--md-text); -webkit-box-shadow: 0 0 0 100px color-mix(in srgb, var(--md-primary) 7%, var(--md-input-bg)) inset; }
.md-input-group { position: relative; display: flex; }
.md-input-group .md-input { padding-right: 54px; }
.md-eye { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); width: 44px; height: 40px; border: 0; border-radius: 9px; background: transparent; color: var(--md-muted); cursor: pointer; display: grid; place-items: center; }
.md-eye:hover { background: var(--md-surface); color: var(--md-text); }
.md-ico-eye, .md-ico-eye-off { width: 20px; height: 20px; display: inline-block; background: currentColor; -webkit-mask: var(--m) center/contain no-repeat; mask: var(--m) center/contain no-repeat; }
.md-ico-eye { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7S2 12 2 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E"); }
.md-ico-eye-off { --m: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l18 18M10.6 10.6a2 2 0 0 0 2.8 2.8M9.9 5.1A9.8 9.8 0 0 1 12 5c6.5 0 10 7 10 7a17 17 0 0 1-3.2 4.1M6.6 6.6C3.8 8.5 2 12 2 12s3.5 7 10 7a9.6 9.6 0 0 0 5.4-1.6'/%3E%3C/svg%3E"); }
.md-input-error, span.md-input-error { display: block; margin-top: 7px; font-size: 13.5px; color: var(--md-danger); font-weight: 500; }
.md-input-error:empty { display: none; }
.md-help { display: block; margin-top: 6px; font-size: 13px; color: var(--md-muted); }
.md-help:empty { display: none; }
.md-caps { display: none; margin-top: 7px; font-size: 13px; color: var(--md-warning); font-weight: 500; }
.md-caps.is-on { display: block; }

/* options row: remember me + forgot password */
.md-settings { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: -2px 0 20px; font-size: 14.5px; }
.md-settings a { display: inline-flex; align-items: center; min-height: 44px; }
.checkbox label, .md-check-label { display: inline-flex; align-items: center; gap: 9px; cursor: pointer; color: var(--md-text); font-weight: 500; min-height: 44px; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--md-primary); margin: 0; cursor: pointer; }

/* buttons */
.md-btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 22px; font: inherit; font-size: 16px; font-weight: 600;
  border-radius: 12px; border: 1.5px solid transparent; cursor: pointer; transition: transform .08s, filter .15s, box-shadow .2s, border-color .15s, color .15s; text-decoration: none !important; -webkit-appearance: none; appearance: none; }
.md-btn:active { transform: translateY(1px); }
.md-btn-primary, input.md-btn-primary { color: #fff; background: var(--md-grad); background-size: 140% 100%; box-shadow: 0 12px 26px -12px rgba(79,70,229,.75), 0 1px 0 rgba(255,255,255,.18) inset; }
.md-btn-primary:hover { color: #fff; filter: brightness(1.07) saturate(1.05); box-shadow: 0 16px 32px -12px rgba(79,70,229,.85), 0 1px 0 rgba(255,255,255,.18) inset; }
.md-btn-primary:focus-visible, .md-btn-default:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--md-ring); }
.md-btn-primary.is-busy { opacity: .8; pointer-events: none; cursor: progress; }
.md-btn-default { color: var(--md-text); background: var(--md-input-bg); border-color: var(--md-line); }
.md-btn-default:hover { border-color: var(--md-primary); color: var(--md-primary); }
.md-btn-block { width: 100%; }
#kc-form-buttons { margin-bottom: 0; }
#kc-form-buttons .md-btn + .md-btn, .md-buttons .md-btn + .md-btn { margin-top: 10px; }
#kc-form-options { flex: 1; }
/* register / reset: "back to login" sits under the primary button */
.md-group:has(> #kc-form-buttons):has(> #kc-form-options) { display: flex; flex-direction: column-reverse; align-items: stretch; gap: 10px; margin: 6px 0 0; }
.md-group:has(> #kc-form-buttons) > #kc-form-options { text-align: center; font-size: 14.5px; }
.md-group:has(> #kc-form-buttons) > #kc-form-options a { display: inline-flex; align-items: center; min-height: 44px; }

/* alerts */
.md-alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; margin-bottom: 18px; font-size: 14.5px; border: 1px solid; line-height: 1.5; }
.md-alert-icon { width: 18px; height: 18px; flex: none; margin-top: 2px; background: currentColor; -webkit-mask: var(--a) center/contain no-repeat; mask: var(--a) center/contain no-repeat;
  --a: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M12 7.5v5.5M12 16.5h.01'/%3E%3C/svg%3E"); }
.md-alert-success .md-alert-icon { --a: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9.5'/%3E%3Cpath d='M8 12.5l2.7 2.7L16 9.8'/%3E%3C/svg%3E"); }
.md-alert-error { color: var(--md-danger); background: color-mix(in srgb, var(--md-danger) 7%, var(--md-bg)); border-color: color-mix(in srgb, var(--md-danger) 28%, transparent); }
.md-alert-warning { color: var(--md-warning); background: color-mix(in srgb, var(--md-warning) 9%, var(--md-bg)); border-color: color-mix(in srgb, var(--md-warning) 32%, transparent); }
.md-alert-success { color: var(--md-success); background: color-mix(in srgb, var(--md-success) 8%, var(--md-bg)); border-color: color-mix(in srgb, var(--md-success) 28%, transparent); }
.md-alert-info { color: var(--md-primary); background: color-mix(in srgb, var(--md-primary) 7%, var(--md-bg)); border-color: color-mix(in srgb, var(--md-primary) 25%, transparent); }
.md-alert-text { color: var(--md-text); }

/* sign-up line, info / error pages */
.md-signup { margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--md-line); text-align: center; font-size: 15px; color: var(--md-muted); }
.md-signup a { margin-left: 4px; font-weight: 600; }
.md-center { text-align: center; margin-top: 14px; }
.instruction, #kc-error-message p, #kc-info-message p { color: var(--md-muted); font-size: 15px; margin: 0 0 18px; }
#kc-error-message .instruction { color: var(--md-text); padding: 14px 16px; border-radius: 12px; background: color-mix(in srgb, var(--md-danger) 7%, var(--md-bg)); border: 1px solid color-mix(in srgb, var(--md-danger) 25%, transparent); }
#kc-back-to-application, #kc-info-message a, #kc-page-expired-message a, #backToApplication { font-weight: 600; }
#kc-info-message p:last-child a, #kc-error-message p:last-child a { display: inline-flex; align-items: center; justify-content: center; min-height: 48px; width: 100%; border-radius: 12px; color: #fff; background: var(--md-grad); text-decoration: none; box-shadow: 0 12px 26px -12px rgba(79,70,229,.75); }
#kc-info-message ul, #kc-info-message ol { color: var(--md-text); }
#kc-page-expired-message, p#instruction1 { color: var(--md-muted); }
#kc-page-expired-message a { display: inline-flex; min-height: 44px; align-items: center; }

/* social providers */
.md-social { margin-top: 22px; }
.md-social hr { border: 0; height: 1px; background: var(--md-line); margin: 0 0 14px; }
.md-social h2 { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--md-muted); text-align: center; margin: 0 0 12px; font-weight: 600; }
.md-social-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.md-social-grid { grid-template-columns: 1fr 1fr; }

/* OTP / authenticator selection / recovery */
.md-select-auth { list-style: none; padding: 0; display: grid; gap: 10px; }
.md-select-auth-item { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1.5px solid var(--md-line); border-radius: 12px; cursor: pointer; color: var(--md-text); }
.md-select-auth-item:hover { border-color: var(--md-primary); text-decoration: none; }
.md-select-auth-title { font-weight: 600; } .md-select-auth-desc { color: var(--md-muted); font-size: 14px; }
.md-otp-tile { display: block; padding: 12px; border: 1.5px solid var(--md-line); border-radius: 12px; margin-bottom: 10px; }
#kc-totp-secret-qr-code { border-radius: 12px; border: 1px solid var(--md-line); background: #fff; padding: 6px; }
#kc-totp-settings, #kc-totp-settings li { color: var(--md-text); }
ol, ul { padding-left: 20px; }
#kc-content-wrapper > ol, #kc-totp-settings { line-height: 1.7; }

/* footer */
.md-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 16px; max-width: 448px; width: 100%; margin: 20px auto 0; font-size: 12.5px; color: var(--md-muted); }
.md-secure { display: inline-flex; align-items: center; gap: 6px; }
.md-lock { width: 12px; height: 12px; background: var(--md-success); -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 10V8a6 6 0 1 1 12 0v2h1v12H5V10zm2 0h8V8a4 4 0 1 0-8 0z'/%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 24 24'%3E%3Cpath d='M6 10V8a6 6 0 1 1 12 0v2h1v12H5V10zm2 0h8V8a4 4 0 1 0-8 0z'/%3E%3C/svg%3E") center/contain no-repeat; }
@media (max-width: 520px) { .md-foot { justify-content: center; text-align: center; } }

/* hide leftovers of the base theme we don't use */
.kc-login-tooltip .kc-tooltip-text { display: none; }

/* ================= MDView 2 app pages (the theme above was the Keycloak login theme; these pages are now part of the web app) ================= */
.md-main > .md-card { margin: auto; }
.md-notice { margin: -6px 0 16px; }
.md-form .md-group:last-child { margin-bottom: 0; }
.md-actions { margin-top: 6px; display: grid; gap: 10px; }
.md-actions .md-center a { display: inline-flex; align-items: center; min-height: 44px; }
.md-devlink { margin-top: 14px; padding: 12px 14px; border-radius: 12px; font-size: 13.5px; color: var(--md-text); background: color-mix(in srgb, var(--md-warning) 10%, var(--md-bg)); border: 1px dashed color-mix(in srgb, var(--md-warning) 50%, transparent); word-break: break-all; }
.md-devlink a { font-family: var(--md-mono); font-size: 12.5px; }
.md-check-label input { margin-right: 2px; }
.md-strength { display: flex; gap: 4px; margin-top: 8px; }
.md-strength i { flex: 1; height: 4px; border-radius: 2px; background: var(--md-line); transition: background .2s; }
.md-strength[data-score="1"] i:nth-child(-n+1), .md-strength[data-score="2"] i:nth-child(-n+2) { background: var(--md-warning); }
.md-strength[data-score="3"] i:nth-child(-n+3) { background: var(--md-primary); }
.md-strength[data-score="4"] i { background: var(--md-success); }
html[data-theme="dark"] .md-main { --md-primary: #60A5FA; --md-primary-600: #93C5FD; --md-accent: #A78BFA; --md-bg: #0F172A; --md-surface: #1E293B; --md-text: #E2E8F0; --md-muted: #94A3B8; --md-line: #334155; --md-line-strong: #475569; --md-card: rgba(30,41,59,.78); --md-input-bg: #0F172A; --md-ring: rgba(96,165,250,.28); color-scheme: dark; }
html[data-theme="light"] .md-main { --md-primary: #2563EB; --md-primary-600: #1D4ED8; --md-accent: #7C3AED; --md-bg: #FFFFFF; --md-surface: #F8FAFC; --md-text: #0F172A; --md-muted: #64748B; --md-line: #E2E8F0; --md-line-strong: #CBD5E1; --md-card: rgba(255,255,255,.82); --md-input-bg: #FFFFFF; --md-ring: rgba(37,99,235,.22); color-scheme: light; }
