:root {
  --bg: #14171c;
  --panel: #1c2028;
  --panel-alt: #232833;
  --border: #2e3440;
  --text: #e6e9ef;
  --text-dim: #9aa3b2;
  --accent: #4f8cff;
  --accent-hover: #6ba0ff;
  --danger: #ff5c6c;
  --success: #3ddc84;
  --radius: 10px;
}

* { box-sizing: border-box; }

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

.hidden { display: none !important; }

.screen { min-height: 100vh; }

/* ── Логин ── */
#login-screen {
  display: flex;
  align-items: center;
  justify-content: center;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px;
  width: 320px;
}
.card h1 { margin-top: 0; font-size: 20px; }

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  margin-bottom: 10px;
  background: var(--panel-alt);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
textarea { min-height: 70px; resize: vertical; }

button {
  width: 100%;
  padding: 10px 12px;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  margin-bottom: 8px;
}
button:hover { background: var(--accent-hover); }
button.secondary {
  width: auto;
  background: var(--panel-alt);
  border: 1px solid var(--border);
}
button.danger { background: var(--danger); }

.error { color: var(--danger); font-size: 13px; min-height: 18px; }

/* ── Основной экран ── */
header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 24px;
  border-bottom: 1px solid var(--border);
}
header h1 { font-size: 18px; margin: 0; }
.header-right { display: flex; align-items: center; gap: 12px; }
#user-email { color: var(--text-dim); font-size: 13px; }

.layout {
  display: grid;
  grid-template-columns: 220px 1fr 320px;
  gap: 0;
  min-height: calc(100vh - 60px);
}

aside, main {
  padding: 16px;
  border-right: 1px solid var(--border);
  overflow-y: auto;
}
main { border-right: 1px solid var(--border); }
#admin-panel { border-right: none; }

.panel-header { margin-bottom: 12px; }
.panel-header h2 { font-size: 14px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-dim); margin: 0; }

ul { list-style: none; padding: 0; margin: 0; }

/* ── Список марок ── */
#brands-list li {
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  margin-bottom: 4px;
  font-size: 14px;
}
#brands-list li:hover { background: var(--panel-alt); }
#brands-list li.active { background: var(--accent); color: white; }

/* ── Список ресурсов ── */
.resource-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 10px;
}
.resource-card h3 { margin: 0 0 6px 0; font-size: 15px; }
.resource-card p { margin: 0; font-size: 13px; color: var(--text-dim); }
.resource-card .badge {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--panel-alt);
  color: var(--text-dim);
  margin-bottom: 8px;
}
.resource-card .badge.program { background: #2c3a52; color: #8fb8ff; }
.resource-card .badge.locked { background: #4a2c2c; color: #ff9c9c; }
.resource-card a.open-link {
  display: inline-block;
  margin-top: 8px;
  color: var(--accent);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}

/* ── Админ-панель ── */
#admin-panel h3 { font-size: 13px; color: var(--text-dim); margin: 16px 0 8px; text-transform: uppercase; }
#admin-panel h3:first-of-type { margin-top: 0; }
.admin-add-user, .grant-form {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 8px;
}
#users-list li, #permissions-list li {
  font-size: 12px;
  color: var(--text-dim);
  padding: 6px 0;
  border-bottom: 1px solid var(--border);
}
#users-list li:last-child, #permissions-list li:last-child { border-bottom: none; }

.perm-row { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.perm-row button {
  width: auto;
  padding: 4px 8px;
  font-size: 11px;
  background: var(--danger);
}

#new-brand-name, #add-brand-btn { margin-top: 12px; }
#admin-add-brand, #admin-add-resource { margin-top: 20px; }
