/* Дашборд проектов — общие стили */

:root {
	--bg:          #f5f6f8;
	--panel:       #ffffff;
	--text:        #1c2024;
	--text-soft:   #6b7280;
	--line:        #e5e7eb;
	--line-strong: #d1d5db;

	--accent:      #2563eb;
	--accent-soft: #eff4ff;

	--ok:          #15803d;
	--ok-bg:       #e7f6ec;
	--warn:        #b45309;
	--warn-bg:     #fdf3e3;
	--bad:         #b91c1c;
	--bad-bg:      #fdecec;

	--radius:      8px;
	--shadow:      0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .04);
}

* { box-sizing: border-box; }

body {
	margin: 0;
	background: var(--bg);
	color: var(--text);
	font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code {
	font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	background: var(--bg);
	padding: 1px 5px;
	border-radius: 4px;
}

h1 { font-size: 22px; margin: 0 0 4px; }
h2 { font-size: 16px; margin: 0; }
h3 { font-size: 14px; margin: 22px 0 8px; }

/* ── Шапка ─────────────────────────────────────────────────────────────── */

.topbar {
	display: flex;
	align-items: center;
	gap: 24px;
	height: 52px;
	padding: 0 24px;
	background: var(--panel);
	border-bottom: 1px solid var(--line);
	position: sticky;
	top: 0;
	z-index: 20;
}

.topbar__logo {
	font-weight: 600;
	font-size: 15px;
	color: var(--text);
	letter-spacing: .2px;
}
.topbar__logo:hover { text-decoration: none; }

.topbar__nav { display: flex; gap: 16px; }
.topbar__nav a { color: var(--text-soft); }

.topbar__right {
	margin-left: auto;
	display: flex;
	align-items: center;
	gap: 14px;
	color: var(--text-soft);
}
.topbar__user { font-size: 13px; }
.topbar__exit { font-size: 13px; }

.wrap {
	max-width: 1500px;
	margin: 0 auto;
	padding: 22px 24px 60px;
}

/* ── Заголовок страницы ────────────────────────────────────────────────── */

.page-head {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 20px;
	margin-bottom: 18px;
	flex-wrap: wrap;
}

.page-head__sub { margin: 4px 0 0; color: var(--text-soft); font-size: 13px; }
.page-head__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.crumbs { margin: 0 0 6px; font-size: 12px; color: var(--text-soft); }
.crumbs a { color: var(--text-soft); }

/* ── Кнопки и поля ─────────────────────────────────────────────────────── */

.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	height: 34px;
	padding: 0 14px;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	background: var(--panel);
	color: var(--text);
	font-size: 13px;
	font-family: inherit;
	cursor: pointer;
	white-space: nowrap;
	transition: background .12s, border-color .12s;
}
.btn:hover { background: var(--bg); text-decoration: none; }

.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: #1d4ed8; }

.btn--danger { color: var(--bad); border-color: #f3c7c7; background: #fff; }
.btn--danger:hover { background: var(--bad-bg); }

.btn--mini { height: 26px; padding: 0 10px; font-size: 12px; color: var(--accent); border-color: #c7d7fb; }
.btn--mini:hover { background: var(--accent-soft); }

.btn--right { margin-left: auto; }

.icon-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	border: 1px solid transparent;
	border-radius: 6px;
	background: none;
	color: var(--text-soft);
	font-size: 15px;
	cursor: pointer;
	transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--bg); color: var(--accent); text-decoration: none; }
.icon-btn.is-busy { animation: spin .8s linear infinite; color: var(--accent); }

@keyframes spin { to { transform: rotate(360deg); } }

.input, .select, textarea,
.field input, .field select, .field textarea {
	height: 34px;
	padding: 0 10px;
	border: 1px solid var(--line-strong);
	border-radius: var(--radius);
	background: var(--panel);
	color: var(--text);
	font: inherit;
	font-size: 13px;
}
textarea, .field textarea { height: auto; padding: 8px 10px; resize: vertical; line-height: 1.5; }

.input:focus, .select:focus, textarea:focus,
.field input:focus, .field select:focus, .field textarea:focus {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .12);
}

.input--search { width: 220px; }
.input--time { width: 110px; height: 28px; font-size: 12px; }

.select--status { height: 28px; font-size: 12px; padding: 0 6px; }

/* ── Формы ─────────────────────────────────────────────────────────────── */

.form--card {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 20px;
	max-width: 900px;
}

.form__grid {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 16px;
}

.field { display: flex; flex-direction: column; gap: 5px; }
.field--wide { grid-column: 1 / -1; }
.field__label { font-size: 12px; color: var(--text-soft); font-weight: 500; }
.field__hint { font-size: 12px; color: var(--text-soft); }
.field__err { font-size: 12px; color: var(--bad); }
.field--err input, .field--err textarea { border-color: var(--bad); }

.check { display: flex; align-items: center; gap: 8px; font-size: 13px; cursor: pointer; }
.check--inline { color: var(--text-soft); font-size: 12px; }

.form__actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 20px;
	padding-top: 16px;
	border-top: 1px solid var(--line);
}

/* ── Карточки состояния ────────────────────────────────────────────────── */

.cards {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
	gap: 12px;
	margin-bottom: 6px;
}

.card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 14px 16px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
}
.card__label { font-size: 12px; color: var(--text-soft); }
.card__value { font-size: 18px; font-weight: 600; }
.card__value--rows { display: flex; flex-direction: column; gap: 2px; font-size: 13px; font-weight: 400; }
.card__note { font-size: 12px; color: var(--text-soft); min-height: 16px; }

/* ── Секции ────────────────────────────────────────────────────────────── */

.section { margin-top: 28px; }

.section__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 10px;
	flex-wrap: wrap;
}
.section__actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.section__actions form { margin: 0; }

.count {
	display: inline-block;
	min-width: 20px;
	padding: 1px 6px;
	margin-left: 4px;
	border-radius: 10px;
	background: var(--bg);
	color: var(--text-soft);
	font-size: 12px;
	font-weight: 500;
	text-align: center;
}

/* ── Таблицы ───────────────────────────────────────────────────────────── */

/* Обёртка сама себе контейнер прокрутки — поэтому шапка липнет к ней, а не к окну */
.table-wrap {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: auto;
	max-height: calc(100vh - 210px);
	min-height: 120px;
}

.table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	white-space: nowrap;
}

.table thead th {
	position: sticky;
	top: 0;
	z-index: 5;
	background: var(--panel);
	border-bottom: 1px solid var(--line-strong);
	padding: 10px 12px;
	text-align: left;
	font-size: 12px;
	font-weight: 600;
	color: var(--text-soft);
}

.table tbody td {
	padding: 9px 12px;
	border-bottom: 1px solid var(--line);
	vertical-align: middle;
}

.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr.is-hidden { display: none; }

.table tfoot td {
	padding: 10px 12px;
	border-top: 1px solid var(--line-strong);
	background: #fbfcfd;
	font-size: 12px;
	color: var(--text-soft);
}

.table--projects tbody { counter-reset: row; }
.table--projects tbody tr { counter-increment: row; }
.table--projects .col-num { color: var(--text-soft); width: 40px; }
.table--projects tbody .col-num::before { content: counter(row); }

.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .col-id { color: var(--text-soft); width: 46px; }
.table .col-title { white-space: normal; min-width: 260px; }
.table .col-err { white-space: normal; max-width: 320px; color: var(--bad); font-size: 12px; }
.table .col-action { width: 44px; text-align: right; }

.site { font-weight: 500; color: var(--text); }
.site:hover { color: var(--accent); }
.site__ext { margin-left: 6px; color: var(--text-soft); font-size: 12px; }

.dash { color: var(--line-strong); }
.yes { color: var(--ok); }
.no  { color: var(--bad); }

/* ── Бейджи, статусы ───────────────────────────────────────────────────── */

.badge {
	display: inline-block;
	padding: 2px 9px;
	border-radius: 20px;
	font-size: 12px;
	font-weight: 600;
	line-height: 1.5;
}
.badge--ok   { background: var(--ok-bg);   color: var(--ok); }
.badge--warn { background: var(--warn-bg); color: var(--warn); }
.badge--bad  { background: var(--bad-bg);  color: var(--bad); }

.tag {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 7px;
	border-radius: 4px;
	background: var(--accent-soft);
	color: var(--accent);
	font-size: 11px;
}
.tag--muted { background: var(--bg); color: var(--text-soft); }

.status { font-weight: 500; }
.status--new         { color: var(--text-soft); }
.status--in_progress { color: var(--accent); }
.status--done        { color: var(--ok); }

.prio { font-size: 12px; }
.prio--high   { color: var(--bad); font-weight: 500; }
.prio--normal { color: var(--text-soft); }
.prio--low    { color: var(--line-strong); }

/* ── Сообщения, подсказки, пустые состояния ────────────────────────────── */

.msg {
	padding: 10px 14px;
	border-radius: var(--radius);
	font-size: 13px;
	margin: 0 0 16px;
}
.msg--ok  { background: var(--ok-bg);  color: var(--ok); }
.msg--err { background: var(--bad-bg); color: var(--bad); }

.hint { color: var(--text-soft); font-size: 12px; margin: 10px 0 0; }
.hint--right { text-align: right; }

.empty {
	padding: 44px 20px;
	text-align: center;
	background: var(--panel);
	border: 1px dashed var(--line-strong);
	border-radius: var(--radius);
	color: var(--text-soft);
}
.empty--page { padding: 80px 20px; }
.empty p { margin: 0 0 14px; }

.notes {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	padding: 14px 16px;
	box-shadow: var(--shadow);
	line-height: 1.6;
}

/* ── Коммиты и файлы ───────────────────────────────────────────────────── */

.commits { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }

.commit {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 10px 14px;
}

.commit__head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }

.commit__toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	border: none;
	background: none;
	padding: 0;
	font: inherit;
	color: var(--text);
	cursor: pointer;
	text-align: left;
}
.commit__toggle:hover .commit__msg { color: var(--accent); }

.commit__sha {
	font: 12px/1.6 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	background: var(--bg);
	color: var(--text-soft);
	padding: 1px 6px;
	border-radius: 4px;
}

.commit__msg { font-size: 13px; }
.commit__meta { font-size: 12px; color: var(--text-soft); margin-left: auto; }
.commit__unlink { margin: 0; }
.commit__files { margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); }

.files { list-style: none; margin: 0; padding: 0; font-size: 12px; }
.files li { display: flex; align-items: center; gap: 8px; padding: 3px 0; }

.file__status { width: 6px; height: 6px; border-radius: 50%; background: var(--text-soft); flex: none; }
.file__status--added    { background: var(--ok); }
.file__status--modified { background: var(--warn); }
.file__status--removed  { background: var(--bad); }
.file__status--renamed  { background: var(--accent); }

.file__name { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; word-break: break-all; }
.file__diff { margin-left: auto; white-space: nowrap; }
.file__diff .add { color: var(--ok); }
.file__diff .del { color: var(--bad); margin-left: 6px; }

.pick-list { list-style: none; margin: 0 0 14px; padding: 0; max-height: 340px; overflow-y: auto;
	background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.pick-list li { padding: 8px 12px; border-bottom: 1px solid var(--line); }
.pick-list li:last-child { border-bottom: none; }
.pick-list .commit__meta { margin-left: 8px; }

/* ── Отчёт ─────────────────────────────────────────────────────────────── */

.report {
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 24px;
	max-width: 1000px;
}
.report h2 { font-size: 18px; margin: 0 0 16px; }

.report__meta {
	display: grid;
	grid-template-columns: 120px 1fr;
	gap: 6px 16px;
	margin: 0 0 8px;
	font-size: 13px;
}
.report__meta dt { color: var(--text-soft); }
.report__meta dd { margin: 0; }

.tree { display: flex; flex-direction: column; gap: 12px; font-size: 12px; }
.tree__dir { color: var(--text-soft); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.tree__files { list-style: none; margin: 4px 0 0; padding: 0 0 0 18px; }
.tree__files li { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; padding: 2px 0; }

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

/* ── Страница входа ────────────────────────────────────────────────────── */

.page-auth {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 100vh;
	padding: 20px;
}

.auth-box {
	width: 100%;
	max-width: 360px;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 12px;
	box-shadow: var(--shadow);
	padding: 28px;
}
.auth-box h1 { font-size: 20px; margin-bottom: 2px; }
.auth-hint { color: var(--text-soft); font-size: 13px; margin: 0 0 18px; }
.auth-box .form { display: flex; flex-direction: column; gap: 14px; }
.auth-box .btn { width: 100%; height: 38px; }

/* ── Мобильные ─────────────────────────────────────────────────────────── */

@media (max-width: 720px) {
	.wrap { padding: 16px 12px 40px; }
	.form__grid { grid-template-columns: 1fr; }
	.page-head { align-items: flex-start; }
	.input--search { width: 100%; }
	.table-wrap { max-height: none; }
}
