:root {
  /* This Mini App intentionally uses a consistent light interface in Telegram's dark mode too. */
  color-scheme: light;
  --bg: #f5f7fb;
  --surface: #ffffff;
  --text: #102047;
  --muted: #6e7890;
  --blue: #0966e8;
  --blue-text: #ffffff;
  --green: #16a653;
  --green-bg: #eaf9f0;
  --orange: #f2a01a;
  --orange-bg: #fff8e8;
  --border: #e3e8f1;
  --shadow: 0 3px 14px rgba(20, 42, 82, .07);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); }
body { min-width: 280px; -webkit-font-smoothing: antialiased; }
button, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  width: min(100%, 560px);
  margin: 0 auto;
  padding: calc(18px + env(safe-area-inset-top)) 16px calc(92px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.page-head { display: flex; align-items: center; justify-content: space-between; margin: 1px 0 17px; }
.page-head h1 { font-size: 25px; line-height: 1.15; margin: 0; letter-spacing: -.55px; }
.icon-btn, .back-btn { border: 0; color: var(--text); background: transparent; font-size: 22px; padding: 6px; }
.back-btn { margin-left: -7px; display: flex; gap: 6px; align-items: center; font-size: 15px; font-weight: 700; }

.monitor-card {
  background: linear-gradient(135deg, #f2fff7, #eefaf6);
  border: 1px solid #cdebd9;
  border-radius: 15px;
  padding: 15px;
  box-shadow: var(--shadow);
}
.monitor-card.paused { background: #f4f6f9; border-color: #dce2eb; }
.monitor-card.paused .check-circle { background: #748096; }
.monitor-top { display: flex; align-items: center; gap: 11px; }
.check-circle { display: grid; place-items: center; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 50%; color: #fff; background: var(--green); font-size: 19px; font-weight: 800; }
.monitor-card strong { display: block; font-size: 15px; }
.monitor-card small { color: var(--muted); font-size: 12px; }
.progress { height: 4px; background: #cae8d5; border-radius: 20px; margin-top: 14px; overflow: hidden; }
.progress span { display: block; width: 30%; height: 100%; background: var(--green); border-radius: inherit; }

.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 9px; margin: 12px 0 22px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; padding: 11px; box-shadow: var(--shadow); }
.stat span { display: block; color: var(--muted); font-size: 11px; white-space: nowrap; }
.stat strong { display: flex; justify-content: space-between; align-items: end; margin-top: 6px; color: var(--blue); font-size: 24px; }
.stat:nth-child(2) strong { color: var(--green); }
.stat strong em { font-size: 15px; font-style: normal; }

.section-title { margin: 0 0 10px; font-size: 14px; }
.job-card { position: relative; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 14px; margin-bottom: 10px; box-shadow: var(--shadow); }
.job-card.featured { border-color: #f2c66d; background: linear-gradient(120deg, #fffdf7, #fff9e9); }
.job-line { display: flex; gap: 12px; align-items: flex-start; }
.job-body { min-width: 0; flex: 1; }
.job-title { margin: 0 0 7px; font-size: 16px; line-height: 1.25; }
.job-summary { margin: -1px 0 8px; color: var(--muted); font-size: 12px; line-height: 1.38; }
.detail-summary { font-size: 13px; }
.title-row { display: flex; gap: 8px; align-items: flex-start; justify-content: space-between; }
.title-row .job-title { flex: 1; }
.detail-title { margin-bottom: 12px; }
.job-meta { display: flex; gap: 6px 12px; flex-wrap: wrap; color: var(--muted); font-size: 11px; line-height: 1.5; }
.job-meta span::first-letter { color: var(--text); }
.score { display: grid; place-items: center; flex: 0 0 58px; min-height: 58px; padding: 5px; border: 1px solid #bce8cb; border-radius: 11px; background: var(--green-bg); color: var(--green); text-align: center; }
.score strong { display: block; font-size: 20px; line-height: 1; }
.score small { font-size: 10px; }
.score.medium { color: var(--blue); background: #edf5ff; border-color: #c5dbfa; }
.new-pill { position: absolute; top: 8px; right: 78px; padding: 3px 6px; border-radius: 5px; color: #fff; background: var(--orange); font-size: 8px; font-weight: 800; }
.status-pill { flex: 0 0 auto; border-radius: 20px; padding: 4px 7px; font-size: 10px; font-weight: 700; color: var(--blue); background: #eaf2ff; }
.status-pill.saved { color: #9a6200; background: var(--orange-bg); }
.status-pill.applied { color: var(--green); background: var(--green-bg); }
.primary-btn, .secondary-btn { width: 100%; min-height: 45px; border-radius: 10px; font-weight: 700; border: 1px solid var(--blue); }
.primary-btn { color: var(--blue-text); background: var(--blue); }
.secondary-btn { color: var(--blue); background: var(--surface); }
.danger-btn { width: 100%; min-height: 42px; color: #b33c3c; background: #fff7f7; border: 1px solid #f0c8c8; border-radius: 10px; font-weight: 700; }
.job-card .primary-btn { min-height: 38px; margin-top: 12px; font-size: 13px; }

.chips { display: flex; gap: 8px; overflow-x: auto; padding: 1px 0 13px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.search-input { width: 100%; min-height: 44px; margin: -3px 0 12px; padding: 0 12px; border: 1px solid var(--border); border-radius: 11px; outline: 0; background: var(--surface); color: var(--text); }
.search-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(9, 102, 232, .1); }
.chip { flex: 0 0 auto; border: 1px solid #b9cef0; color: var(--blue); background: var(--surface); border-radius: 9px; padding: 8px 13px; font-size: 12px; }
.chip.active { color: #fff; border-color: var(--blue); background: var(--blue); }
.chip.urgent { color: #e86d23; border-color: #ffc899; }

.detail-copy { margin-top: 18px; }
.label { display: block; margin: 17px 0 7px; font-size: 12px; font-weight: 700; }
.tag-list { display: flex; gap: 7px; flex-wrap: wrap; }
.tag { padding: 5px 9px; border-radius: 7px; background: #eaf2ff; color: var(--blue); font-size: 11px; }
.message-box { padding: 13px; border: 1px solid var(--border); border-radius: 11px; background: var(--surface); font-size: 13px; line-height: 1.45; white-space: pre-wrap; }
.actions { display: grid; gap: 9px; margin-top: 18px; }
.action-row { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.text-btn { width: 100%; border: 0; padding: 9px; color: var(--muted); background: transparent; font-size: 12px; }

.ready { display: inline-flex; align-items: center; gap: 6px; color: #148440; background: var(--green-bg); border: 1px solid #bce8cb; border-radius: 7px; padding: 6px 9px; font-size: 12px; font-weight: 700; }
textarea { width: 100%; min-height: 180px; resize: vertical; border: 1px solid var(--border); border-radius: 12px; padding: 13px; background: var(--surface); color: var(--text); line-height: 1.45; outline: none; }
textarea:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(9, 102, 232, .1); }
.field { margin-bottom: 13px; }
.field label { display: block; margin-bottom: 6px; font-size: 11px; font-weight: 700; color: var(--muted); }
.field input { width: 100%; min-height: 45px; padding: 0 12px; border: 1px solid var(--border); border-radius: 10px; outline: 0; background: var(--surface); color: var(--text); }
.field input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(9, 102, 232, .1); }
.counter { margin-top: -24px; padding-right: 9px; color: var(--muted); text-align: right; font-size: 10px; }

.profile-head { display: flex; align-items: center; gap: 13px; padding-bottom: 17px; border-bottom: 1px solid var(--border); }
.avatar { display: grid; place-items: center; width: 60px; height: 60px; border-radius: 50%; background: #e6efff; color: var(--blue); font-size: 28px; }
.profile-head h2 { margin: 0 0 4px; font-size: 19px; }
.profile-head p { margin: 2px 0; color: var(--muted); font-size: 12px; }
.profile-section { padding: 17px 0; border-bottom: 1px solid var(--border); }
.profile-section .label { margin-top: 0; }
.row { display: flex; align-items: center; justify-content: space-between; min-height: 48px; border-bottom: 1px solid var(--border); font-size: 13px; }
.row:last-child { border-bottom: 0; }
.row span:last-child { color: var(--text); text-align: right; }
.row .green { color: var(--green) !important; }

.settings-group { margin-bottom: 18px; }
.settings-card { background: var(--surface); border: 1px solid var(--border); border-radius: 13px; overflow: hidden; box-shadow: var(--shadow); }
.settings-card .row { padding: 0 13px; }
.settings-link { width: 100%; color: var(--text); background: transparent; border-top: 0; border-left: 0; border-right: 0; text-align: left; }
.settings-label { margin: 0 0 8px 2px; font-size: 12px; font-weight: 700; }
.switch { position: relative; width: 46px; height: 26px; border-radius: 16px; border: 0; background: #c9d0dc; transition: .2s; }
.switch::after { content: ""; position: absolute; width: 20px; height: 20px; left: 3px; top: 3px; border-radius: 50%; background: white; box-shadow: 0 1px 3px #7776; transition: .2s; }
.switch.on { background: var(--green); }
.switch.on::after { transform: translateX(20px); }
.segments { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--surface); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.segments.four { grid-template-columns: repeat(4, 1fr); }
.segments button { padding: 10px 4px; border: 0; border-right: 1px solid var(--border); background: transparent; color: var(--text); font-size: 11px; }
.segments button:last-child { border-right: 0; }
.segments button.active { color: #fff; background: var(--blue); }
.form-hint { margin: 8px 2px 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.row small { display: block; max-width: 235px; margin-top: 3px; color: var(--muted); font-size: 10px; font-weight: 400; line-height: 1.3; }

.empty { padding: 50px 20px; text-align: center; color: var(--muted); }
.empty strong { display: block; margin-bottom: 7px; color: var(--text); }
.bottom-nav { position: fixed; z-index: 20; left: 0; right: 0; bottom: 0; display: grid; grid-template-columns: repeat(4, 1fr); width: min(100%, 560px); margin: auto; padding: 7px 5px calc(7px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: color-mix(in srgb, var(--surface) 95%, transparent); backdrop-filter: blur(14px); }
.bottom-nav.viewer { grid-template-columns: repeat(3, 1fr); }
.hidden { display: none !important; }
.nav-item { position: relative; display: grid; place-items: center; gap: 1px; border: 0; background: transparent; color: var(--muted); font-size: 10px; }
.nav-item.active { color: var(--blue); font-weight: 700; }
.nav-icon { font-size: 23px; line-height: 1.15; }
.nav-item i { position: absolute; top: -2px; left: calc(50% + 8px); display: grid; place-items: center; min-width: 17px; height: 17px; padding: 0 4px; border: 2px solid var(--surface); border-radius: 10px; background: #ef4444; color: white; font-size: 9px; font-style: normal; }
.toast { position: fixed; z-index: 40; left: 50%; bottom: 90px; max-width: calc(100% - 32px); transform: translate(-50%, 20px); padding: 10px 14px; border-radius: 10px; color: white; background: #17223c; opacity: 0; pointer-events: none; transition: .25s; font-size: 12px; box-shadow: 0 6px 22px #0004; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 600px) {
  body { background: linear-gradient(145deg, #eaf0fa, #f7f9fc); }
  .app-shell { background: var(--bg); box-shadow: 0 0 35px #1b31521a; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition: none !important; } }
