:root {
  --bg: #f1f5f9;
  --panel: #ffffff;
  --border: #e2e8f0;
  --text: #0f172a;
  --muted: #64748b;
  --accent: #0284c7;
  --accent-contrast: #ffffff;
  --danger: #dc2626;
  --row-hover: #f8fafc;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.topbar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.brand-icon { font-size: 28px; line-height: 1; }
.brand-text {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: .1px;
  color: var(--text);
}
.brand-text strong {
  font-weight: 800;
  color: var(--accent);
  letter-spacing: .6px;
  margin-right: 5px;
}

.breadcrumb {
  flex: 1;
  overflow-x: auto;
  white-space: nowrap;
  color: var(--muted);
}
.breadcrumb a {
  color: var(--accent);
  text-decoration: none;
  cursor: pointer;
}
.breadcrumb a:hover { text-decoration: underline; }
.breadcrumb .sep { margin: 0 6px; color: var(--muted); }
.home-link { display: inline-flex; align-items: center; gap: 5px; vertical-align: middle; }
.home-icon { flex-shrink: 0; }

.actions { display: flex; align-items: center; gap: 8px; }
.whoami {
  color: var(--muted);
  font-size: 13px;
  padding: 0 6px;
}

button {
  background: var(--accent);
  color: var(--accent-contrast);
  border: none;
  border-radius: 6px;
  padding: 7px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
button.secondary {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}
button.link {
  background: transparent;
  color: var(--accent);
  padding: 2px 6px;
  font-weight: 500;
}
button.danger-link {
  background: transparent;
  color: var(--danger);
  padding: 2px 6px;
  font-weight: 500;
}
button:hover { opacity: 0.9; }
.hidden { display: none !important; }

main {
  padding: 16px 20px 60px;
  max-width: 1100px;
  margin: 0 auto;
  position: relative;
  min-height: calc(100vh - 200px);
  border-radius: 10px;
  transition: background-color .15s ease;
}
main.drag-over {
  background-color: rgba(2, 132, 199, .06);
  outline: 2px dashed var(--accent);
  outline-offset: -8px;
}

.drag-overlay {
  position: sticky;
  top: 8px;
  z-index: 5;
  margin-bottom: 12px;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(2, 132, 199, .1);
  border: 1px dashed var(--accent);
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
}

.filetable {
  width: 100%;
  border-collapse: collapse;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 2px rgba(15, 23, 42, .04);
}
.filetable th, .filetable td {
  padding: 10px 14px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.filetable th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; }
.filetable tr:last-child td { border-bottom: none; }
.filetable tbody tr:hover { background: var(--row-hover); }

.col-size, .col-mtime { color: var(--muted); white-space: nowrap; width: 140px; }
.col-actions { width: 220px; white-space: nowrap; }

.entry-name { display: flex; align-items: center; gap: 8px; cursor: default; }
.entry-name .icon { font-size: 16px; }
a.dirlink { color: var(--text); text-decoration: none; cursor: pointer; font-weight: 500; }
a.dirlink:hover { color: var(--accent); }

.empty { text-align: center; color: var(--muted); padding: 40px 0; }

.toast {
  position: fixed;
  top: 16px;
  right: 20px;
  background: #16a34a;
  color: white;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(15, 23, 42, .18);
}
.toast.error { background: #dc2626; }

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center;
  z-index: 50;
}
.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 24px;
  width: 320px;
  box-shadow: 0 12px 32px rgba(15, 23, 42, .18);
}
.modal.modal-wide { width: min(760px, 90vw); }
.modal h3 { margin: 0 0 14px; }
.modal label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
.modal input {
  display: block;
  width: 100%;
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #f8fafc;
  color: var(--text);
}
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; }

.view-content {
  max-height: 60vh;
  overflow: auto;
  background: #f8fafc;
  padding: 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  white-space: pre-wrap;
  word-break: break-word;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--text);
}
