:root {
  --primary-color: #0056b3;
  --secondary-color: #007bff;
  --text-color: #343a40;
  --bg-light: #f8f9fa;
  --bg-white: #ffffff;
  --border-color: #e9ecef;
  --box-shadow-color: rgba(0, 0, 0, 0.08);
  --ok-color: #28a745;
  --bad-color: #dc3545;
  --warn-color: #b45309;
}

body.dark-mode {
  --primary-color: #FFD700;
  --secondary-color: #DAA520;
  --text-color: #E0E0E0;
  --bg-light: #1A1A1A;
  --bg-white: #2C2C2C;
  --border-color: #444444;
  --box-shadow-color: rgba(255, 255, 255, 0.1);
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  line-height: 1.55;
  background: var(--bg-light);
  color: var(--text-color);
  transition: background-color 0.5s, color 0.5s;
  animation: fadeInPage 0.9s ease-in-out;
}

@keyframes fadeInPage {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.app {
  display: grid;
  grid-template-columns: 290px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--bg-white);
  border-right: 1px solid var(--border-color);
  padding: 18px 16px;
  transition: background-color 0.5s, border-color 0.5s;
}

.main {
  padding: 22px 26px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 8px 14px 8px;
  border-bottom: 1px solid var(--border-color);
}

.brand-logo {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  object-fit: cover;
  border: 2px solid var(--secondary-color);
  transition: border-color 0.5s;
}

.brand-title {
  font-weight: 800;
  color: var(--primary-color);
  font-size: 18px;
  transition: color 0.5s;
}

.brand-sub {
  font-size: 12px;
  color: var(--text-color);
  opacity: 0.75;
}

.sidebar-actions {
  display: grid;
  gap: 10px;
  padding: 14px 8px;
  border-bottom: 1px solid var(--border-color);
}

.lang {
  display: flex;
  gap: 10px;
}

.lang-btn {
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  border-radius: 10px;
  padding: 6px 10px;
  cursor: pointer;
  transition: transform 0.2s, background-color 0.3s, border-color 0.3s;
}

.lang-btn:hover { transform: translateY(-2px); }

.lang-btn.active {
  background: var(--secondary-color);
  border-color: var(--secondary-color);
}

.flag {
  width: 26px;
  height: 18px;
  border-radius: 4px;
  display: block;
}

.nav {
  display: grid;
  gap: 10px;
  padding: 14px 8px;
}

.nav-item {
  width: 100%;
  text-align: left;
  padding: 12px 12px;
  border-radius: 10px;
  border: 1px solid var(--border-color);
  background: var(--bg-white);
  color: var(--text-color);
  cursor: pointer;
  font-weight: 800;
  transition: background-color 0.3s, border-color 0.3s, color 0.3s;
}

.nav-item.active {
  background: var(--secondary-color);
  border-color: var(--secondary-color);
  color: var(--bg-white);
}

.sidebar-footer {
  padding: 14px 8px 6px 8px;
}

.topbar {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px 16px;
  box-shadow: 0 6px 25px var(--box-shadow-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: background-color 0.5s, border-color 0.5s, box-shadow 0.5s;
}

.top-title {
  margin: 0;
  font-size: 20px;
  color: var(--primary-color);
  transition: color 0.5s;
}

.badge {
  display: inline-block;
  margin-left: 10px;
  padding: 6px 10px;
  border-radius: 999px;
  font-weight: 800;
  font-size: 12px;
  background: var(--secondary-color);
  color: var(--bg-white);
}

.view {
  margin-top: 18px;
}

.hidden { display: none; }

.card {
  background: var(--bg-white);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 6px 25px var(--box-shadow-color);
  transition: background-color 0.5s, border-color 0.5s, box-shadow 0.5s;
}

.card + .card { margin-top: 16px; }

.card-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.card-title {
  margin: 0;
  color: var(--primary-color);
  font-size: 18px;
  transition: color 0.5s;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 16px;
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
}

.row.left { justify-content: flex-start; }

.filters {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
}

.search, .select {
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-white);
  color: var(--text-color);
  outline: none;
  transition: background-color 0.5s, color 0.5s, border-color 0.5s;
}

.search { flex: 1; min-width: 220px; }
.select { min-width: 160px; }

.form-grid {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 10px 12px;
  align-items: center;
  margin-top: 14px;
}

label { font-weight: 700; }

input, textarea, select {
  width: 100%;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 10px 12px;
  background: var(--bg-white);
  color: var(--text-color);
  outline: none;
  transition: background-color 0.5s, color 0.5s, border-color 0.5s;
}

textarea { resize: vertical; }

body.dark-mode input,
body.dark-mode textarea,
body.dark-mode select,
body.dark-mode .search,
body.dark-mode .select {
  background: #1f1f1f;
}

.list {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.item {
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 14px;
  background: var(--bg-light);
  transition: background-color 0.5s, border-color 0.5s;
}

.item-head {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.item-title {
  margin: 0;
  color: var(--primary-color);
  font-size: 16px;
  transition: color 0.5s;
}

.muted {
  opacity: 0.8;
}

.mini {
  font-size: 12px;
}

.actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.btn {
  border: none;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 800;
  transition: background-color 0.3s, color 0.3s, transform 0.2s;
}

.btn:hover { transform: translateY(-2px); }

.btn.primary {
  background: var(--secondary-color);
  color: var(--bg-white);
}

.btn.primary:hover {
  background: var(--primary-color);
}

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

.btn.secondary:hover {
  background: var(--secondary-color);
  color: var(--bg-white);
}

.msg {
  margin: 12px 0 0 0;
  font-weight: 800;
}

.msg.ok { color: var(--ok-color); }
.msg.bad { color: var(--bad-color); }
.msg.warn { color: var(--warn-color); }

.preview {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 16px;
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 12px;
  background: var(--bg-light);
}

.preview-img-wrap {
  width: 72px;
  height: 72px;
  border-radius: 12px;
  overflow: hidden;
  border: 2px solid var(--secondary-color);
  transition: border-color 0.5s;
}

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

.preview-title {
  font-weight: 900;
  color: var(--primary-color);
}

.log {
  margin: 12px 0 0 0;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border-color);
  background: var(--bg-light);
  overflow: auto;
  max-height: 220px;
  white-space: pre-wrap;
}

.kv {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 12px;
  margin-top: 14px;
  align-items: center;
}

.k {
  font-weight: 900;
  opacity: 0.8;
}

.v {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  font-size: 12px;
  opacity: 0.9;
}

@media (max-width: 980px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { position: sticky; top: 0; z-index: 5; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .main { padding: 16px; }
}

.nav-item.locked {
  opacity: 0.55;
}
.nav-item.locked:hover {
  transform: none;
  cursor: not-allowed;
}
