:root {
  --ink: #161713;
  --muted: #6f716a;
  --paper: #f4f2ed;
  --panel: #fbfaf7;
  --line: #dcd9d0;
  --acid: #d9ff43;
  --blue: #3155ff;
  --red: #d73c2c;
  --shadow: 0 24px 80px rgba(37, 36, 31, 0.12);
  font-family:
    Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background: var(--paper);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 78% 12%, rgba(49, 85, 255, 0.08), transparent 28rem),
    var(--paper);
}

button,
input {
  font: inherit;
}

button {
  color: inherit;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

.hidden {
  display: none !important;
}

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

.noise {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  opacity: 0.028;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 180 180' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.8'/%3E%3C/svg%3E");
}

.eyebrow {
  margin: 0 0 0.8rem;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 750;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.auth-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(22rem, 0.86fr) minmax(30rem, 1.14fr);
}

.auth-card {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: clamp(2rem, 7vw, 7rem);
}

.brand-mark,
.wordmark-mark {
  display: grid;
  place-items: center;
  width: 2.45rem;
  height: 2.45rem;
  margin-bottom: 3.7rem;
  color: white;
  background: var(--ink);
  border-radius: 0.7rem;
  font-size: 1rem;
  font-weight: 850;
  letter-spacing: -0.04em;
}

.auth-card h1 {
  max-width: 10ch;
  margin: 0;
  font-size: clamp(3.2rem, 6vw, 5.7rem);
  line-height: 0.92;
  letter-spacing: -0.075em;
}

.auth-copy {
  max-width: 27rem;
  margin: 1.65rem 0 2.25rem;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.65;
}

.auth-form {
  max-width: 29rem;
}

.auth-form > label:first-child,
.dialog-card > label {
  display: block;
  margin-bottom: 0.55rem;
  font-size: 0.76rem;
  font-weight: 750;
}

.key-field {
  position: relative;
}

.key-field input,
.dialog-card > input {
  width: 100%;
  height: 3.35rem;
  padding: 0 4.5rem 0 1rem;
  color: var(--ink);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.75rem;
  outline: none;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease;
}

.dialog-card > input {
  padding-right: 1rem;
}

.key-field input:focus,
.dialog-card > input:focus,
.search-field:focus-within {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(49, 85, 255, 0.12);
}

.text-button {
  position: absolute;
  top: 50%;
  right: 0.95rem;
  padding: 0;
  transform: translateY(-50%);
  color: var(--muted);
  background: none;
  border: 0;
  cursor: pointer;
  font-size: 0.75rem;
  font-weight: 750;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: fit-content;
  margin: 0.9rem 0 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 0.76rem;
}

.checkbox-row input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--ink);
}

.form-error {
  min-height: 1rem;
  margin: 0.7rem 0;
  color: var(--red);
  font-size: 0.76rem;
}

.primary-button,
.secondary-button,
.danger-button,
.quiet-button,
.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
  min-height: 2.75rem;
  padding: 0 1.1rem;
  border-radius: 0.65rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 760;
  transition:
    transform 150ms ease,
    background-color 150ms ease,
    border-color 150ms ease;
}

.primary-button {
  color: white;
  background: var(--ink);
  border: 1px solid var(--ink);
}

.primary-button:hover,
.danger-button:hover {
  transform: translateY(-1px);
}

.auth-submit {
  width: 100%;
  justify-content: space-between;
  min-height: 3.35rem;
}

.secondary-button {
  background: var(--panel);
  border: 1px solid var(--line);
}

.secondary-button:hover,
.quiet-button:hover,
.icon-button:hover {
  border-color: #aaa99f;
  background: white;
}

.danger-button {
  color: white;
  background: var(--red);
  border: 1px solid var(--red);
}

.quiet-button,
.icon-button {
  min-height: 2.3rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
}

.icon-button {
  width: 2.3rem;
  padding: 0;
  font-size: 1rem;
}

.primary-button:disabled,
.secondary-button:disabled,
.quiet-button:disabled {
  pointer-events: none;
  opacity: 0.45;
}

.local-note {
  margin: 1rem 0 0;
  color: #999a92;
  font-size: 0.69rem;
}

.auth-art {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background:
    radial-gradient(circle at 70% 16%, rgba(255, 255, 255, 0.22), transparent 14rem),
    var(--blue);
}

.auth-art::after {
  content: "";
  position: absolute;
  inset: 7%;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 50%;
}

.orbit {
  position: absolute;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 50%;
}

.orbit-one {
  width: 62vw;
  height: 62vw;
  top: 30%;
  left: 17%;
}

.orbit-two {
  width: 32vw;
  height: 32vw;
  top: 48%;
  left: 34%;
  background: var(--acid);
  border-color: var(--acid);
  box-shadow: 0 0 110px rgba(217, 255, 67, 0.22);
}

.edge-pill {
  position: absolute;
  top: 7%;
  right: 7%;
  padding: 0.55rem 0.7rem;
  color: var(--ink);
  background: var(--acid);
  border-radius: 999px;
  font-size: 0.63rem;
  font-weight: 850;
  letter-spacing: 0.12em;
}

.art-copy {
  position: absolute;
  bottom: 7%;
  left: 7%;
  color: white;
}

.art-copy span {
  font-size: 0.66rem;
  font-weight: 750;
  letter-spacing: 0.14em;
}

.art-copy p {
  margin: 0.65rem 0 0;
  font-size: clamp(1.7rem, 3vw, 3rem);
  font-weight: 620;
  line-height: 1.05;
  letter-spacing: -0.05em;
}

.dashboard {
  min-height: 100vh;
}

.topbar {
  height: 4.6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 clamp(1rem, 4vw, 4rem);
  border-bottom: 1px solid var(--line);
}

.wordmark {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--ink);
  text-decoration: none;
  font-size: 0.86rem;
  font-weight: 800;
}

.wordmark-mark {
  width: 2rem;
  height: 2rem;
  margin: 0;
  border-radius: 0.55rem;
  font-size: 0.8rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.edge-status {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.69rem;
  font-weight: 650;
}

.edge-status i {
  width: 0.43rem;
  height: 0.43rem;
  background: #4bb543;
  border-radius: 50%;
  box-shadow: 0 0 0 3px rgba(75, 181, 67, 0.12);
}

.workspace {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2.5rem, 6vw, 5.5rem) 0 4rem;
}

.workspace-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 2rem;
}

.workspace-heading h1 {
  margin: 0;
  font-size: clamp(2.5rem, 5vw, 4.5rem);
  line-height: 0.9;
  letter-spacing: -0.07em;
}

.heading-actions {
  display: flex;
  gap: 0.6rem;
}

.breadcrumbs {
  display: flex;
  align-items: center;
  gap: 0.32rem;
  min-height: 2.8rem;
  margin: 2rem 0 0.65rem;
  overflow-x: auto;
}

.breadcrumb-button {
  flex: none;
  padding: 0.25rem 0.3rem;
  color: var(--muted);
  background: transparent;
  border: 0;
  border-radius: 0.3rem;
  cursor: pointer;
  font-size: 0.76rem;
}

.breadcrumb-button:hover {
  color: var(--ink);
  background: rgba(22, 23, 19, 0.05);
}

.breadcrumb-separator {
  color: #b4b4ad;
  font-size: 0.72rem;
}

.dropzone {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.65rem;
  height: 0;
  overflow: hidden;
  color: var(--blue);
  background: rgba(49, 85, 255, 0.06);
  border: 0 dashed rgba(49, 85, 255, 0.45);
  border-radius: 0.75rem;
  opacity: 0;
  transition:
    height 180ms ease,
    opacity 180ms ease,
    margin 180ms ease;
  font-size: 0.78rem;
  font-weight: 700;
}

.dropzone.visible {
  height: 5rem;
  margin: 0.6rem 0;
  border-width: 1px;
  opacity: 1;
}

.drop-icon {
  display: grid;
  place-items: center;
  width: 1.8rem;
  height: 1.8rem;
  border: 1px solid rgba(49, 85, 255, 0.35);
  border-radius: 50%;
}

.asset-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 1rem;
}

.search-field {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: min(18rem, 55vw);
  height: 2.45rem;
  padding: 0 0.8rem;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 0.6rem;
}

.search-field span {
  color: var(--muted);
}

.search-field input {
  width: 100%;
  background: none;
  border: 0;
  outline: none;
  font-size: 0.77rem;
}

.folder-meta {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: var(--muted);
  font-size: 0.72rem;
}

.asset-panel {
  position: relative;
  min-height: 17rem;
  margin-top: 0.75rem;
  background: rgba(251, 250, 247, 0.82);
  border: 1px solid var(--line);
  border-radius: 0.9rem;
  box-shadow: 0 16px 45px rgba(44, 43, 38, 0.045);
  overflow: hidden;
}

.asset-head,
.asset-row {
  display: grid;
  grid-template-columns: minmax(13rem, 1fr) 7rem 10rem 10rem;
  align-items: center;
  gap: 1rem;
  padding: 0 1.15rem;
}

.asset-head {
  min-height: 2.75rem;
  color: #96978f;
  border-bottom: 1px solid var(--line);
  font-size: 0.64rem;
  font-weight: 750;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.asset-row {
  min-height: 4.45rem;
  border-bottom: 1px solid rgba(220, 217, 208, 0.7);
  transition: background-color 130ms ease;
}

.asset-row:last-child {
  border-bottom: 0;
}

.asset-row:hover {
  background: white;
}

.asset-name {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.asset-badge {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.15rem;
  height: 2.15rem;
  color: var(--blue);
  background: rgba(49, 85, 255, 0.08);
  border-radius: 0.6rem;
  font-size: 0.67rem;
  font-weight: 820;
  text-transform: uppercase;
}

.asset-badge.folder {
  color: #77600c;
  background: rgba(235, 190, 35, 0.14);
}

.asset-name-button {
  min-width: 0;
  padding: 0;
  overflow: hidden;
  color: var(--ink);
  background: transparent;
  border: 0;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 680;
  text-align: left;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.asset-name-button:hover {
  color: var(--blue);
}

.asset-detail {
  color: var(--muted);
  font-size: 0.73rem;
}

.asset-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.25rem;
}

.action-button {
  height: 2rem;
  padding: 0 0.55rem;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0.45rem;
  cursor: pointer;
  font-size: 0.68rem;
  font-weight: 700;
}

.action-button:hover {
  color: var(--ink);
  background: var(--paper);
  border-color: var(--line);
}

.action-button.delete:hover {
  color: var(--red);
}

.loading-state,
.empty-state {
  min-height: 14rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-state {
  gap: 0.35rem;
}

.loading-state span {
  width: 0.42rem;
  height: 0.42rem;
  background: var(--blue);
  border-radius: 50%;
  animation: bounce 900ms infinite ease-in-out;
}

.loading-state span:nth-child(2) {
  animation-delay: 120ms;
}

.loading-state span:nth-child(3) {
  animation-delay: 240ms;
}

@keyframes bounce {
  0%,
  60%,
  100% {
    transform: translateY(0);
    opacity: 0.35;
  }
  30% {
    transform: translateY(-0.4rem);
    opacity: 1;
  }
}

.empty-state {
  flex-direction: column;
  text-align: center;
}

.empty-glyph {
  display: grid;
  place-items: center;
  width: 3.2rem;
  height: 3.2rem;
  color: var(--blue);
  background: rgba(49, 85, 255, 0.08);
  border-radius: 50%;
  font-size: 1.4rem;
}

.empty-state h2 {
  margin: 1rem 0 0.25rem;
  font-size: 1rem;
}

.empty-state p {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  margin-top: 0.8rem;
  color: var(--muted);
  font-size: 0.7rem;
}

dialog {
  width: min(28rem, calc(100% - 2rem));
  padding: 0;
  background: transparent;
  border: 0;
}

dialog::backdrop {
  background: rgba(17, 18, 15, 0.56);
  backdrop-filter: blur(4px);
}

.dialog-card {
  padding: 1.55rem;
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 1rem;
  box-shadow: var(--shadow);
}

.dialog-card h2 {
  margin: 0 0 1.6rem;
  font-size: 1.7rem;
  letter-spacing: -0.045em;
}

.dialog-copy {
  margin: -0.75rem 0 1.5rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.5rem;
  margin-top: 1.4rem;
}

.upload-tray {
  position: fixed;
  right: 1.3rem;
  bottom: 1.3rem;
  z-index: 20;
  width: min(24rem, calc(100% - 2.6rem));
  padding: 1rem;
  color: white;
  background: var(--ink);
  border-radius: 0.85rem;
  box-shadow: var(--shadow);
}

.upload-tray-copy {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.7rem;
  font-size: 0.72rem;
}

.upload-tray-copy span {
  color: #bcbdb5;
}

.progress-track {
  height: 0.22rem;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 1rem;
}

.progress-track span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--acid);
  transition: width 150ms ease;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 1.5rem;
  z-index: 30;
  max-width: calc(100% - 2rem);
  padding: 0.75rem 1rem;
  color: white;
  background: var(--ink);
  border-radius: 999px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 1rem);
  transition:
    opacity 180ms ease,
    transform 180ms ease;
  font-size: 0.72rem;
  font-weight: 680;
  text-align: center;
}

.toast.visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.toast.error {
  background: var(--red);
}

@media (max-width: 850px) {
  .auth-shell {
    grid-template-columns: 1fr;
  }

  .auth-card {
    min-height: 100vh;
    padding: 2rem max(1.3rem, 8vw);
  }

  .auth-art {
    display: none;
  }

  .brand-mark {
    margin-bottom: 3rem;
  }

  .asset-head {
    display: none;
  }

  .asset-row {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 0.5rem;
    padding: 0.7rem 0.85rem;
  }

  .asset-row > .asset-detail {
    display: none;
  }

  .asset-actions {
    grid-column: 2;
  }
}

@media (max-width: 590px) {
  .topbar {
    padding: 0 0.9rem;
  }

  .edge-status {
    display: none;
  }

  .workspace {
    width: min(100% - 1.2rem, 1180px);
    padding-top: 2.5rem;
  }

  .workspace-heading {
    display: block;
  }

  .heading-actions {
    margin-top: 1.5rem;
  }

  .heading-actions button {
    flex: 1;
  }

  .asset-toolbar {
    align-items: stretch;
  }

  .search-field {
    width: 100%;
  }

  .folder-meta > span {
    display: none;
  }

  .asset-row {
    min-height: 4.15rem;
  }

  .action-button {
    padding: 0 0.4rem;
  }

  .asset-actions .action-button:first-child {
    display: none;
  }
}

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