
:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --panel: #ffffff;
  --text: #1b1d22;
  --muted: #6a707c;
  --line: #e3e6eb;
  --accent: #1d4ed8;
  --accent-soft: #eef3ff;
  --danger: #b42318;
  --shadow: 0 18px 50px rgba(20, 28, 45, .08);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button, input { font: inherit; }

.hidden { display: none !important; }

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(460px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 32px;
  box-shadow: var(--shadow);
}

.eyebrow {
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: .12em;
  font-size: 12px;
  font-weight: 700;
}

.login-card h1,
.sidebar h2,
.viewer-header h1 {
  margin: 8px 0 0;
}

.login-card p {
  color: var(--muted);
  margin: 12px 0 26px;
}

.login-card label {
  display: block;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 8px;
}

.password-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.password-row input {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  outline: none;
}

.password-row input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(29, 78, 216, .12);
}

button,
.action-link {
  border: 0;
  border-radius: 12px;
  padding: 11px 15px;
  text-decoration: none;
  cursor: pointer;
}

.password-row button {
  background: var(--accent);
  color: white;
  font-weight: 700;
}

.login-error {
  color: var(--danger);
  min-height: 20px;
  margin-top: 10px;
  font-size: 14px;
}

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

.sidebar {
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: auto;
}

.sidebar-header {
  position: sticky;
  top: 0;
  z-index: 3;
  background: rgba(255,255,255,.96);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.sidebar h2 {
  font-size: 22px;
}

.ghost-button {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line);
  padding: 8px 11px;
}

.tree {
  padding: 12px;
}

.tree-group {
  margin: 2px 0;
}

.tree-folder {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 9px 10px;
  border-radius: 9px;
  font-weight: 650;
}

.tree-folder:hover,
.tree-file:hover {
  background: #f3f5f8;
}

.folder-arrow {
  width: 16px;
  color: var(--muted);
  transition: transform .15s ease;
}

.tree-group.open > .tree-folder .folder-arrow {
  transform: rotate(90deg);
}

.tree-children {
  display: none;
  margin-left: 13px;
  padding-left: 8px;
  border-left: 1px solid var(--line);
}

.tree-group.open > .tree-children {
  display: block;
}

.tree-file {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  text-align: left;
  padding: 9px 10px;
  border-radius: 9px;
  cursor: pointer;
  line-height: 1.3;
}

.tree-file.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 650;
}

.tree-empty {
  color: var(--muted);
  padding: 18px 10px;
  line-height: 1.5;
}

.viewer-area {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  background: #eceff3;
}

.viewer-header {
  min-height: 82px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 15px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.viewer-header h1 {
  font-size: 18px;
}

.pdf-path {
  color: var(--muted);
  font-size: 12px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 70vw;
}

.viewer-actions {
  flex: 0 0 auto;
}

.action-link {
  display: inline-block;
  background: var(--accent);
  color: white;
  font-weight: 650;
  font-size: 14px;
}

.action-link.disabled {
  pointer-events: none;
  opacity: .45;
}

.pdf-viewer {
  width: 100%;
  height: 100%;
  border: 0;
  background: white;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  text-align: center;
  color: var(--muted);
  padding: 40px;
}

.empty-state h3 {
  color: var(--text);
  margin: 12px 0 4px;
}

.empty-state p {
  margin: 0;
}

.empty-icon {
  width: 74px;
  height: 74px;
  display: grid;
  place-items: center;
  border-radius: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  color: var(--accent);
  font-weight: 800;
  letter-spacing: .08em;
}

@media (max-width: 820px) {
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: 42vh 58vh;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .viewer-header {
    padding: 11px 14px;
  }

  .viewer-header h1 {
    font-size: 16px;
  }

  .pdf-path {
    max-width: 55vw;
  }

  .action-link {
    padding: 9px 10px;
    font-size: 12px;
  }
}
