/* agency.css - модуль «Кадровое агентство» (ag-*). Только токены дизайна v4 (style.css), шрифт наследуется (Manrope).
   Адаптив как в handoff 06: ≤1050 планшет, ≤740 телефон. Подключается после platform.css. */

.ag-root{display:block;min-width:0}
.ag-loading{display:flex;gap:10px;align-items:center;justify-content:center;padding:48px 20px;color:var(--muted);font-size:14px;background:var(--white);border:1px dashed var(--line);border-radius:22px}
.ag-root .pf-heading-actions .button.small{padding:11px 18px}

/* Сетки и панели */
.ag-grid{margin-top:4px}
.ag-grid .pf-panel{margin-top:0}
.ag-form-panel .pf-form-actions{margin-top:16px}
.ag-agencies{list-style:none;margin:0;padding:0;display:flex;flex-direction:column;gap:8px}
.ag-agencies li{display:flex;flex-direction:column;gap:2px;padding:10px 14px;border:1px solid var(--line);border-radius:14px;background:var(--paper)}
.ag-agencies b{font-size:13.5px}
.ag-agencies small{font-size:12px;color:var(--muted)}

/* Панель инструментов: вкладки и поиск */
.ag-toolbar{display:flex;gap:14px;align-items:center;justify-content:space-between;flex-wrap:wrap;margin-bottom:18px}
.ag-toolbar .pf-tabs{margin:0}
.ag-search{display:flex;align-items:center;gap:10px;background:var(--white);border:1px solid var(--line);border-radius:14px;padding:0 14px;min-width:260px;flex:1 1 260px;max-width:420px;color:var(--muted);transition:border-color .15s,box-shadow .15s}
.ag-search input{border:0;border-radius:0;padding:12px 0;flex:1;min-width:0;background:transparent;font-size:14px;color:var(--ink)}
.ag-search input:focus{outline:none}
.ag-search:focus-within{border-color:var(--blue);box-shadow:0 0 0 3px color-mix(in srgb,var(--blue) 12%,var(--white))}
.ag-search-modal{margin-top:16px;max-width:none}
/* Поиск и сортировка пула (правка заказчика 05.11.2026) */
.ag-toolbar-tools{display:flex;align-items:center;gap:10px;flex:1 1 420px;justify-content:flex-end;min-width:0}
.ag-toolbar-tools .ag-search{flex:1 1 220px;min-width:200px}
.ag-sort{display:flex;align-items:center;gap:8px;background:var(--white);border:1px solid var(--line);border-radius:14px;padding:0 12px 0 14px;color:var(--muted);flex:0 1 auto;min-width:0;transition:border-color .15s,box-shadow .15s}
.ag-sort:focus-within{border-color:var(--blue);box-shadow:0 0 0 3px color-mix(in srgb,var(--blue) 12%,var(--white))}
.ag-sort-label{display:inline-flex;align-items:center;gap:5px;font-size:11px;letter-spacing:.06em;text-transform:uppercase;font-weight:700;white-space:nowrap}
.ag-sort-label svg{transform:rotate(90deg)}
.ag-sort select{border:0;border-radius:0;padding:12px 0;background:transparent;font-size:13.5px;font-weight:650;color:var(--ink);max-width:260px;min-width:0;cursor:pointer}
.ag-sort select:focus{outline:none}
.ag-th-sort{display:inline-flex;align-items:center;gap:5px;background:none;padding:0;font:inherit;letter-spacing:inherit;text-transform:inherit;color:inherit;cursor:pointer;border-radius:6px}
.ag-th-sort:hover{color:var(--ink)}
.ag-th-sort.is-active{color:var(--blue)}
.ag-th-arrow{display:inline-flex;opacity:0;transition:opacity .15s,transform .15s}
.ag-th-sort:hover .ag-th-arrow{opacity:.5}
.ag-th-sort.is-active .ag-th-arrow{opacity:1}
.ag-th-arrow.is-desc{transform:rotate(180deg)}
.ag-th-arrow svg{transform:rotate(-45deg)}

/* Карточки заявок и договоров */
.ag-requests{display:flex;flex-direction:column;gap:16px}
.ag-request,.ag-contract{padding:22px 24px}
.ag-request-head{display:flex;justify-content:space-between;gap:20px;align-items:flex-start;margin-bottom:16px;flex-wrap:wrap}
.ag-request-head>div:first-child{min-width:0;flex:1 1 320px}
.ag-request-head h2{font-size:20px;letter-spacing:-.02em;margin:4px 0 6px;line-height:1.2}
.ag-request-head .section-label{margin:0}
.ag-request-meta{color:var(--muted);font-size:13px;line-height:1.5}
.ag-request-cond{font-size:13.5px;line-height:1.55;margin-top:8px;max-width:640px}
.ag-request-side{display:flex;flex-direction:column;align-items:flex-end;gap:10px;flex:none}
.ag-progress{display:flex;align-items:center;gap:10px;font-size:12px;color:var(--muted);white-space:nowrap;font-weight:600}
.ag-progress-bar{width:120px;height:6px;border-radius:999px;background:var(--paper);border:1px solid var(--line);overflow:hidden}
.ag-progress-bar span{display:block;height:100%;background:var(--blue);border-radius:999px;transition:width .4s var(--ease-out,ease)}
.ag-progress-bar.done span{background:#3a6731} /* зелёный тега дизайна (.tag.green), токена нет */
.ag-request-actions{display:flex;gap:14px 18px;align-items:center;flex-wrap:wrap;margin-top:16px;font-size:13px}
.ag-request-actions:empty{display:none}
.ag-request .pf-table-wrap,.ag-contract .pf-table-wrap{border-radius:16px}
.ag-request .pf-note{margin-top:0}
.ag-request-row .pf-row-meta{margin-top:8px}
.ag-sub{font-size:14px;margin:18px 0 10px;letter-spacing:-.01em}
.ag-contract .pf-kv{margin-top:4px}

/* Ячейки таблиц */
.ag-cell{display:block;min-width:0}
.ag-cell b{display:block;font-weight:700}
.ag-cell small{display:block;color:var(--muted);font-size:12px;margin-top:2px;line-height:1.45}
.ag-cell .ag-hint{color:#856627} /* текст жёлтого тега дизайна (.tag.yellow), отдельного токена нет */
.ag-cell .ag-warn{color:color-mix(in srgb,var(--red) 70%,var(--ink))}

.ag-root .pf-table td .pf-table-actions{justify-content:flex-end}
.ag-assign-table .text-link{font-size:12px}

/* Лента событий обзора */
.ag-events{display:flex;flex-direction:column}
.ag-event{display:grid;grid-template-columns:12px 1fr auto;gap:12px;align-items:start;padding:12px 0;border-bottom:1px solid var(--line)}
.ag-event:first-child{padding-top:0}
.ag-event:last-child{border-bottom:0;padding-bottom:0}
.ag-event-dot{width:10px;height:10px;border-radius:50%;background:var(--muted);margin-top:5px}
.ag-event-dot.hired,.ag-event-dot.agreed{background:#3a6731}
.ag-event-dot.assigned{background:var(--blue)}
.ag-event-dot.rejected{background:var(--red)}
.ag-event-dot.new{background:#856627}
.ag-event b{display:block;font-size:13.5px}
.ag-event span{display:block;font-size:12.5px;color:var(--muted);margin-top:2px;line-height:1.45}
.ag-event time{font-size:11px;color:var(--muted);white-space:nowrap;padding-top:2px}

/* Диалоги: добавление в пул, выбор участников */
.ag-dialog p{margin-bottom:4px}
.ag-dialog .pf-form{margin-top:18px}
.ag-pick{display:flex;flex-direction:column;gap:8px;max-height:46vh;overflow:auto;margin-top:14px;padding-right:4px}
.ag-pick .pf-empty{padding:28px 16px}
.ag-pick-item{display:flex;align-items:center;gap:12px;padding:12px 14px;border:1px solid var(--line);border-radius:14px;background:var(--white);cursor:pointer;flex-wrap:wrap}
.ag-pick-item:hover{border-color:color-mix(in srgb,var(--line),var(--ink) 15%)}
.ag-pick-item:has(input:checked){border-color:var(--blue);box-shadow:0 0 0 2px color-mix(in srgb,var(--blue) 12%,var(--white))}
.ag-pick-item{flex:none;align-items:flex-start;height:auto}
.ag-pick-item input{flex:none;margin:0}
.ag-pick-item.is-busy{cursor:not-allowed;background:var(--paper)}
.ag-pick-item.is-busy b{color:var(--muted)}
.ag-pick-busy{display:block;margin-top:2px;color:var(--muted)}
.ag-pick-body{flex:1 1 160px;min-width:0;display:flex;flex-direction:column;gap:2px}
.ag-pick-body b{font-size:14px}
.ag-pick-body small{font-size:12px;color:var(--muted)}
.ag-pick-foot{display:flex;justify-content:space-between;align-items:center;gap:14px;flex-wrap:wrap;margin-top:18px;font-size:13px;color:var(--muted);font-weight:600}
.ag-pick-foot .dialog-actions{margin-top:0}
.ag-over{color:var(--red)}

/* Планшет */
@media (max-width:1050px){
  .ag-request-side{flex-direction:row;align-items:center;flex-wrap:wrap;width:100%;justify-content:space-between}
}

/* Телефон */
@media (max-width:740px){
  .ag-request,.ag-contract{padding:18px}
  .ag-request-head h2{font-size:18px}
  .ag-toolbar{align-items:stretch}
  .ag-toolbar .pf-tabs{width:100%}
  .ag-search{min-width:0;max-width:none;width:100%}
  .ag-toolbar-tools{flex-direction:column;align-items:stretch;width:100%}
  .ag-toolbar-tools .ag-search{min-width:0;flex:0 0 auto}
  .ag-sort{width:100%}
  .ag-sort select{flex:1;max-width:none}
  .ag-progress-bar{width:90px}
  .ag-event{grid-template-columns:12px 1fr}
  .ag-event time{grid-column:2}
  .ag-pick{max-height:40vh}
  .ag-root .pf-heading-actions{width:100%}
  .ag-root .pf-heading-actions .button{flex:1 1 auto}
}

/* QA 05.11 BUG-115: тач-цели на телефоне - «Договор с агентством (PDF)», «Скачать PDF», ссылки в таблицах не ниже 40-44 px */
@media (max-width:740px){
  .ag-root .button.small,.ag-request-actions .button{min-height:40px}
  .ag-root .text-link,.ag-request-actions a{min-height:44px;display:inline-flex;align-items:center}
  .ag-root input[type=checkbox]{width:22px;height:22px}
  .ag-pick-item{min-height:44px;height:auto}
  .ag-pick-item .tag{flex-basis:100%;width:fit-content;max-width:100%;margin-left:34px}
}

/* QA 07.11 BUG-037: таблица кандидатов заявки - колонка «Кандидат» не ужимается, стаж в строку, действия по содержимому */
@media (min-width:1051px){
  .ag-assign-table td:first-child{min-width:150px;width:auto}
  /* повторная приёмка 07.11: стаж перенесён в ячейку кандидата; подписи колонок с меньшей разрядкой, поля уже - таблица
     помещается в карточку заявки и на 1280 (колонка ~510 px) */
  html body.pf-authed.in-workspace .ag-assign-table th{letter-spacing:.04em}
  html body.pf-authed.in-workspace .ag-assign-table th,html body.pf-authed.in-workspace .ag-assign-table td{padding-left:8px;padding-right:8px}
  html body.pf-authed.in-workspace .ag-assign-table th:first-child,html body.pf-authed.in-workspace .ag-assign-table td:first-child{padding-left:14px}
  html body.pf-authed.in-workspace .ag-assign-table th:last-child,html body.pf-authed.in-workspace .ag-assign-table td:last-child{padding-right:12px}
  .ag-assign-table th:last-child,.ag-assign-table td:last-child{width:1%}
  .ag-assign-table td:last-child .pf-table-actions{flex-direction:column;align-items:stretch}
}

/* QA 07.11 BUG-113: поле поиска пула не уже плейсхолдера («ФИО, профессия, гражданство»); если рядом с вкладками
   места мало - поиск и сортировка переходят строкой ниже */
.ag-toolbar-tools{flex:1 1 600px}
.ag-toolbar-tools .ag-search{min-width:280px;max-width:none}
@media (max-width:740px){.ag-toolbar-tools .ag-search{min-width:0}}

/* Повторная визуальная приёмка 07.11: в карточном режиме таблиц (≤1050) кнопки действий - от левого края значения, как в
   platform.css; правило .ag-root ... flex-end выше перебивало его, и «На e-mail» висел справа, а стрелка - строкой ниже */
@media (max-width:1050px){
  .ag-root .pf-table td .pf-table-actions{justify-content:flex-start}
}

/* Заявка на подбор персонала (образец заказчицы): форма во всю ширину над списком заявок, разделы 1-5 раскрываются,
   позиции - строками; после первой заявки форма свёрнута до заголовка с кнопкой «Новая заявка» */
.ag-employer{display:flex;flex-direction:column;gap:18px;margin-top:4px;min-width:0}
.ag-employer .pf-panel{margin-top:0}
.ag-form-panel.is-collapsed>:not(.pf-panel-heading){display:none}
.ag-form-panel .pf-panel-heading{flex-wrap:wrap;gap:10px}
.ag-rf{display:flex;flex-direction:column;gap:14px;min-width:0;margin-top:16px}
.ag-form-panel .pf-panel-heading+.pf-note{margin-top:0}
.ag-rf-grid{min-width:0;align-items:end}
.ag-rf-main .pf-form-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
.ag-rf-grid-4,.ag-rf-sec-body>.pf-form-grid{grid-template-columns:repeat(4,minmax(0,1fr))}
.ag-rf-sections{display:flex;flex-direction:column;gap:10px}
.ag-rf-sec{border:1px solid var(--line);border-radius:18px;background:var(--white);min-width:0}
.ag-rf-sec>summary{display:flex;align-items:center;gap:14px;padding:14px 18px;cursor:pointer;list-style:none;border-radius:18px}
.ag-rf-sec>summary::-webkit-details-marker{display:none}
.ag-rf-sec>summary:hover{background:var(--paper)}
.ag-rf-sec>summary:focus-visible{outline:2px solid var(--blue);outline-offset:2px}
.ag-rf-sec>summary svg{flex:none;margin-left:auto;transform:rotate(90deg);transition:transform .2s ease;color:var(--muted)}
.ag-rf-sec[open]>summary svg{transform:rotate(-90deg)}
.ag-rf-num{flex:none;display:inline-grid;place-items:center;width:30px;height:30px;border-radius:50%;background:var(--paper);border:1px solid var(--line);font-weight:800;font-size:13px}
.ag-rf-sec[open] .ag-rf-num{background:var(--blue);border-color:var(--blue);color:var(--white)}
.ag-rf-sec-title{display:flex;flex-direction:column;gap:2px;min-width:0}
.ag-rf-sec-title b{font-size:15px}
.ag-rf-sec-title small{font-size:12.5px;color:var(--muted);font-weight:500}
.ag-rf-sec-body{padding:4px 18px 18px;display:flex;flex-direction:column;gap:14px;min-width:0}
.ag-rf-lead{margin:0;font-size:13px;color:var(--muted);font-weight:600}
.ag-rf-sub{margin:6px 0 0;font-size:13px;text-transform:uppercase;letter-spacing:.06em;color:var(--muted)}
.ag-rf-positions{display:flex;flex-direction:column;gap:12px}
.ag-rf-pos{margin:0;padding:14px 16px 16px;border:1px solid var(--line);border-radius:16px;background:var(--paper);min-width:0}
.ag-rf-pos legend{display:flex;align-items:center;gap:12px;padding:0 6px;font-size:13px;font-weight:700}
.ag-rf-pos legend .button{padding:6px 12px;min-height:0;font-size:12.5px}
.ag-rf-pos legend .button[hidden]{display:none}
.ag-rf-pos-foot{display:flex;align-items:center;justify-content:space-between;gap:12px;flex-wrap:wrap;font-weight:600}
.ag-rf-checks{margin:0;padding:0;border:0;min-width:0;grid-column:1 / -1}
.ag-rf-checks legend{padding:0;margin-bottom:8px}
.ag-rf-checks-list{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));gap:8px 18px}
.ag-rf-checks-list .pf-check{grid-column:auto}
.ag-rf-required{font-size:13px}
.ag-rf-agencies>summary{cursor:pointer;font-weight:700;font-size:13.5px;padding:6px 0}
.ag-rf-agencies .ag-agencies{display:grid;grid-template-columns:repeat(auto-fill,minmax(240px,1fr));margin-top:8px}

/* Полная заявка в карточке заявки */
.ag-rf-view{margin-top:14px;display:flex;flex-direction:column;gap:12px;min-width:0}
.ag-rf-more>summary{cursor:pointer;font-weight:700;font-size:13.5px;color:var(--blue)}
.ag-rf-view-body{display:flex;flex-direction:column;gap:14px;margin-top:10px}
.ag-rf-view-block .pf-kv{margin-top:8px}
.ag-rf-view-block .pf-kv dd{white-space:pre-line;overflow-wrap:anywhere}
.ag-rf-taken{display:block;color:var(--muted);font-size:12px}
.ag-rf-media{display:flex;flex-direction:column;gap:6px;margin-top:12px}
.ag-rf-media-label{font-size:11px;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;font-weight:700}
.ag-rf-links{margin:0;padding:0;list-style:none;display:flex;flex-wrap:wrap;gap:4px 18px;overflow-wrap:anywhere}
.ag-pick-pos{margin:12px 0}
.ag-pick-pos select{width:100%}

@media (max-width:1050px){
  .ag-rf-main .pf-form-grid,.ag-rf-grid-4,.ag-rf-sec-body>.pf-form-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
}
@media (max-width:740px){
  .ag-rf-main .pf-form-grid,.ag-rf-grid-4,.ag-rf-sec-body>.pf-form-grid{grid-template-columns:1fr}
  .ag-rf-sec>summary{padding:12px 14px;gap:10px}
  .ag-rf-sec-body{padding:4px 12px 14px}
  .ag-rf-pos{padding:12px}
  .ag-rf-checks-list{grid-template-columns:1fr}
  .ag-rf-pos-foot .button{width:100%}
  .ag-form-panel .pf-form-actions .button{width:100%}
}
