/* =====================================================================
   Lunev Space — панель (админка + личный кабинет)
   Эстетика: центр управления полётами. Глубокий космос, тёплый янтарь.
   ===================================================================== */

:root {
  --void:        #05070f;
  --deep:        #0a0e1c;
  --panel:       #101528;
  --panel-2:     #151b32;
  --line:        #232b47;
  --line-soft:   #1a2038;
  --ink:         #e8ecf7;
  --ink-dim:     #98a2c0;
  --ink-faint:   #5f6a8c;
  --amber:       #ffb648;
  --amber-deep:  #e8892a;
  --sky:         #58b6ff;
  --mint:        #4fd6a0;
  --rose:        #ff6b7a;
  --violet:      #a98bff;
  --radius:      14px;
  --radius-sm:   9px;
  --shadow:      0 24px 60px -28px rgba(0,0,0,.8);
  --mono:        'JetBrains Mono', 'SFMono-Regular', ui-monospace, 'Consolas', monospace;
  --sans:        'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

body {
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 82% -10%, rgba(255,182,72,.06), transparent 60%),
    radial-gradient(900px 500px at 8% 8%, rgba(88,182,255,.05), transparent 55%),
    var(--void);
}

a { color: var(--sky); text-decoration: none; }
a:hover { color: #8fceff; }

h1, h2, h3 { margin: 0 0 .4em; font-weight: 650; letter-spacing: -.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.15rem; }

.mono { font-family: var(--mono); }
.dim  { color: var(--ink-dim); }
.faint{ color: var(--ink-faint); }

/* --- Каркас с сайдбаром ---------------------------------------------- */
.shell { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

.sidebar {
  background: linear-gradient(180deg, var(--deep), var(--void));
  border-right: 1px solid var(--line);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  display: flex; align-items: center; gap: 11px;
  padding: 4px 8px 20px;
  border-bottom: 1px solid var(--line-soft);
  margin-bottom: 16px;
}
.brand .mark {
  width: 38px; height: 38px; flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  background: radial-gradient(circle at 32% 30%, #ffd98a, var(--amber-deep) 62%, #8a4a12);
  box-shadow: 0 0 22px -4px rgba(255,182,72,.6);
  font-size: 20px;
}
.brand .title { font-weight: 700; font-size: 1.02rem; line-height: 1.1; }
.brand .subtitle { font-size: .72rem; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .14em; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-label {
  font-size: .68rem; text-transform: uppercase; letter-spacing: .16em;
  color: var(--ink-faint); padding: 14px 10px 6px;
}
.nav a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 11px; border-radius: var(--radius-sm);
  color: var(--ink-dim); font-weight: 500; font-size: .92rem;
  transition: background .15s, color .15s;
}
.nav a .ic { width: 18px; text-align: center; opacity: .85; }
.nav a .count {
  margin-left: auto; font-family: var(--mono); font-size: .74rem;
  background: var(--panel-2); color: var(--ink-dim);
  padding: 1px 7px; border-radius: 20px;
}
.nav a:hover { background: var(--panel); color: var(--ink); }
.nav a.active {
  background: linear-gradient(90deg, rgba(255,182,72,.14), rgba(255,182,72,.03));
  color: var(--ink);
  box-shadow: inset 2px 0 0 var(--amber);
}
.nav a.active .ic { opacity: 1; }

.sidebar-foot {
  border-top: 1px solid var(--line-soft);
  padding-top: 14px; margin-top: 10px;
  display: flex; align-items: center; gap: 10px;
}
.sidebar-foot .who { min-width: 0; }
.sidebar-foot .who b { display: block; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot .who span { font-size: .72rem; color: var(--ink-faint); }
.avatar {
  width: 34px; height: 34px; flex: none; border-radius: 50%;
  background: linear-gradient(135deg, var(--violet), var(--sky));
  display: grid; place-items: center; font-weight: 700; color: #fff; font-size: .9rem;
}

/* --- Основная область ------------------------------------------------ */
.main { padding: 26px 30px 60px; min-width: 0; }
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 22px; flex-wrap: wrap;
}
.page-head .eyebrow {
  font-size: .7rem; text-transform: uppercase; letter-spacing: .18em;
  color: var(--amber); margin-bottom: 4px;
}
.page-head p.sub { color: var(--ink-dim); margin: 2px 0 0; font-size: .92rem; }

/* --- Карточки статистики --------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 14px; margin-bottom: 26px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 16px 18px;
  position: relative; overflow: hidden;
}
.stat::after {
  content:''; position:absolute; right:-30px; top:-30px;
  width:100px; height:100px; border-radius:50%;
  background: radial-gradient(circle, rgba(255,182,72,.1), transparent 70%);
}
.stat .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .12em; color: var(--ink-faint); }
.stat .v { font-family: var(--mono); font-size: 1.9rem; font-weight: 600; margin-top: 6px; line-height: 1; }
.stat .v.amber { color: var(--amber); }
.stat .v.sky   { color: var(--sky); }
.stat .v.mint  { color: var(--mint); }
.stat .v.rose  { color: var(--rose); }

/* --- Панель / таблица ------------------------------------------------ */
.card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
  overflow: hidden; margin-bottom: 22px;
}
.card-head {
  padding: 15px 20px; border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.card-head h2 { margin: 0; font-size: 1rem; }
.card-body { padding: 20px; }

table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .1em;
  color: var(--ink-faint); font-weight: 600; padding: 12px 20px; border-bottom: 1px solid var(--line);
}
td { padding: 13px 20px; border-bottom: 1px solid var(--line-soft); font-size: .9rem; }
tr:last-child td { border-bottom: none; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(255,255,255,.02); }

/* --- Значки ролей/статусов ------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: .72rem; font-weight: 600; padding: 3px 9px; border-radius: 20px;
  font-family: var(--mono); letter-spacing: .02em;
}
.badge::before { content:''; width:6px; height:6px; border-radius:50%; background: currentColor; }
.badge.role-admin     { color: var(--amber); background: rgba(255,182,72,.12); }
.badge.role-moderator { color: var(--violet); background: rgba(169,139,255,.12); }
.badge.role-user      { color: var(--ink-dim); background: rgba(152,162,192,.1); }
.badge.st-active  { color: var(--mint); background: rgba(79,214,160,.12); }
.badge.st-pending { color: var(--sky); background: rgba(88,182,255,.12); }
.badge.st-banned  { color: var(--rose); background: rgba(255,107,122,.12); }
.badge.pub-yes { color: var(--mint); background: rgba(79,214,160,.12); }
.badge.pub-no  { color: var(--ink-faint); background: rgba(95,106,140,.12); }

/* --- Кнопки ---------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; justify-content: center;
  font-family: var(--sans); font-size: .88rem; font-weight: 600;
  padding: 9px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  cursor: pointer; transition: all .15s; text-decoration: none;
}
.btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.btn.primary {
  background: linear-gradient(135deg, var(--amber), var(--amber-deep));
  border-color: transparent; color: #241300;
  box-shadow: 0 8px 22px -10px rgba(255,182,72,.7);
}
.btn.primary:hover { filter: brightness(1.06); color: #241300; }
.btn.danger { color: var(--rose); border-color: rgba(255,107,122,.3); }
.btn.danger:hover { background: rgba(255,107,122,.1); }
.btn.sm { padding: 6px 11px; font-size: .8rem; }
.btn.ghost { background: transparent; }

.btn-row { display: flex; gap: 10px; flex-wrap: wrap; }

/* --- Формы ----------------------------------------------------------- */
.field { margin-bottom: 16px; }
.field label { display: block; font-size: .82rem; font-weight: 600; color: var(--ink-dim); margin-bottom: 6px; }
.field .hint { font-size: .76rem; color: var(--ink-faint); margin-top: 5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=search], input[type=url], input[type=datetime-local], input[type=date], input[type=time],
.field input:not([type]), select, textarea {
  width: 100%; background: var(--void); border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 10px 13px; color: var(--ink);
  font-family: var(--sans); font-size: .92rem; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(255,182,72,.14);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }
select { appearance: none; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2398a2c0' d='M1 1l5 5 5-5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 13px center; padding-right: 34px;
}
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px,1fr)); gap: 16px; }

.field label.switch, .switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; user-select: none; margin-bottom: 0; color: var(--ink); }
.switch input { position: absolute; opacity: 0; width: 0; height: 0; }
.switch .track {
  width: 42px; height: 24px; border-radius: 20px; background: var(--line);
  position: relative; transition: background .2s; flex: none;
}
.switch .track::after {
  content:''; position:absolute; top:3px; left:3px; width:18px; height:18px;
  border-radius:50%; background:#fff; transition: transform .2s;
}
.switch input:checked + .track { background: var(--amber); }
.switch input:checked + .track::after { transform: translateX(18px); }

/* --- Flash-сообщения ------------------------------------------------- */
.flash { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 18px; font-size: .9rem; border: 1px solid transparent; }
.flash.success { background: rgba(79,214,160,.1); border-color: rgba(79,214,160,.3); color: #9df0cd; }
.flash.error   { background: rgba(255,107,122,.1); border-color: rgba(255,107,122,.3); color: #ffb3bc; }

/* --- Панель фильтров ------------------------------------------------- */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 18px; }
.toolbar form { display: flex; gap: 10px; flex-wrap: wrap; flex: 1; }
.toolbar input[type=search] { max-width: 320px; }
.toolbar select { max-width: 180px; }

/* --- Пагинация ------------------------------------------------------- */
.pager { display: flex; gap: 6px; margin-top: 18px; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 36px; text-align: center; padding: 7px 10px; border-radius: var(--radius-sm);
  font-family: var(--mono); font-size: .82rem; border: 1px solid var(--line); color: var(--ink-dim);
}
.pager a:hover { border-color: var(--ink-faint); color: var(--ink); }
.pager .current { background: var(--amber); color: #241300; border-color: transparent; font-weight: 600; }

/* --- Журнал ---------------------------------------------------------- */
.log-line { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); font-size: .86rem; }
.log-line:last-child { border-bottom: none; }
.log-line .when { font-family: var(--mono); color: var(--ink-faint); font-size: .78rem; white-space: nowrap; }
.log-line .act { font-family: var(--mono); color: var(--sky); }

/* --- Пусто ----------------------------------------------------------- */
.empty { text-align: center; padding: 50px 20px; color: var(--ink-faint); }
.empty .big { font-size: 2.4rem; margin-bottom: 10px; opacity: .5; }

/* --- Адаптив --------------------------------------------------------- */
.menu-toggle { display: none; }
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; z-index: 60; width: 264px; left: 0; top: 0;
    transform: translateX(-100%); transition: transform .25s;
  }
  .sidebar.open { transform: translateX(0); }
  .menu-toggle {
    display: inline-flex; position: fixed; top: 14px; left: 14px; z-index: 70;
    width: 42px; height: 42px; border-radius: 11px; align-items: center; justify-content: center;
    background: var(--panel); border: 1px solid var(--line); color: var(--ink); font-size: 20px; cursor: pointer;
  }
  .main { padding: 66px 16px 50px; }
  .scrim { position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 55; }
}

/* --- Мелочи ---------------------------------------------------------- */
.right { text-align: right; }
.nowrap { white-space: nowrap; }
.spacer { flex: 1; }
.divider { height: 1px; background: var(--line-soft); margin: 22px 0; border: none; }

/* --- Миграции ------------------------------------------------------- */
.migration-stats { margin-bottom: 18px; }
.card-head { display:flex; align-items:center; justify-content:space-between; gap:16px; padding:18px 20px; border-bottom:1px solid var(--line); }
.card-head h2 { margin:0 0 4px; font-size:1rem; }
.card-head .hint { margin:0; }
.btn:disabled { opacity:.48; cursor:not-allowed; pointer-events:none; }
code { font-family:var(--mono); font-size:.82rem; }
@media (max-width: 700px) { .card-head { align-items:stretch; flex-direction:column; } .card-head form, .card-head .btn { width:100%; } }
.page-content{max-width:900px;margin:0 auto}.prose{line-height:1.75}.prose img{max-width:100%;height:auto}.prose h2,.prose h3{margin-top:1.6em}.prose p{margin:.9em 0}

/* Медиа и каталог объектов */
.media-editor{display:grid;grid-template-columns:minmax(240px,360px) 1fr;gap:20px;align-items:center;margin-bottom:18px}.media-preview{aspect-ratio:2/1;border:1px dashed var(--line);border-radius:var(--radius-sm);overflow:hidden;background:var(--void);display:grid;place-items:center}.media-preview img{width:100%;height:100%;object-fit:cover}.media-placeholder{color:var(--ink-faint);font-size:.82rem;text-align:center;padding:20px}.media-upload{margin:0}.ship-preview{aspect-ratio:16/10}.check-line{display:flex!important;align-items:center;gap:8px;margin-top:10px!important;font-weight:500!important}.object-cell{display:flex;align-items:center;gap:12px}.thumb{width:54px;height:38px;border-radius:8px;object-fit:cover;background:var(--void);display:grid;place-items:center}.thumb.placeholder{font-size:20px}.table-scroll{overflow:auto}input[type=file]{width:100%;padding:10px;background:var(--void);border:1px solid var(--line);border-radius:var(--radius-sm);color:var(--ink-dim)}@media(max-width:760px){.media-editor{grid-template-columns:1fr}}

.grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px}.security-list{display:grid;gap:10px}.security-item{display:flex;align-items:center;justify-content:space-between;gap:12px;padding:12px;border:1px solid var(--line-soft);border-radius:var(--radius-sm)}@media(max-width:760px){.grid-2{grid-template-columns:1fr}}

/* Просмотр защищённого PHP-журнала */
.error-log-view{margin:0;max-height:68vh;overflow:auto;white-space:pre-wrap;word-break:break-word;background:#050814;border:1px solid var(--border,#202943);border-radius:12px;padding:16px;font:12px/1.65 "JetBrains Mono",monospace;color:#d9e2ff}
