/* ARO-108 freeze 2026-08-25-v1: Presence-only tokens; shell/navigation stay unchanged. */
@font-face {
  font-family: "Instrument Sans";
  src: url("../assets/fonts/instrument-sans-latin.woff2") format("woff2");
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
}

:root {
  --presence-paper: #faf9f7;
  --presence-surface: #fff;
  --presence-line: #e0ded7;
  --presence-soft-line: #eeece6;
  --presence-ink: #1c2024;
  --presence-muted: #6c7278;
  --presence-soft: #8b8880;
  --presence-accent: #146b64;
  --presence-tint: #e6f1ef;
  --presence-accent-ink: #0f524d;
  --presence-segment: #f3f1ec;
}

html[data-theme="dark"] {
  --presence-paper: #151e29;
  --presence-surface: #101720;
  --presence-line: #394654;
  --presence-soft-line: #293642;
  --presence-ink: #f7fafc;
  --presence-muted: #b2becd;
  --presence-soft: #a0acb8;
  --presence-accent: #6bc6b3;
  --presence-tint: #163c38;
  --presence-accent-ink: #9bddcf;
  --presence-segment: #202c38;
}

.presence-summary-button,
.presence-self-button,
.sidebar-presence-button,
.presence-dialog {
  font-family: "Instrument Sans", "IBM Plex Sans", sans-serif;
}

.presence-summary-button,
.presence-self-button,
.sidebar-presence-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex: none;
  min-height: 34px;
  padding: 4px 10px 4px 8px;
  border: 1px solid var(--presence-accent);
  border-radius: 7px;
  background: var(--presence-tint);
  color: var(--presence-accent-ink);
  font-size: 11.5px;
  font-weight: 600;
  white-space: nowrap;
}

.presence-summary-button { max-width: 180px; }
.presence-summary-button:hover,
.presence-summary-button:focus-visible,
.sidebar-presence-button:hover {
  color: var(--presence-accent-ink);
  background: var(--presence-tint);
  border-color: var(--presence-accent);
}
.presence-summary-button[data-state="reconnecting"] { border-style: dashed; }
.presence-self-button {
  border-color: var(--presence-line);
  background: var(--presence-surface);
  color: var(--presence-ink);
  font-weight: 500;
}
.presence-avatar-stack { flex-direction: row; padding-left: 0; }
.presence-avatar {
  width: 22px;
  height: 22px;
  margin: 0;
  outline: 2px solid var(--presence-tint);
  border: 0;
  font-size: 8px;
  font-weight: 600;
  box-shadow: none;
}
.presence-avatar + .presence-avatar { margin-left: -7px; }
.presence-avatar-tone-0 { background: #8fb3ad; color: #12332f; }
.presence-avatar-tone-1 { background: #a9bcd4; color: #16293d; }
.presence-avatar-tone-2 { background: #c9c3b4; color: #33301f; }
.presence-avatar.offline,
.presence-avatar.unknown { background: var(--presence-segment); color: var(--presence-muted); box-shadow: none; }
.presence-self-avatar {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #d6d3cb;
  color: #3d4349;
  font-size: 9px;
  font-weight: 600;
}
.presence-self-avatar .presence-shape { position: absolute; right: -2px; bottom: -1px; outline: 2px solid var(--presence-surface); }
.presence-shape { display: inline-block; flex: none; width: 9px; height: 9px; border-radius: 50%; }
.presence-shape.online { background: #1f9d76; }
.presence-shape.idle { border: 2px solid #b58a3a; background: var(--presence-surface); }
.presence-shape.dnd { height: 3px; border-radius: 2px; background: #9c3a33; }
.presence-shape.offline { border: 1.5px solid #a8a59d; background: var(--presence-surface); }
.presence-shape.unknown { height: auto; color: var(--presence-soft); font: 500 11px/1 "IBM Plex Mono", monospace; }
.sidebar-presence-button { display: none; }

.presence-overlay { position: fixed; inset: 0; z-index: 1400; pointer-events: none; }
.presence-dialog {
  position: fixed;
  display: flex;
  flex-direction: column;
  width: 376px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - 24px);
  color: var(--presence-ink);
  background: var(--presence-surface);
  border: 1px solid #d8d5ce;
  border-radius: 12px;
  box-shadow: 0 12px 34px rgba(20, 20, 20, .16);
  overflow: hidden;
  pointer-events: auto;
}
html[data-theme="dark"] .presence-dialog { border-color: var(--presence-line); }
.presence-dialog[data-view="status"] { width: 344px; }
.presence-dialog button,
.presence-dialog input,
.presence-dialog select { font-family: inherit; }
.presence-dialog button:focus-visible,
.presence-dialog input:focus-visible,
.presence-dialog select:focus-visible,
.presence-summary-button:focus-visible,
.presence-self-button:focus-visible,
.sidebar-presence-button:focus-visible {
  outline: 2px solid var(--presence-accent);
  outline-offset: 2px;
}
.presence-dialog-header {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 5px 8px 0 16px;
}
.presence-dialog-header h3 { flex: 1; margin: 0; font-size: 13.5px; font-weight: 600; line-height: 1.2; }
#presence-close {
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--presence-soft);
  font: 400 12px/1 "IBM Plex Mono", monospace;
}
.presence-drag-handle { display: none; }
#presence-people-panel { display: flex; flex-direction: column; min-height: 0; }
.presence-filters { flex: none; padding: 8px 16px 12px; border-bottom: 1px solid var(--presence-soft-line); }
.presence-scope-switch { display: flex; gap: 4px; padding: 3px; background: var(--presence-segment); border-radius: 7px; }
.presence-scope-switch button {
  flex: 1;
  min-width: 0;
  min-height: 30px;
  padding: 7px 4px;
  border: 0;
  border-radius: 5px;
  background: transparent;
  color: var(--presence-muted);
  font-size: 11.5px;
  font-weight: 500;
}
.presence-scope-switch button[aria-pressed="true"] { color: var(--presence-ink); background: var(--presence-surface); box-shadow: 0 1px 2px rgba(20, 20, 20, .08); font-weight: 600; }
.presence-dialog input:not([type="radio"]),
.presence-dialog select {
  min-width: 0;
  width: 100%;
  min-height: 34px;
  padding: 7px 10px;
  border: 1px solid var(--presence-line);
  border-radius: 7px;
  background: var(--presence-paper);
  color: var(--presence-ink);
  font-size: 12px;
}
#presence-search { margin-top: 12px; }
.presence-scope-note { margin: 7px 0 0; color: var(--presence-muted); font-size: 10.5px; line-height: 1.4; overflow-wrap: anywhere; }
.presence-people-scroll { min-height: 0; max-height: 430px; padding: 10px 8px 12px; overflow: auto; overscroll-behavior: contain; }
.presence-people-group h4 { margin: 0; padding: 12px 8px 6px; color: var(--presence-soft); font: 600 10px/1.2 "IBM Plex Mono", monospace; letter-spacing: .08em; text-transform: uppercase; }
.presence-people-group:first-child h4 { padding-top: 8px; }
.presence-person { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 7px 8px; }
.presence-person-avatar { display: inline-grid; flex: none; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-size: 10px; font-weight: 600; }
.presence-person.offline .presence-person-avatar,
.presence-person.unknown .presence-person-avatar { background: var(--presence-segment); color: var(--presence-soft); }
.presence-person-copy { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.presence-person-copy strong { display: block; font-size: 12.5px; line-height: 1.2; font-weight: 500; }
.presence-person-copy small { display: block; margin-top: 2px; color: var(--presence-muted); font-size: 11px; line-height: 1.4; }
.presence-person.offline .presence-person-copy strong { color: var(--presence-muted); }
.presence-text-action { min-height: 36px; padding: 8px; border: 0; background: transparent; color: var(--presence-accent); font-size: 11.5px; font-weight: 500; text-align: left; }
.presence-empty { padding: 16px 8px; }
.presence-empty strong { font-size: 12.5px; font-weight: 600; }
.presence-empty p { margin: 6px 0; color: var(--presence-muted); font-size: 11.5px; line-height: 1.5; }
.presence-surface-status { margin: 4px 6px 8px; padding: 11px 12px; border: 1px solid var(--presence-line); border-radius: 8px; background: var(--presence-paper); color: var(--presence-muted); font-size: 11.5px; line-height: 1.5; }
.presence-surface-status[data-state="reconnecting"] { border-color: #f0e2c8; background: #fdf7ec; color: #7d4c0e; }
html[data-theme="dark"] .presence-surface-status[data-state="reconnecting"] { border-color: #6e552d; background: #332b1d; color: #f0d19a; }
.presence-skeleton { display: grid; gap: 12px; padding: 8px; }
.presence-skeleton span { height: 30px; border-radius: 7px; background: var(--presence-segment); }
.presence-skeleton span:nth-child(2) { width: 82%; }
.presence-skeleton span:nth-child(3) { width: 65%; }
.presence-privacy-note { flex: none; padding: 12px 16px; border-top: 1px solid var(--presence-soft-line); background: var(--presence-paper); color: var(--presence-muted); font-size: 11px; line-height: 1.5; }
#presence-status-panel { min-height: 0; overflow: auto; overscroll-behavior: contain; }
.presence-preferences-form { display: grid; gap: 12px; padding: 8px 14px 14px; }
.presence-availability-options { display: grid; gap: 6px; min-width: 0; margin: 0; padding: 0; border: 0; }
.presence-availability-options label { position: relative; display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 9px 10px; border-radius: 7px; font-size: 12.5px; cursor: pointer; }
.presence-availability-options label:has(input:checked) { background: var(--presence-tint); box-shadow: inset 0 0 0 1px var(--presence-line); font-weight: 600; }
.presence-availability-options label:has(input:focus-visible) { outline: 2px solid var(--presence-accent); outline-offset: 1px; }
.presence-availability-options input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.presence-availability-options small { margin-left: auto; color: var(--presence-muted); font-size: 10.5px; font-weight: 400; }
.presence-field { display: grid; gap: 5px; min-width: 0; color: var(--presence-muted); font-size: 11px; font-weight: 500; }
.presence-preferences-form .presence-custom-status-fields { grid-template-columns: 64px minmax(0, 1fr); }
.presence-form-note { margin: 0; color: var(--presence-muted); font-size: 10.5px; line-height: 1.5; }
.presence-save-button { min-height: 44px; border: 0; border-radius: 7px; background: var(--presence-accent); color: var(--presence-surface); font-size: 12.5px; font-weight: 600; }
.presence-preferences-form .form-status { margin: 0; min-height: 0; font-size: 11px; }
.presence-dialog [hidden],
.presence-overlay[hidden],
[data-presence-open][hidden] { display: none !important; }

@media (max-width: 1023px) {
  .presence-summary-button,
  .presence-self-button { min-height: 44px; }
  .sidebar-presence-button { display: inline-flex; align-self: flex-end; min-height: 44px; margin: 0 0 8px auto; }
}

@media (max-width: 767px) {
  .presence-summary-button { width: auto; max-width: 96px; min-height: 44px; padding: 4px 8px; border-radius: 22px; font-size: 10.5px; }
  .presence-summary-button .presence-avatar-stack,
  .presence-self-button { display: none; }
  #presence-summary-label { overflow: hidden; text-overflow: ellipsis; }
  .presence-overlay { pointer-events: auto; background: rgba(20, 20, 20, .28); }
  .presence-dialog,
  .presence-dialog[data-view="status"] { left: 0; right: 0; bottom: 0; top: auto; width: 100%; max-width: none; max-height: min(600px, calc(100dvh - 24px)); border-radius: 16px 16px 0 0; border-bottom: 0; box-shadow: 0 -8px 26px rgba(20, 20, 20, .14); padding-bottom: env(safe-area-inset-bottom); }
  .presence-drag-handle { display: flex; justify-content: center; align-items: center; flex: none; height: 24px; touch-action: none; }
  .presence-drag-handle span { width: 38px; height: 4px; border-radius: 2px; background: var(--presence-line); }
  .presence-dialog-header { padding-top: 0; }
  .presence-dialog-header h3 { font-size: 14px; }
  .presence-scope-switch button,
  .presence-dialog input:not([type="radio"]),
  .presence-dialog select,
  .presence-text-action { min-height: 44px; }
  .presence-person { min-height: 52px; gap: 11px; }
  .presence-person-avatar { width: 30px; height: 30px; font-size: 11px; }
  .presence-person-copy strong { font-size: 13px; }
  .presence-privacy-note { font-size: 10.5px; }
}
