:root {
  --bg: #eaf4ff;
  --bg-soft: #f4f9ff;
  --text: #0d223d;
  --muted: #516e92;
  --line: rgba(79, 149, 243, 0.38);
  --card: rgba(255, 255, 255, 0.72);
  --accent: #3690ff;
  --accent-dark: #1f70ed;
  --accent-soft: rgba(63, 140, 255, 0.16);
  --glass-shadow: 0 16px 40px rgba(24, 88, 182, 0.16);
  --page-gap: clamp(16px, 1cm, 38px);
  --radius: 18px;
}

* { box-sizing: border-box; }
html { font-size: 16px; }
body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: "Manrope", "Inter", "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
  color: var(--text);
  text-rendering: optimizeLegibility;
  background:
    radial-gradient(circle at 15% 15%, rgba(152, 212, 255, 0.55), transparent 35%),
    radial-gradient(circle at 85% 5%, rgba(147, 176, 255, 0.45), transparent 32%),
    linear-gradient(150deg, #edf6ff 0%, #dcecff 45%, #eff7ff 100%);
  background-attachment: fixed;
}
a { color: var(--accent-dark); text-underline-offset: 2px; }
h1, h2, h3 {
  margin: 0;
  letter-spacing: 0.01em;
}
h1 { font-size: clamp(1.5rem, 2.2vw, 2rem); margin-bottom: .4rem; }
h2 { font-size: clamp(1.2rem, 1.7vw, 1.5rem); margin-bottom: .6rem; }
h3 { font-size: 1.06rem; }
p { margin: 0; }

button, input, select {
  font: inherit;
  font-size: .95rem;
  font-weight: 600;
  line-height: 1.2;
  padding: .66rem .82rem;
  border: 1px solid var(--line);
  border-radius: 12px;
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  transition: border-color .24s ease, box-shadow .24s ease, transform .24s ease, background-color .24s ease;
}
input, select {
  box-shadow: inset 0 1px 2px rgba(31, 85, 166, 0.06);
}
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  gap: .45rem;
  min-height: 42px;
  cursor: pointer;
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-dark) 100%);
  box-shadow: 0 8px 18px rgba(63, 140, 255, 0.3);
}
button:hover { transform: translateY(-1px); }
button:disabled {
  opacity: .64;
  transform: none;
  cursor: not-allowed;
  box-shadow: none;
}
button:focus-visible,
input:focus-visible,
select:focus-visible,
a:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px rgba(63, 140, 255, 0.24);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  white-space: nowrap;
  gap: .45rem;
  min-height: 42px;
  padding: .58rem .9rem;
  font-weight: 600;
  line-height: 1.2;
  border-radius: 12px;
  color: var(--text);
  text-decoration: none;
  border: 1px solid rgba(101, 155, 227, 0.42);
  background: rgba(255, 255, 255, 0.78);
  box-shadow: 0 8px 16px rgba(31, 85, 166, 0.08);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.96);
}
.btn-secondary i,
button i {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  line-height: 1;
  margin-right: 0;
}
.btn-secondary:visited {
  color: var(--text);
}

.bg-page { background: transparent; }
.centered { min-height: 100vh; display: grid; place-items: center; padding: 1rem; }
.container { width: 100%; margin: var(--page-gap) auto; padding: 0 var(--page-gap); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .9rem;
  padding: .8rem var(--page-gap);
  border-bottom: 1px solid rgba(69, 143, 241, 0.4);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: linear-gradient(120deg, rgba(214, 234, 255, 0.8), rgba(228, 242, 255, 0.72));
}
.topbar-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
}
.topbar-actions .btn-secondary,
.topbar-actions button {
  min-width: 128px;
}
.topbar-session {
  display: grid;
  justify-items: center;
  gap: .12rem;
  min-width: 250px;
  padding: .36rem .72rem;
  border: 1px solid rgba(101, 155, 227, 0.34);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.68);
  box-shadow: 0 6px 14px rgba(31, 85, 166, 0.09);
}
.topbar-session-date {
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .03em;
  color: #235087;
}
.topbar-session-row {
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  font-size: .83rem;
  color: var(--muted);
}
.topbar-session-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #2aa76d;
  box-shadow: 0 0 0 4px rgba(42, 167, 109, 0.14);
}
.brand-wrap {
  display: flex;
  align-items: center;
  gap: .65rem;
}
.brand-mark {
  display: inline-flex;
  width: 40px;
  height: 40px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(145deg, #55a6ff, #2f7df1);
  box-shadow: 0 8px 20px rgba(34, 111, 219, 0.38);
}
.brand-mark svg {
  width: 22px;
  height: 22px;
}
.brand-text {
  display: grid;
  gap: 2px;
}
.brand-text strong {
  letter-spacing: .08em;
  font-size: .88rem;
}
.brand-text .muted {
  display: inline-flex;
  align-items: center;
  gap: .32rem;
}
.w-420 { width: min(440px, 100%); }

.card {
  border: 1px solid rgba(101, 155, 227, 0.28);
  border-radius: var(--radius);
  padding: 1.15rem;
  margin-bottom: 1.1rem;
  background: var(--card);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: var(--glass-shadow);
  animation: riseIn .34s ease;
}
.hero-card {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.78), rgba(239, 247, 255, 0.7));
}
.hero-content {
  display: grid;
  gap: 1rem;
}
.hero-kicker {
  margin-bottom: .42rem;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--accent-dark);
}

.module-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
}
.admin-tabs {
  justify-content: flex-start;
}
.module-btn.active {
  color: #fff;
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent-dark), #1f63cb);
}

.stack { display: grid; gap: .7rem; }
.row { display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.controls {
  display: flex;
  justify-content: space-between;
  gap: .8rem;
  flex-wrap: wrap;
  margin-bottom: .75rem;
}
.controls-right {
  margin-left: auto;
  display: flex;
  align-items: center;
}
.filters { display: flex; flex-wrap: wrap; gap: .5rem; flex: 1; }
.filters,
.controls {
  align-items: center;
}
.module-panel {
  transition: opacity .25s ease, transform .25s ease;
}
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: .8rem;
}
.news-card {
  border: 1px solid rgba(101, 155, 227, 0.24);
  border-radius: 14px;
  padding: .82rem;
  background: rgba(255, 255, 255, 0.84);
  display: grid;
  gap: .5rem;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}
.news-card:hover {
  transform: translateY(-2px);
  border-color: rgba(63, 140, 255, 0.45);
  box-shadow: 0 14px 22px rgba(31, 85, 166, 0.12);
}
.news-card p { word-break: break-word; }

.muted { color: var(--muted); }
.error { color: #c73558; }
.hidden { display: none !important; }
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  border: 0;
  padding: 0;
  white-space: nowrap;
  clip-path: inset(100%);
  clip: rect(0 0 0 0);
  overflow: hidden;
}
.mono {
  font-family: Consolas, monospace;
  font-size: .94rem;
  min-height: 2.5rem;
  padding: .6rem;
  border-radius: 10px;
  border: 1px dashed rgba(101, 155, 227, 0.5);
  background: rgba(255, 255, 255, 0.86);
}
.user-row {
  display: flex;
  justify-content: space-between;
  gap: .5rem;
  align-items: center;
  border-bottom: 1px solid rgba(101, 155, 227, 0.24);
  padding: .58rem 0;
}
.users-head {
  padding: .35rem 0 .55rem 0;
  border-bottom: 1px solid rgba(101, 155, 227, 0.2);
  margin-bottom: .35rem;
}
.col-user { flex: 1.2; min-width: 180px; }
.col-hash { flex: 1.3; min-width: 230px; }
.col-status { width: 90px; text-transform: lowercase; }
.col-actions { width: 220px; justify-content: flex-end; }
.hash-chip {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  cursor: pointer;
  user-select: none;
  transition: border-color .2s ease, background-color .2s ease, transform .2s ease;
}
.hash-chip:hover {
  transform: translateY(-1px);
  border-color: rgba(63, 140, 255, 0.7);
  background: rgba(255, 255, 255, 0.95);
}
.hash-chip.copied {
  border-color: rgba(42, 167, 92, 0.8);
  background: rgba(224, 255, 239, 0.95);
}
.admin-panel {
  min-height: 0;
}
.log-card {
  min-height: auto;
  height: calc(100dvh - 260px);
  display: flex;
  flex-direction: column;
}
.log-terminal {
  margin-top: .7rem;
  width: 100%;
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: 14px;
  border: 1px solid rgba(117, 160, 218, 0.35);
  background: linear-gradient(180deg, rgba(11, 26, 48, 0.96), rgba(9, 22, 41, 0.98));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  padding: .65rem .75rem;
  font-family: Consolas, "Courier New", monospace;
  font-size: .86rem;
  line-height: 1.45;
  color: #d5e5ff;
}
.log-line {
  white-space: pre-wrap;
  word-break: break-word;
  padding: .12rem 0;
  border-bottom: 1px dashed rgba(111, 153, 215, 0.18);
}
.log-line:last-child {
  border-bottom: none;
}

dialog:not(.toast-layer) {
  width: min(740px, 96vw);
  padding: 0;
  overflow: hidden;
  border: 1px solid rgba(101, 155, 227, 0.28);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 28px 55px rgba(31, 85, 166, 0.2);
}
dialog:not(.toast-layer)::backdrop {
  backdrop-filter: blur(6px) saturate(120%);
  -webkit-backdrop-filter: blur(6px) saturate(120%);
  background: linear-gradient(160deg, rgba(21, 61, 117, 0.34), rgba(17, 41, 76, 0.56));
}
dialog:not(.toast-layer) article {
  position: relative;
  padding: 1rem;
  background: transparent;
}

.site-footer {
  margin-top: auto;
  padding: 1rem var(--page-gap);
  border-top: 1px solid rgba(69, 143, 241, 0.32);
  backdrop-filter: blur(15px);
  -webkit-backdrop-filter: blur(15px);
  background: linear-gradient(120deg, rgba(220, 238, 255, 0.75), rgba(232, 244, 255, 0.72));
}
.site-footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .75rem;
  flex-wrap: wrap;
}
.site-footer a { color: #2b5ca0; }
.footer-link-btn {
  min-height: 38px;
  padding: .5rem .8rem;
  border-radius: 11px;
  border-color: rgba(79, 149, 243, 0.5);
  background: rgba(255, 255, 255, 0.82);
}
.footer-link-btn:hover {
  transform: translateY(-1px);
  border-color: rgba(54, 144, 255, 0.7);
  background: rgba(255, 255, 255, 0.95);
}

.toast-root {
  position: fixed;
  left: max(14px, calc(var(--page-gap) - 6px));
  bottom: max(14px, calc(var(--page-gap) - 6px));
  z-index: 1200;
  display: grid;
  gap: .55rem;
  pointer-events: none;
}
.toast-layer {
  position: fixed;
  inset: 0;
  margin: 0;
  padding: 0;
  width: 100vw;
  height: 100dvh;
  max-width: none;
  max-height: none;
  border: 0;
  background: transparent;
  pointer-events: none;
  overflow: visible;
}
.toast-layer::backdrop {
  display: none;
  background: transparent;
}
.toast-root-toplayer {
  z-index: auto;
}
.toast-item {
  min-width: 240px;
  max-width: min(420px, 86vw);
  padding: .7rem .85rem;
  border-radius: 12px;
  border: 1px solid rgba(79, 149, 243, 0.45);
  background: linear-gradient(145deg, rgba(226, 241, 255, .92), rgba(245, 251, 255, .9));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 12px 26px rgba(22, 86, 176, 0.2);
  color: var(--text);
  font-size: .9rem;
  font-weight: 600;
  opacity: 0;
  transform: translateY(8px);
  animation: toastIn .22s ease forwards;
}
.toast-item.toast-success {
  border-color: rgba(62, 170, 109, 0.55);
}
.toast-item.toast-error {
  border-color: rgba(209, 63, 99, 0.55);
}
.toast-item.toast-hide {
  animation: toastOut .2s ease forwards;
}

* {
  scrollbar-width: thin;
  scrollbar-color: #5f96e8 #ddebff;
}
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-track { background: #ddebff; }
*::-webkit-scrollbar-thumb {
  border-radius: 10px;
  border: 2px solid #ddebff;
  background: linear-gradient(180deg, #79a7ee, #5b8edc);
}
*::-webkit-scrollbar-thumb:hover { background: linear-gradient(180deg, #5d93e8, #4a78c1); }

@keyframes riseIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes toastOut {
  from { opacity: 1; transform: translateY(0); }
  to { opacity: 0; transform: translateY(6px); }
}

@media (max-width: 1100px) {
  .topbar {
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }
  .topbar-session {
    order: 3;
    width: 100%;
    justify-items: flex-start;
  }
  .topbar-actions .btn-secondary,
  .topbar-actions button {
    min-width: 0;
  }
  .filters input,
  .filters select {
    min-width: 180px;
    flex: 1 1 220px;
  }
  .news-grid {
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  }
  .site-footer-inner {
    align-items: flex-start;
  }
}

@media (max-width: 760px) {
  :root {
    --page-gap: 14px;
  }
  .topbar {
    position: static;
    gap: .7rem;
    padding-top: .7rem;
    padding-bottom: .7rem;
  }
  .brand-wrap {
    width: 100%;
  }
  .topbar-actions {
    width: 100%;
    justify-content: stretch;
    gap: .45rem;
  }
  .topbar-session {
    min-width: 0;
  }
  .topbar-actions .btn-secondary,
  .topbar-actions button {
    flex: 1 1 0;
    width: 100%;
  }
  .container {
    margin-top: .85rem;
    margin-bottom: .85rem;
  }
  .card {
    padding: .9rem;
    border-radius: 14px;
  }
  .controls {
    align-items: stretch;
  }
  .filters {
    width: 100%;
    gap: .45rem;
  }
  .filters > input,
  .filters > select,
  .filters > button {
    width: 100%;
    min-width: 0;
    flex: 1 1 100%;
  }
  .controls-right {
    margin-left: 0;
    width: 100%;
    justify-content: stretch;
  }
  .controls-right > button {
    width: 100%;
  }
  .module-toolbar {
    width: 100%;
    gap: .45rem;
  }
  .module-toolbar .module-btn {
    flex: 1 1 calc(50% - .45rem);
    min-width: 0;
  }
  .admin-tabs {
    width: 100%;
  }
  .admin-tabs .module-btn {
    flex: 1 1 100%;
    width: 100%;
  }
  .news-grid {
    grid-template-columns: 1fr;
  }
  dialog:not(.toast-layer) {
    width: min(680px, calc(100vw - 16px));
    max-height: calc(100dvh - 16px);
  }
  dialog:not(.toast-layer) article {
    padding: .9rem;
    max-height: calc(100dvh - 28px);
    overflow: auto;
  }
  .toast-root {
    left: 12px;
    right: 12px;
    bottom: 12px;
  }
  .toast-item {
    min-width: 0;
    max-width: 100%;
  }
  .site-footer {
    padding-top: .85rem;
    padding-bottom: .85rem;
  }
  .site-footer-inner > .row {
    width: 100%;
  }
  .site-footer-inner > .row .footer-link-btn {
    flex: 1 1 100%;
    width: 100%;
  }
  .users-head {
    display: none;
  }
  .user-row {
    display: grid;
    grid-template-columns: 1fr;
    gap: .4rem;
  }
  .col-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .log-card {
    min-height: auto;
    height: auto;
  }
  .log-terminal {
    min-height: 44vh;
    max-height: 44vh;
  }
}

@media (max-width: 560px) {
  html {
    font-size: 15px;
  }
  h1 {
    font-size: 1.35rem;
  }
  h2 {
    font-size: 1.12rem;
  }
  .brand-mark {
    width: 36px;
    height: 36px;
  }
  .brand-mark svg {
    width: 20px;
    height: 20px;
  }
  .module-toolbar .module-btn {
    flex: 1 1 100%;
  }
  button,
  .btn-secondary {
    min-height: 40px;
  }
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
