/* Contract: contracts/web/rules.md
 * The floating bottom dock + compact Arlene bar, and full-workspace app views.
 *
 * Loaded last of the numbered sheets so it overrides the full-width accent
 * footer from 11-assistant.css and the modal sizing from 17-studio.css and
 * 18-dupes.css without rewriting those sheets.
 */

/* ---------- the bottom OS rail (centered dock + bottom-right utilities) ---------- */
.bottomrail {
  position: relative; z-index: 59;
  flex: none;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr);
  align-items: center; gap: 12px;
  padding: 6px 14px calc(8px + env(safe-area-inset-bottom));
}
body.choosing .bottomrail { display: none; }

.bottombar {
  position: relative;
  display: flex; align-items: center; gap: 8px;
  width: min(760px, calc(100vw - 180px));
  max-width: 100%;
  padding: 5px 8px;
  border-radius: 18px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg), var(--rim);
}

/* In Requests the compose box lives inside the thread, so Arlene stands down
   and the floating bar shrinks cleanly to just the macOS-style app dock. */
body.in-requests .bottombar { width: fit-content; }
body.in-requests .dock-sep { display: none; }
body.choosing .bottombar { display: none; }

/* ---------- macOS-style app dock ---------- */
.dock {
  display: flex; align-items: center; gap: 4px;
  flex: none;
}

.dock-app {
  position: relative;
  display: flex; align-items: center; justify-content: center;
  width: 38px; height: 38px; padding: 0;
  border: 1px solid transparent; border-radius: 12px;
  background: transparent; color: var(--ink-dim);
  cursor: pointer;
  transition: transform var(--t-fast) var(--ease),
              background var(--t-fast) var(--ease),
              color var(--t-fast) var(--ease),
              border-color var(--t-fast) var(--ease);
}
.dock-app:hover {
  color: var(--ink);
  background: var(--panel-2);
  transform: translateY(-2px) scale(1.06);
}
.dock-app:active { transform: translateY(0) scale(.97); }
.dock-app:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.dock-app.on {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 14%, transparent);
  border-color: color-mix(in srgb, var(--accent) 26%, transparent);
}
/* Classic macOS active-app indicator dot below the icon. */
.dock-app.on::after {
  content: '';
  position: absolute; bottom: 2px; left: 50%; transform: translateX(-50%);
  width: 4px; height: 4px; border-radius: 50%;
  background: var(--accent);
}

.dock-ico {
  display: grid; place-items: center;
  width: 20px; height: 20px;
}
.dock-ico svg { width: 20px; height: 20px; display: block; }

/* Hover tooltip above the icon, macOS Dock style. */
.dock-tip {
  position: absolute; bottom: calc(100% + 10px); left: 50%;
  transform: translateX(-50%) translateY(4px);
  padding: 4px 9px; border-radius: 7px;
  background: var(--ink); color: var(--panel);
  font-size: 11.5px; font-weight: 560; line-height: 1.2;
  white-space: nowrap; pointer-events: none;
  opacity: 0; box-shadow: var(--shadow-md);
  transition: opacity var(--t-fast) var(--ease), transform var(--t-fast) var(--ease);
}
.dock-app:hover .dock-tip,
.dock-app:focus-visible .dock-tip {
  opacity: 1; transform: translateX(-50%) translateY(0);
}

/* Notification count badge on a dock icon (e.g. active work items). */
.dock-badge {
  position: absolute; top: 0; right: 0;
  min-width: 16px; height: 16px; padding: 0 4px;
  border-radius: 99px;
  background: var(--accent); color: var(--on-accent);
  font-size: 10px; font-weight: 700; line-height: 16px;
  text-align: center; font-variant-numeric: tabular-nums;
  box-shadow: 0 0 0 2px var(--panel);
}

.dock-sep {
  flex: none; width: 1px; height: 24px; margin: 0 2px;
  background: var(--line-strong);
}

/* ---------- compact Arlene inside the floating dock ---------- */
.bottombar .assistant {
  flex: 1; min-width: 0;
  background: transparent;
  z-index: auto;
}
.bottombar .assistant-line {
  padding: 0; gap: 6px;
  color: var(--ink);
}
.bottombar .assistant-mark {
  width: 10px; height: 10px; border-radius: 3.5px;
  background: var(--accent);
}
.bottombar .assistant-who {
  margin-left: -2px;
  font-size: 12px; font-weight: 620;
  color: var(--accent);
}
.bottombar .assistant-about {
  max-width: min(32%, 240px);
  padding: 3px 8px 3px 4px;
  background: var(--panel-2);
  border-color: var(--line);
  color: var(--ink-dim);
  font-size: 11.5px;
}
.bottombar .assistant-thumb,
.bottombar .assistant-thumb img { width: 18px; height: 18px; }
.bottombar .assistant-count,
.bottombar .assistant-over { color: var(--accent); }

.bottombar .assistant-say {
  min-height: 34px; max-height: 96px;
  padding: 6px 11px;
  background: var(--panel-2); color: var(--ink);
  border: 1px solid var(--line); border-radius: 12px;
  font-size: 13.5px; line-height: 1.4;
}
.bottombar .assistant-say:hover { background: var(--panel-hover); }
.bottombar .assistant-say:focus {
  background: var(--bg);
  border-color: var(--accent);
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--accent) 20%, transparent);
}

.bottombar .assistant-line .ghost,
.bottombar .assistant-line .btn {
  height: 34px; padding: 0 11px;
  border-radius: 10px; font-size: 12.5px;
}
.bottombar .assistant-line .ghost {
  color: var(--ink-dim); border-color: var(--line);
}
.bottombar .assistant-line .ghost:hover {
  color: var(--ink); border-color: var(--line-strong);
  background: var(--panel-2);
}
.dock-icobtn {
  position: relative; flex: none;
  display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border: 1px solid transparent; border-radius: 10px;
  background: transparent; color: var(--ink-dim);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.dock-icobtn:hover { color: var(--ink); background: var(--panel-2); border-color: var(--line); }
.dock-icobtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.dock-icobtn svg { width: 17px; height: 17px; display: block; }
.dock-icobtn .dock-badge { top: -2px; right: -2px; }

.bottombar .assistant-line .dock-send {
  flex: none; display: grid; place-items: center;
  width: 34px; height: 34px; padding: 0;
  border-radius: 10px;
  background: var(--accent); color: var(--on-accent);
}
.bottombar .assistant-line .dock-send svg { width: 16px; height: 16px; display: block; }
.bottombar .assistant-line .dock-send:hover:not([disabled]) {
  filter: brightness(1.06);
  background: var(--accent);
}
.bottombar .assistant-line .dock-send.sending svg { animation: dock-pulse 1s ease-in-out infinite; }
@keyframes dock-pulse { 50% { opacity: .4; transform: scale(.9); } }

.bottombar .assistant-bubble {
  bottom: calc(100% + 16px); left: 0;
  width: min(560px, calc(100vw - 32px));
}

/* ---------- bottom-right utility cluster (upload + refresh/activity) ---------- */
.cornertools {
  position: relative;
  justify-self: end;
  display: flex; align-items: center;
}
.cornerpill {
  display: flex; align-items: center; gap: 4px;
  padding: 5px;
  border-radius: 16px;
  background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(18px) saturate(1.35);
  -webkit-backdrop-filter: blur(18px) saturate(1.35);
  border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg), var(--rim);
}
.cornerbtn {
  display: grid; place-items: center;
  width: 36px; height: 36px; padding: 0;
  border: 1px solid transparent; border-radius: 11px;
  background: transparent; color: var(--ink-dim);
  cursor: pointer;
  transition: background var(--t-fast) var(--ease), color var(--t-fast) var(--ease), border-color var(--t-fast) var(--ease);
}
.cornerbtn:hover { color: var(--ink); background: var(--panel-2); border-color: var(--line); }
.cornerbtn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cornerbtn .ico { width: 18px; height: 18px; display: block; }
.cornerchip {
  height: 26px; padding: 0 9px; margin: 0 2px;
  border-radius: 99px; font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--ink);
  cursor: pointer; white-space: nowrap;
}
.cornerchip.warn {
  color: var(--warn);
  border-color: color-mix(in srgb, var(--warn) 45%, transparent);
  background: color-mix(in srgb, var(--warn) 12%, transparent);
}

.activitypop {
  position: absolute; right: 0; bottom: calc(100% + 12px);
  width: min(380px, calc(100vw - 28px));
  max-height: min(62vh, 460px);
  display: flex; flex-direction: column;
  border-radius: 14px;
  background: var(--panel); border: 1px solid var(--line-strong);
  box-shadow: var(--shadow-lg), var(--rim);
  overflow: hidden;
  z-index: 62;
}
.activitypop-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 12px 10px 14px;
  border-bottom: 1px solid var(--line);
  font-size: 13.5px;
}
.activitypop-close { width: 28px; height: 28px; font-size: 18px; }
.activitypop-body {
  padding: 12px 14px; overflow-y: auto;
  font-size: 13px;
}
.activitypop-body > p:first-child { margin-top: 0; }

@media (max-width: 900px) {
  .bottomrail {
    grid-template-columns: minmax(0, 1fr) auto;
    padding: 5px 8px calc(7px + env(safe-area-inset-bottom));
    gap: 6px;
  }
  .bottomrail-spacer { display: none; }
  .bottombar { width: 100%; }
}

@media (max-width: 720px) {
  .bottomrail { padding: 5px 8px calc(7px + env(safe-area-inset-bottom)); }
  .bottombar {
    padding: 4px 6px; gap: 5px;
    border-radius: 16px;
  }
  .dock-app { width: 34px; height: 34px; border-radius: 10px; }
  .dock-ico, .dock-ico svg { width: 18px; height: 18px; }
  .dock-tip { display: none; }
  .cornertools { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .dock-app, .dock-tip, .bottombar .assistant-line .dock-send.sending svg { transition: none; animation: none; }
}
