:root { color-scheme: dark; }
* { box-sizing: border-box; margin: 0; }
body {
  background: #141210; color: #e8e2d9;
  font: 16px/1.5 system-ui, -apple-system, sans-serif;
  padding: 20px; padding-bottom: 60px;
}
a { color: inherit; text-decoration: none; }
.muted { color: #a89f92; font-size: 14px; }

/* ---- шапка / панель ---- */
.topbar { margin-bottom: 18px; }
.topbar h1 { font-size: 21px; font-weight: 600; }
.topbar a { color: #a89f92; }
.topbar a:active, .topbar a:hover { color: #e8e2d9; }
.sep { color: #4a443c; }
.bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 16px; }

.btn {
  display: inline-block; background: #2a2620; color: #e8e2d9; border: 0;
  padding: 9px 15px; border-radius: 9px; font-size: 14px; cursor: pointer;
}
.btn:hover { background: #3a342c; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-accent { background: #6b5335; }
.btn-accent:hover { background: #7d6240; }

/* ---- сетки и карточки ---- */
.grid {
  display: grid; gap: 12px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}
.card {
  position: relative; border-radius: 12px; overflow: hidden; background: #1e1b17;
}
.card img, .card-noimg {
  width: 100%; aspect-ratio: 2/3; object-fit: cover; display: block;
}
.card-noimg { display: flex; align-items: center; justify-content: center; font-size: 46px; }
.card .meta { padding: 10px 12px; font-size: 13px; color: #a89f92; }
.card .meta b { display: block; color: #e8e2d9; font-size: 14px; font-weight: 600;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.badge {
  position: absolute; top: 10px; left: 10px; font-size: 12px;
  padding: 3px 9px; border-radius: 7px; background: rgba(0,0,0,.6);
}
.badge-busy { background: #6b5335; animation: pulse 1.6s infinite; }
.badge-wait { background: #35566b; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---- плитки борда ---- */
.tile {
  position: relative; border-radius: 10px; overflow: hidden;
  background: #1e1b17; cursor: zoom-in;
}
.tile img { width: 100%; display: block; }
.tile .n, .tile .src {
  position: absolute; top: 8px; background: rgba(0,0,0,.55);
  padding: 2px 8px; border-radius: 6px; font-size: 12px;
}
.tile .n { left: 8px; }
.tile .src { right: 8px; }
.tile-actions {
  position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px;
  opacity: 0; transition: opacity .15s;
}
.tile:hover .tile-actions { opacity: 1; }
@media (hover: none) { .tile-actions { opacity: 1; } }
.act {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 34px; height: 34px; border: 0; border-radius: 8px;
  background: rgba(0,0,0,.6); color: #e8e2d9; font-size: 15px; cursor: pointer;
}
.act:hover { background: rgba(40,36,30,.95); }
.act-del:hover { background: #8c2f2f; }
.tile-trash { cursor: default; }
.tile-trash img { filter: grayscale(.7) brightness(.6); }

.trash, .passport { margin-top: 26px; }
.trash summary, .passport summary { cursor: pointer; color: #a89f92; margin-bottom: 12px; font-size: 15px; }
.passport pre {
  background: #1e1b17; border-radius: 12px; padding: 14px 16px;
  white-space: pre-wrap; font: 14px/1.55 system-ui, sans-serif; color: #cfc4b4;
}
.card .meta .desc { display: block; color: #cfc4b4; margin: 2px 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.btn-danger:hover { background: #6e2a2a; }
.board-tools { margin-top: 30px; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; }
.inline-form select, .new-form select, .new-form input[type=text],
.new-form textarea {
  background: #1e1b17; border: 1px solid #3a342c; border-radius: 9px;
  color: #e8e2d9; padding: 9px 12px; font-size: 15px;
}
.tile-pending { cursor: default; aspect-ratio: 2/3; display: flex;
  align-items: center; justify-content: center; text-align: center; }
.pending-inner { font-size: 15px; line-height: 1.7; padding: 8px; }

/* ---- форма нового борда ---- */
.new-form { max-width: 560px; display: flex; flex-direction: column; gap: 16px; }
.new-form .field { display: flex; flex-direction: column; gap: 6px; }
.new-form label { font-size: 14px; color: #a89f92; }
.new-form .radio { display: inline-flex; gap: 8px; align-items: center;
  color: #e8e2d9; font-size: 15px; margin-right: 18px; }
.new-form textarea { resize: vertical; }
.new-form input[type=file] { color: #a89f92; font-size: 14px; }
.dropzone {
  border: 1.5px dashed #3a342c; border-radius: 12px; padding: 16px;
  display: flex; flex-direction: column; gap: 10px; transition: border-color .15s;
}
.dropzone.drag { border-color: #b08d57; background: #1e1b17; }
.dropzone p { font-size: 13px; }
#dz-preview { max-width: 220px; max-height: 220px; border-radius: 8px; object-fit: cover; }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }

/* ---- проверка паспорта стиля ---- */
.passport-edit {
  max-width: 720px; background: #1e1b17; border-radius: 12px;
  padding: 18px; margin-bottom: 20px;
}
.passport-edit h2 { font-size: 17px; margin-bottom: 6px; }
.passport-edit form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.passport-edit textarea {
  width: 100%; background: #141210; border: 1px solid #3a342c; border-radius: 9px;
  color: #e8e2d9; padding: 10px 12px; font: 14px/1.55 system-ui, sans-serif;
  resize: vertical;
}
.passport-edit .bar { margin-bottom: 0; }

/* ---- прогресс до-гена ---- */
.refill-box {
  background: #1e1b17; border-radius: 12px; padding: 14px 16px; margin-bottom: 16px;
}
.refill-line { font-size: 14px; margin-bottom: 8px; }
.progress { height: 8px; background: #2a2620; border-radius: 5px; overflow: hidden; }
.progress-fill {
  height: 100%; width: 0; background: #b08d57; border-radius: 5px;
  transition: width .6s;
}
.hypo { margin-top: 10px; font-size: 14px; color: #cfc4b4; }

/* ---- лайтбокс ---- */
#lb {
  position: fixed; inset: 0; background: rgba(0,0,0,.93); display: none;
  align-items: center; justify-content: center; z-index: 9;
}
#lb figure { max-width: 92vw; max-height: 92vh; text-align: center; }
#lb img { max-width: 92vw; max-height: 86vh; border-radius: 6px; }
#lb figcaption { color: #a89f92; font-size: 13px; margin-top: 8px; }
.lb-nav {
  position: fixed; top: 50%; transform: translateY(-50%);
  font-size: 36px; color: #e8e2d9; background: none; border: 0;
  cursor: pointer; padding: 18px; z-index: 10;
}
#lb-prev { left: 4px; } #lb-next { right: 4px; }
#lb-close {
  position: fixed; top: 10px; right: 16px; font-size: 26px;
  background: none; border: 0; color: #e8e2d9; cursor: pointer; z-index: 10;
}

/* ---- вход ---- */
.login-wrap { min-height: 82vh; display: flex; align-items: center; justify-content: center; }
.login-box {
  background: #1e1b17; padding: 34px 30px; border-radius: 14px;
  display: flex; flex-direction: column; gap: 14px; width: min(92vw, 330px);
}
.login-box h1 { font-size: 20px; text-align: center; }
.login-box input {
  background: #141210; border: 1px solid #3a342c; border-radius: 9px;
  color: #e8e2d9; padding: 11px 13px; font-size: 16px;
}
.login-box input:focus { outline: none; border-color: #6b5335; }
.login-error { color: #d98383; font-size: 14px; text-align: center; }

/* ---- главная: поиск, папки, дни ---- */
.search {
  margin-left: auto; background: #1e1b17; border: 1px solid #3a342c;
  border-radius: 9px; color: #e8e2d9; padding: 9px 12px; font-size: 14px;
  width: min(320px, 100%);
}
.search:focus { outline: none; border-color: #6b5335; }
.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip {
  background: #1e1b17; border: 1px solid #3a342c; color: #a89f92;
  border-radius: 20px; padding: 6px 13px; font-size: 13px; cursor: pointer;
}
.chip:hover { color: #e8e2d9; }
.chip.on { background: #6b5335; border-color: #6b5335; color: #e8e2d9; }
.day-group { margin-bottom: 28px; }
.day-head {
  display: flex; align-items: center; gap: 10px;
  font-size: 15px; font-weight: 600; color: #cfc4b4; margin-bottom: 12px;
}
.day-head::after { content: ""; flex: 1; height: 1px; background: #2a2620; }
.day-count { color: #7d7466; font-weight: 400; font-size: 13px; }
mark { background: #b08d57; color: #141210; border-radius: 3px; padding: 0 1px; }
.folder-select {
  margin-top: 7px; width: 100%; background: #141210; border: 1px solid #2a2620;
  border-radius: 7px; color: #a89f92; padding: 4px 8px; font-size: 12px;
}

/* ---- телефон ---- */
@media (max-width: 600px) {
  body { padding: 12px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .grid.boards { grid-template-columns: 1fr 1fr; }
  .topbar h1 { font-size: 18px; }
}
