/* People and communication: Mesaje, Utilizatori, Alocări, Jurnal, Profil. */

.ppl-search { min-width: 0; }
.ppl-search > .icon { left: 12px; width: 16px; height: 16px; }
.ppl-search > .input { padding-left: 36px; }

/* ================================================================== */
/* Mesaje                                                             */
/* ================================================================== */

.chat {
  display: grid; grid-template-columns: 340px minmax(0, 1fr);
  height: calc(100vh - var(--topbar-h) - 100px); min-height: 520px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl);
  overflow: hidden;
}
.chat--single { grid-template-columns: minmax(0, 1fr); }

/* List */
.chat__list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--surface); }
.chat__list-head { display: flex; flex-direction: column; gap: 14px; padding: 20px 20px 16px; border-bottom: 1px solid var(--line); }
.chat__list-title { font-size: var(--text-xl); letter-spacing: -0.02em; }
.chat__items { list-style: none; flex: 1; min-height: 0; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.chat__items > li[hidden] { display: none; }
.chat__none { padding: 20px; font-size: var(--text-sm); text-align: center; }

.convo {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: var(--r-md); color: var(--ink);
  transition: background 0.15s var(--ease);
}
.convo:hover { background: var(--surface-2); color: var(--ink); }
.convo[aria-current='true'] { background: var(--primary-soft); }
.convo[aria-current='true']::before {
  content: ''; position: absolute; left: 0; top: 12px; bottom: 12px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--primary);
}
.convo__body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.convo__top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.convo__name { font-size: var(--text-md); font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo__time { flex-shrink: 0; font-size: var(--text-xs); font-weight: 650; color: var(--muted); font-variant-numeric: tabular-nums; }
.convo__preview { font-size: var(--text-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo--unread .convo__name { font-weight: 800; }
.convo--unread .convo__preview { color: var(--ink-2); font-weight: 650; }
.convo--unread .convo__time { color: var(--primary-ink); }
.convo__dot { flex-shrink: 0; width: 10px; height: 10px; border-radius: 50%; background: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

/* Thread */
.chat__thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--paper); }
.chat__thread--empty { justify-content: center; }
.chat__head {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 20px; min-height: 72px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.chat__who { flex: 1; min-width: 0; }
.chat__title { font-size: var(--text-lg); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat__sub { margin-top: 2px; font-size: var(--text-sm); color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat__back { display: none; }
.chat__project { flex-shrink: 0; }

.chat__log {
  list-style: none; flex: 1; min-height: 0; overflow-y: auto;
  display: flex; flex-direction: column; gap: 16px;
  padding: 24px clamp(16px, 3vw, 32px);
}
.chat__log:focus-visible { border-radius: 0; box-shadow: inset var(--ring); }
.chat__log--empty { justify-content: center; }

.msg-day { display: flex; align-items: center; gap: 12px; font-size: var(--text-xs); font-weight: 750; color: var(--muted); }
.msg-day::before, .msg-day::after { content: ''; flex: 1; height: 1px; background: var(--line); }
.msg-day span { padding: 4px 10px; border-radius: var(--r-pill); background: var(--surface); border: 1px solid var(--line); }

.msg-group { display: flex; align-items: flex-end; gap: 10px; max-width: min(640px, 86%); }
.msg-group--mine { align-self: flex-end; flex-direction: row-reverse; }
.msg-group__body { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.msg-group--mine .msg-group__body { align-items: flex-end; }
.msg-group__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 4px 2px; font-size: var(--text-xs); color: var(--muted); }
.msg-group__meta strong { font-size: var(--text-sm); color: var(--ink); font-weight: 750; }
.msg-group__time { font-variant-numeric: tabular-nums; }
.msg-role { padding: 1px 8px; border-radius: var(--r-pill); background: var(--neutral-soft); color: var(--neutral); font-weight: 750; }

.bubble {
  padding: 10px 14px; border-radius: 18px 18px 18px 6px;
  background: var(--surface); border: 1px solid var(--line); color: var(--ink);
  font-size: var(--text-md); line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere;
}
.msg-group--mine .bubble { border-radius: 18px 18px 6px 18px; background: var(--primary-soft); border-color: transparent; }

/* Composer */
.composer { padding: 14px 20px 12px; background: var(--surface); border-top: 1px solid var(--line); }
.composer__box {
  display: flex; align-items: flex-end; gap: 10px;
  padding: 6px 6px 6px 14px; border: 1px solid var(--line-strong); border-radius: var(--r-lg);
  background: var(--surface); transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.composer__box:focus-within { border-color: var(--primary); box-shadow: var(--ring); }
.composer__input {
  flex: 1; min-width: 0; min-height: 44px; max-height: 168px; padding: 11px 0;
  border: 0; background: none; resize: none; outline: none;
  font-size: var(--text-base); line-height: 1.45; color: var(--ink);
}
.composer__input:focus-visible { box-shadow: none; }
.composer__input::placeholder { color: var(--muted); }
.composer__send { flex-shrink: 0; }
.composer__hint { margin-top: 8px; font-size: var(--text-xs); color: var(--muted); }

@media (max-width: 960px) {
  .chat {
    grid-template-columns: minmax(0, 1fr);
    height: calc(100vh - var(--topbar-h) - 128px);
    height: calc(100dvh - var(--topbar-h) - 128px);
    min-height: 440px;
  }
  .chat[data-view='list'] .chat__thread { display: none; }
  .chat[data-view='thread'] .chat__list { display: none; }
  .chat__list { border-right: 0; }
  .chat__back { display: inline-flex; flex-shrink: 0; }
  .chat__head { padding: 12px; gap: 10px; }
  .chat__head .avatar { width: 36px; height: 36px; }
  .composer { padding: 12px; }
  .composer__hint { display: none; }
  .msg-group { max-width: 92%; }
}
@media (max-width: 520px) {
  .chat__project span { display: none; }
  .chat__project { width: 36px; padding: 0; }
  .composer__send span { display: none; }
  .composer__send { width: 44px; padding: 0; }
}

/* ================================================================== */
/* Utilizatori                                                        */
/* ================================================================== */

.ppl-toolbar { align-items: center; }
.ppl-toolbar .ppl-search { flex: 0 1 300px; }
@media (max-width: 720px) { .ppl-toolbar .ppl-search { flex: 1 1 100%; } }
.ppl-user { display: flex; align-items: center; gap: 12px; }
.ppl-actions { display: inline-flex; flex-wrap: nowrap; justify-content: flex-end; gap: 6px; }
.ppl-row--off .ppl-user, .ppl-row--off td:nth-child(3) { opacity: 0.6; }

/* ================================================================== */
/* Alocări                                                            */
/* ================================================================== */

.load-grid { list-style: none; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 230px), 1fr)); }
.load-card { display: flex; flex-direction: column; gap: 14px; padding: 20px; }
.load-card--hot { border-color: var(--danger-soft); box-shadow: inset 0 0 0 1px var(--danger-soft); }
.load-card__top { display: flex; align-items: center; gap: 12px; }
.load-card__name { font-weight: 750; font-size: var(--text-md); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load-card__sub { font-size: var(--text-xs); color: var(--muted); font-weight: 650; }
.load-card__num { display: flex; align-items: baseline; gap: 8px; font-size: var(--text-sm); }
.load-card__num .display { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.03em; line-height: 1; }
.load-card--hot .load-card__num .display { color: var(--danger); }
.load-card__warn { display: flex; align-items: center; gap: 6px; font-size: var(--text-xs); font-weight: 750; color: var(--danger); }
.load-card__ok { font-size: var(--text-xs); font-weight: 650; color: var(--muted); }
.progress--danger > span { background: var(--danger); }
.alloc-select { max-width: 260px; }

/* ================================================================== */
/* Jurnal activitate                                                  */
/* ================================================================== */

.tl-card { display: flex; flex-direction: column; gap: 28px; }
.tl-group__title { margin-bottom: 8px; font-family: var(--font-ui); font-size: var(--text-xs); font-weight: 800; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.tl { list-style: none; position: relative; }
.tl::before { content: ''; position: absolute; left: 17px; top: 18px; bottom: 18px; width: 2px; background: var(--line); }
.tl__item { position: relative; display: flex; align-items: flex-start; gap: 16px; padding: 12px 0; }
.tl__icon {
  position: relative; z-index: 1; width: 36px; height: 36px; flex-shrink: 0;
  display: grid; place-items: center; border-radius: 50%;
  background: var(--neutral-soft); color: var(--neutral); box-shadow: 0 0 0 4px var(--surface);
}
.tl__icon--info { background: var(--info-soft); color: var(--info); }
.tl__icon--success { background: var(--success-soft); color: var(--success); }
.tl__icon--warn { background: var(--warn-soft); color: var(--warn); }
.tl__body { flex: 1; min-width: 0; }
.tl__text { display: flex; align-items: flex-start; gap: 10px; font-size: var(--text-md); color: var(--ink-2); }
.tl__text .avatar { width: 24px; height: 24px; font-size: 10px; margin-top: -1px; }
.tl__text strong { color: var(--ink); font-weight: 750; }
.tl__meta { display: flex; gap: 6px; margin: 4px 0 0 34px; font-size: var(--text-xs); color: var(--muted); font-weight: 650; }
.tl__time { flex-shrink: 0; padding-top: 2px; font-size: var(--text-xs); font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
@media (max-width: 640px) {
  .tl__item { flex-wrap: wrap; gap: 12px; }
  .tl__time { order: 3; width: 100%; margin-left: 48px; padding-top: 0; }
  .tl__body { width: calc(100% - 48px); flex: none; }
}

/* ================================================================== */
/* Profil și setări                                                   */
/* ================================================================== */

.prof-grid { display: grid; gap: 20px; align-items: start; grid-template-columns: 320px minmax(0, 1fr); }
@media (max-width: 1000px) { .prof-grid { grid-template-columns: minmax(0, 1fr); } }
.prof-id { display: flex; flex-direction: column; align-items: center; gap: 16px; text-align: center; position: sticky; top: calc(var(--topbar-h) + 24px); }
@media (max-width: 1000px) { .prof-id { position: static; } }
.prof-id__name { font-size: var(--text-xl); overflow-wrap: anywhere; }
.prof-id__role { margin-top: 8px; }
.prof-id__facts { list-style: none; width: 100%; display: flex; flex-direction: column; gap: 10px; padding-top: 16px; border-top: 1px solid var(--line); text-align: left; }
.prof-id__facts li { display: flex; align-items: center; gap: 10px; font-size: var(--text-sm); color: var(--ink-2); min-width: 0; }
.prof-id__facts li .icon { color: var(--muted); }
.prof-id__facts li span { overflow-wrap: anywhere; }

.switch-list { list-style: none; padding: 4px 24px 8px; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 0; border-top: 1px solid var(--line); }
.switch-row:first-child { border-top: 0; }
.switch-row__label { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
div.switch-row__label { cursor: default; }
.switch-row__title { font-size: var(--text-md); font-weight: 750; color: var(--ink); }
.switch-row__desc { font-size: var(--text-sm); color: var(--muted); }

/* Toggle switch: <input type="checkbox" role="switch" class="switch"> */
.switch {
  appearance: none; -webkit-appearance: none; flex-shrink: 0; margin: 0;
  position: relative; width: 46px; height: 28px; border-radius: var(--r-pill);
  background: var(--line-strong); cursor: pointer;
  transition: background 0.18s var(--ease);
}
.switch::before {
  content: ''; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%;
  background: var(--surface); box-shadow: var(--shadow-sm);
  transition: transform 0.18s var(--ease);
}
.switch:hover { background: var(--muted); }
.switch:checked { background: var(--primary); }
.switch:checked:hover { background: var(--primary-hover); }
.switch:checked::before { transform: translateX(18px); }
.switch:focus-visible { outline: none; box-shadow: var(--ring); border-radius: var(--r-pill); }
.switch:disabled { opacity: 0.5; cursor: not-allowed; }
@media (forced-colors: active) { .switch { border: 1px solid CanvasText; } .switch::before { background: CanvasText; } }
