/* Shared work, access and revision history use the same form components. */
.accessLocked main,.accessLocked #teamDialog { visibility: hidden; pointer-events:none; }
.accessGate { position:fixed;inset:0;z-index:100;background:var(--color-page);display:grid;place-items:center;padding:20px;overflow:auto; }
.accessCard { width:min(460px,100%);background:white;border:1px solid var(--line);border-radius:16px;padding:28px;display:grid;gap:18px; }
.accessCard h1 { font-weight:700; }
/* One header row. The mobile date rail already supplies the date context. */
.topbarTools { display:flex;align-items:center;gap:22px;margin-left:auto;flex-shrink:0; }
.topbarTools #showHistory { gap:7px;font-size:13px;min-height:38px;font-weight:500; }
.connectionNotice { position:fixed;right:20px;bottom:18px;z-index:45;display:flex;align-items:center;gap:12px;max-width:calc(100vw - 28px);padding:8px 14px;background:#fff5f5;border:1px solid #e9b8be;color:#a42133;border-radius:10px;box-shadow:var(--shadow-notice);font-size:13px; }
.connectionNotice button { color:inherit;flex-shrink:0; }
.managementDialog { padding:24px;border:1px solid var(--line);border-radius:16px;width:min(680px,calc(100vw - 24px));max-height:88dvh;color:var(--color-text);background:var(--color-surface); }
.managementDialog::backdrop { background:rgb(25 35 52 / 22%); }
.managementDialog>header { display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:16px; }
.managementDialog #teamContent { display:grid;gap:12px; }
.managementDialog p { margin:6px 0; }
.managementDialog .fieldControl { width:100%; }
.managementCard { border:1px solid var(--line);padding:14px;border-radius:10px;display:grid;gap:8px; }
.managementActions { display:flex;gap:8px;flex-wrap:wrap;align-items:center; }
.managementCard .subtitle { white-space:normal;overflow-wrap:anywhere; }
.historyCells { display:grid;gap:10px; }
.historyCompare { display:grid;grid-template-columns:1fr 1fr;gap:12px;overflow-wrap:anywhere; }
.historyCompare pre { white-space:pre-wrap;font:inherit;font-size:13px;margin:6px 0; }
.peerEditing { background:#edf1f8;color:#385577;padding:10px;border-radius:8px;font-size:13px;margin-bottom:12px; }
#remoteConflict { display:grid;gap:8px;margin-bottom:14px; }
#remoteConflict strong { color:#bd263c; }
.peerCell { position:relative; }
.peerCell::after { content:attr(data-peer);position:absolute;bottom:2px;right:2px;max-width:95%;font-size:10px;line-height:1.3;padding:2px 5px;background:#e9e3f6;color:#55377a;border:1px solid #aa94c6;border-radius:4px;pointer-events:none;overflow:hidden;text-overflow:ellipsis;white-space:nowrap; }
@media(max-width:760px) {
  .topbar {min-height:60px;gap:8px;flex-wrap:nowrap;}
  .identity {min-width:0;}
  .topbarTools {gap:0;}
  .topbarTools #showHistory {padding:8px 4px;font-size:12px;gap:5px;min-height:44px;}
  .topbarTools #showHistory .icon {width:18px;height:18px;}
  .managementDialog {padding:18px 14px;border-radius:16px;width:calc(100vw - 16px);max-height:92dvh;}
  .managementDialog h2 {font-size:20px;}
  .managementDialog>header {gap:4px;}
  .managementDialog>header .button {padding:8px;}
  .historyCompare {grid-template-columns:1fr;}
  .connectionNotice {right:14px;bottom:14px;}
}

td.peerCell:not(.chosen) { box-shadow:inset 0 0 0 2px var(--peer-color,#8666b0); }
[data-peer-color="0"] { --peer-color:#8666b0; }
[data-peer-color="1"] { --peer-color:#318b87; }
[data-peer-color="2"] { --peer-color:#ac792c; }
[data-peer-color="3"] { --peer-color:#487db1; }
[data-peer-color="4"] { --peer-color:#ac5986; }
[data-peer-color="5"] { --peer-color:#6a873b; }
.peerCell::after { border-color:var(--peer-color);color:var(--peer-color);background:#fff; }

.historyToolbar {display:flex;gap:12px;align-items:center;justify-content:space-between;flex-wrap:wrap;}
.historyTabs {display:flex;gap:2px;padding:3px;background:var(--color-page);border-radius:9px;}
.historyTabs .button {font-size:12px;min-height:34px;padding:6px 10px;border:0;background:transparent;}
.historyTabs [aria-pressed="true"] {background:white;box-shadow:0 1px 3px #1f29371a;color:var(--color-primary,#365a98);}
.historyTimeline {display:grid;gap:22px;}
.historyDayTitle {font-size:14px;margin:4px 0 12px;font-weight:700;color:var(--color-secondary);}
.historyDayEvents {display:grid;gap:18px;}
.historyEvent {border-left:1px solid var(--line);padding-left:14px;}
.historyEventHead {display:flex;align-items:center;gap:8px;flex-wrap:wrap;font-size:13px;margin-bottom:8px;position:relative;}
.historyEventHead::before {content:'';position:absolute;left:-18px;top:5px;width:7px;height:7px;border-radius:50%;background:#a8b4c7;box-shadow:0 0 0 3px white;}
.historyEventHead time {font-variant-numeric:tabular-nums;color:var(--color-muted);font-size:12px;}
.historyActor {font-size:12px;color:var(--color-secondary);overflow-wrap:anywhere;}
.historyEventHead .historyActor {flex-basis:100%;}
.historyEventHead .subtitle {margin-left:auto;font-size:11px;}
.historyTiles {display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px;}
.historyTiles .historyTile {display:flex;flex-direction:column;align-items:flex-start;gap:4px;min-width:0;padding:12px;text-align:left;border:1px solid #dce2ec;border-radius:9px;background:#f8faff;font-size:13px;line-height:1.4;font-weight:400;overflow-wrap:anywhere;white-space:normal;}
.historyTiles .historyTile:hover {background:#f0f4fa;border-color:#9daecc;}
.historyTileCaption {color:var(--color-secondary);font-size:11px;}
.historyTileTime {font-size:14px;margin-bottom:3px;}
.historyTileLink {color:#365a98;font-size:12px;margin-top:6px;}
.historyEmpty {padding:20px 0;color:var(--color-secondary);font-size:14px;}
.historyCompare>div {background:var(--color-page);padding:12px;border-radius:8px;margin-top:10px;}
.historyCompare>div:last-child {background:#eef3fb;}
.historyBack {justify-self:start;padding:4px 0;min-height:32px;font-size:13px;}
.historyPreviewMeta {display:flex;gap:6px 18px;flex-wrap:wrap;font-size:12px;color:var(--color-secondary);}
.historyIntro {font-size:13px;color:var(--color-secondary);}
.historyRestoreGroup {border:1px solid var(--line);border-radius:10px;padding:14px;min-width:0;}
.historyRestoreHeading {display:flex;justify-content:space-between;align-items:center;gap:6px 12px;flex-wrap:wrap;margin-bottom:12px;font-size:14px;}
.historyRestoreHeading>span {font-size:12px;color:var(--color-secondary);}
.historyHours {display:flex;flex-wrap:wrap;gap:6px;}
.historyHour {display:flex;gap:6px;align-items:center;background:white;border:1px solid var(--line);border-radius:6px;padding:7px 9px;min-height:36px;font-size:13px;cursor:pointer;}
.historyHour:has(:checked) {border-color:#a7bad8;background:#f3f6fb;color:#2e4b7e;}
.historyHour:has(:disabled) {color:var(--color-muted);cursor:default;}
.historyHour input {width:15px;height:15px;margin:0;accent-color:#365a98;}
.historySelectAll {font-size:12px;min-height:30px;padding:4px 0;}
.historyCompare b {font-size:12px;color:var(--color-secondary);}
.historyCompare>div:last-child b {color:#2e4b7e;}
.historyRestoreFooter {position:sticky;bottom:-24px;padding:12px 0 0;background:white;border-top:1px solid var(--line);display:flex;align-items:center;justify-content:space-between;gap:12px;box-shadow:0 -8px 12px white;}
.historyRestoreSummary {font-size:12px;color:var(--color-secondary);}
.historyRestoreFooter .button {white-space:nowrap;font-size:13px;}
@media(max-width:760px){
 .historyRestoreGroup {padding:10px;}
 .historyRestoreFooter {bottom:-18px;flex-wrap:wrap;gap:6px;}
 .historyRestoreFooter .button {width:100%;}
}
@media(max-width:520px) {
 .historyTiles {grid-template-columns:1fr;}
 .historyEventHead .subtitle {width:100%;margin-left:0;}
 .historyToolbar {gap:8px;}
 .historyToolbar>.subtitle {font-size:11px;}
}

.historyTiles .historyTile:only-child {grid-column:1/-1;}

/* Small overlapping avatars; one device appears once even with several tabs. */
.topbarTools {gap:14px;}
.presenceGroup {position:relative;flex:0 0 auto;}
.peerAvatars {display:flex;align-items:center;padding:4px 0;}
.peerAvatar {display:grid;place-items:center;width:32px;height:32px;flex:0 0 32px;padding:0;border:2px solid var(--color-page);border-radius:50%;background:var(--peer-color,#68819f);color:#fff;font:600 11px/1 var(--font-family);letter-spacing:.1px;position:relative;}
.peerAvatar+.peerAvatar {margin-left:-9px;}
.peerAvatar:hover,.peerAvatar:focus-visible {z-index:2;outline:2px solid var(--peer-color,#68819f);outline-offset:1px;}
.peerAvatarMore {background:#e5e9ef;color:#526174;}
.presencePopover {position:absolute;top:calc(100% + 7px);right:0;width:max-content;max-width:min(300px,calc(100vw - 28px));padding:14px 16px;background:#fff;border:1px solid var(--line);border-radius:12px;box-shadow:0 6px 24px #25364c20;z-index:60;font-size:13px;}
.presencePopover strong {font-size:12px;color:var(--color-secondary);}
.presencePopover ul {list-style:none;display:grid;gap:12px;padding:0;margin:14px 0 0;max-height:260px;overflow:auto;}
.presencePopover li {display:flex;align-items:center;gap:8px;overflow-wrap:anywhere;}
.presenceDot {width:9px;height:9px;flex:0 0 9px;border-radius:50%;background:var(--peer-color);}
@media(max-width:760px){
 .topbarTools {gap:7px;}
 .peerAvatar {width:25px;height:25px;flex-basis:25px;font-size:9px;}
 .peerAvatar+.peerAvatar {margin-left:-8px;}
 .topbarTools #showHistory {gap:4px;padding:8px 0;}
 .topbarTools #showHistory .icon {display:none;}
 .presencePopover {right:-55px;}
}
