/* ─────────────────────────────────────────────
   Vanfu Files — graphite & ivory
   Monochrome premium: warm off-white canvas,
   near-black ink, black primary buttons.
   No decorative color. Linear/Things energy.
   ───────────────────────────────────────────── */

:root {
  --canvas: #fafaf9;
  --surface: #ffffff;
  --ink: #191918;
  --ink-2: #57534e;
  --ink-3: #a3a09b;
  --line: #e7e5e2;
  --line-soft: #f0efed;
  --hover: #f4f3f1;
  --black: #191918;
  --black-hover: #2e2d2b;
  --ring: rgba(25, 25, 24, 0.12);
  --red: #c5483e;
  --green: #3e7a4e;
  --shadow-card: 0 1px 2px rgba(25, 25, 24, 0.04), 0 8px 24px rgba(25, 25, 24, 0.05);
  --shadow-pop: 0 4px 12px rgba(25, 25, 24, 0.08), 0 16px 48px rgba(25, 25, 24, 0.1);
  --font: "Geist", -apple-system, "Segoe UI", Helvetica, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; }

body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--canvas);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
svg { width: 16px; height: 16px; flex-shrink: 0; }
button { font-family: var(--font); cursor: pointer; }
input { font-family: var(--font); }

/* ───────── Logo ───────── */
.logo {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  background: var(--black);
  color: #fff;
  font-size: 21px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}
.logo.sm { width: 26px; height: 26px; font-size: 14px; border-radius: 7px; }

/* ───────── Buttons ───────── */
.btn-dark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: var(--black);
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 18px;
  transition: background 0.14s, transform 0.1s;
}
.btn-dark:hover { background: var(--black-hover); }
.btn-dark:active { transform: scale(0.985); }
.btn-dark:disabled { opacity: 0.5; cursor: default; }
.btn-dark.sm { padding: 7px 14px; font-size: 13.5px; border-radius: 7px; }

.btn-light {
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 13px;
  transition: background 0.12s, border-color 0.12s;
}
.btn-light:hover { background: var(--hover); border-color: #d8d6d2; }

.ghost-btn {
  border: none;
  background: none;
  color: var(--ink-3);
  padding: 6px;
  border-radius: 7px;
  display: flex;
  transition: background 0.12s, color 0.12s;
}
.ghost-btn:hover { background: var(--hover); color: var(--ink); }

/* ───────── Login ───────── */
.login {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--canvas);
}

.login-box {
  width: 100%;
  max-width: 330px;
  display: flex;
  flex-direction: column;
  align-items: center;
  animation: rise 0.45s cubic-bezier(0.2, 0.9, 0.3, 1);
}

@keyframes rise {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: none; }
}

.login-box h1 {
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: 20px;
}

.login-box .sub {
  font-size: 13.5px;
  color: var(--ink-3);
  margin: 4px 0 30px;
}

.login-box input {
  font-size: 14.5px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
  margin-bottom: 11px;
  transition: border-color 0.13s, box-shadow 0.13s;
}
.login-box input::placeholder { color: var(--ink-3); }
.login-box input:focus {
  outline: none;
  border-color: var(--ink-2);
  box-shadow: 0 0 0 3.5px var(--ring);
}

.secret-wrap { position: relative; width: 100%; }
.secret-wrap input { padding-right: 40px; }
.secret-wrap button {
  position: absolute;
  right: 6px;
  top: 8px;
  border: none;
  background: none;
  color: var(--ink-3);
  padding: 5px;
  border-radius: 6px;
  display: flex;
}
.secret-wrap button:hover { color: var(--ink-2); }

#loginBtn { width: 100%; margin-top: 8px; padding: 11px; }

/* ───────── App shell ───────── */
.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: 1060px;
  margin: 0 auto;
  padding: 0 32px;
}

/* ───────── Topbar ───────── */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 0 18px;
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand-name { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }

.topbar-right { display: flex; align-items: center; gap: 9px; }

.avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--line-soft);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 11.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}
.uname { font-size: 13.5px; font-weight: 500; color: var(--ink-2); }

/* ───────── Toolbar ───────── */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 14px;
  flex-wrap: wrap;
}

.crumbs { display: flex; align-items: center; flex-wrap: wrap; min-width: 0; }

.crumb {
  border: none;
  background: none;
  font-size: 14.5px;
  font-weight: 500;
  color: var(--ink-3);
  padding: 3px 7px;
  border-radius: 6px;
  white-space: nowrap;
  transition: background 0.1s, color 0.1s;
}
.crumb:hover { background: var(--hover); color: var(--ink); }
.crumb:last-child { color: var(--ink); font-weight: 600; }

.crumb-sep { color: #cfccc7; font-size: 13px; padding: 0 2px; }

.actions { display: flex; align-items: center; gap: 8px; }

.search {
  display: flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 0 10px;
  color: var(--ink-3);
  transition: border-color 0.13s, box-shadow 0.13s;
}
.search:focus-within {
  border-color: var(--ink-2);
  box-shadow: 0 0 0 3.5px var(--ring);
}
.search svg { width: 14px; height: 14px; }
.search input {
  border: none;
  background: none;
  font-size: 13.5px;
  color: var(--ink);
  padding: 7.5px 0;
  width: 130px;
}
.search input:focus { outline: none; }
.search input::placeholder { color: var(--ink-3); }

/* ───────── Sheet (file table) ───────── */
.sheet {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
  margin-bottom: 32px;
}

.cols,
.row {
  display: grid;
  grid-template-columns: 44px 1fr 88px 130px 78px;
  align-items: center;
  padding: 0 14px;
}

.cols {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-3);
  padding-top: 11px;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--line);
}

.list { flex: 1; overflow-y: auto; }

.row {
  min-height: 44px;
  font-size: 14px;
  border-bottom: 1px solid var(--line-soft);
  transition: background 0.1s;
}
.row:last-child { border-bottom: none; }
.row:hover { background: var(--canvas); }
.folder-row { cursor: pointer; }

.row-icon { display: flex; justify-content: center; color: var(--ink-3); }
.row-icon svg { width: 17px; height: 17px; }
.folder-icon { color: var(--ink-2); }
.folder-icon svg { fill: var(--line-soft); }

.row-name {
  font-weight: 450;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-row .row-name { font-weight: 550; }

.row-meta {
  font-size: 13px;
  color: var(--ink-3);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.row-actions {
  display: flex;
  justify-content: flex-end;
  gap: 2px;
  opacity: 0;
  transition: opacity 0.12s;
}
.row:hover .row-actions { opacity: 1; }

.icon-btn {
  border: none;
  background: none;
  color: var(--ink-3);
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.1s, color 0.1s;
}
.icon-btn svg { width: 14.5px; height: 14.5px; }
.icon-btn:hover { background: var(--hover); color: var(--ink); }
.icon-btn.del-btn:hover { color: var(--red); }

/* ───────── Empty / loading ───────── */
.empty {
  padding: 100px 20px;
  text-align: center;
  color: var(--ink-3);
  font-size: 14px;
}
.empty button {
  margin-top: 12px;
  border: none;
  background: none;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 90px;
  color: var(--ink-3);
  font-size: 13.5px;
}
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--line);
  border-top-color: var(--ink-2);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ───────── Drop overlay ───────── */
.drop {
  position: fixed;
  inset: 0;
  background: rgba(250, 250, 249, 0.86);
  backdrop-filter: blur(2px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.15s;
  z-index: 60;
}
.drop.show { opacity: 1; pointer-events: auto; }

.drop-box {
  border: 1.5px dashed var(--ink-2);
  border-radius: 14px;
  padding: 34px 64px;
  font-size: 15px;
  font-weight: 550;
  color: var(--ink);
  background: var(--surface);
  box-shadow: var(--shadow-pop);
}

/* ───────── Uploads ───────── */
.uploads {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 290px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 11px;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
  z-index: 50;
  overflow: hidden;
}
.uploads.show { opacity: 1; transform: none; pointer-events: auto; }

.upload-item {
  display: grid;
  grid-template-columns: 1fr 76px 32px;
  align-items: center;
  gap: 9px;
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--line-soft);
}
.upload-item:last-child { border-bottom: none; }
.up-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; }
.up-bar { height: 4px; background: var(--line-soft); border-radius: 2px; overflow: hidden; }
.up-fill { height: 100%; background: var(--ink); transition: width 0.2s; }
.up-pct { font-size: 11.5px; color: var(--ink-3); text-align: right; font-variant-numeric: tabular-nums; }
.upload-item.done .up-fill { background: var(--green); }
.upload-item.done .up-pct { color: var(--green); font-weight: 700; }
.upload-item.failed .up-fill { background: var(--red); }
.upload-item.failed .up-pct { color: var(--red); font-weight: 700; }

/* ───────── Toast ───────── */
.toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  transform: translateX(-50%) translateY(10px);
  background: var(--ink);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  padding: 9px 18px;
  border-radius: 9px;
  box-shadow: var(--shadow-pop);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s cubic-bezier(0.2, 0.9, 0.3, 1);
  z-index: 70;
  max-width: 80vw;
}
.toast.show { opacity: 1; transform: translateX(-50%); }
.toast.error { background: var(--red); }
.toast.success { background: var(--ink); }

/* ───────── Mobile ───────── */
@media (max-width: 720px) {
  .app { padding: 0 14px; }
  .cols { display: none; }
  .row { grid-template-columns: 36px 1fr 78px; padding: 0 10px; }
  .row .row-meta:nth-child(4) { display: none; }
  .row-actions { opacity: 1; }
  .search input { width: 76px; }
  .topbar { padding: 16px 0 12px; }
}

/* ───────── Modals ───────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(25, 25, 24, 0.32);
  backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.16s ease;
  z-index: 80;
  padding: 20px;
}
.modal-overlay.show { opacity: 1; pointer-events: auto; }

.modal {
  width: 100%;
  max-width: 360px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  padding: 24px;
  transform: scale(0.96) translateY(6px);
  transition: transform 0.18s cubic-bezier(0.2, 0.9, 0.3, 1);
}
.modal-overlay.show .modal { transform: none; }

.modal h3 {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 14px;
}

.modal input {
  font-size: 14.5px;
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--ink);
  width: 100%;
  transition: border-color 0.13s, box-shadow 0.13s;
}
.modal input::placeholder { color: var(--ink-3); }
.modal input:focus {
  outline: none;
  border-color: var(--ink-2);
  box-shadow: 0 0 0 3.5px var(--ring);
}

.modal-text {
  font-size: 14px;
  color: var(--ink-2);
  word-break: break-all;
  padding: 10px 13px;
  background: var(--canvas);
  border-radius: 9px;
  border: 1px solid var(--line-soft);
}

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

.btn-danger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red);
  color: #fff;
  border: none;
  border-radius: 7px;
  font-size: 13.5px;
  font-weight: 500;
  padding: 7px 14px;
  transition: background 0.14s, transform 0.1s;
}
.btn-danger:hover { background: #ad3c33; }
.btn-danger:active { transform: scale(0.985); }

/* ───────── Mode switcher (Company Files / Product Images) ───────── */
.modebar {
  display: flex;
  gap: 4px;
  padding: 0 0 2px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 2px;
}
.mode-tab {
  border: none;
  background: none;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-3);
  padding: 8px 14px;
  border-radius: 8px 8px 0 0;
  position: relative;
  transition: color 0.12s, background 0.12s;
}
.mode-tab:hover { color: var(--ink); background: var(--hover); }
.mode-tab.active { color: var(--ink); font-weight: 600; }
.mode-tab.active::after {
  content: "";
  position: absolute;
  left: 10px; right: 10px; bottom: -3px;
  height: 2px;
  background: var(--ink);
  border-radius: 2px;
}
.icon-btn.copy-btn:hover { color: var(--green); }
