:root {
  --bg: #0b0d12;
  --panel: #141822;
  --panel-2: #1b2030;
  --border: #262c3d;
  --text: #e6e9f2;
  --muted: #8a93a8;
  --accent: #f2b01e;
  --accent-hover: #ffc53d;
  --danger: #e5484d;
  --ok: #46a758;
  --radius: 10px;
  --font: ui-sans-serif, system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.5;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
  background: var(--panel);
  position: sticky;
  top: 0;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  background: linear-gradient(135deg, #ff6ec7 0%, #f2b01e 50%, #5ac8fa 100%);
  color: #111;
  padding: 4px 12px;
  border-radius: 6px;
  font-weight: 800;
  letter-spacing: 0.5px;
  font-style: italic;
  text-shadow: 1px 1px 0 rgba(255, 255, 255, 0.3);
}

.tag {
  color: var(--muted);
}

.auth {
  display: flex;
  gap: 8px;
}

input,
select,
button {
  font: inherit;
  color: inherit;
}

input[type='text'],
input[type='password'],
select {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--text);
  outline: none;
  min-width: 180px;
}

input:focus,
select:focus {
  border-color: var(--accent);
}

button {
  background: var(--accent);
  color: #111;
  border: none;
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}

button:hover {
  background: var(--accent-hover);
}

button.ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid var(--border);
}

button.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

button.danger {
  background: var(--danger);
  color: #fff;
}

main {
  max-width: 1100px;
  margin: 24px auto;
  padding: 0 24px;
  display: grid;
  gap: 20px;
}

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

.card h2 {
  margin: 0 0 16px 0;
  font-size: 16px;
  font-weight: 600;
}

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

.row-actions {
  display: flex;
  gap: 8px;
}

form label {
  display: block;
  margin-bottom: 12px;
  color: var(--muted);
}

form label input[type='text'] {
  display: block;
  margin-top: 6px;
  width: 280px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 140px;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  text-align: center;
  padding: 20px;
  transition: border-color 0.15s, background 0.15s;
}

.dropzone:hover,
.dropzone.drag {
  border-color: var(--accent);
  background: rgba(242, 176, 30, 0.05);
}

.dropzone-label {
  color: var(--muted);
}

.previews {
  display: none;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

.previews.show {
  display: flex;
}

.preview {
  position: relative;
  width: 88px;
  height: 88px;
  border-radius: 8px;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--border);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.preview .remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s;
}

.preview .remove:hover {
  background: var(--danger);
}

.preview .filename {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 10px;
  padding: 3px 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.results {
  margin-top: 12px;
  display: grid;
  gap: 6px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  background: var(--panel-2);
  padding: 8px 12px;
  border-radius: 6px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  overflow: hidden;
}

.result-item.err {
  border-left: 3px solid var(--danger);
}

.result-item.ok {
  border-left: 3px solid var(--ok);
}

.result-item a {
  color: var(--accent);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.file-tile {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.file-tile .thumb {
  aspect-ratio: 1;
  background: #000;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-tile .thumb img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}

.file-tile .meta {
  padding: 8px 10px;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.file-tile .meta .name {
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-tile .actions {
  display: flex;
  gap: 6px;
  padding: 0 10px 10px 10px;
}

.file-tile .actions button {
  flex: 1;
  font-size: 12px;
  padding: 6px 8px;
}

.empty {
  color: var(--muted);
  font-style: italic;
  padding: 20px;
  text-align: center;
}

.toast {
  position: fixed;
  bottom: 20px;
  right: 20px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 8px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s, transform 0.2s;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.toast.err {
  border-left-color: var(--danger);
}
