:root{
  --bg:#0b1020;
  --panel:#34395a;
  --panel-2:#101737;
  --border:#273469;
  --accent:#8b5cf6;
  --accent-2:#22d3ee;
  --ok:#22c55e;
  --warn:#f59e0b;
  --err:#ef4444;
  --muted:#a3aed0;
  --radius:14px;
  --radius-sm:10px;
  --shadow:0 10px 30px rgba(2,6,23,.35);
}

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

html,body{
  height:100%;
}

body{
  margin:0;
  font-family:Inter,system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,"Helvetica Neue",Arial;
  background:var(--bg);
  color:#e5e7eb;
}

/* ===================== */
/*   СТРАНИЦА ВХОДА      */
/*   .page-login     */
/* ===================== */

.page-login{
  min-height:100vh;
  display:grid;
  place-items:center;
}

.page-login .box{
  width:min(460px,92vw);
  background:linear-gradient(180deg,#121a44 0%,#0f1639 100%);
  border:1px solid var(--border);
  border-radius:14px;
  padding:22px;
}

.page-login h1{
  margin:0 0 14px;
  font-size:18px;
  color:#c7d2fe;
}

.page-login .row{
  display:flex;
  flex-direction:column;
  gap:6px;
  margin:10px 0;
}

.page-login .input{
  padding:12px 12px;
  background:#0e1533;
  border:1px solid var(--border);
  color:#e5e7eb;
  border-radius:10px;
}

.page-login .btn{
  width:100%;
  padding:12px;
  background:linear-gradient(180deg,#2b3aa0 0%,#243079 100%);
  color:#fff;
  border:1px solid #3b4ab5;
  border-radius:10px;
  cursor:pointer;
}

.page-login .btn:hover{
  filter:brightness(1.05);
}

.page-login .note{
  color:var(--muted);
  font-size:12px;
}

.page-login .flash{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-bottom:8px;
}

.page-login .tag{
  padding:8px 10px;
  border-radius:999px;
  font-size:13px;
  border:1px solid;
}

.page-login .tag--ok{
  border-color:#1faa5c;
  color:#b7f7cd;
  background:rgba(34,197,94,.1);
}

.page-login .tag--err{
  border-color:#b63b3b;
  color:#fecaca;
  background:rgba(239,68,68,.1);
  white-space:pre-line;
}

/* ===================== */
/*  СТРАНИЦА ФАЙЛОВ      */
/*   .layout     */
/* ===================== */

a{
  color:#c7d2fe;
  text-decoration:none;
}

a:hover{
  text-decoration:underline;
}

.layout{
  min-height:100vh;
}

body.is-busy::after{
  content:"Загрузка...";
  position:fixed;
  inset:0;
  background:rgba(0,0,0,.55);
  color:#e5e7eb;
  display:flex;
  align-items:center;
  justify-content:center;
  font-size:16px;
  z-index:9999;
}

/* ==== Layout ==== */

.layout{
  display:grid;
  grid-template-columns:350px 1fr;
  gap:0;
  min-height:100%;
}

.layout .sidebar{
  padding:18px 14px;
  background:linear-gradient(180deg,#0f1538 0%,#0b1020 100%);
  border-right:1px solid var(--border);
}

.layout .main{
  display:flex;
  flex-direction:column;
}

.layout .brand{
  display:flex;
  align-items:center;
  gap:10px;
  padding:8px 10px;
  border-radius:12px;
  background:linear-gradient(180deg,#111a46 0%,#0d1333 100%);
  border:1px solid var(--border);
}

.layout .brand__dot{
  width:10px;
  height:10px;
  border-radius:50%;
  background:conic-gradient(from 0deg,#8b5cf6,#22d3ee);
}

.layout .brand__name{
  font-weight:700;
  letter-spacing:.3px;
}

.layout .tree{
  margin-top:12px;
  padding:10px;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  max-height:calc(100vh - 200px);
  overflow:auto;
}

.layout .tree__item{
  display:flex;
  align-items:center;
  gap:8px;
  padding:8px 10px;
  border-radius:10px;
}

.layout .tree__item:hover{
  background:#121a44;
}

.layout .tree__icon{
  opacity:.9;
}

.layout .tree__name{
  flex:1;
}

.layout .tree__item--active{
  background:#1a2359;
}

.layout .create{
  margin-top:12px;
  padding:12px;
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
}

.layout .create__row{
  display:flex;
  gap:8px;
  align-items:center;
}

.layout .input{
  flex:1;
  padding:10px 12px;
  background:#0e1533;
  border:1px solid var(--border);
  color:#e5e7eb;
  border-radius:10px;
}

.layout .compress-row{
  display:flex;
  align-items:center;
  gap:6px;
}

.layout .compress-row .input{
  flex:1 1 0;
  min-width:0;
}

.layout .compress-x{
  flex:0 0 auto;
  color:var(--muted);
  font-size:14px;
}

.layout .btn{
  padding:10px 12px;
  background:linear-gradient(180deg,#2b3aa0 0%,#243079 100%);
  color:#fff;
  border:1px solid #3b4ab5;
  border-radius:10px;
  cursor:pointer;
}

.layout .btn:hover{
  filter:brightness(1.05);
}

.layout .toolbar{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  padding:14px 18px;
  border-bottom:1px solid var(--border);
  background:linear-gradient(180deg,#0f1535 0%,#0b1020 100%);
}

.layout .crumbs{
  display:flex;
  flex-wrap:wrap;
  gap:6px;
  align-items:center;
}

.layout .crumbs__item{
  padding:6px 10px;
  background:#0e1533;
  border:1px solid var(--border);
  border-radius:999px;
}

.layout .content{
  display:grid;
  grid-template-columns:1.2fr .8fr;
  gap:16px;
  padding:16px;
}

.layout .panel{
  background:var(--panel);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow:var(--shadow);
  padding:14px;
}

.layout .panel__title{
  margin:0 0 10px;
  font-size:16px;
  color:#c7d2fe;
}

.layout .grid{
  display:grid;
  grid-template-columns:repeat(auto-fill,minmax(160px,1fr));
  gap:12px;
}

.layout .card{
  background:linear-gradient(180deg,#121a44 0%,#0f1639 100%);
  border:1px solid var(--border);
  border-radius:12px;
  padding:10px;
  position:relative;
}

.layout .card--dir{
  display:flex;
  align-items:center;
  justify-content:space-between;
}

.layout .card--item{
  display:flex;
  flex-direction:column;
}

.layout .card__name{
  font-size:14px;
  word-break:break-word;
}

.layout .card__meta{
  font-size:12px;
  color:var(--muted);
}

.layout .card--item .card__meta{
  margin-bottom:4px;
}

.layout .thumb{
  width:100%;
  aspect-ratio:1/1;
  border-radius:10px;
  overflow:hidden;
  background:#0e1533;
  display:flex;
  align-items:center;
  justify-content:center;
  margin-bottom:6px;
  border:1px solid var(--border);
}

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

.layout .thumb--file{
  font-size:32px;
  color:var(--muted);
}

.layout .btn-delete-wrapper{
  margin-top:auto;
  text-align:right;
  display:flex;
  justify-content:space-between;
}

.layout .btn--sm{
  padding:8px 10px;
  font-size:10px;
  border-radius:8px;
}

.layout .btn--delete{
  background:linear-gradient(180deg,#a12b2b 0%, #7e2323 100%);
  border-color:#b53b3b;
}

.layout .btn--delete:hover{
  filter:brightness(1.05);
}

.layout .btn--copy{
  font-size:8px;
}

.layout .btn--compress{
  background:linear-gradient(180deg,#2563eb 0%, #1d4ed8 100%);
  border-color:#3b82f6;
}

.layout .btn--compress:hover{
  filter:brightness(1.1);
}

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

.layout .drop{
  padding:28px;
  border:2px dashed #334079;
  border-radius:12px;
  background:rgba(20,28,70,.35);
  text-align:center;
}

.layout .drop--over{
  background:rgba(34,211,238,.08);
  border-color:#22d3ee;
}

.layout .select{
  width:100%;
  padding:10px;
  background:#0e1533;
  border:1px solid var(--border);
  color:#e5e7eb;
  border-radius:10px;
}

.layout .flash{
  margin:12px 16px 0;
  display:flex;
  gap:10px;
  flex-wrap:wrap;
}

.layout .tag{
  padding:8px 10px;
  border-radius:999px;
  font-size:13px;
  border:1px solid;
}

.layout .tag--ok{
  border-color:#1faa5c;
  color:#b7f7cd;
  background:rgba(34,197,94,.1);
}

.layout .tag--warn{
  border-color:#c68a14;
  color:#fde68a;
  background:rgba(245,158,11,.08);
}

.layout .tag--err{
  border-color:#b63b3b;
  color:#fecaca;
  background:rgba(239,68,68,.1);
  white-space:pre-line;
}

@media (max-width:980px){
  .layout .layout{
    grid-template-columns:1fr;
  }
  .layout .content{
    grid-template-columns:1fr;
  }
  .layout .sidebar{
    order:2;
  }
}
