/* Admin panel - zed.dev inspired, minimal & high-end */

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: #0a0a0e;
  color: #e6e7ec;
  font-family: 'Inter', 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  font-size: 15px;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

a { color: inherit; text-decoration: none; }
.muted { color: #7b8090; }
.right { text-align: right; }
.center { text-align: center; }
.inline { display: inline; }

/* ---------- Layout ---------- */
body.admin {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px 20px;
  border-right: 1px solid rgba(255,255,255,0.06);
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0) 60%);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 4px 18px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.brand-name {
  font-weight: 600;
  letter-spacing: -0.01em;
}
.brand-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: linear-gradient(135deg, #9ab7ff 0%, #c89cff 50%, #ff9ac8 100%);
  box-shadow: 0 0 16px rgba(170, 150, 255, 0.5);
}
.nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 6px;
}
.nav a {
  padding: 9px 12px;
  border-radius: 8px;
  color: #b9bdc9;
  font-size: 0.95rem;
  transition: background 160ms ease, color 160ms ease;
}
.nav a:hover { background: rgba(255,255,255,0.03); color: #fff; }
.nav a.on {
  background: rgba(160, 185, 255, 0.08);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(160, 185, 255, 0.18);
}
.logout {
  margin-top: auto;
}
.logout button {
  width: 100%;
  padding: 9px 10px;
  background: transparent;
  border: 1px solid rgba(255,255,255,0.08);
  color: #b9bdc9;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  transition: border-color 160ms ease, color 160ms ease;
}
.logout button:hover { color: #fff; border-color: rgba(255, 160, 160, 0.4); }
.to-home {
  margin-top: 6px;
  color: #7b8090;
  font-size: 0.85rem;
  text-align: center;
}
.to-home:hover { color: #9ab7ff; }

.content {
  padding: 48px 56px 80px;
  max-width: 1100px;
  width: 100%;
}

/* ---------- Page head ---------- */
.page-head {
  margin-bottom: 28px;
}
.page-head h1 {
  font-size: 1.8rem;
  margin: 0;
  font-weight: 600;
  letter-spacing: -0.01em;
}
.page-head p { margin: 8px 0 0; }
.row-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px; }
.row-actions { display: flex; gap: 10px; align-items: center; }

/* ---------- Alerts ---------- */
.alert {
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 18px;
  font-size: 0.92rem;
  border: 1px solid transparent;
}
.alert-ok { background: rgba(120, 220, 160, 0.08); border-color: rgba(120, 220, 160, 0.2); color: #b6f0c9; }
.alert-err { background: rgba(255, 120, 120, 0.08); border-color: rgba(255, 120, 120, 0.22); color: #ffc9c9; }
.alert-muted { background: rgba(255,255,255,0.03); border-color: rgba(255,255,255,0.08); color: #9aa0ad; }

/* ---------- Stats ---------- */
.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 36px;
}
.stat {
  padding: 18px 20px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0.005));
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.stat-label { color: #7b8090; font-size: 0.82rem; letter-spacing: 0.06em; text-transform: uppercase; }
.stat-value { font-size: 1.7rem; font-weight: 600; letter-spacing: -0.01em; }
.stat-value em { font-style: normal; color: #4c5060; font-size: 0.95rem; font-weight: 500; }

/* ---------- Quick cards ---------- */
.quick h2 { font-size: 1.05rem; font-weight: 500; color: #aab0bd; margin: 0 0 14px; }
.quick-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.quick-card {
  padding: 16px 18px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.06);
  background: rgba(255,255,255,0.02);
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease, color 160ms ease;
}
.quick-card:hover {
  border-color: rgba(160, 185, 255, 0.35);
  background: rgba(160, 185, 255, 0.05);
  color: #fff;
  transform: translateY(-1px);
}

/* ---------- Forms ---------- */
.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
  max-width: 620px;
}
.card-form {
  padding: 24px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0.005));
}
.form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: #aab0bd; }
.form input[type="text"], .form input[type="password"], .form input[type="url"], .form input[type="number"], .form textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  color: #e6e7ec;
  border-radius: 9px;
  font: inherit;
  transition: border-color 140ms ease, background 140ms ease;
}
.form input:focus, .form textarea:focus {
  outline: none;
  border-color: rgba(160, 185, 255, 0.45);
  background: rgba(160, 185, 255, 0.04);
}
.form textarea { resize: vertical; font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace; font-size: 0.9rem; }
.form small { color: #6a6f7c; font-size: 0.82rem; }
.color-row { display: flex; gap: 10px; align-items: center; }
.color-row input[type="color"] { width: 46px; height: 40px; padding: 2px; border: 1px solid rgba(255,255,255,0.08); border-radius: 8px; background: rgba(255,255,255,0.02); }
.color-row input[type="text"] { flex: 1; font-family: 'JetBrains Mono', monospace; }

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

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 9px;
  border: 1px solid transparent;
  font: inherit;
  font-size: 0.92rem;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
  text-decoration: none;
}
.btn.sm { padding: 6px 10px; font-size: 0.82rem; }
.btn.primary {
  background: linear-gradient(180deg, #8aa8ff, #6f8aff);
  color: #10131a;
  border-color: rgba(160, 185, 255, 0.4);
  font-weight: 600;
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: 0 8px 24px -12px rgba(120, 150, 255, 0.6); }
.btn.ghost {
  background: rgba(255,255,255,0.02);
  color: #c8ccd5;
  border-color: rgba(255,255,255,0.1);
}
.btn.ghost:hover { border-color: rgba(160, 185, 255, 0.4); color: #fff; }
.btn.danger {
  background: rgba(255, 120, 120, 0.08);
  color: #ffb6b6;
  border-color: rgba(255, 120, 120, 0.28);
}
.btn.danger:hover { background: rgba(255, 120, 120, 0.16); color: #fff; }

/* ---------- Table ---------- */
.area-section {
  margin: 26px 0 40px;
  padding: 22px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0.005));
}
.area-section-head h2 { font-size: 1.1rem; margin: 0 0 14px; font-weight: 600; }
.row-form {
  display: grid;
  grid-template-columns: 1fr 2fr auto;
  gap: 10px;
  margin-bottom: 14px;
}
.row-form input {
  padding: 9px 12px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  color: #e6e7ec;
  border-radius: 9px;
  font: inherit;
}
.row-form input:focus { outline: none; border-color: rgba(160, 185, 255, 0.45); }

.table {
  width: 100%;
  border-collapse: collapse;
  border-spacing: 0;
}
.table th, .table td {
  padding: 10px 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  font-size: 0.9rem;
  vertical-align: middle;
}
.table th { color: #7b8090; font-weight: 500; text-align: left; letter-spacing: 0.03em; }
.table tr:last-child td { border-bottom: none; }
.row-edit { display: grid; grid-template-columns: 1fr 2fr auto; gap: 8px; align-items: center; }
.row-edit input {
  width: 100%;
  padding: 7px 10px;
  border: 1px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.02);
  color: #e6e7ec;
  border-radius: 7px;
  font: inherit;
}
.row-edit input:focus { outline: none; border-color: rgba(160, 185, 255, 0.45); }

/* ---------- Memo ---------- */
.memo-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.memo-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  background: rgba(255,255,255,0.02);
  transition: border-color 140ms ease, background 140ms ease;
}
.memo-item:hover { border-color: rgba(160, 185, 255, 0.35); background: rgba(160, 185, 255, 0.04); }
.memo-title { font-weight: 500; }
.memo-meta { color: #7b8090; font-size: 0.82rem; font-variant-numeric: tabular-nums; }

.memo-view {
  padding: 28px 32px;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,0.015), rgba(255,255,255,0.005));
  line-height: 1.75;
  font-size: 1rem;
  color: #d7d9e0;
}
.memo-view .code {
  background: #05060a;
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: 10px;
  padding: 14px 16px;
  overflow: auto;
  font-family: 'JetBrains Mono', 'Menlo', 'Consolas', monospace;
  font-size: 0.88rem;
  color: #cfd2dd;
  margin: 12px 0;
}

.empty {
  padding: 48px;
  border: 1px dashed rgba(255,255,255,0.08);
  border-radius: 14px;
  text-align: center;
  color: #7b8090;
  display: flex;
  flex-direction: column;
  gap: 14px;
  align-items: center;
}

/* ---------- Login ---------- */
body.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  background:
    radial-gradient(900px 500px at 20% -10%, rgba(120, 160, 255, 0.1), transparent 60%),
    radial-gradient(800px 500px at 90% 110%, rgba(255, 120, 180, 0.07), transparent 60%),
    #0a0a0e;
}
.login-wrap { width: 100%; max-width: 420px; }
.login-card {
  padding: 36px 32px;
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  backdrop-filter: blur(20px);
}
.login-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #aab0bd;
  font-weight: 600;
  margin-bottom: 8px;
}
.login-card h1 { font-size: 1.6rem; margin: 6px 0 4px; letter-spacing: -0.01em; }
.login-card .muted { margin: 0 0 22px; }
.login-card .form { max-width: none; }
.login-card .btn.primary { width: 100%; padding: 12px 16px; }
.login-foot { margin: 18px 0 0; text-align: center; font-size: 0.85rem; color: #7b8090; }
.login-foot a:hover { color: #9ab7ff; }

/* ---------- Responsive admin ---------- */
@media (max-width: 900px) {
  body.admin { grid-template-columns: 1fr; }
  .sidebar {
    position: static;
    height: auto;
    flex-direction: row;
    flex-wrap: wrap;
    align-items: center;
    padding: 14px 16px;
  }
  .sidebar .brand { border-bottom: none; padding: 0 6px 0 0; margin-right: 6px; }
  .sidebar .nav { flex-direction: row; flex-wrap: wrap; flex: 1; margin: 0; }
  .sidebar .logout { margin-top: 0; width: auto; }
  .sidebar .logout button { width: auto; padding: 8px 12px; }
  .sidebar .to-home { display: none; }
  .content { padding: 24px 20px 60px; }
  .stats { grid-template-columns: repeat(2, 1fr); }
  .row-form, .row-edit { grid-template-columns: 1fr; }
}
