/* Общие стили сайта: токены, шапка, базовые блоки страниц. Подключается из header.php */
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=Inter:wght@400;500;600;700;800&display=swap');

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

:root{
  --bg:#151518;
  --panel:#1e1e25;
  --panel-2:#191920;
  --text:#efeff1;
  --muted:#868899;
  --line:#333340;
  --accent:#f9c940;
  --green:#61d1ad;
  --violet:#9d8ff0;
  --danger:#ff8f8f;
  --shadow:0 18px 40px rgba(0,0,0,.24);
  --header-h:60px;
}

body{
  margin:0;
  background:var(--bg);
  color:var(--text);
  font-family:var(--sans);
}
body.nav-open{
  overflow:hidden;
}

.site-header{
  position:sticky;
  top:0;
  z-index:1000;
  background:rgba(21,21,24,.94);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--line);
  font-family:var(--sans);
}

.site-header .wrap{
  width:min(1280px, calc(100vw - 24px));
  margin:0 auto;
  height:var(--header-h);
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:20px;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
  color:var(--text);
  text-decoration:none;
  font-family:var(--mono);
  font-size:14px;
}

.brand-mark{
  width:30px;
  height:30px;
  border-radius:6px;
  border:1px solid var(--line);
  background:#151518;
  overflow:hidden;
  display:flex;
  align-items:center;
  justify-content:center;
  flex:0 0 auto;
}

.brand-mark img{
  width:100%;
  height:100%;
  object-fit:cover;
  display:block;
}

.nav{
  display:flex;
  align-items:center;
  gap:18px;
}

.nav a, .nav button,
.auth-area a, .auth-area button{
  appearance:none;
  border:none;
  background:transparent;
  color:var(--muted);
  margin:0;
  padding:0;
  font-family:inherit;
  font-weight:500;
  font-size:13px;
  line-height:20px;
  cursor:pointer;
  text-decoration:none;
  transition:color .18s ease;
  white-space:nowrap;
}

.nav-link,
.nav-btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:20px;
  vertical-align:middle;
}

.nav a:hover, .nav button:hover,
.auth-area a:hover, .auth-area button:hover,
.nav a.active, .nav button.active{
  color:var(--accent);
}

.nav-link.active, .nav-btn.active{
  position:relative;
}

.nav-link.active::after, .nav-btn.active::after{
  content:"";
  position:absolute;
  left:0;
  right:0;
  bottom:-8px;
  height:2px;
  background:var(--accent);
}

.auth-area{
  display:flex;
  align-items:center;
  gap:12px;
}

.auth-user{
  color:var(--text);
  font-size:12px;
  padding:6px 10px;
  border:1px solid var(--line);
  border-radius:999px;
  background:var(--panel);
}

.auth-action{
  background:var(--panel) !important;
  border:1px solid var(--line) !important;
  border-radius:8px;
  padding:7px 14px !important;
  color:var(--text) !important;
}

.auth-action:hover{ background:#252532 !important; }

.burger{
  display:none;
  width:38px;
  height:38px;
  border:1px solid var(--line) !important;
  border-radius:10px;
  background:var(--panel) !important;
  align-items:center;
  justify-content:center;
}

.burger-lines{ width:18px; height:12px; position:relative; }
.burger-lines span{
  position:absolute;
  left:0;
  right:0;
  height:2px;
  border-radius:2px;
  background:var(--text);
}
.burger-lines span:nth-child(1){ top:0; }
.burger-lines span:nth-child(2){ top:5px; }
.burger-lines span:nth-child(3){ top:10px; }

.dd{ position:relative; }

.dd-panel{
  display:none;
  position:absolute;
  top:calc(100% + 6px);
  left:0;
  min-width:330px;
  background:#1b1b22;
  border:1px solid #333340;
  border-radius:10px;
  box-shadow:0 20px 34px rgba(0,0,0,.34);
  padding:10px 12px;
}

.dd-panel.open{
  display:block;
  animation:ddIn .16s ease both;
}
.dd-panel.closing{
  display:block;
  pointer-events:none;
  animation:ddOut .18s ease both;
}

@keyframes ddIn{
  from{ opacity:0; transform:translateY(-4px) scale(.985); }
  to{ opacity:1; transform:translateY(0) scale(1); }
}
@keyframes ddOut{
  from{ opacity:1; transform:translateY(0) scale(1); }
  to{ opacity:0; transform:translateY(-3px) scale(.992); }
}

.menu-root,
.dd-list,
.dd-group-list{
  list-style:none;
  margin:0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:0;
}

.menu-root a,
.dd-list a,
.dd-group-list a{
  display:block;
  padding:8px 0;
  border-bottom:1px solid #2a2a34;
  color:var(--text);
  text-decoration:none;
  font-size:13px;
  line-height:1.25;
  font-family:inherit;
  font-weight:500;
  transition:color .14s ease;
}
.menu-root li:last-child a,
.dd-list li:last-child a,
.dd-group-list li:last-child a{
  border-bottom:none;
}

.menu-root a:hover,
.dd-list a:hover,
.dd-group-list a:hover{
  color:var(--accent);
}

.dd-group + .dd-group{
  margin-top:10px;
  padding-top:10px;
  border-top:1px solid #2a2a34;
}
.dd-group-title{
  margin:0 0 4px;
  color:var(--green);
  font-size:11px;
  font-family:var(--mono);
  text-transform:uppercase;
  letter-spacing:.04em;
}

.auth-modal{ position:fixed; inset:0; display:none; z-index:2000; }
.auth-modal.open{ display:block; }
.auth-backdrop{ position:absolute; inset:0; background:rgba(0,0,0,.55); }
.auth-box{
  position:relative;
  width:min(430px, calc(100vw - 24px));
  margin:80px auto 0;
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:16px;
  box-shadow:var(--shadow);
  padding:16px;
}
.auth-close{
  position:absolute;
  top:10px;
  right:10px;
  width:32px;
  height:32px;
  border:none;
  background:transparent;
  color:var(--muted);
  cursor:pointer;
  font-size:20px;
}
.auth-tabs{ display:flex; gap:8px; margin-bottom:12px; }
.auth-tab{
  border:1px solid var(--line);
  background:var(--panel-2);
  border-radius:10px;
  padding:8px 12px;
  color:var(--text);
  cursor:pointer;
}
.auth-tab.active{
  background:rgba(249,201,64,.08);
  border-color:rgba(249,201,64,.28);
  color:var(--accent);
}
.auth-row{ margin-top:10px; }
.auth-row label{ display:block; font-size:13px; color:var(--muted); }
.auth-row input{
  width:100%;
  margin-top:6px;
  border:1px solid var(--line);
  border-radius:10px;
  padding:10px 12px;
  background:#151518;
  color:var(--text);
  outline:none;
  font:inherit;
}
.auth-actions{ display:flex; gap:10px; margin-top:12px; }
.auth-btn{
  border:1px solid var(--line);
  background:var(--panel-2);
  border-radius:10px;
  padding:10px 14px;
  color:var(--text);
  cursor:pointer;
}
.auth-btn.primary{
  background:var(--accent);
  color:#151518;
  border-color:transparent;
  font-weight:700;
}
.auth-err{ margin-top:10px; color:var(--danger); font-size:13px; }

@media (max-width: 900px){
  :root{
    --header-h:56px;
  }
  .site-header .wrap{
    width:calc(100vw - 24px);
    gap:10px;
  }
  .nav{
    position:fixed;
    left:12px;
    right:12px;
    top:calc(var(--header-h) + 8px);
    z-index:999;
    display:none;
    flex-direction:column;
    align-items:stretch;
    gap:10px;
    padding:12px;
    border:1px solid var(--line);
    border-radius:14px;
    background:rgba(21,21,24,.98);
    box-shadow:var(--shadow);
    max-height:calc(100vh - var(--header-h) - 20px);
    overflow:auto;
  }
  .nav.open{ display:flex; }
  .nav-link,
  .nav-btn{
    justify-content:flex-start;
    min-height:38px;
  }
  .nav-link.active::after, .nav-btn.active::after{
    bottom:4px;
    left:0;
    right:auto;
    width:36px;
  }
  .dd{ width:100%; }
  .dd-panel{
    position:static;
    width:100%;
    min-width:0;
    margin-top:6px;
  }
  .menu-root a,
  .dd-list a,
  .dd-group-list a{
    padding:11px 0;
  }
  .auth-area{ gap:8px; }
  .auth-user{ display:none; }
  .auth-action{
    padding:6px 9px !important;
    max-width:92px;
    overflow:hidden;
    text-overflow:ellipsis;
  }
  .burger{
    display:flex;
    flex:0 0 auto;
  }
}

@media (max-width: 520px){
  .brand-text{ display:none; }
  .site-header .wrap{
    width:calc(100vw - 16px);
  }
  .auth-action{
    max-width:74px;
    font-size:11px;
    padding:6px 7px !important;
  }
  .nav{
    left:8px;
    right:8px;
  }
}

:root{
  --text-2:#a4a8bb;
  --sans:Inter,system-ui,-apple-system,"Segoe UI",Roboto,Arial,sans-serif;
  --mono:'Space Mono',ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;
}

/* ===== Общие блоки страниц =====
   Каркас: <main class="page"><div class="page-wrap">…</div></main>
   Шапка:  .page-label (// раздел), .page-title, .page-sub
   Блоки:  .panel, .field (label + input), .btn, .data-table, .form-error */

.page{
  min-height:calc(100vh - var(--header-h));
  background:var(--bg);
  color:var(--text);
  padding:28px 0 40px;
}
.page-wrap{
  width:min(1080px, calc(100vw - 24px));
  margin:0 auto;
}
.page-wrap--narrow{ width:min(980px, calc(100vw - 24px)); }

.page-label{
  font-family:var(--mono);
  font-size:11px;
  color:var(--green);
  margin-bottom:6px;
}
.page-title{
  margin:0 0 10px;
  font-size:30px;
  line-height:1.2;
}
.page-sub{
  margin:0 0 20px;
  color:var(--text-2);
  font-size:14px;
  line-height:1.6;
  max-width:820px;
}

.panel{
  background:var(--panel);
  border:1px solid var(--line);
  border-radius:12px;
  padding:16px;
}

.field label{
  display:block;
  margin-bottom:7px;
  font-size:13px;
  color:#c5c8d6;
  font-weight:600;
}
.field input,
.field select,
.field textarea{
  width:100%;
  box-sizing:border-box;
  background:var(--bg);
  border:1px solid var(--line);
  border-radius:8px;
  padding:10px 12px;
  color:var(--text);
  font:inherit;
  font-size:14px;
  outline:none;
}
.field input:focus,
.field select:focus,
.field textarea:focus{
  border-color:var(--green);
  box-shadow:0 0 0 3px rgba(97,209,173,.15);
}

.btn{
  border:1px solid var(--line);
  background:var(--bg);
  color:var(--text);
  border-radius:8px;
  padding:10px 14px;
  font:inherit;
  font-size:14px;
  font-weight:600;
  cursor:pointer;
  transition:border-color .16s ease, color .16s ease;
}
.btn:hover{
  border-color:var(--accent);
  color:var(--accent);
}

.data-table{
  width:100%;
  border-collapse:collapse;
}
.data-table th,
.data-table td{
  border-bottom:1px solid #2b2b36;
  padding:9px 8px;
  text-align:left;
  font-size:13px;
  vertical-align:top;
}
.data-table th{
  color:var(--green);
  font-family:var(--mono);
  font-size:11px;
  text-transform:uppercase;
  letter-spacing:.04em;
}
.data-table tr:last-child td{ border-bottom:none; }

.form-error{
  margin:0;
  color:var(--danger);
  font-size:13px;
}

@media (max-width: 900px){
  .page-wrap, .page-wrap--narrow{ width:calc(100vw - 20px); }
  .page-title{ font-size:26px; }
  .page-sub{ font-size:13px; }
  .panel{ padding:14px; }
}
