:root {
  --bg: #f7f4ef;
  --bg-strong: #e9dfd2;
  --card: #fffaf2;
  --ink: #182026;
  --ink-soft: #475663;
  --accent: #0d9488;
  --accent-2: #dc2626;
  --line: #d3c9bb;
  --shadow: 0 16px 40px rgba(46, 33, 15, 0.15);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Segoe UI", "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 15% -10%, #ffedd5 0, transparent 40%),
    radial-gradient(circle at 90% 0, #ccfbf1 0, transparent 35%),
    linear-gradient(180deg, var(--bg) 0%, #f1ebe3 100%);
  overflow-x: hidden;
}

.bg-shape {
  position: fixed;
  z-index: -1;
  border-radius: 999px;
  filter: blur(24px);
  opacity: 0.35;
}

.bg-shape-1 {
  width: 220px;
  height: 220px;
  background: #34d399;
  top: 8%;
  right: -60px;
}

.bg-shape-2 {
  width: 180px;
  height: 180px;
  background: #fb7185;
  bottom: 8%;
  left: -50px;
}

.topbar {
  max-width: 1300px;
  margin: 0 auto 18px;
  background: color-mix(in hsl, var(--card) 90%, #fff 10%);
  border: 1px solid var(--line);
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  animation: pop-in 460ms ease;
}

.topbar h1 {
  margin: 0;
  font-size: clamp(1.2rem, 2.5vw, 1.8rem);
  letter-spacing: 0.01em;
}

.topbar p {
  margin: 6px 0 0;
  color: var(--ink-soft);
}

.chip {
  font-family: "Consolas", "Courier New", monospace;
  font-size: 0.8rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 10px;
  background: #fff;
}

.layout {
  max-width: 1300px;
  margin: 0 auto;
  display: grid;
  gap: 14px;
}

.tabs {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.tab {
  border: 1px solid var(--line);
  background: #fff8eb;
  color: var(--ink);
  border-radius: 12px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: transform 120ms ease, background-color 120ms ease, border-color 120ms ease;
}

.tab:hover {
  transform: translateY(-1px);
  border-color: #b6a894;
}

.tab.is-active {
  background: linear-gradient(130deg, var(--accent) 0%, #14b8a6 100%);
  color: #fff;
  border-color: transparent;
}

.tab-label {
  max-width: 170px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tab-close {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  font-size: 0.95rem;
  line-height: 1;
  background: rgba(255, 255, 255, 0.45);
}

.tab-closable .tab-close:hover {
  background: rgba(255, 255, 255, 0.8);
}

.tab:not(.is-active) .tab-close {
  background: #efe6d9;
}

.panels {
  background: color-mix(in hsl, var(--card) 93%, #fff 7%);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel {
  padding: 18px;
  animation: fade-up 250ms ease;
}

.panel-head h2 {
  margin: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel-head-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.copy-pdf-url-btn {
  white-space: nowrap;
}

.panel-head p {
  margin: 6px 0 0;
  color: var(--ink-soft);
}

.explorer-toolbar {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(7, minmax(0, max-content));
  gap: 10px;
  align-items: center;
}

.btn {
  border: 1px solid transparent;
  border-radius: 10px;
  min-height: 40px;
  padding: 0 12px;
  font-weight: 600;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

.icon-btn {
  width: 40px;
  min-width: 40px;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.icon-glyph {
  font-size: 1rem;
  line-height: 1;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.btn:hover {
  filter: brightness(1.05);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  filter: none;
}

.btn.btn-ghost {
  background: #fff;
  color: var(--ink);
  border-color: var(--line);
}

.btn.btn-danger {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.breadcrumbs {
  margin-top: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #fff;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.crumb {
  border: 0;
  background: transparent;
  color: #0f766e;
  font-weight: 600;
  cursor: pointer;
  padding: 0;
}

.crumb:hover {
  text-decoration: underline;
}

.crumb-sep {
  color: #7c8b98;
}

.explorer-list-wrap {
  margin-top: 12px;
  border-radius: 14px;
  border: 1px solid #ccbda8;
  background: #fff;
  overflow: auto;
  max-height: 72vh;
}

.explorer-list-wrap.is-drag-over {
  border-color: var(--accent);
  background: color-mix(in hsl, #fff 90%, #ccfbf1 10%);
  box-shadow: 0 0 0 3px color-mix(in hsl, var(--accent) 18%, transparent 82%);
}

.explorer-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
}

.explorer-table th,
.explorer-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid #eee1cc;
}

.explorer-table th {
  position: sticky;
  top: 0;
  background: #fff8eb;
  z-index: 1;
}

.explorer-table tbody tr:hover {
  background: #fffbf4;
}

.explorer-table tbody tr.is-selected {
  background: #c7f9f1;
  box-shadow: inset 4px 0 0 #0f766e;
}

.explorer-table tbody tr.is-selected td {
  color: #0b3a36;
  font-weight: 600;
}

.name-cell {
  min-width: 240px;
}

.name-btn {
  border: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  background: transparent;
  font: inherit;
  color: #0f172a;
  cursor: pointer;
}

.name-btn:hover {
  color: #0f766e;
}

.name-text {
  line-height: 1.2;
}

.item-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  position: relative;
  flex: 0 0 16px;
}

.item-icon-dir {
  border: 1px solid #b7791f;
  border-radius: 3px;
  background: linear-gradient(180deg, #fcd34d 0%, #f59e0b 100%);
}

.item-icon-dir::before {
  content: '';
  position: absolute;
  left: 2px;
  top: -4px;
  width: 7px;
  height: 5px;
  border: 1px solid #b7791f;
  border-bottom: 0;
  border-radius: 2px 2px 0 0;
  background: #fde68a;
}

.item-icon-file {
  border: 1px solid #9ca3af;
  border-radius: 2px;
  background: linear-gradient(180deg, #ffffff 0%, #f3f4f6 100%);
}

.item-icon-file::before {
  content: '';
  position: absolute;
  right: -1px;
  top: -1px;
  width: 6px;
  height: 6px;
  border-left: 1px solid #9ca3af;
  border-bottom: 1px solid #9ca3af;
  background: #e5e7eb;
  transform: skew(-20deg);
}

.item-icon-pdf {
  border: 1px solid #b91c1c;
  border-radius: 2px;
  background: linear-gradient(180deg, #fee2e2 0%, #fecaca 100%);
}

.item-icon-pdf::before {
  content: '';
  position: absolute;
  right: -1px;
  top: -1px;
  width: 6px;
  height: 6px;
  border-left: 1px solid #b91c1c;
  border-bottom: 1px solid #b91c1c;
  background: #fca5a5;
  transform: skew(-20deg);
}

.item-icon-pdf::after {
  content: 'P';
  position: absolute;
  left: 4px;
  top: 2px;
  font-size: 8px;
  line-height: 1;
  font-weight: 700;
  color: #7f1d1d;
}

.empty-cell {
  text-align: center;
  color: var(--ink-soft);
}

.hint {
  margin: 10px 2px 0;
  color: var(--ink-soft);
  font-size: 0.92rem;
}

.hint.is-error {
  color: #b91c1c;
}

.placeholder {
  min-height: 300px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--ink-soft);
}

.viewer-panel .panel-head p {
  margin-bottom: 12px;
}

.viewer-frame-wrap {
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  min-height: 74vh;
}

.viewer-frame {
  width: 100%;
  height: 100%;
  min-height: 74vh;
  border: 0;
  display: block;
}

@keyframes fade-up {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.actions-cell {
  text-align: center;
  padding: 8px 12px;
}

.open-external-btn {
  border: 1px solid var(--line);
  background: transparent;
  color: var(--ink-soft);
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font: inherit;
  transition: all 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.open-external-btn:hover {
  background: #c7f9f1;
  border-color: var(--accent);
  color: var(--accent);
}

.open-external-btn:active {
  transform: scale(0.95);
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: scale(0.98);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

@media (max-width: 980px) {
  .explorer-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .explorer-upload-row {
    grid-template-columns: 1fr;
  }

  .btn {
    width: 100%;
  }
}
