:root {
  --bg: #f5f7fa;
  --panel: #ffffff;
  --ink: #1c2530;
  --muted: #6b7785;
  --line: #e3e8ef;
  --accent: #2f6fed;
  --accent-ink: #ffffff;
  --danger: #d23f3f;
  --ok: #2e9e5b;
  --radius: 10px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
.hidden { display: none !important; }
button { font: inherit; cursor: pointer; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Landing ---- */
.landing { position: relative; min-height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.landing-bg {
  position: absolute; inset: 0; z-index: 0;
  background:
    radial-gradient(1100px 600px at 12% -10%, #dbe6ff 0%, transparent 55%),
    radial-gradient(900px 500px at 108% 8%, #e7dcff 0%, transparent 50%),
    linear-gradient(160deg, #f7f9fc 0%, #eef2fb 100%);
}
.landing-nav {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between;
  padding: 20px 6vw;
}
.nav-cta { background: var(--ink); color: #fff; padding: 9px 18px; border-radius: 99px; font-size: 14px; font-weight: 600; }
.nav-cta:hover { text-decoration: none; opacity: .9; }
.landing-grid {
  position: relative; z-index: 1; flex: 1; display: grid; grid-template-columns: 1.1fr 0.9fr;
  gap: 48px; align-items: center; max-width: 1140px; width: 100%; margin: 0 auto; padding: 24px 6vw 40px;
}
.hero-badge {
  display: inline-block; font-size: 12.5px; font-weight: 600; color: var(--accent);
  background: rgba(47,111,237,.10); padding: 6px 14px; border-radius: 99px; margin-bottom: 22px;
}
.hero h1 { font-size: clamp(36px, 5vw, 58px); line-height: 1.05; letter-spacing: -0.02em; margin: 0 0 18px; }
.hero-sub { font-size: 18px; color: var(--muted); line-height: 1.55; max-width: 30em; margin: 0 0 26px; }
.hero-features { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.hero-features li { display: flex; align-items: center; gap: 12px; font-size: 15px; color: #33414f; }
.hero-features li span {
  flex: none; width: 30px; height: 30px; display: grid; place-items: center; border-radius: 8px;
  background: #fff; color: var(--accent); box-shadow: 0 2px 8px rgba(20,40,80,.08); font-size: 15px;
}
.auth-card { display: flex; justify-content: center; }
.landing-foot { position: relative; z-index: 1; text-align: center; color: var(--muted); font-size: 13px; padding: 18px; }
@media (max-width: 820px) {
  .landing-grid { grid-template-columns: 1fr; gap: 26px; padding-top: 8px; max-width: 520px; }
  .hero h1 { font-size: clamp(32px, 8vw, 44px); }
  .auth-card { order: -1; }            /* card first on small screens */
}

/* ---- Auth card ---- */
.card {
  background: var(--panel); width: 100%; max-width: 380px; padding: 32px;
  border-radius: 16px; box-shadow: 0 18px 50px rgba(20, 40, 80, .14);
}
.card h2 { margin: 0 0 4px; font-size: 22px; }
.card-sub { color: var(--muted); margin: 0 0 22px; font-size: 14px; }
.brand { font-size: 22px; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.brand.small { font-size: 17px; }
.logo { color: var(--accent); }
#auth-form { display: flex; flex-direction: column; gap: 10px; }
input[type=email], input[type=password], input[type=text] {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: var(--radius);
  font-size: 15px; background: #fbfcfe;
}
input:focus { outline: 2px solid var(--accent); border-color: transparent; }
#auth-submit, .btn-upload {
  background: var(--accent); color: var(--accent-ink); border: 0;
  padding: 11px; border-radius: var(--radius); font-weight: 600; font-size: 15px;
}
.switch { font-size: 14px; color: var(--muted); margin-top: 16px; text-align: center; }
.error { color: var(--danger); font-size: 14px; min-height: 18px; margin: 10px 0 0; }

/* ---- App ---- */
.topbar {
  display: flex; align-items: center; gap: 20px; padding: 12px 22px;
  background: var(--panel); border-bottom: 1px solid var(--line);
}
.topbar .quota { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.quota-bar { width: 140px; height: 7px; background: var(--line); border-radius: 99px; overflow: hidden; }
#quota-fill { height: 100%; width: 0; background: var(--accent); transition: width .3s; }
.quota-text { font-size: 12px; color: var(--muted); white-space: nowrap; }
.user { display: flex; align-items: center; gap: 12px; font-size: 14px; color: var(--muted); }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: var(--radius); padding: 7px 12px; color: var(--ink); }
.ghost:hover { background: var(--bg); }

.toolbar { display: flex; align-items: center; padding: 16px 22px 8px; gap: 16px; }
.breadcrumb { font-size: 15px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.breadcrumb a { color: var(--ink); font-weight: 500; }
.breadcrumb .sep { color: var(--muted); }
.breadcrumb .current { color: var(--muted); }
.actions { margin-left: auto; display: flex; gap: 10px; align-items: center; }
.btn-upload { display: inline-block; cursor: pointer; padding: 8px 14px; font-size: 14px; }

.uploads { padding: 0 22px; }
.upload-item { font-size: 13px; color: var(--muted); padding: 6px 0; display: flex; gap: 10px; align-items: center; }
.upload-item .prog { flex: 1; height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; max-width: 240px; }
.upload-item .prog > div { height: 100%; background: var(--ok); width: 0; transition: width .15s; }

.filelist { padding: 8px 22px 40px; }
table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding: 8px 10px; border-bottom: 1px solid var(--line); font-weight: 600; }
.col-size { width: 110px; }
.col-when { width: 180px; }
tbody td { padding: 11px 10px; border-bottom: 1px solid var(--line); font-size: 14px; }
tbody tr:hover { background: var(--panel); }
.name-cell { display: flex; align-items: center; gap: 10px; }
.icon { width: 20px; text-align: center; }
.icon.dir { color: #e8b339; }
.icon.file { color: var(--muted); }
.name-link { cursor: pointer; }
.name-link:hover { text-decoration: underline; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions a { font-size: 13px; margin-left: 14px; }
.row-actions a:first-child { margin-left: 0; }
.muted { color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 40px; }

/* drag-and-drop */
.filelist { position: relative; }
.drophint {
  display: none; position: absolute; inset: 0; align-items: center; justify-content: center;
  background: rgba(47,111,237,.06); border: 2px dashed var(--accent); border-radius: 12px;
  color: var(--accent); font-weight: 600; font-size: 16px; pointer-events: none; z-index: 5;
}
.filelist.dragover .drophint { display: flex; }

/* modal / preview */
.modal { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,25,45,.55); }
.modal-box {
  position: relative; background: var(--panel); border-radius: 12px; width: min(880px, 92vw);
  max-height: 88vh; display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(10,20,50,.35);
}
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.modal-head span { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { padding: 16px 18px; overflow: auto; }
.preview-img { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto; border-radius: 6px; }
.preview-frame { width: 100%; height: 72vh; border: 0; }
.preview-text { white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 13px; line-height: 1.5; margin: 0; }

/* ---- dialog (input/confirm) ---- */
.dialog-box { width: min(440px, 92vw); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; padding: 14px 18px 18px; }
.dlg-btn { border: 0; border-radius: 10px; padding: 10px 18px; font-weight: 600; font-size: 14px; }
.dlg-btn.primary { background: var(--accent); color: #fff; }
.dlg-btn.danger { background: var(--danger); color: #fff; }
.dlg-btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.dlg-btn.ghost:hover { background: var(--bg); }
.dialog-msg { margin: 0 0 4px; color: #33414f; font-size: 14.5px; line-height: 1.5; }
.field { margin-bottom: 12px; }
.field-label { display: block; font-size: 13px; color: var(--muted); margin-bottom: 6px; font-weight: 600; }
.dialog-input { width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; font-size: 15px; background: #fbfcfe; }
.dialog-input:focus { outline: 2px solid var(--accent); border-color: transparent; }
.link-row { display: flex; gap: 8px; margin-top: 6px; }
.link-row input { flex: 1; font-size: 13px; }

/* account button in topbar */
#account { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- account panel ---- */
.account-box { width: min(560px, 94vw); max-height: 88vh; }
.acct-usage { margin-bottom: 8px; }
.acct-bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; margin: 8px 0 6px; }
.acct-bar > div { height: 100%; background: var(--accent); border-radius: 99px; }
.acct-section { padding: 16px 0; border-top: 1px solid var(--line); }
.acct-section:first-child { border-top: 0; padding-top: 4px; }
.acct-section h3 { margin: 0 0 4px; font-size: 15px; }
.acct-section .sub { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.acct-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.acct-row .val { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; }
.acct-btn { border: 1px solid var(--line); background: #fff; border-radius: 9px; padding: 8px 14px; font-size: 13px; font-weight: 600; color: var(--ink); white-space: nowrap; }
.acct-btn:hover { background: var(--bg); }
.acct-btn.danger { border-color: #f2c2c2; color: var(--danger); }
.acct-btn.danger:hover { background: #fdecec; }

/* ---- pending banner ---- */
.pending-banner {
  display: flex; align-items: center; justify-content: space-between; gap: 14px;
  background: #fff7e6; border-bottom: 1px solid #f2dca5; color: #7a5a12;
  padding: 10px 22px; font-size: 14px;
}

/* ---- admin panel ---- */
.admin-box { width: min(920px, 96vw); max-height: 90vh; }
.modal-head > div { display: flex; gap: 8px; }
.admin-stats { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 6px; }
.stat-card { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; min-width: 96px; }
.stat-card .n { font-size: 20px; font-weight: 700; }
.stat-card .l { font-size: 12px; color: var(--muted); }
.admin-toggle { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); margin: 12px 0; }
.switch-btn { border: 1px solid var(--line); background: #fff; border-radius: 99px; width: 46px; height: 26px; position: relative; cursor: pointer; transition: background .15s; flex: none; }
.switch-btn::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.25); transition: left .15s; }
.switch-btn.on { background: var(--ok); border-color: var(--ok); }
.switch-btn.on::after { left: 22px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.admin-table th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .04em; padding: 8px 8px; border-bottom: 1px solid var(--line); }
.admin-table td { padding: 8px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.admin-table select { padding: 5px 8px; border: 1px solid var(--line); border-radius: 8px; font-size: 13px; background: #fff; }
.admin-table .del { color: var(--danger); cursor: pointer; font-size: 13px; }
.badge { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 11.5px; font-weight: 600; }
.badge.active { background: #e4f6ea; color: #227a45; }
.badge.pending { background: #fff2d9; color: #8a6413; }
.badge.suspended { background: #fde0e0; color: #a83232; }
.admin-section-title { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; margin: 18px 0 8px; }

/* ---- toasts ---- */
.toasts { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); z-index: 100; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast { background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 10px; font-size: 14px; box-shadow: 0 8px 26px rgba(10,20,50,.28); animation: toast-in .18s ease; max-width: 90vw; }
.toast.error { background: var(--danger); }
.toast.success { background: var(--ok); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
