@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=IBM+Plex+Mono:wght@400;500;600&display=swap');

:root {
  --bg: #1b1d1f;
  --panel: #222528;
  --panel-alt: #2a2d31;
  --panel-raised: #2e3236;
  --border: #34383c;
  --border-soft: #2b2f33;
  --ink: #e9e7e2;
  --muted: #9a9ea3;
  --muted-soft: #6c7075;
  --accent: #e0a63e;
  --accent-ink: #1b1d1f;
  --danger: #c1554a;
  --danger-ink: #fbe9e7;

  /* folder-tab colors, by file family */
  --tab-folder: #e0a63e;
  --tab-doc: #6fa8dc;
  --tab-image: #7fbf7f;
  --tab-archive: #b892d6;
  --tab-code: #e08a5c;
  --tab-audio: #d67ab1;
  --tab-video: #5cc2c9;
  --tab-pdf: #d15b5b;
  --tab-default: #6c7075;

  --radius: 6px;
  --font-ui: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
}

button { font-family: inherit; }

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 28px 20px 60px;
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

/* ---------- Top band ---------- */

.topband {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
}

.brand-mark {
  display: inline-flex;
  width: 30px;
  height: 30px;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  background: rgba(224, 166, 62, 0.14);
}

.brand-name {
  font-family: var(--font-mono);
  font-weight: 600;
  font-size: 17px;
  letter-spacing: 0.02em;
  color: var(--ink);
}

.topband-actions {
  display: flex;
  gap: 10px;
}

/* ---------- Buttons ---------- */

.btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--panel-alt);
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  padding: 9px 15px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: background-color 120ms ease, border-color 120ms ease, transform 60ms ease;
}

.btn:hover { background: var(--panel-raised); border-color: var(--muted-soft); }
.btn:active { transform: translateY(1px); }

.btn-ghost {
  background: transparent;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}
.btn-primary:hover { background: #eab558; border-color: #eab558; }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: var(--danger-ink);
  font-weight: 600;
}
.btn-danger:hover { background: #cf6459; border-color: #cf6459; }

/* ---------- Label strip (breadcrumb, like a typed card-catalog label) ---------- */

.label-strip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 11px 16px;
  border-bottom: none;
}

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

.breadcrumb button {
  background: none;
  border: none;
  color: var(--muted);
  font-family: inherit;
  font-size: inherit;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
}

.breadcrumb button:hover { color: var(--ink); background: var(--panel-alt); }

.breadcrumb .crumb-current {
  color: var(--accent);
  font-weight: 600;
  padding: 2px 4px;
}

.breadcrumb .crumb-sep {
  color: var(--muted-soft);
}

.item-count {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--muted-soft);
  white-space: nowrap;
}

/* ---------- Main listing panel ---------- */

.drop-zone {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 0 0 var(--radius) var(--radius);
  flex: 1;
  min-height: 320px;
}

.drop-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(224, 166, 62, 0.08);
  border: 2px dashed var(--accent);
  border-radius: var(--radius);
  pointer-events: none;
}

.drop-zone.dragging .drop-overlay { display: flex; }

.drop-overlay-inner {
  font-family: var(--font-mono);
  color: var(--accent);
  font-size: 15px;
  letter-spacing: 0.02em;
}

.table-head {
  display: grid;
  grid-template-columns: 10px 1fr 100px 170px 84px;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted-soft);
}

.listing {
  display: flex;
  flex-direction: column;
}

.row {
  display: grid;
  grid-template-columns: 10px 1fr 100px 170px 84px;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-soft);
  cursor: default;
  user-select: none;
}

.row:hover { background: var(--panel-alt); }
.row.drag-over { background: rgba(224, 166, 62, 0.12); outline: 1px dashed var(--accent); outline-offset: -1px; }
.row[draggable="true"] { cursor: grab; }

.row-tab {
  width: 4px;
  height: 22px;
  border-radius: 2px;
  background: var(--tab-default);
}

.row-name {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 0;
  font-size: 14px;
}

.row-name .icon {
  flex: none;
  display: inline-flex;
  opacity: 0.9;
}

.row-name .name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-name button.name-link {
  background: none;
  border: none;
  color: var(--ink);
  font: inherit;
  padding: 0;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  text-align: left;
}

.row.type-folder .row-name button.name-link { color: var(--ink); font-weight: 500; }

.row-size, .row-modified {
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
  white-space: nowrap;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
}

.row-actions button {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  padding: 5px 7px;
  border-radius: 5px;
  display: inline-flex;
}

.row-actions button:hover { color: var(--ink); background: var(--panel-raised); }

.empty-state {
  padding: 70px 20px;
  text-align: center;
}

.empty-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0 0 6px;
}

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

/* ---------- Status bar ---------- */

.statusbar {
  min-height: 20px;
  margin-top: 10px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  color: var(--muted);
}

.statusbar.error { color: var(--danger); }
.statusbar.success { color: var(--tab-image); }

/* ---------- Context menu ---------- */

.ctx-menu {
  position: fixed;
  z-index: 50;
  min-width: 150px;
  background: var(--panel-raised);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 5px;
  box-shadow: 0 12px 28px rgba(0,0,0,0.45);
}

.ctx-menu button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  color: var(--ink);
  font-size: 13px;
  padding: 8px 10px;
  border-radius: 4px;
  cursor: pointer;
}

.ctx-menu button:hover { background: var(--panel-alt); }
.ctx-menu button.ctx-danger { color: var(--danger); }
.ctx-menu button.ctx-danger:hover { background: rgba(193, 85, 74, 0.14); }

/* ---------- Dialogs ---------- */

.dialog {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-raised);
  color: var(--ink);
  padding: 20px;
  width: 380px;
  max-width: 90vw;
}

.dialog::backdrop {
  background: rgba(0, 0, 0, 0.55);
}

.dialog-title {
  font-size: 16px;
  margin: 0 0 14px;
}

.dialog-copy {
  font-size: 13.5px;
  color: var(--muted);
  margin: 0 0 16px;
  line-height: 1.5;
}

.field-label {
  display: block;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 6px;
}

.field-input {
  width: 100%;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--ink);
  border-radius: 5px;
  padding: 9px 11px;
  font-size: 14px;
  font-family: var(--font-mono);
}

.field-input:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 18px;
}

.move-tree {
  max-height: 240px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 5px;
  background: var(--panel);
}

.move-tree-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  font-size: 13.5px;
  cursor: pointer;
  border-bottom: 1px solid var(--border-soft);
}

.move-tree-item:last-child { border-bottom: none; }
.move-tree-item:hover { background: var(--panel-alt); }
.move-tree-item.selected { background: rgba(224, 166, 62, 0.14); color: var(--accent); }
.move-tree-item .indent { flex: none; }

/* ---------- Focus visibility ---------- */

a:focus-visible,
button:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Responsive ---------- */

@media (max-width: 640px) {
  .table-head .col-modified, .row-modified { display: none; }
  .table-head, .row {
    grid-template-columns: 8px 1fr 76px 68px;
  }
  .app { padding: 18px 12px 40px; }
  .topband-actions .btn { padding: 8px 11px; font-size: 12.5px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
