* {
  box-sizing: border-box;
}

:root {
  color-scheme: dark;
  --bg: #05070b;
  --surface: rgba(15, 24, 38, 0.9);
  --surface-strong: rgba(18, 31, 49, 0.96);
  --border: rgba(124, 199, 255, 0.22);
  --border-strong: rgba(53, 255, 135, 0.5);
  --text: #e8f0ff;
  --muted: #9fb2d0;
  --blue: #7cc7ff;
  --green: #35ff87;
  --violet: #b58cff;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.34);
}

html {
  min-height: 100%;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 18% 8%, rgba(53, 255, 135, 0.1), transparent 28%),
    radial-gradient(circle at 82% 16%, rgba(124, 199, 255, 0.12), transparent 30%),
    linear-gradient(180deg, #070b12 0%, var(--bg) 100%);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(124, 199, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(124, 199, 255, 0.035) 1px, transparent 1px);
  background-size: 44px 44px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.55), transparent 70%);
}

.container {
  position: relative;
  width: min(100%, 1060px);
  margin: 0 auto;
  padding: 58px 28px 78px;
}

a {
  color: var(--blue);
  font-weight: 750;
  text-decoration: none;
}

a:hover,
a:focus {
  color: #d5efff;
  text-decoration: underline;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(53, 255, 135, 0.08);
  box-shadow: 0 0 24px rgba(53, 255, 135, 0.12);
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  line-height: 1;
  text-transform: uppercase;
}

h1 {
  margin: 24px 0 14px;
  font-size: clamp(44px, 7vw, 76px);
  line-height: 0.98;
  letter-spacing: 0;
  text-shadow: 0 18px 44px rgba(0, 0, 0, 0.42);
}

.subtitle {
  max-width: 700px;
  margin: 0;
  color: var(--muted);
  font-size: clamp(18px, 2.4vw, 23px);
  line-height: 1.42;
}

.hero {
  max-width: 820px;
}

.dashboard .container {
  max-width: 980px;
}

.dashboard .hero {
  max-width: none;
  text-align: center;
}

.dashboard h1 {
  margin-bottom: 0;
}

.home-section {
  width: min(100%, 820px);
  margin: 26px auto 0;
}

.home-section-primary {
  margin-top: 42px;
}

.section-title {
  margin: 0 0 12px;
  color: var(--text);
  font-size: 24px;
  line-height: 1.1;
  text-align: center;
}

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

.section-grid-single {
  grid-template-columns: minmax(0, 1fr);
}

.card-feature {
  min-height: 188px;
  padding: 34px 72px 34px 34px;
  border-color: rgba(53, 255, 135, 0.5);
  background:
    radial-gradient(circle at 88% 14%, rgba(53, 255, 135, 0.2), transparent 32%),
    linear-gradient(180deg, rgba(17, 39, 42, 0.98), rgba(8, 18, 29, 0.98));
}

.card-feature span {
  color: var(--green);
  font-size: clamp(34px, 5vw, 48px);
}

.card-feature small {
  max-width: 460px;
  font-size: 18px;
}

.status-panel {
  width: min(100%, 980px);
  margin: 34px auto 0;
}

.grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 36px;
}

.card,
.panel {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--surface-strong), rgba(9, 16, 29, 0.96));
  box-shadow: var(--shadow);
}

.card {
  position: relative;
  display: block;
  min-height: 138px;
  padding: 24px 58px 24px 24px;
  border-radius: 8px;
  color: var(--blue);
  overflow: hidden;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.card::after {
  content: "/";
  position: absolute;
  top: 18px;
  right: 22px;
  color: rgba(124, 199, 255, 0.55);
  font-size: 36px;
  font-weight: 900;
}

.card:hover,
.card:focus {
  transform: translateY(-3px);
  border-color: rgba(124, 199, 255, 0.54);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.42);
  text-decoration: none;
}

.card span {
  display: block;
  color: var(--blue);
  font-size: clamp(26px, 3.4vw, 34px);
  font-weight: 900;
  line-height: 1;
}

.card small {
  display: block;
  max-width: 320px;
  margin-top: 14px;
  color: #a8bad6;
  font-size: 16px;
  line-height: 1.38;
}

.card-primary,
.card[href="/notes/"] {
  border-color: rgba(53, 255, 135, 0.42);
  background:
    radial-gradient(circle at 92% 12%, rgba(53, 255, 135, 0.18), transparent 30%),
    linear-gradient(180deg, rgba(17, 39, 42, 0.96), rgba(9, 20, 28, 0.96));
}

.card-primary span,
.card[href="/notes/"] span {
  color: var(--green);
}

.panel {
  margin-top: 28px;
  padding: 26px;
  border-radius: 8px;
  overflow: hidden;
}

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

.eyebrow {
  margin: 0;
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.panel h2 {
  margin: 0;
  font-size: 28px;
  line-height: 1.1;
}

.status-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.status-grid p,
.dashboard .panel > p {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(124, 199, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 7, 10, 0.42);
  color: var(--text);
  font-size: 17px;
  line-height: 1.35;
}

.status-grid strong,
.dashboard .panel > p strong {
  display: block;
  margin-bottom: 8px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-grid span {
  display: block;
}

.route-page .container {
  max-width: 900px;
  padding-top: 70px;
}

.route-page .panel {
  margin-top: 28px;
}

.app-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin: 24px 0 0;
  padding: 8px;
  border: 1px solid rgba(124, 199, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 7, 10, 0.26);
}

.app-nav a {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 10px 12px;
  border: 1px solid rgba(124, 199, 255, 0.18);
  border-radius: 8px;
  background: rgba(5, 7, 10, 0.28);
  color: var(--text);
  font-size: 14px;
  font-weight: 850;
  line-height: 1;
  text-decoration: none;
}

.app-nav a:hover,
.app-nav a:focus {
  border-color: rgba(53, 255, 135, 0.42);
  color: var(--green);
  text-decoration: none;
}

.share-form {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.compact-form {
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto;
  align-items: end;
  padding: 16px;
  border: 1px solid rgba(124, 199, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 7, 10, 0.28);
}

.share-form label {
  display: grid;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 850;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.share-form input,
.share-form select {
  width: 100%;
  min-height: 46px;
  padding: 11px 12px;
  border: 1px solid rgba(124, 199, 255, 0.24);
  border-radius: 8px;
  background: rgba(5, 7, 10, 0.48);
  color: var(--text);
  font: inherit;
}

.share-form input:focus,
.share-form select:focus {
  border-color: rgba(53, 255, 135, 0.58);
  box-shadow: 0 0 0 3px rgba(53, 255, 135, 0.1);
  outline: none;
}

.share-form button,
.small-button {
  justify-self: start;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  background: rgba(53, 255, 135, 0.1);
  color: var(--green);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.share-form button:hover,
.share-form button:focus,
.small-button:hover,
.small-button:focus {
  background: rgba(53, 255, 135, 0.18);
}

.muted,
.hint {
  color: var(--muted);
  line-height: 1.5;
}

.error,
.success {
  margin: 16px 0 0;
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1.35;
}

.error {
  border: 1px solid rgba(255, 92, 92, 0.38);
  background: rgba(255, 92, 92, 0.1);
  color: #ffb6b6;
}

.success {
  border: 1px solid rgba(53, 255, 135, 0.38);
  background: rgba(53, 255, 135, 0.1);
  color: var(--green);
}

.empty {
  margin: 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.5;
}

.uploaded-files {
  display: grid;
  gap: 12px;
  margin: 0 0 18px;
  padding: 0;
  list-style: none;
}

.uploaded-file {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 72px;
  padding: 14px;
  border: 1px solid rgba(124, 199, 255, 0.16);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(124, 199, 255, 0.1), transparent 34%),
    rgba(5, 7, 10, 0.38);
}

.uploaded-file.is-empty {
  border-style: dashed;
}

.file-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border: 1px solid rgba(53, 255, 135, 0.32);
  border-radius: 8px;
  background: rgba(53, 255, 135, 0.08);
  color: var(--green);
  font-size: 24px;
  font-weight: 900;
  line-height: 1;
}

.file-main {
  min-width: 0;
}

.file-name,
.file-meta {
  display: block;
}

.file-name {
  overflow-wrap: anywhere;
  color: var(--text);
  font-size: 18px;
  font-weight: 900;
  line-height: 1.2;
}

a.file-name:hover,
a.file-name:focus {
  color: var(--green);
  text-decoration: none;
}

.file-meta {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.35;
}

.file-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 30px;
  padding: 7px 10px;
  border: 1px solid rgba(124, 199, 255, 0.22);
  border-radius: 999px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

a.file-status:hover,
a.file-status:focus {
  border-color: rgba(53, 255, 135, 0.42);
  color: var(--green);
  text-decoration: none;
}

.file-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.inline-form {
  margin: 0;
}

.danger-button {
  min-height: 28px;
  padding: 7px 10px;
  border: 1px solid rgba(255, 92, 92, 0.38);
  border-radius: 999px;
  background: rgba(255, 92, 92, 0.1);
  color: #ffb6b6;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-width: 180px;
}

.danger-button:hover,
.danger-button:focus {
  background: rgba(255, 92, 92, 0.18);
}

.table-wrap {
  max-width: 100%;
  margin-top: 18px;
  overflow-x: auto;
  border: 1px solid rgba(124, 199, 255, 0.12);
  border-radius: 8px;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
  line-height: 1.35;
}

.audit-table th,
.audit-table td {
  padding: 10px;
  border-bottom: 1px solid rgba(124, 199, 255, 0.14);
  text-align: left;
  vertical-align: top;
}

.audit-table th {
  color: var(--green);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.audit-table td {
  color: var(--text);
  overflow-wrap: anywhere;
}

.audit-table th,
.audit-table td {
  max-width: 340px;
}

.user-table th,
.user-table td {
  white-space: nowrap;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 22px 0 0;
}

.details-grid div {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(124, 199, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 7, 10, 0.34);
}

.details-grid dt {
  margin-bottom: 7px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.details-grid dd {
  margin: 0;
  color: var(--text);
  overflow-wrap: anywhere;
  font-weight: 800;
}

.file-preview {
  margin-top: 18px;
}

.file-preview-text {
  max-height: 560px;
  overflow: auto;
  white-space: pre-wrap;
}

.file-preview-image {
  display: block;
  max-width: 100%;
  max-height: 720px;
  border: 1px solid rgba(124, 199, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 7, 10, 0.44);
}

.file-preview-frame {
  width: 100%;
  height: min(72vh, 760px);
  min-height: 460px;
  border: 1px solid rgba(124, 199, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 7, 10, 0.44);
}

.back,
main.container > p a[href="/"],
.test-back-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin-top: 28px;
  padding: 11px 18px;
  border: 1px solid var(--border-strong);
  border-radius: 999px;
  background: rgba(53, 255, 135, 0.08);
  box-shadow: 0 0 20px rgba(53, 255, 135, 0.12);
  color: var(--green) !important;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1.1;
  text-decoration: none !important;
  text-transform: uppercase;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}

.back:hover,
.back:focus,
main.container > p a[href="/"]:hover,
main.container > p a[href="/"]:focus,
.test-back-button:hover,
.test-back-button:focus {
  background: rgba(53, 255, 135, 0.16);
  box-shadow: 0 0 26px rgba(53, 255, 135, 0.22);
  transform: translateY(-1px);
}

body:not(.dashboard):not(.route-page) main.container > p.subtitle {
  display: none;
}

details {
  padding: 0;
}

summary {
  cursor: pointer;
  padding: 18px 22px;
  color: var(--text);
  font-size: 22px;
  font-weight: 900;
}

summary:hover {
  color: var(--blue);
}

pre {
  max-width: 100%;
  margin: 0;
  padding: 14px 22px 20px;
  overflow-x: hidden;
  overflow-wrap: anywhere;
  border-top: 1px solid rgba(124, 199, 255, 0.14);
  color: var(--green);
  font-size: 16px;
  line-height: 1.55;
  white-space: normal;
  word-break: break-word;
}

.cmd-line {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.cmd-divider {
  border-top: 1px solid #263244;
  margin: 7px 0;
}

pre .cmd-main {
  flex: 0 1 auto;
  max-width: 100%;
  color: var(--green);
}

pre .cmd-hash {
  flex: 0 0 auto;
  padding: 0 4px;
  color: var(--violet);
  font-weight: 900;
}

pre .cmd-desc {
  flex: 1 1 260px;
  min-width: 0;
  max-width: 100%;
  color: var(--text);
  font-size: 14px;
}

.test-back-wrap {
  margin: 34px 0 42px !important;
}

@media (max-width: 860px) {
  .container {
    padding: 44px 22px 64px;
  }

  .grid,
  .section-grid,
  .status-grid {
    grid-template-columns: 1fr;
  }

  .card {
    min-height: 124px;
  }

  .card-feature {
    min-height: 166px;
  }

  .panel-heading {
    display: block;
  }

  .panel h2 {
    margin-top: 8px;
  }

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

@media (max-width: 520px) {
  .container {
    padding-inline: 16px;
  }

  h1 {
    font-size: 42px;
  }

  .card,
  .panel {
    padding: 20px;
  }

  .uploaded-file {
    grid-template-columns: 38px minmax(0, 1fr);
    align-items: start;
  }

  .file-icon {
    width: 38px;
    height: 38px;
  }

  .file-actions {
    grid-column: 2;
    justify-self: start;
    justify-content: flex-start;
  }

  .app-nav {
    align-items: stretch;
  }

  .app-nav a {
    flex: 1 1 auto;
    justify-content: center;
  }

  .file-preview-frame {
    min-height: 360px;
  }

  summary {
    padding: 16px 18px;
    font-size: 19px;
  }

  pre {
    padding: 12px 18px 18px;
    font-size: 15px;
  }
}

/* ===== J-Lab UI repair override ===== */

body {
  margin: 0;
  background:
    radial-gradient(circle at 12% 0%, rgba(53, 255, 135, 0.10), transparent 32%),
    linear-gradient(120deg, #05080c 0%, #09121c 100%);
  color: #eaf2ff;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

main,
.wrap,
.page,
.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 44px 28px 80px;
}

header,
.hero {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 28px 0;
}

.brand,
.kicker {
  color: #35ff87;
  font-weight: 900;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1 {
  margin: 32px 0 22px;
  color: #eaf2ff;
  font-size: clamp(56px, 8vw, 96px);
  line-height: 0.95;
  letter-spacing: -0.06em;
}

h2 {
  margin: 0 0 18px;
  color: #eaf2ff;
  font-size: clamp(30px, 4vw, 44px);
  line-height: 1.05;
}

p,
.muted,
.hint,
small {
  color: #a9bad2;
}

a {
  color: #7cc7ff;
}

.app-nav {
  display: flex !important;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin: 18px 0 30px;
  padding: 0;
  border: 0;
  background: transparent;
}

.app-nav a {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  flex: 0 1 auto;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid rgba(124, 199, 255, 0.22);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.56);
  color: #eaf2ff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.02);
}

.app-nav a:hover,
.app-nav a:focus {
  border-color: rgba(53, 255, 135, 0.45);
  color: #35ff87;
  text-decoration: none;
}

.panel {
  margin: 28px 0;
  padding: clamp(24px, 4vw, 42px);
  border: 1px solid rgba(124, 199, 255, 0.22);
  border-radius: 14px;
  background: rgba(13, 25, 42, 0.88);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.panel-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.panel-heading .muted {
  margin: 8px 0 0;
}

.share-form {
  display: grid !important;
  gap: 18px;
  max-width: 100%;
}

.share-form label {
  display: grid !important;
  gap: 8px;
  color: #a9bad2;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.share-form input,
.share-form select {
  width: 100%;
  min-height: 52px;
  padding: 12px 14px;
  border: 1px solid rgba(124, 199, 255, 0.26);
  border-radius: 9px;
  background: #060d16;
  color: #eaf2ff;
  font: inherit;
  font-weight: 700;
}

.share-form input[type="file"] {
  padding: 14px;
}

.share-form input:focus,
.share-form select:focus {
  outline: none;
  border-color: rgba(53, 255, 135, 0.65);
  box-shadow: 0 0 0 3px rgba(53, 255, 135, 0.11);
}

.share-form button,
.small-button,
.file-status,
.danger-button {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
  width: fit-content;
  min-height: 34px;
  padding: 8px 13px;
  border-radius: 999px;
  font: inherit;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.share-form button,
.small-button {
  border: 1px solid rgba(53, 255, 135, 0.38);
  background: rgba(53, 255, 135, 0.10);
  color: #35ff87;
}

.danger-button {
  border: 1px solid rgba(255, 92, 92, 0.45);
  background: rgba(255, 92, 92, 0.12);
  color: #ffb6b6;
}

.file-status {
  border: 1px solid rgba(124, 199, 255, 0.22);
  background: rgba(5, 9, 14, 0.45);
  color: #7cc7ff;
}

.uploaded-file {
  display: grid !important;
  grid-template-columns: 64px minmax(0, 1fr) auto;
  align-items: center;
  gap: 18px;
  margin: 14px 0;
  padding: 18px;
  border: 1px solid rgba(124, 199, 255, 0.16);
  border-radius: 10px;
  background: rgba(5, 9, 14, 0.34);
}

.file-icon {
  display: grid;
  place-items: center;
  width: 54px;
  height: 54px;
  border: 1px solid rgba(53, 255, 135, 0.42);
  border-radius: 10px;
  background: rgba(53, 255, 135, 0.12);
  color: #35ff87;
  font-weight: 1000;
  font-size: 28px;
}

.file-main {
  min-width: 0;
  display: grid;
  gap: 6px;
}

.file-name {
  color: #eaf2ff;
  font-size: 20px;
  font-weight: 950;
  text-decoration: none;
  overflow-wrap: anywhere;
}

a.file-name:hover {
  color: #35ff87;
}

.file-meta {
  color: #a9bad2;
  font-size: 15px;
}

.file-actions {
  display: flex !important;
  flex-wrap: wrap;
  justify-content: flex-end;
  align-items: center;
  gap: 8px;
}

.inline-form {
  display: inline-flex;
  margin: 0;
}

.status-grid,
.admin-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 14px;
}

.status-grid p,
.admin-grid p {
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(124, 199, 255, 0.14);
  border-radius: 10px;
  background: rgba(5, 9, 14, 0.38);
}

.status-grid strong,
.admin-grid strong {
  display: block;
  margin-bottom: 12px;
  color: #7cc7ff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.status-grid span,
.admin-grid span {
  color: #eaf2ff;
  font-size: 26px;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
  margin-top: 18px;
  border: 1px solid rgba(124, 199, 255, 0.12);
  border-radius: 10px;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

.audit-table th,
.audit-table td {
  padding: 12px 14px;
  border-bottom: 1px solid rgba(124, 199, 255, 0.12);
  text-align: left;
  vertical-align: top;
}

.audit-table th {
  color: #35ff87;
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.audit-table td {
  color: #eaf2ff;
  overflow-wrap: anywhere;
}

.details-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 24px;
}

.details-grid div {
  padding: 16px;
  border: 1px solid rgba(124, 199, 255, 0.14);
  border-radius: 10px;
  background: rgba(5, 9, 14, 0.38);
}

.details-grid dt {
  margin-bottom: 8px;
  color: #7cc7ff;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.details-grid dd {
  margin: 0;
  color: #eaf2ff;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.file-preview {
  margin-top: 18px;
}

.file-preview-text {
  max-height: 560px;
  overflow: auto;
  padding: 18px;
  border: 1px solid rgba(124, 199, 255, 0.14);
  border-radius: 10px;
  background: #05090e;
  color: #eaf2ff;
  white-space: pre-wrap;
}

.file-preview-image {
  display: block;
  max-width: 100%;
  max-height: 720px;
  border: 1px solid rgba(124, 199, 255, 0.16);
  border-radius: 10px;
  background: #05090e;
}

.file-preview-frame {
  width: 100%;
  min-height: 520px;
  height: 72vh;
  border: 1px solid rgba(124, 199, 255, 0.16);
  border-radius: 10px;
  background: #05090e;
}

.error,
.success {
  display: block;
  margin: 16px 0;
  padding: 13px 15px;
  border-radius: 9px;
  font-weight: 850;
}

.error {
  border: 1px solid rgba(255, 92, 92, 0.45);
  background: rgba(255, 92, 92, 0.10);
  color: #ffb6b6;
}

.success {
  border: 1px solid rgba(53, 255, 135, 0.38);
  background: rgba(53, 255, 135, 0.10);
  color: #a9ffc9;
}

@media (max-width: 760px) {
  main,
  .wrap,
  .page,
  .container,
  header,
  .hero {
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: clamp(48px, 16vw, 76px);
  }

  .app-nav a {
    flex: 0 0 auto;
  }

  .uploaded-file {
    grid-template-columns: 52px minmax(0, 1fr);
  }

  .file-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .panel-heading {
    display: grid;
  }
}

/* ===== J-Lab next phase ===== */

h1 {
  letter-spacing: 0;
}

.home-page .container {
  max-width: 1180px;
  padding-top: 32px;
  padding-bottom: 42px;
}

.home-hero {
  padding: 0;
}

.compact-home h1 {
  margin: 12px 0 8px;
  font-size: clamp(34px, 5vw, 58px);
}

.compact-home .app-nav {
  margin-top: 14px;
  padding: 6px;
}

.compact-home .app-nav a {
  min-height: 34px;
  padding: 8px 11px;
  font-size: 13px;
}

.hero-pills {
  width: 100%;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hero-pills .badge {
  margin: 0;
}

.account-pill {
  border-color: rgba(124, 199, 255, 0.28);
  background: rgba(124, 199, 255, 0.08);
  box-shadow: 0 0 24px rgba(124, 199, 255, 0.12);
  color: #b9dfff;
}

.home-hero .app-nav {
  margin-top: 14px;
}

.login-home .container {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 420px);
  align-items: center;
  gap: clamp(24px, 5vw, 54px);
  min-height: 100vh;
  padding-top: 42px;
  padding-bottom: 42px;
}

.home-login-hero {
  min-width: 0;
}

.login-home .subtitle {
  max-width: 520px;
}

.login-gate-panel {
  width: 100%;
  margin-top: 0;
}

.login-gate-panel h2 {
  margin-bottom: 10px;
}

.lab-dashboard {
  margin: 34px 0 0;
  padding: clamp(22px, 4vw, 36px);
  border: 1px solid rgba(124, 199, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(53, 255, 135, 0.08), transparent 38%),
    rgba(8, 17, 29, 0.84);
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.24);
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 14px;
  margin-top: 16px;
}

.home-grid > .panel,
.home-grid > .lab-dashboard,
.home-work-row > .panel {
  margin: 0;
}

.home-work-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  min-height: 390px;
  align-items: stretch;
  gap: 14px;
}

.home-work-row > .panel {
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding: 16px;
}

.control-strip {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.control-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 13px;
  border: 1px solid rgba(124, 199, 255, 0.22);
  border-radius: 999px;
  background: rgba(5, 9, 14, 0.45);
  color: #eaf2ff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  text-decoration: none;
  text-transform: uppercase;
}

.control-button:hover,
.control-button:focus {
  border-color: rgba(53, 255, 135, 0.45);
  color: #35ff87;
  text-decoration: none;
}

.metric-grid,
.pulse-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 22px;
}

.metric-card,
.pulse-card,
.download-preview-card,
.clipboard-entry,
.system-band > div,
.empty-state {
  border: 1px solid rgba(124, 199, 255, 0.15);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.38);
}

.metric-card,
.pulse-card {
  min-width: 0;
  padding: 18px;
  overflow: hidden;
}

.metric-card span,
.pulse-card span,
.system-band strong,
.clipboard-entry time {
  display: block;
  color: #7cc7ff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-card strong,
.pulse-card strong {
  display: block;
  margin-top: 10px;
  color: #eaf2ff;
  font-size: clamp(20px, 3vw, 32px);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.metric-card small,
.pulse-card small,
.system-band small {
  display: block;
  margin-top: 14px;
  color: #a9bad2;
  font-weight: 750;
  line-height: 1.35;
}

.meter {
  flex: 1 1 auto;
  height: 10px;
  overflow: hidden;
  border: 1px solid rgba(124, 199, 255, 0.18);
  border-radius: 999px;
  background: rgba(5, 9, 14, 0.7);
}

.meter b {
  display: block;
  width: var(--meter-value, 0%);
  height: 100%;
  max-width: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #35ff87, #7cc7ff);
}

.meter.has-value b {
  min-width: 8px;
}

.meter-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.meter-label {
  flex: 0 0 auto;
  min-width: 42px;
  color: #eaf2ff;
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
  text-align: right;
}

.system-band {
  display: grid;
  grid-template-columns: 1.5fr 1fr 1.2fr;
  gap: 14px;
  margin-top: 14px;
}

.system-band > div {
  min-width: 0;
  padding: 16px;
}

.system-band span {
  display: block;
  margin-top: 8px;
  color: #eaf2ff;
  font-weight: 800;
  overflow-wrap: anywhere;
}

.status-dot::before {
  content: "";
  display: inline-block;
  width: 9px;
  height: 9px;
  margin-right: 8px;
  border-radius: 50%;
  background: #35ff87;
  box-shadow: 0 0 16px rgba(53, 255, 135, 0.75);
}

.home-split {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 18px;
}

.download-preview-list,
.clipboard-list {
  display: grid;
  gap: 12px;
}

.recent-panel .download-preview-list {
  flex: 1 1 auto;
  min-height: 0;
  max-height: 300px;
  overflow: auto;
  align-content: start;
  padding-right: 4px;
}

.recent-panel {
  min-height: 0;
}

.download-preview-card,
.clipboard-entry {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  min-width: 0;
  padding: 14px;
}

.download-preview-card > div:first-child,
.clipboard-entry > div:first-child {
  min-width: 0;
}

.empty-state {
  padding: 18px;
}

.home-upload-form {
  margin-top: 0;
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  gap: 10px;
}

.upload-panel {
  align-self: stretch;
}

.upload-panel .panel-heading h2,
.recent-panel .panel-heading h2 {
  font-size: clamp(22px, 2.8vw, 30px);
}

.dropzone {
  min-height: 112px;
  place-items: center;
  padding: 14px;
  border: 1px dashed rgba(53, 255, 135, 0.48);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(53, 255, 135, 0.09), transparent 44%),
    rgba(5, 9, 14, 0.38);
  text-align: center;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.dropzone.is-dragging {
  border-color: rgba(124, 199, 255, 0.75);
  background: rgba(124, 199, 255, 0.1);
}

.dropzone-title,
.dropzone-copy,
.dropzone-name {
  display: block;
  text-transform: none;
  letter-spacing: 0;
}

.dropzone-title {
  color: #eaf2ff;
  font-size: 18px;
  font-weight: 950;
}

.dropzone-copy,
.dropzone-name {
  color: #a9bad2;
  font-size: 13px;
  font-weight: 750;
}

.dropzone input {
  max-width: 100%;
  margin-top: 8px;
}

.upload-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 12px;
}

.share-form textarea {
  width: 100%;
  min-height: 120px;
  padding: 12px 14px;
  border: 1px solid rgba(124, 199, 255, 0.26);
  border-radius: 9px;
  background: #060d16;
  color: #eaf2ff;
  font: inherit;
  font-weight: 700;
  resize: vertical;
}

.share-form textarea:focus {
  outline: none;
  border-color: rgba(53, 255, 135, 0.65);
  box-shadow: 0 0 0 3px rgba(53, 255, 135, 0.11);
}

.clipboard-panel {
  margin-top: 18px;
}

.home-page .clipboard-panel {
  padding: 12px 14px;
}

.home-page .clipboard-panel .panel-heading {
  margin-bottom: 8px;
}

.home-grid > .clipboard-panel {
  margin-top: 0;
}

.admin-card-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.admin-link-card {
  display: block;
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(124, 199, 255, 0.18);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.38);
  color: #eaf2ff;
  text-decoration: none;
}

.admin-link-card strong,
.admin-link-card span {
  display: block;
}

.admin-link-card strong {
  color: #7cc7ff;
  font-size: 13px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.admin-link-card span {
  margin-top: 10px;
  color: #a9bad2;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.35;
}

.admin-link-card:hover,
.admin-link-card:focus {
  border-color: rgba(53, 255, 135, 0.45);
  color: #35ff87;
  text-decoration: none;
}

.admin-link-card:hover strong,
.admin-link-card:focus strong,
.clipboard-link-card strong {
  color: #35ff87;
}

.clipboard-form {
  margin-bottom: 18px;
}

.home-page .clipboard-form {
  gap: 8px;
  margin-bottom: 8px;
}

.home-page .clipboard-form textarea {
  min-height: 54px;
  max-height: 54px;
  padding: 9px 11px;
  resize: none;
}

.home-page .clipboard-list {
  gap: 6px;
}

.home-page .clipboard-entry {
  padding: 8px 10px;
}

.home-page .clipboard-entry-preview {
  align-items: flex-start;
  min-height: 44px;
  max-height: 60px;
  overflow: hidden;
}

.home-page .clipboard-entry-preview > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.home-page .clipboard-content-preview {
  margin-top: 5px;
  line-height: 1.35;
  max-height: 38px;
  overflow: hidden;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.upload-panel .hint {
  margin: 0;
  font-size: 12px;
  line-height: 1.35;
}

.home-wiki-panel {
  padding: 14px 16px;
}

.home-wiki-panel .panel-heading {
  margin-bottom: 8px;
}

.home-wiki-panel h2 {
  font-size: clamp(22px, 2.6vw, 28px);
}

.wiki-preview-filter {
  grid-template-columns: minmax(170px, 0.9fr) minmax(200px, 1.2fr) auto;
  align-items: end;
  gap: 10px;
  margin-top: 10px;
  padding: 10px;
  border: 1px solid rgba(124, 199, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.3);
}

.wiki-preview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.wiki-preview-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  max-height: 260px;
  overflow: auto;
  padding-right: 4px;
}

.wiki-preview-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid rgba(124, 199, 255, 0.15);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.38);
}

.wiki-preview-main {
  min-width: 0;
}

.wiki-preview-row .file-name {
  font-size: 16px;
  line-height: 1.25;
}

.wiki-preview-updated {
  margin: 6px 0 0;
  color: #a9bad2;
  font-size: 12px;
  font-weight: 750;
}

.clipboard-content {
  margin-top: 8px;
  color: #eaf2ff;
  font-size: 16px;
  font-weight: 750;
  line-height: 1.45;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

.user-table {
  min-width: 0;
  table-layout: fixed;
}

.user-table th,
.user-table td {
  max-width: none;
  padding: 10px 8px;
  white-space: normal;
}

.user-table th:nth-child(1),
.user-table td:nth-child(1),
.user-table th:nth-child(3),
.user-table td:nth-child(3),
.user-table th:nth-child(4),
.user-table td:nth-child(4),
.user-table th:nth-child(6),
.user-table td:nth-child(6) {
  width: 8%;
}

.user-table th:nth-child(5),
.user-table td:nth-child(5) {
  width: 15%;
}

.user-table th:nth-child(7),
.user-table td:nth-child(7) {
  width: 25%;
}

.user-table .table-actions {
  min-width: 0;
  gap: 6px;
}

.user-table .small-button,
.user-table .danger-button {
  min-height: 30px;
  padding: 7px 9px;
  font-size: 12px;
}

.account-panel,
.system-panel,
.system-log-panel {
  max-width: 100%;
}

.account-form {
  max-width: 560px;
}

.system-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 14px;
  margin-top: 18px;
}

.system-grid p {
  min-width: 0;
  margin: 0;
  padding: 16px;
  border: 1px solid rgba(124, 199, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.38);
}

.system-grid strong {
  display: block;
  margin-bottom: 10px;
  color: #7cc7ff;
  font-size: 12px;
  font-weight: 1000;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.system-grid span {
  display: block;
  color: #eaf2ff;
  font-size: 18px;
  font-weight: 850;
  overflow-wrap: anywhere;
}

.system-grid .system-status-ok,
.system-grid .system-status-bad {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 7px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 950;
  line-height: 1;
}

.system-grid .system-status-ok {
  border: 1px solid rgba(53, 255, 135, 0.38);
  background: rgba(53, 255, 135, 0.10);
  color: #a9ffc9;
}

.system-grid .system-status-bad {
  border: 1px solid rgba(255, 92, 92, 0.45);
  background: rgba(255, 92, 92, 0.10);
  color: #ffb6b6;
}

.system-log {
  max-height: 460px;
  overflow: auto;
  white-space: pre-wrap;
}

.invite-form {
  grid-template-columns: minmax(180px, 1.2fr) minmax(150px, 0.8fr) minmax(130px, 0.7fr) auto;
}

.invite-table th,
.invite-table td {
  vertical-align: top;
}

.invite-table small {
  display: block;
  margin-top: 6px;
  color: #a9bad2;
  font-size: 12px;
  font-weight: 750;
  overflow-wrap: anywhere;
}

.invite-code {
  display: inline-block;
  max-width: 280px;
  padding: 5px 7px;
  border: 1px solid rgba(124, 199, 255, 0.22);
  border-radius: 6px;
  background: rgba(5, 9, 14, 0.56);
  color: #eaf2ff;
  font-size: 13px;
  overflow-wrap: anywhere;
  white-space: normal;
}

.invite-status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 6px 9px;
  border: 1px solid rgba(124, 199, 255, 0.22);
  border-radius: 999px;
  background: rgba(5, 9, 14, 0.48);
  color: #eaf2ff;
  font-size: 12px;
  font-weight: 950;
  line-height: 1;
}

.invite-status-active {
  border-color: rgba(53, 255, 135, 0.38);
  background: rgba(53, 255, 135, 0.1);
  color: #a9ffc9;
}

.invite-status-used {
  border-color: rgba(124, 199, 255, 0.35);
  color: #b9dfff;
}

.invite-status-expired,
.invite-status-disabled {
  border-color: rgba(255, 218, 121, 0.34);
  background: rgba(255, 218, 121, 0.08);
  color: #ffe2a3;
}

.reset-password-form {
  display: grid;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 6px;
  width: min(100%, 270px);
}

.reset-password-form input {
  width: 100%;
  min-height: 30px;
  padding: 7px 9px;
  border: 1px solid rgba(124, 199, 255, 0.24);
  border-radius: 999px;
  background: #060d16;
  color: #eaf2ff;
  font: inherit;
  font-size: 12px;
  font-weight: 750;
}

.reset-password-form input:focus {
  outline: none;
  border-color: rgba(53, 255, 135, 0.65);
  box-shadow: 0 0 0 3px rgba(53, 255, 135, 0.11);
}

.user-table {
  width: 100%;
  min-width: 0;
}

.user-table th:nth-child(7),
.user-table td:nth-child(7) {
  width: 31%;
}

.user-table .table-actions {
  align-items: center;
}

@media (max-width: 980px) {
  .metric-grid,
  .pulse-grid,
  .system-band,
  .home-split,
  .home-work-row,
  .admin-card-grid {
    grid-template-columns: 1fr;
  }

  .login-home .container {
    grid-template-columns: 1fr;
    align-content: center;
    justify-items: center;
    gap: 18px;
    min-height: 100svh;
    padding-top: 24px;
    padding-bottom: 24px;
  }

  .login-home .home-login-hero,
  .login-home .login-gate-panel {
    width: min(100%, 460px);
    margin-left: auto;
    margin-right: auto;
  }

  .control-strip {
    justify-content: flex-start;
  }

  .user-table .table-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .reset-password-form {
    width: 100%;
  }

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

  .home-work-row {
    min-height: 0;
  }

  .wiki-preview-filter {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .download-preview-card,
  .clipboard-entry {
    display: grid;
  }

  .download-preview-card .file-actions,
  .clipboard-entry .inline-form {
    justify-content: flex-start;
  }

  .account-pill {
    margin-left: 0;
  }

  .hero-pills {
    justify-content: flex-start;
  }

  .login-home h1 {
    font-size: clamp(34px, 12vw, 46px);
  }

  .login-home .home-login-hero {
    text-align: center;
  }

  .upload-row {
    grid-template-columns: 1fr;
  }

  .wiki-preview-row {
    display: grid;
  }

  .wiki-preview-actions {
    align-items: flex-start;
  }
}

/* ===== J-Lab Phase 2 file controls ===== */

.upload-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

/* ===== J-Lab nav dropdown cleanup ===== */

.app-nav {
  position: relative;
  z-index: 20;
  width: min(100%, 720px);
  margin-left: auto;
  margin-right: auto;
}

.app-nav .nav-dropdown {
  position: relative;
  margin: 0;
  min-width: 0;
}

.app-nav .nav-dropdown > summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 8px 11px;
  border: 1px solid rgba(124, 199, 255, 0.22);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.56);
  color: #eaf2ff;
  font-size: 13px;
  font-weight: 900;
  line-height: 1;
  cursor: pointer;
  list-style: none;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.02);
}

.app-nav .nav-dropdown > summary::-webkit-details-marker {
  display: none;
}

.app-nav .nav-dropdown > summary::after {
  content: "v";
  margin-left: 7px;
  font-size: 11px;
  opacity: 0.9;
}

.app-nav .nav-dropdown[open] > summary,
.app-nav .nav-dropdown > summary:hover,
.app-nav .nav-dropdown > summary:focus {
  border-color: rgba(53, 255, 135, 0.45);
  color: #35ff87;
}

.app-nav .nav-dropdown-menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  max-width: min(92vw, 320px);
  padding: 6px;
  display: grid;
  gap: 6px;
  border: 1px solid rgba(124, 199, 255, 0.25);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.95);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.35);
  z-index: 70;
}

.app-nav .nav-dropdown-menu a {
  width: 100%;
  justify-content: flex-start;
  min-height: 32px;
  padding: 8px 10px;
  font-size: 12px;
}

.app-nav .nav-account-link {
  margin-left: auto;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.account-actions {
  margin-top: 16px;
  justify-content: flex-start;
}

@media (max-width: 860px) {
  .app-nav .nav-account-link {
    margin-left: 0;
  }
}

@media (max-width: 620px) {
  .app-nav {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: stretch;
    gap: 8px;
    width: min(100%, 720px);
    margin-left: auto;
    margin-right: auto;
    padding: 6px;
  }

  .app-nav a,
  .app-nav .nav-dropdown > summary {
    width: 100%;
    min-height: 42px;
    padding: 0 10px;
    justify-content: center;
    text-align: center;
  }

  .app-nav .nav-dropdown {
    width: 100%;
    min-width: 0;
  }

  .app-nav .nav-dropdown > summary {
    justify-content: center;
    white-space: normal;
  }

  .app-nav .nav-dropdown > summary::after {
    display: none;
  }

  .app-nav .nav-dropdown-menu {
    position: static;
    margin-top: 6px;
    min-width: 0;
    width: 100%;
    max-width: none;
  }

  .app-nav .nav-account-link {
    width: 100%;
    margin-left: 0;
    justify-content: center;
  }
}

.upload-panel .upload-row {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto;
}

.route-page .upload-panel .upload-row {
  grid-template-columns: 1fr;
}

.download-filter-form {
  grid-template-columns: minmax(180px, 1.4fr) minmax(140px, 1fr) minmax(140px, 1fr) minmax(96px, 0.7fr) auto;
  align-items: end;
  gap: 10px;
  margin: 18px 0;
  padding: 14px;
  border: 1px solid rgba(124, 199, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.36);
}

.download-filter-form input,
.download-filter-form select {
  min-height: 40px;
  padding: 9px 10px;
}

.filter-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.download-filter-form button,
.download-filter-form .reset-filter {
  min-height: 40px;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.file-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 5px 8px;
  border: 1px solid rgba(124, 199, 255, 0.2);
  border-radius: 999px;
  background: rgba(5, 9, 14, 0.52);
  color: #b9dfff;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
  line-height: 1;
  text-transform: uppercase;
}

.category-badge {
  border-color: rgba(53, 255, 135, 0.28);
  color: #a9ffc9;
}

.visibility-badge {
  border-color: rgba(124, 199, 255, 0.28);
  color: #9fd8ff;
}

.version-badge {
  border-color: rgba(255, 218, 121, 0.36);
  color: #ffe2a3;
}

.category-edit-form {
  grid-template-columns: minmax(180px, 260px) auto;
  align-items: end;
  max-width: 460px;
  margin-top: 18px;
  padding: 14px;
  border: 1px solid rgba(53, 255, 135, 0.18);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.34);
}

.file-history-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.history-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(124, 199, 255, 0.14);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.34);
}

.history-item .file-name {
  font-size: 16px;
}

@media (max-width: 900px) {
  .download-filter-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filter-actions {
    grid-column: 1 / -1;
  }
}

@media (max-width: 620px) {
  .download-filter-form,
  .category-edit-form,
  .history-item {
    grid-template-columns: 1fr;
  }

  .history-item .file-status {
    justify-self: start;
  }
}

/* ===== J-Lab Phase 4A Wiki ===== */

.wiki-panel,
.wiki-form-panel,
.wiki-view-panel {
  max-width: 100%;
}

.wiki-filter-form {
  grid-template-columns: minmax(220px, 1.4fr) minmax(190px, 0.9fr) auto auto;
  align-items: end;
  gap: 10px;
  margin: 18px 0 22px;
  padding: 14px;
  border: 1px solid rgba(124, 199, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.36);
}

.checkbox-label {
  align-self: center;
  display: inline-flex !important;
  grid-auto-flow: column;
  align-items: center;
  justify-content: flex-start;
  gap: 9px !important;
  min-height: 40px;
  color: #eaf2ff !important;
  letter-spacing: 0 !important;
  text-transform: none !important;
}

.checkbox-label input {
  width: 18px;
  min-height: 18px;
  accent-color: #35ff87;
}

.wiki-card-list {
  display: grid;
  gap: 12px;
}

.wiki-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 18px;
  border: 1px solid rgba(124, 199, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.38);
}

.wiki-card-main {
  min-width: 0;
}

.wiki-card h3 {
  margin: 10px 0 6px;
  color: #eaf2ff;
  font-size: clamp(22px, 3vw, 30px);
  line-height: 1.12;
  overflow-wrap: anywhere;
}

.wiki-card-meta,
.wiki-preview {
  margin: 0;
  line-height: 1.45;
}

.wiki-card-meta {
  color: #7cc7ff;
  font-size: 13px;
  font-weight: 850;
}

.wiki-preview {
  margin-top: 10px;
  color: #a9bad2;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.wiki-pin-badge {
  border-color: rgba(255, 218, 121, 0.36);
  color: #ffe2a3;
}

.wiki-note-form {
  max-width: 100%;
}

.wiki-note-form textarea {
  min-height: 420px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.55;
}

.wiki-body {
  display: grid;
  gap: 16px;
  margin-top: 20px;
}

.wiki-body p {
  margin: 0;
  color: #eaf2ff;
  font-size: 17px;
  line-height: 1.65;
  overflow-wrap: anywhere;
}

.wiki-code-block {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(124, 199, 255, 0.18);
  border-radius: 8px;
  background: #05090e;
}

.wiki-code-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 12px 0;
}

.wiki-code-block pre {
  margin: 0;
  padding: 12px 18px 18px;
  overflow-x: auto;
  border: 0;
  color: #a9ffc9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre;
  word-break: normal;
}

.copy-code-button {
  position: static;
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid rgba(53, 255, 135, 0.38);
  border-radius: 999px;
  background: rgba(53, 255, 135, 0.10);
  color: #35ff87;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
}

.copy-code-button:hover,
.copy-code-button:focus {
  background: rgba(53, 255, 135, 0.18);
}

.wiki-open-lab-menu {
  position: relative;
}

.wiki-open-lab-summary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 6px 10px;
  border: 1px solid rgba(124, 199, 255, 0.34);
  border-radius: 999px;
  background: rgba(124, 199, 255, 0.1);
  color: #9fd8ff;
  cursor: pointer;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.06em;
  line-height: 1;
  text-transform: uppercase;
  list-style: none;
}

.wiki-open-lab-summary::-webkit-details-marker {
  display: none;
}

.wiki-open-lab-summary:hover,
.wiki-open-lab-summary:focus {
  border-color: rgba(53, 255, 135, 0.5);
  color: #35ff87;
}

.wiki-open-lab-options {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 4;
  min-width: 148px;
  padding: 8px;
  border: 1px solid rgba(124, 199, 255, 0.28);
  border-radius: 8px;
  background: rgba(5, 12, 20, 0.96);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.34);
  display: grid;
  gap: 6px;
}

.wiki-open-lab-option {
  width: 100%;
  min-height: 30px;
  padding: 7px 10px;
  border: 1px solid rgba(124, 199, 255, 0.25);
  border-radius: 6px;
  background: rgba(5, 9, 14, 0.62);
  color: #eaf2ff;
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 800;
  text-align: left;
}

.wiki-open-lab-option:hover,
.wiki-open-lab-option:focus {
  border-color: rgba(53, 255, 135, 0.46);
  color: #35ff87;
}

@media (max-width: 720px) {
  .wiki-code-actions {
    justify-content: stretch;
  }

  .wiki-code-actions .copy-code-button,
  .wiki-open-lab-menu,
  .wiki-open-lab-summary {
    width: 100%;
  }

  .wiki-open-lab-options {
    position: static;
    min-width: 0;
    margin-top: 6px;
  }
}

@media (max-width: 900px) {
  .wiki-filter-form {
    grid-template-columns: 1fr;
  }

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

  .wiki-card .file-actions {
    justify-content: flex-start;
  }
}

/* ===== J-Lab Phase 4B mobile/download/wiki polish ===== */

.download-bulk-form {
  grid-template-columns: minmax(190px, 1.2fr) minmax(190px, 1.2fr) auto;
  align-items: end;
  gap: 10px;
  margin: 12px 0 16px;
  padding: 14px;
  border: 1px solid rgba(53, 255, 135, 0.18);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.34);
}

.download-bulk-form p.hint {
  grid-column: 1 / -1;
  margin: 2px 0 0;
}

.bulk-select {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 32px;
  padding: 0 8px;
  border: 1px solid rgba(124, 199, 255, 0.22);
  border-radius: 999px;
  color: #b9dfff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.bulk-select input {
  width: 16px;
  height: 16px;
  accent-color: #35ff87;
}

.copy-link-button {
  border: 1px solid rgba(124, 199, 255, 0.24);
  background: rgba(5, 9, 14, 0.42);
  color: #9fd8ff;
}

.downloads-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.page-indicator {
  color: #d3e8ff;
  border-color: rgba(124, 199, 255, 0.3);
  background: rgba(6, 12, 21, 0.62);
}

.wiki-category-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 0 0 14px;
}

.wiki-category-chip {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 6px 10px;
  border: 1px solid rgba(124, 199, 255, 0.22);
  border-radius: 999px;
  background: rgba(5, 9, 14, 0.42);
  color: #b9dfff;
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.wiki-category-chip:hover,
.wiki-category-chip:focus,
.wiki-category-chip.is-active {
  border-color: rgba(53, 255, 135, 0.45);
  color: #35ff87;
  text-decoration: none;
}

.wiki-section-block + .wiki-section-block {
  margin-top: 16px;
}

.wiki-section-title {
  margin: 0 0 10px;
  color: #9fd8ff;
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

mark {
  padding: 0 2px;
  border-radius: 4px;
  background: rgba(255, 218, 121, 0.26);
  color: #fff3c8;
}

@media (max-width: 700px) {
  .download-filter-form {
    grid-template-columns: 1fr;
  }

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

  .download-bulk-form button,
  .download-filter-form button,
  .download-filter-form .reset-filter {
    width: auto;
    min-height: 38px;
  }

  .uploaded-file {
    grid-template-columns: 48px minmax(0, 1fr);
    gap: 10px;
    padding: 12px;
  }

  .uploaded-file .file-actions {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }

  .upload-panel .upload-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .dropzone {
    min-height: 120px;
    padding: 14px;
  }

  .login-home .login-gate-panel {
    width: min(100%, 420px);
  }

  .login-home .share-form button {
    width: auto;
  }
}

/* ===== J-Lab Labs Stage 8B ===== */

.labs-panel,
.labs-instances-panel {
  max-width: 100%;
}

.labs-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.labs-toolbar .small-button {
  white-space: nowrap;
}

.labs-cleanup-cards {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.labs-stat-card {
  min-width: 0;
  padding: 12px 14px;
  border: 1px solid rgba(124, 199, 255, 0.2);
  border-radius: 8px;
  background: rgba(5, 17, 25, 0.5);
  display: grid;
  gap: 4px;
}

.labs-stat-card span {
  color: #9fd8ff;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.labs-stat-card strong {
  color: #ecf6ff;
  font-size: 26px;
  line-height: 1;
}

.labs-safety-note {
  margin: 10px 0 0;
  font-size: 13px;
}

.labs-history-note {
  margin: 6px 0 0;
  font-size: 13px;
}

.labs-history-toggle {
  white-space: nowrap;
}

.labs-status-grid span {
  font-size: 16px;
}

.labs-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.lab-type-card {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(124, 199, 255, 0.16);
  border-radius: 8px;
  background: rgba(5, 9, 14, 0.38);
}

.lab-type-card.is-disabled {
  opacity: 0.78;
}

.lab-type-card h3 {
  margin: 12px 0 10px;
  color: #eaf2ff;
  font-size: 22px;
  line-height: 1.15;
}

.lab-type-card .muted {
  margin: 0 0 12px;
  font-size: 14px;
}

.labs-table th:nth-child(1),
.labs-table td:nth-child(1) {
  width: 6%;
}

.labs-table th:nth-child(2),
.labs-table td:nth-child(2) {
  width: 8%;
}

.labs-table th:nth-child(4),
.labs-table td:nth-child(4),
.labs-table th:nth-child(5),
.labs-table td:nth-child(5),
.labs-table th:nth-child(6),
.labs-table td:nth-child(6) {
  width: 11%;
}

.labs-table th:nth-child(10),
.labs-table td:nth-child(10) {
  width: 14%;
}

.labs-table .table-actions {
  min-width: 0;
  gap: 6px;
}

.lab-status-running {
  border-color: rgba(53, 255, 135, 0.4);
  background: rgba(53, 255, 135, 0.1);
  color: #a9ffc9;
}

.lab-status-stopped {
  border-color: rgba(255, 218, 121, 0.36);
  background: rgba(255, 218, 121, 0.12);
  color: #ffe2a3;
}

.lab-status-created {
  border-color: rgba(124, 199, 255, 0.34);
  background: rgba(124, 199, 255, 0.12);
  color: #9fd8ff;
}

.lab-status-expired {
  border-color: rgba(255, 170, 124, 0.42);
  background: rgba(255, 170, 124, 0.14);
  color: #ffd0ad;
}

.lab-status-deleted {
  border-color: rgba(120, 130, 150, 0.36);
  background: rgba(120, 130, 150, 0.12);
  color: #c5cede;
}

.lab-status-error {
  border-color: rgba(255, 92, 92, 0.45);
  background: rgba(255, 92, 92, 0.12);
  color: #ffb6b6;
}

.lab-status-missing {
  border-color: rgba(160, 170, 185, 0.38);
  background: rgba(160, 170, 185, 0.1);
  color: #d7dfef;
}

@media (max-width: 980px) {
  .labs-toolbar {
    width: 100%;
    justify-content: flex-start;
  }

  .labs-toolbar .inline-form,
  .labs-toolbar .small-button {
    width: 100%;
  }

  .labs-table .table-actions {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ===== J-Lab Labs Stage 8C ===== */

.labs-shell-warning-inline {
  margin-top: 12px;
}

.labs-shell-panel .panel-heading {
  align-items: flex-start;
}

.labs-shell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.labs-shell-warning {
  margin: 8px 0 14px;
}

.labs-shell-meta span {
  font-size: 15px;
}

.labs-shell-error {
  margin: 12px 0;
}

.labs-wiki-command-panel {
  margin: 10px 0 14px;
  padding: 14px;
  border: 1px solid rgba(53, 255, 135, 0.32);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(8, 24, 30, 0.95), rgba(5, 14, 24, 0.95));
}

.labs-wiki-command-head p {
  margin: 0 0 6px;
}

.labs-wiki-command-warning {
  margin: 8px 0 8px;
  color: #ffd8a8;
  font-weight: 800;
}

.labs-wiki-command-panel pre {
  margin: 0;
  padding: 12px;
  border: 1px solid rgba(124, 199, 255, 0.22);
  border-radius: 8px;
  background: rgba(3, 8, 14, 0.86);
  overflow-x: auto;
}

.labs-wiki-command-panel code {
  color: #a9ffc9;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre;
}

.labs-wiki-command-panel .copy-code-button {
  margin-top: 10px;
}

.labs-shell-terminal-wrap {
  margin-top: 12px;
  padding: 10px;
  border: 1px solid rgba(124, 199, 255, 0.22);
  border-radius: 8px;
  background: rgba(3, 8, 14, 0.88);
}

.labs-shell-frame {
  width: 100%;
  min-height: 520px;
  height: 68vh;
  border: 1px solid rgba(124, 199, 255, 0.18);
  border-radius: 6px;
  background: #05090e;
}

@media (max-width: 980px) {
  .labs-shell-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .labs-shell-actions .inline-form,
  .labs-shell-actions .small-button,
  .labs-shell-actions .file-status {
    width: 100%;
  }

  .labs-wiki-command-panel .copy-code-button {
    width: 100%;
  }

  .labs-shell-frame {
    min-height: 420px;
    height: 62vh;
  }
}
