:root {
  color-scheme: dark;
  --ink: #f8fbff;
  --muted: rgba(248, 251, 255, 0.66);
  --soft: rgba(248, 251, 255, 0.46);
  --line: rgba(255, 255, 255, 0.2);
  --glass: rgba(255, 255, 255, 0.012);
  --glass-strong: rgba(255, 255, 255, 0.05);
  --field: rgba(4, 13, 17, 0.22);
  --mint: #a9ffd4;
  --cyan: #9ceaff;
  --gold: #ffe1a4;
  --shadow: 0 30px 90px rgba(0, 0, 0, 0.22);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #08161c;
  overflow-x: hidden;
}

body::before {
  position: fixed;
  inset: -20%;
  z-index: -3;
  content: "";
  background:
    linear-gradient(102deg, rgba(156, 234, 255, 0.28), transparent 30%),
    linear-gradient(220deg, transparent 20%, rgba(255, 225, 164, 0.2) 46%, transparent 70%),
    linear-gradient(328deg, rgba(169, 255, 212, 0.2), transparent 36%);
  filter: blur(42px) saturate(125%);
  animation: drift 18s ease-in-out infinite alternate;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app {
  min-height: 100vh;
  padding: 28px;
}

.screen {
  display: none;
  min-height: calc(100vh - 56px);
}

.screen.is-active {
  display: grid;
}

body.home-mode {
  overflow: hidden;
  background: #e8f3f7;
}

body.home-mode::before {
  display: none;
}

body.home-mode .app {
  padding: 0;
}

.home-screen {
  position: relative;
  height: 100vh;
  height: 100svh;
  min-height: 620px;
  overflow: hidden;
  align-content: start;
  background:
    linear-gradient(180deg, rgba(2, 8, 10, 0.08) 0%, rgba(2, 8, 10, 0) 38%, rgba(2, 8, 10, 0.16) 100%),
    linear-gradient(90deg, rgba(3, 12, 14, 0.12) 0%, transparent 40%, rgba(3, 12, 14, 0.06) 100%),
    url("../lx-home-bg.png") center center / cover no-repeat;
  isolation: isolate;
}

.home-screen::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  content: "";
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.1) 0, transparent 126px),
    radial-gradient(circle at 50% 44%, rgba(255, 255, 255, 0.04) 0, transparent 50%, rgba(0, 0, 0, 0.12) 100%),
    linear-gradient(180deg, transparent 0, rgba(255, 255, 255, 0.08) 100%);
}

.home-screen > * {
  position: relative;
  z-index: 1;
}

.glass-panel,
.glass-nav {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.008)),
    var(--glass);
  box-shadow:
    var(--shadow),
    inset 0 1px 0 rgba(255, 255, 255, 0.44),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 42px rgba(255, 255, 255, 0.02);
  backdrop-filter: blur(36px) saturate(190%) contrast(112%);
  -webkit-backdrop-filter: blur(36px) saturate(190%) contrast(112%);
  isolation: isolate;
}

.glass-panel::before,
.glass-nav::before {
  position: absolute;
  inset: -55%;
  z-index: -1;
  content: "";
  opacity: 0.14;
  background:
    linear-gradient(122deg, transparent 9%, rgba(255, 255, 255, 0.36) 17%, transparent 28%),
    linear-gradient(286deg, transparent 20%, rgba(156, 234, 255, 0.2) 38%, transparent 60%),
    linear-gradient(24deg, transparent 34%, rgba(255, 255, 255, 0.14) 52%, transparent 74%);
  filter: url("#liquid-warp") blur(0.5px);
  transform: rotate(-8deg);
  animation: sheen 9s ease-in-out infinite alternate;
}

.glass-panel::after,
.glass-nav::after {
  position: absolute;
  inset: 0;
  pointer-events: none;
  content: "";
  border-radius: inherit;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.52),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1),
    inset 0 0 36px rgba(255, 255, 255, 0.018);
}

.site-nav {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(260px, 1.2fr) minmax(100px, 1fr);
  align-items: center;
  width: 100%;
  min-height: 72px;
  padding: 12px clamp(18px, 4vw, 54px);
  gap: 18px;
  border-top: 0;
  border-right: 0;
  border-left: 0;
  border-bottom-color: rgba(255, 255, 255, 0.14);
  border-radius: 0 0 8px 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.003)),
    rgba(255, 255, 255, 0.003);
  box-shadow:
    0 18px 62px rgba(0, 0, 0, 0.045),
    inset 0 1px 0 rgba(255, 255, 255, 0.52),
    inset 0 -1px 0 rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(42px) saturate(190%) contrast(112%);
  -webkit-backdrop-filter: blur(42px) saturate(190%) contrast(112%);
}

.brand-lockup {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.mini-mark {
  display: grid;
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.32);
  border-radius: 8px;
  color: #071319;
  background: linear-gradient(135deg, rgba(169, 255, 212, 0.92), rgba(156, 234, 255, 0.72) 52%, rgba(255, 225, 164, 0.86));
  font-size: 13px;
  font-weight: 900;
  box-shadow: 0 14px 34px rgba(16, 62, 73, 0.16);
}

.brand-title {
  min-width: 0;
}

.brand-title strong,
.user-chip strong {
  display: block;
  overflow: hidden;
  font-size: 15px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-title span,
.user-chip span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-center {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(18px, 4vw, 46px);
  color: rgba(248, 251, 255, 0.72);
  font-size: 13px;
}

.nav-center span {
  white-space: nowrap;
}

.glass-button,
.icon-button {
  display: inline-grid;
  min-width: 42px;
  height: 42px;
  padding: 0 15px;
  place-items: center;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.075), rgba(255, 255, 255, 0.008)),
    rgba(255, 255, 255, 0.008);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.36),
    0 12px 32px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.glass-button:hover,
.icon-button:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.018)),
    rgba(255, 255, 255, 0.018);
  transform: translateY(-1px);
}

.home-login {
  justify-self: end;
  min-width: 78px;
  font-weight: 700;
}

.home-composition {
  display: grid;
  align-items: end;
  justify-items: end;
  height: calc(100vh - 72px);
  height: calc(100svh - 72px);
  min-height: 548px;
  padding: clamp(24px, 5vh, 62px) clamp(18px, 4vw, 54px) clamp(20px, 4vh, 42px);
}

.motto-card {
  display: flex;
  align-items: center;
  justify-content: center;
  width: min(520px, calc(100vw - 36px));
  min-height: 86px;
  margin-right: clamp(0px, 5vw, 84px);
  margin-bottom: clamp(18px, 7vh, 86px);
  padding: 20px clamp(22px, 4vw, 38px);
  gap: clamp(14px, 3vw, 28px);
  color: rgba(248, 251, 255, 0.92);
  font-size: clamp(19px, 2.2vw, 30px);
  font-weight: 800;
  text-shadow: 0 12px 32px rgba(0, 0, 0, 0.18);
}

.motto-card i {
  display: block;
  width: clamp(26px, 5vw, 62px);
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(248, 251, 255, 0.62), transparent);
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 30;
  min-height: 100vh;
  min-height: 100svh;
  padding: 22px;
  place-items: center;
  background:
    radial-gradient(circle at 50% 42%, rgba(255, 255, 255, 0.08), transparent 34%),
    rgba(2, 8, 10, 0.16);
  backdrop-filter: blur(8px) saturate(120%);
  -webkit-backdrop-filter: blur(8px) saturate(120%);
  animation: modalFade 180ms ease both;
}

.login-card {
  width: min(420px, calc(100vw - 34px));
  padding: 58px 26px 28px;
  animation: modalRise 220ms ease both;
}

.modal-back {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 2;
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  color: rgba(248, 251, 255, 0.86);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.01)),
    rgba(255, 255, 255, 0.01);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.34),
    0 10px 28px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(18px) saturate(170%);
  -webkit-backdrop-filter: blur(18px) saturate(170%);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.modal-back:hover {
  border-color: rgba(255, 255, 255, 0.4);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, 0.13), rgba(255, 255, 255, 0.025)),
    rgba(255, 255, 255, 0.025);
  transform: translateY(-1px);
}

.login-form,
.admin-form {
  display: grid;
  gap: 14px;
}

.field {
  display: grid;
  gap: 8px;
}

.field span {
  color: rgba(248, 251, 255, 0.78);
  font-size: 13px;
}

.field input,
.field select {
  width: 100%;
  height: 48px;
  padding: 0 14px;
  color: var(--ink);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  outline: none;
  background: var(--field);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.field select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, rgba(248, 251, 255, 0.72) 50%),
    linear-gradient(135deg, rgba(248, 251, 255, 0.72) 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 20px,
    calc(100% - 12px) 20px;
  background-size: 6px 6px;
  background-repeat: no-repeat;
}

.field input:focus,
.field select:focus {
  border-color: rgba(156, 234, 255, 0.78);
  background-color: rgba(4, 13, 17, 0.32);
  box-shadow:
    0 0 0 4px rgba(156, 234, 255, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.12);
}

.primary-action {
  height: 48px;
  border: 0;
  border-radius: 8px;
  color: #061014;
  font-weight: 900;
  background: linear-gradient(135deg, var(--mint), var(--cyan) 54%, var(--gold));
  box-shadow: 0 18px 42px rgba(156, 234, 255, 0.22);
  transition: transform 160ms ease, box-shadow 160ms ease;
}

.primary-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 22px 52px rgba(156, 234, 255, 0.28);
}

.primary-action:disabled,
.icon-button:disabled {
  cursor: wait;
  opacity: 0.62;
  transform: none;
}

.message {
  min-height: 20px;
  color: rgba(248, 251, 255, 0.72);
  font-size: 13px;
}

.message.is-error {
  color: #ffd1c9;
}

.message.is-success {
  color: #b9ffd8;
}

.dashboard-screen {
  align-content: start;
  gap: 18px;
}

.dashboard-top {
  display: grid;
  grid-template-columns: auto minmax(160px, 360px) auto;
  align-items: center;
  gap: 16px;
  min-height: 64px;
  padding: 12px 14px;
}

.search {
  display: flex;
  align-items: center;
  height: 42px;
  padding: 0 12px;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
}

.search svg {
  flex: 0 0 auto;
  opacity: 0.72;
}

.search input {
  width: 100%;
  min-width: 0;
  color: var(--ink);
  border: 0;
  outline: 0;
  background: transparent;
}

.account {
  display: flex;
  align-items: center;
  justify-content: end;
  min-width: 0;
  gap: 10px;
}

.user-chip {
  min-width: 0;
  text-align: right;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 340px) 1fr;
  gap: 18px;
  min-height: calc(100vh - 166px);
}

.news-column,
.stage {
  min-height: 520px;
  padding: 18px;
}

.panel-head,
.stage-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-head {
  padding-bottom: 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.14);
}

.panel-head h2,
.stage-title h2 {
  margin: 0;
}

.panel-head h2 {
  font-size: 17px;
}

.stage-title h2 {
  font-size: 24px;
}

.stage-title span {
  color: var(--muted);
  font-size: 13px;
}

.count-badge,
.role-badge {
  min-width: 34px;
  padding: 5px 9px;
  color: #071318;
  text-align: center;
  border-radius: 8px;
  background: rgba(169, 255, 212, 0.86);
  font-size: 12px;
  font-weight: 800;
}

.role-badge {
  min-width: 58px;
  color: rgba(248, 251, 255, 0.88);
  background: rgba(255, 255, 255, 0.12);
}

.role-badge.is-admin {
  color: #061014;
  background: rgba(156, 234, 255, 0.84);
}

.empty-news {
  display: grid;
  min-height: 420px;
  place-items: center;
  align-content: center;
  text-align: center;
}

.empty-ring {
  display: grid;
  width: 88px;
  height: 88px;
  margin: 0 auto 18px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.04));
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.22),
    0 20px 44px rgba(0, 0, 0, 0.24);
}

.empty-news strong {
  display: block;
  font-size: 16px;
}

.empty-news span {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: 13px;
}

.stage {
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 18px;
}

.admin-panel {
  display: none;
  gap: 18px;
  grid-template-columns: minmax(240px, 320px) 1fr;
}

.admin-panel.is-visible {
  display: grid;
}

.admin-box {
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.admin-box h3 {
  margin: 0 0 14px;
  font-size: 15px;
}

.user-list {
  display: grid;
  gap: 10px;
  max-height: 360px;
  overflow: auto;
  padding-right: 4px;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 54px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(5, 12, 16, 0.2);
}

.user-row strong,
.user-row span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-row strong {
  font-size: 14px;
}

.user-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.blank-field {
  min-height: 100%;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.018));
}

@keyframes drift {
  from {
    transform: translate3d(-2%, -1%, 0) rotate(0deg);
  }
  to {
    transform: translate3d(2%, 1%, 0) rotate(3deg);
  }
}

@keyframes sheen {
  from {
    transform: translate3d(-3%, -1%, 0) rotate(-8deg);
  }
  to {
    transform: translate3d(3%, 2%, 0) rotate(7deg);
  }
}

@keyframes modalFade {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes modalRise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@media (max-width: 980px) {
  .admin-panel {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 840px) {
  .app {
    padding: 16px;
  }

  body.home-mode .app {
    padding: 0;
  }

  .screen {
    min-height: calc(100vh - 32px);
  }

  .home-screen {
    min-height: 560px;
    background-position: 56% center;
  }

  .site-nav {
    grid-template-columns: auto 1fr auto;
    min-height: 68px;
    padding: 10px 18px;
  }

  .nav-center {
    gap: 16px;
    font-size: 12px;
  }

  .home-composition {
    height: calc(100vh - 68px);
    height: calc(100svh - 68px);
    min-height: 492px;
    padding: 20px 16px 18px;
  }

  .motto-card {
    justify-self: center;
    margin-right: 0;
    margin-bottom: 32px;
  }

  .dashboard-top {
    grid-template-columns: 1fr auto;
  }

  .search {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .workspace {
    grid-template-columns: 1fr;
  }

  .news-column,
  .stage {
    min-height: 360px;
  }
}

@media (max-width: 520px) {
  .home-screen {
    min-height: 520px;
  }

  .site-nav {
    grid-template-columns: auto auto;
  }

  .nav-center {
    display: none;
  }

  .home-composition {
    min-height: 452px;
  }

  .motto-card {
    flex-direction: column;
    width: min(300px, calc(100vw - 32px));
    min-height: 132px;
    gap: 11px;
    font-size: 22px;
  }

  .motto-card i {
    width: 56px;
  }

  .user-chip {
    display: none;
  }

  .stage-title {
    align-items: start;
    flex-direction: column;
  }
}
