:root {
  --primary: #0a3d6b;
  --accent: #00a8e8;
  --bg: #f4f7fa;
  --card: #fff;
  --border: #e2e8f0;
  --text: #1a1a2e;
  --muted: #5c6370;
  --danger: #c0392b;
  --success: #1e8449;
  --radius: 8px;
  --font: "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 2rem;
  width: min(100%, 400px);
  box-shadow: 0 8px 32px rgba(10, 61, 107, 0.08);
}

.login-card h1 { color: var(--primary); margin-bottom: 0.25rem; }
.login-card p { color: var(--muted); margin-bottom: 1.5rem; }
.login-card label { display: block; margin-bottom: 1rem; font-size: 0.9rem; font-weight: 600; }
.login-card input {
  width: 100%;
  margin-top: 0.35rem;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}
.login-hint { font-size: 0.8rem; color: var(--muted); margin-top: 1rem; }
.back-link { display: inline-block; margin-top: 1rem; color: var(--primary); text-decoration: none; font-size: 0.9rem; }

.admin-header {
  background: var(--primary);
  color: #fff;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.admin-header h1 { font-size: 1.15rem; }
.admin-header__actions { display: flex; gap: 0.75rem; align-items: center; }
.admin-header a { color: rgba(255,255,255,0.85); text-decoration: none; font-size: 0.9rem; }

.admin-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: calc(100vh - 64px);
}

.admin-nav {
  background: var(--card);
  border-right: 1px solid var(--border);
  padding: 1rem 0;
}

.admin-nav button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 0.75rem 1.25rem;
  border: none;
  background: none;
  font: inherit;
  color: var(--muted);
  cursor: pointer;
  border-left: 3px solid transparent;
}

.admin-nav button.active,
.admin-nav button:hover {
  background: var(--bg);
  color: var(--primary);
  border-left-color: var(--accent);
}

.admin-main { padding: 1.5rem; }

.panel { display: none; }
.panel.active { display: block; }

.panel h2 {
  color: var(--primary);
  margin-bottom: 1rem;
  font-size: 1.35rem;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.card h3 { font-size: 1rem; margin-bottom: 1rem; color: var(--primary); }

.field { margin-bottom: 1rem; }
.field label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
}
.field input,
.field textarea,
.field select {
  width: 100%;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font: inherit;
}
.field textarea { min-height: 100px; resize: vertical; }
.field small { display: block; margin-top: 0.25rem; color: var(--muted); font-size: 0.8rem; }

.field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.checkbox-field input { width: auto; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.65rem 1.25rem;
  border: none;
  border-radius: var(--radius);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  background: var(--primary);
  color: #fff;
  transition: opacity 0.2s;
}
.btn:hover { opacity: 0.9; }
.btn--secondary { background: #fff; color: var(--primary); border: 1px solid var(--border); }
.btn--danger { background: var(--danger); }
.btn--small { padding: 0.4rem 0.75rem; font-size: 0.85rem; }

.toolbar {
  position: sticky;
  bottom: 0;
  background: rgba(244, 247, 250, 0.95);
  backdrop-filter: blur(8px);
  border-top: 1px solid var(--border);
  padding: 1rem 0;
  margin-top: 1rem;
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.image-field {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  flex-wrap: wrap;
}
.image-field img {
  width: 120px;
  height: 80px;
  object-fit: contain;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg);
  padding: 0.25rem;
}
.image-field__controls { flex: 1; min-width: 200px; }

.list-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 0.75rem;
  background: var(--bg);
}

.list-item__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
}
.alert--error { background: #fdecea; color: var(--danger); border: 1px solid #f5c6cb; }
.alert--success { background: #e8f8ef; color: var(--success); border: 1px solid #b7dfc9; }

#toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.85rem 1.25rem;
  border-radius: var(--radius);
  background: var(--primary);
  color: #fff;
  font-size: 0.9rem;
  opacity: 0;
  transform: translateY(10px);
  transition: 0.25s;
  z-index: 100;
  pointer-events: none;
}
#toast.show { opacity: 1; transform: translateY(0); }

@media (max-width: 768px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav {
    display: flex;
    overflow-x: auto;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 0;
  }
  .admin-nav button {
    white-space: nowrap;
    border-left: none;
    border-bottom: 3px solid transparent;
  }
  .admin-nav button.active { border-bottom-color: var(--accent); border-left-color: transparent; }
  .field-row { grid-template-columns: 1fr; }
}
