.tb-wrap {
  max-width: 480px;
  margin: 1.5rem auto;
  font-family: 'Sora', sans-serif;
}
.tb-wrap p,
.tb-wrap p:empty {
  margin: 0 !important;
  padding: 0 !important;
}
.tb-wrap .mode-group {
  display: flex;
  gap: 10px;
  margin-bottom: 10px;
}

.tb-wrap .mode-btn {
  flex: 1;
  height: 54px;
  border-radius: 12px;
  font-family: 'Sora', sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  border: 2px solid #dedad3;
  background: #f0ede8;
  color: #b0ada8;
}

.tb-wrap .mode-btn .mode-label { font-size: 15px; font-weight: 700; }
.tb-wrap .mode-btn .mode-sub   { font-size: 12px; font-weight: 400; opacity: 0.8; font-family: 'DM Mono', monospace; }

.tb-wrap .mode-btn.active-sarj {
  background: #2a5cff;
  border-color: #2a5cff;
  color: #fff;
  box-shadow: 0 4px 14px rgba(42, 92, 255, 0.35);
}

.tb-wrap .mode-btn.active-desarj {
  background: #d85a30;
  border-color: #d85a30;
  color: #fff;
  box-shadow: 0 4px 14px rgba(216, 90, 48, 0.35);
}

.tb-wrap .mode-btn:not(.active-sarj):not(.active-desarj):hover {
  border-color: #b0ada8;
  color: #7a7670;
}

.tb-wrap .top-card {
  background: #fff;
  border: 1px solid #dedad3;
  border-radius: 14px;
  padding: 1.25rem;
  margin-bottom: 10px;
}

.tb-wrap .top-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tb-wrap .top-lbl {
  font-size: 13px;
  font-weight: 600;
  color: #7a7670;
  width: 90px;
  flex-shrink: 0;
  font-family: 'DM Mono', monospace;
}

.tb-wrap .top-unit {
  font-size: 13px;
  color: #7a7670;
  font-family: 'DM Mono', monospace;
  flex-shrink: 0;
}

.tb-wrap .top-input {
  height: 42px;
  border: 1.5px solid #dedad3;
  border-radius: 8px;
  background: #f0ede8;
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  font-weight: 500;
  color: #1a1916;
  padding: 0 12px;
  outline: none;
  flex: 1;
  transition: border-color 0.15s, background 0.15s;
}

.tb-wrap .top-input:focus {
  border-color: #2a5cff;
  background: #fff;
}

.tb-wrap .top-hint {
  font-size: 12px;
  color: #777;
  margin-top: 6px;
  font-style: italic;
  padding-left: 98px;
}

.tb-wrap .field-box {
  border-radius: 14px;
  padding: 1rem 1.25rem;
  margin-bottom: 10px;
}

.tb-wrap .field-box.r-box { background: #EEF1FF; border: 1.5px solid #b8c4f8; }
.tb-wrap .field-box.c-box { background: #E6F7F3; border: 1.5px solid #8fd5c0; }
.tb-wrap .field-box.v-box { background: #F3EEFF; border: 1.5px solid #c9b0f5; }

.tb-wrap .field-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.tb-wrap .field-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'DM Mono', monospace;
  font-size: 13px;
  font-weight: 700;
  flex-shrink: 0;
}

.tb-wrap .r-box .field-icon { background: #2a5cff; color: #fff; }
.tb-wrap .c-box .field-icon { background: #1E8455; color: #fff; }
.tb-wrap .v-box .field-icon { background: #7c3aed; color: #fff; }

.tb-wrap .field-input {
  height: 42px;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 15px;
  font-weight: 500;
  color: #1a1916;
  padding: 0 12px;
  outline: none;
  flex: 1;
  width: 85px !important;
  transition: border-color 0.15s, background 0.15s;
}

.tb-wrap .r-box .field-input { background: #dce3ff; }
.tb-wrap .r-box .field-input:focus { border-color: #2a5cff; background: #fff; }
.tb-wrap .c-box .field-input { background: #c8ede3; }
.tb-wrap .c-box .field-input:focus { border-color: #1E8455; background: #fff; }
.tb-wrap .v-box .field-input { background: #e9d8fd; }
.tb-wrap .v-box .field-input:focus { border-color: #7c3aed; background: #fff; }

.tb-wrap .field-hint {
  font-size: 12px;
  color: #777;
  margin-top: 6px;
  font-style: italic;
  padding-left: 42px;
}

.tb-wrap .unit-group {
  display: flex;
  gap: 5px;
  flex-shrink: 0;
}

.tb-wrap .unit-btn {
  height: 34px;
  padding: 0 12px;
  border-radius: 8px;
  font-family: 'DM Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  border: 1.5px solid rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.6);
  color: #7a7670;
  white-space: nowrap;
}

.tb-wrap .r-box .unit-btn.active { background: #2a5cff !important; color: #fff !important; border-color: #2a5cff !important; }
.tb-wrap .c-box .unit-btn.active { background: #1E8455 !important; color: #fff !important; border-color: #1E8455 !important; }
.tb-wrap .v-box .unit-btn.active { background: #7c3aed !important; color: #fff !important; border-color: #7c3aed !important; }

.tb-wrap .result-card {
  border: 1.5px solid #dedad3;
  border-radius: 14px;
  padding: 1.25rem 1.25rem 1rem;
  margin-bottom: 10px;
  transition: border-color 0.2s, background 0.2s;
  background: #f5f3ff;
}

.tb-wrap .result-card.has-result.sarj   { border-color: #2a5cff; background: #eef1ff; }
.tb-wrap .result-card.has-result.desarj { border-color: #d85a30; background: #fff0ee; }

.tb-wrap .result-hdr {
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.07em;
  /*text-transform: uppercase;*/
  color: #7a7670;
  margin-bottom: 10px;
}

.tb-wrap .formula-strip {
  background: #1a1916;
  border-radius: 8px;
  padding: 10px 16px;
  margin-bottom: 14px;
  display: inline-block;
}

.tb-wrap .fm {
  font-family: Georgia, serif;
  font-size: 17px;
  color: #f5f4f0;
  white-space: nowrap;
}

.tb-wrap .fm sub,
.tb-wrap .fm sup { color: #a8c4ff; font-size: 11px; }

.tb-wrap .result-main {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 12px;
}

.tb-wrap .result-big {
  font-family: 'DM Mono', monospace;
  font-size: 38px;
  font-weight: 500;
  line-height: 1;
}

.tb-wrap .result-big-unit {
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  color: #7a7670;
}

.tb-wrap .sarj-color   { color: #2a5cff; }
.tb-wrap .desarj-color { color: #d85a30; }

.tb-wrap .result-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.tb-wrap .r-item {
  background: #fff;
  border-radius: 8px;
  padding: 10px 12px;
}

.tb-wrap .r-item-lbl {
  font-size: 12px;
  color: #7a7670;
  font-weight: 600;
  letter-spacing: 0.05em;
  /*text-transform: uppercase;*/
  margin-bottom: 5px;
}

.tb-wrap .r-item-val {
  font-family: 'DM Mono', monospace;
  font-size: 16px;
  font-weight: 500;
  color: #1a1916;
}

.tb-wrap .r-item-unit {
  font-size: 11px;
  color: #7a7670;
  font-family: 'DM Mono', monospace;
}

.tb-wrap .placeholder-txt {
  font-size: 14px;
  color: #7a7670;
  font-family: 'DM Mono', monospace;
}

.tb-wrap .error-msg {
  color: #b03a2e;
  font-size: 13px;
  font-family: 'DM Mono', monospace;
}

.tb-wrap .reset-btn {
  width: 100%;
  height: 40px;
  border: 1.5px solid #dedad3;
  border-radius: 8px;
  background: transparent;
  font-family: 'Sora', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #7a7670;
  cursor: pointer;
  transition: all 0.15s;
}

.tb-wrap .reset-btn:hover {
  border-color: #b03a2e;
  color: #b03a2e;
}

@media (max-width: 420px) {
  .tb-wrap .result-grid { grid-template-columns: 1fr; }
  .tb-wrap .top-hint,
  .tb-wrap .field-hint  { padding-left: 0; margin-top: 6px; }
  .tb-wrap .unit-group  { flex-wrap: wrap; }
}
