:root {
	--bg: var(--tg-theme-bg-color, #faf7f2);
	--text: var(--tg-theme-text-color, #1f1a17);
	--hint: var(--tg-theme-hint-color, #7a6f63);
	--surface: var(--tg-theme-secondary-bg-color, #fffaf3);
	--line: rgba(31, 26, 23, 0.14);
	--accent: #b45309;
	--button: var(--tg-theme-button-color, #b45309);
	--button-ink: var(--tg-theme-button-text-color, #fff7ed);
	--danger: var(--tg-theme-destructive-text-color, #b42318);
	--ok: #2f7d4f;
	--radius: 2px;
	color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #14110f;
		--text: #f4efe9;
		--hint: #a79a8c;
		--surface: #1d1815;
		--line: rgba(244, 239, 233, 0.16);
		--accent: #f59e0b;
		--danger: #f97066;
		--ok: #6fcf97;
	}
}

* {
	box-sizing: border-box;
}

html,
body {
	margin: 0;
	min-height: 100%;
}

body {
	background: var(--bg);
	color: var(--text);
	font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 15px;
	line-height: 1.45;
	-webkit-font-smoothing: antialiased;
}

button,
input {
	font: inherit;
	color: inherit;
}

button {
	cursor: pointer;
}

:focus-visible {
	outline: 2px solid var(--accent);
	outline-offset: 2px;
}

.shell {
	width: 100%;
	max-width: 680px;
	margin: 0 auto;
	padding: calc(10px + env(safe-area-inset-top)) 18px calc(32px + env(safe-area-inset-bottom));
}

.top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
	padding-top: 8px;
}

.eyebrow {
	margin: 0 0 2px;
	color: var(--hint);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}

h1,
h2,
h3 {
	font-family: ui-serif, Georgia, "Times New Roman", serif;
	font-weight: 600;
	letter-spacing: -0.015em;
}

h1 {
	margin: 0;
	font-size: 30px;
	line-height: 1.1;
}

.mode-chip {
	flex: none;
	margin-top: 4px;
	padding: 5px 8px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	color: var(--hint);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.mode-chip[data-mode="auto"] {
	border-color: var(--accent);
	color: var(--accent);
}

.mode-chip[data-mode="paused"] {
	border-color: var(--danger);
	color: var(--danger);
}

.tabs {
	display: flex;
	gap: 22px;
	margin: 20px 0 6px;
	border-bottom: 1px solid var(--line);
}

.tab {
	position: relative;
	padding: 0 0 10px;
	border: 0;
	background: none;
	color: var(--hint);
	font-size: 13px;
}

.tab::after {
	position: absolute;
	right: 0;
	bottom: -1px;
	left: 0;
	height: 2px;
	background: transparent;
	content: "";
}

.tab.is-active {
	color: var(--text);
}

.tab.is-active::after {
	background: var(--accent);
}

.count {
	margin-left: 2px;
	color: var(--hint);
	font-variant-numeric: tabular-nums;
}

.view {
	padding-top: 16px;
}

.loading,
.empty {
	max-width: 34em;
	color: var(--hint);
	font-size: 14px;
	line-height: 1.6;
}

.empty strong {
	display: block;
	margin-bottom: 4px;
	color: var(--text);
	font-family: ui-serif, Georgia, "Times New Roman", serif;
	font-size: 19px;
	font-weight: 600;
}

.job {
	display: grid;
	grid-template-columns: 46px minmax(0, 1fr);
	gap: 14px;
	padding: 16px 0 16px 12px;
	border-bottom: 1px solid var(--line);
	border-left: 2px solid transparent;
}

.job[data-band="high"] {
	border-left-color: var(--accent);
}

.job[data-band="mid"] {
	border-left-color: var(--hint);
}

.job-score {
	color: var(--hint);
	font-family: ui-serif, Georgia, "Times New Roman", serif;
	font-size: 28px;
	font-variant-numeric: tabular-nums;
	line-height: 1;
}

.job[data-band="high"] .job-score {
	color: var(--accent);
}

.job h2 {
	margin: 0 0 4px;
	font-size: 17px;
	line-height: 1.25;
}

.job h2 .title {
	display: block;
	color: var(--hint);
	font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 13px;
	font-weight: 400;
	letter-spacing: 0;
}

.reason {
	margin: 0 0 6px;
	color: var(--hint);
	font-size: 13px;
}

.meta {
	margin: 0;
	color: var(--hint);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 12px;
}

.btn {
	padding: 9px 12px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
	background: transparent;
	color: var(--text);
	font-size: 13px;
	line-height: 1;
}

.btn.primary {
	border-color: transparent;
	background: var(--button);
	color: var(--button-ink);
}

.btn.danger {
	border-color: var(--danger);
	color: var(--danger);
}

.btn:disabled {
	cursor: default;
	opacity: 0.45;
}

.notice {
	margin: 14px 0;
	padding: 10px 12px;
	border-left: 3px solid var(--accent);
	color: var(--hint);
	font-size: 13px;
	line-height: 1.5;
}

.notice.danger {
	border-left-color: var(--danger);
}

.notice strong {
	color: var(--text);
}

.sheet {
	position: fixed;
	inset: 0;
	z-index: 40;
	display: grid;
	align-items: end;
}

.sheet[hidden] {
	display: none;
}

.sheet-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.58);
}

.sheet-panel {
	position: relative;
	z-index: 1;
	width: 100%;
	max-width: 680px;
	max-height: 92vh;
	margin: 0 auto;
	padding: 24px 20px calc(28px + env(safe-area-inset-bottom));
	overflow: auto;
	border-radius: 14px 14px 0 0;
	background: var(--surface);
	color: var(--text);
}

.sheet-close {
	position: absolute;
	top: 8px;
	right: 12px;
	width: 36px;
	height: 36px;
	border: 0;
	background: none;
	color: var(--hint);
	font-size: 24px;
	line-height: 1;
}

.detail h2 {
	margin: 0 0 2px;
	padding-right: 30px;
	font-size: 23px;
	line-height: 1.2;
}

.detail .detail-company {
	margin: 0 0 12px;
	color: var(--hint);
	font-size: 13px;
}

.detail .reason {
	font-size: 14px;
}

.facts {
	display: grid;
	grid-template-columns: 9em minmax(0, 1fr);
	gap: 4px 12px;
	margin: 16px 0;
	padding: 12px 0;
	border-top: 1px solid var(--line);
	border-bottom: 1px solid var(--line);
}

.facts dt {
	color: var(--hint);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.facts dd {
	margin: 0 0 6px;
	font-size: 13px;
	overflow-wrap: anywhere;
}

.vacancy,
.letter {
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

.vacancy {
	max-height: 38vh;
	margin: 8px 0 0;
	overflow: auto;
	color: var(--hint);
	font-size: 12px;
	line-height: 1.55;
}

.letter {
	margin: 8px 0 0;
	padding: 12px 0 0;
	border-top: 1px solid var(--line);
	font-size: 14px;
	line-height: 1.55;
}

.section-label {
	margin: 18px 0 4px;
	color: var(--hint);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
}

.reply {
	padding: 14px 0;
	border-bottom: 1px solid var(--line);
}

.reply-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
}

.reply h2 {
	margin: 0;
	font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
	font-size: 14px;
	font-weight: 600;
	letter-spacing: 0;
}

.kind {
	flex: none;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.kind.rejection {
	color: var(--danger);
}

.kind.interview,
.kind.offer {
	color: var(--ok);
}

.kind.screening,
.kind.unknown {
	color: var(--accent);
}

.reply p {
	margin: 4px 0 0;
	color: var(--hint);
	font-size: 13px;
}

.reply time {
	display: block;
	margin-top: 4px;
	color: var(--hint);
	font-size: 11px;
	font-variant-numeric: tabular-nums;
}

.stat-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 0;
	border-bottom: 1px solid var(--line);
}

.stat-row span:first-child {
	color: var(--hint);
	font-size: 13px;
}

.stat-value {
	font-family: ui-serif, Georgia, "Times New Roman", serif;
	font-size: 27px;
	font-variant-numeric: tabular-nums;
	line-height: 1;
}

.stat-row.accent .stat-value {
	color: var(--accent);
}

.mode-switch {
	display: flex;
	gap: 0;
	margin: 10px 0 4px;
	border: 1px solid var(--line);
	border-radius: var(--radius);
}

.mode-btn {
	flex: 1;
	padding: 9px 6px;
	border: 0;
	border-right: 1px solid var(--line);
	background: transparent;
	color: var(--hint);
	font-size: 12px;
}

.mode-btn:last-child {
	border-right: 0;
}

.mode-btn.is-active {
	background: var(--button);
	color: var(--button-ink);
}

.thresholds {
	display: flex;
	flex-wrap: wrap;
	align-items: end;
	gap: 16px;
	margin-top: 10px;
}

.field {
	display: grid;
	gap: 4px;
}

.field label {
	color: var(--hint);
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.field input {
	width: 76px;
	padding: 4px 0;
	border: 0;
	border-bottom: 1px solid var(--line);
	background: transparent;
	font-variant-numeric: tabular-nums;
}

.toast {
	position: fixed;
	right: 18px;
	bottom: calc(20px + env(safe-area-inset-bottom));
	left: 18px;
	z-index: 60;
	max-width: 520px;
	margin: 0 auto;
	padding: 11px 14px;
	border-left: 3px solid var(--accent);
	background: #1f1a17;
	color: #f4efe9;
	font-size: 13px;
	line-height: 1.4;
}

.toast.is-error {
	border-left-color: #f97066;
}

.toast[hidden] {
	display: none;
}

.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (min-width: 720px) {
	.sheet-panel {
		margin-bottom: 28px;
		border-radius: 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	* {
		scroll-behavior: auto !important;
	}
}

body.sheet-open {
	overflow: hidden;
}

.btn {
	display: inline-block;
	text-decoration: none;
}

.manual-tag {
	color: var(--accent);
}
