@import url('/app.css');

/* Админка использует токены и шрифты меню; ниже — только её компоненты */
.cosmos { display: none; }
body { min-height: 100dvh; }
.muted { color: var(--muted); }
.err { color: var(--heart); min-height: 1.2em; font-size: .875rem; }

/* ---------- Кнопки / поля ---------- */
.btn {
  height: 42px; padding: 0 16px; border-radius: 12px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-weight: 600; font-size: .9375rem; white-space: nowrap; border: 1px solid transparent;
  transition: transform .15s var(--ease), background-color .2s, opacity .2s, border-color .2s;
}
.btn svg { width: 18px; height: 18px; }
.btn:active { transform: scale(.97); }
.btn:disabled { opacity: .45; pointer-events: none; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: var(--line-2); }
.btn.ghost:hover { background: var(--line); }
.btn.danger { color: var(--heart); }
.btn.sm { height: 34px; padding: 0 12px; font-size: .8125rem; border-radius: 10px; }
.btn.big { height: 52px; font-size: 1rem; border-radius: 14px; }
.icon-btn.sm { width: 32px; height: 32px; }
.icon-btn.sm svg { width: 18px; height: 18px; }

.field { display: grid; gap: 8px; }
.field > span { font-size: .8125rem; font-weight: 600; letter-spacing: -.005em; }
.field > span i { color: var(--accent); font-style: normal; }
.field > span small { display: block; font-weight: 400; color: var(--muted); margin-top: 2px; font-size: .75rem; }
.field input, .field select, .field textarea, .dlg-input {
  width: 100%; background: var(--surface); color: var(--text); border: 1px solid var(--line-2); border-radius: 12px;
  font: 500 1rem var(--font); padding: 12px 14px; outline: none; transition: border-color .2s, box-shadow .2s;
}
.field select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 20px) 50%, calc(100% - 15px) 50%; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.field textarea { resize: vertical; line-height: 1.5; min-height: 64px; }
.field input:focus, .field select:focus, .field textarea:focus, .dlg-input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.row { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: end; }
.toggle-field { justify-items: start; }
.toggle-field .switch { margin-bottom: 5px; }

/* ---------- Вход ---------- */
.login { min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(60vmax 60vmax at 80% -10%, var(--accent-soft), transparent 60%); }
.login-card { width: min(380px, 100%); display: grid; gap: 22px; animation: rise .6s var(--ease-out) both; }
.login-logo { width: 74px; }
.login h1 { font-size: 2.5rem; letter-spacing: -.05em; line-height: 1; }

/* ---------- Каркас ---------- */
.shell { display: grid; grid-template-columns: 290px 1fr; min-height: 100dvh; }
.side {
  position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column;
  border-right: 1px solid var(--line); background: var(--bg-2); padding: 18px 12px;
}
.side-head { padding: 4px 10px 18px; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand img { width: 40px; }
.brand span { display: grid; line-height: 1.1; }
.brand small { font-family: var(--mono); font-size: .625rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-top: 3px; }
.side-title { display: flex; justify-content: space-between; align-items: center; padding: 8px 6px 8px 10px; }
.cat-list { flex: 1; overflow-y: auto; display: grid; align-content: start; gap: 2px; padding-bottom: 12px; }
.cat-row {
  display: grid; grid-template-columns: 18px 1fr auto; align-items: center; gap: 8px;
  padding: 10px 10px 10px 6px; border-radius: 12px; cursor: pointer; user-select: none;
  transition: background-color .2s, color .2s, transform .2s var(--ease);
}
.cat-row:hover { background: var(--line); }
.cat-row.active { background: var(--text); color: var(--bg); }
.cat-row.active .count, .cat-row.active .grip { color: inherit; opacity: .55; }
.cat-row .name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-row .count { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.cat-row.is-hidden .name { opacity: .45; text-decoration: line-through; }
.cat-row.drop-target { background: var(--accent-soft); outline: 2px dashed var(--accent); outline-offset: -2px; }
.grip { color: var(--faint); cursor: grab; touch-action: none; display: grid; place-items: center; height: 24px; }
.grip svg { width: 14px; height: 14px; }
.side-foot { border-top: 1px solid var(--line); padding-top: 10px; display: grid; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 10px; font-size: .875rem; font-weight: 500; color: var(--muted); text-align: left; }
.side-link svg { width: 18px; height: 18px; }
.side-link:hover { background: var(--line); color: var(--text); }

.main { min-width: 0; padding: 0 clamp(16px, 3vw, 40px) 60px; }
.main-head {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: flex-end; gap: 16px; flex-wrap: wrap;
  padding: 28px 0 20px; background: var(--glass); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--line); margin-bottom: 24px;
}
.menu-toggle { display: none; }
.main-title { flex: 1; min-width: 200px; display: grid; gap: 6px; }
.main-title h1 { font-size: clamp(2rem, 4vw, 3.25rem); letter-spacing: -.05em; line-height: 1; outline: none; border-radius: 8px; padding: 2px 6px; margin: -2px -6px; transition: background-color .2s; }
.main-title h1:hover { background: var(--line); }
.main-title h1:focus { background: var(--surface); box-shadow: 0 0 0 2px var(--accent); }
.main-actions { display: flex; gap: 8px; align-items: center; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: 12px; top: 50%; translate: 0 -50%; width: 18px; height: 18px; color: var(--muted); }
.search-box input { height: 42px; width: 260px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--surface); color: var(--text); font: 500 .9375rem var(--font); padding: 0 12px 0 38px; outline: none; }
.search-box input:focus { border-color: var(--accent); }

/* ---------- Позиции ---------- */
.items { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 18px; }
.card {
  position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden;
  cursor: pointer; display: flex; flex-direction: column; user-select: none;
  animation: rise .5s var(--ease-out) backwards;
  transition: transform .5s var(--ease-out), box-shadow .5s var(--ease-out), border-color .35s var(--ease);
}
.card-img { overflow: hidden; }
.card-img img { transition: transform .9s var(--ease-out); }
@media (hover: hover) {
  .card:hover { transform: translateY(-2px); box-shadow: 0 18px 40px -22px rgba(0,0,0,.55); border-color: var(--line-2); }
  .card:hover .card-img img { transform: scale(1.03); }
}
.card:active { transform: translateY(0) scale(.99); transition-duration: .2s; }
.card-img { aspect-ratio: 1; background: var(--img-bg); position: relative; }
.card-img img { width: 100%; height: 100%; object-fit: cover; }
.card-img .noimg { position: absolute; inset: 0; display: grid; place-items: center; color: var(--faint); font-size: .8125rem; gap: 6px; align-content: center; justify-items: center; }
.card-img .noimg svg { width: 30px; height: 30px; }
.card-body { padding: 12px 14px 14px; display: grid; gap: 4px; }
.card-body b { font-weight: 600; letter-spacing: -.02em; line-height: 1.2; }
.card-body .mono { color: var(--muted); }
.card .grip { position: absolute; top: 8px; left: 8px; width: 32px; height: 32px; border-radius: 10px; background: rgba(0,0,0,.5); color: #fff; backdrop-filter: blur(8px); opacity: 0; transition: opacity .2s; }
.card:hover .grip, .card.dragging .grip { opacity: 1; }
@media (hover: none) { .card .grip { opacity: 1; } }
.card .tag { position: absolute; top: 10px; right: 10px; background: rgba(0,0,0,.6); color: #fff; font: 500 .6875rem var(--mono); padding: 4px 8px; border-radius: 8px; backdrop-filter: blur(8px); }
.card.is-hidden .card-img img { opacity: .35; filter: grayscale(1); }
.card-new { border: 1.5px dashed var(--line-2); background: none; align-items: center; justify-content: center; min-height: 240px; color: var(--muted); gap: 10px; font-weight: 600; }
.card-new svg { width: 30px; height: 30px; }
.card-new:hover { color: var(--accent); border-color: var(--accent); }
.dragging { opacity: .5; transform: scale(.97) !important; box-shadow: none !important; z-index: 2; }
.drag-ghost { position: fixed; pointer-events: none; z-index: 100; opacity: .92; transform: rotate(2deg) scale(1.03); box-shadow: 0 30px 60px rgba(0,0,0,.5); transition: none; animation: none; }
.group-label { grid-column: 1 / -1; margin-top: 10px; }
.empty-state { grid-column: 1 / -1; padding: 60px 0; text-align: center; color: var(--muted); display: grid; gap: 10px; justify-items: center; }
.empty-state h3 { color: var(--text); font-size: 1.375rem; letter-spacing: -.03em; }

/* ---------- Редактор (выезжающая панель) ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 50; animation: fade .3s var(--ease); }
.drawer {
  position: fixed; z-index: 51; top: 0; right: 0; bottom: 0; width: min(1280px, calc(100vw - 64px));
  background: var(--bg); border-left: 1px solid var(--line); box-shadow: -30px 0 80px rgba(0,0,0,.35);
  animation: drawer-in .55s var(--ease-out);
}
.drawer.closing { animation: drawer-out .3s var(--ease) forwards; }
@keyframes drawer-in { from { transform: translateX(100%); } }
@keyframes drawer-out { to { transform: translateX(100%); } }
.drawer-form { height: 100%; display: flex; flex-direction: column; }
.drawer-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; padding: calc(var(--safe-top) + 20px) 24px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 1.75rem; letter-spacing: -.04em; line-height: 1.05; margin-top: 4px; max-width: 640px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.drawer-head-actions { display: flex; gap: 8px; align-items: center; }
.drawer-body { flex: 1; overflow-y: auto; padding: 22px 24px 32px; display: grid; gap: 22px; align-content: start; }
.drawer-foot { display: flex; gap: 8px; align-items: center; padding: 14px 24px calc(var(--safe-bottom) + 14px); border-top: 1px solid var(--line); }
.save-state { margin-left: auto; color: var(--muted); }

.photo-field { display: grid; gap: 10px; }
.photo-drop {
  position: relative; aspect-ratio: 1; border-radius: 18px; overflow: hidden; cursor: pointer;
  background: var(--surface); border: 1.5px dashed var(--line-2); transition: border-color .2s, background-color .2s;
}
.photo-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; display: none; }
.photo-drop.has img { display: block; }
.photo-drop.has { border-style: solid; border-color: var(--line); }
.photo-empty { position: absolute; inset: 0; display: grid; place-content: center; justify-items: center; gap: 8px; color: var(--muted); text-align: center; padding: 20px; font-size: .875rem; }
.photo-empty svg { width: 36px; height: 36px; margin-bottom: 4px; }
.photo-empty b { color: var(--text); font-size: 1rem; }
.photo-drop.has .photo-empty { display: none; }
.photo-progress { position: absolute; left: 0; right: 0; bottom: 0; height: 3px; opacity: 0; transition: opacity .3s; }
.photo-progress i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s var(--ease); }
.photo-drop.uploading .photo-progress { opacity: 1; }
/* Кнопки поверх фото: появляются при наведении */
.photo-tools { position: absolute; top: 10px; right: 10px; display: flex; gap: 6px; opacity: 0; transform: translateY(-4px); transition: opacity .3s var(--ease), transform .4s var(--ease-out); }
.photo-drop.has:hover .photo-tools { opacity: 1; transform: none; }
.photo-drop:not(.has) .photo-tools { display: none; }
.photo-tools button { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; color: #fff; background: rgba(10,11,10,.55); backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px); transition: background-color .2s; }
.photo-tools button svg { width: 18px; height: 18px; }
.photo-tools button:hover { background: rgba(10,11,10,.8); }
.photo-tools #photoRemove:hover { background: var(--heart); }

.editor { border: 1px solid var(--line-2); border-radius: 12px; overflow: hidden; background: var(--surface); transition: border-color .2s, box-shadow .2s; }
.editor:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.editor textarea { border: 0 !important; box-shadow: none !important; border-radius: 0; }
.toolbar { display: flex; gap: 2px; padding: 6px; border-bottom: 1px solid var(--line); align-items: center; }
.toolbar button { height: 30px; min-width: 30px; padding: 0 10px; border-radius: 8px; font-size: .8125rem; font-weight: 500; color: var(--muted); }
.toolbar button:hover { background: var(--line); color: var(--text); }
.toolbar-hint { margin-left: auto; color: var(--muted); padding-right: 6px; }
.mono-area { font-family: var(--mono) !important; font-size: .875rem !important; line-height: 1.7 !important; }

.seg { display: flex; background: var(--bg-2); border-radius: 12px; padding: 3px; border: 1px solid var(--line); }
.seg button { padding: 7px 12px; border-radius: 9px; font-size: .8125rem; font-weight: 600; color: var(--muted); transition: all .25s var(--ease); }
.seg button.on { background: var(--surface-2); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

/* Превью карточки в редакторе — те же компоненты, что в меню */
.preview-pane { padding-top: 0; }
.pv { padding-top: 22px; }
.pv .detail { grid-template-columns: 1fr !important; gap: 24px; }
.pv .detail-media { position: static !important; margin: 0 !important; }
.pv .detail-photo { border-radius: 20px !important; }
.pv .detail-name { font-size: 2.5rem; }

/* ---------- Диалог / поповер ---------- */
.dialog { margin: auto; border: 0; border-radius: 22px; padding: 26px; width: min(440px, calc(100% - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dialog[open] { animation: rise .35s var(--ease-out); }
.dialog::backdrop { background: rgba(0,0,0,.55); backdrop-filter: blur(4px); }
.dialog h3 { font-size: 1.375rem; letter-spacing: -.03em; margin-bottom: 8px; }
.dialog p { line-height: 1.5; }
.dlg-input { margin-top: 16px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.dialog.danger #dlgOk { background: var(--heart); color: #fff; }

.popover { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--line-2); border-radius: 14px; padding: 6px; display: grid; min-width: 220px; box-shadow: var(--shadow); animation: rise .25s var(--ease-out); }
.popover button { text-align: left; padding: 10px 12px; border-radius: 9px; font-weight: 500; font-size: .9375rem; }
.popover button:hover { background: var(--line); }
.popover .danger { color: var(--heart); }

.toast { bottom: 24px; }
.toast.error::before { background: var(--heart); }

/* ---------- Адаптив: админка на планшете / телефоне ---------- */
@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; z-index: 45; left: 0; width: min(300px, 86vw); transform: translateX(-102%); transition: transform .45s var(--ease-out); box-shadow: 30px 0 60px rgba(0,0,0,.3); }
  .shell.side-open .side { transform: none; }
  .shell.side-open::after { content: ''; position: fixed; inset: 0; z-index: 44; background: rgba(0,0,0,.45); animation: fade .3s; }
  .menu-toggle { display: grid; margin-left: -10px; }
  .main-head { padding-top: calc(var(--safe-top) + 16px); }
  .main-actions { width: 100%; }
  .search-box { flex: 1; }
  .search-box input { width: 100%; }
  .items { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
  .card-new { min-height: 180px; }
}
@media (max-width: 560px) {
  .drawer-head { flex-wrap: wrap; }
  .drawer-body { padding: 18px 16px 28px; }
  .drawer-foot { padding-inline: 16px; flex-wrap: wrap; }
  .row { grid-template-columns: 1fr; }
  #addItem span { display: none; }
}

/* ---------- Редактор: две колонки, состав и технология — построчно ---------- */
.editor-grid { grid-template-columns: 340px minmax(0, 1fr); gap: 40px; align-items: start; padding: 28px 32px 48px; }
.col-main { display: grid; gap: 20px; position: sticky; top: 0; }
.col-rows { display: grid; gap: 36px; min-width: 0; }

.block { display: grid; gap: 0; }
.block-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.block-head h3 { font-size: 1.375rem; letter-spacing: -.035em; font-weight: 650; }

.rows-head, .irow { display: grid; grid-template-columns: 22px 30px minmax(0, 1fr) 120px 32px; gap: 8px; align-items: center; }
.rows-head.steps-head, .irow.step { grid-template-columns: 22px 30px 150px minmax(0, 1fr) 32px; align-items: start; }
.rows-head { padding: 0 0 8px; border-bottom: 1px solid var(--line); font-family: var(--mono); font-size: .6875rem; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.rows-head span:nth-child(4) { text-align: right; padding-right: 12px; }
.rows-head.steps-head span:nth-child(4) { text-align: left; padding-left: 12px; }
.rows-head span:nth-child(3) { padding-left: 12px; }

.rows { display: grid; }
.irow { padding: 5px 0; border-bottom: 1px solid var(--line); background: var(--bg); animation: row-in .3s var(--ease-out); }
@keyframes row-in { from { opacity: 0; transform: translateY(-4px); } }
.irow .grip { opacity: .0; transition: opacity .2s; height: 40px; }
.irow:hover .grip, .irow:focus-within .grip { opacity: 1; }
.irow .idx { color: var(--faint); font-size: .75rem; padding-top: 1px; }
.irow.step .grip, .irow.step .idx, .irow.step .r-del { margin-top: 4px; }
.irow.step .idx { line-height: 40px; }
.irow input, .irow textarea {
  width: 100%; height: 40px; border: 1px solid transparent; border-radius: 10px; background: transparent; color: var(--text);
  font: 500 .9375rem/1.45 var(--font); padding: 0 12px; outline: none;
  transition: background-color .2s, border-color .2s, box-shadow .2s;
}
.irow textarea { resize: none; padding: 9px 12px; min-height: 40px; overflow: hidden; display: block; }
.irow input:hover, .irow textarea:hover { background: var(--surface); }
.irow input:focus, .irow textarea:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.irow .r-qty { font-family: var(--mono); font-size: .9375rem; text-align: right; }
.irow .r-label { font-family: var(--mono); font-size: .75rem; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
.irow .r-label::placeholder { color: var(--faint); }
.irow input::placeholder, .irow textarea::placeholder { color: var(--faint); }
.r-del { width: 32px; height: 32px; border-radius: 9px; display: grid; place-items: center; color: var(--faint); opacity: 0; transition: opacity .2s, background-color .2s, color .2s; }
.r-del svg { width: 16px; height: 16px; }
.irow:hover .r-del, .irow:focus-within .r-del { opacity: 1; }
.r-del:hover { background: color-mix(in srgb, var(--heart) 14%, transparent); color: var(--heart); }
.irow.dragging { opacity: .35; }
.irow.drag-ghost { border: 1px solid var(--line-2); border-radius: 12px; background: var(--surface); padding-inline: 4px; }

.add-row {
  display: flex; align-items: center; gap: 10px; height: 46px; padding: 0 12px 0 60px; margin-top: 2px;
  color: var(--muted); font-weight: 600; font-size: .875rem; border-radius: 12px; text-align: left;
  transition: color .2s, background-color .2s;
}
.add-row svg { width: 18px; height: 18px; }
.add-row:hover { color: var(--accent); background: var(--accent-soft); }

.weight-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; padding: 14px 16px 14px 60px; border-radius: 14px; background: var(--surface); }
.weight-row label { font-weight: 600; font-size: .9375rem; flex: 1; }
.weight-input { display: flex; align-items: center; gap: 8px; }
.weight-input input { width: 110px; height: 42px; border: 1px solid var(--line-2); border-radius: 10px; background: var(--bg); color: var(--text); font: 600 1.125rem var(--mono); text-align: right; padding: 0 12px; outline: none; }
.weight-input input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.weight-input span { font-family: var(--mono); color: var(--muted); }
/* Выход: считается автоматически из граммовок, пока его не поменяли вручную */
.auto-badge { height: 30px; padding: 0 12px; border-radius: 15px; font: 500 .75rem var(--mono); color: var(--muted); border: 1px solid var(--line-2); transition: all .3s var(--ease); white-space: nowrap; }
.auto-badge.on { color: var(--accent); border-color: transparent; background: var(--accent-soft); cursor: default; }
.auto-badge:not(.on):hover { color: var(--accent); border-color: var(--accent); }
.weight-input input.auto { color: var(--accent); }
.foot-toggle { display: flex; align-items: center; gap: 10px; font-size: .875rem; font-weight: 600; margin-right: 8px; cursor: pointer; }

@media (max-width: 1100px) {
  .editor-grid { grid-template-columns: 1fr; }
  .col-main { position: static; grid-template-columns: 240px 1fr; align-items: start; }
  .col-main .photo-field { grid-row: span 4; }
}

/* ---------- kult.: шапка админки и бренды ---------- */
.login-mark { font-size: 3.5rem; }
.kult-home { display: flex; align-items: baseline; gap: 10px; }
.kult-home .wordmark { font-size: 1.75rem; }
.kult-home small { font-family: var(--mono); font-size: .625rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }

.brand-switch { display: flex; gap: 4px; align-items: center; padding: 0 2px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.brand-current {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 8px; border-radius: 14px; text-align: left;
  border: 1px solid var(--line-2); background: var(--surface); transition: border-color .25s var(--ease), background-color .25s;
}
.brand-current:hover { border-color: var(--muted); }
.bc-logo { width: 40px; height: 40px; border-radius: 11px; display: grid; place-items: center; flex: none; overflow: hidden; }
.bc-logo img { width: 72%; height: 72%; object-fit: contain; }
.bc-logo i { font-style: normal; font-weight: 800; font-size: 1.125rem; }
.bc-logo.sm { width: 30px; height: 30px; border-radius: 9px; }
.bc-logo.sm i { font-size: .875rem; }
.bc-text { display: grid; min-width: 0; line-height: 1.15; }
.bc-text small { font-family: var(--mono); font-size: .625rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.bc-text b { font-weight: 700; letter-spacing: -.02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bc-caret { width: 18px; height: 18px; margin-left: auto; color: var(--muted); flex: none; }

.brand-menu { padding: 6px; }
.brand-list { display: grid; gap: 2px; max-height: 50vh; overflow-y: auto; }
.brand-opt { display: grid; grid-template-columns: 16px 30px 1fr auto; gap: 10px; align-items: center; padding: 7px 10px 7px 4px; border-radius: 10px; cursor: pointer; user-select: none; background: var(--surface); }
.brand-opt:hover { background: var(--line); }
.brand-opt.on { background: var(--accent-soft); }
.brand-opt .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-opt .count { font-family: var(--mono); font-size: .75rem; color: var(--muted); }
.brand-opt.is-hidden .name { opacity: .45; text-decoration: line-through; }
.brand-opt .grip { opacity: 0; transition: opacity .2s; }
.brand-opt:hover .grip { opacity: 1; }
.add-brand { display: flex !important; align-items: center; gap: 10px; color: var(--accent); font-weight: 600 !important; border-top: 1px solid var(--line); border-radius: 0 0 9px 9px !important; margin-top: 4px; }
.add-brand svg { width: 18px; height: 18px; }

.brand-dlg { width: min(860px, calc(100% - 32px)); }
.bd-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px; margin-top: 18px; }
.bd-fields { display: grid; gap: 18px; align-content: start; }
.logo-drop { position: relative; height: 120px; border-radius: 14px; border: 1.5px dashed var(--line-2); display: grid; place-items: center; cursor: pointer; background: var(--bg); transition: border-color .2s, background-color .2s; }
.logo-drop.over { border-color: var(--accent); background: var(--accent-soft); }
.logo-drop img { max-width: 70%; max-height: 80px; object-fit: contain; display: none; }
.logo-drop.has img { display: block; }
.logo-drop.has .logo-empty { display: none; }
.logo-empty { color: var(--muted); font-size: .875rem; }
.colors { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.color-input { display: flex; gap: 8px; align-items: center; }
.color-input input[type="color"] { width: 46px; height: 46px; padding: 3px; border-radius: 12px; cursor: pointer; flex: none; }
.color-input .hex { font-family: var(--mono) !important; text-transform: uppercase; }
.bd-preview { display: grid; gap: 12px; align-content: start; }
.bd-preview .brand-tile { pointer-events: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.swatches .label { width: 100%; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; box-shadow: inset 0 0 0 1px rgba(0,0,0,.2); transition: transform .2s var(--ease); }
.swatches button:hover { transform: scale(1.12); }
.text-btn.sm { padding: 6px 0; font-size: .8125rem; justify-self: start; }
.dialog-actions { align-items: center; }

.pw-fields { display: grid; gap: 14px; margin-top: 18px; }
#pwDlg .err { margin-top: 10px; }
