/* ============================================================================
   SESTO.SENSO Portal — Telegram tab styles
   ============================================================================ */

/* ----- Shell ----- */
.tg-tab-shell {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.tg-tab-error {
  padding: 16px;
  border: 1px solid var(--border, #e5e5e5);
  background: var(--bg-warn-soft, #fff8f0);
  border-radius: 8px;
  color: var(--text-fg, #1a1a1a);
  font-size: 14px;
  line-height: 1.5;
}

/* ----- Sub-tab strip ----- */
.tg-subtabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border, #e5e5e5);
  padding-bottom: 0;
  margin-bottom: 0;
}

.tg-subtab {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 16px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted, #6b6b6b);
  cursor: pointer;
  transition: color 120ms, border-color 120ms;
}
.tg-subtab:hover { color: var(--text-fg, #1a1a1a); }
.tg-subtab.is-active {
  color: var(--text-fg, #1a1a1a);
  border-bottom-color: var(--brand, #e60074);
}

.tg-tab-body {
  min-height: 200px;
}

.tg-subtab-loading,
.tg-comp-loading {
  padding: 32px;
  text-align: center;
  color: var(--text-muted, #6b6b6b);
  font-size: 14px;
}

.tg-subtab-stub {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-muted, #6b6b6b);
}
.tg-subtab-stub-mark { font-size: 32px; color: var(--text-faint, #999); margin-bottom: 12px; }
.tg-subtab-stub-title { font-size: 18px; font-weight: 600; color: var(--text-fg, #1a1a1a); margin-bottom: 8px; }
.tg-subtab-stub-text { font-size: 13px; max-width: 480px; margin: 0 auto; line-height: 1.6; }

/* ============================================================================
   Composer
   ============================================================================ */

.tg-comp-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1000px) {
  .tg-comp-layout { grid-template-columns: 1fr; }
}

.tg-comp-col-form,
.tg-comp-col-preview {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Section blocks */
.tg-comp-section {
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
  padding: 14px 16px;
}

.tg-comp-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-muted, #6b6b6b);
  margin-bottom: 10px;
}
.tg-comp-sublabel {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-faint, #999);
}
.tg-comp-hint {
  font-size: 12px;
  color: var(--text-muted, #6b6b6b);
  padding: 8px 10px;
  background: var(--bg-soft, #f7f7f7);
  border-radius: 6px;
  line-height: 1.5;
  margin-top: 8px;
}

/* Channel toggle */
.tg-channel-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.tg-channel-btn {
  background: var(--bg-soft, #f7f7f7);
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 12px;
  text-align: left;
  cursor: pointer;
  transition: all 120ms;
}
.tg-channel-btn:hover:not(.is-disabled):not(.is-active) {
  background: var(--bg-soft-hover, #f0f0f0);
}
.tg-channel-btn.is-active {
  border-color: var(--brand, #e60074);
  background: var(--bg-elevated, #fff);
}
.tg-channel-btn.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tg-channel-btn-tier { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; color: var(--text-muted, #6b6b6b); }
.tg-channel-btn-name { font-size: 14px; font-weight: 600; color: var(--text-fg, #1a1a1a); margin-top: 4px; }
.tg-channel-btn-meta { font-size: 11px; color: var(--text-faint, #999); margin-top: 2px; }

/* Caption */
.tg-comp-caption {
  width: 100%;
  padding: 10px;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 6px;
  background: var(--bg-elevated, #fff);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-fg, #1a1a1a);
  resize: vertical;
  min-height: 100px;
}
.tg-comp-caption:focus { outline: 2px solid var(--brand, #e60074); outline-offset: -2px; }

.tg-comp-char-counter {
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-faint, #999);
  text-align: right;
}
.tg-comp-char-counter.is-warn { color: var(--warn, #d97706); }
.tg-comp-char-counter.is-danger { color: var(--danger, #dc2626); }

/* Media picker */
.tg-comp-media-selected {
  margin-bottom: 10px;
}
.tg-comp-media-selected-label {
  font-size: 11px;
  color: var(--text-muted, #6b6b6b);
  margin-bottom: 6px;
}
.tg-comp-media-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.tg-comp-media-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--bg-soft, #f7f7f7);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 4px;
  padding: 4px 8px;
  font-size: 12px;
}
.tg-comp-chip-kind { font-size: 12px; }
.tg-comp-chip-name { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-comp-chip-level {
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 3px;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border, #e5e5e5);
}
.tg-comp-chip-remove {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--text-muted, #6b6b6b);
  font-size: 14px;
  padding: 0 2px;
  line-height: 1;
}
.tg-comp-chip-remove:hover { color: var(--danger, #dc2626); }

.tg-level-clean { background: var(--bg-soft, #f7f7f7); }
.tg-level-sensual { background: rgba(255, 200, 200, 0.2); }
.tg-level-implied { background: rgba(255, 165, 0, 0.15); }
.tg-level-explicit { background: rgba(220, 38, 38, 0.12); }

.tg-comp-media-chip.tg-level-explicit { border-color: rgba(220, 38, 38, 0.4); }

/* Media picker drawer grid */
.tg-media-pick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.tg-media-pick-card {
  border: 2px solid transparent;
  border-radius: 6px;
  padding: 10px;
  background: var(--bg-elevated, #fff);
  transition: border-color 120ms;
}
.tg-media-pick-card.is-selected { border-color: var(--brand, #e60074); }
.tg-media-pick-card.is-blocked { opacity: 0.4; cursor: not-allowed; }
.tg-media-pick-thumb {
  height: 80px;
  background: var(--bg-soft, #f7f7f7);
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  color: var(--text-muted, #6b6b6b);
  margin-bottom: 8px;
}
.tg-media-pick-name { font-size: 12px; color: var(--text-fg, #1a1a1a); margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-media-pick-meta { display: flex; gap: 6px; align-items: center; font-size: 10px; }
.tg-media-pick-blocked { color: var(--danger, #dc2626); font-weight: 600; }

/* Options */
.tg-comp-opts-row { display: flex; gap: 24px; flex-wrap: wrap; }
.tg-comp-opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-fg, #1a1a1a);
  cursor: pointer;
}
.tg-comp-opt.is-disabled { opacity: 0.5; cursor: not-allowed; }
.tg-comp-opt-hint { font-size: 11px; color: var(--text-faint, #999); margin-left: 4px; }

/* Buttons picker */
.tg-comp-btn-selected { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.tg-comp-btn-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--bg-soft, #f7f7f7);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 6px;
  padding: 8px 10px;
}
.tg-comp-btn-num {
  background: var(--brand, #e60074);
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 700;
}
.tg-comp-btn-info { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.tg-comp-btn-label { font-size: 13px; color: var(--text-fg, #1a1a1a); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-comp-btn-kind { font-size: 10px; color: var(--text-muted, #6b6b6b); letter-spacing: 0.05em; }
.tg-comp-btn-actions { display: flex; gap: 4px; }

.tg-btn-pick-list { display: flex; flex-direction: column; gap: 8px; }
.tg-btn-pick-card {
  border: 2px solid transparent;
  background: var(--bg-elevated, #fff);
  border-radius: 6px;
  padding: 10px 12px;
  transition: border-color 120ms;
}
.tg-btn-pick-card.is-selected { border-color: var(--brand, #e60074); background: var(--bg-soft, #f7f7f7); }
.tg-btn-pick-main { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; }
.tg-btn-pick-kind {
  background: var(--text-muted, #6b6b6b);
  color: white;
  font-size: 9px;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
}
.tg-btn-pick-label { font-size: 13px; color: var(--text-fg, #1a1a1a); }
.tg-btn-pick-meta { display: flex; gap: 8px; font-size: 11px; color: var(--text-muted, #6b6b6b); }
.tg-btn-promo { color: var(--brand, #e60074); font-weight: 700; }

/* Send-when */
.tg-comp-when-row { display: flex; gap: 20px; margin-bottom: 8px; }
.tg-comp-radio { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; }
.tg-comp-datetime {
  padding: 8px 10px;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 6px;
  font-family: inherit;
  font-size: 13px;
}

/* Submit bar */
.tg-comp-submit-bar {
  position: sticky;
  bottom: 0;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.tg-comp-submit-summary { font-size: 13px; color: var(--text-fg, #1a1a1a); line-height: 1.5; }
.tg-comp-submit-errors { font-size: 12px; color: var(--danger, #dc2626); line-height: 1.6; }
.tg-comp-submit-btn { align-self: stretch; }

/* Phone preview */
.tg-comp-preview-wrap {
  background: var(--bg-soft, #f7f7f7);
  border-radius: 12px;
  padding: 14px;
  position: sticky;
  top: 16px;
}
.tg-comp-preview-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted, #6b6b6b); margin-bottom: 10px; }
.tg-phone-preview {
  background: #efeae2;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}
.tg-phone-header {
  background: #517da2;
  color: white;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.tg-phone-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: rgba(255,255,255,0.3);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  font-size: 14px;
}
.tg-phone-title { font-size: 13px; font-weight: 600; }
.tg-phone-body {
  min-height: 120px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.tg-phone-msg {
  background: white;
  border-radius: 8px;
  padding: 10px;
  font-size: 13px;
  max-width: 90%;
  align-self: flex-start;
  box-shadow: 0 1px 1px rgba(0,0,0,0.08);
}
.tg-phone-media { margin-bottom: 8px; }
.tg-phone-media-single {
  background: #ccc;
  border-radius: 4px;
  height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 12px;
}
.tg-phone-media-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}
.tg-phone-media-cell {
  background: #ccc;
  height: 70px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #555;
  font-size: 14px;
}
.tg-phone-media-cell.is-spoiler,
.tg-phone-media-single.is-spoiler {
  background: repeating-linear-gradient(45deg, #999, #999 4px, #888 4px, #888 8px);
  color: white;
}
.tg-phone-media-more { font-size: 11px; color: #666; text-align: right; padding: 4px 0; }
.tg-phone-caption { font-size: 13px; color: #1a1a1a; line-height: 1.4; }
.tg-phone-buttons { display: flex; flex-direction: column; gap: 4px; margin-top: 8px; }
.tg-phone-button {
  background: #f1f0eb;
  border: 1px solid #ddd;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 12px;
  color: #517da2;
  text-align: center;
  font-weight: 500;
}
.tg-phone-empty { color: #999; font-style: italic; text-align: center; padding: 16px 0; }

/* Recent posts */
.tg-comp-recents {
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
  padding: 14px 16px;
}
.tg-comp-recents-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted, #6b6b6b); margin-bottom: 10px; }
.tg-recent-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border, #e5e5e5);
}
.tg-recent-row:last-child { border-bottom: none; }
.tg-recent-meta { display: flex; gap: 8px; align-items: center; font-size: 11px; }
.tg-recent-tier {
  font-weight: 700;
  letter-spacing: 0.05em;
  padding: 1px 5px;
  border-radius: 3px;
  color: white;
}
.tg-recent-tier-free { background: #6b8e23; }
.tg-recent-tier-vip { background: #b8860b; }
.tg-recent-time { color: var(--text-muted, #6b6b6b); }
.tg-recent-status { color: var(--text-faint, #999); }
.tg-recent-caption { font-size: 12px; color: var(--text-fg, #1a1a1a); line-height: 1.4; }

/* ============================================================================
   Planos
   ============================================================================ */

.tg-planos { display: flex; flex-direction: column; gap: 16px; }

.tg-planos-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}
.tg-planos-title { font-size: 16px; font-weight: 700; color: var(--text-fg, #1a1a1a); }
.tg-planos-sublabel { font-size: 12px; color: var(--text-muted, #6b6b6b); margin-top: 2px; max-width: 480px; }

.tg-planos-list { display: flex; flex-direction: column; gap: 6px; }
.tg-plano-row {
  display: grid;
  grid-template-columns: 1fr 100px 80px auto;
  gap: 16px;
  align-items: center;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
  padding: 12px 14px;
}
.tg-plano-row.is-inactive { opacity: 0.55; }
.tg-plano-duration { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-muted, #6b6b6b); }
.tg-plano-name { font-size: 14px; font-weight: 600; color: var(--text-fg, #1a1a1a); margin-top: 2px; }
.tg-plano-meta { font-size: 11px; color: var(--text-faint, #999); margin-top: 2px; }
.tg-plano-price { font-size: 15px; font-weight: 700; color: var(--brand, #e60074); text-align: right; }
.tg-plano-actions { display: flex; gap: 6px; }

.tg-tag {
  display: inline-block;
  font-size: 9px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 3px;
}
.tg-tag-ok { background: #d4edda; color: #155724; }
.tg-tag-info { background: #d1ecf1; color: #0c5460; }
.tg-tag-muted { background: var(--bg-soft, #f7f7f7); color: var(--text-muted, #6b6b6b); }
.tg-act-danger { color: var(--danger, #dc2626) !important; }

/* ============================================================================
   Destinos
   ============================================================================ */

.tg-destinos { display: flex; flex-direction: column; gap: 16px; }
.tg-destinos-list { display: flex; flex-direction: column; gap: 6px; }

.tg-dest-row {
  display: grid;
  grid-template-columns: 60px 1fr auto 60px 80px auto;
  gap: 14px;
  align-items: center;
  background: var(--bg-elevated, #fff);
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 8px;
  padding: 12px 14px;
}
.tg-dest-row.is-inactive { opacity: 0.5; }
.tg-dest-badge {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  padding: 4px 8px;
  border-radius: 4px;
  text-align: center;
  color: white;
}
.tg-dest-badge-blue { background: #3182ce; }
.tg-dest-badge-green { background: #38a169; }
.tg-dest-badge-orange { background: #dd6b20; }
.tg-dest-badge-purple { background: #805ad5; }
.tg-dest-badge-gray { background: #718096; }
.tg-dest-main { min-width: 0; }
.tg-dest-label { font-size: 14px; font-weight: 600; color: var(--text-fg, #1a1a1a); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tg-dest-meta { font-size: 11px; color: var(--text-muted, #6b6b6b); margin-top: 3px; }
.tg-dest-meta code { font-family: var(--font-mono, monospace); font-size: 10px; background: var(--bg-soft, #f7f7f7); padding: 1px 4px; border-radius: 3px; }
.tg-dest-surfaces { display: flex; gap: 4px; flex-wrap: wrap; }
.tg-dest-pos { font-size: 11px; color: var(--text-faint, #999); text-align: center; }
.tg-dest-actions { display: flex; gap: 6px; }

/* ============================================================================
   Shared form styles
   ============================================================================ */

.tg-form-row { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.tg-form-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-muted, #6b6b6b); }
.tg-form-input {
  padding: 8px 10px;
  border: 1px solid var(--border, #e5e5e5);
  border-radius: 6px;
  background: var(--bg-elevated, #fff);
  font-family: inherit;
  font-size: 14px;
  color: var(--text-fg, #1a1a1a);
  width: 100%;
}
.tg-form-input:focus {
  outline: 2px solid var(--brand, #e60074);
  outline-offset: -2px;
}
.tg-form-input:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.tg-dest-kind-fields { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border, #e5e5e5); }

/* Drawer specific to TG picker */
.tg-picker-drawer { width: 720px; max-width: 100vw; }

/* btn-xs (smaller than btn-sm) for inline icon-ish buttons */
.btn-xs {
  font-size: 11px;
  padding: 3px 7px;
  height: auto;
  line-height: 1.3;
}

/* ============================================================================
   Picker UX improvements (v20260514a)
   ============================================================================ */

/* Drawer wrap with sticky header */
.tg-picker-wrap {
  display: flex;
  flex-direction: column;
  gap: 12px;
  height: 100%;
}

.tg-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 12px;
  background: var(--bg-soft, #f7f7f7);
  border-radius: 6px;
  margin-bottom: 4px;
  position: sticky;
  top: 0;
  z-index: 1;
}

.tg-picker-counter {
  font-size: 12px;
  color: var(--text-muted, #6b6b6b);
  font-weight: 500;
}

/* Selection checkmark on media + button cards */
.tg-media-pick-card,
.tg-btn-pick-card {
  position: relative;
}

.tg-media-pick-check,
.tg-btn-pick-check {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--brand, #e60074);
  color: white;
  font-size: 13px;
  font-weight: 700;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1;
  box-shadow: 0 1px 2px rgba(0,0,0,0.15);
}

.tg-media-pick-card.is-selected .tg-media-pick-check,
.tg-btn-pick-card.is-selected .tg-btn-pick-check {
  display: flex;
}

/* Selected cards: stronger visual */
.tg-media-pick-card.is-selected {
  border-color: var(--brand, #e60074);
  background: rgba(230, 0, 116, 0.04);
}
.tg-btn-pick-card.is-selected {
  border-color: var(--brand, #e60074);
  background: rgba(230, 0, 116, 0.04);
}
