/* BCET Mini App — mobile-first, themed from Telegram's themeParams vars. */

:root {
  --bg: var(--tg-theme-bg-color, #fff);
  --bg2: var(--tg-theme-secondary-bg-color, #f2f4f7);
  --text: var(--tg-theme-text-color, #1a1d21);
  --hint: var(--tg-theme-hint-color, #6b7280);
  --link: var(--tg-theme-link-color, #2563eb);
  --btn: var(--tg-theme-button-color, #2563eb);
  --btn-text: var(--tg-theme-button-text-color, #fff);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.45 -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: 4rem;
}

.view { padding: 0.75rem; }
header h1 { font-size: 1.15rem; margin: 0.2rem 0 0.6rem; }

/* status chips */
.chips { display: flex; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.6rem; }
.chip {
  border: 1px solid var(--hint); border-radius: 999px; background: none;
  color: var(--hint); font-size: 0.8rem; padding: 0.2rem 0.7rem;
}
.chip.on { background: var(--btn); border-color: var(--btn); color: var(--btn-text); }

/* queue rows */
.rows { list-style: none; margin: 0; padding: 0; }
.rows li {
  padding: 0.6rem 0.4rem; border-bottom: 1px solid var(--bg2); cursor: pointer;
}
.rows li:active { background: var(--bg2); }
.row-top { display: flex; justify-content: space-between; gap: 0.5rem; }
.row-sender { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-id { color: var(--hint); font-size: 0.8rem; flex-shrink: 0; }
.row-subject { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-summary {
  color: var(--hint); font-size: 0.85rem;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.empty { color: var(--hint); text-align: center; margin-top: 3rem; }

/* detail */
.detail-head { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 0.5rem; }
.meta { color: var(--hint); font-size: 0.85rem; }
.card { background: var(--bg2); border-radius: 10px; padding: 0.6rem 0.75rem; margin-bottom: 0.7rem; }
.sender { font-weight: 600; }
.subject { margin-top: 0.15rem; }
.meeting { margin-top: 0.35rem; font-size: 0.9rem; }
section h3 {
  font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--hint); margin: 0.9rem 0 0.3rem;
}
pre {
  white-space: pre-wrap; word-break: break-word; margin: 0;
  font: inherit; max-height: 45vh; overflow-y: auto;
  background: var(--bg2); border-radius: 10px; padding: 0.6rem 0.75rem;
}
#d-reply { max-height: none; }
.notice { color: var(--hint); margin: 0.8rem 0; }

/* actions */
.actions { display: flex; flex-wrap: wrap; gap: 0.45rem; margin-top: 1rem; }
.actions button, .review button {
  border: 1px solid var(--hint); border-radius: 10px; background: var(--bg);
  color: var(--text); padding: 0.55rem 0.9rem; font-size: 0.95rem;
}
button.primary { background: var(--btn); border-color: var(--btn); color: var(--btn-text); }
button.ghost { border-color: transparent; color: var(--link); background: none; }
button.small { font-size: 0.75rem; padding: 0 0.3rem; text-transform: none; }
button:active { opacity: 0.75; }

/* edit */
#edit-text {
  width: 100%; min-height: 45vh; resize: vertical;
  background: var(--bg2); color: var(--text);
  border: 1px solid var(--hint); border-radius: 10px; padding: 0.6rem 0.75rem;
  font: inherit;
}
.review { margin-top: 0.8rem; }

/* blocked + toast */
.blocked-card { text-align: center; margin-top: 4rem; color: var(--hint); }
.blocked-card h2 { color: var(--text); }
#toast {
  position: fixed; bottom: 1rem; left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); border-radius: 10px;
  padding: 0.5rem 1rem; font-size: 0.9rem; max-width: 90vw; z-index: 10;
}
