:root {
  color-scheme: dark;
  --bg: #090b10;
  --surface: rgba(24, 28, 39, .66);
  --surface-hover: rgba(34, 39, 54, .82);
  --border: rgba(202, 214, 255, .09);
  --text: #edf0fa;
  --muted: #949bad;
  --mint: #a7b5ff;
  --amber: #ebc18a;
  --accent: #a7b5ff;
  --green: #8bdec1;
  --shadow: 0 16px 48px rgba(0, 0, 0, .18), inset 0 1px 0 rgba(255, 255, 255, .035);
  --control-glass: linear-gradient(165deg, #ffffff1c, #ffffff04 48%, #ffffff08), #a7b5ff08;
  --control-shadow: inset 0 1px 0 #ffffff2b, inset 0 -1px 0 #00000030, 0 4px 12px #00000024;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-synthesis: none;
}

* { box-sizing: border-box; }
html { min-height: 100%; scrollbar-gutter: stable; scrollbar-color: #394056 transparent; scrollbar-width: thin; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 15% 0, rgba(80, 94, 161, .28), transparent 48%),
    radial-gradient(ellipse at 95% 60%, rgba(62, 97, 112, .15), transparent 45%);
}
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea { -webkit-tap-highlight-color: transparent; }
button { color: inherit; cursor: pointer; }
a { color: inherit; text-decoration: none; }
svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; }
.svg-library { position: absolute; width: 0; height: 0; overflow: hidden; }
[hidden] { display: none !important; }
.auth-screen { display: grid; place-items: center; min-height: 100dvh; padding: 24px; }
.auth-card { width: min(420px, 100%); padding: 32px; border: 1px solid #c4d0ff24; border-radius: 28px; background: linear-gradient(145deg, #20283bf2, #111722f4 70%); box-shadow: 0 30px 100px #0008, inset 0 1px 0 #ffffff12; backdrop-filter: blur(30px); -webkit-backdrop-filter: blur(30px); }
.auth-card h1 { margin: 18px 0 8px; font-size: 24px; }
.auth-card .field { margin-top: 16px; }
.auth-card .button { width: 100%; margin-top: 18px; }
.auth-card .auth-mode { margin-top: 10px; }
body.auth-required > :not(#auth-screen):not(.svg-library) { display: none !important; }
.admin-view { gap: 18px; }
.admin-user-form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; padding: 18px; border: 1px solid var(--border); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.admin-user-form .field { flex: 1 1 180px; }
.admin-user-form .button { flex: 0 0 auto; }
.admin-users { display: grid; gap: 10px; }
.admin-user-card { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(260px, 1.5fr) auto; align-items: center; gap: 18px; padding: 16px 18px; border: 1px solid var(--border); border-radius: 18px; background: var(--surface); box-shadow: var(--shadow); }
.admin-user-card strong, .admin-user-card small, .admin-user-card .admin-role { display: block; }
.admin-user-card small { color: var(--muted); font-size: 11px; }
.admin-role { color: var(--accent); font-size: 11px; margin-top: 3px; }
.admin-user-stats { display: flex; flex-wrap: wrap; gap: 6px 12px; color: #c9d0e7; font-size: 12px; }
.admin-user-stats small { flex-basis: 100%; }
.admin-user-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: end; }
.admin-permission { display: inline-flex; align-items: center; gap: 5px; color: var(--muted); font-size: 11px; }
.admin-secret { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 16px; border: 1px solid #8bdec155; border-radius: 14px; color: var(--green); background: #8bdec112; }
.admin-secret span { user-select: all; }
@media (max-width: 760px) { .admin-user-card { grid-template-columns: 1fr; gap: 10px; } .admin-user-actions { justify-content: start; } }
::selection { background: #899dff4d; color: #fff; }
:where(button, a, input, select, textarea):focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
button:disabled { cursor: default; opacity: .4; }
button, a { touch-action: manipulation; }

/* Floating navigation */
.sidebar {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 32px;
  width: min(1440px, calc(100% - 64px));
  min-height: 88px;
  margin: 24px auto 0;
  padding: 18px 24px;
  border: 1px solid var(--border);
  border-radius: 26px;
  background: rgba(22, 25, 35, .74);
  backdrop-filter: blur(28px);
  -webkit-backdrop-filter: blur(28px);
  box-shadow: var(--shadow);
}
.brand { display: inline-flex; align-items: center; flex-shrink: 0; gap: 12px; font-size: 17px; font-weight: 650; letter-spacing: -.6px; }
.brand-light { color: #a1a9bd; font-weight: 400; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border: 1px solid #c4d0ff38; border-radius: 15px; background: var(--control-glass); color: #edf0fa; box-shadow: var(--control-shadow); }
.brand-mark svg { width: 27px; height: 27px; }
.sidebar nav { display: flex; padding: 4px; gap: 4px; border: 1px solid #ffffff05; border-radius: 17px; background: #090b104d; }
.nav-item { display: flex; align-items: center; justify-content: center; gap: 9px; padding: 10px 16px; border: 1px solid transparent; border-radius: 13px; color: var(--muted); font-size: 12px; font-weight: 550; transition: color .2s, background .2s, box-shadow .2s; }
.nav-item svg { width: 17px; height: 17px; }
.nav-item:hover { color: var(--text); background: #ffffff04; }
.nav-item.active { color: #e0e7ff; background: var(--control-glass); border-color: #c4d0ff30; box-shadow: var(--control-shadow); }
.nav-item > span { display: inline-grid; place-items: center; min-width: 22px; padding: 1px 6px; border-radius: 7px; color: #c3cdfa; background: #a7b5ff17; font-size: 10px; font-variant-numeric: tabular-nums; }
.sidebar-tools { display: flex; align-items: center; gap: 12px; margin-left: auto; min-width: 0; }
.search { display: flex; align-items: center; gap: 10px; width: 190px; min-width: 0; min-height: 44px; padding: 10px 14px; background: #080a102e; border: 1px solid var(--border); border-radius: 14px; transition: border-color .2s, background .2s; }
.search svg { width: 17px; height: 17px; color: #7f89a3; }
.search input { width: 100%; min-width: 0; padding: 0; border: 0; outline: none; color: var(--text); background: none; font-size: 12px; }
.search input::placeholder { color: #8c95aa; }
.search:focus-within { border-color: #a7b5ff60; background: #a7b5ff07; }
.search input:focus-visible { outline: none; }

/* Shared controls */
.button, .icon-button, .session-filter, .detail-tab { transition: background .2s, border-color .2s, color .2s, box-shadow .2s, transform .2s; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 11px 18px; border: 1px solid #c4d0ff38; border-radius: 14px; background: var(--control-glass); box-shadow: var(--control-shadow); backdrop-filter: blur(18px) saturate(150%); -webkit-backdrop-filter: blur(18px) saturate(150%); color: #e0e7ff; font-size: 12px; line-height: 20px; font-weight: 550; white-space: nowrap; }
.button svg { width: 17px; height: 17px; }
.button:hover:not(:disabled) { background: linear-gradient(165deg, #ffffff2b, #ffffff08 48%, #ffffff10), #a7b5ff12; border-color: #c4d0ff66; box-shadow: var(--control-shadow), 0 6px 22px #899cff14; transform: translateY(-1px); }
.button:active:not(:disabled), .icon-button:active:not(:disabled) { transform: translateY(1px); }
.primary { background: linear-gradient(165deg, #e0e6ff40, #a7b5ff12 48%, #a7b5ff24), #7b8ff52b; color: #f1f3ff; border-color: #c7d0ff66; box-shadow: var(--control-shadow), 0 4px 20px #8f9dff18; }
.primary:hover:not(:disabled) { background: linear-gradient(165deg, #e0e6ff59, #a7b5ff20 48%, #a7b5ff36), #7b8ff53b; border-color: #d2dbffa3; box-shadow: var(--control-shadow), 0 6px 28px #8f9dff28; }
.secondary { color: #d5dbea; }
.danger { background: linear-gradient(165deg, #ffd5d51c, #e4838804 48%, #e4838810), #e4838808; border-color: #e4838840; color: #ffc0c5; }
.danger:hover:not(:disabled) { background: linear-gradient(165deg, #ffd5d52b, #e4838808 48%, #e483881c), #e4838812; border-color: #e4838870; }
.icon-button { display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; padding: 0; border: 1px solid #c4d0ff26; border-radius: 13px; background: var(--control-glass); box-shadow: var(--control-shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); color: #b8c3de; }
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover:not(:disabled) { color: #e3e9ff; background: linear-gradient(165deg, #ffffff2b, #ffffff08 48%, #ffffff10); border-color: #c4d0ff55; }
.small-dot { display: inline-block; flex-shrink: 0; width: 6px; height: 6px; background: currentColor; border-radius: 50%; }
.online-dot { color: var(--green); box-shadow: 0 0 9px #8bdec124; }
.offline-dot { color: #7c879b; }
.dead-dot { color: var(--amber); }

/* Account list */
main { display: flex; flex-direction: column; gap: 24px; width: min(1376px, calc(100% - 96px)); margin: 0 auto; padding: 46px 0 24px; min-height: calc(100dvh - 136px); animation: reveal .35s ease-out; }
.page-heading { display: flex; align-items: center; justify-content: space-between; gap: 20px; }
h1 { margin: 0; font-size: clamp(26px, 2.4vw, 34px); font-weight: 550; line-height: 1.2; letter-spacing: -1.1px; }
.account-summary { display: flex; align-items: center; gap: 26px; font-size: 12px; color: var(--muted); }
.account-summary > span { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.account-summary strong { font-size: 14px; color: #d5dced; font-weight: 550; font-variant-numeric: tabular-nums; }
.filters-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.role-filters, .session-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 3px; width: fit-content; max-width: 100%; padding: 4px; border: 1px solid var(--border); border-radius: 14px; background: #14182388; box-shadow: inset 0 1px 0 #ffffff02; }
.session-filter, .role-filter { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 30px; padding: 5px 10px; border: 1px solid transparent; border-radius: 10px; color: var(--muted); background: transparent; font-size: 11px; white-space: nowrap; transition: background .2s, border-color .2s, color .2s; }
.session-filter:hover { background: #ffffff04; color: var(--text); }
.session-filter.active, .role-filter.active { background: var(--control-glass); color: #e0e7ff; border-color: #c4d0ff30; box-shadow: var(--control-shadow); }
.role-filter:hover { background: #ffffff04; color: var(--text); }
.expired-toggle { position: relative; display: inline-flex; align-items: center; gap: 8px; min-height: 30px; margin-left: auto; padding: 3px 0; color: var(--muted); font-size: 11px; cursor: pointer; white-space: nowrap; }
.expired-toggle input { position: absolute; width: 28px; height: 16px; margin: 0; opacity: 0; }
.toggle-track { position: relative; pointer-events: none; width: 28px; height: 16px; border: 1px solid #a7b5ff29; border-radius: 20px; background: #ffffff07; transition: background .2s, border-color .2s; }
.toggle-track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 10px; height: 10px; border-radius: 50%; background: #8792ac; transition: transform .2s, background .2s; }
.expired-toggle input:checked + .toggle-track { background: #a7b5ff25; border-color: #a7b5ff60; }
.expired-toggle input:checked + .toggle-track::after { transform: translateX(12px); background: #bac8ff; }
.expired-toggle input:focus-visible + .toggle-track { outline: 2px solid var(--accent); outline-offset: 4px; }
.filter-count { min-width: 19px; padding: 1px 5px; border-radius: 6px; color: #a4aec3; background: #ffffff05; font-size: 10px; text-align: center; font-variant-numeric: tabular-nums; }
.session-filter.active .filter-count { background: #a7b5ff1a; color: #ccd6ff; }
.account-list { display: flex; flex-direction: column; gap: 10px; }
.account-group-heading { display: flex; align-items: center; gap: 12px; margin: 18px 4px 2px; color: #b0b8cc; font-size: 12px; font-weight: 500; }
.account-group-heading:first-child { margin-top: 0; }
.account-group-heading::after { content: ""; height: 1px; flex: 1; background: linear-gradient(90deg, var(--border), transparent); }
.account-card { display: flex; align-items: center; gap: 18px; min-height: 94px; padding: 18px 20px; border: 1px solid var(--border); border-radius: 22px; background: linear-gradient(110deg, #1b2030a8, #171b25a8); box-shadow: var(--shadow); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); transition: background .2s, border-color .2s, box-shadow .2s, transform .2s; }
.account-card:hover { background: linear-gradient(110deg, #252b40b3, #1c2231b3); border-color: #a7b5ff29; box-shadow: 0 10px 32px #00000022, inset 0 1px 0 #ffffff05; transform: translateY(-2px); }
.account-card.needs-attention { border-color: #ebc18a24; }
.avatar { position: relative; display: grid; place-items: center; flex-shrink: 0; width: 48px; height: 48px; overflow: hidden; border: 1px solid #b4c3ff20; border-radius: 16px; background: linear-gradient(145deg, #343e59, #252c40); color: #9cafd2; }
.avatar svg { width: 23px; height: 23px; }
.avatar .steam-avatar { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.account-identity { display: flex; flex: 1; flex-direction: column; gap: 5px; min-width: 0; }
.account-name { margin: 0; overflow-wrap: anywhere; font-size: 14px; font-weight: 550; line-height: 1.35; letter-spacing: -.15px; }
.account-id { color: #848fa7; font-size: 11px; letter-spacing: .2px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.account-states { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 6px; max-width: 44%; min-width: 0; }
.status-badge, .family-badge { display: inline-flex; align-items: center; gap: 6px; min-height: 27px; padding: 4px 9px; border: 1px solid #8bdec11c; border-radius: 9px; color: #9ddbc5; background: #8bdec109; font-size: 10px; white-space: nowrap; line-height: 1.5; }
.session-countdown { display: inline-flex; align-items: center; justify-content: flex-end; gap: 5px; min-width: 46px; padding: 4px 2px; color: #8c9ab5; font-size: 10px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.session-countdown svg { width: 12px; height: 12px; }
.session-countdown.expires-soon { color: var(--amber); }
.status-badge.offline { color: #9da7bc; border-color: #a1aec819; background: #a1aec805; }
.status-badge.attention, .family-badge { color: #e2bd8b; border-color: #ebc18a24; background: #ebc18a09; }
.status-badge.in-game { color: #b3db9a; border-color: #b3db9a24; background: #b3db9a09; }
.presence-badge { min-width: 0; max-width: 100%; }
.badge-text { overflow: hidden; text-overflow: ellipsis; }
.account-actions { display: flex; align-items: center; gap: 10px; margin-left: 4px; flex-shrink: 0; }
.detail-button { border-color: #c4d0ff26; }
.quick-profile-button { min-height: 36px; padding: 7px 12px; border-radius: 12px; font-size: 11px; }
.quick-profile-button svg { width: 15px; height: 15px; }
.quick-profile-button.can-restore { background: linear-gradient(165deg, #ffffff24, #a7b5ff0b 48%, #a7b5ff15); border-color: #a7b5ff55; color: #d8e0ff; }
.pagination { display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 58px; padding: 16px 4px 0; margin-top: auto; color: #8b96af; font-size: 12px; font-variant-numeric: tabular-nums; }
.page-controls { display: flex; align-items: center; gap: 12px; padding: 4px; border: 1px solid var(--border); border-radius: 16px; background: #14182366; }
#page-number { min-width: 40px; text-align: center; }
#previous-page svg { transform: rotate(180deg); }
.empty-state { display: grid; place-items: center; gap: 12px; flex: 1; min-height: 240px; align-content: center; color: var(--muted); }
.empty-state p { margin: 0; }
.api-error { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border: 1px solid #ed9ba52b; border-radius: 18px; color: #efaab3; background: #d5697a09; font-size: 12px; }

/* Chat */
.chat-view { gap: 20px; }
.ticket-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 20px; align-items: start; }
.ticket-sidebar { min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 22px; background: var(--surface); backdrop-filter: blur(20px); -webkit-backdrop-filter: blur(20px); }
#ticket-search { width: 100%; min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 12px; color: var(--text); background: #090b104d; font-size: 12px; }
.ticket-list { display: grid; gap: 8px; max-height: 65dvh; margin-top: 12px; overflow-y: auto; scrollbar-width: thin; }
.ticket-item { display: grid; gap: 10px; width: 100%; padding: 13px; border: 1px solid transparent; border-radius: 16px; background: #ffffff03; text-align: left; transition: background .2s, border-color .2s; }
.ticket-item:hover:not(:disabled) { border-color: #c4d0ff26; background: #a7b5ff0b; }
.ticket-item[aria-pressed="true"] { border-color: #c4d0ff38; background: var(--control-glass); box-shadow: var(--control-shadow); }
.ticket-item-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.ticket-item-top strong { color: #d7e0ff; font-size: 12px; }
.ticket-item-top time { color: var(--muted); font-size: 10px; font-variant-numeric: tabular-nums; }
.ticket-account { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 11px; }
.ticket-account > span:nth-child(2) { min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ticket-account .avatar, .ticket-participants .avatar { width: 28px; height: 28px; border-radius: 9px; }
.ticket-account .avatar svg, .ticket-participants .avatar svg { width: 17px; height: 17px; }
.ticket-role { margin-left: auto; color: #8994ac; font-size: 9px; }
.ticket-conversation { display: grid; gap: 14px; min-width: 0; }
.ticket-heading { padding: 4px; min-width: 0; }
.ticket-heading h2 { margin: 0; font-size: 20px; font-weight: 550; }
.ticket-heading p { margin: 5px 0 0; }
.ticket-participants { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; color: #bfc9e2; font-size: 12px; }
.ticket-participants:empty { display: none; }
.ticket-participants > span { display: inline-flex; align-items: center; gap: 8px; overflow-wrap: anywhere; min-width: 0; }
.chat-sync-status { padding: 10px 16px; border-bottom: 1px solid var(--border); color: var(--amber); font-size: 11px; }
.chat-image-link { display: block; margin-top: 6px; }
.chat-image { display: block; max-width: 100%; max-height: 300px; border-radius: 12px; object-fit: contain; }
.chat-message-time { display: inline-block; margin-left: 5px; color: #9ba7c0; font-size: 9px; font-variant-numeric: tabular-nums; cursor: help; }
.chat-date-separator { display: flex; align-items: center; gap: 12px; margin: 14px 0 10px; color: #8995b2; font-size: 10px; font-weight: 550; letter-spacing: .02em; text-transform: capitalize; }
.chat-date-separator::before, .chat-date-separator::after { content: ''; height: 1px; flex: 1; background: linear-gradient(90deg, transparent, #a7b5ff2e); }
.chat-date-separator::after { background: linear-gradient(90deg, #a7b5ff2e, transparent); }
.message-time-tooltip { position: fixed; z-index: 500; min-width: 190px; max-width: min(320px, calc(100vw - 16px)); padding: 10px 12px; border: 1px solid #c4d0ff55; border-radius: 11px; background: linear-gradient(145deg, #252d40f5, #111722f7 70%); box-shadow: 0 14px 36px #0009, inset 0 1px 0 #ffffff14; backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); color: #edf1ff; font-size: 11px; line-height: 1.5; pointer-events: none; animation: tooltip-reveal .14s ease-out; }
.message-time-tooltip-row { display: flex; gap: 8px; justify-content: space-between; white-space: nowrap; }
.message-time-tooltip-row b { color: #aebcf0; font-weight: 550; }
.message-time-tooltip-row time { color: #f4f6ff; font-variant-numeric: tabular-nums; }
@keyframes tooltip-reveal { from { opacity: 0; transform: translateY(3px) scale(.98); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .message-time-tooltip { animation: none; } }
.chat-attachment { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-top: 1px solid var(--border); background: #a7b5ff08; font-size: 12px; }
.chat-attachment > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
#chat-attachment-preview { width: 46px; height: 46px; object-fit: contain; border-radius: 8px; }
.chat-compose .icon-button { align-self: center; }
#ticket-dialog .chat-targets { flex-direction: column; align-items: stretch; }
#ticket-dialog .chat-direction { display: none; }
#ticket-dialog .picker-control { display: grid; grid-template-columns: 30px minmax(0, 1fr) 14px; width: 100%; }
#ticket-dialog .account-options { position: static; grid-column: 1 / -1; max-height: 220px; margin-top: 6px; }
.chat-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.chat-targets { display: flex; align-items: center; gap: 16px; }
.chat-account-choice { display: grid; gap: 7px; min-width: 0; color: var(--muted); font-size: 11px; }
.chat-direction { color: #7b86a6; padding-top: 20px; }

/* Shared account search and selectors */
.account-picker { position: relative; }
.account-picker:has(input[aria-expanded="true"]) { z-index: 4; }
.account-options { position: absolute; z-index: 10; top: calc(100% + 10px); left: 0; width: 100%; max-height: min(380px, 52dvh); padding: 7px; overflow-y: auto; overscroll-behavior: contain; border: 1px solid #b7c5f52b; border-radius: 20px; background: linear-gradient(135deg, #252c3bf5, #161c2af5); backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px); box-shadow: 0 18px 60px #0008, inset 0 1px 0 #ffffff05; scrollbar-width: thin; }
.search .account-options { width: 360px; max-width: calc(100vw - 64px); }
.search-group { display: flex; align-items: center; justify-content: space-between; padding: 10px 11px 7px; color: #a8b3cc; font-size: 10px; letter-spacing: .3px; }
.search-group span { color: #7786a6; font-variant-numeric: tabular-nums; }
.account-option { display: flex; align-items: center; gap: 11px; width: 100%; min-height: 62px; padding: 10px; border: 1px solid transparent; border-radius: 14px; color: var(--text); background: transparent; text-align: left; transition: background .15s, border-color .15s; }
.account-option:hover, .account-option.is-highlighted { background: #a7b5ff13; border-color: #a7b5ff1d; }
.account-option[aria-selected="true"] { background: #a7b5ff0b; }
.account-option .avatar { width: 38px; height: 38px; border-radius: 12px; }
.account-option .avatar svg { width: 19px; height: 19px; }
.option-identity { display: grid; flex: 1; min-width: 0; gap: 4px; }
.option-name { color: #e0e6f6; font-size: 12px; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.option-meta { color: #8b98b5; font-size: 10px; font-variant-numeric: tabular-nums; }
.option-presence { flex-shrink: 0; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.account-option > svg { width: 15px; height: 15px; color: var(--accent); }
.search-empty { margin: 0; padding: 24px 12px; text-align: center; color: var(--muted); font-size: 12px; }
.picker-control { display: flex; align-items: center; gap: 10px; width: 260px; min-height: 52px; padding: 9px 12px; border: 1px solid #c4d0ff26; border-radius: 16px; background: var(--control-glass); box-shadow: var(--control-shadow); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px); transition: border-color .2s, background .2s; }
.picker-control:focus-within { border-color: #a7b5ff88; background: linear-gradient(165deg, #ffffff24, #ffffff07 48%, #ffffff0b), #a7b5ff0d; }
.picker-control input { flex: 1; min-width: 0; width: 100%; padding: 0; outline: 0; border: 0; background: transparent; color: var(--text); font-size: 12px; text-overflow: ellipsis; }
.picker-control input:focus-visible { outline: 0; }
.picker-avatar { display: grid; place-items: center; flex-shrink: 0; width: 30px; height: 30px; color: #8b9bc1; }
.picker-avatar .avatar { width: 30px; height: 30px; border-radius: 10px; }
.picker-chevron { width: 14px; height: 14px; transform: rotate(90deg); color: #7d8aa9; transition: transform .2s; }
.picker-control:has([aria-expanded="true"]) > .picker-chevron { transform: rotate(-90deg); }
.picker-control:has(input:disabled) { opacity: .5; }
.chat-ring-controls { display: flex; align-items: center; flex-wrap: wrap; gap: 14px; padding: 15px 18px; border: 1px solid var(--border); border-radius: 20px; background: #181d287d; }
.chat-ring-controls .section-note { margin: 0; flex: 1; min-width: 160px; }
#chat-ring { min-width: 140px; }
#chat-ring.ring-active { color: #eadbff; border-color: #bb95f670; background: linear-gradient(165deg, #ead5ff30, #bb95f60b 48%, #bb95f61c); box-shadow: var(--control-shadow), 0 0 24px #bb95f61a; }
#chat-ring.ring-active::before { content: ""; width: 6px; height: 6px; background: #c0a0ff; border-radius: 50%; animation: ring-pulse 2s ease-in-out infinite; }
.chat-workspace { display: grid; grid-template-columns: minmax(0, 1fr); flex: 1; min-height: 480px; height: min(65dvh, 760px); border: 1px solid var(--border); border-radius: 26px; background: var(--surface); box-shadow: var(--shadow); overflow: hidden; backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); }
.chat-panel { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.chat-messages { flex: 1; min-height: 0; padding: 28px; overflow-y: auto; scrollbar-width: thin; }
.chat-messages > .section-note:only-child { display: grid; place-items: center; height: 100%; margin: 0; color: #8691ab; }
.chat-message, .chat-own-message { width: fit-content; max-width: 72%; padding: 13px 18px; margin: 0 0 12px; border: 1px solid #ffffff08; border-radius: 18px 18px 18px 5px; background: #ffffff05; color: #cbd2e3; font-size: 13px; overflow-wrap: anywhere; white-space: pre-wrap; }
.chat-own-message { margin-left: auto; border-radius: 18px 18px 5px 18px; border-color: #a7b5ff24; background: linear-gradient(135deg, #899cff23, #899cff14); color: #e0e5ff; }
.chat-delivery { display: inline-flex; vertical-align: middle; margin-left: 5px; color: #aab9e6; }
.chat-delivery svg { width: 15px; height: 15px; }
[data-delivery="queued"] .chat-delivery svg, [data-delivery="sending"] .chat-delivery svg, [data-delivery="retrying"] .chat-delivery svg { animation: delivery-spin 1.1s linear infinite; }
[data-delivery="read"] .chat-delivery { color: #90c9ff; }
[data-delivery="failed"] .chat-delivery, [data-delivery="uncertain"] .chat-delivery, .chat-send-error { color: #f3a6b0; }
.chat-send-error { display: block; margin-top: 7px; font-size: 11px; white-space: normal; }
.chat-cancel-send { display: inline-grid; place-items: center; width: 20px; height: 20px; margin-left: 5px; padding: 0; border: 1px solid #ffffff1a; border-radius: 50%; background: #ffffff08; color: #e6aab4; cursor: pointer; vertical-align: middle; }
.chat-cancel-send:hover { background: #e6aab41c; }
.chat-cancel-send svg { width: 11px; height: 11px; }
.chat-uncertain-attempt { font-size: 11px; border-color: #f3a6b024; background: #f3a6b008; }
.chat-uncertain-attempt summary { cursor: pointer; color: #f3a6b0; white-space: normal; }
.chat-uncertain-attempt[open] summary { margin-bottom: 8px; }
.chat-pending-image { display: block; max-width: 100%; max-height: 320px; border-radius: 12px; }
.ticket-health { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 10px; padding: 0 4px 14px; }
.ticket-health-status { display: flex; flex-wrap: wrap; gap: 6px; flex: 1 1 280px; min-width: 0; color: var(--muted); font-size: 11px; }
.ticket-health-badge { padding: 5px 9px; border: 1px solid #ffffff12; border-radius: 12px; background: #ffffff05; overflow-wrap: anywhere; }
.ticket-health-badge.warning { color: #edbd9c; border-color: #e7ab7424; background: #e7ab7408; }
.ticket-health .button { padding: 8px 12px; font-size: 11px; flex-shrink: 0; }
.ticket-health-actions { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }
.ticket-presence-controls { display: flex; flex-wrap: wrap; gap: 10px; }
.presence-account { display: grid; gap: 5px; flex: 1 1 140px; max-width: 220px; min-width: 0; color: var(--muted); font-size: 11px; }
.presence-account > label:first-child { padding-left: 3px; }
.presence-keep { display: flex; align-items: center; gap: 7px; width: fit-content; padding: 4px 3px; cursor: pointer; }
.presence-keep input { appearance: none; display: grid; place-content: center; width: 15px; height: 15px; margin: 0; border: 1px solid #c4d0ff40; border-radius: 5px; background: var(--control-glass); cursor: pointer; }
.presence-keep input:checked { background: #a7b5ff30; border-color: #a7b5ff99; }
.presence-keep input:checked::after { content: ""; width: 7px; height: 4px; border: solid #dce3ff; border-width: 0 0 2px 2px; transform: translateY(-1px) rotate(-45deg); }
.presence-keep input:focus-visible { outline: 2px solid #a7b5ff; outline-offset: 3px; }
.presence-keep:has(input:disabled) { opacity: .5; cursor: default; }
.presence-observed { color: #edbd9c; overflow-wrap: anywhere; }
.ticket-checked-at { align-self: center; color: #8691ab; font-size: 10px; }
@keyframes delivery-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { [data-delivery="queued"] .chat-delivery svg, [data-delivery="sending"] .chat-delivery svg, [data-delivery="retrying"] .chat-delivery svg { animation: none; } }
.chat-compose { display: flex; gap: 12px; margin: 0; padding: 18px; border-top: 1px solid var(--border); background: #090c1440; }
.chat-compose input { flex: 1; min-width: 0; min-height: 46px; padding: 12px 16px; border: 1px solid var(--border); border-radius: 15px; background: #090c1440; color: var(--text); font-size: 13px; }
input::placeholder, textarea::placeholder { color: #737f99; }
input:disabled { opacity: .5; }

/* Shared custom selects, including fields loaded inside account dialogs. */
.custom-select { display: block; width: 100%; min-width: 0; }
.select-trigger { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 10px 12px; border: 1px solid #c4d0ff26; border-radius: 14px; background: var(--control-glass); box-shadow: var(--control-shadow); color: var(--text); text-align: left; font-size: 12px; font-weight: 400; transition: background .18s, border-color .18s, box-shadow .18s; }
.select-trigger:hover:not(:disabled), .select-trigger[aria-expanded="true"] { border-color: #a7b5ff66; background: linear-gradient(165deg, #c7d1ff20, #a7b5ff0c 60%), #111521; box-shadow: var(--control-shadow), 0 0 0 3px #a7b5ff08; }
.select-trigger:disabled { opacity: .5; cursor: not-allowed; }
.select-value { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-trigger > svg { width: 15px; height: 15px; color: #98a4c2; transform: rotate(90deg); transition: transform .18s, color .18s; }
.select-trigger[aria-expanded="true"] > svg { color: var(--accent); transform: rotate(270deg); }
.select-menu { position: fixed; inset: auto; z-index: 100; margin: 0; padding: 6px; min-width: 0; max-width: none; overflow: auto; overscroll-behavior: contain; border: 1px solid #bbc8ff38; border-radius: 18px; background: linear-gradient(145deg, #30384bec, #171d2af5 65%); color: var(--text); box-shadow: 0 18px 50px #0009, 0 4px 12px #0005, inset 0 1px 0 #ffffff12; backdrop-filter: blur(32px); -webkit-backdrop-filter: blur(32px); scrollbar-width: thin; scrollbar-color: #65729366 transparent; }
.select-menu:not([hidden]) { animation: select-reveal .16s ease-out; }
.select-option { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 9px 10px; border: 1px solid transparent; border-radius: 11px; color: #c9d2e8; font-size: 12px; font-weight: 400; line-height: 1.45; cursor: pointer; transition: background .12s, border-color .12s, color .12s; }
.select-option + .select-option { margin-top: 3px; }
.select-option[aria-selected="true"] { background: #a7b5ff10; color: #edf0ff; border-color: #a7b5ff14; }
.select-option.is-highlighted { background: linear-gradient(110deg, #a7b5ff27, #a7b5ff12); border-color: #b8c4ff35; color: #f1f4ff; }
.select-option[aria-disabled="true"] { opacity: .4; cursor: not-allowed; }
.select-option-label { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.select-option > svg { width: 15px; height: 15px; color: var(--accent); opacity: 0; }
.select-option[aria-selected="true"] > svg { opacity: 1; }
.select-indicator { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: #8591aa; box-shadow: 0 0 0 4px #8591aa0c; }
.select-indicator[data-status="online"] { background: var(--green); box-shadow: 0 0 0 4px #8bdec10c, 0 0 10px #8bdec126; }
.select-indicator[data-status="invisible"] { background: var(--accent); box-shadow: 0 0 0 4px #a7b5ff0c; }
.select-indicator:is([data-status="away"], [data-status="busy"], [data-status="snooze"]) { background: var(--amber); }
.field > .custom-select { margin: 8px 0 0; font: inherit; }
@keyframes select-reveal { from { opacity: 0; transform: translateY(4px) scale(.985); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .select-menu:not([hidden]) { animation: none; } .select-trigger, .select-trigger > svg, .select-option { transition: none; } }

/* Glass dialogs */
dialog { width: min(540px, calc(100% - 32px)); max-height: calc(100dvh - 48px); padding: 30px; color: var(--text); border: 1px solid #ccd7ff24; border-radius: 28px; background: linear-gradient(135deg, rgba(31, 36, 52, .95), rgba(19, 24, 35, .97)); box-shadow: 0 40px 140px #00000099, inset 0 1px 0 #ffffff09; backdrop-filter: blur(36px); -webkit-backdrop-filter: blur(36px); scrollbar-width: thin; }
dialog[open] { animation: dialog-enter .22s ease-out; }
dialog::backdrop { background: #05070db3; backdrop-filter: blur(9px); -webkit-backdrop-filter: blur(9px); }
.dialog-heading { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 20px; }
.dialog-icon { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid #a7b5ff25; border-radius: 16px; background: linear-gradient(135deg, #a7b5ff1d, #a7b5ff08); color: var(--accent); }
.close-dialog.icon-button { border-radius: 50%; }
dialog h2 { margin: 0 0 24px; font-size: 24px; font-weight: 550; line-height: 1.3; letter-spacing: -.6px; overflow-wrap: anywhere; }
.field { display: block; margin-top: 18px; font-size: 12px; font-weight: 500; color: #c5cddd; }
.field > span { margin-left: 6px; font-size: 11px; font-weight: 400; color: #8d98af; }
.field :is(input, select, textarea) { display: block; width: 100%; margin-top: 8px; padding: 12px 14px; border: 1px solid #b7c5f51a; border-radius: 13px; background: #090d164d; color: var(--text); font-size: 12px; font-weight: 400; transition: border-color .2s, background .2s; }
.field :is(input, select, textarea):hover { border-color: #b7c5f533; }
.field :is(input, select, textarea):focus { border-color: #a7b5ff66; background: #0b101b77; }
.field input[type="file"] { padding: 8px; }
input::file-selector-button { border: 1px solid #c4d0ff30; border-radius: 9px; margin-right: 12px; padding: 7px 10px; background: var(--control-glass); box-shadow: var(--control-shadow); color: #d1d9f7; font: inherit; cursor: pointer; }
.field textarea { min-height: 108px; max-height: 260px; resize: vertical; word-break: break-all; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 11px; line-height: 1.8; }
.import-role-switch, .import-method-switch { display: flex; gap: 4px; padding: 4px; border: 1px solid var(--border); border-radius: 15px; background: #090d162e; }
.import-role-switch { margin-bottom: 20px; }
.import-method-switch { background: transparent; }
.import-role-switch button, .import-method-switch button { flex: 1; min-height: 38px; padding: 8px 12px; border: 1px solid transparent; border-radius: 11px; background: transparent; color: var(--muted); font-size: 12px; transition: background .2s, color .2s, border-color .2s; }
.import-role-switch button[aria-pressed="true"], .import-method-switch button[aria-pressed="true"] { color: #e0e7ff; border-color: #c4d0ff30; background: var(--control-glass); box-shadow: var(--control-shadow); }
.import-role-switch button:hover:not(:disabled), .import-method-switch button:hover:not(:disabled) { color: var(--text); background: #a7b5ff0b; }
.form-error { padding: 12px 14px; border: 1px solid #f0a4aa24; border-radius: 12px; background: #f0a4aa07; color: #f0a4aa; font-size: 12px; overflow-wrap: anywhere; }
.dialog-actions { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 24px; padding-top: 20px; border-top: 1px solid var(--border); }
.detail-data { margin: 20px 0; }
.detail-data > div { display: flex; justify-content: space-between; gap: 18px; padding: 14px 0; border-bottom: 1px solid var(--border); font-size: 12px; }
.detail-data dt { color: var(--muted); }
.detail-data dd { margin: 0; color: #d4dced; text-align: right; overflow-wrap: anywhere; }
.account-role-field { max-width: 260px; margin: 16px 0; }
.toast { position: fixed; z-index: 5; left: 50%; bottom: 28px; transform: translateX(-50%); display: flex; align-items: center; gap: 12px; width: max-content; max-width: min(600px, calc(100vw - 32px)); padding: 15px 20px; border: 1px solid #a7b5ff36; border-radius: 18px; color: #dae2ff; background: #242d42e6; backdrop-filter: blur(24px); -webkit-backdrop-filter: blur(24px); box-shadow: 0 12px 50px #0006; font-size: 12px; animation: toast-enter .2s ease-out; overflow-wrap: anywhere; }
.toast svg { color: var(--accent); width: 18px; height: 18px; }

/* Account settings */
#details-dialog { width: min(1040px, calc(100% - 48px)); padding: 28px; }
#details-dialog .dialog-heading { margin-bottom: 12px; }
#details-dialog > h2 { margin-bottom: 24px; }
.account-workspace { display: grid; grid-template-columns: 170px minmax(0, 1fr); gap: 26px; min-height: 420px; padding-top: 24px; border-top: 1px solid var(--border); }
.detail-tabs { display: flex; flex-direction: column; gap: 6px; padding-right: 16px; border-right: 1px solid var(--border); }
.detail-tab { padding: 11px 13px; border: 1px solid transparent; border-radius: 12px; color: var(--muted); background: transparent; text-align: left; font-size: 12px; }
.detail-tab:hover { background: #ffffff05; color: var(--text); }
.detail-tab[aria-selected="true"] { border-color: #c4d0ff30; background: var(--control-glass); box-shadow: var(--control-shadow); color: #e0e7ff; }
.personalization-tabs { display: flex; gap: 5px; max-width: 100%; margin-bottom: 22px; padding-bottom: 14px; overflow-x: auto; border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.personalization-tabs .detail-tab { flex-shrink: 0; padding: 9px 12px; white-space: nowrap; }
.detail-panels { min-width: 0; max-height: calc(100dvh - 260px); padding: 0 8px 4px 0; overflow-y: auto; scrollbar-width: thin; }
.detail-panels h3 { margin: 0; font-size: 16px; font-weight: 550; letter-spacing: -.2px; }
.section-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 20px; }
.section-heading .button { min-height: 36px; padding: 7px 12px; font-size: 11px; }
.section-status, .section-note { color: var(--muted); font-size: 12px; line-height: 1.7; overflow-wrap: anywhere; }
.section-status.error { color: #f0a4aa; }
.section-status.saved { color: var(--green); }
.section-form fieldset { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; min-width: 0; padding: 0; margin: 0; border: 0; }
.section-form .field { margin: 0; }
.section-form .field.wide { grid-column: 1 / -1; }
.section-form textarea { min-height: 140px; max-height: 320px; font-family: inherit; font-size: 12px; word-break: normal; }
.section-form fieldset:disabled { opacity: .6; }
.section-form .dialog-actions { grid-column: 1 / -1; margin-top: 6px; padding-top: 18px; }
.section-form .draft-label { margin-right: auto; color: var(--amber); font-size: 11px; }
.avatar-upload { margin-top: 26px; padding-top: 22px; border-top: 1px solid var(--border); }
.device-group-heading { display: flex; align-items: center; gap: 9px; margin: 24px 0 12px; color: #c5cede; font-size: 12px; font-weight: 500; }
.device-group-heading span { padding: 2px 7px; border-radius: 7px; color: #a4afca; background: #a7b5ff0c; font-size: 10px; }
.device-card { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 10px; padding: 18px; border: 1px solid var(--border); border-radius: 18px; background: #ffffff03; }
.device-icon { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 12px; color: #b3c0f3; background: #a7b5ff0c; }
.device-icon svg { width: 18px; height: 18px; }
.device-body { flex: 1; min-width: 0; }
.device-body strong { display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; color: #d5deee; font-size: 13px; font-weight: 500; overflow-wrap: anywhere; }
.device-meta { margin-top: 8px; color: var(--muted); font-size: 11px; line-height: 1.9; overflow-wrap: anywhere; }
.device-state { margin-top: 5px; color: var(--green); font-size: 10px; }

@keyframes reveal { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
@keyframes dialog-enter { from { opacity: 0; transform: translateY(10px) scale(.985); } to { opacity: 1; transform: translateY(0) scale(1); } }
@keyframes toast-enter { from { opacity: 0; margin-bottom: -8px; } to { opacity: 1; margin-bottom: 0; } }
@keyframes ring-pulse { 50% { opacity: .35; box-shadow: 0 0 0 4px #c0a0ff0d; } }

@media (min-width: 1500px) { main { padding-top: 54px; } }
@media (max-width: 1180px) {
  .sidebar { gap: 20px; width: calc(100% - 40px); padding: 16px 18px; }
  .brand { font-size: 15px; gap: 9px; }
  .brand-mark { width: 38px; height: 38px; border-radius: 13px; }
  .search { width: 150px; }
  main { width: calc(100% - 64px); }
  .nav-item { padding: 10px 12px; }
  .quick-profile-label { display: none; }
  .quick-profile-button { width: 36px; height: 36px; padding: 0; }
  .account-states { max-width: 48%; }
}
@media (max-width: 930px) {
  .sidebar { flex-wrap: wrap; justify-content: space-between; gap: 16px; }
  .sidebar-tools { flex-basis: 100%; margin-left: 0; }
  .search { flex: 1; }
  .sidebar nav { margin-left: auto; }
  main { padding-top: 32px; min-height: calc(100dvh - 196px); }
  .chat-toolbar { align-items: flex-start; flex-direction: column; }
  .chat-targets { width: 100%; }
  .chat-account-choice { flex: 1; }
  .picker-control { width: 100%; }
}
@media (max-width: 700px) {
  .ticket-layout { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .ticket-sidebar { border-radius: 18px; }
  .ticket-list { max-height: 230px; }
  .ticket-item { padding: 11px; }
  .ticket-heading h2 { font-size: 18px; }
  .sidebar { width: calc(100% - 24px); min-height: 0; margin-top: 12px; padding: 14px; gap: 14px; border-radius: 22px; }
  .brand { gap: 8px; font-size: 14px; }
  .brand-mark { width: 34px; height: 34px; border-radius: 12px; }
  .brand-mark svg { width: 24px; height: 24px; }
  .sidebar nav { padding: 3px; gap: 2px; border-radius: 14px; }
  .nav-item { gap: 6px; padding: 9px 10px; border-radius: 11px; font-size: 11px; }
  .nav-item svg { width: 15px; height: 15px; }
  .nav-item > span { min-width: 18px; padding: 0 4px; font-size: 9px; }
  .sidebar-tools { gap: 8px; }
  .sidebar-tools .button { padding: 10px 12px; font-size: 11px; }
  .search { width: 0; padding: 10px 12px; }
  main { width: calc(100% - 32px); padding-top: 30px; gap: 20px; min-height: calc(100dvh - 175px); }
  .page-heading { align-items: flex-start; flex-direction: column; gap: 16px; }
  h1 { font-size: 28px; }
  .account-summary { gap: 22px; font-size: 11px; }
  .account-summary strong { font-size: 12px; }
  .filters-toolbar { gap: 8px; }
  .expired-toggle { margin-left: 0; padding-left: 4px; font-size: 10px; }
  .role-filters, .session-filters { gap: 2px; padding: 4px; border-radius: 14px; }
  .session-filter, .role-filter { min-height: 30px; padding: 5px 9px; gap: 5px; font-size: 10px; border-radius: 9px; }
  .account-list { gap: 10px; }
  .account-card { display: grid; grid-template-columns: 40px minmax(0, 1fr) auto; gap: 12px; padding: 16px; border-radius: 20px; }
  .avatar { width: 40px; height: 40px; border-radius: 13px; grid-row: 1; }
  .account-identity { gap: 4px; }
  .account-name { font-size: 13px; }
  .account-id { font-size: 10px; }
  .account-states { grid-column: 1 / -1; grid-row: 2; justify-content: flex-start; max-width: 100%; gap: 5px; padding-top: 1px; }
  .account-actions { grid-column: 3; grid-row: 1; gap: 5px; margin: 0; }
  .account-actions .icon-button, .quick-profile-button { width: 34px; height: 34px; min-height: 34px; border-radius: 11px; }
  .status-badge, .family-badge { min-height: 25px; padding: 4px 8px; font-size: 10px; }
  .account-group-heading { margin-top: 12px; }
  .pagination { font-size: 11px; }
  .page-controls { gap: 6px; }
  .page-controls .icon-button { width: 32px; height: 32px; }
  .chat-targets { flex-direction: column; align-items: stretch; gap: 12px; }
  .chat-direction { display: none; }
  .chat-ring-controls { padding: 13px; gap: 10px; border-radius: 18px; }
  .chat-ring-controls .section-note { min-width: 120px; font-size: 11px; }
  #chat-ring { min-width: 128px; padding: 10px 12px; font-size: 11px; }
  .chat-workspace { height: 58dvh; min-height: 360px; border-radius: 22px; }
  .chat-messages { padding: 18px; }
  .chat-message, .chat-own-message { max-width: 88%; padding: 11px 14px; font-size: 12px; }
  .chat-compose { padding: 12px; gap: 8px; }
  .chat-compose .button { padding: 10px 12px; font-size: 11px; }
  .chat-compose input { padding: 10px 12px; }
  dialog { width: calc(100% - 24px); max-height: calc(100dvh - 24px); padding: 22px; border-radius: 24px; }
  dialog h2 { font-size: 22px; }
  .field > span { font-size: 10px; }
  #details-dialog { width: calc(100% - 24px); padding: 20px; }
  #details-dialog > h2 { margin-bottom: 18px; }
  .account-workspace { display: flex; flex-direction: column; gap: 20px; min-height: 350px; padding-top: 16px; }
  .detail-tabs { flex-direction: row; flex-wrap: wrap; gap: 5px; padding: 0 0 14px; border-right: 0; border-bottom: 1px solid var(--border); }
  .detail-tab { padding: 10px 12px; font-size: 11px; }
  .detail-panels { max-height: calc(100dvh - 300px); padding: 0 2px 4px; }
  .personalization-tabs { margin-bottom: 18px; }
  .section-form fieldset { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .section-heading { flex-wrap: wrap; }
  .detail-data > div { font-size: 11px; gap: 12px; }
  .device-card { padding: 14px; }
  .dialog-actions { gap: 8px; }
  .dialog-actions .button { padding: 10px 12px; font-size: 11px; }
  .toast { bottom: 16px; padding: 14px 16px; }
}
@media (max-width: 380px) {
  .brand-light { display: none; }
  .sidebar-tools .button { padding: 10px; }
  .account-summary { gap: 14px; }
  .account-card { gap: 10px; padding: 13px; }
  .chat-direction { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* Chat image viewer. */
#image-viewer { width: min(1440px, calc(100vw - 32px)); max-width: none; height: calc(100dvh - 32px); max-height: none; padding: 0; overflow: hidden; border-radius: 24px; background: #10141df2; }
#image-viewer[open] { display: flex; flex-direction: column; }
.image-viewer-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.image-viewer-toolbar h2 { font-size: 14px; margin: 0; }
.image-viewer-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-left: auto; }
.image-viewer-actions .button { font-size: 11px; padding: 9px 11px; text-decoration: none; }
.image-viewer-actions .icon-button { width: 36px; height: 36px; }
#image-zoom-value { min-width: 45px; font-size: 11px; text-align: center; color: var(--muted); }
.image-viewer-body { display: flex; flex: 1; min-height: 0; min-width: 0; }
.image-stage { position: relative; flex: 1; min-width: 0; overflow: hidden; touch-action: none; cursor: grab; background: radial-gradient(ellipse, #252d3b55, #080b1280); }
.image-stage:active { cursor: grabbing; }
#image-full { position: absolute; top: 50%; left: 50%; max-width: none; max-height: none; user-select: none; transform-origin: center; }
.image-text-panel { display: flex; flex-direction: column; gap: 12px; width: min(340px, 40%); padding: 18px; border-left: 1px solid var(--border); background: #101521cc; font-size: 12px; }
.image-text-panel textarea { flex: 1; min-height: 80px; width: 100%; resize: none; padding: 12px; color: var(--text); border: 1px solid var(--border); border-radius: 12px; background: #090c1480; line-height: 1.6; }
.image-text-panel p { margin: 0; font-size: 11px; color: var(--muted); }
.image-viewer-status { min-height: 32px; margin: 0; padding: 8px 18px; font-size: 11px; color: var(--muted); border-top: 1px solid var(--border); }
@media (max-width: 600px) {
  #image-viewer { width: calc(100vw - 12px); height: calc(100dvh - 12px); border-radius: 18px; }
  .image-viewer-toolbar { padding: 10px; gap: 8px; }
  .image-viewer-actions { gap: 4px; }
  .image-viewer-body { flex-direction: column; }
  .image-text-panel { width: 100%; height: 42%; border-left: 0; border-top: 1px solid var(--border); padding: 12px; gap: 8px; }
  .image-viewer-actions .button { padding: 8px; font-size: 10px; }
}
