:root {
  color-scheme: light;
  --bg: #f4f7f8;
  --surface: #ffffff;
  --surface-2: #f9fbfb;
  --line: #dbe5e8;
  --text: #182326;
  --muted: #607176;
  --primary: #0d7c86;
  --primary-dark: #09616a;
  --accent: #e2a225;
  --danger: #b4323a;
  --ok: #23815d;
  --shadow: 0 18px 50px rgba(24, 35, 38, .12);
  --small-shadow: 0 8px 18px rgba(24, 35, 38, .12);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(13, 124, 134, .09), transparent 280px),
    var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: progress;
  opacity: .72;
}

@keyframes unreadPulse {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(226, 162, 37, .34), var(--small-shadow);
  }
  50% {
    box-shadow: 0 0 0 6px rgba(226, 162, 37, .08), var(--small-shadow);
  }
}

.chat-attention,
.risk-attention {
  border-color: var(--accent) !important;
  animation: unreadPulse 1.15s ease-in-out infinite;
}

.attention-badge {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  margin-left: 7px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  line-height: 1;
}

.app-shell {
  min-height: 100vh;
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.boot-card {
  width: min(460px, 100%);
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.92);
  box-shadow: var(--shadow);
}

.boot-card h1 {
  margin-bottom: 4px;
  font-size: 24px;
}

.boot-card p {
  margin-bottom: 0;
}

.boot-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(13, 124, 134, .18);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 520px) minmax(320px, 440px);
  align-items: center;
  justify-content: center;
  gap: 64px;
  padding: 40px;
}

.login-card,
.surface,
.modal-card,
.candidate-card,
.stat-card {
  background: rgba(255, 255, 255, .94);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.login-card {
  display: grid;
  gap: 18px;
  padding: 28px;
}

.operator-art {
  position: relative;
  min-height: 430px;
  border-radius: 8px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(8, 27, 32, .16), rgba(8, 27, 32, .02)),
    url("./assets/hr-operators.webp") center / cover no-repeat,
    linear-gradient(45deg, #0c2a30, #0d7c86);
  box-shadow: var(--shadow);
}

.operator-art::before,
.operator-art::after {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, transparent 0 24%, rgba(255,255,255,.12) 25% 26%, transparent 27% 100%),
    linear-gradient(180deg, transparent 0 20%, rgba(255,255,255,.10) 21% 22%, transparent 23% 100%);
  background-size: 72px 72px;
  animation: scan 7s linear infinite;
}

.operator-art::after {
  background:
    linear-gradient(138deg, transparent 0 54%, rgba(255,255,255,.44) 66%, rgba(255,255,255,.10) 100%);
  mix-blend-mode: screen;
  animation: pulse 3.4s ease-in-out infinite;
}

.operator-photo-shine {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 88% 10%, rgba(255,255,255,.42), transparent 22%),
    linear-gradient(180deg, transparent 0 62%, rgba(7, 29, 34, .20));
  pointer-events: none;
}

.operator-face {
  position: absolute;
  width: 138px;
  height: 172px;
  border-radius: 48% 48% 42% 42%;
  background: #ffe1c8;
  box-shadow: inset 0 -18px 0 rgba(146, 78, 57, .08), 0 18px 36px rgba(0,0,0,.16);
  z-index: 3;
  animation: operatorTalk 3.2s ease-in-out infinite;
}

.operator-face.woman {
  left: 122px;
  top: 154px;
}

.operator-face.man {
  right: 116px;
  top: 176px;
  width: 132px;
  height: 164px;
  background: #f4caa8;
  animation-delay: .45s;
}

.operator-face::before {
  content: "";
  position: absolute;
  left: -18px;
  right: -18px;
  top: -28px;
  height: 82px;
  border-radius: 48% 48% 28% 28%;
  background: #4d2c37;
}

.operator-face.man::before {
  height: 58px;
  background: #2e3a42;
  border-radius: 42% 42% 24% 24%;
}

.operator-face::after {
  content: "";
  position: absolute;
  right: -40px;
  top: 64px;
  width: 64px;
  height: 27px;
  border: 7px solid #f7fafb;
  border-left: 0;
  border-radius: 0 28px 28px 0;
}

.operator-face.man::after {
  right: auto;
  left: -40px;
  border-left: 7px solid #f7fafb;
  border-right: 0;
  border-radius: 28px 0 0 28px;
}

.operator-face span {
  position: absolute;
  left: 31px;
  right: 31px;
  top: 78px;
  height: 34px;
  border-top: 6px solid #5b4a4a;
  border-bottom: 4px solid rgba(118, 65, 65, .48);
  border-radius: 50%;
}

.call-screen {
  position: absolute;
  left: 174px;
  top: 34px;
  width: 180px;
  height: 104px;
  z-index: 2;
  border: 1px solid rgba(255,255,255,.48);
  border-radius: 8px;
  background: rgba(255,255,255,.18);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.48), 0 20px 40px rgba(0,0,0,.16);
  backdrop-filter: blur(3px);
  animation: screenFloat 4.4s ease-in-out infinite;
}

.call-screen b {
  position: absolute;
  left: 20px;
  top: 18px;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: rgba(255,255,255,.78);
}

.call-screen i {
  position: absolute;
  left: 92px;
  right: 18px;
  height: 8px;
  border-radius: 999px;
  background: rgba(255,255,255,.68);
  animation: line 1.9s ease-in-out infinite;
}

.call-screen i:nth-child(2) { top: 28px; }
.call-screen i:nth-child(3) { top: 48px; width: 50px; animation-delay: .22s; }
.call-screen i:nth-child(4) { top: 68px; width: 66px; animation-delay: .4s; }

.operator-note {
  position: absolute;
  right: 132px;
  bottom: 78px;
  width: 150px;
  height: 88px;
  z-index: 4;
  border-radius: 8px;
  background: rgba(255,255,255,.88);
  box-shadow: 0 16px 34px rgba(0,0,0,.14);
  transform: rotate(-2deg);
}

.operator-note::before {
  content: "";
  position: absolute;
  left: 20px;
  right: 20px;
  top: 18px;
  height: 10px;
  border-radius: 999px;
  background: rgba(13,124,134,.28);
}

.operator-note i {
  position: absolute;
  left: 20px;
  height: 7px;
  border-radius: 999px;
  background: rgba(24,35,38,.22);
}

.operator-note i:nth-child(1) { top: 42px; width: 104px; }
.operator-note i:nth-child(2) { top: 58px; width: 82px; }
.operator-note i:nth-child(3) { top: 74px; width: 96px; }

.operator-lines {
  position: absolute;
  left: 36px;
  bottom: 36px;
  z-index: 2;
  display: grid;
  gap: 10px;
}

.operator-lines i {
  width: 145px;
  height: 9px;
  border-radius: 10px;
  background: rgba(255,255,255,.58);
  animation: line 2s ease-in-out infinite;
}

.operator-lines i:nth-child(2) { width: 98px; animation-delay: .18s; }
.operator-lines i:nth-child(3) { width: 132px; animation-delay: .36s; }
.operator-lines i:nth-child(4) { width: 76px; animation-delay: .54s; }

@keyframes scan {
  from { background-position: 0 0; }
  to { background-position: 90px 90px; }
}

@keyframes pulse {
  0%, 100% { opacity: .48; }
  50% { opacity: .9; }
}

@keyframes line {
  0%, 100% { transform: translateX(0); opacity: .55; }
  50% { transform: translateX(-16px); opacity: .95; }
}

@keyframes operatorTalk {
  0%, 100% { transform: translateY(0); }
  45% { transform: translateY(-5px); }
}

@keyframes screenFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(6px); }
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 34px;
  line-height: 1.08;
}

h2 {
  margin-bottom: 14px;
  font-size: 24px;
}

h3 {
  margin-bottom: 12px;
  font-size: 17px;
}

.muted {
  color: var(--muted);
}

label {
  display: grid;
  gap: 7px;
  color: #314247;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c9d7db;
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 10px 12px;
  outline: 0;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(13, 124, 134, .14);
}

.button {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid #b8c9cd;
  border-radius: 8px;
  background: linear-gradient(#fff, #eef4f5);
  color: var(--text);
  font-weight: 800;
  padding: 10px 16px;
  box-shadow: inset 0 1px 0 #fff, 0 4px 0 rgba(24, 35, 38, .12), var(--small-shadow);
  transition: transform .12s ease, box-shadow .12s ease;
}

.button[aria-busy="true"] {
  position: relative;
  pointer-events: none;
}

.button[aria-busy="true"]::before {
  content: "";
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.button:hover {
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(24, 35, 38, .14), 0 5px 12px rgba(24, 35, 38, .10);
}

.button.primary {
  border-color: var(--primary-dark);
  background: linear-gradient(#13939e, var(--primary));
  color: #fff;
}

.button.warn {
  border-color: #b98918;
  background: linear-gradient(#f4c450, var(--accent));
  color: #2a210d;
}

.button.danger {
  border-color: #8f252c;
  background: linear-gradient(#c9444d, var(--danger));
  color: #fff;
}

.button.ghost {
  box-shadow: none;
  background: #fff;
}

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

.form-error,
.alert {
  margin: 0;
  padding: 12px;
  border-radius: 8px;
  border: 1px solid rgba(180, 50, 58, .22);
  background: rgba(180, 50, 58, .08);
  color: var(--danger);
}

.workspace {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

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

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), #2bb7a6);
  color: #fff;
  font-weight: 900;
  box-shadow: var(--small-shadow);
}

.top-actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  padding: 6px 12px;
  color: #314247;
  font-size: 13px;
  font-weight: 800;
}

.warn-pill {
  border-color: rgba(185, 137, 24, .42);
  background: #fff7df;
  color: #5d4408;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, .9fr);
}

.grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.surface,
.candidate-card,
.stat-card {
  padding: 18px;
}

.section-title {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

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

.detail {
  min-height: 64px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px 12px;
}

.detail span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 4px;
}

.detail strong {
  display: block;
  overflow-wrap: anywhere;
}

.candidate-head {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: start;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
}

.status-form {
  display: grid;
  gap: 12px;
}

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

.history-list {
  display: grid;
  gap: 10px;
  max-height: 430px;
  overflow: auto;
  padding-right: 4px;
}

.history-item {
  border-left: 4px solid var(--primary);
  background: var(--surface-2);
  border-radius: 8px;
  padding: 10px 12px;
}

.history-item strong {
  display: block;
  margin-bottom: 5px;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

th {
  background: #eaf3f4;
  color: #274147;
  font-size: 12px;
  text-transform: uppercase;
}

tr:last-child td {
  border-bottom: 0;
}

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat-card {
  box-shadow: var(--small-shadow);
}

.stat-number {
  display: block;
  font-size: 30px;
  font-weight: 900;
  line-height: 1;
}

.status-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.training-date-list {
  display: grid;
  gap: 10px;
  margin-top: 4px;
}

.training-date-list h4 {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  text-transform: uppercase;
}

.chip {
  border-radius: 999px;
  background: #eef5f6;
  border: 1px solid var(--line);
  color: #28454a;
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 800;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(20, 31, 35, .42);
  z-index: 20;
}

.modal-card {
  width: min(880px, 100%);
  max-height: min(780px, calc(100vh - 40px));
  display: grid;
  gap: 14px;
  overflow: auto;
  padding: 18px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

.empty {
  min-height: 180px;
  display: grid;
  place-items: center;
  border: 1px dashed #b9c9cd;
  border-radius: 8px;
  background: rgba(255,255,255,.54);
  color: var(--muted);
  text-align: center;
  padding: 24px;
}

.toast {
  position: fixed;
  right: 18px;
  top: 18px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 36px));
  border: 1px solid rgba(35, 129, 93, .28);
  border-radius: 8px;
  background: #effaf5;
  color: #13583f;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-weight: 800;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .18s ease, transform .18s ease;
}

.toast.bad {
  border-color: rgba(180, 50, 58, .28);
  background: #fff1f2;
  color: var(--danger);
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

.compact-topbar {
  background: rgba(255,255,255,.78);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--small-shadow);
  padding: 12px;
}

.work-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 16px;
  align-items: start;
}

.training-shell {
  display: grid;
  grid-template-columns: 360px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.training-group-list {
  display: grid;
  gap: 10px;
}

.training-group-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  box-shadow: var(--small-shadow);
}

.training-group-card.due {
  border-color: var(--accent);
  animation: unreadPulse 1.5s ease-in-out infinite;
}

.training-group-main {
  min-height: auto;
  border: 0;
  background: transparent;
  box-shadow: none;
  color: var(--text);
  display: grid;
  gap: 4px;
  padding: 0;
  text-align: left;
}

.training-group-main span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.training-import-box {
  margin: 12px 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.training-table input {
  min-width: 150px;
}

.self-added-row {
  background: #fff8f8;
}

.warn-chip {
  border-color: rgba(226, 162, 37, .45);
  background: #fff7df;
  color: #6b4b05;
}

.pulse-button {
  animation: unreadPulse 1.2s ease-in-out infinite;
}

.public-training-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.public-training-card {
  width: min(560px, 100%);
  display: grid;
  gap: 18px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,.96);
  box-shadow: var(--shadow);
}

.public-result {
  display: grid;
  gap: 8px;
  border-radius: 8px;
  padding: 12px;
}

.public-result:empty {
  display: none;
}

.public-result.ok {
  border: 1px solid rgba(35,129,93,.24);
  background: #effaf5;
  color: #13583f;
}

.public-result.bad {
  border: 1px solid rgba(180,50,58,.24);
  background: #fff1f2;
  color: var(--danger);
}

.public-result.wait {
  border: 1px solid rgba(13,124,134,.22);
  background: #eef8f9;
  color: var(--primary-dark);
}

.side-rail {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 12px;
}

.telephony-sticky {
  padding: 14px;
}

.mini-title h2 {
  font-size: 19px;
}

.action-surface {
  box-shadow: var(--small-shadow);
}

.compact-hint {
  margin: 12px 0 0;
  font-size: 13px;
}

.import-hint {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid rgba(13, 124, 134, .18);
  border-radius: 8px;
  background: #f4fbfb;
  color: #2c3e43;
  font-size: 13px;
}

.hint-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.hint-head strong {
  font-size: 14px;
}

.hint-columns {
  display: grid;
  gap: 4px;
}

.import-hint p {
  margin: 0;
}

.action-result {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  line-height: 1.35;
}

.action-result strong {
  font-size: 13px;
}

.action-result.ok {
  border: 1px solid rgba(23, 125, 88, .25);
  background: #edf9f2;
  color: #145c40;
}

.action-result.bad {
  border: 1px solid rgba(180, 50, 58, .25);
  background: #fff1f2;
  color: var(--danger);
}

.base-viewer {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.base-view-pager {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.tight-title {
  margin-bottom: 0;
}

.priority-card {
  display: grid;
  gap: 14px;
}

.candidate-head.simple {
  grid-template-columns: 1fr;
}

.candidate-phone-big {
  margin-top: 8px;
  font-size: 30px;
  font-weight: 900;
  color: var(--primary-dark);
  letter-spacing: 0;
}

.inline-status {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

.status-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(170px, 1fr));
  gap: 10px;
  align-items: end;
}

.wide-field {
  grid-column: span 2;
}

.mini-note {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid rgba(13, 124, 134, .18);
  border-radius: 8px;
  background: #f3fbfb;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.compact-form {
  display: grid;
  gap: 12px;
}

.compact-form h3 {
  margin-bottom: 2px;
}

.compact-filters {
  gap: 8px;
}

.compact-filters input,
.compact-filters select {
  width: auto;
  min-width: 170px;
}

.two-tight {
  grid-template-columns: minmax(0, .9fr) minmax(520px, 1.1fr);
  align-items: start;
}

.admin-shell {
  display: grid;
  grid-template-columns: 190px minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.admin-nav {
  position: sticky;
  top: 16px;
  display: grid;
  gap: 8px;
  padding: 10px;
  background: rgba(255,255,255,.86);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--small-shadow);
}

.tab-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(#fff, #eef4f5);
  color: #314247;
  font-weight: 900;
  text-align: left;
  padding: 9px 10px;
  box-shadow: inset 0 1px 0 #fff, 0 3px 0 rgba(24, 35, 38, .08);
}

.tab-button.active {
  border-color: var(--primary-dark);
  background: linear-gradient(#13939e, var(--primary));
  color: #fff;
}

.admin-content {
  min-width: 0;
}

.admin-form .status-row {
  grid-template-columns: repeat(3, minmax(170px, 1fr));
}

.compact-table table {
  min-width: 640px;
}

.base-viewer .compact-table table {
  min-width: 1480px;
}

.history-view-table table {
  min-width: 1380px;
}

.compact-table th,
.compact-table td {
  padding: 8px 10px;
  font-size: 13px;
}

.base-edit-input {
  width: 138px;
  min-height: 32px;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 12px;
}

.base-edit-input[data-base-field="age"] {
  width: 78px;
}

.base-edit-input[data-base-field="comment"],
.base-edit-input[data-base-field="last_work"],
.base-edit-input[data-base-field="education"] {
  width: 170px;
}

.telephony-overview-table {
  max-height: 620px;
  overflow: auto;
}

.telephony-overview-table table {
  min-width: 980px;
}

.telephony-overview-table th {
  position: sticky;
  top: 0;
  z-index: 1;
}

.table-actions {
  width: 1%;
  white-space: nowrap;
}

.button.tiny {
  min-height: 32px;
  padding: 6px 10px;
  font-size: 12px;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 rgba(24, 35, 38, .10), 0 5px 10px rgba(24, 35, 38, .08);
}

.small-empty {
  min-height: 72px;
  padding: 14px;
  font-size: 13px;
}

.dashboard-grid {
  display: grid;
  gap: 14px;
}

.dashboard-meta {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.dense-stats {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.dense-stats .stat-card {
  padding: 14px;
}

.dense-stats .stat-number {
  font-size: 24px;
}

.news-panel {
  margin-bottom: 16px;
  border-color: rgba(226, 162, 37, .42);
  background: #fffdf5;
}

.instruction-panel {
  margin-bottom: 16px;
  padding: 10px;
  background: #fbfefe;
  box-shadow: var(--small-shadow);
}

.instruction-panel details {
  display: grid;
  gap: 12px;
}

.instruction-panel summary {
  cursor: pointer;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  border: 1px solid rgba(13, 124, 134, .34);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, #edf8f8);
  color: var(--primary-dark);
  font-weight: 900;
  padding: 10px 14px;
  box-shadow: var(--small-shadow);
  user-select: none;
}

.instruction-panel summary::-webkit-details-marker {
  display: none;
}

.instruction-panel summary::after {
  content: "Открыть";
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  padding: 6px 10px;
  white-space: nowrap;
}

.instruction-panel details[open] summary::after {
  content: "Свернуть";
}

.instruction-button-title {
  font-size: 15px;
}

.instruction-button-meta {
  color: var(--text);
  font-size: 13px;
  margin-left: auto;
  text-align: right;
}

.instruction-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-top: 12px;
}

.instruction-grid ul {
  margin: 0;
  padding-left: 18px;
  color: #314247;
}

.instruction-grid li {
  margin-bottom: 7px;
}

.incoming-call {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  margin-bottom: 16px;
  border-color: rgba(35, 129, 93, .42);
  background:
    linear-gradient(90deg, rgba(35, 129, 93, .11), rgba(255,255,255,.96));
}

.incoming-call h2 {
  margin-bottom: 4px;
  color: #155d45;
}

.incoming-call p {
  margin-bottom: 0;
}

.call-ring {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(#35b779, var(--ok));
  color: #fff;
  font-size: 27px;
  font-weight: 900;
  box-shadow: 0 0 0 0 rgba(35, 129, 93, .38), var(--small-shadow);
  animation: phoneRing 1.1s ease-in-out infinite;
}

.incoming-call-button {
  white-space: nowrap;
}

.incoming-call-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.microphone-gate {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 18px;
  align-items: start;
  max-width: 760px;
  margin: 0 auto;
  border-color: rgba(16, 127, 137, .32);
  background: linear-gradient(120deg, rgba(16, 127, 137, .08), rgba(255,255,255,.96));
}

.mic-icon {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), #1c7f67);
  box-shadow: var(--small-shadow);
  font-size: 28px;
}

.microphone-gate h2 {
  margin-bottom: 6px;
}

@keyframes phoneRing {
  0%, 100% {
    transform: rotate(0);
    box-shadow: 0 0 0 0 rgba(35, 129, 93, .38), var(--small-shadow);
  }
  20% { transform: rotate(-10deg); }
  40% { transform: rotate(10deg); }
  60% {
    transform: rotate(-6deg);
    box-shadow: 0 0 0 12px rgba(35, 129, 93, 0), var(--small-shadow);
  }
}

.notice-card {
  border: 1px solid rgba(226, 162, 37, .34);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: var(--small-shadow);
}

.maintenance-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(180, 50, 58, .08), rgba(18, 145, 156, .08)),
    var(--bg);
}

.maintenance-card {
  width: min(560px, 100%);
  display: grid;
  gap: 14px;
  border: 1px solid rgba(180, 50, 58, .24);
  border-radius: 8px;
  background: #fff;
  padding: 26px;
  box-shadow: var(--shadow);
}

.maintenance-sign {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  border: 4px solid var(--danger);
  border-radius: 50%;
  color: var(--danger);
  font-size: 42px;
  font-weight: 900;
  line-height: 1;
}

.demo-shell {
  display: grid;
  gap: 16px;
}

.demo-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.demo-card {
  border-color: rgba(226, 162, 37, .55);
}

.history-details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  padding: 10px 12px;
}

.history-details summary {
  cursor: pointer;
  font-weight: 900;
  color: var(--primary-dark);
}

.compact-list {
  display: grid;
  gap: 10px;
}

.chat-admin-layout {
  display: grid;
  grid-template-columns: minmax(320px, .95fr) minmax(0, 1.05fr);
  gap: 16px;
  align-items: start;
}

.chat-panel-title {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  margin: 4px 0 10px;
}

.chat-panel-title h3 {
  margin: 0;
}

.chat-panel-title span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.messenger-surface {
  display: grid;
  gap: 14px;
  min-height: 0;
}

.messenger-layout {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(0, 1fr);
  height: clamp(520px, calc(100vh - 245px), 780px);
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
}

.messenger-sidebar {
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 10px;
  min-width: 0;
  min-height: 0;
  padding: 12px;
  background: #f6faf9;
  border-right: 1px solid var(--line);
}

.messenger-dialog-list {
  min-height: 0;
  overflow: auto;
  display: grid;
  align-content: start;
  gap: 6px;
  padding-right: 2px;
}

.messenger-dialog {
  width: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 72px;
  padding: 9px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  box-shadow: none;
}

.messenger-dialog:hover,
.messenger-dialog.active {
  background: #fff;
  border-color: var(--line);
}

.messenger-dialog.has-unread {
  background: #fff;
  border-color: rgba(226, 162, 37, .44);
}

.dialog-main {
  min-width: 0;
  display: grid;
  gap: 2px;
}

.dialog-main strong,
.dialog-main small,
.dialog-main em {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dialog-main strong {
  font-size: 14px;
}

.dialog-main small {
  color: var(--muted);
  font-size: 12px;
}

.dialog-main em {
  color: #435156;
  font-size: 12px;
  font-style: normal;
}

.dialog-badge {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
}

.messenger-pane {
  position: relative;
  min-width: 0;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto auto;
  gap: 10px;
  height: 100%;
  overflow: hidden;
  padding: 12px;
  background: #fff;
}

.messenger-empty {
  min-height: 420px;
  display: grid;
  place-content: center;
  gap: 6px;
  text-align: center;
  color: var(--muted);
}

.messenger-empty strong {
  color: var(--text);
  font-size: 18px;
}

.messenger-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.messenger-head strong,
.messenger-head span {
  display: block;
}

.messenger-head strong {
  font-size: 18px;
}

.messenger-head span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.messenger-actions {
  justify-content: flex-end;
  flex-wrap: wrap;
}

.messenger-messages {
  max-height: none;
  min-height: 0;
  overflow: auto;
  align-content: start;
  padding: 10px;
}

.muted-row {
  opacity: .72;
}

.access-toolbar {
  margin-bottom: 12px;
}

.access-request-list {
  display: grid;
  gap: 10px;
}

.access-card {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: var(--small-shadow);
}

.access-card.new-request {
  border-color: rgba(13, 124, 134, .32);
  background: linear-gradient(180deg, #fff, #f7fcfc);
}

.access-card-head {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  justify-content: space-between;
}

.access-card-head strong,
.access-card-head span {
  display: block;
}

.access-card-head span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.access-decision,
.access-result {
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

.compact-details {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

details.compact-details {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  margin: 12px 0;
  box-shadow: var(--small-shadow);
}

details.compact-details > summary {
  cursor: pointer;
  font-weight: 800;
  color: var(--text);
}

.compact-details .detail {
  min-height: 54px;
  padding: 8px 10px;
}

.queue-progress {
  display: grid;
  gap: 3px;
  min-width: 220px;
}

.queue-progress strong {
  color: var(--primary-dark);
  font-size: 13px;
}

.queue-progress span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.25;
}

.compact-item {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  box-shadow: var(--small-shadow);
}

details.compact-item {
  display: block;
}

details.compact-item > summary {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.compact-item span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  margin-top: 3px;
}

.compact-item p {
  margin: 8px 0 0;
}

.unread-item {
  border-color: var(--accent);
  animation: unreadPulse 1.5s ease-in-out infinite;
}

@keyframes unreadPulse {
  0%, 100% { box-shadow: 0 0 0 rgba(226, 162, 37, 0), var(--small-shadow); }
  50% { box-shadow: 0 0 0 4px rgba(226, 162, 37, .16), var(--small-shadow); }
}

.chat-box {
  display: grid;
  gap: 12px;
}

.chat-title {
  font-weight: 900;
  color: var(--primary-dark);
}

.chat-messages {
  display: grid;
  gap: 8px;
  max-height: 430px;
  overflow: auto;
  padding: 4px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.chat-message {
  max-width: min(76%, 720px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 8px 10px;
  display: grid;
  gap: 6px;
  line-height: 1.35;
}

.chat-message.mine {
  justify-self: end;
  background: #eaf8f7;
  border-color: rgba(13, 124, 134, .24);
}

.chat-message-head {
  display: flex;
  gap: 10px;
  align-items: baseline;
  justify-content: space-between;
  min-width: 0;
}

.chat-message-head strong {
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-message-head span {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.chat-message p {
  margin: 0;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
  word-break: break-word;
}

.chat-message span {
  color: var(--muted);
  font-size: 12px;
}

.reply-preview,
.chat-image-preview {
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: rgba(13, 124, 134, .08);
  text-align: left;
}

.reply-preview {
  display: grid;
  gap: 2px;
  padding: 7px 9px;
  border-left: 3px solid var(--primary);
}

.reply-preview strong,
.reply-preview span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reply-preview strong {
  color: var(--primary-dark);
  font-size: 12px;
}

.chat-attachment {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.chat-attachment.audio-attachment {
  grid-template-columns: minmax(0, 1fr) auto;
}

.chat-audio {
  grid-column: 1 / -1;
  width: 100%;
  max-width: 360px;
  height: 34px;
}

.voice-message {
  display: flex;
  align-items: center;
  gap: 8px;
  width: min(360px, 100%);
  padding: 7px 8px;
  border: 1px solid rgba(13, 124, 134, .18);
  border-radius: 8px;
  background: rgba(13, 124, 134, .08);
}

.chat-message.mine .voice-message {
  background: rgba(13, 124, 134, .1);
}

.voice-message-icon {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--primary);
  color: #fff;
  font-size: 11px;
  line-height: 1;
}

.voice-message-body {
  min-width: 0;
  flex: 1;
  display: grid;
  gap: 3px;
}

.voice-message-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.voice-message-title strong {
  color: var(--primary-dark);
  font-size: 12px;
}

.voice-message-title span,
.voice-message-unavailable {
  color: var(--muted);
  font-size: 11px;
}

.voice-player {
  grid-column: auto;
  width: 100%;
  max-width: 280px;
  height: 30px;
}

.chat-attachment .chat-image-preview {
  grid-column: 1 / -1;
  display: block;
  padding: 0;
  overflow: hidden;
  background: #fff;
}

.chat-image-preview img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  background: #fff;
}

.chat-attachment strong,
.chat-attachment span {
  display: block;
}

.chat-attachment strong {
  overflow-wrap: anywhere;
}

.chat-message-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.text-button {
  border: 0;
  background: transparent;
  color: var(--primary-dark);
  font-size: 12px;
  font-weight: 800;
  padding: 2px 0;
}

.chat-reactions {
  display: inline-flex;
  gap: 4px;
  margin-left: auto;
}

.reaction-button {
  display: inline-flex;
  gap: 3px;
  align-items: center;
  min-height: 24px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.reaction-button.active {
  border-color: rgba(13, 124, 134, .4);
  background: #eaf8f7;
}

.reaction-button strong {
  font-size: 11px;
}

.chat-compose-note {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  padding: 8px 10px;
  border: 1px solid rgba(13, 124, 134, .24);
  border-radius: 8px;
  background: #f2fbfa;
}

.chat-compose-note.edit-note {
  border-color: rgba(226, 162, 37, .36);
  background: #fff9ec;
}

.chat-compose-note strong,
.chat-compose-note span {
  display: block;
}

.chat-compose-note span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 2px;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto auto auto auto;
  gap: 8px;
  align-items: stretch;
  padding-top: 10px;
  border-top: 1px solid var(--line);
  background: #fff;
}

.chat-form textarea {
  min-height: 48px;
  resize: vertical;
}

.messenger-form {
  align-items: start;
}

.messenger-form textarea {
  min-height: 54px;
  max-height: 110px;
}

.icon-button {
  min-width: 44px;
  padding-left: 10px;
  padding-right: 10px;
}

.voice-button.recording {
  border-color: rgba(180, 50, 58, .45);
  background: #fff1f2;
  color: var(--danger);
}

.chat-compose-meta {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  min-height: 18px;
  color: var(--muted);
  font-size: 12px;
}

.chat-file-name,
.voice-status {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chat-text-counter {
  flex: 0 0 auto;
  font-weight: 800;
}

.chat-text-counter.near-limit {
  color: var(--danger);
}

.chat-history-form {
  margin-bottom: 12px;
}

.chat-history-result {
  max-height: min(560px, calc(100vh - 300px));
  overflow: auto;
}

.chat-history-list {
  display: grid;
  gap: 8px;
}

.chat-history-item {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.chat-history-item p {
  margin: 0;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.chat-history-meta {
  color: var(--muted);
  font-size: 12px;
}

.chat-bottom-button {
  position: absolute;
  right: 18px;
  bottom: 86px;
  z-index: 2;
  box-shadow: var(--small-shadow);
}

.message-flash {
  outline: 3px solid rgba(226, 162, 37, .42);
  outline-offset: 2px;
}

.check-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.check-line input {
  width: auto;
  min-height: auto;
}

.chip-button {
  cursor: pointer;
  box-shadow: inset 0 1px 0 #fff, 0 2px 0 rgba(24, 35, 38, .08);
}

.hidden {
  display: none !important;
}

@media (max-width: 980px) {
  .login-screen,
  .boot-card,
  .grid.two,
  .grid.three,
  .stats-row,
  .dense-stats,
  .details,
  .conditional-fields,
  .work-grid,
  .training-shell,
  .admin-shell,
  .messenger-layout,
  .two-tight,
  .incoming-call,
  .microphone-gate,
  .instruction-grid,
  .compact-details,
  .status-row,
  .admin-form .status-row {
    grid-template-columns: 1fr;
  }

  .side-rail,
  .admin-nav {
    position: static;
  }

  .admin-nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operator-art {
    min-height: 280px;
  }

  .topbar,
  .candidate-head {
    grid-template-columns: 1fr;
  }

  .incoming-call-actions {
    justify-content: flex-start;
  }

  .messenger-layout {
    height: auto;
    max-height: none;
    min-height: auto;
  }

  .messenger-sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
    max-height: 340px;
  }

  .messenger-pane {
    min-height: 520px;
    max-height: 620px;
  }

  .messenger-head {
    align-items: stretch;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .workspace,
  .login-screen {
    padding: 16px;
  }

  .login-screen {
    gap: 18px;
  }

  h1 {
    font-size: 28px;
  }

  .top-actions,
  .toolbar {
    align-items: stretch;
    flex-direction: column;
  }

  .button {
    width: 100%;
  }

  .compact-filters input,
  .compact-filters select {
    width: 100%;
  }

  .chat-form {
    grid-template-columns: 1fr;
  }

  .messenger-actions,
  .chat-message-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .chat-message,
  .chat-message.mine {
    max-width: 100%;
    justify-self: stretch;
  }

  .chat-bottom-button {
    position: static;
    width: 100%;
  }

  .compact-item {
    align-items: stretch;
    flex-direction: column;
  }
}
