:root {
  color-scheme: light;
  --bg: #f6f8fc;
  --surface: #ffffff;
  --surface-soft: #f9fbff;
  --ink: #17212e;
  --text: #1b2635;
  --muted: #657084;
  --dim: #9aa4b5;
  --line: #dfe5ef;
  --line-strong: #cbd5e4;
  --blue: #1769ff;
  --blue-2: #2c82ff;
  --blue-soft: #eaf2ff;
  --success: #13a06f;
  --warning: #d88918;
  --danger: #d94b4b;
  --shadow: 0 24px 70px rgba(24, 39, 75, 0.10);
  --shadow-soft: 0 12px 34px rgba(24, 39, 75, 0.08);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 13px;
  --font: "Inter", "Microsoft YaHei", "PingFang SC", "Segoe UI", Arial, sans-serif;
  font-family: var(--font);
}

* { box-sizing: border-box; }

body {
  min-height: 100vh;
  margin: 0;
  overflow-x: hidden;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255,255,255,.82), rgba(246,248,252,.94)),
    radial-gradient(circle at 72% 18%, rgba(23,105,255,.08), transparent 30%),
    var(--bg);
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #050b18;
  --surface: rgba(8, 16, 31, .88);
  --surface-soft: rgba(15, 29, 55, .78);
  --ink: #f6f9ff;
  --text: #eef4ff;
  --muted: #aab8d2;
  --dim: #7484a1;
  --line: rgba(126, 156, 214, .18);
  --line-strong: rgba(147, 172, 216, .28);
  --blue: #1769ff;
  --blue-2: #4f91ff;
  --blue-soft: rgba(23,105,255,.18);
  --shadow: 0 28px 90px rgba(0, 0, 0, .42);
  --shadow-soft: 0 16px 44px rgba(0, 0, 0, .28);
  background:
    radial-gradient(circle at 78% 10%, rgba(23,105,255,.34), transparent 22%),
    radial-gradient(circle at 86% 46%, rgba(42,126,255,.22), transparent 20%),
    linear-gradient(180deg, #061125 0%, #050b18 44%, #030711 100%);
}

.cinema-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(23,33,46,.045) 1px, transparent 1px),
    linear-gradient(rgba(23,33,46,.035) 1px, transparent 1px);
  background-size: 96px 96px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.55), transparent 72%);
}

body[data-theme="dark"] .cinema-bg {
  background:
    linear-gradient(115deg, transparent 0 43%, rgba(35,107,255,.15) 44%, transparent 48%),
    linear-gradient(145deg, transparent 0 58%, rgba(82,141,255,.12) 59%, transparent 63%),
    linear-gradient(90deg, rgba(134,169,232,.055) 1px, transparent 1px),
    linear-gradient(rgba(134,169,232,.04) 1px, transparent 1px);
  background-size: 100% 100%, 100% 100%, 96px 96px, 96px 96px;
  mask-image: linear-gradient(180deg, rgba(0,0,0,.88), transparent 84%);
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button, input, select, textarea, a {
  transition: transform .18s ease, border-color .18s ease, background .18s ease, box-shadow .18s ease, color .18s ease, opacity .18s ease;
}
.hidden, [hidden] { display: none !important; }

.login-screen:not(.hidden) ~ .app-shell .bob-widget {
  display: none;
}

.app-shell {
  position: relative;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: calc(100vh - 36px);
  margin: 18px;
  border: 1px solid var(--line);
  border-radius: 30px;
  overflow: hidden;
  background: rgba(255,255,255,.76);
  box-shadow: var(--shadow);
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: minmax(420px, 1.08fr) minmax(390px, .72fr);
  align-items: center;
  gap: 34px;
  padding: clamp(26px, 5vw, 70px) clamp(28px, 9vw, 130px);
  background: rgba(246, 248, 252, .88);
  backdrop-filter: blur(18px);
}

.login-showcase {
  position: relative;
  overflow: hidden;
  min-height: min(640px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: rgba(255,255,255,.88);
  box-shadow: var(--shadow);
  padding: clamp(34px, 5vw, 54px);
}

.login-showcase::after {
  content: "";
  position: absolute;
  right: -110px;
  bottom: -120px;
  width: 350px;
  height: 350px;
  border: 1px solid #dbe6f7;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(23,105,255,.05), transparent);
}

.login-showcase-logo {
  width: 190px;
  height: 132px;
  object-fit: contain;
  object-position: left center;
  mix-blend-mode: multiply;
  margin-bottom: 32px;
}

.login-pill {
  width: max-content;
  max-width: 100%;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 26px;
  border: 1px solid #cfe0fa;
  border-radius: 999px;
  background: #f5f9ff;
  color: var(--blue);
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 900;
}

.login-pill::before {
  content: "";
  width: 26px;
  height: 2px;
  background: var(--blue);
}

.login-showcase h1 {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: 0;
  color: var(--ink);
  font-size: clamp(42px, 5.3vw, 72px);
  line-height: .94;
  font-weight: 950;
}

.login-copy {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 22px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.75;
}

.login-feature-grid {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 52px;
}

.login-feature-grid article {
  min-height: 98px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #f8fbff;
  padding: 16px;
}

.login-feature-grid strong,
.login-feature-grid span {
  display: block;
}

.login-feature-grid strong {
  color: var(--ink);
  font-size: 16px;
}

.login-feature-grid span {
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.login-card {
  width: 100%;
  max-width: 460px;
  display: grid;
  gap: 15px;
  justify-self: center;
  overflow: hidden;
  padding: 0 36px 30px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h1, .screen-head h2, .panel h3 {
  margin: 0;
  letter-spacing: 0;
}

.login-card h1 {
  color: var(--ink);
  font-size: 34px;
  line-height: 1.15;
}

.login-card-head {
  padding-top: 22px;
}

.login-card-head p {
  margin: 8px 0 0;
  color: var(--muted);
}

.login-role-tabs {
  display: grid;
  grid-template-columns: 1fr;
  margin: 0 -36px 12px;
  padding: 8px 8px 8px;
  border-bottom: 1px solid var(--line);
  background: #f7faff;
  color: transparent;
  font-size: 0;
}

.login-role-tabs .custom-select {
  width: 100%;
}

.login-role-tabs .select-trigger {
  display: none;
}

.login-role-tabs .native-select {
  position: absolute;
}

.login-role-tabs .select-menu {
  position: static;
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  max-height: none;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.login-role-tabs .select-option {
  min-height: 46px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  color: var(--muted);
  background: transparent;
  font-size: 15px;
}

.login-role-tabs .select-option.active {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 12px 24px rgba(23,33,46,.16);
}

.login-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: var(--muted);
  font-size: 13px;
}

.login-remember {
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.login-remember input {
  width: 18px;
  min-height: 18px;
  height: 18px;
  padding: 0;
}

.login-note {
  display: grid;
  gap: 6px;
  margin: 0;
  border: 1px solid #cfe0fa;
  border-radius: 16px;
  background: #f3f8ff;
  padding: 14px;
}

.login-note strong {
  color: var(--ink);
}

.login-note span {
  color: var(--muted);
}

.login-note, .screen-head span, .page-title p, small {
  color: var(--muted);
  line-height: 1.65;
}

body[data-theme="dark"] .login-screen {
  background:
    radial-gradient(circle at 18% 16%, rgba(23,105,255,.24), transparent 28%),
    radial-gradient(circle at 78% 8%, rgba(77,145,255,.18), transparent 26%),
    linear-gradient(135deg, #050b18 0%, #071326 52%, #030711 100%);
  backdrop-filter: blur(18px);
}

body[data-theme="dark"] .login-showcase {
  border-color: rgba(137, 165, 221, .18);
  background:
    linear-gradient(145deg, rgba(9, 19, 39, .96), rgba(5, 11, 24, .94)),
    radial-gradient(circle at 16% 14%, rgba(23,105,255,.16), transparent 34%);
  box-shadow: 0 28px 80px rgba(0,0,0,.42);
}

body[data-theme="dark"] .login-showcase::after {
  border-color: rgba(91,145,255,.18);
  background: radial-gradient(circle, rgba(23,105,255,.13), transparent 62%);
}

body[data-theme="dark"] .login-showcase-logo {
  mix-blend-mode: normal;
  width: 214px;
  filter: drop-shadow(0 12px 30px rgba(23,105,255,.16));
}

body[data-theme="dark"] .login-pill {
  border-color: rgba(91,145,255,.35);
  background: rgba(23,105,255,.10);
  color: #78adff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
}

body[data-theme="dark"] .login-pill::before {
  background: #5b91ff;
}

body[data-theme="dark"] .login-showcase h1 {
  color: #f6f9ff;
  text-shadow: 0 16px 45px rgba(0,0,0,.35);
}

body[data-theme="dark"] .login-copy {
  color: #b6c3da;
}

body[data-theme="dark"] .login-feature-grid article {
  border-color: rgba(137, 165, 221, .17);
  background: rgba(11, 23, 45, .74);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.045);
}

body[data-theme="dark"] .login-feature-grid strong {
  color: #eef4ff;
}

body[data-theme="dark"] .login-feature-grid span {
  color: #93a4c1;
}

body[data-theme="dark"] .login-card {
  border-color: rgba(137, 165, 221, .22);
  background:
    linear-gradient(180deg, rgba(10, 21, 42, .98), rgba(6, 13, 28, .97));
  box-shadow: 0 30px 90px rgba(0,0,0,.46), inset 0 1px 0 rgba(255,255,255,.05);
}

body[data-theme="dark"] .login-card h1 {
  color: #f7fbff;
}

body[data-theme="dark"] .login-card-head p,
body[data-theme="dark"] .login-card label,
body[data-theme="dark"] .login-row,
body[data-theme="dark"] .login-note span {
  color: #aebbd4;
}

body[data-theme="dark"] .login-role-tabs {
  border-bottom-color: rgba(137, 165, 221, .18);
  background: rgba(5, 11, 24, .8);
}

body[data-theme="dark"] .login-role-tabs .select-option {
  color: #93a4c1;
}

body[data-theme="dark"] .login-role-tabs .select-option:hover {
  background: rgba(23,105,255,.10);
  color: #d9e6ff;
}

body[data-theme="dark"] .login-role-tabs .select-option.active {
  color: #fff;
  background: #1769ff;
  box-shadow: 0 14px 32px rgba(23,105,255,.28);
}

body[data-theme="dark"] .login-card input,
body[data-theme="dark"] .login-card select {
  background: rgba(4, 10, 22, .86);
  border-color: rgba(137, 165, 221, .28);
  color: #f2f6ff;
}

body[data-theme="dark"] .login-card input::placeholder {
  color: #6f7f9d;
}

body[data-theme="dark"] .login-card input:focus,
body[data-theme="dark"] .login-card select:focus {
  border-color: rgba(91,145,255,.72);
  box-shadow: 0 0 0 4px rgba(23,105,255,.18);
}

body[data-theme="dark"] .login-remember input {
  background: rgba(4, 10, 22, .86);
}

body[data-theme="dark"] .login-row span {
  color: #9caecc;
}

body[data-theme="dark"] .login-note {
  border-color: rgba(91,145,255,.25);
  background: rgba(23,105,255,.09);
}

body[data-theme="dark"] .login-note strong {
  color: #eaf2ff;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 24px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, #f8fbff);
}

body[data-theme="dark"] .app-shell {
  background: rgba(4, 10, 22, .78);
  border-color: rgba(137, 165, 221, .18);
}

body[data-theme="dark"] .sidebar {
  background: linear-gradient(180deg, rgba(5, 12, 27, .96), rgba(4, 9, 20, .9));
}

.brand, .sidebar-footer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-logo {
  width: 178px;
  height: 78px;
  object-fit: contain;
  object-position: left center;
}

.brand > div { display: none; }

.brand-mark, .user-avatar {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 900;
  box-shadow: var(--shadow-soft);
}

.brand strong, .brand span, .sidebar-footer strong, .sidebar-footer span {
  display: block;
}

.brand strong {
  color: var(--ink);
  font-size: 22px;
  font-weight: 500;
  line-height: 1;
}

.brand span {
  margin-top: 5px;
  color: var(--dim);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .22em;
}

.sidebar-footer span {
  color: var(--muted);
  font-size: 12px;
}

.nav-list {
  display: grid;
  gap: 7px;
}

.nav-section {
  margin: 12px 10px 5px;
  color: var(--dim);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.nav-item {
  min-height: 46px;
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  gap: 12px;
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: var(--muted);
  padding: 0 12px;
  text-align: left;
  font-weight: 850;
  white-space: nowrap;
}

.nav-item svg {
  width: 21px;
  height: 21px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item:hover {
  color: var(--ink);
  background: var(--blue-soft);
}

.nav-item.active {
  color: #fff;
  background: var(--ink);
  box-shadow: 0 12px 28px rgba(23,33,46,.16);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  grid-template-columns: 46px 1fr;
}

.theme-toggle {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 900;
}

.theme-toggle:hover {
  color: var(--ink);
  border-color: rgba(23,105,255,.38);
  background: var(--blue-soft);
}

.bob-widget {
  position: fixed;
  left: 24px;
  bottom: 28px;
  z-index: 150;
  display: grid;
  gap: 10px;
  width: max-content;
  touch-action: none;
}

.bob-pet {
  display: grid;
  justify-items: center;
  gap: 6px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  padding: 0;
  font-weight: 950;
  transform-style: preserve-3d;
  cursor: grab;
  user-select: none;
  box-shadow: none;
  transition: transform .18s ease;
}

.bob-pet:active,
.bob-widget.dragging .bob-pet {
  cursor: grabbing;
  transform: scale(.985);
  box-shadow: none;
}

.bob-pet:hover .bob-head {
  transform: rotate(-3deg) translateY(-1px);
}

.bob-scene {
  position: relative;
  width: 120px;
  height: 112px;
  display: block;
  perspective: 360px;
  animation: bobIdle 7.2s ease-in-out infinite;
}

.bob-body,
.bob-head,
.bob-ear,
.bob-eye,
.bob-muzzle,
.bob-nose,
.bob-mouth,
.bob-leg {
  position: absolute;
  display: block;
}

.bob-body {
  left: 34px;
  bottom: 7px;
  width: 58px;
  height: 34px;
  border-radius: 26px 26px 17px 17px;
  background: #f1d9b7;
  box-shadow: none;
}

.bob-head {
  left: 12px;
  top: 30px;
  width: 96px;
  height: 70px;
  border-radius: 38px 38px 30px 30px;
  background: #f3d9b1;
  border: 3px solid #2a3140;
  box-shadow: none;
  transition: transform .25s ease;
  z-index: 2;
}

.bob-head::before,
.bob-head::after {
  content: "";
  position: absolute;
  top: 25px;
  width: 18px;
  height: 5px;
  border-top: 3px solid rgba(43, 48, 59, .72);
  border-radius: 999px;
}

.bob-head::before { left: 21px; transform: rotate(-13deg); }
.bob-head::after { right: 21px; transform: rotate(13deg); }

.bob-ear {
  top: -33px;
  width: 33px;
  height: 58px;
  border-radius: 58% 72% 43% 48% / 76% 82% 34% 42%;
  background: #f3d9b1;
  border: 3px solid #2a3140;
  border-bottom-color: transparent;
  box-shadow: none;
  animation: bobEar 8.5s ease-in-out infinite;
  transform: var(--ear-pose);
  transform-origin: 50% 100%;
  z-index: -1;
  overflow: hidden;
}

.bob-ear::after {
  content: "";
  position: absolute;
  left: 8px;
  top: 8px;
  width: 13px;
  height: 34px;
  border-radius: 64% 70% 40% 46% / 78% 82% 36% 40%;
  background: #f1aaa0;
  transform: rotate(-3deg);
}

.bob-ear-left {
  left: 4px;
  --ear-pose: rotate(-31deg) skewY(-5deg);
}

.bob-ear-right {
  right: 4px;
  --ear-pose: rotate(31deg) skewY(5deg) scaleX(.96);
  animation-delay: 1.8s;
}

.bob-ear-right::after {
  left: 9px;
  transform: rotate(5deg);
}

.bob-eye {
  top: 34px;
  width: 18px;
  height: 7px;
  border-radius: 999px;
  background: transparent;
  border-bottom: 4px solid #222938;
  box-shadow: none;
  animation: bobBlink 6.8s infinite;
  overflow: hidden;
}

.bob-eye::after {
  display: none;
}

.bob-eye-left { left: 25px; transform: rotate(-9deg); }
.bob-eye-right { right: 25px; transform: rotate(9deg); }

.bob-muzzle {
  left: 25px;
  top: 42px;
  width: 46px;
  height: 27px;
  border-radius: 20px 20px 18px 18px;
  background: #d4b391;
  box-shadow: none;
}

.bob-muzzle::after {
  content: "";
  position: absolute;
  left: 7px;
  top: 10px;
  width: 3px;
  height: 3px;
  border-radius: 999px;
  background: rgba(55, 38, 33, .45);
  box-shadow: 7px 2px 0 rgba(55, 38, 33, .38), 23px 1px 0 rgba(55, 38, 33, .4), 29px 5px 0 rgba(55, 38, 33, .34);
}

.bob-nose {
  left: 41px;
  top: 42px;
  width: 16px;
  height: 12px;
  border-radius: 48%;
  background: #24242b;
  box-shadow: none;
}

.bob-mouth {
  left: 48px;
  top: 55px;
  width: 21px;
  height: 11px;
  border-right: 2px solid #3b2d2b;
  border-bottom: 2px solid #3b2d2b;
  border-radius: 0 0 12px 0;
  transform: rotate(18deg);
}

.bob-leg {
  bottom: 1px;
  width: 16px;
  height: 19px;
  border-radius: 9px 9px 6px 6px;
  background: #e5c59c;
}

.bob-leg-left { left: 45px; }
.bob-leg-right { right: 39px; }

.bob-name {
  display: none;
  color: var(--muted);
  font-size: 12px;
  letter-spacing: .04em;
}

.bob-panel {
  position: absolute;
  left: 0;
  bottom: calc(100% + 12px);
  z-index: 120;
  width: min(360px, calc(100vw - 36px));
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 12px;
}

.bob-widget[data-panel-position="below"] .bob-panel {
  top: calc(100% + 12px);
  bottom: auto;
}

.bob-widget[data-panel-align="right"] .bob-panel {
  left: auto;
  right: 0;
}

.bob-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.bob-panel-head strong,
.bob-panel-head span {
  display: block;
}

.bob-panel-head span {
  color: var(--muted);
  font-size: 12px;
}

.bob-panel-head button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 20px;
}

.bob-messages {
  max-height: 300px;
  overflow: auto;
  display: grid;
  gap: 9px;
}

.bob-message {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
  padding: 10px;
}

.bob-message.user {
  background: var(--blue);
  color: #fff;
}

.bob-message strong {
  display: block;
  margin-bottom: 5px;
  font-size: 12px;
}

.bob-message p {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
}

.bob-matches {
  display: grid;
  gap: 6px;
  margin-top: 9px;
}

.bob-matches button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  color: var(--blue);
  text-align: left;
  padding: 0 10px;
  font-weight: 850;
}

.bob-form {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
}

.bob-form input {
  min-height: 42px;
}

.bob-form .primary-action {
  min-height: 42px;
}

.voice-action {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
  color: var(--blue);
  padding: 0 13px;
  font-weight: 900;
}

.voice-action:hover,
.voice-action.listening {
  border-color: rgba(23,105,255,.34);
  background: var(--blue-soft);
  color: var(--blue);
}

.voice-action.listening {
  box-shadow: 0 0 0 4px rgba(23,105,255,.12);
}

body[data-theme="dark"] .bob-pet,
body[data-theme="dark"] .bob-panel,
body[data-theme="dark"] .bob-message,
body[data-theme="dark"] .bob-matches button,
body[data-theme="dark"] .voice-action {
  background: rgba(7, 15, 31, .92);
  border-color: rgba(137, 165, 221, .18);
}

body[data-theme="dark"] .bob-pet {
  background: transparent;
  border-color: transparent;
}

body[data-theme="dark"] .bob-message.user {
  background: rgba(23,105,255,.72);
}

@keyframes bobIdle {
  0%, 100% { transform: translateY(0) scale(1); }
  50% { transform: translateY(-3px) scale(1.012); }
}

@keyframes bobEar {
  0%, 90%, 100% { filter: none; transform: var(--ear-pose); }
  93% { filter: brightness(1.05); transform: var(--ear-pose) translateY(-1px) rotate(1deg); }
}

@keyframes bobBlink {
  0%, 91%, 100% { opacity: 1; }
  94% { opacity: .35; }
}

.sidebar-logout {
  grid-column: 1 / -1;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 850;
}

.sidebar-logout:hover {
  border-color: rgba(217,75,75,.32);
  color: var(--danger);
  background: #fff7f7;
}

.workspace {
  min-width: 0;
  padding: 28px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(280px, 460px);
  gap: 18px;
  align-items: center;
  margin-bottom: 26px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 10px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .18em;
  text-transform: uppercase;
}

.eyebrow::before {
  content: "";
  width: 34px;
  height: 2px;
  background: var(--blue);
}

.login-card .eyebrow::before,
.panel .eyebrow::before { display: none; }

.page-title h1 {
  margin: 0;
  color: var(--ink);
  font-size: clamp(30px, 4vw, 58px);
  line-height: .95;
  font-weight: 950;
}

.page-title p {
  max-width: 720px;
  margin: 14px 0 0;
  font-size: 16px;
}

.global-search {
  min-height: 50px;
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 0 16px;
  box-shadow: var(--shadow-soft);
}

.global-search svg {
  width: 19px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
}

.global-search:focus-within {
  border-color: rgba(23,105,255,.45);
  box-shadow: 0 0 0 4px rgba(23,105,255,.10), var(--shadow-soft);
}

.global-search input {
  min-height: 48px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
}

.global-search input:focus {
  border-color: transparent;
  box-shadow: none;
}

.global-search button {
  min-height: 36px;
  border: 1px solid var(--blue);
  border-radius: 12px;
  background: var(--blue);
  color: #fff;
  padding: 0 15px;
  font-size: 13px;
  font-weight: 900;
}

.global-search button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 22px rgba(23,105,255,.20);
}

.pill, .soft-badge, .panel-head span {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 5px 10px;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 800;
}

.view { display: none; }
.view.active { display: block; animation: viewIn .28s ease both; }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

.screen-head, .panel-head {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.screen-head h2 {
  color: var(--ink);
  font-size: clamp(30px, 5vw, 56px);
  line-height: .96;
  font-weight: 950;
}

.screen-head span {
  display: block;
  margin-top: 8px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

body[data-theme="dark"] .panel,
body[data-theme="dark"] .metric-card,
body[data-theme="dark"] .table-wrap,
body[data-theme="dark"] .region-card,
body[data-theme="dark"] .task-card,
body[data-theme="dark"] .catalog-row,
body[data-theme="dark"] .login-card,
body[data-theme="dark"] .account-management-card {
  background: rgba(7, 15, 31, .72);
  border-color: rgba(137, 165, 221, .18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), var(--shadow-soft);
}

body[data-theme="dark"] .login-screen .login-card {
  background: linear-gradient(180deg, rgba(10, 21, 42, .98), rgba(6, 13, 28, .97));
  border-color: rgba(137, 165, 221, .22);
  box-shadow: 0 30px 90px rgba(0,0,0,.46), inset 0 1px 0 rgba(255,255,255,.05);
}

body[data-theme="dark"] .screen-head,
body[data-theme="dark"] .topbar {
  border-color: rgba(137, 165, 221, .16);
}

.panel h3 {
  color: var(--ink);
  font-size: 18px;
}

.home-hero {
  display: grid;
  grid-template-columns: minmax(260px, .9fr) repeat(2, minmax(170px, .5fr)) minmax(300px, .9fr);
  gap: 14px;
  margin-bottom: 18px;
}

.hero-card, .metric-card {
  position: relative;
  overflow: hidden;
  min-height: 148px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 20px;
}

.hero-card {
  background: linear-gradient(135deg, var(--ink), #263244);
  color: #fff;
}

.hero-card::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 170px;
  height: 170px;
  border-radius: 50%;
  border: 32px solid rgba(23,105,255,.28);
}

.hero-card strong, .metric-card strong {
  display: block;
  margin-top: 14px;
  font-size: 48px;
  line-height: 1;
}

.hero-kicker, .metric-card span {
  color: var(--muted);
  font-weight: 900;
}

.hero-card .hero-kicker,
.hero-card p { color: rgba(255,255,255,.72); }
.metric-card small { display: block; margin-top: 10px; }

.hero-bars {
  position: absolute;
  right: 20px;
  bottom: 18px;
  display: flex;
  align-items: end;
  gap: 7px;
  height: 70px;
}

.hero-bars i {
  width: 12px;
  border-radius: 999px;
  background: linear-gradient(180deg, #58a0ff, var(--blue));
}
.hero-bars i:nth-child(1) { height: 30%; }
.hero-bars i:nth-child(2) { height: 62%; }
.hero-bars i:nth-child(3) { height: 45%; }
.hero-bars i:nth-child(4) { height: 82%; }
.hero-bars i:nth-child(5) { height: 56%; }

.client-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 390px);
  gap: 16px;
  align-items: start;
}

.client-table-panel { min-width: 0; }
.filter-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.filter-bar .select-trigger {
  min-height: 34px;
  border-color: transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 0 10px;
  box-shadow: none;
}

.filter-bar .select-trigger:hover,
.filter-bar .custom-select.open .select-trigger {
  border-color: transparent;
  background: var(--blue-soft);
  color: var(--blue);
  box-shadow: none;
}

.filter-bar .select-trigger svg {
  width: 16px;
  height: 16px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input, select, textarea {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 10px 13px;
  outline: none;
}

body[data-theme="dark"] input,
body[data-theme="dark"] select,
body[data-theme="dark"] textarea,
body[data-theme="dark"] .select-trigger,
body[data-theme="dark"] .select-menu,
body[data-theme="dark"] .global-search,
body[data-theme="dark"] .ghost-action,
body[data-theme="dark"] .sidebar-logout {
  background: rgba(6, 13, 27, .82);
  border-color: rgba(137, 165, 221, .2);
  color: var(--text);
}

body[data-theme="dark"] .custom-select.open .select-trigger {
  border-color: rgba(68,134,255,.42);
  box-shadow: 0 0 0 3px rgba(23,105,255,.12);
}

textarea {
  min-height: 96px;
  resize: vertical;
}

input::placeholder, textarea::placeholder { color: var(--dim); }
input:focus, select:focus, textarea:focus {
  border-color: rgba(23,105,255,.56);
  box-shadow: 0 0 0 4px rgba(23,105,255,.10);
}

.custom-select {
  position: relative;
  min-width: 152px;
  isolation: isolate;
}
.filter-bar .custom-select { min-width: 138px; }
.form-grid .custom-select,
.task-form .custom-select,
.login-card .custom-select { width: 100%; }

.native-select {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  opacity: 0;
  pointer-events: none;
}

.select-trigger {
  width: 100%;
  min-height: 44px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 18px;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  color: var(--text);
  padding: 0 13px 0 15px;
  text-align: left;
  box-shadow: none;
}

.select-trigger span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 850;
}

.select-trigger svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.custom-select.open .select-trigger {
  border-color: rgba(23,105,255,.50);
  box-shadow: 0 0 0 4px rgba(23,105,255,.10);
}

.custom-select.open .select-trigger svg { transform: rotate(180deg); }

.select-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  display: none;
  max-height: 260px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.custom-select.open .select-menu {
  display: grid;
  gap: 4px;
}

.select-option {
  min-height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  padding: 0 12px;
  text-align: left;
  font-weight: 800;
}

.select-option:hover,
.select-option.active {
  color: var(--blue);
  background: var(--blue-soft);
}

body[data-theme="dark"] .select-option:hover,
body[data-theme="dark"] .select-option.active {
  color: #dbe8ff;
  background: rgba(23,105,255,.14);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.form-grid textarea, .form-grid button { grid-column: 1 / -1; }

.primary-action, .ghost-action {
  min-height: 46px;
  border-radius: 14px;
  padding: 0 17px;
  font-weight: 900;
  white-space: nowrap;
}

.primary-action {
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #fff;
  box-shadow: 0 14px 28px rgba(23,105,255,.22);
}

.ghost-action {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--ink);
}

.primary-action:hover, .ghost-action:hover, .task-card:hover {
  transform: translateY(-1px);
}

body[data-theme="dark"] .ghost-action:hover,
body[data-theme="dark"] .theme-toggle:hover,
body[data-theme="dark"] .pagination-bar button:hover {
  border-color: rgba(91,145,255,.34);
  background: rgba(23,105,255,.13);
  color: #eef5ff;
  box-shadow: 0 12px 26px rgba(0,0,0,.18);
}

body[data-theme="dark"] .primary-action:hover,
body[data-theme="dark"] .pagination-bar button.active {
  background: #1f74ff;
  box-shadow: 0 14px 30px rgba(23,105,255,.24);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

table {
  width: 100%;
  min-width: 900px;
  border-collapse: collapse;
}

th, td {
  padding: 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 12px;
  font-weight: 900;
}

td strong, td small { display: block; }
td small {
  color: var(--muted);
  margin-top: 4px;
}

tbody tr:hover { background: #fbfdff; }

body[data-theme="dark"] tbody tr:hover {
  background: rgba(23,105,255,.07);
}

tbody tr.search-hit {
  position: relative;
  background: linear-gradient(90deg, rgba(19,160,111,.13), rgba(23,105,255,.06));
  box-shadow: inset 4px 0 0 var(--success);
}

tbody tr.search-hit:hover {
  background: linear-gradient(90deg, rgba(19,160,111,.18), rgba(23,105,255,.08));
}

.search-hit-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--success);
}

.search-hit-name::after {
  content: "匹配";
  border-radius: 999px;
  background: rgba(19,160,111,.12);
  color: var(--success);
  padding: 3px 7px;
  font-size: 11px;
  font-weight: 900;
}

.team-stack {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 12px;
}

.link-button {
  border: 0;
  background: transparent;
  color: var(--blue);
  font-weight: 900;
  padding: 0;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.pagination-bar > div {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pagination-bar button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  padding: 0 12px;
  font-weight: 900;
}

.pagination-bar button:hover,
.pagination-bar button.active {
  border-color: rgba(23,105,255,.42);
  background: var(--blue);
  color: #fff;
}

.pagination-ellipsis {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  color: var(--dim);
  padding: 0 2px;
}

.pagination-jump {
  width: auto;
  min-height: 34px;
  display: inline-flex;
  grid-template-columns: none;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.pagination-jump input {
  width: 74px;
  min-height: 34px;
  border-radius: 999px;
  padding: 0 11px;
  text-align: center;
}

.pagination-jump button {
  min-height: 34px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.danger-link { color: var(--danger); }

.region-flow {
  display: grid;
  gap: 12px;
}

.region-flow-item {
  display: grid;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 10px;
}

.region-flow-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.region-flow-meta span {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.region-flow-meta i {
  width: 9px;
  height: 9px;
  border-radius: 999px;
}

.region-flow-meta b { color: var(--ink); }

.region-flow-track {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8eef7;
}

.region-flow-track em {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.task-command {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr);
  gap: 16px;
  margin-bottom: 16px;
}

.task-create-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 14px;
}

.task-create-head span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.task-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.task-form input[type="hidden"] { display: none; }
.task-form button { grid-column: auto; }

.task-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.task-column {
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(255,255,255,.92);
  padding: 16px;
  box-shadow: var(--shadow-soft);
}

body[data-theme="dark"] .task-column {
  background: rgba(7, 15, 31, .66);
  border-color: rgba(137, 165, 221, .18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.04), var(--shadow-soft);
}

.task-column.featured {
  border-color: rgba(23,105,255,.35);
  background: linear-gradient(180deg, #f4f8ff, #fff);
}

body[data-theme="dark"] .task-column.featured {
  border-color: rgba(68,134,255,.36);
  background: linear-gradient(180deg, rgba(14, 33, 67, .78), rgba(7, 15, 31, .68));
}

.task-column-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.task-column-head h3 { margin: 0; color: var(--ink); }

.task-column-head span {
  min-width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 900;
}

.task-card {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
  padding: 14px;
  box-shadow: 0 8px 18px rgba(24,39,75,.05);
}

body[data-theme="dark"] .task-card {
  background: rgba(15, 27, 49, .82);
  border-color: rgba(137, 165, 221, .18);
  box-shadow: 0 14px 30px rgba(0,0,0,.22);
}

.task-card span, .task-card small, .empty-text { color: var(--muted); }

body[data-theme="dark"] .empty-text {
  color: #8fa1c1;
}

.task-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.task-card-top b {
  border-radius: 999px;
  background: var(--blue-soft);
  color: var(--blue);
  padding: 4px 8px;
  font-size: 11px;
}

body[data-theme="dark"] .task-card-top b {
  background: rgba(23,105,255,.18);
  color: #63a2ff;
}

.task-actions {
  display: flex;
  gap: 12px;
  margin-top: 4px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.region-grid, .planner-grid, .admin-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.region-card, .plan-block {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  padding: 18px;
  box-shadow: var(--shadow-soft);
}

.region-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.region-card-head h3 {
  margin: 0;
  color: var(--ink);
  font-size: 22px;
}

.school-item {
  display: grid;
  gap: 6px;
  border-top: 1px solid var(--line);
  padding: 12px 0;
}

.school-item a {
  color: var(--blue);
  text-decoration: none;
  font-weight: 900;
}

.region-card ul {
  margin: 10px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.7;
}

.region-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.region-card-foot span {
  color: var(--muted);
  font-size: 12px;
}

.region-more {
  min-height: 36px;
  border: 1px solid var(--blue);
  border-radius: 999px;
  background: var(--blue);
  color: #fff;
  padding: 0 16px;
  font-weight: 900;
}

.region-more:hover {
  transform: translateX(2px);
  box-shadow: 0 10px 22px rgba(23,105,255,.18);
}

#regionDetail.view.active {
  animation: detailSlideIn .32s cubic-bezier(.2,.8,.2,1) both;
}

@keyframes detailSlideIn {
  from { opacity: 0; transform: translateX(18px); }
  to { opacity: 1; transform: none; }
}

.region-detail-panel {
  display: grid;
  gap: 16px;
}

.region-detail-toolbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.catalog-search input {
  min-height: 48px;
  border-radius: 16px;
}

.school-catalog {
  display: grid;
  gap: 10px;
}

.catalog-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  padding: 14px;
}

.catalog-row:hover {
  border-color: rgba(23,105,255,.28);
  background: #fff;
  box-shadow: 0 10px 24px rgba(24,39,75,.07);
}

.catalog-rank {
  display: grid;
  gap: 5px;
}

.catalog-rank strong {
  color: var(--blue);
}

.catalog-rank span,
.catalog-main p {
  color: var(--muted);
  font-size: 12px;
}

.catalog-main h3 {
  margin: 0;
  color: var(--ink);
  font-size: 18px;
}

.catalog-main p {
  margin: 6px 0 0;
}

.catalog-row a {
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--blue);
  text-decoration: none;
  padding: 0 13px;
  font-weight: 900;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

.large-textarea {
  min-height: 260px;
  margin: 12px 0;
}

.plan-output {
  display: grid;
  gap: 12px;
}

.ai-output {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 16px;
  line-height: 1.8;
  white-space: normal;
}

.plan-editor,
.evaluation-editor {
  width: 100%;
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface-soft);
  color: var(--text);
  padding: 16px;
  line-height: 1.8;
  resize: vertical;
}

.evaluation-editor {
  min-height: 300px;
  background: #fff;
}

.plan-evaluation {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.application-data-panel {
  display: grid;
  gap: 16px;
}

.application-toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.application-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.application-summary article {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 14px;
}

.application-summary span,
.application-summary strong {
  display: block;
}

.application-summary span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.application-summary strong {
  margin-top: 8px;
  color: var(--ink);
  font-size: 28px;
}

button:disabled {
  cursor: wait;
  opacity: .68;
  transform: none !important;
}

.chat-panel {
  display: grid;
  grid-template-rows: minmax(420px, 55vh) auto;
  gap: 12px;
}

body[data-theme="dark"] .chat-panel {
  background: rgba(7, 15, 31, .66);
  border-color: rgba(137, 165, 221, .18);
}

.chat-messages {
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.chat-message {
  max-width: 80%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 12px;
}

body[data-theme="dark"] .chat-message {
  background: rgba(13, 27, 53, .82);
  border-color: rgba(137, 165, 221, .18);
  color: var(--text);
}

.chat-message.teacher {
  align-self: flex-end;
  color: #fff;
  background: var(--ink);
}

body[data-theme="dark"] .chat-message.teacher {
  background: rgba(23,105,255,.16);
  border-color: rgba(91,145,255,.32);
}

.chat-message span {
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

.chat-message.teacher span,
.chat-message.teacher p { color: #fff; }

body[data-theme="dark"] .chat-message.teacher span {
  color: #78adff;
}

body[data-theme="dark"] .chat-message.teacher p {
  color: #edf4ff;
}

.chat-input {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
}

body[data-theme="dark"] .chat-input {
  background: transparent;
}

.account-form {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.admin-action-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.account-manage-panel {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.account-management-list {
  display: grid;
  gap: 10px;
}

.account-management-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface-soft);
  padding: 14px;
}

.account-management-card strong,
.account-management-card span,
.account-management-card small {
  display: block;
}

.account-management-card strong {
  color: var(--ink);
  font-size: 16px;
}

.account-management-card span {
  margin-top: 4px;
  color: var(--muted);
  font-weight: 800;
}

.account-management-card small {
  margin-top: 4px;
  color: var(--dim);
}

button:disabled {
  cursor: not-allowed;
  opacity: .45;
}

body[data-theme="dark"] .brand-logo {
  filter: brightness(1.14) contrast(1.08) drop-shadow(0 0 14px rgba(23,105,255,.22));
}

body[data-theme="dark"] .nav-item.active {
  background: linear-gradient(135deg, rgba(23,105,255,.72), rgba(16,57,130,.9));
  box-shadow: 0 12px 32px rgba(23,105,255,.24);
}

body[data-theme="dark"] .hero-card {
  background: linear-gradient(135deg, rgba(8, 18, 36, .96), rgba(13, 35, 75, .82));
}

body[data-theme="dark"] .sidebar-logout:hover {
  background: rgba(217,75,75,.14);
}

body[data-theme="dark"] .filter-bar .select-trigger:hover,
body[data-theme="dark"] .filter-bar .custom-select.open .select-trigger,
body[data-theme="dark"] .account-management-card:hover,
body[data-theme="dark"] .region-flow-item:hover {
  background: rgba(23,105,255,.10);
  border-color: rgba(91,145,255,.22);
  color: #eaf2ff;
}

@media (max-width: 1180px) {
  .login-screen {
    grid-template-columns: 1fr;
    align-items: start;
    overflow: auto;
  }
  .login-showcase {
    min-height: auto;
  }
  .login-feature-grid {
    grid-template-columns: 1fr;
    margin-top: 28px;
  }
  .app-shell { grid-template-columns: 1fr; }
  .sidebar {
    position: sticky;
    top: 0;
    z-index: 3;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
  }
  .brand {
    flex: 0 0 188px;
    min-width: 188px;
  }
  .brand-logo {
    width: 168px;
    height: 68px;
  }
  .nav-list {
    display: flex;
    align-items: center;
    flex: 0 0 auto;
  }
  .nav-item {
    flex: 0 0 auto;
    min-width: 124px;
  }
  .nav-section, .sidebar-footer { display: none; }
  .home-hero, .client-layout, .task-command, .task-board, .region-grid, .planner-grid, .admin-grid { grid-template-columns: 1fr; }
  .region-detail-toolbar,
  .application-toolbar,
  .catalog-row { grid-template-columns: 1fr; }
  .application-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .topbar { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  body {
    min-height: 100dvh;
  }

  button,
  input,
  select,
  textarea {
    font-size: 16px;
    touch-action: manipulation;
  }

  .login-screen {
    position: fixed;
    z-index: 100;
    display: block;
    min-height: 100dvh;
    overflow: auto;
    padding: 14px;
    background:
      radial-gradient(circle at 70% 0%, rgba(23,105,255,.10), transparent 34%),
      var(--bg);
  }

  .login-showcase,
  .login-card {
    width: 100%;
    max-width: none;
    border-radius: 22px;
  }

  .login-showcase {
    min-height: auto;
    display: grid;
    gap: 12px;
    margin-bottom: 12px;
    padding: 22px;
  }

  .login-showcase-logo {
    width: 156px;
    height: 86px;
    margin-bottom: 4px;
  }

  .login-pill {
    margin-bottom: 4px;
    padding: 7px 13px;
    font-size: 12px;
  }

  .login-showcase h1 {
    max-width: 330px;
    font-size: 34px;
    line-height: 1.02;
  }

  .login-copy {
    margin-top: 4px;
    font-size: 15px;
    line-height: 1.65;
  }

  .login-feature-grid {
    display: none;
  }

  .login-card {
    justify-self: stretch;
    padding: 0 20px 22px;
  }

  .login-card h1 {
    font-size: 30px;
  }

  .login-role-tabs {
    margin-left: -20px;
    margin-right: -20px;
  }

  .app-shell {
    display: block;
    min-height: 100dvh;
    margin: 0;
    border: 0;
    border-radius: 0;
    box-shadow: none;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    padding: 12px 14px 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
    overflow: visible;
  }

  .brand {
    min-width: 0;
    flex: 0 1 auto;
  }

  .brand-logo {
    width: 132px;
    height: 56px;
  }

  .theme-toggle {
    min-width: 86px;
    min-height: 44px;
    align-self: center;
    padding: 0 12px;
    font-size: 14px;
  }

  .bob-widget {
    left: 14px;
    bottom: 16px;
  }

  .bob-pet {
    grid-template-columns: auto 1fr;
    justify-items: start;
    align-items: center;
    padding: 8px 12px;
  }

  .bob-scene {
    width: 96px;
    height: 82px;
    transform-origin: left center;
  }

  .bob-name {
    font-size: 14px;
  }

  .bob-panel {
    position: fixed;
    left: 12px;
    right: 12px;
    bottom: 12px;
    width: auto;
    max-height: min(76dvh, 620px);
  }

  .bob-messages {
    max-height: 46dvh;
  }

  .bob-form {
    grid-template-columns: 1fr;
  }

  .nav-list {
    grid-column: 1 / -1;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding: 2px 0 4px;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
  }

  .nav-list::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    min-width: 96px;
    min-height: 46px;
    grid-template-columns: 20px 1fr;
    gap: 8px;
    border: 1px solid var(--line);
    border-radius: 999px;
    background: var(--surface);
    padding: 0 12px;
    scroll-snap-align: start;
    font-size: 13px;
  }

  .nav-item svg {
    width: 18px;
    height: 18px;
  }

  .nav-section,
  .sidebar-footer {
    display: none;
  }

  .workspace {
    padding: 16px 14px 22px;
  }

  .topbar {
    gap: 14px;
    margin-bottom: 18px;
    padding-bottom: 16px;
  }

  .page-title h1 {
    font-size: 36px;
    line-height: 1;
  }

  .page-title p:not(.eyebrow) {
    margin-top: 8px;
    font-size: 14px;
  }

  .global-search {
    min-height: 48px;
    grid-template-columns: 18px minmax(0, 1fr) 64px;
    border-radius: 15px;
    padding: 0 10px 0 13px;
  }

  .global-search input {
    min-width: 0;
  }

  .global-search button {
    min-height: 34px;
    padding: 0 12px;
  }

  .screen-head,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .screen-head h2 {
    font-size: 36px;
  }

  .home-hero {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
  }

  .hero-card,
  .distribution-panel {
    grid-column: 1 / -1;
  }

  .hero-card,
  .metric-card {
    min-height: 132px;
    padding: 16px;
    border-radius: 18px;
  }

  .hero-card strong,
  .metric-card strong {
    font-size: 42px;
  }

  .client-layout,
  .task-command,
  .task-board,
  .region-grid,
  .planner-grid,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .filter-bar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .filter-bar .custom-select {
    min-width: 0;
    width: 100%;
  }

  .table-wrap {
    border-radius: 16px;
    -webkit-overflow-scrolling: touch;
  }

  .form-grid,
  .task-form,
  .admin-action-row,
  .chat-input,
  .application-toolbar {
    grid-template-columns: 1fr;
  }

  .primary-action,
  .ghost-action {
    width: 100%;
  }

  .pagination-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .pagination-bar > div {
    justify-content: flex-start;
  }

  .pagination-bar button {
    min-height: 38px;
    padding: 0 14px;
  }

  .pagination-jump {
    width: 100%;
    flex-wrap: wrap;
  }

  .pagination-jump input {
    width: 86px;
    min-height: 38px;
  }

  .account-management-card {
    grid-template-columns: 1fr;
  }

  .application-summary {
    grid-template-columns: 1fr;
  }

  .chat-panel {
    grid-template-rows: minmax(320px, 52vh) auto;
  }

  .plan-editor,
  .evaluation-editor,
  .large-textarea {
    min-height: 300px;
  }
}
