:root {
  --bg: #fdfaf6;
  --ink: #2b2320;
  --muted: #8a7d72;
  --accent: #b5794a;
  --accent-ink: #ffffff;
  --card: #ffffff;
  --border: #e8ddd0;
  --error: #b3413a;
  --success: #3f7d5c;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 16px 48px;
}

header {
  text-align: center;
  margin: 16px 0 24px;
}

header h1 {
  font-size: 1.4rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 8px;
}

header p {
  margin: 0;
  color: var(--muted);
}

main {
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

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

button {
  font: inherit;
  border: none;
  border-radius: 10px;
  padding: 14px 18px;
  cursor: pointer;
}

.btn-primary {
  background: var(--accent);
  color: var(--accent-ink);
  width: 100%;
  font-size: 1rem;
  font-weight: 600;
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
}

input[type="file"] {
  display: none;
}

.preview-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.preview-item {
  position: relative;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--border);
}

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

.preview-item .remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  font-size: 14px;
  line-height: 1;
}

.preview-item .meta {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 3px 6px;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  color: #fff;
  font-size: 0.65rem;
}

.preview-item.status-error {
  outline: 2px solid var(--error);
}

.preview-item.status-success {
  outline: 2px solid var(--success);
}

.status-line {
  font-size: 0.9rem;
  color: var(--muted);
  min-height: 1.2em;
}

.status-line.error {
  color: var(--error);
}

.status-line.success {
  color: var(--success);
}

.hidden {
  display: none !important;
}

/* Viewer / bildspel */
body.viewer-body {
  padding: 0;
  margin: 0;
  background: #000;
  overflow: hidden;
  height: 100vh;
}

.viewer-stage {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #000;
}

.viewer-stage img {
  position: absolute;
  max-width: 100vw;
  max-height: 100vh;
  object-fit: contain;
  transition: opacity 1s ease;
}

.viewer-empty {
  color: #999;
  font-size: 1.4rem;
  text-align: center;
  padding: 24px;
}

/* Admin */
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border);
}

.admin-table img.thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 6px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.login-form input {
  padding: 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font: inherit;
}
