:root {
  color-scheme: light;
  --ink: #17212b;
  --muted: #667085;
  --line: #d9e2ec;
  --panel: #ffffff;
  --soft: #f4f7fb;
  --accent: #0f7b6c;
  --accent-dark: #096255;
  --danger: #c0392b;
  --shadow: 0 18px 60px rgba(25, 43, 70, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #eef3f8;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px 22px;
  border-right: 1px solid var(--line);
  background: #fbfdff;
}

.brand,
.topbar,
.section-heading,
.top-actions,
.nav-item,
.primary-button,
.search-wrap,
.file-row,
.file-main,
.file-actions,
.queue-item,
.drop-zone {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #0f7b6c, #2d8cff);
}

.brand-mark.large {
  width: 56px;
  height: 56px;
  margin: 0 auto 12px;
  font-size: 24px;
}

.brand h1,
.auth-box h2,
.section-heading h2,
.empty-state h3 {
  margin: 0;
}

.brand h1 {
  font-size: 20px;
  line-height: 1.1;
}

.brand p,
.usage-panel p,
.section-heading p,
.empty-state p {
  margin: 4px 0 0;
  color: var(--muted);
}

.primary-button {
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-weight: 700;
  background: var(--accent);
  transition: background 0.15s ease, transform 0.15s ease;
}

.primary-button:hover {
  background: var(--accent-dark);
}

.primary-button:active {
  transform: translateY(1px);
}

.primary-button.full {
  margin-top: 14px;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item {
  gap: 10px;
  width: 100%;
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: #334155;
  background: transparent;
  text-align: left;
}

.nav-item.active,
.nav-item:hover {
  background: #e8f3f1;
  color: var(--accent-dark);
}

.usage-panel {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.usage-label {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 6px;
}

.workspace {
  min-width: 0;
  padding: 24px clamp(18px, 3vw, 42px);
}

.topbar {
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.search-wrap {
  flex: 1;
  gap: 10px;
  min-height: 46px;
  max-width: 680px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.search-wrap input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

.top-actions {
  gap: 8px;
}

.icon-button,
.file-action {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #344054;
  background: var(--panel);
}

.icon-button.active,
.icon-button:hover,
.file-action:hover {
  border-color: #b7d8d2;
  color: var(--accent-dark);
  background: #eef8f6;
}

.drop-zone {
  justify-content: center;
  gap: 10px;
  min-height: 88px;
  margin-bottom: 18px;
  border: 1px dashed #9bb8c9;
  border-radius: 8px;
  color: #475467;
  background: rgba(255, 255, 255, 0.6);
}

.drop-zone.dragging {
  border-color: var(--accent);
  color: var(--accent-dark);
  background: #e8f6f4;
}

.queue {
  display: grid;
  gap: 8px;
  margin-bottom: 18px;
}

.queue-item {
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.queue-progress {
  width: 120px;
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf0;
}

.queue-progress span {
  display: block;
  width: var(--progress, 0%);
  height: 100%;
  background: var(--accent);
}

.files-section {
  min-height: 420px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.section-heading {
  justify-content: space-between;
  margin-bottom: 18px;
}

.section-heading h2 {
  font-size: 22px;
}

.file-table {
  display: grid;
  gap: 8px;
}

.file-table.grid {
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}

.file-row {
  justify-content: space-between;
  gap: 14px;
  min-height: 68px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.file-table.grid .file-row {
  display: grid;
  min-height: 160px;
  align-content: space-between;
}

.file-main {
  gap: 12px;
  min-width: 0;
}

.file-icon {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  color: #164e63;
  background: #dff5fb;
}

.file-name {
  overflow: hidden;
  margin: 0;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.file-actions {
  gap: 8px;
  flex: 0 0 auto;
}

.file-action.danger:hover {
  border-color: #efc2bd;
  color: var(--danger);
  background: #fff1f0;
}

.empty-state {
  padding: 52px 16px;
  color: var(--muted);
  text-align: center;
}

.empty-state svg {
  width: 42px;
  height: 42px;
  margin-bottom: 12px;
}

.auth-screen {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(238, 243, 248, 0.92);
  backdrop-filter: blur(10px);
  z-index: 10;
}

.auth-screen.hidden {
  display: none;
}

.auth-box {
  width: min(420px, 100%);
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.auth-box h2 {
  text-align: center;
  margin-bottom: 22px;
}

.auth-box label {
  display: block;
  margin-bottom: 8px;
  font-weight: 700;
}

.auth-box input {
  width: 100%;
  height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: 8px;
  color: #fff;
  background: #1f2937;
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  pointer-events: none;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

svg {
  width: 19px;
  height: 19px;
  stroke-width: 2.2;
}

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

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 4;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 14px;
    padding: 16px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .brand {
    min-width: 0;
  }

  .brand h1 {
    font-size: 18px;
  }

  .primary-button {
    width: auto;
    min-width: 112px;
    padding: 0 14px;
  }

  .nav-list,
  .usage-panel {
    display: none;
  }

  .workspace {
    padding: 16px;
  }

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

  .files-section {
    padding: 14px;
  }

  .file-row,
  .file-actions {
    align-items: flex-start;
  }

  .file-row {
    flex-direction: column;
  }
}
