:root {
  --bg-page: radial-gradient(circle at 15% 15%, #eef3fb 0%, #e5e9f0 55%, #dce2ec 100%);
  --glass-bg: rgba(255, 255, 255, 0.78);
  --glass-strong: rgba(255, 255, 255, 0.92);
  --border: rgba(24, 28, 36, 0.12);
  --text: #181c24;
  --muted: #5c6575;
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.12);
  --folder-top: #fbd38d;
  --folder-body: #f6ad55;
  --radius: 14px;
}

* {
  box-sizing: border-box;
}

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

.app-shell {
  max-width: 1280px;
  min-height: 100dvh;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  padding: 14px;
  gap: 12px;
}

.window-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: var(--glass-strong);
  border: 1px solid var(--border);
  backdrop-filter: blur(14px);
}

.win-dots {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  display: inline-block;
  border: 0;
  padding: 0;
}

.dot.red { background: #ff5f57; }
.dot.yellow { background: #febc2e; }
.dot.green { background: #28c840; }
.interactive-dot { cursor: pointer; }

.win-title {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  color: var(--muted);
}

.ghost-btn {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.7);
  color: var(--text);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
}

.ghost-btn:hover {
  background: #fff;
}

.workspace {
  flex: 1;
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr) 320px;
  background: var(--glass-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  backdrop-filter: blur(16px);
  min-height: 680px;
}

.sidebar {
  border-right: 1px solid var(--border);
  padding: 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: rgba(255, 255, 255, 0.45);
}

.nav-group-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0 10px 6px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.65);
}

.nav-item.active {
  background: #fff;
  font-weight: 600;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.main-pane {
  padding: 16px 20px 32px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.breadcrumb {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.breadcrumb button,
.breadcrumb a {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  padding: 2px 6px;
  border-radius: 6px;
  cursor: pointer;
}

.breadcrumb button:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--text);
}

.breadcrumb .current {
  color: var(--text);
  font-weight: 600;
}

.pane-lead {
  margin: 0;
  font-size: 13px;
  color: var(--muted);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.72);
  color: var(--text);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
}

.chip.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

.folder-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  gap: 18px;
  padding-top: 6px;
}

.folder-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-radius: 12px;
  border: 1px solid transparent;
  background: transparent;
  cursor: pointer;
  text-align: center;
}

.folder-card:hover,
.folder-card.selected {
  background: rgba(255, 255, 255, 0.85);
  border-color: var(--border);
}

.folder-visual {
  width: 96px;
  height: 76px;
  border-radius: 12px;
  background: linear-gradient(180deg, var(--folder-top), var(--folder-body));
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 20px;
  color: rgba(24, 28, 36, 0.72);
  box-shadow: inset 0 2px 6px rgba(255, 255, 255, 0.5), 0 6px 14px rgba(0, 0, 0, 0.08);
}

.folder-name {
  font-size: 12px;
  font-weight: 600;
}

.folder-meta {
  font-size: 11px;
  color: var(--muted);
}

.year-group-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  margin: 12px 0 6px;
  letter-spacing: 0.04em;
}

.file-row {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  text-align: left;
  font-size: 13px;
  cursor: pointer;
}

.file-row:hover {
  background: rgba(255, 255, 255, 0.7);
}

.file-row.selected {
  background: #fff;
  border-color: var(--border);
  font-weight: 600;
}

.file-badge {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  background: rgba(24, 28, 36, 0.08);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 700;
  flex-shrink: 0;
}

.file-thumb {
  width: 34px;
  height: 26px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
}

.project-list {
  display: grid;
  gap: 14px;
}

.project-card {
  display: grid;
  grid-template-columns: 210px minmax(0, 1fr);
  gap: 16px;
  padding: 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  text-align: left;
  cursor: pointer;
}

.project-card:hover {
  background: #fff;
  transform: translateY(-1px);
}

.project-cover {
  width: 100%;
  height: 132px;
  object-fit: cover;
  border-radius: 9px;
  background: #dfe5ee;
}

.project-title {
  margin: 4px 0 6px;
  font-size: 16px;
  font-weight: 700;
}

.project-desc {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag-pill {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(24, 28, 36, 0.06);
  color: var(--muted);
}

/* Miller Columns cho Downloads */
.miller-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  min-height: 360px;
}

.miller-col {
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  background: rgba(255, 255, 255, 0.55);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Khung Detail bên phải */
.detail-pane {
  border-left: 1px solid var(--border);
  padding: 18px;
  background: rgba(255, 255, 255, 0.55);
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}

.detail-preview-img,
.detail-preview-video {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
  background: #111318;
}

.detail-quote {
  padding: 12px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid var(--border);
  font-size: 12px;
  line-height: 1.6;
  color: var(--muted);
}

.meta-list {
  display: grid;
  gap: 8px;
  margin: 0;
  font-size: 12px;
}

.meta-row {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
}

.meta-row dt {
  color: var(--muted);
}

.meta-row dd {
  margin: 0;
  font-weight: 500;
}

.action-primary {
  border: 0;
  background: var(--accent);
  color: #fff;
  border-radius: 9px;
  padding: 9px 12px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

/* Dock dưới cho Mobile */
.bottom-dock {
  display: none;
}

/* Popup modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 18, 25, 0.45);
  backdrop-filter: blur(6px);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 60;
}

.modal-backdrop[hidden] {
  display: none;
}

.modal-window {
  width: min(100%, 720px);
  max-height: 86dvh;
  background: var(--glass-strong);
  border: 1px solid var(--border);
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}

.modal-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}

.modal-body {
  padding: 20px 24px 32px;
  overflow-y: auto;
  line-height: 1.75;
  font-size: 14px;
}

/* Thích ứng Điện thoại (<= 760px) */
@media (max-width: 760px) {
  .app-shell {
    padding: 8px 8px calc(76px + env(safe-area-inset-bottom, 0px));
  }

  .workspace {
    grid-template-columns: minmax(0, 1fr);
    min-height: auto;
  }

  .sidebar,
  .detail-pane {
    display: none;
  }

  .mobile-detail-card {
    display: block;
    padding: 12px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid var(--border);
  }

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

  .project-card {
    grid-template-columns: minmax(0, 1fr);
  }

  .bottom-dock {
    position: fixed;
    left: 50%;
    transform: translateX(-50%);
    bottom: max(12px, env(safe-area-inset-bottom));
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.88);
    border: 1px solid var(--border);
    backdrop-filter: blur(16px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.14);
    z-index: 40;
  }

  .dock-btn {
    border: 0;
    background: transparent;
    padding: 8px 14px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 600;
    color: var(--muted);
    cursor: pointer;
  }

  .dock-btn.active {
    background: #fff;
    color: var(--text);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  }
}