:root {
  --red: #DC231E;
  --red-dark: #B81B17;
  --ink: #333333;
  --muted: #6B6B6B;
  --card: #F7F7F7;
  --line: #E0E0E0;
  --bg: #FFFFFF;
  --soft: #F3F3F3;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 14px rgba(0,0,0,.05);
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.5 Arial, Helvetica, sans-serif; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
.hidden { display: none !important; }
.boot { padding: 80px; text-align: center; color: var(--muted); }

/* ---------- header */
.top { position: sticky; top: 0; z-index: 10; background: #fff; border-bottom: 1px solid var(--line); }
.top-inner { max-width: 1240px; margin: 0 auto; padding: 14px 24px; display: flex; align-items: center; gap: 20px; }
.brand { display: flex; align-items: baseline; gap: 12px; text-decoration: none; white-space: nowrap; }
.logo { font-weight: 800; font-size: 22px; letter-spacing: 2px; }
.logo b { color: var(--red); }
.brand-sub { font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; color: var(--muted); }
.search { flex: 1; max-width: 460px; position: relative; }
.search input { width: 100%; padding: 10px 14px 10px 38px; border: 1px solid var(--line); border-radius: 999px; background: var(--card); outline: none; }
.search input:focus { border-color: var(--red); background: #fff; }
.search svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; stroke: var(--muted); }
.spacer { flex: 1; }
.user { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--red); color: #fff; font-weight: 700; font-size: 12px; display: grid; place-items: center; }
.user a { color: var(--muted); }

/* ---------- buttons */
.btn { display: inline-flex; align-items: center; gap: 8px; border: 1px solid var(--line); background: #fff; padding: 9px 16px; border-radius: 999px; cursor: pointer; font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--ink); }
.btn-red { background: var(--red); border-color: var(--red); color: #fff; }
.btn-red:hover { background: var(--red-dark); border-color: var(--red-dark); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn-ghost:hover { color: var(--red); border-color: transparent; }
.btn-small { padding: 5px 12px; font-size: 12px; }
.btn[disabled] { opacity: .5; cursor: default; }

/* ---------- layout */
main { max-width: 1240px; margin: 0 auto; padding: 28px 24px 80px; }
.pill { display: inline-block; background: var(--red); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase; padding: 5px 12px; border-radius: 999px; }
h1 { font-size: 30px; line-height: 1.2; margin: 12px 0 6px; }
h2 { font-size: 18px; margin: 0 0 14px; }
.lead { color: var(--muted); margin: 0 0 24px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.label { font-size: 11px; font-weight: 700; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.red { color: var(--red); }
.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- filters + stats */
.toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip { border: 1px solid var(--line); background: #fff; border-radius: 999px; padding: 6px 13px; font-size: 13px; cursor: pointer; color: var(--muted); }
.chip.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.stats { display: flex; gap: 28px; }
.stat b { display: block; font-size: 26px; color: var(--red); line-height: 1.1; }

/* ---------- project grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 20px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; text-decoration: none; display: flex; flex-direction: column; transition: transform .15s, box-shadow .15s; }
.card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(0,0,0,.09); }
.cover { aspect-ratio: 16 / 10; background: #e9e9e9 center / cover no-repeat; position: relative; display: grid; place-items: center; overflow: hidden; }
.cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover .ph { color: #bdbdbd; font-weight: 800; letter-spacing: 3px; font-size: 13px; text-transform: uppercase; }
.cover .cat { position: absolute; top: 10px; left: 10px; }
.card-body { padding: 14px 16px 16px; display: flex; flex-direction: column; gap: 4px; }
.card-title { font-weight: 700; font-size: 16px; }
.card-meta { font-size: 13px; color: var(--muted); }
.card-foot { display: flex; justify-content: space-between; margin-top: 8px; font-size: 12px; color: var(--muted); }
.empty { text-align: center; padding: 70px 20px; border: 2px dashed var(--line); border-radius: var(--radius); color: var(--muted); }

/* ---------- forms */
.form { max-width: 820px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 18px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field input, .field select, .field textarea { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #fff; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--red); }
.field textarea { min-height: 150px; resize: vertical; }
.hint { font-size: 12px; color: var(--muted); }
.form-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 22px; }

/* ---------- project page */
.back { font-size: 13px; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--red); }
.head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; margin-bottom: 22px; }
.meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 22px; }
.meta .box { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; }
.meta .val { font-weight: 700; margin-top: 3px; word-break: break-word; }
.desc { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; white-space: pre-wrap; margin-bottom: 14px; }
.tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 30px; }
.tag { font-size: 12px; border: 1px solid var(--red); color: var(--red); border-radius: 999px; padding: 2px 10px; }
.folder-path { font-family: Consolas, Menlo, monospace; font-size: 12px; background: var(--soft); padding: 2px 8px; border-radius: 6px; }

/* ---------- upload */
.drop { border: 2px dashed #cfcfcf; border-radius: var(--radius); padding: 34px; text-align: center; background: #fff; cursor: pointer; transition: border-color .15s, background .15s; margin-bottom: 14px; }
.drop:hover, .drop.over { border-color: var(--red); background: #fff7f7; }
.drop b { display: block; font-size: 17px; margin-bottom: 4px; }
.queue { display: flex; flex-direction: column; gap: 8px; margin-bottom: 26px; }
.qitem { display: grid; grid-template-columns: 1fr 120px 90px; gap: 12px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 13px; }
.qname { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar { height: 6px; background: var(--line); border-radius: 99px; overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: var(--red); transition: width .2s; }
.qstate { text-align: right; color: var(--muted); }
.qitem.done .qstate { color: #1a8a3a; }
.qitem.err .qstate { color: var(--red); }

/* ---------- files */
.section { margin-top: 28px; }
.section-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.count { font-size: 12px; font-weight: 700; color: var(--red); }
.thumbs { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.thumb { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.thumb .media { aspect-ratio: 4 / 3; background: #222; display: grid; place-items: center; overflow: hidden; }
.thumb .media > a { display: block; width: 100%; height: 100%; }
.thumb .media img, .thumb .media video { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .media .ext { color: #fff; font-weight: 800; letter-spacing: 2px; }
.thumb .info { padding: 8px 10px; font-size: 12px; }
.fname { font-weight: 700; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.factions { display: flex; gap: 6px; margin-top: 6px; }
.list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.lrow { display: grid; grid-template-columns: 1fr 100px 200px 150px; gap: 12px; align-items: center; padding: 10px 14px; border-top: 1px solid var(--line); font-size: 13px; background: #fff; }
.lrow:first-child { border-top: 0; }

/* ---------- login */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login-left { padding: 60px 70px; display: flex; flex-direction: column; justify-content: center; }
.login-left h1 { font-size: 42px; margin: 18px 0 12px; }
.login-left p { color: var(--muted); max-width: 440px; }
.login-right { background: var(--soft); display: grid; place-items: center; padding: 40px; }
.squares { display: grid; grid-template-columns: repeat(4, 84px); gap: 14px; }
.squares i { width: 84px; height: 84px; border-radius: 16px; background: #e4e4e4; }
.squares i.r { background: var(--red); }
.ms-btn { display: inline-flex; align-items: center; gap: 12px; margin-top: 26px; background: #fff; border: 1px solid #dadce0; padding: 11px 22px; font-weight: 700; text-decoration: none; border-radius: 999px; width: fit-content; box-shadow: 0 1px 2px rgba(0,0,0,.06); }
.ms-btn:hover { background: #f5f5f5; }
.alert { background: #fff1f0; border: 1px solid #f3c2bf; color: var(--red-dark); padding: 12px 14px; border-radius: 8px; margin-top: 18px; max-width: 440px; }
.dev { margin-top: 26px; padding: 16px; border: 1px dashed var(--line); border-radius: 8px; max-width: 440px; }
.dev input { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; margin: 6px 0 10px; }

.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--ink); color: #fff; padding: 11px 20px; border-radius: 999px; font-size: 14px; z-index: 50; box-shadow: var(--shadow); }
.toast.err { background: var(--red); }

@media (max-width: 860px) {
  .login { grid-template-columns: 1fr; }
  .login-right { display: none; }
  .login-left { padding: 40px 26px; }
  .fields { grid-template-columns: 1fr; }
  .brand-sub, .user span { display: none; }
  .lrow { grid-template-columns: 1fr 80px; }
  .lrow .hide-m { display: none; }
  .qitem { grid-template-columns: 1fr 70px; }
  .qitem .bar { display: none; }
}
