:root {
  color-scheme: dark;
  --bg: #080b16;
  --panel: #101624;
  --panel-2: #151d2f;
  --line: rgba(104, 114, 160, 0.24);
  --text: #f1f4ff;
  --muted: #90a0c0;
  --accent: #32d4e9;
  --accent-2: #b086ff;
  --warn: #ffc864;
  --good: #4ce1a2;
  --danger: #ff6f8c;
  --shadow: 0 16px 44px rgba(0, 0, 0, 0.36);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top, rgba(50, 212, 233, 0.16), transparent 28%),
    radial-gradient(circle at 85% 0%, rgba(176, 134, 255, 0.12), transparent 24%),
    linear-gradient(180deg, #080b16, #090d18 42%, #060810);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, input, select { font: inherit; }
button { cursor: pointer; }

.hidden { display: none !important; }

.app-shell { min-height: 100vh; padding-bottom: 92px; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(8, 11, 22, 0.9);
  border-bottom: 1px solid rgba(144, 160, 192, 0.12);
  backdrop-filter: blur(16px);
}

.brand-block {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-text {
  display: none;
  font-size: 18px;
  font-weight: 900;
  letter-spacing: 0.03em;
}

.brand-text-only .brand-logo {
  display: none;
}

.brand-text-only .brand-text {
  display: block;
}

.brand-logo {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  object-fit: cover;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.08), 0 10px 30px rgba(0,0,0,0.26);
}

.brand-name { font-size: 15px; font-weight: 900; letter-spacing: 0.02em; }
.brand-subtitle, .session-pill, .eyebrow, .notice, .card-meta, .lock-copy, .hero-location { color: var(--muted); }
.brand-subtitle { font-size: 12px; }

.topbar-actions { display: flex; align-items: center; gap: 10px; }
.session-pill {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(16, 22, 36, 0.84);
  font-size: 13px;
}

.icon-button, .ghost-button, .danger-button, .link-button, .text-button, .publish-card {
  border: 0;
  border-radius: 14px;
}

.icon-button {
  width: 42px;
  height: 42px;
  color: var(--text);
  background: rgba(21, 29, 47, 0.95);
  border: 1px solid var(--line);
}

.admin-button {
  width: auto;
  min-width: 64px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 800;
}

.workspace { width: min(1120px, calc(100% - 24px)); margin: 0 auto; padding: 18px 0 24px; }

.lock-screen {
  min-height: calc(100vh - 90px);
  display: grid;
  place-items: center;
}

.lock-panel, .feed-card, .profile-panel, .profile-form, .worker-form, .help-card, .modal, .publish-card, .stat-card {
  background: linear-gradient(180deg, rgba(21, 29, 47, 0.96), rgba(16, 22, 36, 0.96));
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.lock-panel {
  width: min(560px, 100%);
  padding: 22px;
  border-radius: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 0; font-size: clamp(28px, 5vw, 46px); line-height: 1.02; }
h2 { margin-bottom: 0; font-size: 22px; }
h3 { margin-bottom: 8px; }

.login-form, .profile-form, .worker-form { display: grid; gap: 12px; margin-top: 18px; }
.login-form label, .profile-form label, .worker-form label { display: grid; gap: 8px; color: var(--muted); font-size: 14px; }
.inline-form { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
input, select {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  color: var(--text);
  background: rgba(7, 10, 18, 0.82);
  border: 1px solid rgba(144, 160, 192, 0.16);
  border-radius: 14px;
  outline: none;
}

input::placeholder { color: rgba(144, 160, 192, 0.58); }
input:focus, select:focus { border-color: rgba(50, 212, 233, 0.85); box-shadow: 0 0 0 3px rgba(50, 212, 233, 0.12); }

.ghost-button, .danger-button, .link-button, .text-button, .publish-card {
  min-height: 44px;
  padding: 0 16px;
}

.ghost-button, .text-button, .link-button {
  color: var(--text);
  background: transparent;
}

.ghost-button {
  border: 1px solid rgba(144, 160, 192, 0.18);
}

.danger-button {
  margin-top: 14px;
  color: var(--text);
  background: transparent;
  border: 1px solid rgba(255, 111, 140, 0.42);
}

.link-button {
  padding: 0;
  color: var(--accent);
}

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 18px 0 12px;
}

.section-head.compact { margin-top: 0; margin-bottom: 16px; }

.view { display: none; }
.view.active { display: block; }

.hero {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.hero-location {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 15px;
  font-weight: 700;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 54px;
  padding: 0 16px;
  border-radius: 18px;
  background: rgba(21, 29, 47, 0.9);
  border: 1px solid rgba(144, 160, 192, 0.14);
}

.search-box span { color: var(--muted); font-size: 18px; }
.search-box input {
  min-height: 0;
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none !important;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 18px 0 12px;
}

.stat-card {
  min-height: 122px;
  padding: 16px;
  border-radius: 18px;
}

.stat-card strong {
  display: block;
  margin-bottom: 8px;
  font-size: 30px;
  line-height: 1;
}

.stat-card:nth-child(1) strong { color: var(--accent); }
.stat-card:nth-child(2) strong { color: var(--accent-2); }
.stat-card:nth-child(3) strong { color: #e8f2ff; }
.stat-card:nth-child(4) strong { color: var(--good); }

.feed-section { margin-top: 8px; }
.feed-list, .feed-strip { display: grid; gap: 12px; }
.feed-strip { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }

.feed-card {
  width: 100%;
  padding: 0;
  overflow: hidden;
  text-align: left;
  border-radius: 20px;
  touch-action: pan-y;
  -webkit-tap-highlight-color: transparent;
}

.feed-card-body { display: grid; gap: 12px; padding: 16px; }
.feed-card-head { display: flex; align-items: start; justify-content: space-between; gap: 12px; }
.feed-card h3 { margin: 0; font-size: 18px; line-height: 1.12; }
.card-text { margin: 0; color: #cbd7f0; font-size: 14px; line-height: 1.42; }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0;
  font-size: 13px;
}
.card-meta span {
  padding: 5px 8px;
  background: rgba(7, 10, 18, 0.42);
  border: 1px solid rgba(144, 160, 192, 0.12);
  border-radius: 999px;
}

.type-badge {
  flex: none;
  padding: 6px 9px;
  color: #070b16;
  background: var(--warn);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}
.type-badge.shabashka { background: var(--accent); }
.type-badge.vacancy { background: var(--warn); }
.type-badge.worker { background: var(--good); }
.type-badge.unknown { background: #8d9bb6; }

.profile-layout {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
}

.profile-panel, .profile-form, .worker-form {
  gap: 12px;
  padding: 16px;
  border-radius: 20px;
}

.profile-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(144, 160, 192, 0.12);
}
.profile-row:last-child { padding-bottom: 0; border-bottom: 0; }

.checks {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid rgba(144, 160, 192, 0.12);
  border-radius: 16px;
}
.checks legend { padding: 0 6px; color: var(--muted); }
.checks label { display: flex; align-items: center; gap: 10px; }

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

.publish-card {
  min-height: 120px;
  padding: 16px;
  color: var(--text);
  text-align: left;
  border: 1px solid rgba(144, 160, 192, 0.14);
}
.publish-card strong, .publish-card span { display: block; }
.publish-card strong { margin-bottom: 8px; font-size: 18px; }

.notice { margin-top: 12px; color: var(--muted); }

.menu-launcher {
  position: fixed;
  right: 18px;
  top: 52%;
  z-index: 90;
  width: 64px;
  height: 64px;
  transform: translateY(-50%);
  color: var(--text);
  background: rgba(21, 29, 47, 0.36);
  border: 1px solid rgba(50, 212, 233, 0.48);
  border-radius: 999px;
  box-shadow:
    0 0 0 1px rgba(50, 212, 233, 0.08),
    0 0 14px rgba(50, 212, 233, 0.18),
    0 8px 24px rgba(0, 0, 0, 0.25);
  animation: pulseGlow 2.2s ease-in-out infinite;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}

.menu-launcher::before {
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 999px;
}

.menu-launcher::after {
  content: "⋯";
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  font-size: 24px;
  line-height: 1;
}

@keyframes pulseGlow {
  0%, 100% {
    box-shadow:
      0 0 0 1px rgba(50, 212, 233, 0.08),
      0 0 14px rgba(50, 212, 233, 0.18),
      0 8px 24px rgba(0, 0, 0, 0.25);
  }
  50% {
    box-shadow:
      0 0 0 1px rgba(50, 212, 233, 0.24),
      0 0 26px rgba(50, 212, 233, 0.3),
      0 8px 24px rgba(0, 0, 0, 0.25);
  }
}

.quick-menu {
  position: fixed;
  inset: 0;
  z-index: 95;
  display: grid;
  place-items: center end;
  padding-right: 18px;
  background: rgba(1, 2, 6, 0.26);
  touch-action: manipulation;
}

.quick-menu-panel {
  display: grid;
  gap: 10px;
  min-width: 180px;
  padding: 12px;
  background: rgba(16, 22, 36, 0.96);
  border: 1px solid rgba(144, 160, 192, 0.12);
  border-radius: 20px;
  box-shadow: var(--shadow);
}

.quick-menu-panel button {
  min-height: 42px;
  padding: 0 14px;
  color: var(--text);
  background: rgba(21, 29, 47, 0.84);
  border: 1px solid rgba(144, 160, 192, 0.12);
  border-radius: 14px;
  text-align: left;
}

.quick-menu-panel button:hover,
.quick-menu-panel button:active {
  border-color: rgba(50, 212, 233, 0.34);
}

.viewed {
  opacity: 0.65;
  filter: grayscale(0.18);
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 8px;
}

.icon-chip {
  min-height: 32px;
  padding: 0 10px;
  color: var(--text);
  background: rgba(7, 10, 18, 0.42);
  border: 1px solid rgba(144, 160, 192, 0.12);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.icon-chip.active {
  border-color: rgba(50, 212, 233, 0.5);
  color: var(--accent);
}

.help-panel {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: end center;
  padding: 16px 12px 22px;
  background: rgba(3, 5, 11, 0.58);
}

.help-card {
  width: min(720px, 100%);
  padding: 18px;
  border-radius: 24px;
}
.help-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.help-grid ul { margin: 0; padding-left: 18px; color: var(--text); }

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: none;
  padding: 14px;
  background: rgba(1, 2, 6, 0.72);
}
.modal-backdrop.open { display: grid; place-items: center; }
.modal {
  width: min(820px, 100%);
  max-height: min(90vh, 880px);
  padding: 18px;
  overflow: auto;
  border-radius: 24px;
}
.modal-close {
  position: sticky;
  top: 0;
  margin-left: auto;
  margin-bottom: 12px;
}
.modal-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}
.modal-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.modal-meta span {
  padding: 5px 8px;
  background: rgba(7, 10, 18, 0.42);
  border: 1px solid rgba(144, 160, 192, 0.12);
  border-radius: 999px;
}
.modal-text { white-space: pre-wrap; line-height: 1.55; }
.modal-links {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(144, 160, 192, 0.12);
  border-radius: 18px;
  background: rgba(7, 10, 18, 0.3);
}
.source-link { color: var(--accent); text-decoration: none; }

.modal-top-actions {
  position: absolute;
  top: 18px;
  right: 18px;
  display: flex;
  gap: 8px;
}

.modal-layout {
  position: relative;
  padding-top: 10px;
}

.modal-actions-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
}

.views-row {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

@media (max-width: 940px) {
  .stats-grid {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: minmax(118px, 1fr);
    overflow-x: auto;
    padding-bottom: 4px;
    scrollbar-width: none;
  }
  .stats-grid::-webkit-scrollbar { display: none; }
  .form-grid, .publish-grid, .profile-layout, .help-grid { grid-template-columns: 1fr; }
  .feed-strip { grid-template-columns: 1fr; }
  .section-head, .feed-card-head, .modal-head { flex-direction: column; align-items: start; }
  .inline-form { grid-template-columns: 1fr; }
  .menu-launcher { right: 12px; }
  .quick-menu { padding-right: 12px; }
}
