/* дизайн-система экранов (tt-*): токены и шкала как в tapsyru/su-sharuashylygy.
   фон #EEF4F8, карточка #FFF + рамка #E3EBF2 + радиус 16, акценты #004D78 / #10C469 */
.tt-card {
    background: #FFFFFF; border: 1px solid #E3EBF2; border-radius: 16px; overflow: hidden;
    font-family: Inter, -apple-system, 'Segoe UI', Roboto, sans-serif; color: #1F2933; margin-bottom: 16px;
}
/* внутри белой карточки формы своя рамка даёт «карточку в карточке» — там идём плоско */
.card-body .tt-card { border: none; border-radius: 0; background: transparent; }

.tt-toolbar {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 16px 20px; border-bottom: 1px solid #EDF2F7;
}
.tt-toolbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex-wrap: wrap; }
.tt-title { font: 600 13px/1.2 Inter, sans-serif; color: #1F2933; }
.tt-count {
    display: inline-flex; align-items: center; height: 22px; padding: 0 10px; border-radius: 11px;
    background: #EEF4F8; color: #004D78; font: 600 11.5px/1 Inter, sans-serif; white-space: nowrap;
}
.tt-body { padding: 20px; }
.tt-body > :last-child { margin-bottom: 0; }

/* шапка сущности: вид документа мелко, номер крупно, статус рядом */
.tt-kicker { font: 600 11px/1.3 Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #64748B; }
.tt-headline { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.tt-number { font: 700 20px/1.25 Inter, sans-serif; color: #0F172A; }

.tt-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    height: 32px; padding: 0 14px; border-radius: 9px; border: 1px solid transparent;
    font: 600 12.5px/1 Inter, sans-serif; white-space: nowrap; cursor: pointer; text-decoration: none;
    box-sizing: border-box;
    transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.tt-btn:hover { text-decoration: none; }
.tt-btn i { font-size: 15px; line-height: 1; }
.tt-btn-block { display: flex; width: 100%; }
.tt-btn-primary { background: #004D78; color: #FFFFFF; }
.tt-btn-primary:hover { background: #003A5C; color: #FFFFFF; }
.tt-btn-ghost { background: #FFFFFF; border-color: #D8E3EC; color: #37474F; }
.tt-btn-ghost:hover { background: #F2F8FF; border-color: #B9D4E6; color: #004D78; }
.tt-btn-danger { background: #FFFFFF; border-color: #F0D5D2; color: #C0392B; }
.tt-btn-danger:hover { background: #FDF3F2; border-color: #E4B7B1; color: #A93226; }
.tt-stack { display: flex; flex-direction: column; gap: 8px; }

/* статус — чип с тоном; тон выбираем по смыслу, а не по bootstrap-цвету */
.tt-status {
    display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 12px;
    font: 600 12px/1 Inter, sans-serif; white-space: nowrap;
}
.tt-status::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.tt-tone-info { background: #E8F1FA; color: #004D78; }
.tt-tone-success { background: #E3F8EC; color: #0B7A43; }
.tt-tone-warn { background: #FFF4E0; color: #8A5A00; }
.tt-tone-danger { background: #FDECEA; color: #B42318; }
.tt-tone-muted { background: #EEF1F4; color: #475569; }
.tt-chip {
    display: inline-block; padding: 3px 10px; border-radius: 8px;
    background: #EEF4F8; color: #004D78; font: 600 11.5px/1.45 Inter, sans-serif;
}

/* пары «ключ — значение»: сетка сама складывается в одну колонку на телефоне */
.tt-kv { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px 24px; }
.tt-kv-k { font: 600 11px/1.3 Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #64748B; margin-bottom: 4px; }
.tt-kv-v { font: 500 13px/1.45 Inter, sans-serif; color: #1F2933; overflow-wrap: anywhere; }
.tt-name { font-weight: 600; color: #111827; }
.tt-sub { display: block; margin-top: 4px; font: 500 12px/1.4 Inter, sans-serif; color: #64748B; }
.tt-sub i { font-size: 13px; margin-right: 4px; opacity: .85; }
/* иконки — MDI 5.5 из hyper-theme: имена сверять с её materialdesignicons.css, новых там нет */
.tt-sub a { color: #004D78; font-weight: 600; text-decoration: none; }
.tt-sub a:hover { text-decoration: underline; }
.tt-mono { font-family: Consolas, 'JetBrains Mono', monospace; font-size: 12.5px; color: #475569; }
.tt-money { white-space: nowrap; font-variant-numeric: tabular-nums; font-weight: 600; }
.tt-divider { height: 1px; background: #E7EEF4; margin: 20px 0; border: 0; }

/* ход подписания */
.tt-sign { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; margin-top: 20px; }
.tt-party {
    display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px;
    border: 1px solid #E3EBF2; background: #F8FAFC;
}
.tt-party-icon {
    flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px;
    display: inline-flex; align-items: center; justify-content: center; font-size: 17px;
    background: #EEF1F4; color: #94A3B8;
}
.tt-party.is-done .tt-party-icon { background: #E3F8EC; color: #0B7A43; }
.tt-party-role { font: 600 11px/1.3 Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #64748B; }
.tt-party-state { font: 600 13px/1.35 Inter, sans-serif; color: #1F2933; margin-top: 2px; }
.tt-party:not(.is-done) .tt-party-state { color: #64748B; font-weight: 500; }

.tt-deadline { margin-top: 16px; }
.tt-deadline-row { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.tt-deadline-label { font: 500 12px/1.4 Inter, sans-serif; color: #64748B; }
.tt-deadline-label b { font-weight: 600; color: #1F2933; }
.tt-deadline-left { font: 600 12px/1.4 Inter, sans-serif; font-variant-numeric: tabular-nums; }
.tt-bar { height: 8px; margin-top: 8px; border-radius: 4px; background: #E7EEF4; overflow: hidden; }
.tt-bar > span { display: block; height: 100%; border-radius: 4px; background: #10C469; }
.tt-bar.is-warn > span { background: #F2A30F; }
.tt-bar.is-danger > span { background: #D92D20; }
.is-warn .tt-deadline-left, .tt-deadline-left.is-warn { color: #8A5A00; }
.tt-deadline-left.is-danger { color: #B42318; }
.tt-deadline-left.is-ok { color: #0B7A43; }

.tt-alert {
    display: flex; align-items: flex-start; gap: 10px; margin-top: 16px; padding: 12px 14px; border-radius: 12px;
    background: #FFF8E8; border: 1px solid #FFE2A8; color: #8A5A00; font: 500 12.5px/1.45 Inter, sans-serif;
}
.tt-alert i { font-size: 16px; line-height: 1.2; }
.tt-alert-danger { background: #FDF3F2; border-color: #F0D5D2; color: #912018; }
.tt-alert-success { background: #E3F8EC; border-color: #B7EBCD; color: #0B7A43; }
.tt-alert-muted { background: #F8FAFC; border-color: #E3EBF2; color: #475569; }
.tt-alert b { font-weight: 600; }

/* хронология операций */
.tt-timeline { list-style: none; margin: 0; padding: 4px 20px 12px; }
.tt-timeline li { position: relative; padding: 12px 0 12px 20px; border-bottom: 1px solid #EDF2F7; }
.tt-timeline li:last-child { border-bottom: none; }
.tt-timeline li::before {
    content: ''; position: absolute; left: 0; top: 17px; width: 8px; height: 8px; border-radius: 50%;
    background: #B9D4E6;
}
.tt-timeline li:first-child::before { background: #004D78; }
.tt-timeline a { font: 600 13px/1.35 Inter, sans-serif; color: #1F2933; text-decoration: none; }
.tt-timeline a:hover { color: #004D78; text-decoration: underline; }
.tt-timeline .tt-sub { margin-top: 2px; }

.tt-scroll { overflow-x: auto; }
table.tt-table { width: 100%; border-collapse: collapse; font-family: Inter, sans-serif; }
.tt-table thead th {
    background: #F8FAFC; text-align: left; white-space: nowrap; padding: 12px 16px; border-bottom: 1px solid #E3EBF2;
    font: 600 11px/1.2 Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #64748B;
}
.tt-table tbody td {
    padding: 12px 16px; border-bottom: 1px solid #E7EEF4; vertical-align: top;
    font: 500 13px/1.45 Inter, sans-serif; color: #1F2933;
}
.tt-table tbody tr:nth-child(even) td { background: #F4F9FC; }
.tt-table tbody tr:hover td { background: #E9F3FC; }
.tt-table tbody tr:last-child td { border-bottom: none; }

.tt-sub-warn { color: #B42318; }

/* свёрнутый служебный блок (журнал уведомлений) */
details.tt-log > summary { cursor: pointer; list-style: none; border-bottom: none; }
details.tt-log > summary::-webkit-details-marker { display: none; }
details.tt-log[open] > summary { border-bottom: 1px solid #EDF2F7; }
.tt-log-chevron { color: #94A3B8; font-size: 20px; transition: transform .15s ease; }
details.tt-log[open] .tt-log-chevron { transform: rotate(180deg); }

.tt-empty { padding: 32px 20px; text-align: center; }
.tt-empty-text { font: 500 13px/1.5 Inter, sans-serif; color: #64748B; margin: 0; }

/* длинный текст (описание, основание) — на всю ширину сетки, переносы как ввёл пользователь */
.tt-kv-wide { grid-column: 1 / -1; }
.tt-text { white-space: pre-line; }
.tt-section + .tt-section { margin-top: 20px; }
.tt-list { margin: 0; padding-left: 20px; font: 500 13px/1.5 Inter, sans-serif; color: #1F2933; }
.tt-list li + li { margin-top: 6px; }
.tt-list li::marker { color: #64748B; font-variant-numeric: tabular-nums; }

.tt-btn-row { display: flex; gap: 8px; }
.tt-btn-row > .tt-btn-block { flex: 1 1 auto; width: auto; }
.tt-btn-icon { width: 32px; padding: 0; flex: 0 0 auto; }
.tt-btn.is-disabled { opacity: .5; cursor: not-allowed; pointer-events: none; }
.tt-hint { font: 500 12px/1.4 Inter, sans-serif; color: #64748B; margin-top: -2px; }

/* короткий список ссылок в боковой колонке: слева номер + дата, справа статус */
.tt-links { list-style: none; margin: 0; padding: 0; max-height: 400px; overflow-y: auto; }
.tt-links li + li { border-top: 1px solid #EDF2F7; }
.tt-links a {
    display: flex; align-items: center; justify-content: space-between; gap: 8px;
    padding: 12px 20px; text-decoration: none; color: #1F2933;
}
.tt-links a:hover { background: #E9F3FC; }
.tt-links .tt-sub { margin-top: 2px; }

.tt-files { display: flex; flex-direction: column; gap: 4px; }
.tt-files a { font: 500 13px/1.45 Inter, sans-serif; color: #004D78; text-decoration: none; overflow-wrap: anywhere; }
.tt-files a:hover { text-decoration: underline; }
.tt-files i { color: #64748B; margin-right: 4px; }
.tt-files .tt-size { color: #94A3B8; font-size: 12px; margin-left: 4px; white-space: nowrap; }
.tt-timeline .tt-chips { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 6px; }

/* реестры: в ячейке главное значение, под ним подстроки и чипы — список читается «по диагонали» */
.tt-registry .tt-table tbody td { padding: 14px 16px; }
/* длинные статусы иначе растягивают колонку на пол-экрана */
.tt-registry .tt-status { white-space: normal; height: auto; min-height: 24px; padding: 4px 10px; line-height: 1.3; max-width: 260px; }
.tt-registry .tt-status::before { flex: 0 0 auto; }
.tt-registry .tt-chip { max-width: 260px; }
.tt-table a.tt-name { color: #004D78; text-decoration: none; }
.tt-table a.tt-name:hover { text-decoration: underline; }
.tt-inline { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 6px; }
.tt-muted { color: #94A3B8; font-weight: 500; }
.tt-right { text-align: right; }
.tt-nowrap { white-space: nowrap; }
.tt-big { font: 700 13.5px/1.35 Inter, sans-serif; color: #0F172A; }
.tt-col-main { min-width: 240px; }
.tt-col-mid { min-width: 190px; }
.tt-col-narrow { min-width: 140px; }
.tt-soon { color: #8A5A00; }
.tt-empty-icon {
    width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px; background: #EEF4F8; color: #004D78;
    display: flex; align-items: center; justify-content: center; font-size: 22px;
}
.tt-empty-title { font: 600 14px/1.4 Inter, sans-serif; color: #1F2933; margin: 0 0 4px; }

@media (max-width: 768px) {
    .tt-toolbar, .tt-body { padding: 14px; }
    .tt-timeline { padding: 4px 14px 8px; }
    .tt-links a { padding: 12px 14px; }
    .tt-table thead th, .tt-table tbody td { padding: 10px 12px; }
    .tt-number { font-size: 18px; }
}

/* ===== реестры: доп. к базе ===== */
.tt-registry { margin-bottom: 16px; }
.tt-registry .tt-table tbody tr { cursor: default; }
.tt-kicker-inline { font: 600 11px/1.3 Inter, sans-serif; letter-spacing: .06em; text-transform: uppercase; color: #64748B; }
.tt-sub + .tt-sub { margin-top: 2px; }
.tt-col-act { width: 1%; white-space: nowrap; text-align: right; }
/* действие строки: иконка 32×32, цвет появляется на ховере */
.tt-icon-btn {
    display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border-radius: 9px;
    color: #64748B; border: 1px solid transparent; text-decoration: none; font-size: 18px;
    transition: background .15s ease, color .15s ease, border-color .15s ease;
}
.tt-icon-btn:hover { background: #F2F8FF; border-color: #B9D4E6; color: #004D78; text-decoration: none; }

/* ===== мини-карточки связанных сущностей (объект ↔ тендер ↔ договор ↔ доп. соглашение) ===== */
.tt-rel { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin-bottom: 16px; }
.tt-rel-item {
    display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; border-radius: 12px;
    background: #FFFFFF; border: 1px solid #E3EBF2; color: #1F2933; text-decoration: none; min-width: 0;
    transition: border-color .15s ease, background .15s ease;
}
a.tt-rel-item:hover { border-color: #B9D4E6; background: #F7FBFE; text-decoration: none; color: #1F2933; }
.tt-rel-icon {
    flex: 0 0 auto; width: 32px; height: 32px; border-radius: 9px; background: #EEF4F8; color: #004D78;
    display: inline-flex; align-items: center; justify-content: center; font-size: 17px;
}
.tt-rel-body { min-width: 0; flex: 1 1 auto; }
.tt-rel-title { font: 600 13px/1.35 Inter, sans-serif; color: #111827; overflow-wrap: anywhere; }
.tt-rel-go { flex: 0 0 auto; color: #94A3B8; font-size: 18px; align-self: center; }
a.tt-rel-item:hover .tt-rel-go { color: #004D78; }
.tt-rel .tt-inline { margin-top: 6px; }

/* ===== ajax: поиск и табы ===== */
.lazy-search-content { position: relative; }
.lazy-search-content.lazy-search-loading, [data-mdn-swap].mdn-swapping { opacity: .55; pointer-events: none; transition: opacity 180ms ease; }
.mdn-progress {
    position: fixed; top: 0; left: 0; height: 3px; width: 0; opacity: 0; z-index: 999999; pointer-events: none;
    background: linear-gradient(90deg, #004D78 0%, #10C469 50%, #004D78 100%); background-size: 200% 100%;
    border-radius: 0 3px 3px 0; animation: mdn-progress-shimmer 1.2s linear infinite;
}
@keyframes mdn-progress-shimmer { 0% { background-position: 0% 0; } 100% { background-position: 200% 0; } }
.mdn-load-error { margin-bottom: 12px; }

/* ===== экран просмотра: шапка, секции, боковая колонка ===== */
.tt-head .tt-body { padding: 20px 24px; }
.tt-head .tt-number { font-size: 22px; }
.tt-lead { margin: 8px 0 0; font: 500 13px/1.5 Inter, sans-serif; color: #475569; max-width: 860px; }
.tt-head-facts { margin-top: 20px; padding-top: 20px; border-top: 1px solid #E7EEF4; }
.tt-head-facts .tt-kv-v { font-size: 14px; font-weight: 600; }
.tt-page .tt-card .card { box-shadow: none; }
/* в боковой колонке мини-карточки в один столбец и без своей рамки — карточка уже есть */
.tt-rel-col { grid-template-columns: 1fr; gap: 0; margin: 0; }
.tt-rel-col .tt-rel-item { border: 0; border-radius: 0; border-bottom: 1px solid #EDF2F7; padding: 14px 20px; }
.tt-rel-col .tt-rel-item:last-child { border-bottom: 0; }
/* раскрывающаяся мини-карточка (перейти некуда, подробности на месте) */
details.tt-rel-details, .tt-rel-col details.tt-rel-details { display: block; padding: 0; }
details.tt-rel-details > summary { display: flex; align-items: flex-start; gap: 12px; padding: 12px 16px; cursor: pointer; list-style: none; }
.tt-rel-col details.tt-rel-details > summary { padding: 14px 20px; }
details.tt-rel-details > summary::-webkit-details-marker { display: none; }
details.tt-rel-details > summary:hover { background: #F7FBFE; }
details.tt-rel-details .tt-rel-go { transition: transform .15s ease; }
details.tt-rel-details[open] .tt-rel-go { transform: rotate(180deg); color: #004D78; }
.tt-rel-more { padding: 0 20px 16px 64px; }
.tt-rel-more .tt-kv { grid-template-columns: 1fr; gap: 10px; }
/* старые bootstrap-карточки внутри нового макета (лента операций, финансы, файлы) — под общий вид */
.tt-page .card { background: #FFFFFF; border: 1px solid #E3EBF2 !important; border-radius: 16px; box-shadow: none; margin-bottom: 16px; overflow: hidden; }
.tt-page .card > .card-body { padding: 20px; }
.tt-page .header-title { font: 600 13px/1.2 Inter, sans-serif !important; letter-spacing: 0; text-transform: none; color: #1F2933; margin-bottom: 16px !important; }
.tt-page .header-title a { color: #1F2933; }
.tt-page .header-title a:hover { color: #004D78; }
.tt-page .tt-card .tt-card { border: 0; border-radius: 0; margin: 0; }
