:root {
  --bg: #eef1f5;
  --panel: #ffffff;
  --ink: #1c2430;
  --muted: #6b7785;
  --line: #d8dee6;
  --accent: #3b82f6;
  --accent-soft: #dbeafe;
  --danger: #dc2626;
  --shadow: 0 1px 2px rgba(28, 36, 48, 0.06), 0 8px 24px rgba(28, 36, 48, 0.06);
  --radius: 10px;
  --font: "IBM Plex Sans", "Noto Sans SC", "PingFang SC", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(1200px 600px at 10% -10%, #dbe7ff 0%, transparent 55%),
    radial-gradient(900px 500px at 100% 0%, #e8f0f8 0%, transparent 50%),
    var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-left, .topbar-right { display: flex; align-items: center; gap: 8px; min-width: 0; }

.icon-btn {
  width: 40px;
  height: 40px;
  border: 1px solid transparent;
  background: transparent;
  border-radius: 8px;
  color: var(--ink);
  cursor: pointer;
  display: grid;
  place-items: center;
}
.icon-btn:hover:not(:disabled) { background: var(--accent-soft); border-color: #bfd3f7; }
.icon-btn:disabled { opacity: 0.35; cursor: not-allowed; }

.crumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 4px;
  margin-left: 8px;
  min-width: 0;
  color: var(--muted);
  font-size: 14px;
}
.crumbs a {
  color: var(--muted);
  text-decoration: none;
  padding: 4px 8px;
  border-radius: 6px;
}
.crumbs a:hover { background: #eef3f9; color: var(--ink); }
.crumbs a.current { color: var(--ink); font-weight: 600; }
.crumbs .sep { opacity: 0.45; }

.user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #f4f7fb;
  border: 1px solid var(--line);
  font-size: 14px;
  font-weight: 600;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 16px 22px 22px;
  min-height: 0;
}

.file-panel {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: auto;
  min-height: 280px;
}

.file-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}
.file-table th,
.file-table td {
  padding: 12px 14px;
  border-bottom: 1px solid #eef1f5;
  text-align: left;
  white-space: nowrap;
}
.file-table thead th {
  position: sticky;
  top: 0;
  background: #f8fafc;
  color: var(--muted);
  font-weight: 600;
  z-index: 1;
}
.file-table tbody tr { cursor: default; }
.file-table tbody tr:hover { background: #f5f8fc; }
.file-table tbody tr.selected { background: #eff6ff; }
.file-table tbody tr.folder { cursor: pointer; }

.col-check { width: 40px; }
.col-name { width: 50%; }
.col-date { width: 25%; text-align: center !important; }
.col-size { width: 15%; text-align: right !important; }
.sortable { user-select: none; cursor: pointer; }
.sort-ind { font-size: 11px; color: var(--accent); margin-left: 2px; }

.name-cell {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.name-cell .icon {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: #eef2f7;
  color: #64748b;
}
.name-cell .icon.folder { background: #fff7ed; color: #ea580c; }
.name-cell span { overflow: hidden; text-overflow: ellipsis; }

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

.bottom-row {
  display: grid;
  grid-template-columns: minmax(220px, 320px) minmax(260px, 420px);
  gap: 16px;
  align-items: start;
  justify-content: space-between;
}

.widget {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px 16px;
}
.widget-title { font-size: 14px; font-weight: 700; margin-bottom: 10px; }
.widget-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.widget-head .widget-title { margin-bottom: 0; }
.widget-actions { display: flex; gap: 4px; }
.mini-btn {
  width: 26px;
  height: 26px;
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 6px;
  cursor: pointer;
  color: var(--muted);
  font-size: 16px;
  line-height: 1;
}
.mini-btn:hover { background: #eef2f7; color: var(--ink); }

.storage-meta {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 8px;
}
.storage-meta .sep { margin: 0 4px; }

.bar {
  height: 8px;
  background: #e8edf3;
  border-radius: 999px;
  overflow: hidden;
}
.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, var(--accent));
  border-radius: 999px;
  width: 0;
  transition: width 0.25s ease;
}

.upload-list { display: flex; flex-direction: column; gap: 12px; }
.upload-item .fname {
  font-size: 13px;
  margin-bottom: 6px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.upload-item .meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}
.upload-widget.collapsed .upload-list { display: none; }

.menu {
  position: fixed;
  z-index: 50;
  min-width: 160px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 6px;
  display: flex;
  flex-direction: column;
}
.menu[hidden] {
  display: none !important;
}
.menu button {
  border: 0;
  background: transparent;
  text-align: left;
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
  color: var(--ink);
}
.menu button:hover { background: #f1f5f9; }
.menu button[data-action="delete"] { color: var(--danger); }
.menu button[data-action="logout"] { color: var(--muted); }

.modal {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(28, 36, 48, 0.35);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none !important; }
.modal-card {
  width: min(520px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  padding: 18px 18px 16px;
}
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.modal-head h2 { margin: 0; font-size: 17px; }
.modal-file {
  margin: 0 0 14px;
  font-size: 13px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.modal-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 13px;
  color: var(--muted);
}
.modal-field select,
.modal-field input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
  background: #fff;
}
.share-url-row {
  display: flex;
  gap: 8px;
}
.share-url-row input { flex: 1; min-width: 0; }
.modal-hint {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  min-height: 1.2em;
}
.modal-actions { display: flex; justify-content: flex-end; }
.btn {
  border: 1px solid var(--line);
  background: #f8fafc;
  border-radius: 8px;
  padding: 9px 14px;
  font: inherit;
  cursor: pointer;
  color: var(--ink);
  white-space: nowrap;
}
.btn:hover { background: #eef2f7; }
.btn.primary {
  border-color: transparent;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
}
.btn.primary:hover { filter: brightness(0.96); }

.login-body {
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(360px, 100%);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card h1 { margin: 0; font-size: 22px; }
.login-sub { margin: 0; color: var(--muted); font-size: 14px; }
.login-card label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--muted); }
.login-card input {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  font: inherit;
  color: var(--ink);
}
.login-card button {
  margin-top: 6px;
  border: 0;
  border-radius: 8px;
  padding: 11px 14px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}
.login-card button:hover { filter: brightness(0.95); }
.login-error { color: var(--danger); margin: 0; font-size: 13px; }

@media (max-width: 720px) {
  .bottom-row { grid-template-columns: 1fr; }
  .topbar { padding: 12px 14px; }
  .main { padding: 12px 14px 16px; }
  .col-date { display: none; }
}
