:root {
  color-scheme: light;
  --font-sans: "Inter", "Segoe UI", sans-serif;
  --bg: #f5f7fb;
  --bg-accent: rgba(37, 99, 235, 0.12);
  --surface: rgba(255, 255, 255, 0.8);
  --surface-strong: #ffffff;
  --surface-muted: #eef2f7;
  --border: rgba(15, 23, 42, 0.08);
  --text: #0f172a;
  --text-muted: #64748b;
  --text-soft: #94a3b8;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --success: #16a34a;
  --danger: #dc2626;
  --shadow: 0 22px 50px rgba(15, 23, 42, 0.09);
  --shadow-soft: 0 10px 24px rgba(15, 23, 42, 0.06);
  --radius-xl: 28px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --transition: 180ms ease;
  --sidebar-width: 284px;
}

body[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0a1017;
  --bg-accent: rgba(96, 165, 250, 0.13);
  --surface: rgba(15, 23, 42, 0.72);
  --surface-strong: #111827;
  --surface-muted: #192230;
  --border: rgba(148, 163, 184, 0.12);
  --text: #f8fafc;
  --text-muted: #cbd5e1;
  --text-soft: #94a3b8;
  --accent: #60a5fa;
  --accent-soft: rgba(96, 165, 250, 0.16);
  --success: #22c55e;
  --danger: #fb7185;
  --shadow: 0 30px 80px rgba(2, 6, 23, 0.45);
  --shadow-soft: 0 16px 36px rgba(2, 6, 23, 0.28);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--text);
  background:
    radial-gradient(circle at top left, var(--bg-accent), transparent 28%),
    radial-gradient(circle at right top, rgba(245, 158, 11, 0.08), transparent 18%),
    var(--bg);
  transition:
    background var(--transition),
    color var(--transition);
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 0;
  color: inherit;
  background: none;
  cursor: pointer;
}

input,
textarea {
  width: 100%;
  border: 0;
  border-radius: var(--radius-md);
  background: var(--surface-muted);
  color: var(--text);
  padding: 14px 16px;
  outline: none;
}

input:focus,
textarea:focus {
  box-shadow: 0 0 0 3px var(--accent-soft);
}

.auth-shell,
.app-shell {
  min-height: 100vh;
  padding: 20px;
}

.auth-shell {
  display: grid;
  place-items: center;
}

.auth-panel,
.sidebar,
.main-panel,
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.auth-panel {
  width: min(100%, 480px);
  border-radius: var(--radius-xl);
  padding: 28px;
}

.auth-form,
.stack-form,
.directory-list {
  display: grid;
  gap: 14px;
}

.eyebrow,
.section-label,
.summary-label {
  margin: 0;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-soft);
}

.auth-panel h1,
.brand h1,
.topbar-title h2,
.panel-header h3 {
  margin: 6px 0 0;
}

.auth-description,
.feedback,
.file-card-meta,
.sidebar-path {
  color: var(--text-muted);
}

.app-shell {
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  gap: 20px;
}

.sidebar,
.main-panel {
  border-radius: var(--radius-xl);
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 4px 6px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, #0f172a, var(--accent));
  color: #ffffff;
  font-weight: 800;
}

.sidebar-block,
.summary-card,
.panel {
  background: rgba(255, 255, 255, 0.36);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
}

body[data-theme="dark"] .sidebar-block,
body[data-theme="dark"] .summary-card,
body[data-theme="dark"] .panel {
  background: rgba(15, 23, 42, 0.4);
}

.sidebar-block {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.sidebar-path {
  margin: 0;
  overflow-wrap: anywhere;
}

.primary-button,
.secondary-button,
.theme-toggle,
.segmented-option,
.directory-item {
  min-height: 44px;
  border-radius: 12px;
  transition:
    transform var(--transition),
    background var(--transition),
    color var(--transition);
}

.primary-button,
.secondary-button,
.theme-toggle,
.segmented-option {
  padding: 0 16px;
}

.primary-button {
  background: var(--text);
  color: var(--surface-strong);
  font-weight: 700;
}

body[data-theme="dark"] .primary-button {
  background: #f8fafc;
  color: #0f172a;
}

.secondary-button,
.theme-toggle,
.segmented-option,
.directory-item {
  background: var(--surface-muted);
  color: var(--text);
}

.primary-button:hover,
.secondary-button:hover,
.theme-toggle:hover,
.segmented-option:hover,
.directory-item:hover,
.file-card-title:hover {
  transform: translateY(-1px);
}

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.nav-pill {
  min-width: 32px;
  min-height: 28px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.directory-item {
  width: 100%;
  text-align: left;
  padding: 0 14px;
}

.main-panel {
  display: grid;
  gap: 18px;
  padding: 22px;
}

.topbar,
.topbar-controls,
.workspace-grid,
.panel-header,
.file-card,
.field {
  display: flex;
}

.topbar {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.topbar-controls {
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.search-field input {
  min-width: 280px;
}

.segmented-control {
  display: inline-grid;
  grid-auto-flow: column;
  gap: 8px;
  padding: 6px;
  border-radius: 14px;
  background: var(--surface-muted);
}

.segmented-option.active {
  background: var(--surface-strong);
  box-shadow: var(--shadow-soft);
}

.summary-grid,
.workspace-grid {
  display: grid;
  gap: 16px;
}

.summary-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.summary-card {
  padding: 18px;
}

.summary-card strong {
  display: block;
  margin-top: 10px;
  font-size: 2rem;
}

.summary-card span {
  color: var(--text-muted);
}

.workspace-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.panel {
  flex-direction: column;
  gap: 16px;
  padding: 20px;
}

.panel-header {
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.field {
  flex-direction: column;
  gap: 8px;
}

.file-panel {
  min-height: 340px;
}

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

.file-list[data-view="grid"] {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.file-list[data-view="list"] {
  grid-template-columns: 1fr;
}

.file-list[data-view="list"] .file-card {
  align-items: center;
  justify-content: space-between;
}

.file-list[data-view="list"] .file-card-main {
  flex: 1;
}

.file-card {
  align-items: flex-start;
  gap: 14px;
  padding: 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  border: 1px solid var(--border);
}

.file-marker {
  display: inline-grid;
  place-items: center;
  flex: 0 0 34px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  font-size: 0.74rem;
  font-weight: 700;
}

.file-marker.is-directory {
  background: rgba(245, 158, 11, 0.15);
  color: #b45309;
}

.file-marker.is-file {
  background: var(--accent-soft);
  color: var(--accent);
}

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

.file-card-title {
  padding: 0;
  font-weight: 700;
  text-align: left;
}

.file-card-meta,
.feedback,
.empty-state {
  margin: 4px 0 0;
}

.feedback[data-tone="error"] {
  color: var(--danger);
}

.feedback[data-tone="success"] {
  color: var(--success);
}

.empty-card {
  padding: 28px;
  border-radius: var(--radius-lg);
  background: var(--surface-muted);
  color: var(--text-muted);
  text-align: center;
}

@media (max-width: 1100px) {
  .app-shell,
  .workspace-grid,
  .summary-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .auth-shell,
  .app-shell {
    padding: 12px;
  }

  .main-panel,
  .sidebar,
  .auth-panel {
    border-radius: 20px;
  }

  .search-field,
  .search-field input {
    width: 100%;
    min-width: 0;
  }
}
