* { box-sizing: border-box; }
body {
  font-family: -apple-system, Segoe UI, Roboto, sans-serif;
  background: #111418;
  color: #e6e6e6;
  margin: 0;
  padding: 0;
}
.container {
  max-width: 480px;
  margin: 60px auto;
  padding: 24px;
}
h1 { font-size: 1.4rem; margin-bottom: 20px; }
input, button {
  width: 100%;
  padding: 12px;
  margin: 6px 0;
  border-radius: 8px;
  border: 1px solid #333;
  background: #1c2026;
  color: #fff;
  font-size: 1rem;
}
button {
  background: #2f7de1;
  border: none;
  cursor: pointer;
  font-weight: 600;
}
button:hover { background: #245fb0; }
.error { color: #ff6b6b; margin-top: 8px; min-height: 1.2em; }
.dropzone {
  border: 2px dashed #444;
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  color: #999;
  margin: 20px 0;
  cursor: pointer;
}
.dropzone.dragover { border-color: #2f7de1; color: #fff; }
.file-list { margin-top: 16px; font-size: 0.9rem; }
.file-item { display: flex; justify-content: space-between; padding: 4px 0; border-bottom: 1px solid #222; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 20px;
  border-bottom: 1px solid #222;
}
.topbar button { width: auto; padding: 8px 14px; }

.tabs {
  display: flex;
  gap: 4px;
  padding: 0 20px;
  border-bottom: 1px solid #222;
}
.tab-btn {
  width: auto;
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 12px 16px;
  color: #999;
  font-weight: 600;
}
.tab-btn.active { color: #fff; border-bottom: 2px solid #2f7de1; }
.tab-btn:hover { background: #1c2026; }

.tab-panel.container { max-width: 900px; }

.gallery-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.gallery-toolbar label { display: flex; align-items: center; gap: 6px; color: #ccc; font-size: 0.9rem; }
.gallery-toolbar input[type="checkbox"] { width: auto; margin: 0; }
.gallery-toolbar button, .panel-section button, .panel-section select { width: auto; }

.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.media-card {
  background: #1c2026;
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #2a2f36;
}
.media-card.deleted { opacity: 0.6; border-color: #7a3d3d; }
.media-thumb {
  width: 100%;
  height: 110px;
  background: #0d0f12;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.media-thumb img, .media-thumb video { width: 100%; height: 100%; object-fit: cover; }
.media-thumb .icon { font-size: 2rem; color: #555; }
.media-info { padding: 8px; font-size: 0.78rem; }
.media-info .name { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 4px; }
.media-info .meta { color: #888; display: block; margin-bottom: 6px; }
.media-actions { display: flex; gap: 4px; }
.media-actions button {
  width: auto;
  flex: 1;
  padding: 6px;
  font-size: 0.75rem;
  background: #2a2f36;
}
.media-actions button.danger { background: #7a3d3d; }
.media-actions button:hover { background: #384049; }

.pager { display: flex; gap: 8px; justify-content: center; margin-top: 16px; }
.pager button { width: auto; padding: 8px 16px; }

.panel-section { margin-bottom: 32px; }
.panel-section h2 { font-size: 1.05rem; margin-bottom: 12px; }
.user-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #222;
  font-size: 0.9rem;
}
.user-row .role-badge {
  background: #2a2f36;
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  margin-left: 8px;
}
.user-row button { width: auto; padding: 6px 10px; font-size: 0.8rem; }
.user-row.inactive { opacity: 0.5; }
#token-result, #share-result {
  margin-top: 12px;
  padding: 12px;
  background: #1c2026;
  border-radius: 8px;
  font-size: 0.85rem;
  word-break: break-all;
  display: none;
}

.audit-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}
.audit-table th, .audit-table td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid #222;
}
.audit-table th { color: #999; font-weight: 600; }
#export-audit-btn { text-decoration: none; }
#export-audit-btn button { width: auto; }

.upload-progress {
  margin-top: 12px;
  background: #1c2026;
  border-radius: 8px;
  height: 26px;
  position: relative;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  width: 0%;
  background: #2f7de1;
  transition: width 0.15s ease;
}
.upload-progress span {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 600;
}

.gallery-search {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.gallery-search input { width: auto; flex: 1; min-width: 140px; }
.gallery-search button { width: auto; }

.media-card { position: relative; }
.media-card .select-check {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 20px;
  height: 20px;
  z-index: 2;
  margin: 0;
  cursor: pointer;
}
.media-card.selected { border-color: #2f7de1; box-shadow: 0 0 0 2px #2f7de1 inset; }
