:root {
  color-scheme: dark;
  --bg: #0b1016;
  --panel: rgba(18, 24, 33, 0.88);
  --panel-strong: rgba(12, 17, 24, 0.96);
  --border: rgba(255, 255, 255, 0.08);
  --text: #ebf2f7;
  --muted: #9fb0c0;
  --accent: #f4c55b;
  --accent-2: #5ec2b7;
  --danger: #ff7467;
  --shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(circle at top left, rgba(94, 194, 183, 0.16), transparent 30%),
    radial-gradient(circle at top right, rgba(244, 197, 91, 0.18), transparent 28%),
    linear-gradient(180deg, #0a0f14, #131d29 48%, #0b1016);
  color: var(--text);
  font-family: "Outfit", sans-serif;
}

input {
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  padding: 0.9rem 1rem;
  font: inherit;
}

button,
a {
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
}

button {
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 0.72rem 1rem;
  background: linear-gradient(135deg, var(--accent), #ff9f67);
  color: #19130d;
  font: inherit;
  font-weight: 700;
}

button:hover,
a:hover {
  transform: translateY(-1px);
}

button.ghost,
a.ghost {
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--text);
}

button.danger {
  color: #ffd8d5;
  border-color: rgba(255, 116, 103, 0.28);
  background: rgba(255, 116, 103, 0.08);
}

button:disabled {
  opacity: 0.45;
  transform: none;
}

.shell {
  width: min(1600px, 100%);
  margin: 0 auto;
  padding: 1rem;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  width: min(480px, 100%);
  padding: 1.4rem;
}

.login-card h1 {
  margin: 0.2rem 0 0.6rem;
}

.login-copy {
  margin: 0 0 1.2rem;
  color: var(--muted);
}

.login-form {
  display: grid;
  gap: 1rem;
}

.login-form label {
  display: grid;
  gap: 0.45rem;
}

.login-error {
  color: var(--danger);
  margin: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.topbar h1 {
  margin: 0.2rem 0 0;
  font-size: clamp(1.8rem, 4vw, 2.7rem);
}

.eyebrow,
.section-title,
.terminal-path,
.preview-meta,
.current-path,
.empty-list,
.file-row small {
  color: var(--muted);
}

.eyebrow,
.section-title {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.75rem;
}

.topbar-actions,
.quick-actions,
.section-head {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  flex-wrap: wrap;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  gap: 1rem;
  min-height: calc(100vh - 7rem);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  border-radius: 24px;
  backdrop-filter: blur(14px);
}

.sidebar {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.favorites {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.favorite {
  background: rgba(94, 194, 183, 0.12);
  border-color: rgba(94, 194, 183, 0.28);
  color: var(--text);
}

.tree-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.selection-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.8rem;
  margin: 0 0 1rem;
  padding: 0.85rem 1rem;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.03);
}

.selection-meta {
  display: grid;
  gap: 0.2rem;
  min-width: 0;
}

.selection-meta strong,
.selection-meta small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selection-meta small {
  color: var(--muted);
}

.selection-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.current-path {
  margin: 0.4rem 0 1rem;
  font-family: "IBM Plex Mono", monospace;
  font-size: 0.85rem;
  word-break: break-all;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
  min-height: 0;
  overflow: auto;
  padding-right: 0.2rem;
}

.file-row {
  border-radius: 20px;
  width: 100%;
  padding: 0.9rem 1rem;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border-color: var(--border);
  color: var(--text);
}

.file-row.directory {
  background: rgba(94, 194, 183, 0.08);
}

.file-open {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 0;
  background: transparent;
  border: 0;
  color: inherit;
  text-align: left;
}

.file-open:hover,
.file-manage:hover {
  transform: none;
}

.file-manage {
  flex: 0 0 auto;
}

.file-main {
  display: grid;
  gap: 0.25rem;
}

.file-tag {
  color: var(--accent);
  white-space: nowrap;
}

.content {
  display: grid;
  grid-template-rows: minmax(360px, 48vh) minmax(280px, 1fr);
  gap: 1rem;
  min-height: 0;
}

.terminal-panel,
.preview-panel {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 0.8rem;
}

.terminal {
  flex: 1;
  min-height: 0;
  border-radius: 20px;
  overflow: hidden;
  background: var(--panel-strong);
  border: 1px solid var(--border);
  padding: 0.5rem;
}

.preview {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--panel-strong);
  padding: 1rem;
}

.preview.empty {
  display: grid;
  place-items: center;
}

.preview-frame,
.preview-image,
.preview-media {
  width: 100%;
  min-height: 100%;
  border: 0;
  border-radius: 14px;
}

.preview-image {
  object-fit: contain;
  max-height: 100%;
}

.plain-text,
.markdown-body {
  font-family: "IBM Plex Mono", monospace;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.markdown-body {
  font-family: "Outfit", sans-serif;
}

.markdown-body :first-child {
  margin-top: 0;
}

.markdown-body code,
.plain-text {
  font-family: "IBM Plex Mono", monospace;
}

.download-card {
  display: grid;
  gap: 1rem;
  place-items: center;
  min-height: 100%;
}

.download-card a {
  color: var(--accent);
}

.hidden {
  display: none;
}

@media (max-width: 960px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .content {
    grid-template-rows: minmax(300px, 44vh) minmax(280px, auto);
  }
}

@media (max-width: 640px) {
  .shell {
    padding: 0.75rem;
  }

  .topbar,
  .panel-head {
    flex-direction: column;
    align-items: stretch;
  }

  .selection-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .topbar-actions,
  .quick-actions,
  .selection-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .topbar-actions button:last-of-type,
  .quick-actions button:last-of-type {
    grid-column: 1 / -1;
  }

  .file-row {
    flex-direction: column;
    align-items: stretch;
  }

  .file-open {
    padding-bottom: 0.35rem;
  }

  .file-manage {
    width: 100%;
  }

  .content {
    grid-template-rows: minmax(280px, 38vh) minmax(240px, auto);
  }
}
