/*
 * Reusable components: buttons, form fields, tabs, data grid, popups,
 * modal, drawer, toasts, avatars. The real app uses DevExtreme widgets with a
 * Teams theme; these styles reproduce their look (measured from screenshots).
 */

/* ---------------- Buttons ---------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  height: var(--btn-h); min-width: 92px; padding: 0 18px; border-radius: 2px;
  border: 1px solid var(--accent); background: #fff; color: var(--accent-text);
  font-size: var(--fs-base); font-weight: 600; white-space: nowrap; line-height: 1;
}
.btn:hover { background: #F4F4FC; }
.btn:disabled, .btn.is-disabled { opacity: 0.55; cursor: default; }
.btn-primary { background: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-hover); }
.btn-primary:disabled:hover { background: var(--accent); }
.btn svg.i { width: 16px; height: 16px; }
.btn-danger { background: #C4314B; border-color: #C4314B; color: #fff; }
.btn-row { display: flex; gap: 5px; align-items: center; }
.btn-row--end { justify-content: flex-end; gap: 12px; }
.form-actions { padding: 18px 0 20px 0; display: flex; gap: 5px; }

.link-btn { background: none; border: 0; padding: 0; color: var(--accent-text); font-size: inherit; cursor: pointer; }
.link-btn:hover { text-decoration: underline; }
.icon-btn {
  width: 36px; height: 36px; border: 0; border-radius: 2px; background: transparent; color: var(--text-secondary);
  display: inline-flex; align-items: center; justify-content: center;
}
.icon-btn:hover { background: #EDEBE9; color: var(--text); }
.icon-btn:disabled { color: var(--text-disabled); background: transparent; cursor: default; }

/* ---------------- Form fields ---------------- */
.form { max-width: var(--form-w); }
.form--wide { max-width: none; }
.field { margin-bottom: 15px; }
.field__label { display: block; font-size: var(--fs-base); margin: 0 0 6px 0; line-height: 20px; }
.field__label .req { margin-left: 2px; }
.field__hint { font-size: var(--fs-small); color: var(--text-secondary); margin-top: 4px; }
.input, .textarea {
  width: 100%; height: var(--field-h); padding: 0 11px; background: #fff; color: var(--text);
  border: 1px solid var(--border); border-radius: 2px; outline: none; font-size: var(--fs-base);
}
.textarea { display: block; height: auto; min-height: 120px; padding: 9px 11px; resize: vertical; line-height: 20px; }
.input:focus, .textarea:focus { border-color: var(--accent); }
.input::placeholder, .textarea::placeholder { color: var(--text-muted); }
.input:disabled, .textarea:disabled { background: #FAF9F8; color: var(--text-secondary); }
.input.is-invalid, .textarea.is-invalid, .select.is-invalid .select__box { border-color: #C4314B; }
.field__error { color: #C4314B; font-size: var(--fs-small); margin-top: 4px; }

/* Input with trailing buttons (clear "x", spinners, dropdown caret) */
.input-wrap { position: relative; display: flex; align-items: stretch; width: 100%; height: var(--field-h);
  background: #fff; border: 1px solid var(--border); border-radius: 2px; }
.input-wrap:focus-within { border-color: var(--accent); }
.input-wrap > input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; padding: 0 11px; }
.input-wrap.is-disabled { background: #FAF9F8; color: var(--text-secondary); }
.input-wrap__clear { width: 30px; border: 0; background: none; color: #8A8886; display: inline-flex; align-items: center; justify-content: center; }
.input-wrap__clear svg.i { width: 18px; height: 18px; }
.input-wrap__spin { width: 30px; display: flex; flex-direction: column; }
.input-wrap__spin button { flex: 1; border: 0; background: none; padding: 0; color: var(--text); display: flex; align-items: center; justify-content: center; }
.input-wrap__spin button svg.i { width: 9px; height: 9px; }
.input-wrap__caret { width: 34px; border: 0; background: none; color: var(--text); display: inline-flex; align-items: center; justify-content: center; }
.input-wrap__caret svg.i { width: 10px; height: 10px; }

/* Select box (DevExtreme SelectBox look) */
.select { position: relative; width: 100%; }
.select__box { cursor: pointer; }
.select__value { flex: 1; min-width: 0; padding: 0 11px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.select__value.is-placeholder { color: var(--text-muted); }
.select--compact .input-wrap { height: 30px; }
.dropdown-list { max-height: 320px; overflow-y: auto; padding: 0; }
.dropdown-list__item { padding: 9px 12px; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 18px; }
.dropdown-list__item:hover, .dropdown-list__item.is-focused { background: #F3F2F1; }
.dropdown-list__item.is-selected { background: var(--accent); color: #fff; }
.dropdown-list__empty { padding: 10px 12px; color: var(--text-muted); }
.dropdown-list__search { padding: 6px; border-bottom: 1px solid var(--row-line); }
.dropdown-list__search .input { height: 32px; }

/* Checkbox (DevExtreme CheckBox, Teams theme): white 22px box, light border, purple when checked.
   Used in lists and grids (user Queues/Skills tabs, "Enabled" boxes, column chooser). */
.check { display: inline-flex; align-items: center; gap: 13px; cursor: pointer; user-select: none; line-height: 20px; }
.check input { position: absolute; opacity: 0; width: 0; height: 0; }
.check__box {
  width: 22px; height: 22px; flex: 0 0 22px; border: 1px solid #DDDDDD; border-radius: 2px; background: #fff;
  display: inline-flex; align-items: center; justify-content: center; color: #6463A6;
}
.check__box svg.i { width: 16px; height: 16px; visibility: hidden; }
.check input:checked + .check__box svg.i { visibility: visible; }
.check input:checked + .check__box { border-color: #6463A6; }
.check input:focus-visible + .check__box { outline: 2px solid var(--accent); outline-offset: 1px; }
.check.is-disabled { cursor: default; color: var(--text-disabled); }
.check.is-disabled .check__box { border-color: #EDEBE9; color: #C8C6C4; background: #FAF9F8; }
.check.is-disabled input:checked + .check__box { border-color: #EDEBE9; }
.check-list { display: flex; flex-direction: column; gap: 12px; }

/* Form checkbox (ASP.NET Zero / Metronic form-check): 20px, blue-grey outline and check, no fill.
   Used on forms: Active, Send activation email, Default, user Roles, Only locked users. */
.check--form { gap: 10px; color: #5A5A5A; }
.check--form .check__box { width: 20px; height: 20px; flex-basis: 20px; border-color: #BDC3D4; border-radius: 3px; background: transparent; color: #7281A4; }
.check--form .check__box svg.i { width: 14px; height: 14px; }
.check--form input:checked + .check__box { border-color: #BDC3D4; }
.check--form.is-disabled .check__box { opacity: 0.6; background: transparent; }

/* Read-only checkbox used inside grid cells */
.cell-check { display: inline-flex; width: 16px; height: 16px; border: 1px solid #E1DFDD; border-radius: 2px; background: #F3F2F1;
  align-items: center; justify-content: center; color: #A19F9D; vertical-align: middle; }
.cell-check svg.i { width: 12px; height: 12px; }

/* Radio */
.radio { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; line-height: 20px; }
.radio input { position: absolute; opacity: 0; }
.radio__dot { width: 18px; height: 18px; border: 1px solid #8A8886; border-radius: 50%; background: #fff; display: inline-flex; align-items: center; justify-content: center; }
.radio input:checked + .radio__dot { border-color: var(--accent); }
.radio input:checked + .radio__dot::after { content: ''; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.radio-list { display: flex; flex-direction: column; gap: 6px; }

/* Toggle switch (queue sign-in, Agent Panel) */
.toggle { position: relative; display: inline-flex; width: 40px; height: 20px; cursor: pointer; }
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.toggle__track { position: absolute; inset: 0; border-radius: 10px; border: 1px solid #616161; background: #fff; transition: background 0.15s; }
.toggle__track::after { content: ''; position: absolute; top: 3px; left: 3px; width: 12px; height: 12px; border-radius: 50%; background: #616161; transition: left 0.15s, background 0.15s; }
.toggle input:checked + .toggle__track { background: var(--accent); border-color: var(--accent); }
.toggle input:checked + .toggle__track::after { left: 23px; background: #fff; }
.toggle.is-disabled { cursor: default; opacity: 0.5; }

/* Yellow notice box ("If you are changing your own permissions...") */
.note { background: var(--note-bg); border: 1px solid var(--note-border); padding: 10px 24px; font-style: italic; font-size: 15px; line-height: 25px; color: #3F4254; }

/* ---------------- Tabs (purple pill + pointer) ---------------- */
.tabs { display: inline-flex; align-items: center; height: 34px; background: var(--tabstrip-bg); padding: 1px 0; margin-bottom: 18px; flex-wrap: nowrap; }
.tab {
  position: relative; height: 32px; padding: 0 22px; border: 0; background: transparent; color: var(--text);
  font-size: var(--fs-base); white-space: nowrap; display: inline-flex; align-items: center; gap: 8px;
}
.tab:hover { color: var(--accent-text); }
.tab.is-active { background: var(--accent); color: #fff; }
.tab.is-active::after {
  content: ''; position: absolute; left: 50%; bottom: -10px; margin-left: -10px;
  border-left: 10px solid transparent; border-right: 10px solid transparent; border-top: 10px solid var(--accent);
}
.tab:disabled { color: var(--text-disabled); cursor: default; }
.tab__badge { display: inline-flex; align-items: center; justify-content: center; min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 2px; background: var(--accent); color: #fff; font-size: 11px; font-weight: 600; }
.tab.is-active .tab__badge { background: #fff; color: var(--accent); }

/* ---------------- Data grid ---------------- */
.grid { display: flex; flex-direction: column; background: #fff; min-height: 0; }
.grid--fill { flex: 1; }
.grid__toolbar {
  flex: 0 0 50px; height: 50px; display: flex; align-items: center; background: var(--band-bg);
  padding: 0 8px 0 7px; border-bottom: 1px solid var(--grid-line); gap: 2px;
}
.grid__toolbar-right { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.tb-btn {
  height: 34px; padding: 0 9px; border: 0; border-radius: 2px; background: transparent; color: var(--text);
  display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap;
}
.tb-btn svg.i { width: 16px; height: 16px; color: var(--text-secondary); }
.tb-btn:hover { background: #EDEBE9; }
.tb-btn:disabled { color: var(--text-disabled); background: transparent; cursor: default; }
.tb-btn:disabled svg.i { color: var(--text-disabled); }
.tb-text { color: var(--text-secondary); font-size: 14px; margin-right: 10px; white-space: nowrap; }
.grid__search { width: 282px; height: 34px; border: 0; background: #F3F2F1; padding: 0 9px; font-size: 13px; outline: none; border-radius: 2px; }
.grid__search::placeholder { color: var(--text-muted); }
.grid__search:focus { box-shadow: inset 0 -2px 0 var(--accent); }
.grid__toolbar .icon-btn { width: 46px; height: 36px; }
.grid__toolbar .icon-btn svg.i { width: 20px; height: 20px; }

.grid__scroll { flex: 1; min-height: 0; overflow: auto; position: relative; }
.grid__table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
.grid__table th {
  position: sticky; top: 0; z-index: 1; background: var(--band-bg); height: 40px; padding: 0 8px; text-align: left;
  font-weight: 400; font-size: 13.5px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  border-bottom: 1px solid var(--grid-line); vertical-align: bottom; padding-bottom: 6px; user-select: none;
}
.grid__table th.is-sortable { cursor: pointer; }
.grid__table th .sort { display: inline-flex; vertical-align: -3px; margin-left: 3px; }
.grid__table th .sort svg.i { width: 14px; height: 14px; }
.grid__table th.is-sep { border-right: 1px solid var(--grid-line); }
.grid__table td {
  height: 41px; padding: 0 8px; border-bottom: 1px solid var(--page-bg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  font-size: var(--fs-base);
}
.grid__table td.is-sep { border-right: 1px solid var(--grid-line); }
.grid__table td.al-right, .grid__table th.al-right { text-align: right; }
.grid__table td.al-center, .grid__table th.al-center { text-align: center; }
.grid__table tr.row { cursor: default; }
.grid__table tr.row:hover td { background: var(--row-hover); }
.grid__table tr.row.is-selected td { background: var(--accent); color: #fff; }
.grid__table tr.row.is-selected td a, .grid__table tr.row.is-selected td .link { color: #fff; }
.grid__table tr.row.is-selected .cell-check { background: transparent; border-color: rgba(255,255,255,0.7); color: #fff; }
.grid__table td.col-menu { text-align: center; padding: 0; }
.grid__table .row-menu-btn { border: 0; background: none; color: inherit; width: 28px; height: 28px; border-radius: 2px; }
.grid__table .row-menu-btn:hover { background: rgba(0,0,0,0.06); }
.grid__table td.col-expand { padding: 0; text-align: center; }
.grid__table .expand-btn { border: 0; background: none; color: inherit; width: 24px; height: 24px; }
.grid__table .expand-btn svg.i { width: 9px; height: 9px; }
.grid__table tr.detail td { white-space: normal; height: auto; background: #fff; padding: 0; }
.grid__table .link { color: var(--text); text-decoration: underline dotted; text-underline-offset: 3px; }
.grid__empty { position: absolute; inset: 41px 0 0 0; display: flex; align-items: center; justify-content: center; color: var(--text-muted); font-size: var(--fs-base); pointer-events: none; }
.grid__footer { flex: 0 0 auto; display: flex; border-top: 1px solid var(--grid-line); background: #fff; overflow: hidden; }
.grid__footer-table { width: 100%; table-layout: fixed; border-collapse: collapse; }
.grid__footer-table td { height: 46px; padding: 0 8px; font-weight: 600; font-size: 14px; color: var(--text-secondary); white-space: nowrap; overflow: hidden; }

.pager { flex: 0 0 56px; height: 56px; display: flex; align-items: center; padding: 0 2px; gap: 4px; }
.pager__size, .pager__page {
  min-width: 34px; height: 40px; padding: 0 9px; border: 0; background: transparent; color: var(--text); font-size: 14px; border-radius: 2px;
}
.pager__size:hover, .pager__page:hover { background: #EDEBE9; }
.pager__size.is-active, .pager__page.is-active { background: #EDEBE8; }
.pager__info { margin-left: auto; color: var(--text-secondary); font-size: 14px; margin-right: 12px; }
.pager__pages { display: flex; gap: 2px; }

/* Column chooser popup */
.col-chooser { padding: 8px 0; min-width: 230px; }
.col-chooser__title { padding: 4px 14px 10px; font-weight: 600; }
.col-chooser__item { padding: 6px 14px; }

/* ---------------- Popups and menus ---------------- */
.popup { position: fixed; z-index: 1000; background: #fff; box-shadow: var(--shadow-popup); border-radius: 2px; }
.menu { padding: 4px 0; min-width: 140px; }
.menu__item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 14px; border: 0; background: none; text-align: left; font-size: 14px; color: var(--text); white-space: nowrap; }
.menu__item:hover { background: #F3F2F1; }
.menu__item:disabled { color: var(--text-disabled); background: none; cursor: default; }
.menu__sep { height: 1px; background: var(--row-line); margin: 4px 0; }

/* ---------------- Modal ---------------- */
.overlay { position: fixed; inset: 0; z-index: 900; background: rgba(32, 31, 30, 0.5); }
.modal-wrap { position: fixed; inset: 0; z-index: 901; display: flex; align-items: flex-start; justify-content: center; padding-top: 60px; overflow: auto; }
.modal { background: #fff; box-shadow: var(--shadow-modal); width: 760px; max-width: calc(100vw - 40px); border-radius: 3px; margin-bottom: 40px; }
.modal--sm { width: 560px; }
.modal--lg { width: 1000px; }
.modal__header { display: flex; align-items: center; padding: 18px 20px 14px 22px; border-bottom: 1px solid var(--row-line); }
.modal__title { font-size: 20px; font-weight: 400; flex: 1; }
.modal__close { border: 0; background: none; width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; color: var(--text); }
.modal__close svg.i { width: 18px; height: 18px; }
.modal__body { padding: 20px 22px 6px; }
.modal__footer { padding: 14px 22px 18px; display: flex; justify-content: flex-end; gap: 12px; align-items: center; }
.modal__footer .spacer { flex: 1; }

/* Confirm dialog (ASP.NET Zero "Are you sure?") */
.confirm { text-align: center; padding: 30px 28px 10px; }
.confirm__icon { width: 64px; height: 64px; margin: 0 auto 16px; border-radius: 50%; border: 3px solid #FACEA8; color: #F8BB86; display: flex; align-items: center; justify-content: center; font-size: 38px; font-weight: 300; }
.confirm__title { font-size: 24px; font-weight: 600; margin-bottom: 10px; color: #595959; }
.confirm__text { color: var(--text-secondary); font-size: 15px; }

/* ---------------- Drawer (right side panel) ---------------- */
.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 901; width: 726px; max-width: 100vw; background: #fff; box-shadow: -4px 0 18px rgba(0,0,0,0.18);
  display: flex; flex-direction: column; border-bottom: 5px solid var(--accent); }
.drawer--narrow { width: 430px; }
.drawer__close { position: absolute; top: 18px; right: 18px; border: 0; background: none; width: 28px; height: 28px; color: var(--text); }
.drawer__close svg.i { width: 16px; height: 16px; }
.drawer__header { padding: 34px 40px 8px 40px; }
.drawer__title { font-size: 24px; font-weight: 600; }
.drawer__body { flex: 1; overflow: auto; padding: 8px 40px 20px 40px; }
.drawer__footer { padding: 16px 40px 18px; display: flex; gap: 8px; }

/* ---------------- Toasts (bottom right) ---------------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 1200; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; }
.toast { min-width: 300px; max-width: 380px; padding: 14px 16px 14px 42px; color: #fff; box-shadow: var(--shadow-popup); border-radius: 3px; font-size: 14px; line-height: 19px; position: relative; opacity: 0.95; }
.toast::before { content: ''; position: absolute; left: 14px; top: 15px; width: 18px; height: 18px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.9); box-sizing: border-box; }
.toast--success { background: #1BC5BD; }
.toast--info { background: #6264A7; }
.toast--warn { background: #FFA800; }
.toast--error { background: #F64E60; }

/* ---------------- Avatars + presence ---------------- */
.avatar { position: relative; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; color: #fff; font-weight: 600; flex: 0 0 auto; overflow: visible; }
.avatar__img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.avatar--20 { width: 20px; height: 20px; font-size: 8px; }
.avatar--24 { width: 24px; height: 24px; font-size: 10px; }
.avatar--28 { width: 28px; height: 28px; font-size: 11px; }
.avatar--32 { width: 32px; height: 32px; font-size: 12px; }
.avatar--34 { width: 34px; height: 34px; font-size: 13px; }
.avatar--36 { width: 36px; height: 36px; font-size: 13.5px; }
.avatar--48 { width: 48px; height: 48px; font-size: 17px; }
.avatar--72 { width: 72px; height: 72px; font-size: 26px; }
.avatar--default { background: #C8C6C4; color: #fff; }
.avatar--default svg.i { width: 60%; height: 60%; }
.presence { position: absolute; right: -2px; bottom: -2px; width: 12px; height: 12px; border-radius: 50%; border: 2px solid #fff; box-sizing: content-box; display: inline-flex; align-items: center; justify-content: center; }
.avatar--24 .presence, .avatar--28 .presence { width: 8px; height: 8px; border-width: 1.5px; right: -2px; bottom: -2px; }
.presence svg.i { width: 8px; height: 8px; color: #fff; }
.presence--available { background: var(--presence-available); }
.presence--busy { background: var(--presence-busy); }
.presence--away { background: var(--presence-away); }
.presence--offline { background: #fff; border-color: #fff; box-shadow: inset 0 0 0 1.5px var(--presence-offline); }
.presence--dnd { background: var(--presence-busy); }
.person { display: inline-flex; align-items: center; gap: 10px; min-width: 0; }
.person__name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------- Misc ---------------- */
.empty { color: var(--text-muted); text-align: center; padding: 40px 0; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 8px; background: #EDEBE9; border-radius: 2px; font-size: 13px; }
.divider { height: 1px; background: var(--row-line); margin: 12px 0; }
