 
/* ===========================
   CABINET (scoped)
   =========================== */

.box{
  max-width: 860px;
  padding: 22px;

}

.box h1{
  margin: 4px 0 10px;
  font-size: 34px;
  line-height: 1.12;
}

.muted{ color:#666; }
.small{ font-size: 13px; }

/* local fixes you had */
/*#step4{ width: 500px; }
#imageContainer4{ width: initial; }*/

/* ===========================
   FORMS (only inside cabinet)
   =========================== */

#authBlock input,
#authBlock button,
#sessionBar button,
.copybtn{
  font: inherit;
}

#authBlock input{
  width: 100%;
  box-sizing: border-box;
  padding: 12px;
  margin: 10px 0;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  background: rgba(255,255,255,0.95);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

#authBlock input:focus{
  border-color: rgba(0,0,0,0.26);
  box-shadow: 0 0 0 4px rgba(0,0,0,0.05);
}

#authBlock button,
#sessionBar button{
  width: 100%;
  box-sizing: border-box;
  margin: 8px 0 0;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.14);
  background: #f6f6f6;
  cursor: pointer;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}

#authBlock button:hover,
#sessionBar button:hover{
  background:#f0f0f0;
  border-color: rgba(0,0,0,0.18);
}

#authBlock button:active,
#sessionBar button:active{
  transform: translateY(1px);
}

/* verify block spacing (when it appears) */
#verifyBlock{ margin-top: 6px; }

/* ===========================
   SESSION BAR
   =========================== */

.sessionbar{
  margin: 14px 0;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.72);
  display:flex;
  gap: 12px;
  align-items:center;
  justify-content: space-between;
}

.sessionbar-left{ min-width:0; }
#sessionText{ font-weight: 600; }

.sessionbar-right{ flex: 0 0 auto; }
.sessionbar-right button{
  width: auto;
  margin: 0;
  padding: 10px 14px;
}

/* ===========================
   MESSAGES
   =========================== */

#msg{
  margin-top: 10px;
  padding: 10px 12px;
  border-radius: 12px;
}
#msg:empty{ display:none; }

.ok{ color:#0a7a25; }
.err{ color:#b00020; }

#msg.ok{
  background:#f1fbf3;
  border:1px solid #cfe8d6;
  color:#0a7a25;
}
#msg.err{
  background:#fff3f5;
  border:1px solid #f2c6cc;
  color:#b00020;
}

/* ===========================
   LIST / CARD (if you render purchases into #list)
   =========================== */

#list{ margin-top: 10px; }

code{
  background: #eaeaea;
  padding: 2px 6px;
  border-radius: 6px;
  font-size: 14px;
}

/* Purchase card */
.row{
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.82);
  border-radius: 16px;
  padding: 14px;
  margin: 14px 0;

  display: grid;
  grid-template-columns: 1fr 240px;
  gap: 14px;
  align-items: stretch;

  box-shadow: 0 8px 18px rgba(0,0,0,0.04);
}

.row-left{ min-width: 0; }

.row-head{
  display:flex;
  align-items:center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.badges{
  display:flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items:center;
  min-width:0;
}

.badge{
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(246,246,246,0.9);
  font-size: 13px;
  line-height: 1;
  white-space: nowrap;
  max-width: 100%;
}

.badge code{
  background: transparent;
  padding: 0;
  font-weight: 600;
}

.chip{
  display:inline-flex;
  align-items:center;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.9);
  font-size: 13px;
  white-space: nowrap;
}
.chip.ok{ border-color: #cfe8d6; }
.chip.err{ border-color: #f2c6cc; }

.row-meta{
  display:grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px 12px;
  margin-bottom: 10px;
}

.meta{
  border: 1px solid rgba(0,0,0,0.06);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(250,250,250,0.9);
  min-width:0;
}

.meta .k{
  color:#666;
  font-size: 12px;
  margin-bottom: 6px;
}

.meta .v{
  font-size: 14px;
  overflow:hidden;
  text-overflow: ellipsis;
}

.idline{
  display:flex;
  align-items:center;
  gap: 10px;
  flex-wrap: wrap;
}

.idline code{
  padding: 4px 8px;
  border-radius: 10px;
  background: rgba(0,0,0,0.04);
}

.copybtn{
  width: auto;
  padding: 8px 10px;
  margin: 0;
  border: 1px solid rgba(0,0,0,0.12);
  border-radius: 10px;
  background: rgba(255,255,255,0.9);
  cursor: pointer;
}
.copybtn:active{ transform: translateY(1px); }

.actions{
  display:flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.actions a{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid rgba(0,0,0,0.12);
  text-decoration: none;
  background: rgba(255,255,255,0.9);
  color: inherit;
  transition: transform .05s ease, background .15s ease, border-color .15s ease;
}

.actions a:hover{
  background: rgba(246,246,246,0.95);
  border-color: rgba(0,0,0,0.18);
}
.actions a:active{ transform: translateY(1px); }

.actions a.primary{
  background: rgba(246,246,246,0.95);
  font-weight: 600;
}

/* preview */
.row-right{
  border: 1px solid rgba(0,0,0,0.08);
  border-radius: 14px;
  overflow: hidden;
  min-height: 220px;
}

.row-right img{
  width:100%;
  height:100%;
  display:block;
  object-fit: cover;

}

.preview-empty{
  display:flex;
  align-items:center;
  justify-content:center;
  height:100%;
  padding: 12px;
  color:#666;
  font-size: 13px;
}

/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 800px) {
  .row{ grid-template-columns: 1fr; }
  .row-right{ min-height: 240px; }
  .row-meta{ grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .box{ padding: 16px; border-radius: 14px; }
  .box h1{ font-size: 28px; }

  .sessionbar{
    flex-direction: column;
    align-items: stretch;
  }
  .sessionbar-right button{ width:100%; }

  .row-right img{ object-fit: contain; }
}


/* ===========================
   MOBILE FIXES (card header)
   =========================== */
@media (max-width: 600px) {

  /* Карточка ровнее + одинаковые отступы */
  .row{
    padding: 12px;
    border-radius: 16px;
    gap: 12px;
  }

  /* Хедер: сервис сверху, статус отдельной строкой -> ничего не наезжает */
  .row-head{
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
    justify-content: start;
    gap: 8px;
    margin-bottom: 10px;
  }

  /* Бейджи не растягиваем, разрешаем перенос и ужимаем */
  .badges{
    gap: 6px;
    min-width: 0;
  }

  .badge, .chip{
    font-size: 12px;
    padding: 6px 9px;
    max-width: 100%;
  }

  /* Важное: разрешаем бейджу с сервисом переноситься, а не давить статус */
  .badge{
    white-space: normal;          /* вместо nowrap */
    overflow-wrap: anywhere;
    line-height: 1.2;
  }

  /* Статус всегда “сам по себе”, не сжимается и не лезет на бейджи */
  .chip{
    justify-self: start;
  }

  /* Метаблоки и действия — ровнее */
  .row-meta{
    gap: 8px;
  }
  .meta{
    padding: 10px;
  }

  .actions{
    gap: 8px;
  }
  .actions a{
    width: 100%;                  /* кнопки в столбик, одинаковая ширина */
  }

  /* Превью: ровный блок фикс. высоты */
  .row-right{
    min-height: 220px;
  }
  .row-right img{
    height: 100%;
    object-fit: contain;
  }
}


/* SESSION BUTTON FIX */
#sessionBar .sessionbar-right{
  width: auto;
}

#sessionBar .sessionbar-right button{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;              /* desktop */
  min-width: 140px;
  padding: 10px 14px;
  margin: 0;
  line-height: 1.2;
  text-align: center;
}

/* mobile */
@media (max-width: 600px){
  #sessionBar .sessionbar-right{
    width: 100%;
  }
  #sessionBar .sessionbar-right button{
    width: 100%;
    min-width: 0;
  }
}

/* когда в meta только один блок (без "Действия") */
.row-meta--single{
  grid-template-columns: 1fr;
}

/* === COMPACT CARD (image right, smaller, no overlap) === */

.row{
  padding: 12px;
  border-radius: 14px;
  gap: 10px;

  /* левый блок резиновый, правый компактный */
  grid-template-columns: minmax(0, 1fr) 150px;
  align-items: start;
}

/* Хедер делаем в 2 строки: бейджи и статус не дерутся */
.row-head{
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 8px;
}

.badges{
  gap: 6px;
}

.badge, .chip{
  font-size: 12px;
  padding: 6px 9px;
}

.badge{
  white-space: nowrap; /* компактнее */
  max-width: 100%;
}

.row-head .chip{
  justify-self: start;     /* статус отдельной строкой слева */
  white-space: nowrap;
}

/* meta компактнее */
.row-meta{
  gap: 8px 10px;
  margin-bottom: 8px;
}
.meta{
  padding: 9px 10px;
  border-radius: 12px;
}
.meta .k{ font-size: 11px; margin-bottom: 4px; }
.meta .v{ font-size: 13px; }

/* кнопки компактнее */
.actions{
  gap: 8px;
}
.actions a{
  padding: 9px 10px;
  border-radius: 12px;
  font-size: 13px;
}

/* превью справа компактное и НЕ огромное */
.row-right{
  min-height: 150px;

  border-radius: 12px;
}
.row-right img{
  width: 100%;
  height: 100%;
  object-fit: contain;     /* всегда влезает */
  display: block;
}

/* ещё компактнее на очень узких */
@media (max-width: 520px){
  .row{
    grid-template-columns: 1fr;
  }
  .row-right{
    height: 180px;
    min-height: 180px;
  }
}

/* ВАЖНО: если у тебя было правило скрывать статус на мобиле — отменяем */
@media (max-width: 600px){
  .row-head .chip{ display: inline-flex !important; }
}
.row-meta--single{ grid-template-columns: 1fr; }