/* Dolphin Hub design system. Dolphin web tokens (dolphin-web/src/styles/theme.css)
   with the staff tools' 3D-press controls. Light by default, dark by
   [data-ui=dark] or the system setting. */
@font-face { font-family: StaffManrope; src: url('/staff-login/manrope.woff2') format('woff2'); font-weight: 200 800; font-display: swap; }
@font-face { font-family: StaffHeading; src: url('/staff-login/heading.woff2') format('woff2'); font-display: swap; }

:root {
  color-scheme: light;
  --bg: #F0F2F5; --surface: #FFFFFC; --raised: #FFFFFF; --sunken: #F4F6F9; --canvas: #E9EDF2;
  --ink: #0A234F; --ink-2: #29466F; --muted: #536A86; --faint: #8A9BB0;
  --line: #D9E4F2; --line-strong: #C4D3E6; --shadow: #C9D6E6;
  --blue: #2F9AE6; --blue-ink: #1E6FBE; --blue-soft: #E3F2FD; --blue-edge: #91C8ED;
  --green: #3FA669; --green-soft: #DCF5E6; --red: #E35D6A; --red-soft: #FFE3E5; --amber: #B88A20; --amber-soft: #FFF3CC;
  --focus: #2F9AE6;
  --r-sm: 10px; --r: 14px; --r-lg: 20px;
  --font: StaffManrope, ui-rounded, system-ui, -apple-system, sans-serif;
  --display: StaffHeading, StaffManrope, ui-rounded, system-ui, sans-serif;
  font: 600 14px/1.45 var(--font); color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
:root[data-ui=dark] {
  color-scheme: dark;
  --bg: #0E1621; --surface: #141E2B; --raised: #1A2636; --sunken: #111A26; --canvas: #0B121B;
  --ink: #EAF2FB; --ink-2: #C7D6E8; --muted: #93A6BD; --faint: #6B7F96;
  --line: #24344A; --line-strong: #314661; --shadow: #070C13;
  --blue: #5FC6F7; --blue-ink: #8DD4FA; --blue-soft: #16324A; --blue-edge: #2D6A94;
  --green: #5CC98A; --green-soft: #143222; --red: #F07C87; --red-soft: #3A1A20; --amber: #E0B64A; --amber-soft: #33290F;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); overflow: hidden; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--blue-ink); }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: var(--blue-soft); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

.wordmark { display: inline-flex; align-items: center; gap: 10px; font: 400 20px/1 var(--display); letter-spacing: -.01em; color: var(--ink); text-decoration: none; white-space: nowrap; }
.wordmark img { width: 30px; height: 30px; }
.wordmark b { font-weight: 400; color: var(--blue); }
.h1 { font: 400 30px/1.15 var(--display); margin: 0; letter-spacing: -.01em; }
.h2 { font: 400 20px/1.2 var(--display); margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 12px; }

/* Controls */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 0 14px;
  border: 2px solid var(--line); border-radius: 12px; background: var(--raised); color: var(--ink);
  box-shadow: 0 2px 0 var(--shadow); font-weight: 750; cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background .12s, border-color .12s;
}
.btn:hover:not(:disabled) { background: var(--sunken); }
.btn:active:not(:disabled) { translate: 0 2px; box-shadow: none; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--blue); border-color: var(--blue); color: #fff; box-shadow: 0 3px 0 var(--blue-ink); }
:root[data-ui=dark] .btn.primary { color: #06223A; }
.btn.primary:hover:not(:disabled) { background: var(--blue); filter: brightness(1.05); }
.btn.green { background: var(--green); border-color: var(--green); color: #fff; box-shadow: 0 3px 0 #2c7d4e; }
.btn.danger { color: var(--red); }
.btn.sm { min-height: 32px; padding: 0 10px; border-radius: 10px; font-size: 13px; }
.btn.lg { min-height: 48px; padding: 0 22px; border-radius: 14px; font-size: 15px; }
.btn[aria-pressed=true] { border-color: var(--blue-edge); background: var(--blue-soft); color: var(--blue-ink); }
.icon-btn {
  display: inline-grid; place-items: center; width: 38px; height: 38px; padding: 0; border: 0; border-radius: 12px;
  background: transparent; color: var(--ink-2); cursor: pointer;
}
.icon-btn:hover { background: var(--sunken); color: var(--ink); }
.icon-btn[aria-pressed=true] { background: var(--blue-soft); color: var(--blue-ink); }
.icon-btn.sm { width: 32px; height: 32px; border-radius: 10px; }
.seg { display: inline-flex; padding: 3px; gap: 2px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--line); }
.seg > button {
  min-height: 30px; padding: 0 12px; border: 0; border-radius: 9px; background: transparent; color: var(--muted);
  font-weight: 750; cursor: pointer; white-space: nowrap; display: inline-flex; align-items: center; gap: 7px;
}
.seg > button[aria-pressed=true] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 0 var(--line-strong), 0 1px 3px rgb(10 35 79 / .08); }
.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 9px; border-radius: 12px;
  background: var(--sunken); color: var(--muted); font-size: 12px; font-weight: 750; white-space: nowrap;
}
.chip.blue { background: var(--blue-soft); color: var(--blue-ink); }
.chip.green { background: var(--green-soft); color: var(--green); }
.chip.amber { background: var(--amber-soft); color: var(--amber); }
.chip.red { background: var(--red-soft); color: var(--red); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; }
.dot.live { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .35; } }
.input, .textarea {
  width: 100%; min-height: 40px; padding: 9px 12px; border: 2px solid var(--line); border-radius: 12px;
  background: var(--sunken); color: var(--ink); outline: 0;
}
.input:focus, .textarea:focus { border-color: var(--blue-edge); background: var(--raised); }
.textarea { resize: none; line-height: 1.45; }
.field { display: grid; gap: 6px; }
.field > span { font-size: 12.5px; color: var(--muted); font-weight: 750; }
.kbd { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; font: 700 11px/1 var(--font); color: var(--muted); }

.app-icon { display: inline-grid; flex: none; border-radius: 24%; overflow: hidden; background: var(--sunken); box-shadow: 0 0 0 1px rgb(10 35 79 / .08); }
.app-icon { position: relative; }
.app-icon img, .app-icon > svg { width: 100%; height: 100%; display: block; object-fit: cover; }
.app-icon.tiled img { padding: 9%; object-fit: contain; }
.app-badge { position: absolute; right: 5%; bottom: 5%; width: 40%; height: 40%; border-radius: 50%; box-shadow: 0 0 0 2px rgb(255 255 255 / .9); }
.app-badge svg { width: 100%; height: 100%; display: block; }
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; flex: none; border-radius: 50%; color: #fff;
  background: var(--av, #2f9ae6); font: 800 12px/1 var(--font); text-transform: uppercase; letter-spacing: -.02em;
}
.avatar.lg { width: 36px; height: 36px; font-size: 14px; }
.avatar.agent { background: var(--ink); }
.avatar.prod { background: var(--green); }

/* Popover menus */
.pop { position: relative; }
.pop-panel {
  position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; min-width: 220px; max-height: min(70vh, 560px); overflow: auto;
  padding: 6px; border: 2px solid var(--line); border-radius: var(--r); background: var(--raised); box-shadow: 0 3px 0 var(--shadow), 0 18px 40px -18px rgb(10 35 79 / .35);
}
.pop-panel.right { left: auto; right: 0; }
.pop-panel.up { top: auto; bottom: calc(100% + 8px); }
.menu-label { padding: 8px 10px 4px; font-size: 11.5px; font-weight: 800; color: var(--faint); letter-spacing: .02em; }
.menu-item {
  width: 100%; display: flex; align-items: center; gap: 10px; min-height: 36px; padding: 6px 10px; border: 0; border-radius: 10px;
  background: none; color: var(--ink); text-align: left; cursor: pointer; font-weight: 700;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--sunken); outline: none; }
.menu-item[aria-checked=true] { background: var(--blue-soft); color: var(--blue-ink); }
.menu-item .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-item .meta { color: var(--faint); font-size: 12px; font-weight: 650; }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--line); }

/* Dialog */
.dialog { border: 0; padding: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--ink); box-shadow: 0 30px 80px -20px rgb(10 35 79 / .45); width: min(620px, calc(100vw - 32px)); max-height: calc(100vh - 48px); }
.dialog::backdrop { background: rgb(10 20 35 / .38); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 18px 20px 6px; }
.dialog-body { padding: 8px 20px 20px; display: grid; gap: 14px; }
.code-block { position: relative; padding: 12px 44px 12px 12px; border-radius: 12px; background: var(--sunken); border: 1px solid var(--line); font: 12px/1.5 ui-monospace, "SF Mono", Menlo, monospace; white-space: pre-wrap; word-break: break-all; color: var(--ink-2); }
.code-block .icon-btn { position: absolute; top: 6px; right: 6px; }

.toast { position: fixed; z-index: 90; left: 50%; bottom: 24px; transform: translateX(-50%); padding: 10px 16px; border-radius: 12px; background: var(--ink); color: var(--surface); font-weight: 750; box-shadow: 0 10px 30px -10px rgb(0 0 0 / .4); }

/* Sign-in */
.signin { position: fixed; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 100; }

/* Workspace */
.ws { position: relative; height: 100%; display: grid; grid-template-columns: minmax(0, 1fr) var(--side, 400px); grid-template-rows: minmax(0, 1fr); background: var(--canvas); }
.ws[data-side=closed] { grid-template-columns: minmax(0, 1fr) 0; }
.ws-main { position: relative; min-width: 0; display: grid; grid-template-rows: auto minmax(0, 1fr); }
.ws-bar { display: flex; align-items: center; gap: 8px; padding: 10px 14px; flex-wrap: wrap; }
.ws-bar .spacer { flex: 1; }
.ws-stage { position: relative; min-height: 0; }
.ws-stage-inner { position: absolute; inset: 0; }
.ws-loading { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); z-index: 5; }
.ws-side { min-width: 0; border-left: 1px solid var(--line); background: var(--surface); display: grid; grid-template-rows: auto minmax(0, 1fr); overflow: hidden; }
.ws[data-side=closed] .ws-side { border: 0; }
.side-tabs { display: flex; align-items: center; gap: 4px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.side-tabs .seg { flex: 1; }
.side-tabs .seg > button { flex: 1; justify-content: center; }
.side-body { min-height: 0; overflow: hidden; display: grid; }
.trigger { display: inline-flex; align-items: center; gap: 8px; min-height: 38px; padding: 0 12px 0 8px; border: 2px solid var(--line); border-radius: 12px; background: var(--raised); box-shadow: 0 2px 0 var(--shadow); cursor: pointer; font-weight: 750; white-space: nowrap; max-width: 320px; }
.trigger:hover { background: var(--sunken); }
.trigger[aria-expanded=true] { border-color: var(--blue-edge); }
.trigger .label { overflow: hidden; text-overflow: ellipsis; }
.trigger .sub { color: var(--muted); font-weight: 650; }
.trigger::after { content: ''; width: 6px; height: 6px; margin-left: 2px; flex: none; border: solid var(--muted); border-width: 0 2px 2px 0; transform: translateY(-2px) rotate(45deg); }
.trigger.no-caret::after { display: none; }

/* Threads */
.threads { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.thread-list { overflow: auto; padding: 8px; display: grid; align-content: start; gap: 4px; }
.thread-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 10px; border: 0; border-radius: 12px; background: none; text-align: left; cursor: pointer; color: var(--ink); }
.thread-row:hover { background: var(--sunken); }
.thread-row[aria-current=true] { background: var(--blue-soft); }
.thread-row .t { font-weight: 800; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-row .s { color: var(--muted); font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo { display: grid; grid-template-rows: auto minmax(0, 1fr) auto; min-height: 0; }
.convo-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); min-width: 0; }
.convo-head .title { flex: 1; min-width: 0; }
.convo-head .title b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convo-head .title span { display: block; color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.messages { overflow: auto; padding: 14px 14px 8px; display: flex; flex-direction: column; gap: 14px; overscroll-behavior: contain; }
.msg { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 10px; }
.msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 3px; }
.msg-head b { font-weight: 800; }
.msg-head time { color: var(--faint); font-size: 11.5px; font-weight: 650; }
.msg-body { color: var(--ink-2); font-weight: 560; white-space: pre-wrap; word-break: break-word; }
.msg.kind-human .msg-body { color: var(--ink); }
.msg.kind-tool { grid-template-columns: 28px minmax(0, 1fr); }
.msg.kind-tool .msg-body { font: 12px/1.45 ui-monospace, "SF Mono", Menlo, monospace; color: var(--muted); }
.msg.kind-system, .msg.kind-command { display: flex; justify-content: center; }
.msg.kind-system .pill, .msg.kind-command .pill { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; background: var(--sunken); color: var(--muted); font-size: 12.5px; font-weight: 750; }
.msg.kind-command .pill { background: var(--amber-soft); color: var(--amber); }
.msg-body code { font: 12px ui-monospace, Menlo, monospace; padding: 1px 5px; border-radius: 6px; background: var(--sunken); }
.msg-body a { word-break: break-all; }
.composer { padding: 10px 12px 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; background: var(--surface); }
.composer-box { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 6px; padding: 6px 6px 6px 12px; border: 2px solid var(--line); border-radius: 16px; background: var(--raised); }
.composer-box:focus-within { border-color: var(--blue-edge); }
.composer-box textarea { border: 0; outline: 0; background: none; resize: none; padding: 6px 0; max-height: 160px; min-height: 24px; }
.composer-tools { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { display: grid; place-items: center; align-content: center; gap: 10px; padding: 28px; text-align: center; color: var(--muted); }
.empty .h2 { color: var(--ink); }

/* Comments (document-style margin) */
.comments { display: grid; grid-template-rows: auto minmax(0, 1fr); min-height: 0; }
.cmt-list { overflow: auto; padding: 10px 12px 18px; display: grid; align-content: start; gap: 10px; }
.cmt { border: 2px solid var(--line); border-radius: var(--r); background: var(--raised); padding: 10px 12px; display: grid; gap: 8px; cursor: pointer; }
.cmt[aria-current=true] { border-color: var(--blue-edge); box-shadow: 0 0 0 3px var(--blue-soft); }
.cmt.is-resolved { opacity: .6; }
.cmt-head { display: flex; align-items: center; gap: 8px; }
.cmt-head .who { font-weight: 800; }
.cmt-head time { color: var(--faint); font-size: 11.5px; }
.cmt-head .grow { flex: 1; }
.cmt-anchor { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmt-body { white-space: pre-wrap; color: var(--ink-2); font-weight: 560; }
.cmt-reply { display: grid; grid-template-columns: 24px minmax(0, 1fr); gap: 8px; padding-top: 8px; border-top: 1px solid var(--line); }
.cmt-reply .avatar { width: 24px; height: 24px; font-size: 10px; }
.cmt-actions { display: flex; gap: 6px; }

/* Voice */
.voice-bar { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--blue-soft); color: var(--blue-ink); font-weight: 750; }
.voice-wave { display: inline-flex; gap: 3px; align-items: center; height: 18px; }
.voice-wave i { width: 3px; border-radius: 2px; background: currentColor; height: 30%; animation: wave 1s ease-in-out infinite; }
.voice-wave i:nth-child(2) { animation-delay: .15s; } .voice-wave i:nth-child(3) { animation-delay: .3s; } .voice-wave i:nth-child(4) { animation-delay: .45s; }
@keyframes wave { 50% { height: 100%; } }

/* Space switcher (Prod / people) */
.spaces { display: inline-flex; align-items: center; gap: 4px; padding: 3px; border-radius: 999px; background: var(--sunken); border: 1px solid var(--line); }
.space { display: inline-flex; align-items: center; gap: 7px; height: 32px; padding: 0 12px 0 3px; border: 0; border-radius: 999px; background: none; color: var(--muted); font-weight: 750; cursor: pointer; white-space: nowrap; }
.space .avatar { width: 26px; height: 26px; font-size: 11px; }
.space[aria-pressed=true] { background: var(--raised); color: var(--ink); box-shadow: 0 1px 0 var(--line-strong), 0 1px 3px rgb(10 35 79 / .08); }
.space:hover:not([aria-pressed=true]) { color: var(--ink); }

@media (max-width: 900px) {
  .ws { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) auto; }
  .ws-side { position: fixed; inset: auto 0 0 0; height: 62vh; border-left: 0; border-top: 1px solid var(--line); border-radius: 18px 18px 0 0; z-index: 30; box-shadow: 0 -20px 40px -20px rgb(10 35 79 / .35); }
  .ws[data-side=closed] .ws-side { display: none; }
}
