:root {
  --bg: #0f1116;
  --panel: #171a21;
  --panel-2: #1e222b;
  --border: #2a2f3a;
  --text: #e6eaf2;
  --muted: #98a2b3;
  --accent: #4f8cff;
  --accent-2: #37d67a;
  --danger: #ff5c5c;
  --radius: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  font-size: 14px;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
}

header h1 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: .3px;
}

header .spacer { flex: 1; }

main {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
}

.panel:not(:first-child) { margin-top: 16px; }

button {
  font: inherit;
  color: var(--text);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
button:hover:not(:disabled) { background: #262b36; border-color: #3a4150; }
button:disabled { opacity: .5; cursor: not-allowed; }

button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 600;
}
button.primary:hover:not(:disabled) { background: #3f7cf0; }

button.danger {
  background: transparent;
  border-color: #4a2a2a;
  color: var(--danger);
}
button.danger:hover:not(:disabled) { background: #2a1a1a; }

input[type="password"], input[type="text"] {
  font: inherit;
  width: 100%;
  padding: 10px 12px;
  color: var(--text);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
}
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 38px 20px;
  text-align: center;
  color: var(--muted);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.over {
  border-color: var(--accent);
  background: #1b2130;
  color: var(--text);
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.card {
  position: relative;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.card img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: #0b0d12;
}

.card .meta {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.card .del {
  position: absolute;
  top: 6px;
  right: 6px;
  padding: 4px 8px;
  font-size: 12px;
  opacity: 0;
  transition: opacity .15s;
}
.card:hover .del { opacity: 1; }

.progress {
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  min-height: 18px;
  white-space: pre-wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 18px;
  box-shadow: 0 8px 24px rgba(0,0,0,.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s;
  z-index: 50;
}
.toast.show { opacity: 1; }
.toast.error { border-color: #5a2a2a; color: #ff9b9b; }
.toast.ok { border-color: #26543a; color: #8be8b0; }

.storage-bar {
  height: 6px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 10px;
}
.storage-bar > i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  width: 0;
  transition: width .3s;
}

.muted { color: var(--muted); }
.right { text-align: right; }
.row { display: flex; align-items: center; gap: 10px; }
.center { display: flex; align-items: center; justify-content: center; min-height: 100vh; }

.login-card { width: min(360px, 92vw); }
.login-card h2 { margin: 0 0 6px; font-size: 18px; }
.login-card p { margin: 0 0 18px; color: var(--muted); font-size: 13px; }
.login-card form { display: flex; flex-direction: column; gap: 12px; }
