:root {
  --primary: #1a3a5c;
  --secondary: #2e6da4;
  --text: #2c3e50;
  --muted: #6d7b86;
  --line: #d8e4eb;
  --header: #e8f4fb;
  --surface: #ffffff;
  --page: #f7f8f9;
  --thumb: #bbdefb;
  --shadow: rgba(44, 62, 80, 0.14);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--text);
  font-family: Arial, Helvetica, sans-serif;
}

body.dark {
  --text: #edf4f8;
  --muted: #aebbc5;
  --line: #2f4454;
  --header: #d7edf8;
  --surface: #1f2f3c;
  --page: #111c26;
  --thumb: #263f5a;
  --shadow: rgba(0, 0, 0, 0.35);
}

a {
  color: inherit;
}

.app-header {
  background: var(--header);
  color: var(--text);
  box-shadow: 0 2px 8px rgba(44, 62, 80, 0.1);
  position: sticky;
  top: 0;
  z-index: 10;
}

.toolbar {
  min-height: 80px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.round-button,
.toggle button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.brand {
  display: flex;
  min-width: 60px;
  align-items: center;
}

.brand img {
  max-height: 46px;
  max-width: 170px;
  object-fit: contain;
}

.divider {
  width: 1px;
  height: 42px;
  background: #b5d0de;
  margin: 0 12px;
}

.app-title {
  font-size: 1.15rem;
  font-weight: 600;
}

.toolbar-spacer {
  flex: 1;
}

.round-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 1.25rem;
}

.round-button:hover,
.toggle button:hover {
  background: rgba(46, 109, 164, 0.1);
}

.page {
  padding: 24px;
}

.folder-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

h1 {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 0;
  color: var(--primary);
  font-size: clamp(1.45rem, 2vw, 1.85rem);
}

body.dark h1 {
  color: #7fb5df;
}

body.dark .app-title {
  color: #000;
}

.folder-header p {
  margin: 6px 0 0 48px;
  color: var(--muted);
  font-size: 0.9rem;
}

.folder-icon {
  width: 32px;
  height: 32px;
  color: currentColor;
}

.folder-icon svg,
.pdf-icon svg {
  width: 100%;
  height: 100%;
  fill: currentColor;
}

.content-grid {
  display: block;
}

.files-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.files-card {
  padding: 16px;
}

.files-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.files-toolbar strong {
  flex: 1;
  font-size: 1rem;
}

.toggle {
  display: inline-flex;
  border-radius: 4px;
  overflow: hidden;
}

.toggle button {
  width: 36px;
  height: 36px;
  font-size: 1.1rem;
}

.toggle button.active {
  color: var(--primary);
  background: rgba(46, 109, 164, 0.14);
}

.file-list {
  display: grid;
  gap: 0;
}

.file-row {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 8px 4px;
  border-top: 1px solid var(--line);
  cursor: pointer;
  border-radius: 4px;
}

.file-row:first-child {
  border-top: 0;
}

.file-row:hover,
.file-card:hover {
  box-shadow: 0 4px 16px var(--shadow);
  transform: translateY(-1px);
}

.pdf-icon {
  width: 34px;
  height: 34px;
  color: #1565c0;
  display: grid;
  place-items: center;
}

.file-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-meta {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.actions {
  display: flex;
  gap: 4px;
}

.action-button {
  display: inline-grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: var(--muted);
  text-decoration: none;
  font-size: 1rem;
}

.action-button.download {
  color: var(--primary);
}

.action-button:hover {
  background: rgba(46, 109, 164, 0.1);
}

.file-list.grid-view {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 16px;
}

.grid-view .file-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  min-height: 212px;
  padding: 0;
  border: 1px solid var(--line);
  background: var(--surface);
  overflow: hidden;
}

.grid-view .pdf-icon {
  width: 100%;
  height: 100px;
  background: var(--thumb);
}

.grid-view .pdf-icon svg {
  width: 48px;
  height: 48px;
}

.grid-view .file-details {
  padding: 10px;
  min-height: 74px;
}

.grid-view .file-name {
  font-size: 0.82rem;
}

.grid-view .actions {
  justify-content: flex-end;
  padding: 4px 8px 8px;
  margin-top: auto;
}

.empty-state {
  text-align: center;
  padding: 56px 16px;
  color: #9aa7b0;
}

.empty-state span {
  font-size: 64px;
}

.empty-state h2 {
  margin: 8px 0 0;
  font-size: 1.2rem;
}

@media (max-width: 680px) {
  .toolbar {
    padding: 0 14px;
    gap: 10px;
  }

  .divider {
    margin: 0 4px;
  }

  .page {
    padding: 16px;
  }

  .folder-header p {
    margin-left: 0;
  }

  .files-toolbar {
    align-items: stretch;
    flex-wrap: wrap;
  }

  .files-toolbar strong {
    flex-basis: 100%;
  }

  .file-row {
    grid-template-columns: 40px minmax(0, 1fr);
  }

  .file-row .actions {
    grid-column: 2;
  }
}
