/* ==========================================================================
   LynxHub — community site styles
   Monochrome restoration: the original pre-redesign LYNX palette — six
   grayscale tones, no hue anywhere. Hierarchy and state are expressed
   through contrast and inversion, never color. The "primary" action is a
   light surface with dark text (inverted), not a colored button; the online
   dot, success, warning and destructive states are all derived from the
   same six tones. Design tokens here match source/admin-web/admin-web.css.
   ========================================================================== */

:root{
  /* ---- the six canonical grayscale tones (from the original mockup) ---- */
  --bg:        #0a0a0b;
  --graphite:  #2c2d32;
  --shadow:    #555152;
  --mid:       #969293;
  --hair:      #d2cfd0;
  --white:     #fcfbfb;

  /* ---- raised neutral surfaces — white-over-bg, strictly hue-free ---- */
  --bg-raise:    rgba(252,251,251,0.03);   /* elevated cards / popovers / modals */
  --bg-raise-2:  rgba(252,251,251,0.055);  /* inputs, raised controls, chips */
  --bg-hover:    rgba(252,251,251,0.10);    /* hover fill */

  /* ---- hairline separators (neutral, white-over-bg) ---- */
  --separator:        rgba(252,251,251,0.10);
  --separator-strong: rgba(252,251,251,0.18);

  /* ---- label tiers mapped onto the grayscale tones ---- */
  --label:       var(--white);
  --label-2:     var(--mid);
  --label-3:     var(--shadow);
  --label-4:     rgba(252,251,251,0.24);

  /* ---- "accent" is inversion, not hue: light surface / dark text ---- */
  --blue:        var(--white);   /* primary action — inverted, kept named --blue for refs */
  --blue-hover:  var(--hair);
  --blue-press:  var(--mid);
  /* ---- semantic states, all hue-free — differentiated by tone/emphasis ---- */
  --green:       var(--hair);    /* online / success — light gray dot, per original */
  --red:         var(--white);   /* destructive — signalled by high-contrast emphasis */
  --orange:      var(--hair);    /* warning / in-development */

  /* ---- state aliases ---- */
  --ok:          var(--green);
  --warn:        var(--orange);
  --danger:      var(--red);

  /* ---- corner radius scale (Apple leans generous) ---- */
  --r-sm:  8px;
  --r-md:  12px;
  --r-lg:  16px;
  --r-xl:  22px;
  --r-pill:999px;
  --radius: var(--r-md);

  /* ---- soft, restrained elevation shadows ---- */
  --shadow-1: 0 1px 2px rgba(0,0,0,0.40);
  --shadow-2: 0 8px 28px rgba(0,0,0,0.42);
  --shadow-3: 0 24px 64px rgba(0,0,0,0.55);

  /* ---- type ---- */
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;

  /* ---- motion ---- */
  --ease: cubic-bezier(0.32, 0.72, 0, 1);   /* Apple-ish ease-out */
  --dur:  0.22s;

  --focus: var(--hair);
}

*{ margin:0; padding:0; box-sizing:border-box; }
html{ background:var(--bg); -webkit-text-size-adjust:100%; }

body{
  background:var(--bg);
  color:var(--label);
  font-family:var(--font-sans);
  font-size:16px;
  line-height:1.5;
  -webkit-font-smoothing:antialiased;
  -moz-osx-font-smoothing:grayscale;
  text-rendering:optimizeLegibility;
  min-height:100vh;
  display:flex;
  flex-direction:column;
}

a{ color:inherit; text-decoration:none; }
button{ font-family:inherit; }
svg{ display:block; }

/* The `hidden` attribute must always win. Author rules like
   `.btn{display:inline-flex}` and `.user-chip{display:inline-flex}` otherwise
   out-specify the UA `[hidden]{display:none}` — that was the source of the
   logged-in "Войти" button showing alongside the user chip. */
[hidden]{ display:none !important; }

:focus-visible{ outline:2px solid var(--focus); outline-offset:2px; border-radius:4px; }

/* screen-reader only */
.sr-only{
  position:absolute; width:1px; height:1px;
  padding:0; margin:-1px; overflow:hidden;
  clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

/* ---------- header (sticky, frosted vibrancy) ---------- */
header{
  position:sticky;
  top:0;
  z-index:50;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:24px;
  padding:14px clamp(16px, 6vw, 64px);
  background:var(--bg);
  border-bottom:1px solid var(--graphite);
  flex-wrap:wrap;
}

.brand{
  display:flex;
  align-items:center;
  gap:10px;
}

.brand img{
  width:30px;
  height:30px;
  display:block;
  border-radius:8px;
  object-fit:contain;
}

.brand span{
  font-weight:700;
  font-size:19px;
  letter-spacing:0.12em;
}

nav{
  display:flex;
  gap:8px;
}

.nav-tab{
  background:none;
  border:none;
  color:var(--label-2);
  font-weight:590;
  font-size:15px;
  letter-spacing:-0.01em;
  padding:8px 12px;
  border-radius:var(--r-sm);
  cursor:pointer;
  position:relative;
  display:inline-flex;
  align-items:center;
  gap:6px;
  transition:color 0.2s ease;
}
.nav-tab:hover{ color:var(--label); }
.nav-tab.active{ color:var(--label); }
.nav-tab::after{
  content:"";
  position:absolute;
  left:12px; right:12px; bottom:-14px;
  height:2px;
  border-radius:2px;
  background:var(--blue);
  transform:scaleX(0);
  transition:transform 0.2s ease;
}
.nav-tab.active::after{ transform:scaleX(1); }
.nav-tab .lock{ width:12px; height:12px; opacity:0.7; }

.header-right{
  display:flex;
  align-items:center;
  gap:12px;
}

/* live online indicator */
.status{ position:relative; }

.status-btn{
  display:inline-flex;
  align-items:center;
  gap:8px;
  background:none;
  border:1px solid transparent;
  border-radius:var(--r-pill);
  padding:7px 12px;
  font-family:var(--font-mono);
  font-size:12px;
  color:var(--label-2);
  cursor:pointer;
  transition:background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.status-btn:hover{ background:rgba(252,251,251,0.05); color:var(--label); }

.dot{
  width:7px; height:7px;
  border-radius:50%;
  background:var(--label-3);
  flex:none;
}
.dot.live{ background:var(--green); animation:pulse 2s ease-in-out infinite; }

@keyframes pulse{
  0%,100%{ opacity:1; }
  50%{ opacity:0.35; }
}

/* online popover */
.online-pop{
  position:absolute;
  top:calc(100% + 12px);
  right:0;
  min-width:230px;
  max-width:290px;
  background:rgba(10,10,11,0.86);
  backdrop-filter:saturate(180%) blur(24px);
  -webkit-backdrop-filter:saturate(180%) blur(24px);
  border:1px solid var(--separator-strong);
  border-radius:var(--r-lg);
  padding:14px;
  box-shadow:var(--shadow-3);
  z-index:40;
}
.online-pop h4{
  font-size:12px; letter-spacing:0.02em;
  color:var(--label-2); margin-bottom:12px; font-weight:600;
}
.online-pop ul{ list-style:none; display:flex; flex-direction:column; gap:10px; }
.online-pop li{ display:flex; align-items:center; gap:10px; font-size:14px; }
.online-pop .mini-av{
  width:26px; height:26px; border-radius:50%;
  background:var(--bg-raise-2); color:var(--label);
  display:flex; align-items:center; justify-content:center;
  font-size:12px; font-weight:600; flex:none;
}
.online-pop .empty{ font-size:13px; color:var(--label-2); }

/* user chip / login button */
.user-chip{
  display:inline-flex;
  align-items:center;
  gap:9px;
  background:var(--bg-raise-2);
  border:1px solid var(--separator);
  border-radius:var(--r-pill);
  padding:5px 14px 5px 5px;
  color:var(--label);
  cursor:pointer;
  max-width:210px;
  min-height:40px;
  transition:background var(--dur) var(--ease);
}
.user-chip:hover{ background:var(--bg-hover); }
.user-chip .avatar{ width:30px; height:30px; font-size:12px; }
.user-chip .u-name{
  font-weight:600; font-size:15px; letter-spacing:-0.01em;
  white-space:nowrap; overflow:hidden; text-overflow:ellipsis;
}

/* generic buttons */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap:8px;
  border:1px solid var(--separator-strong);
  background:var(--bg-raise-2);
  color:var(--label);
  border-radius:var(--r-md);
  padding:11px 18px;
  min-height:44px;
  font-weight:600;
  font-size:15px;
  letter-spacing:-0.01em;
  cursor:pointer;
  transition:background var(--dur) var(--ease), border-color var(--dur) var(--ease),
             transform var(--dur) var(--ease), opacity var(--dur) var(--ease);
}
.btn:hover{ background:var(--bg-hover); }
.btn:active{ transform:scale(0.97); }
.btn-primary{ background:var(--blue); color:var(--bg); border-color:transparent; box-shadow:var(--shadow-1); }
.btn-primary:hover{ background:var(--blue-hover); }
.btn-primary:active{ background:var(--blue-press); transform:scale(0.97); }
.btn-ghost{ background:transparent; border-color:transparent; color:var(--label-2); }
.btn-ghost:hover{ background:rgba(252,251,251,0.05); color:var(--label); }
/* destructive: no hue — signalled by high-contrast inversion on commit */
.btn-danger{ background:transparent; color:var(--hair); border-color:var(--separator-strong); }
.btn-danger:hover{ background:var(--white); color:var(--bg); border-color:var(--white); }
.btn:disabled{ opacity:0.45; cursor:not-allowed; transform:none; }
.btn-sm{ padding:8px 14px; min-height:36px; font-size:14px; border-radius:var(--r-sm); }

/* ---------- layout ---------- */
main{
  flex:1;
  padding:64px clamp(16px, 6vw, 64px) 56px;
}

.panel{ display:none; max-width:1080px; margin:0 auto; }
.panel.active{ display:block; }

/* locked panel (logged-out gating for watch/files) */
.locked{
  display:none;
  flex-direction:column;
  align-items:center;
  text-align:center;
  gap:16px;
  padding:64px 32px;
  background:var(--bg-raise);
  border:1px solid var(--separator);
  border-radius:var(--r-xl);
  box-shadow:var(--shadow-2);
  max-width:440px;
  margin:32px auto 0;
}
.panel.gated.active > .panel-inner{ display:none; }
.panel.gated.active > .locked{ display:flex; }
.locked svg{ color:var(--label-3); }
.locked h3{ font-weight:700; font-size:22px; letter-spacing:-0.02em; }
.locked p{ font-size:15px; color:var(--label-2); line-height:1.55; max-width:320px; }

/* ---------- home ---------- */
.hero{
  display:flex;
  flex-direction:column;
  align-items:center;
  text-align:center;
  max-width:600px;
  margin:0 auto;
  position:relative;
}

.crest{
  position:relative;
  width:116px; height:116px;
  display:flex; align-items:center; justify-content:center;
  margin-bottom:32px;
}

.crest::before{
  content:"";
  position:absolute; inset:-28px;
  border-radius:50%;
  background:radial-gradient(circle, rgba(252,251,251,0.06) 0%, rgba(252,251,251,0) 70%);
}

.crest img{
  width:100%; height:100%;
  object-fit:contain;
  border-radius:26px;
  background:var(--bg-raise);
  box-shadow:inset 0 0 0 1px var(--separator-strong), var(--shadow-3);
  position:relative;
}

.eyebrow{
  font-family:var(--font-mono);
  font-size:12px;
  letter-spacing:0.18em;
  text-transform:uppercase;
  color:var(--label-2);
  margin-bottom:16px;
}

h1{
  font-weight:700;
  font-size:clamp(52px, 11vw, 88px);
  line-height:0.98;
  letter-spacing:-0.03em;
}

.sub{
  margin-top:18px;
  font-size:18px;
  line-height:1.55;
  color:var(--label-2);
  max-width:420px;
}

.hero-cta{ margin-top:32px; display:flex; gap:12px; flex-wrap:wrap; justify-content:center; }

.news-head{ margin-top:72px; }

.news-list{
  background:var(--bg-raise);
  border:1px solid var(--separator);
  border-radius:var(--r-lg);
  box-shadow:var(--shadow-1);
  overflow:hidden;
}

.news-item{
  padding:24px;
  border-bottom:1px solid var(--separator);
  display:flex;
  flex-direction:column;
  gap:8px;
}
.news-item:last-child{ border-bottom:none; }

.news-top{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
}

.news-tag{
  display:inline-flex;
  align-items:center;
  font-size:11px;
  font-weight:600;
  letter-spacing:0.02em;
  text-transform:uppercase;
  color:var(--blue);
  background:rgba(252,251,251,0.06);
  border-radius:var(--r-pill);
  padding:4px 10px;
}

.news-date{
  font-family:var(--font-mono);
  font-size:12px;
  color:var(--label-3);
  white-space:nowrap;
}

.news-title{
  font-weight:640;
  font-size:20px;
  letter-spacing:-0.02em;
  margin-top:2px;
}

.news-excerpt{
  font-size:15px;
  line-height:1.6;
  color:var(--label-2);
  max-width:640px;
}

/* ---------- section head ---------- */
.panel-head{
  display:flex;
  align-items:baseline;
  justify-content:space-between;
  gap:16px;
  flex-wrap:wrap;
  margin-bottom:24px;
}

.panel-head h2{
  font-weight:700;
  font-size:28px;
  letter-spacing:-0.02em;
}

.pill{
  display:inline-flex;
  align-items:center;
  gap:7px;
  border:1px solid var(--separator-strong);
  border-radius:var(--r-pill);
  padding:6px 14px;
  font-family:var(--font-mono);
  font-size:12px;
  color:var(--label-2);
}

.files-count{
  font-family:var(--font-mono);
  font-size:13px;
  color:var(--label-2);
}

/* ---------- watch together (placeholder / coming soon) ---------- */
.watch-layout{
  display:grid;
  grid-template-columns:1fr 320px;
  gap:20px;
}

.video-frame{
  position:relative;
  aspect-ratio:16/9;
  background:linear-gradient(150deg, var(--bg-raise-2), var(--bg));
  border:1px solid var(--separator);
  border-radius:var(--r-lg);
  display:flex;
  align-items:center;
  justify-content:center;
  flex-direction:column;
  gap:16px;
  overflow:hidden;
}

.play-circle{
  width:60px; height:60px;
  border-radius:50%;
  background:rgba(252,251,251,0.06);
  border:1px solid var(--separator-strong);
  display:flex; align-items:center; justify-content:center;
  color:var(--label);
}

.video-frame .note{
  font-size:13px;
  color:var(--label-2);
  line-height:1.5;
  text-align:center;
  max-width:80%;
}

.soon-badge{
  display:inline-flex; align-items:center; gap:7px;
  background:rgba(252,251,251,0.06);
  color:var(--orange);
  border-radius:var(--r-pill);
  padding:5px 12px;
  font-size:11px; font-weight:600; letter-spacing:0.04em; text-transform:uppercase;
}
.soon-badge .dot{ background:var(--orange); }

.participants{
  display:flex;
  align-items:center;
  gap:10px;
  margin-top:20px;
  flex-wrap:wrap;
}

.participants .label{
  font-family:var(--font-mono);
  font-size:12px;
  color:var(--label-2);
  letter-spacing:0.06em;
  text-transform:uppercase;
  margin-right:4px;
}

.avatar{
  width:34px; height:34px;
  border-radius:50%;
  background:var(--bg-raise-2);
  border:1px solid var(--separator-strong);
  display:flex; align-items:center; justify-content:center;
  font-size:13px;
  font-weight:600;
  color:var(--label);
  flex:none;
}

.chat-box{
  background:var(--bg-raise);
  border:1px solid var(--separator);
  border-radius:var(--r-lg);
  display:flex;
  flex-direction:column;
  height:100%;
  min-height:360px;
  overflow:hidden;
}

.chat-messages{
  flex:1;
  overflow-y:auto;
  padding:18px;
  display:flex;
  flex-direction:column;
  gap:12px;
}

.msg{ font-size:14px; line-height:1.5; }
.msg .name{ font-weight:600; color:var(--label); margin-right:6px; }
.msg .text{ color:var(--label-2); }

.chat-input{
  border-top:1px solid var(--separator);
  display:flex;
  align-items:center;
  gap:8px;
  padding:12px 14px;
}

.chat-input input{
  flex:1;
  background:none;
  border:none;
  color:var(--label);
  font-family:inherit;
  font-size:14px;
}
.chat-input input::placeholder{ color:var(--label-3); }
.chat-input input:disabled{ cursor:not-allowed; }

.chat-input button{
  background:none;
  border:none;
  color:var(--label-3);
  cursor:not-allowed;
  padding:6px;
}

@media (max-width:760px){
  .watch-layout{ grid-template-columns:1fr; }
  .chat-box{ min-height:280px; }
}

/* ---------- files ---------- */
.search-wrap{
  display:flex;
  align-items:center;
  gap:8px;
  background:var(--bg-raise-2);
  border:1px solid var(--separator);
  border-radius:var(--r-md);
  padding:0 14px;
  min-height:44px;
  color:var(--label-3);
  flex:1;
  min-width:200px;
  max-width:300px;
  transition:border-color var(--dur) var(--ease);
}
.search-wrap:focus-within{ border-color:var(--blue); }

.search-wrap input{
  flex:1;
  background:none;
  border:none;
  color:var(--label);
  font-family:inherit;
  font-size:15px;
  padding:10px 0;
}
.search-wrap input::placeholder{ color:var(--label-3); }
.search-wrap input:focus-visible{ outline:none; }

/* drop zone / upload */
.dropzone{
  border:1.5px dashed var(--separator-strong);
  border-radius:var(--r-lg);
  padding:32px;
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
  flex-wrap:wrap;
  text-align:center;
  color:var(--label-2);
  margin-bottom:24px;
  transition:border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.dropzone:hover{ border-color:var(--label-3); }
.dropzone svg{ color:var(--label-3); }
.dropzone.drag{ border-color:var(--blue); background:rgba(252,251,251,0.05); color:var(--label); }
.dropzone.drag svg{ color:var(--blue); }
.dropzone .dz-text{ font-size:15px; line-height:1.5; }
.dropzone .dz-hint{ font-family:var(--font-mono); font-size:11px; color:var(--label-3); margin-top:4px; }

.upload-progress{
  display:none;
  align-items:center;
  gap:12px;
  margin-bottom:24px;
  font-family:var(--font-mono);
  font-size:13px;
  color:var(--label-2);
}
.upload-progress.show{ display:flex; }
.progress-track{
  flex:1;
  height:6px;
  border-radius:var(--r-pill);
  background:var(--bg-raise-2);
  overflow:hidden;
  max-width:300px;
}
.progress-bar{ height:100%; width:0%; background:var(--blue); border-radius:var(--r-pill); transition:width 0.2s ease; }

/* collapsible per-category sections */
.file-sections{
  display:flex;
  flex-direction:column;
  gap:16px;
}

.file-section{
  background:var(--bg-raise);
  border:1px solid var(--separator);
  border-radius:var(--r-lg);
  box-shadow:var(--shadow-1);
  overflow:hidden;
}

.sec-header{
  display:flex;
  align-items:center;
  gap:12px;
  width:100%;
  padding:16px 18px;
  background:transparent;
  border:none;
  color:var(--label);
  cursor:pointer;
  text-align:left;
  font-family:inherit;
  transition:background var(--dur) var(--ease);
}
.sec-header:hover{ background:rgba(252,251,251,0.03); }
.sec-chevron{
  display:flex; color:var(--label-3);
  transition:transform 0.2s ease;
}
/* chevron points right when collapsed, down when open */
.file-section:not(.collapsed) .sec-chevron{ transform:rotate(90deg); }
.sec-title{
  font-size:16px; font-weight:640; letter-spacing:-0.01em; flex:1;
}
.sec-count{
  font-family:var(--font-mono); font-size:12px; color:var(--label-2);
  background:var(--bg-raise-2); border-radius:var(--r-pill);
  padding:2px 10px; min-width:26px; text-align:center;
}

.sec-body{
  padding:0 18px 12px;
  border-top:1px solid var(--separator);
}
.file-section.collapsed .sec-body{ display:none; }

/* the section's own scoped search — full-width, sits above its list */
.sec-search{
  max-width:none;
  margin:14px 0 4px;
  min-height:40px;
}
.sec-search input{ font-size:14px; padding:8px 0; }

.sec-note{
  padding:20px 4px;
  font-size:14px;
  color:var(--label-3);
  text-align:center;
}

.file-list{
  background:var(--bg-raise);
  border:1px solid var(--separator);
  border-radius:var(--r-lg);
  box-shadow:var(--shadow-1);
  overflow:hidden;
}
.file-list:empty{ display:none; }
/* inside a section the card chrome lives on .file-section, so the nested
   list is a plain row container */
.file-section .file-list{
  background:none; border:none; box-shadow:none; border-radius:0; overflow:visible;
}

.file-row{
  display:grid;
  grid-template-columns:40px 1fr auto auto auto auto;
  align-items:center;
  gap:16px;
  padding:14px 0;
  border-bottom:1px solid var(--separator);
}
.file-row:last-child{ border-bottom:none; }

.file-icon{
  width:40px; height:40px;
  border-radius:var(--r-sm);
  background:var(--bg-raise-2);
  display:flex; align-items:center; justify-content:center;
  color:var(--label-2);
  flex:none;
}

/* real inline preview: an uploaded image (as itself) or a supplied cover */
.file-thumb{
  width:40px; height:40px;
  border-radius:var(--r-sm);
  object-fit:cover;
  background:var(--bg-raise-2);
  flex:none;
  display:block;
}

.file-name{ font-size:15px; font-weight:500; letter-spacing:-0.01em; word-break:break-word; }
.file-sub{ display:flex; align-items:center; gap:10px; margin-top:5px; flex-wrap:wrap; }
.cat-badge{
  display:inline-flex; align-items:center;
  border-radius:var(--r-pill);
  padding:3px 10px;
  font-size:11px; font-weight:600; letter-spacing:0.03em; text-transform:uppercase;
  background:rgba(252,251,251,0.07); color:var(--label-2);
  flex:none;
}
.file-comment{
  font-size:12px; color:var(--label-3); line-height:1.4;
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%;
}

.file-meta{
  font-family:var(--font-mono);
  font-size:13px;
  color:var(--label-2);
  white-space:nowrap;
}
.file-meta.uploader{ max-width:140px; overflow:hidden; text-overflow:ellipsis; }

.dl-btn{
  background:transparent;
  border:1px solid var(--separator-strong);
  border-radius:var(--r-sm);
  color:var(--hair);
  padding:9px;
  cursor:pointer;
  display:flex;
  transition:border-color 0.2s ease;
}
.dl-btn:hover{ border-color:var(--shadow); }

/* per-row action cluster: download + owner-only edit/delete */
.file-actions{ display:flex; align-items:center; gap:8px; }
.row-btn{
  background:transparent;
  border:1px solid var(--separator-strong);
  border-radius:var(--r-sm);
  color:var(--label-2);
  padding:9px;
  cursor:pointer;
  display:flex; align-items:center;
  transition:border-color 0.2s ease, color 0.2s ease, background var(--dur) var(--ease);
}
.row-btn:hover{ border-color:var(--shadow); color:var(--label); }
/* delete confirm: matches .btn-danger's high-contrast inversion, no hue */
.del-btn.confirm{
  width:auto;
  padding:8px 12px;
  font-family:inherit; font-size:12px; font-weight:600; letter-spacing:-0.01em;
  background:var(--white); color:var(--bg); border-color:var(--white);
}

/* skeleton + empty + error states (shared) */
.skeleton-row{
  display:grid;
  grid-template-columns:40px 1fr 70px;
  align-items:center;
  gap:16px;
  padding:16px 18px;
  border-bottom:1px solid var(--separator);
}
.skeleton-row:last-child{ border-bottom:none; }
.sk{
  background:linear-gradient(90deg, var(--bg-raise-2) 25%, var(--bg-hover) 50%, var(--bg-raise-2) 75%);
  background-size:200% 100%;
  animation:shimmer 1.3s infinite;
  border-radius:6px;
  height:12px;
}
.sk.box{ height:40px; width:40px; border-radius:var(--r-sm); }
.sk.w60{ width:60%; } .sk.w40{ width:40%; }
@keyframes shimmer{ 0%{ background-position:200% 0; } 100%{ background-position:-200% 0; } }

.state{
  text-align:center;
  padding:64px 24px;
  color:var(--label-2);
  display:flex; flex-direction:column; align-items:center; gap:12px;
}
.state svg{ color:var(--label-3); }
.state h3{ font-weight:640; font-size:20px; letter-spacing:-0.02em; color:var(--label); }
.state p{ font-size:14px; line-height:1.6; max-width:360px; }
.state.error h3{ color:var(--red); }

@media (max-width:640px){
  .file-row{ grid-template-columns:36px 1fr auto; }
  .file-meta.size, .file-meta.date, .file-meta.uploader{ display:none; }
}

/* ---------- modal (login) ---------- */
.overlay{
  position:fixed; inset:0;
  background:rgba(10,10,11,0.6);
  backdrop-filter:saturate(160%) blur(16px);
  -webkit-backdrop-filter:saturate(160%) blur(16px);
  display:flex; align-items:center; justify-content:center;
  padding:20px;
  z-index:100;
  animation:overlay-in 0.2s var(--ease);
}
@keyframes overlay-in{ from{ opacity:0; } to{ opacity:1; } }

.modal{
  width:100%;
  max-width:400px;
  background:var(--bg-raise);
  border:1px solid var(--separator-strong);
  border-radius:var(--r-xl);
  padding:32px 28px 28px;
  box-shadow:var(--shadow-3);
  animation:modal-in 0.26s var(--ease);
}
@keyframes modal-in{ from{ opacity:0; transform:translateY(12px) scale(0.98); } to{ opacity:1; transform:none; } }

.modal-logo{ display:flex; align-items:center; gap:10px; margin-bottom:8px; }
.modal-logo img{ width:28px; height:28px; border-radius:7px; object-fit:contain; }
.modal-logo span{ font-weight:700; letter-spacing:0.12em; font-size:16px; }
.modal h2{
  font-weight:700; font-size:24px;
  margin:18px 0 6px; letter-spacing:-0.02em;
}
.modal .modal-sub{ font-size:14px; color:var(--label-2); line-height:1.5; margin-bottom:24px; }

/* forms */
.field{ display:flex; flex-direction:column; gap:8px; margin-bottom:18px; }
.field label{
  font-size:13px; font-weight:590; color:var(--label-2); letter-spacing:-0.01em;
}
.field input, .field textarea{
  background:var(--bg-raise-2);
  border:1px solid var(--separator);
  border-radius:var(--r-md);
  color:var(--label);
  font-family:inherit;
  font-size:16px;
  padding:12px 14px;
  min-height:46px;
  width:100%;
  resize:vertical;
  transition:border-color var(--dur) var(--ease), background var(--dur) var(--ease);
}
.field input:focus, .field textarea:focus{ outline:none; border-color:var(--blue); background:var(--bg-raise); }
.field input::placeholder, .field textarea::placeholder{ color:var(--label-3); }
.field .hint{ font-family:var(--font-mono); font-size:11px; color:var(--label-3); }

.form-error{
  display:none;
  background:rgba(252,251,251,0.10);
  border:1px solid var(--separator-strong);
  color:var(--red);
  border-radius:var(--r-md);
  padding:12px 14px;
  font-size:14px;
  margin-bottom:18px;
}
.form-error.show{ display:block; }

/* ---------- upload modal ---------- */
/* .overlay's display:flex would otherwise beat the UA [hidden] rule, so make
   the hidden attribute actually hide it. */
.overlay[hidden]{ display:none; }

.modal-upload{
  max-width:520px;
  max-height:88vh;
  overflow-y:auto;
  padding:22px 26px 26px;
  text-align:left;
}
/* header row: title + close affordance, mirrors the reference modal-head */
.modal-upload .modal-head{
  display:flex; align-items:center; justify-content:space-between; gap:14px;
  margin-bottom:20px;
}
.modal-upload .modal-head h2{ margin:0; font-size:22px; }

.field select{
  background:var(--bg-raise-2);
  border:1px solid var(--separator);
  border-radius:var(--r-md);
  color:var(--label);
  font-family:inherit;
  font-size:16px;
  padding:12px 40px 12px 14px;
  min-height:46px;
  width:100%;
  cursor:pointer;
  appearance:none; -webkit-appearance:none;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23969293' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat:no-repeat; background-position:right 14px center;
  transition:border-color var(--dur) var(--ease), background-color var(--dur) var(--ease);
}
.field select:focus{ outline:none; border-color:var(--blue); }
.field .opt{ color:var(--label-3); font-weight:500; }

/* file pickers inside the modal — a button plus a filename readout */
.file-pick{ display:flex; align-items:center; gap:12px; flex-wrap:wrap; }
.file-pick-name{
  font-family:var(--font-mono); font-size:13px; color:var(--label-2);
  overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:100%;
}
.file-pick-name.set{ color:var(--label); }
.thumb-clear{
  background:transparent; border:1px solid var(--separator-strong);
  border-radius:var(--r-sm); color:var(--label-2); cursor:pointer;
  padding:6px; display:flex; align-items:center;
  transition:background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.thumb-clear:hover{ background:var(--bg-hover); color:var(--label); }

.modal-actions{ display:flex; gap:10px; justify-content:flex-end; margin-top:22px; }
.modal-actions .btn{ min-width:120px; }
#modal-progress{ margin:6px 0 0; }

/* ---------- cabinet slide-over ---------- */
.cabinet{
  position:fixed;
  top:0; right:0; bottom:0;
  width:min(440px, 100%);
  background:var(--bg-raise);
  border-left:1px solid var(--separator-strong);
  box-shadow:var(--shadow-3);
  z-index:90;
  transform:translateX(100%);
  transition:transform 0.34s var(--ease);
  display:flex; flex-direction:column;
  overflow-y:auto;
}
.cabinet.open{ transform:translateX(0); }
.cabinet-scrim{
  position:fixed; inset:0;
  background:rgba(0,0,0,0.5);
  backdrop-filter:blur(2px);
  -webkit-backdrop-filter:blur(2px);
  z-index:80;
  opacity:0; pointer-events:none;
  transition:opacity 0.34s var(--ease);
}
.cabinet-scrim.open{ opacity:1; pointer-events:auto; }

.cabinet-head{
  display:flex; align-items:center; justify-content:space-between;
  padding:22px 24px;
  border-bottom:1px solid var(--separator);
  position:sticky; top:0;
  background:rgba(10,10,11,0.82);
  backdrop-filter:saturate(180%) blur(20px);
  -webkit-backdrop-filter:saturate(180%) blur(20px);
  z-index:2;
}
.cabinet-head h2{ font-weight:700; font-size:22px; letter-spacing:-0.02em; }
.icon-btn{
  background:none; border:none; color:var(--label-2); cursor:pointer;
  padding:8px; border-radius:var(--r-sm); display:flex;
  transition:background var(--dur) var(--ease), color var(--dur) var(--ease);
}
.icon-btn:hover{ color:var(--label); background:var(--bg-hover); }

.cabinet-body{ padding:24px; display:flex; flex-direction:column; gap:24px; }

.cab-identity{ display:flex; align-items:center; gap:16px; }
.cab-identity .avatar{ width:56px; height:56px; font-size:21px; }
.cab-identity .who .dn{ font-weight:700; font-size:19px; letter-spacing:-0.02em; }
.cab-identity .who .un{ font-family:var(--font-mono); font-size:13px; color:var(--label-2); margin-top:3px; }

.badge{
  display:inline-flex; align-items:center; gap:5px;
  border-radius:var(--r-pill);
  padding:4px 11px;
  font-size:11px; font-weight:600; letter-spacing:0.04em; text-transform:uppercase;
  background:rgba(252,251,251,0.06); color:var(--label-2);
  margin-top:8px;
}
.badge.admin{ background:rgba(252,251,251,0.08); color:var(--orange); }

.cab-section-label{
  font-size:12px; font-weight:600; letter-spacing:0.04em; text-transform:uppercase;
  color:var(--label-2);
  border-top:1px solid var(--separator);
  padding-top:20px;
}

/* status toggle switch */
.switch-row{
  display:flex; align-items:center; justify-content:space-between; gap:12px;
}
.switch-row .sw-label{ font-size:15px; }
.switch-row .sw-state{ font-family:var(--font-mono); font-size:12px; color:var(--label-2); margin-left:auto; margin-right:12px; }
.switch{
  position:relative; width:52px; height:31px; flex:none;
  border:none; border-radius:var(--r-pill);
  background:var(--bg-hover); cursor:pointer; padding:0;
  transition:background 0.24s var(--ease);
}
.switch::after{
  content:""; position:absolute; top:2px; left:2px;
  width:27px; height:27px; border-radius:50%;
  background:var(--white); box-shadow:var(--shadow-1);
  transition:transform 0.24s var(--ease);
}
.switch[aria-checked="true"]{ background:var(--green); }
.switch[aria-checked="true"]::after{ transform:translateX(21px); }

.cab-actions{ display:flex; flex-direction:column; gap:10px; margin-top:4px; }
.save-hint{ font-family:var(--font-mono); font-size:12px; color:var(--label-2); min-height:14px; }
.save-hint.ok{ color:var(--green); }
.save-hint.err{ color:var(--red); }

/* ---------- toast ---------- */
.toasts{
  position:fixed; bottom:24px; left:50%; transform:translateX(-50%);
  display:flex; flex-direction:column; gap:10px;
  z-index:200; width:min(380px, calc(100% - 32px));
}
.toast{
  background:rgba(10,10,11,0.86);
  backdrop-filter:saturate(180%) blur(20px);
  -webkit-backdrop-filter:saturate(180%) blur(20px);
  border:1px solid var(--separator-strong);
  border-left-width:3px;
  border-radius:var(--r-md);
  padding:13px 16px;
  font-size:14px; line-height:1.4;
  box-shadow:var(--shadow-2);
  animation:toast-in 0.24s var(--ease);
  transition:opacity 0.25s var(--ease);
}
.toast.ok{ border-left-color:var(--green); }
.toast.err{ border-left-color:var(--red); }
.toast.info{ border-left-color:var(--mid); }
@keyframes toast-in{ from{ opacity:0; transform:translateY(10px); } to{ opacity:1; transform:none; } }

/* ---------- footer ---------- */
footer{
  border-top:1px solid var(--separator);
  padding:24px clamp(16px, 6vw, 64px) 32px;
  display:flex; align-items:center; justify-content:space-between;
  gap:16px; flex-wrap:wrap;
}
.footer-brand{
  font-family:var(--font-mono);
  font-size:12px; letter-spacing:0.08em; text-transform:uppercase; color:var(--label-2);
}
.footer-note{ font-family:var(--font-mono); font-size:12px; color:var(--label-3); }

/* app boot loader (before /api/me resolves) */
.boot{
  position:fixed; inset:0; display:flex; align-items:center; justify-content:center;
  background:var(--bg); z-index:150;
}
.spinner{
  width:28px; height:28px; border-radius:50%;
  border:2.5px solid var(--separator-strong); border-top-color:var(--blue);
  animation:spin 0.8s linear infinite;
}
@keyframes spin{ to{ transform:rotate(360deg); } }

@media (prefers-reduced-motion: reduce){
  *, *::before, *::after{
    animation-duration:0.001ms !important;
    animation-iteration-count:1 !important;
    transition-duration:0.001ms !important;
  }
}
