*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --border: #e4e7f0;
  --text: #1a1d2e;
  --muted: #6b7280;
  --accent: #4f46e5;
  --accent-light: #eef2ff;
  --folder: #f59e0b;
  --folder-bg: #fffbeb;
  --radius: 12px;
  --shadow: 0 1px 4px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.04);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

/* ── Header ── */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 24px;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 24px;
  position: sticky;
  top: 0;
  z-index: 10;
}

.logo {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 1rem;
  color: var(--accent);
  flex-shrink: 0;
}

#breadcrumb {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.875rem;
  color: var(--muted);
}

.bc-item {
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}
.bc-item:hover { color: var(--accent); }
.bc-item.active { color: var(--text); font-weight: 500; cursor: default; }
.bc-sep { color: var(--border); }

/* ── Main ── */
main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px 24px;
}

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.view-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
}

.btn-refresh, .btn-back {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 14px;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
.btn-refresh:hover, .btn-back:hover {
  background: var(--accent-light);
  border-color: var(--accent);
  color: var(--accent);
}

/* ── PAN grid ── */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 16px;
}

.folder-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 18px 16px;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s, border-color .15s;
  box-shadow: var(--shadow);
}
.folder-card:hover {
  border-color: var(--accent);
  box-shadow: 0 4px 20px rgba(79,70,229,.12);
  transform: translateY(-2px);
}

.folder-icon {
  color: var(--folder);
  margin-bottom: 12px;
}

.folder-pan {
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
  font-family: "SF Mono", "Fira Code", monospace;
}

.folder-meta {
  font-size: 0.78rem;
  color: var(--muted);
}

.folder-badge {
  display: inline-block;
  margin-top: 10px;
  background: var(--folder-bg);
  color: var(--folder);
  border-radius: 20px;
  padding: 2px 10px;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ── Files list ── */
.files-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.file-row {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 14px;
  box-shadow: var(--shadow);
}

.file-icon {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: .03em;
}
.file-icon.pdf  { background: #fef2f2; color: #dc2626; }
.file-icon.img  { background: #f0fdf4; color: #16a34a; }
.file-icon.txt  { background: #f0f9ff; color: #0284c7; }
.file-icon.other { background: var(--bg); color: var(--muted); }

.file-info { flex: 1; min-width: 0; }

.file-name {
  font-size: 0.9rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-meta {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.file-size {
  font-size: 0.78rem;
  color: var(--muted);
  flex-shrink: 0;
}

/* ── Empty + loading ── */
.empty {
  text-align: center;
  padding: 64px 24px;
  color: var(--muted);
}
.empty svg { margin-bottom: 16px; opacity: .4; }
.empty p { font-size: 0.9rem; line-height: 1.6; }

.loading {
  display: flex;
  justify-content: center;
  padding: 48px;
}
.spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }
