/* ПроДолг — общий стиль сайта */
:root {
    --bg: #f5f6f8;
    --surface: #ffffff;
    --border: #e4e7ec;
    --text: #101828;
    --muted: #667085;
    --accent: #1f4fd8;
    --accent-hover: #1a43b8;
    --accent-soft: #eef2fd;
    --ok: #12804a;   --ok-soft: #e7f6ee;
    --warn: #b25e09; --warn-soft: #fdf3e6;
    --bad: #c4321f;  --bad-soft: #fdecea;
    --radius: 14px;
    --shadow: 0 1px 2px rgba(16, 24, 40, .05);
    --shadow-hover: 0 12px 32px -12px rgba(16, 24, 40, .22);
    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    --mono: "Cascadia Mono", "JetBrains Mono", Consolas, "SFMono-Regular", Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.5;
    color: var(--text);
    background: var(--bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); }
h1, h2 { margin: 0; letter-spacing: -0.01em; }
svg { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- шапка ---------- */
.topbar { background: var(--surface); border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 10; }
.topbar__inner {
    max-width: 1200px; margin: 0 auto; padding: 0 24px; height: 64px;
    display: flex; align-items: center; justify-content: space-between; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.brand__mark {
    width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, #3b6cff, #6d3bff);
    display: grid; place-items: center; color: #fff;
}
.brand__mark svg { width: 21px; height: 21px; stroke-width: 2; }
.brand__name { font-weight: 700; font-size: 18px; letter-spacing: -0.02em; }
.nav { display: flex; gap: 4px; }
.nav a {
    padding: 8px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; font-weight: 500; font-size: 14px;
    white-space: nowrap;
}
.nav a:hover { color: var(--text); background: var(--bg); }
.nav a.is-active { color: var(--accent); background: var(--accent-soft); }

.page { flex: 1; width: 100%; max-width: 1200px; margin: 0 auto; padding: 40px 24px 56px; }
.footer { text-align: center; color: var(--muted); font-size: 13px; padding: 24px; border-top: 1px solid var(--border); }

/* ---------- главная ---------- */
.hero { text-align: center; max-width: 640px; margin: 32px auto 48px; }
.hero h1 { font-size: 40px; line-height: 1.15; font-weight: 750; }
.hero p { color: var(--muted); font-size: 17px; margin: 14px 0 0; }

.tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.tile {
    display: flex; flex-direction: column; gap: 10px; padding: 28px; min-height: 260px;
    background: var(--surface); border: 1px solid var(--border); border-radius: 18px;
    color: var(--text); text-decoration: none; box-shadow: var(--shadow);
    transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); border-color: #c9d4f6; }
.tile__icon {
    width: 52px; height: 52px; border-radius: 14px; background: var(--accent-soft); color: var(--accent);
    display: grid; place-items: center; margin-bottom: 10px;
}
.tile__icon svg { width: 28px; height: 28px; }
.tile__title { font-size: 20px; font-weight: 650; line-height: 1.3; }
.tile__text { color: var(--muted); flex: 1; }
.tile__go { display: flex; align-items: center; gap: 6px; color: var(--accent); font-weight: 600; }
.tile__go svg { transition: transform .18s ease; }
.tile:hover .tile__go svg { transform: translateX(4px); }

/* ---------- заголовок страницы ---------- */
.page-head { margin-bottom: 28px; }
.page-head h1 { font-size: 30px; font-weight: 720; }
.page-head p { color: var(--muted); margin: 8px 0 0; max-width: 760px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.chip {
    display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; border-radius: 999px;
    background: var(--surface); border: 1px solid var(--border); color: var(--text);
    text-decoration: none; font-size: 14px; font-weight: 500;
}
.chip:hover { border-color: var(--accent); color: var(--accent); }

/* ---------- общие элементы ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); }
.card + .card { margin-top: 16px; }
.card__title { font-size: 15px; font-weight: 650; margin-bottom: 14px; }
.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--surface); color: var(--text); font: inherit; font-weight: 600; font-size: 14px;
    cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { border-color: #c7ccd6; background: var(--bg); }
.btn--primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--danger { color: var(--bad); }
.btn--danger:hover { border-color: #f1b5ac; background: var(--bad-soft); }
.btn:disabled { opacity: .5; cursor: default; }
.badge {
    display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
    background: var(--bg); color: var(--muted);
}
.badge--sm { font-size: 11px; padding: 1px 7px; }
.badge--run { background: var(--accent-soft); color: var(--accent); }
.badge--ok { background: var(--ok-soft); color: var(--ok); }
.badge--wait { background: var(--warn-soft); color: var(--warn); }
.badge--bad { background: var(--bad-soft); color: var(--bad); }
.badge--muted { background: var(--bg); color: var(--muted); }
.form-error { color: var(--bad); font-size: 14px; margin: 10px 2px 0; }

.dropzone {
    position: relative; display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; padding: 32px 20px; text-align: center; cursor: pointer;
    background: var(--surface); border: 1.5px dashed #c3cad6; border-radius: var(--radius);
    transition: border-color .15s, background .15s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-busy { opacity: .6; pointer-events: none; }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone__icon { font-size: 30px; color: var(--accent); margin-bottom: 4px; }
.dropzone__title { font-weight: 650; }
.dropzone__hint { color: var(--muted); font-size: 13px; }

.options { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding: 0 2px; }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; cursor: pointer; }
.check input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); cursor: pointer; }
.options__hint { color: var(--muted); font-size: 13px; margin: 0; }

/* ---------- поиск приказов / дел 13- ---------- */
.workspace { display: grid; grid-template-columns: 380px 1fr; gap: 20px; align-items: stretch; }
/* левая колонка — той же высоты, что «Ход работы»: без файла поле загрузки занимает её целиком,
   с файлом — карточка задачи растягивается до низа */
.side { display: flex; flex-direction: column; gap: 16px; min-height: 0; }
.side:has(#job[hidden]) .dropzone { flex: 1; }
.side .job { flex: 1; display: flex; flex-direction: column; }
.side .job[hidden] { display: none; }
.job__actions { margin-top: auto !important; padding-top: 16px; }
.side .card + .card { margin-top: 0; }
.job__head { display: flex; gap: 12px; align-items: flex-start; }
.job__file { font-size: 28px; color: var(--accent); flex: none; margin-top: 2px; }
.job__meta { min-width: 0; display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.job__name { font-weight: 650; word-break: break-word; }
.bar { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; margin: 18px 0 10px; }
.bar__fill { height: 100%; width: 0; background: var(--accent); border-radius: 999px; transition: width .6s ease; }
.bar__fill--live {
    background-image: linear-gradient(90deg, rgba(255,255,255,0) 0, rgba(255,255,255,.35) 50%, rgba(255,255,255,0) 100%);
    background-size: 200% 100%; animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.job__numbers { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.job__message { font-size: 13px; color: var(--warn); margin: 10px 0 0; }
.job__message:empty { display: none; }
.job__actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 16px; }
.job__actions [hidden] { display: none; }

.console {
    background: #0e1525; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
    display: flex; flex-direction: column; height: calc(100vh - 230px); min-height: 460px;
}
.console__head { display: flex; align-items: center; gap: 7px; padding: 12px 16px; border-bottom: 1px solid #1d2638; }
.console__dot { width: 10px; height: 10px; border-radius: 50%; background: #2a3550; }
.console__title { margin-left: 8px; color: #8b97b3; font-size: 13px; font-weight: 600; }
.console__body {
    flex: 1; margin: 0; padding: 16px 18px; overflow: auto; white-space: pre-wrap; word-break: break-word;
    color: #cfd8ea; font: 12.5px/1.6 var(--mono);
}

/* ---------- подсудность (классы используются script.js) ---------- */
.narrow { max-width: 760px; }
.update { display: none !important; }
.form { width: 100%; }
.input { display: flex; gap: 8px; }
.input__element {
    flex: 1; height: 44px; padding: 0 14px; border: 1px solid var(--border); border-radius: 10px;
    font: inherit; font-size: 15px; outline: none; background: var(--surface); min-width: 0;
}
.input__element:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.input__submit {
    height: 44px; padding: 0 22px; border: 0; border-radius: 10px; background: var(--accent); color: #fff;
    font: inherit; font-weight: 600; cursor: pointer;
}
.input__submit:hover { background: var(--accent-hover); }
.file-drop-area { display: block; }
.margin-area { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.fake-btn { pointer-events: none; }
.file-msg { color: var(--muted); font-size: 13px; }
.file-input { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.format { margin-top: 16px; font-size: 13px; color: var(--muted); }
.format__name { margin-bottom: 8px; }
.format__table { width: 100%; border-collapse: collapse; font-size: 13px; color: var(--text); }
.format__table th, .format__table td { border: 1px solid var(--border); padding: 7px 10px; text-align: left; }
.format__table th { background: var(--bg); font-weight: 600; }
.result__container { margin-top: 16px; }
.result__box { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 12px; }
.result__headline { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.result__headline__lc { font-weight: 650; }
.result__headline__rc { color: var(--muted); font-size: 13px; }
.result__body p { margin: 4px 0; }
.result__body span { font-weight: 550; }
.result__body i { animation: spin 1.4s linear infinite; color: var(--accent); }
.progress-container { height: 8px; border-radius: 999px; background: var(--bg); overflow: hidden; margin-top: 10px; }
.progress-bar { height: 100%; width: 0; background: var(--accent); color: transparent; font-size: 0; transition: width .4s ease; }
.link { color: var(--accent); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- узкие экраны ---------- */
@media (max-width: 980px) {
    .tiles { grid-template-columns: 1fr; }
    .tile { min-height: 0; }
    .workspace { grid-template-columns: 1fr; }
    .console { height: 480px; }
}
@media (max-width: 640px) {
    .page { padding: 24px 16px 40px; }
    .topbar__inner { padding: 0 16px; height: auto; min-height: 56px; flex-wrap: wrap; padding-top: 10px; padding-bottom: 10px; }
    .nav { width: 100%; overflow-x: auto; }
    .hero h1 { font-size: 30px; }
    .page-head h1 { font-size: 24px; }
    .input { flex-direction: column; }
}

/* ---------- страница-документ (алгоритм подбора дел) ---------- */
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; margin-bottom: 18px; }
.back:hover { color: var(--accent); }
.doc { max-width: 860px; }
.doc__toc { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 28px; }
.doc__toc a { padding: 6px 11px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 13px; }
.doc__toc a:hover { border-color: var(--accent); color: var(--accent); }
.doc__section { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 26px 30px; margin-bottom: 16px; box-shadow: var(--shadow); scroll-margin-top: 80px; }
.doc__section h2 { font-size: 20px; font-weight: 680; margin-bottom: 14px; }
.doc__section h3 { font-size: 15px; font-weight: 650; margin: 22px 0 8px; }
.doc__section p { margin: 8px 0; }
.doc__section ul, .doc__section ol { margin: 6px 0; padding-left: 22px; }
.doc__section li { margin: 7px 0; }
.doc__section li::marker { color: var(--accent); }
.doc .checks { list-style: none; padding-left: 0; }
.doc .checks li { position: relative; padding-left: 28px; }
.doc .checks li::before { content: ""; position: absolute; left: 2px; top: 5px; width: 14px; height: 8px; border-left: 2px solid var(--ok); border-bottom: 2px solid var(--ok); transform: rotate(-45deg); }
.examples { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.example { background: var(--bg); border-radius: 12px; padding: 14px 16px; font-size: 14px; }
.example__title { font-weight: 650; margin-bottom: 6px; }
.example p { margin: 4px 0; }
.example__result { color: var(--accent); font-weight: 550; }
.doc__table { width: 100%; border-collapse: collapse; font-size: 14px; }
.doc__table th, .doc__table td { text-align: left; vertical-align: top; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.doc__table th { color: var(--muted); font-weight: 600; font-size: 13px; }
.doc__table td:first-child { font-weight: 550; width: 44%; }
@media (max-width: 760px) { .examples { grid-template-columns: 1fr; } .doc__section { padding: 20px; } }
.result__delete { margin-top: 12px; }

