
:root{
  --bg:#0f1115;
  --bg2:#171a20;
  --card:#1b2028;
  --card2:#232934;
  --line:#313846;
  --text:#f2f4f7;
  --muted:#aab3c2;
  --soft:#7e8898;
  --accent:#d97904;
  --accent2:#ee8a12;
  --accent3:#ffb14a;
  --chip:#14233f;
  --chiptext:#ffffff;
  --okbg:#17311d;
  --okline:#2e6b3b;
  --oktext:#d7f0dc;
  --errbg:#331b1d;
  --errline:#6d3035;
  --errtext:#ffd9dd;
  --shadow:0 12px 28px rgba(0,0,0,0.28);
  --radius:18px;
}

*{box-sizing:border-box}
html,body{margin:0;padding:0}
body{
  font-family:Inter,Arial,Helvetica,sans-serif;
  background:
    radial-gradient(circle at top left, rgba(198,40,40,0.14), transparent 28%),
    linear-gradient(180deg,#0c0e12 0%, #11141a 100%);
  color:var(--text);
  min-height:100vh;
}

a{color:#ffd8d3;text-decoration:none}
a:hover{text-decoration:underline}

.wrap{
  max-width:1360px;
  margin:0 auto;
  padding:24px 22px 50px 22px;
}

.topbar{
  display:flex;
  justify-content:flex-start;
  align-items:flex-start;
  gap:20px;
  margin-bottom:18px;
  padding:26px 28px 24px 28px;
  border:1px solid rgba(255,255,255,0.06);
  border-radius:24px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.01)),
    linear-gradient(135deg, #14181f 0%, #0f1217 100%);
  box-shadow:var(--shadow);
}

.topbarcompact{
  padding:16px 18px 14px 18px;
  align-items:flex-start;
}

.topbarflat{
  display:grid;
  grid-template-columns:minmax(0,1fr) auto;
  align-items:start;
  gap:12px 18px;
  padding:14px 18px 12px 18px;
}

h1{
  margin:0;
  font-size:34px;
  line-height:1.05;
  letter-spacing:-0.02em;
  color:#fff;
}

.subline{
  margin-top:8px;
  color:var(--muted);
  font-size:15px;
}

.herohead{
  flex:1;
  min-width:0;
}

.heroheadcompact{
  display:flex;
  flex-direction:column;
  gap:10px;
}

.heroheadflat{
  display:block;
  min-width:0;
}

.archivebar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:14px;
}

.archivebarcompact{
  gap:14px;
  margin-bottom:0;
}

.archivebarflat{
  gap:12px;
  margin-bottom:0;
}

.actionshead{
  align-self:start;
}

.archivepill{
  display:inline-flex;
  align-items:flex-start;
  justify-content:center;
  min-height:40px;
  padding:10px 16px;
  border:1px solid rgba(255,255,255,0.08);
  border-radius:999px;
  background:rgba(255,255,255,0.03);
  color:#f7f9fb;
  font-weight:700;
  text-decoration:none;
  transition:all .16s ease;
}

.archivepillbig{
  min-height:72px;
  padding:16px 26px;
  border-radius:28px;
  font-size:32px;
  line-height:1;
  letter-spacing:-0.02em;
}

.archivepillmega{
  min-height:56px;
  padding:10px 22px;
  border-radius:22px;
  font-size:28px;
  line-height:1;
  letter-spacing:-0.02em;
}

.archivepill:hover{
  background:rgba(255,255,255,0.08);
  border-color:rgba(255,255,255,0.14);
  text-decoration:none;
}

.archivepill.active{
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  border-color:rgba(255,255,255,0.06);
  color:white;
}

.microstatsgrid{
  margin-top:16px;
  display:grid;
  grid-template-columns:repeat(2,minmax(280px,1fr));
  gap:14px;
  max-width:980px;
}

.microstatsgridcompact{
  margin-top:0;
  gap:10px;
  max-width:900px;
}

.statline{
  display:flex;
  flex-wrap:wrap;
  justify-content:space-between;
  gap:10px 18px;
  width:100%;
  align-items:center;
  margin-top:0;
  padding:12px 16px;
  border-radius:16px;
  border:1px solid rgba(255,255,255,0.06);
  background:linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015)), var(--card);
  box-shadow:var(--shadow);
}

.statlinefull{
  grid-column:1 / -1;
}

.statlineitem{
  flex:1 1 calc(50% - 18px);
  min-width:0;
  color:#dbe2ec;
  font-size:16px;
  line-height:1.32;
  font-weight:500;
  white-space:normal;
}

.statlineitem strong{
  color:#ffffff;
  font-weight:700;
}

.statcardcompact{
  padding:16px 18px;
}

.statcardultracompact{
  padding:10px 14px;
  border-radius:14px;
}

.microstats{
  display:grid;
  gap:6px;
  font-size:13px;
  line-height:1.45;
  color:var(--soft);
}

.microstatscompact{
  gap:2px;
  font-size:12px;
  line-height:1.3;
}

.microstats strong{
  color:#eef2f7;
  font-weight:700;
}

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

.actions a,
.resetlink,
.exportlink,
.navbtn,
.sectiontoggle{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-height:40px;
  padding:10px 14px;
  border:1px solid rgba(255,255,255,0.08);
  border-radius:999px;
  background:rgba(255,255,255,0.03);
  color:#f7f9fb;
  font-weight:600;
  transition:all .16s ease;
  text-decoration:none;
}

.actions a:hover,
.resetlink:hover,
.exportlink:hover,
.navbtn:hover,
.sectiontoggle:hover{
  background:rgba(255,255,255,0.08);
  border-color:rgba(255,255,255,0.14);
  text-decoration:none;
}

.exportlink{
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  border-color:rgba(255,255,255,0.06);
  color:white;
}

.exportlink:hover{
  background:linear-gradient(135deg,#d43030,#f04343);
}

.exportlinkwide{
  padding-left:18px;
  padding-right:18px;
}

.userbadge{
  display:inline-flex;
  align-items:center;
  min-height:40px;
  padding:10px 14px;
  border-radius:999px;
  background:rgba(255,255,255,0.05);
  border:1px solid rgba(255,255,255,0.07);
  color:#fff;
  font-weight:700;
}

.searchpanel,
.detailmeta,
.adminbox,
.loginbox,
.result,
.statcard{
  border:1px solid rgba(255,255,255,0.06);
  border-radius:var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015)),
    var(--card);
  box-shadow:var(--shadow);
}

.searchpanel{
  margin-bottom:18px;
  padding:20px;
}

.grid{
  display:grid;
  grid-template-columns:2.3fr 1.3fr 0.8fr 0.8fr;
  gap:12px;
  margin-bottom:14px;
}

input[type="text"],
input[type="password"],
input[type="file"],
select,
button{
  font:inherit;
}

input[type="text"],
input[type="password"],
select{
  width:100%;
  min-height:48px;
  padding:12px 14px;
  border-radius:14px;
  border:1px solid var(--line);
  background:var(--bg2);
  color:var(--text);
  outline:none;
}

input[type="file"]{
  width:100%;
  min-height:48px;
  padding:10px 12px;
  border-radius:14px;
  border:1px dashed #4b566a;
  background:#141920;
  color:var(--muted);
}

input::placeholder{
  color:#8590a2;
}

select option{
  background:#151920;
  color:white;
}

button{
  min-height:44px;
  padding:10px 16px;
  border-radius:999px;
  border:1px solid rgba(255,255,255,0.06);
  background:linear-gradient(135deg,var(--accent),var(--accent2));
  color:white;
  font-weight:700;
  cursor:pointer;
  transition:all .16s ease;
}

button:hover{
  filter:brightness(1.06);
}

.options{
  display:flex;
  flex-wrap:wrap;
  gap:12px;
  align-items:center;
  margin-bottom:16px;
  color:var(--muted);
  font-size:14px;
}

.options label{
  display:inline-flex;
  align-items:center;
  gap:8px;
  padding:8px 12px;
  border-radius:999px;
  background:#14233f;
  border:1px solid rgba(220,226,235,0.22);
  color:#ffffff;
}

.sectionbox{
  padding-top:4px;
}

.sectionheader{
  display:flex;
  flex-wrap:wrap;
  align-items:center;
  justify-content:space-between;
  gap:10px;
  margin-bottom:12px;
}

.sectionheaderinline{
  justify-content:flex-start;
  gap:8px;
  margin-bottom:8px;
}

.sectionheadertight{
  gap:6px;
}

.sectiontitle{
  margin:0;
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.08em;
  color:var(--muted);
  font-weight:800;
}

.sectiontoggle{
  min-height:34px;
  padding:8px 12px;
  cursor:pointer;
}

.sectiontoggletight{
  min-height:30px;
  padding:6px 10px;
  font-size:13px;
}

.sectiongrid{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:10px;
}

.sectiongrid.collapsed{
  display:none;
}

.sectionitem{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  min-height:42px;
  padding:10px 12px;
  border-radius:14px;
  background:var(--chip);
  border:1px solid rgba(220,226,235,0.22);
  color:var(--chiptext);
}

.sectionitem input{
  margin-right:8px;
}

.count{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  min-width:28px;
  height:28px;
  padding:0 8px;
  border-radius:999px;
  background:#1d2126;
  color:white;
  font-size:12px;
  font-weight:700;
}

.meta{
  margin:10px 2px 16px 2px;
  color:var(--muted);
  font-size:14px;
  font-weight:600;
}

.result{
  display:grid;
  grid-template-columns:260px minmax(0,1fr);
  gap:18px;
  padding:16px;
  margin-bottom:16px;
  overflow:hidden;
  transition:transform .16s ease, border-color .16s ease, background .16s ease;
}

.result:hover{
  transform:translateY(-1px);
  border-color:rgba(255,255,255,0.1);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.04), rgba(255,255,255,0.02)),
    var(--card2);
}

.thumbcol{
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:center;
}

.thumb{
  display:block;
  width:100%;
  height:220px;
  object-fit:contain;
  object-position:center top;
  border-radius:14px;
  border:1px solid rgba(255,255,255,0.06);
  background:#10141a;
}

.contentcol{
  min-width:0;
}

.head{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  align-items:center;
  margin-bottom:12px;
  color:var(--muted);
  font-size:13px;
}

.file{
  color:#fff;
  font-weight:800;
}

.page{
  color:#d6dde8;
}

.badge{
  display:inline-flex;
  align-items:center;
  min-height:28px;
  padding:6px 10px;
  border-radius:999px;
  background:rgba(198,40,40,0.14);
  border:1px solid rgba(198,40,40,0.28);
  color:#ffd7d2;
  font-size:12px;
  font-weight:800;
  text-transform:uppercase;
  letter-spacing:.04em;
}

.altbadge{
  background:rgba(255,255,255,0.08);
  border-color:rgba(255,255,255,0.10);
  color:#f3f5f8;
}

.snippet{
  color:#eef2f7;
  font-size:17px;
  line-height:1.62;
}

.snippet mark,
.pagebox mark{
  background:#ffd24a;
  color:#111;
  padding:0 .14em;
  border-radius:4px;
}

.result .actions{
  justify-content:flex-start;
  margin-top:14px;
}

.result .actions a{
  background:rgba(255,255,255,0.02);
}

.pager{
  display:flex;
  gap:14px;
  align-items:center;
  justify-content:center;
  margin-top:24px;
  color:var(--muted);
}

.back{
  margin:2px 0 14px 2px;
}

.back a{
  color:#ffe0dc;
  font-weight:700;
}

.detailwrap .topbar{
  margin-bottom:14px;
}

.detailmeta{
  padding:18px;
  margin-bottom:14px;
  color:#dce2eb;
  line-height:1.7;
}

.toplinks{
  justify-content:flex-start;
  margin-top:12px;
}

.neighborbar{
  display:flex;
  flex-wrap:wrap;
  gap:10px;
  margin-bottom:14px;
}

.detailgrid{
  display:grid;
  grid-template-columns:minmax(320px,42%) 1fr;
  gap:18px;
}

.imagebox,
.pagebox{
  border:1px solid rgba(255,255,255,0.06);
  border-radius:var(--radius);
  background:
    linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.015)),
    var(--card);
  box-shadow:var(--shadow);
}

.imagebox{
  padding:14px;
}

.pageimage{
  width:100%;
  height:auto;
  border-radius:12px;
  display:block;
}

.pagebox{
  padding:20px;
  color:#eef2f7;
  line-height:1.68;
  font-size:16px;
}

.loginwrap{
  max-width:680px;
  min-height:84vh;
  display:flex;
  align-items:center;
  justify-content:center;
}

.loginbox{
  width:100%;
  padding:26px;
}

.loginform,
.adminform{
  display:flex;
  flex-direction:column;
  gap:10px;
  margin-top:16px;
}

.loginform label,
.adminform label{
  color:var(--muted);
  font-size:14px;
  font-weight:700;
}

.flasherror,
.flashok{
  margin:14px 0 16px 0;
  padding:12px 14px;
  border-radius:14px;
  font-weight:600;
}

.flasherror{
  background:var(--errbg);
  border:1px solid var(--errline);
  color:var(--errtext);
}

.flashok{
  background:var(--okbg);
  border:1px solid var(--okline);
  color:var(--oktext);
}

.adminstats{
  display:grid;
  grid-template-columns:repeat(auto-fit,minmax(240px,1fr));
  gap:14px;
  margin-bottom:18px;
}

.statcard{
  padding:16px;
}

.statlabel{
  color:var(--muted);
  font-size:13px;
  text-transform:uppercase;
  letter-spacing:.06em;
  margin-bottom:8px;
  font-weight:800;
}

.statvalue{
  font-size:30px;
  font-weight:900;
  color:white;
}

.adminpanel,
.adminlogs{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
  margin-bottom:18px;
}

.adminbox{
  padding:18px;
}

.usercard,
.logitem{
  padding:14px 0;
  border-top:1px solid rgba(255,255,255,0.06);
}

.usercard:first-child,
.logitem:first-child{
  border-top:none;
}

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

.smalltext{
  color:var(--muted);
  font-size:13px;
  line-height:1.5;
}

.headline{
  font-size:18px;
  font-weight:800;
  color:#fff;
}

input[type="checkbox"]{
  accent-color:var(--accent2);
}

@media (max-width:1400px){
  .statline{
    flex-wrap:wrap;
  }
  .statlineitem{
    flex:1 1 320px;
    white-space:normal;
  }
}

@media (max-width:1120px){

  .statlineitem{
    flex:1 1 100%;
    font-size:15px;
  }
  .topbarflat{
    grid-template-columns:1fr;
  }
  .grid{
    grid-template-columns:1fr 1fr;
  }
  .microstatsgrid,
  .microstatsgridcompact{
    grid-template-columns:1fr;
  }
  .statline{
    gap:10px;
    padding:10px 12px;
  }
  .statlineitem{
    flex:1 1 100%;
    font-size:15px;
  }
  .result{
    grid-template-columns:1fr;
  }
  .thumb{
    height:auto;
    max-height:340px;
  }
  .detailgrid,
  .adminpanel,
  .adminlogs{
    grid-template-columns:1fr;
  }
  .topbar{
    flex-direction:column;
  }
  .actions{
    justify-content:flex-start;
  }
}

@media (max-width:700px){
  .wrap{
    padding:16px 14px 36px 14px;
  }
  .topbar{
    padding:20px 18px;
    border-radius:20px;
  }
  .topbarcompact{
    padding:14px 14px 12px 14px;
  }
  .topbarflat{
    grid-template-columns:1fr;
    padding:12px 14px 10px 14px;
  }
  .archivepillmega{
    min-height:48px;
    padding:8px 16px;
    font-size:24px;
  }
  .statline{
    padding:10px 12px;
  }
  .statlineitem{
    font-size:15px;
    white-space:normal;
  }
  h1{
    font-size:28px;
  }
  .archivepillbig{
    min-height:58px;
    padding:12px 18px;
    font-size:24px;
  }
  .grid{
    grid-template-columns:1fr;
  }
  .searchpanel,
  .result,
  .detailmeta,
  .adminbox,
  .loginbox{
    padding:16px;
  }
  .snippet{
    font-size:16px;
  }
}

.sectionitem span:first-of-type{
  flex:1;
  min-width:0;
  white-space:nowrap;
  overflow:hidden;
  text-overflow:ellipsis;
}
