:root {
  --bg: #111827;
  --gray-950: #030712;
  --gray-900: #111827;
  --gray-850: #172033;
  --gray-800: #1f2937;
  --gray-700: #374151;
  --gray-600: #4b5563;
  --gray-500: #6b7280;
  --gray-400: #9ca3af;
  --gray-300: #d1d5db;
  --text: #ffffff;
  --muted: #9ca3af;
  --muted-soft: #6b7280;
  --glass: rgba(255, 255, 255, 0.05);
  --glass-hover: rgba(255, 255, 255, 0.10);
  --glass-strong: rgba(255, 255, 255, 0.12);
  --border: rgba(255, 255, 255, 0.10);
  --border-hover: rgba(255, 255, 255, 0.20);
  --karma-300: #d8b4fe;
  --karma-400: #c084fc;
  --karma-500: #a855f7;
  --karma-600: #9333ea;
  --blue: #93c5fd;
  --emerald: #6ee7b7;
  --green: #4ade80;
  --orange: #fdba74;
  --red: #fca5a5;
  --yellow: #facc15;
  --amber: #fbbf24;
  --shine: inset 0 1px 0 rgba(255, 255, 255, 0.055);
  --shadow-xl: none;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html { background: var(--gray-900); }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background: var(--gray-900);
  font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
body.modal-open {
  overflow: hidden;
}

a {
  color: var(--karma-300);
  text-decoration: none;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}
a:hover { color: #f3e8ff; }

code {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--karma-300);
  padding: 1px 6px;
  font-size: 0.9em;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: var(--glass);
  border: 1px solid var(--border);
  border-top: 0;
  border-radius: 0 0 12px 12px;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.topbar-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  max-width: 80rem;
  min-height: 50px;
  margin: 0 auto;
  padding: 10px 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  position: absolute;
  left: 16px;
  flex: 0 0 auto;
  color: var(--text);
  font-size: 1.25rem;
  font-weight: 800;
  line-height: 1;
}
.brand span:last-child {
  color: transparent;
  background: linear-gradient(90deg, var(--karma-300), var(--karma-500));
  -webkit-background-clip: text;
  background-clip: text;
}
.brand:hover { text-decoration: none; }

.brand-mark {
  position: relative;
  width: 21px;
  height: 21px;
  color: var(--karma-400);
  filter: drop-shadow(0 0 8px rgba(192, 132, 252, 0.28));
}
.brand-mark::before {
  content: "";
  position: absolute;
  left: 2px;
  bottom: 3px;
  width: 7px;
  height: 7px;
  border-radius: 3px;
  background: currentColor;
  transform: rotate(45deg);
}
.brand-mark::after {
  content: "";
  position: absolute;
  right: 0;
  top: 0;
  width: 16px;
  height: 16px;
  border: 3px solid currentColor;
  border-left-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  transform: rotate(10deg);
}

.top-nav {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin: 0 auto;
  font-size: 0.9rem;
}
.top-nav a {
  color: var(--gray-400);
  border-radius: 8px;
  padding: 7px 12px;
}
.top-nav a:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}
.top-nav a.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.10);
}

.app-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 20px;
  width: min(calc(100% - 32px), 80rem);
  min-height: calc(100vh - 74px);
  margin: 24px auto 0;
}

.sidebar {
  position: sticky;
  top: 74px;
  align-self: start;
  max-height: calc(100vh - 96px);
  overflow: auto;
  padding: 14px;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shine);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}

.nav-section + .nav-section { margin-top: 18px; }
.nav-title {
  color: var(--gray-500);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  margin: 0 8px 7px;
  text-transform: uppercase;
}

.nav-link {
  display: flex;
  align-items: center;
  min-height: 34px;
  padding: 7px 10px;
  border-radius: 8px;
  color: var(--gray-300);
}
.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}
.nav-link.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.10);
}

.account-section {
  margin-top: 22px;
}
.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 38px;
  padding: 8px 10px;
  color: var(--gray-300);
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.account-card span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.account-card .link-btn {
  color: var(--gray-400);
  white-space: nowrap;
}
.account-card .link-btn:hover {
  color: var(--text);
}

.content {
  min-width: 0;
  padding: 0 0 56px;
}
.container {
  max-width: 30rem;
  margin: 0 auto;
  padding: 42px 16px 64px;
}
.foot {
  color: var(--gray-500);
  text-align: center;
  padding: 16px;
  font-size: 0.78rem;
}

h1 {
  margin: 0;
  color: var(--text);
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1.2;
}
h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
}
h3 {
  margin: 0 0 10px;
  color: var(--text);
  font-size: 0.95rem;
}

.page-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}
.page-subtitle {
  margin: 6px 0 0;
  color: var(--gray-400);
}
.head-actions {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.crumbs {
  color: var(--gray-400);
  margin-bottom: 12px;
}
.crumbs a { color: var(--karma-300); }

.panel,
.card,
.toolbar {
  position: relative;
  overflow: hidden;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shine);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.panel::before,
.card::before,
.toolbar::before,
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.16), transparent);
  pointer-events: none;
}
.panel,
.card {
  margin-bottom: 16px;
  padding: 16px;
}
.card.narrow { margin: 44px auto; }
.card.highlight { border-color: rgba(34, 197, 94, 0.45); }

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  padding: 16px;
}
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}
.toolbar form,
.inline-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}
.toolbar form.inline {
  display: inline-flex;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9000;
  display: grid;
  place-items: start center;
  padding: min(10vh, 72px) 16px 24px;
  background: rgba(3, 7, 18, 0.58);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
.modal-dialog {
  width: min(430px, 100%);
  overflow: hidden;
  color: var(--text);
  background: rgba(31, 41, 55, 0.94);
  border: 1px solid var(--border-hover);
  border-radius: 10px;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.46), var(--shine);
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 48px;
  padding: 14px 14px 13px 16px;
  border-bottom: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
}
.modal-head h2 {
  margin: 0;
  font-size: 0.98rem;
}
.modal-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  color: var(--gray-400);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 800;
  line-height: 1;
}
.modal-close:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.10);
}
.modal-body {
  padding: 16px;
}
.modal-body label {
  margin: 0;
  color: var(--gray-300);
  font-weight: 700;
}
.modal-field {
  display: grid;
  gap: 7px;
}
.modal-label {
  color: var(--gray-300);
  font-weight: 700;
}
.modal-body input[type=text],
.modal-body input[type=file] {
  width: 100%;
  margin-top: 7px;
}
.file-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.file-select-row .modal-help {
  flex: 1;
  min-width: 0;
  margin: 0;
}
.modal-help {
  min-height: 20px;
  margin: 9px 0 0;
  color: var(--gray-400);
  font-size: 0.86rem;
  overflow-wrap: anywhere;
}
.modal-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 13px 16px 16px;
  border-top: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.035);
}
.modal-form {
  margin: 0;
}

.selection-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: rgba(168, 85, 247, 0.14);
  border: 1px solid rgba(168, 85, 247, 0.35);
  border-radius: 12px;
  color: var(--text);
  backdrop-filter: blur(24px);
}
.selection-count {
  margin-right: 4px;
  color: var(--karma-300);
  font-weight: 800;
}

.dropzone {
  display: grid;
  gap: 4px;
  place-items: center;
  min-height: 88px;
  margin: 0 0 16px;
  padding: 16px;
  color: var(--gray-400);
  background: rgba(168, 85, 247, 0.10);
  border: 1px dashed rgba(192, 132, 252, 0.48);
  border-radius: 12px;
  text-align: center;
  backdrop-filter: blur(24px);
  transition: background 160ms ease, border-color 160ms ease, color 160ms ease;
}
.dropzone strong { color: var(--text); }
.dropzone.dragover,
body.drag-upload-active .dropzone {
  color: var(--text);
  background: rgba(168, 85, 247, 0.20);
  border-color: rgba(216, 180, 254, 0.78);
}
.drop-status {
  min-height: 20px;
  color: var(--karma-300);
  font-weight: 800;
}
body.drag-upload-active .content {
  outline: 1px solid rgba(192, 132, 252, 0.36);
  outline-offset: -8px;
}

input[type=text],
input[type=password],
input[type=file],
input[type=search],
select,
textarea,
.linkbox {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  font: inherit;
  padding: 8px 10px;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease;
}
input::placeholder,
textarea::placeholder { color: var(--gray-500); }
input[type=file]::file-selector-button {
  margin-right: 10px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--gray-300);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 9px;
}
input:focus,
select:focus,
textarea:focus,
.linkbox:focus {
  border-color: rgba(168, 85, 247, 0.50);
}
label {
  display: block;
  margin-bottom: 10px;
  color: var(--gray-400);
}
label input,
label select { display: block; width: 100%; margin-top: 4px; }

.btn,
.link-btn,
button {
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
}
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 34px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--gray-300);
  border: 1px solid transparent;
  padding: 7px 13px;
  font-size: 0.92rem;
  font-weight: 600;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--text);
  text-decoration: none;
}
.btn.primary {
  background: rgba(168, 85, 247, 0.20);
  color: var(--karma-300);
}
.btn.primary:hover { background: rgba(168, 85, 247, 0.30); }
.btn.submit {
  background: rgba(168, 85, 247, 0.20);
  border-color: rgba(168, 85, 247, 0.32);
  color: var(--karma-300);
}
.btn.submit:hover {
  background: rgba(34, 197, 94, 0.22);
  border-color: rgba(34, 197, 94, 0.42);
  color: #86efac;
}
.btn.danger {
  background: rgba(239, 68, 68, 0.20);
  color: var(--red);
}
.btn.danger:hover { background: rgba(239, 68, 68, 0.30); }

.toolbar .upload .btn.primary {
  background: rgba(168, 85, 247, 0.20);
  color: var(--karma-300);
}
.newfolder .btn {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
}

.link-btn {
  background: none;
  border: none;
  color: var(--gray-400);
  padding: 2px 5px;
}
.link-btn:hover {
  color: var(--text);
  text-decoration: none;
}
.link-btn.danger { color: var(--red); }
.inline,
form.inline { display: inline; }

.listing {
  width: 100%;
  overflow: hidden;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--glass);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: var(--shine);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
}
.listing th,
.listing td {
  border-bottom: 1px solid rgba(255, 255, 255, 0.055);
  padding: 10px 12px;
  text-align: left;
  vertical-align: middle;
}
.listing th {
  color: var(--gray-400);
  font-size: 0.78rem;
  font-weight: 800;
}
.listing tbody tr {
  transition: background 140ms ease;
}
.listing tbody tr:hover { background: rgba(255, 255, 255, 0.05); }
.listing tbody tr.selected {
  background: rgba(168, 85, 247, 0.14);
}
.listing tr:last-child td { border-bottom: none; }
.listing td.actions,
.listing th.actions {
  text-align: right;
  white-space: nowrap;
}
.select-col {
  width: 36px;
  text-align: center !important;
}
.select-col input[type=checkbox] {
  width: 14px;
  height: 14px;
  accent-color: var(--karma-500);
  cursor: pointer;
}
.listing.compact {
  box-shadow: none;
  margin-top: 10px;
}

.icon-actions { white-space: nowrap; }
.icon-actions form.inline { display: inline-flex; }
.icon-actions .icon-btn,
.icon-actions form.inline {
  margin-left: 4px;
  vertical-align: middle;
}
.icon-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--gray-400);
  padding: 0;
  transition: background 160ms ease, color 160ms ease, border-color 160ms ease;
}
.icon-btn:hover {
  background: rgba(255, 255, 255, 0.10);
  color: var(--text);
  text-decoration: none;
}
.icon-btn.danger:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.16);
}
.icon-btn.copied {
  color: var(--green);
  background: rgba(34, 197, 94, 0.14);
}

[data-tooltip] {
  cursor: inherit;
}

.tooltip-layer {
  position: fixed;
  z-index: 10000;
  width: max-content;
  max-width: min(260px, calc(100vw - 16px));
  padding: 5px 8px;
  color: var(--gray-300);
  background: rgba(31, 41, 55, 0.98);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  white-space: normal;
  pointer-events: none;
  opacity: 0;
  transform: translateY(2px);
  transition: opacity 90ms ease, transform 90ms ease;
}
.tooltip-layer.visible {
  opacity: 1;
  transform: translateY(0);
}
.tooltip-layer::before {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -5px;
  width: 8px;
  height: 8px;
  background: rgba(31, 41, 55, 0.98);
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  transform: translateX(-50%) rotate(45deg);
}
.tooltip-layer.below::before {
  top: -5px;
  bottom: auto;
  border: 0;
  border-left: 1px solid var(--border);
  border-top: 1px solid var(--border);
}

.context-menu {
  position: fixed;
  z-index: 100;
  min-width: 210px;
  overflow: hidden;
  padding: 4px;
  background: var(--gray-800);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.36);
}
.context-menu button {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  min-height: 34px;
  padding: 8px 10px;
  color: var(--gray-300);
  background: transparent;
  border: 0;
  border-radius: 7px;
  text-align: left;
  font-size: 0.88rem;
  transition: color 150ms ease, background 150ms ease;
}
.context-menu button:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.10);
}
.context-menu button.danger:hover {
  color: var(--red);
  background: rgba(239, 68, 68, 0.16);
}
.context-separator {
  height: 1px;
  margin: 4px 2px;
  background: var(--border);
}

.i {
  position: relative;
  display: inline-block;
  width: 16px;
  height: 16px;
}
.i::before,
.i::after {
  content: "";
  position: absolute;
  box-sizing: border-box;
}
.i-open::before {
  left: 1px;
  top: 3px;
  width: 14px;
  height: 10px;
  border: 2px solid currentColor;
  border-radius: 8px / 6px;
}
.i-open::after {
  left: 6px;
  top: 6px;
  width: 4px;
  height: 4px;
  background: currentColor;
  border-radius: 50%;
}
.i-download::before {
  left: 7px;
  top: 1px;
  width: 2px;
  height: 9px;
  background: currentColor;
}
.i-download::after {
  left: 3px;
  top: 7px;
  width: 10px;
  height: 8px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: rotate(-45deg);
}
.i-link::before {
  left: 1px;
  top: 6px;
  width: 8px;
  height: 5px;
  border: 2px solid currentColor;
  border-radius: 5px;
  transform: rotate(-30deg);
}
.i-link::after {
  right: 1px;
  top: 5px;
  width: 8px;
  height: 5px;
  border: 2px solid currentColor;
  border-radius: 5px;
  transform: rotate(-30deg);
}
.i-clock::before {
  inset: 1px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.i-clock::after {
  left: 7px;
  top: 4px;
  width: 5px;
  height: 6px;
  border-left: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
}
.i-lock::before {
  left: 3px;
  top: 7px;
  width: 10px;
  height: 7px;
  border: 2px solid currentColor;
  border-radius: 2px;
}
.i-lock::after {
  left: 5px;
  top: 1px;
  width: 6px;
  height: 8px;
  border: 2px solid currentColor;
  border-bottom: 0;
  border-radius: 8px 8px 0 0;
}
.i-public::before {
  left: 1px;
  top: 1px;
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-radius: 50%;
}
.i-public::after {
  left: 3px;
  top: 7px;
  width: 10px;
  border-top: 2px solid currentColor;
}
.i-rename::before {
  left: 2px;
  top: 11px;
  width: 12px;
  border-top: 2px solid currentColor;
}
.i-rename::after {
  left: 4px;
  top: 2px;
  width: 9px;
  height: 9px;
  border-left: 3px solid currentColor;
  border-bottom: 3px solid currentColor;
  transform: skew(-18deg) rotate(-45deg);
}
.i-trash::before {
  left: 4px;
  top: 5px;
  width: 8px;
  height: 10px;
  border: 2px solid currentColor;
  border-top: 0;
  border-radius: 0 0 2px 2px;
}
.i-trash::after {
  left: 3px;
  top: 2px;
  width: 10px;
  border-top: 2px solid currentColor;
}
.i-restore::before {
  left: 2px;
  top: 3px;
  width: 12px;
  height: 10px;
  border: 2px solid currentColor;
  border-left-color: transparent;
  border-radius: 50%;
}
.i-restore::after {
  left: 1px;
  top: 2px;
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  border-right: 6px solid currentColor;
}

.empty {
  color: var(--gray-400);
  text-align: center;
  padding: 24px;
}

.name-cell {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 250px;
}
.item-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: var(--text);
  font-weight: 700;
}
.item-name:hover {
  color: var(--karma-300);
  text-decoration: none;
}
.item-icon {
  display: inline-block;
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  border-radius: 4px;
}
.folder-icon {
  background: linear-gradient(180deg, #facc15, #d97706);
  box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.22);
}
.file-icon {
  background: linear-gradient(180deg, #c084fc, #7c3aed);
  border-radius: 3px;
}

.star-form { line-height: 1; }
.star {
  width: 24px;
  height: 24px;
  background: transparent;
  border: none;
  color: var(--gray-500);
  font-size: 1rem;
  line-height: 1;
  padding: 0;
}
.star:hover,
.star.on {
  color: var(--yellow);
  font-weight: 800;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  border: 1px solid var(--border);
  border-radius: 999px;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  text-transform: uppercase;
}
.badge.public {
  background: rgba(34, 197, 94, 0.10);
  border-color: rgba(34, 197, 94, 0.40);
  color: #86efac;
}
.badge.private {
  background: rgba(255, 255, 255, 0.05);
  color: var(--gray-400);
}

.alert {
  border-radius: 8px;
  padding: 10px 12px;
}
.alert.error {
  background: rgba(239, 68, 68, 0.10);
  border: 1px solid rgba(239, 68, 68, 0.32);
  color: var(--red);
}
.alert.ok {
  background: rgba(34, 197, 94, 0.10);
  border: 1px solid rgba(34, 197, 94, 0.32);
  color: #bbf7d0;
}

.linkrow {
  display: flex;
  gap: 8px;
  align-items: center;
  margin: 10px 0;
}
.linkbox {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  font-size: 0.88rem;
}
.linkbox.small {
  width: min(440px, 42vw);
}
.hint,
.meta {
  color: var(--gray-400);
  font-size: 0.88rem;
}

.grid2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.grid2 form {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 13px;
}

.segmented {
  display: inline-flex;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.segmented a {
  color: var(--gray-400);
  padding: 8px 12px;
}
.segmented a.active {
  background: rgba(168, 85, 247, 0.30);
  color: var(--text);
  text-decoration: none;
}

.detail {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--gray-400);
  overflow: auto;
  padding: 12px;
  font-size: 0.8rem;
}

.upload-link-box {
  grid-column: 1 / -1;
  border-top: 1px solid var(--border);
  padding-top: 12px;
}
.public-upload-card { margin-top: 70px; }

.preview-panel { padding: 14px; }
.preview-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.preview-title h2 { margin: 0; }
.preview-stage {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 300px;
  background: rgba(3, 7, 18, 0.72);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: auto;
}
.image-stage { padding: 16px; }
.image-preview {
  display: block;
  max-width: 100%;
  max-height: 72vh;
  object-fit: contain;
}
.media-player {
  display: block;
  width: min(100%, 1080px);
  max-height: 72vh;
  background: #000;
}
.audio-player {
  display: block;
  width: 100%;
  margin-top: 4px;
}
.text-editor {
  display: block;
  width: 100%;
  min-height: 440px;
  resize: vertical;
  background: rgba(3, 7, 18, 0.72);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 14px;
  font: 13px/1.55 ui-monospace, SFMono-Regular, Consolas, "Liberation Mono", monospace;
  tab-size: 2;
}
.preview-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
}

@media (max-width: 1080px) {
  .topbar-inner { flex-wrap: wrap; }
  .top-nav {
    order: 3;
    flex-basis: 100%;
    justify-content: flex-start;
    padding-left: 0;
  }
}

@media (max-width: 920px) {
  .brand {
    position: static;
  }
  .topbar-inner {
    justify-content: flex-start;
  }
  .top-nav {
    order: 2;
  }
  .app-layout {
    grid-template-columns: 1fr;
    margin-top: 16px;
  }
  .sidebar {
    position: static;
    display: flex;
    gap: 12px;
    max-height: none;
    overflow-x: auto;
    padding: 12px;
  }
  .nav-section { min-width: 170px; }
  .page-head {
    display: grid;
    grid-template-columns: 1fr;
  }
  .grid2 { grid-template-columns: 1fr; }
  .listing {
    display: block;
    overflow-x: auto;
  }
  .linkrow { flex-wrap: wrap; }
  .linkbox.small,
  .linkbox {
    width: 100%;
    flex-basis: 100%;
  }
}
