/* 通辽智慧农牧 · 统一身份认证主题
   与 portal / 工作台 / 高标登录页共用同一套视觉 token。 */

@font-face {
  font-family: "Albert Sans";
  src: url("../fonts/AlbertSans-VariableFont_wght.woff2") format("woff2");
  font-weight: 100 900;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --paper: #f7faf2;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-solid: #ffffff;
  --ink: #1d241b;
  --ink-soft: #30463a;
  --muted: #66715f;
  --faint: #8b9584;
  --line: rgba(31, 59, 37, 0.13);
  --line-strong: rgba(31, 59, 37, 0.22);
  --green: #1d7a46;
  --green-deep: #143c27;
  --lime: #71e13d;
  --lime-soft: #e7ffda;
  --danger: #b42318;
  --shadow: 0 30px 80px -36px rgba(25, 58, 35, 0.4);
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  overflow-x: hidden;
  background: var(--paper);
  color: var(--ink);
  font-family: "Albert Sans", "PingFang SC", "Microsoft YaHei", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button, input { font: inherit; }
a { color: inherit; text-decoration: none; }
svg, img { display: block; }
[hidden] { display: none !important; }

/* 页面背景：纸感网格 + 三个缓慢呼吸的农事色光斑 */
.tl-canvas { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.tl-canvas::before {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(31, 59, 37, 0.038) 1px, transparent 1px),
    linear-gradient(90deg, rgba(31, 59, 37, 0.038) 1px, transparent 1px);
  background-size: 64px 64px;
  -webkit-mask-image: linear-gradient(to bottom, transparent 1%, #000 18%, #000 82%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 1%, #000 18%, #000 82%, transparent 100%);
}
.tl-orb { position: absolute; display: block; border-radius: 50%; will-change: transform; }
.tl-orb-a { top: -300px; left: -180px; width: 720px; height: 720px; background: radial-gradient(circle, rgba(113,225,61,.23), rgba(113,225,61,.05) 48%, transparent 70%); animation: tlFloatA 17s ease-in-out infinite; }
.tl-orb-b { right: -260px; bottom: -320px; width: 780px; height: 780px; background: radial-gradient(circle, rgba(29,122,70,.14), rgba(29,122,70,.03) 50%, transparent 72%); animation: tlFloatB 21s ease-in-out infinite; }
.tl-orb-c { top: 140px; right: 20%; width: 260px; height: 260px; background: radial-gradient(circle, rgba(255,255,255,.78), rgba(255,255,255,.16) 48%, transparent 70%); filter: blur(2px); }
@keyframes tlFloatA { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(28px,22px,0) scale(1.035); } }
@keyframes tlFloatB { 0%,100% { transform: translate3d(0,0,0) scale(1); } 50% { transform: translate3d(-30px,-18px,0) scale(1.025); } }

/* 顶栏与双栏结构 */
.tl-page { position: relative; z-index: 1; min-height: 100vh; min-height: 100dvh; }
.tl-topbar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  width: min(1200px, calc(100% - 64px));
  height: 68px;
  margin: 0 auto;
  border-bottom: 1px solid var(--line);
}
.tl-brand { display: inline-flex; align-items: center; gap: 11px; min-width: 0; }
.tl-brand-mark { width: 36px; height: 36px; flex: 0 0 36px; display: grid; place-items: center; }
.tl-brand-mark img { width: 100%; height: 100%; object-fit: contain; }
.tl-brand-copy { display: grid; gap: 1px; min-width: 0; }
.tl-brand-copy strong { font-size: 14px; font-weight: 760; letter-spacing: -.015em; white-space: nowrap; }
.tl-brand-copy small { color: var(--faint); font-size: 8px; font-weight: 700; letter-spacing: .13em; white-space: nowrap; }
.tl-portal-link { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; transition: color 180ms ease, transform 180ms ease; }
.tl-portal-link:hover { color: var(--green); transform: translateX(2px); }

.tl-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 456px);
  align-items: center;
  gap: 88px;
  width: min(1200px, calc(100% - 64px));
  min-height: calc(100vh - 68px);
  min-height: calc(100dvh - 68px);
  margin: 0 auto;
  padding: 46px 0 54px;
}

/* 左侧叙事：与门户登录页同节奏的入场 */
.tl-story > * { opacity: 0; transform: translate3d(0,18px,0); animation: tlEnter 760ms var(--ease) forwards; }
.tl-story > :nth-child(1) { animation-delay: 40ms; }
.tl-story > :nth-child(2) { animation-delay: 110ms; }
.tl-story > :nth-child(3) { animation-delay: 180ms; }
.tl-story > :nth-child(4) { animation-delay: 250ms; }
.tl-story > :nth-child(5) { animation-delay: 320ms; }
@keyframes tlEnter { to { opacity: 1; transform: translate3d(0,0,0); } }

.tl-eyebrow {
  display: inline-flex; align-items: center; gap: 9px; min-height: 32px; padding: 0 14px;
  border: 1px solid var(--line); border-radius: 999px;
  background: rgba(255,255,255,.68); color: var(--muted);
  font-size: 11.5px; font-weight: 650; -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
}
.tl-eyebrow i, .tl-status i, .tl-runtime i { width: 7px; height: 7px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 4px rgba(113,225,61,.16); }
.tl-story h1 { margin: 26px 0 0; color: var(--ink); font-size: clamp(52px, 5vw, 74px); font-weight: 810; letter-spacing: -.052em; line-height: 1.02; }
.tl-story h1 span { color: var(--green); }
.tl-story > p { max-width: 560px; margin: 24px 0 0; color: var(--muted); font-size: 15px; line-height: 1.9; }
.tl-points { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 12px; margin-top: 32px; }
.tl-points > div {
  min-height: 104px; padding: 17px;
  border: 1px solid var(--line); border-radius: 15px;
  background: linear-gradient(145deg, rgba(255,255,255,.88), rgba(255,255,255,.62));
  box-shadow: 0 20px 40px -36px rgba(26,61,35,.5);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
}
.tl-points strong { display: block; color: var(--ink); font-size: 13.5px; font-weight: 720; }
.tl-points span { display: block; margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.6; }
.tl-story-foot { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--faint); font-size: 10.5px; }
.tl-status { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-weight: 650; }

/* 右侧玻璃卡片 */
.tl-card-wrap { opacity: 0; transform: translate3d(0,24px,0) scale(.985); animation: tlCardEnter 860ms 150ms var(--ease) forwards; }
@keyframes tlCardEnter { to { opacity: 1; transform: translate3d(0,0,0) scale(1); } }
.tl-card {
  position: relative;
  overflow: hidden;
  padding: 32px;
  border: 1px solid var(--line-strong);
  border-radius: 22px;
  background: linear-gradient(155deg, rgba(255,255,255,.97), rgba(255,255,255,.84));
  box-shadow: var(--shadow);
  -webkit-backdrop-filter: blur(24px) saturate(1.18);
  backdrop-filter: blur(24px) saturate(1.18);
}
.tl-card::before { content: ""; position: absolute; top: 0; left: 30px; right: 30px; height: 3px; border-radius: 0 0 99px 99px; background: linear-gradient(90deg, var(--lime), var(--green) 52%, transparent); }
.tl-card::after { content: ""; position: absolute; top: -110px; right: -120px; width: 270px; height: 270px; border-radius: 50%; background: radial-gradient(circle, rgba(113,225,61,.12), transparent 68%); pointer-events: none; }
.tl-card-top { position: relative; z-index: 3; display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--green); font-size: 10.5px; font-weight: 760; letter-spacing: .1em; }
.tl-card-tools { display: flex; align-items: center; gap: 8px; }
.tl-runtime { display: inline-flex; align-items: center; gap: 7px; min-height: 27px; padding: 0 10px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.66); color: var(--muted); font-size: 10.5px; font-weight: 600; letter-spacing: 0; white-space: nowrap; }
.tl-runtime i { width: 6px; height: 6px; box-shadow: 0 0 0 3px rgba(113,225,61,.15); }
.tl-card-head { position: relative; z-index: 1; }
.tl-card-head h2, #kc-page-title { margin: 20px 0 0; color: var(--ink); font-size: 29px; font-weight: 780; letter-spacing: -.04em; line-height: 1.22; }
.tl-kicker { display: inline-block; margin-bottom: 8px; color: var(--green); font-size: 10.5px; font-weight: 760; letter-spacing: .1em; }
.tl-card-head p, #kc-content-wrapper > p { margin: 9px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.7; }

/* Keycloak 表单：通过主题属性映射到 tl-* 类，覆盖基类样式 */
#kc-content, #kc-content-wrapper, #kc-form, #kc-form-wrapper, .tl-form-shell { position: relative; z-index: 1; }
.tl-form-shell { margin-top: 26px; }
.tl-form { margin: 0; }
.tl-field { margin: 16px 0 0; }
.tl-field:first-child { margin-top: 0; }
.tl-label, .tl-form .tl-label { display: block; margin: 0 0 8px; padding: 0; color: var(--muted); font-size: 11px; font-weight: 680; letter-spacing: .045em; }
.tl-field-control { position: relative; }
.tl-field-control > svg { position: absolute; top: 50%; left: 16px; z-index: 2; width: 17px; height: 17px; color: var(--faint); transform: translateY(-50%); fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; pointer-events: none; transition: color 180ms ease; }
.tl-field-control:focus-within > svg { color: var(--green); }

.tl-input, #kc-content input.tl-input {
  width: 100%; height: 52px; margin: 0; padding: 0 48px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(255,255,255,.78); color: var(--ink);
  font-size: 13px; line-height: 50px; box-shadow: inset 0 1px 0 rgba(255,255,255,.72);
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease;
}
.tl-input::placeholder { color: #9aa69a; }
.tl-input:hover { border-color: var(--line-strong); }
.tl-input:focus, .tl-input:focus-visible { outline: none; border-color: rgba(29,122,70,.55); background: #fff; box-shadow: 0 0 0 3px rgba(113,225,61,.14), inset 0 1px 0 #fff; }

.tl-password-toggle {
  position: absolute; top: 50%; right: 8px; z-index: 3;
  width: 36px; height: 36px; margin: 0; padding: 0;
  display: grid; place-items: center; transform: translateY(-50%);
  border: 0; border-radius: 9px; background: transparent; color: var(--faint);
  cursor: pointer; transition: color 160ms ease, background 160ms ease;
}
.tl-password-toggle:hover { color: var(--ink); background: rgba(31,59,37,.05); }
.tl-password-toggle i { position: relative; display: block; width: 16px; height: 16px; font-size: 0; }
.tl-password-toggle i::before { content: ""; position: absolute; top: 4px; left: 1px; width: 14px; height: 9px; border: 1.6px solid currentColor; border-radius: 50% 50% 50% 50% / 65% 65% 35% 35%; }
.tl-password-toggle i::after { content: ""; position: absolute; top: 7px; left: 6.5px; width: 3px; height: 3px; border-radius: 50%; background: currentColor; }
.tl-icon-eye-off::before { border-top-color: transparent; border-left-color: transparent; transform: rotate(-35deg); }
.tl-icon-eye-off::after { width: 17px; height: 1.5px; top: 8px; left: 0; border-radius: 0; transform: rotate(-35deg); }

.tl-options { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 24px; margin-top: 16px; }
.tl-options #kc-form-options { display: block; }
.tl-checkbox { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11.5px; cursor: pointer; }
.tl-checkbox input { width: 15px; height: 15px; margin: 0; accent-color: var(--green); }
.tl-options a, .tl-options-right a { color: var(--green); font-size: 11.5px; font-weight: 650; }
.tl-options a:hover { text-decoration: underline; }

#kc-form-buttons { margin-top: 20px; }
.tl-button-primary, #kc-login, #kc-content input[type="submit"], #kc-content button[type="submit"] {
  width: 100%; height: 52px; margin: 0; padding: 0 18px;
  border: 1px solid rgba(20,60,39,.9); border-radius: 12px;
  background: linear-gradient(135deg, #1a6f43, #123d28);
  color: #fff; font-size: 13.5px; font-weight: 720; letter-spacing: .04em;
  box-shadow: 0 16px 32px -20px rgba(20,60,39,.9), inset 0 1px 0 rgba(255,255,255,.16);
  cursor: pointer;
  transition: transform 180ms var(--ease), box-shadow 180ms ease, filter 180ms ease;
}
.tl-button-primary:hover, #kc-login:hover { transform: translateY(-1px); filter: brightness(1.06); box-shadow: 0 20px 38px -20px rgba(20,60,39,.95), inset 0 1px 0 rgba(255,255,255,.2); }
.tl-button-primary:active, #kc-login:active { transform: scale(.99); }
.tl-input:focus-visible, #kc-login:focus-visible, a:focus-visible, button:focus-visible { outline: 2px solid var(--green); outline-offset: 3px; }
.tl-input-error { display: block; margin-top: 7px; color: var(--danger); font-size: 11px; }

.tl-alert { position: relative; z-index: 1; margin: 18px 0 0; padding: 11px 13px; border: 1px solid rgba(180,35,24,.2); border-radius: 11px; background: rgba(255,244,242,.92); color: var(--danger); font-size: 12px; }
.tl-alert-success { border-color: rgba(29,122,70,.2); background: rgba(231,255,218,.9); color: var(--green-deep); }
.tl-alert-warning, .tl-alert-info { border-color: var(--line-strong); background: rgba(255,255,255,.86); color: var(--muted); }

#kc-registration-container, #kc-registration, #kc-info, #kc-info-wrapper { position: relative; z-index: 1; margin-top: 18px; color: var(--muted); font-size: 11.5px; text-align: center; }
#kc-registration a, #kc-info a, #try-another-way { color: var(--green); font-weight: 700; }
#kc-social-providers { position: relative; z-index: 1; margin-top: 22px; }
#kc-social-providers hr { border: 0; border-top: 1px solid var(--line); }
#kc-social-providers h2 { margin: 14px 0; color: var(--muted); font-size: 11.5px; font-weight: 650; text-align: center; }
#kc-locale { position: static; z-index: 4; }
#kc-locale-dropdown { position: relative; }
#kc-current-locale-link { display: inline-flex; align-items: center; min-height: 27px; border: 1px solid var(--line); border-radius: 999px; background: rgba(255,255,255,.82); color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: 0; padding: 0 10px; cursor: pointer; }
#kc-locale-dropdown ul { display: none; position: absolute; top: calc(100% + 6px); right: 0; z-index: 5; min-width: 118px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); list-style: none; padding: 6px; margin: 0; }
#kc-locale-dropdown ul.show, #kc-locale-dropdown[aria-expanded="true"] ul { display: block; }
#kc-locale-dropdown a { display: block; padding: 6px 10px; color: var(--ink); font-size: 11.5px; }
#kc-username { margin-top: 16px; color: var(--ink); font-weight: 700; }
#reset-login { margin-left: 10px; color: var(--green); }
.tl-footnote { margin: 16px 0 0; color: var(--faint); font-size: 10.5px; text-align: center; }

/* 其他 Keycloak 步骤页复用卡片内表单外观 */
#kc-content .form-group, #kc-content [class*="form__group"] { margin-top: 16px; }
#kc-content label { color: var(--muted); font-size: 11px; font-weight: 680; }
#kc-content .pf-c-button:not(.tl-password-toggle) { min-height: 44px; border-radius: 11px; }
#kc-content a { color: var(--green); }
.tl-feedback-icon { display: none; }

/* 响应式 */
@media (max-width: 1024px) {
  .tl-layout { grid-template-columns: minmax(0,1fr) 410px; gap: 42px; }
  .tl-story h1 { font-size: clamp(46px, 5.6vw, 64px); }
}
@media (max-width: 860px) {
  .tl-topbar { width: min(100% - 36px, 640px); }
  .tl-layout { grid-template-columns: 1fr; gap: 30px; width: min(100% - 36px, 560px); padding: 34px 0 44px; }
  .tl-story { text-align: center; }
  .tl-story > p { margin-inline: auto; }
  .tl-points { text-align: left; }
  .tl-story-foot { justify-content: center; flex-wrap: wrap; }
  .tl-card-wrap { width: min(100%, 520px); margin-inline: auto; }
}
@media (max-width: 560px) {
  .tl-topbar { height: 60px; width: calc(100% - 28px); }
  .tl-brand-mark { width: 34px; height: 34px; flex-basis: 34px; }
  .tl-brand-copy small { display: none; }
  .tl-portal-link { font-size: 11px; }
  .tl-layout { width: calc(100% - 28px); padding-top: 28px; }
  .tl-story h1 { margin-top: 20px; font-size: clamp(40px, 12vw, 54px); }
  .tl-story > p { font-size: 13px; line-height: 1.75; }
  .tl-points { grid-template-columns: 1fr; gap: 8px; margin-top: 22px; }
  .tl-points > div { min-height: 0; padding: 12px 14px; }
  .tl-points span { margin-top: 3px; }
  .tl-story-foot > span:last-child { display: none; }
  .tl-card { padding: 24px 20px; border-radius: 18px; }
  .tl-card-head h2, #kc-page-title { font-size: 24px; }
}
@media (prefers-reduced-motion: reduce) {
  .tl-story > *, .tl-card-wrap { animation: none !important; opacity: 1 !important; transform: none !important; }
  .tl-orb { animation: none !important; }
  * { scroll-behavior: auto !important; transition-duration: .01ms !important; }
}
