/* GuildNet console (A3, sidebar). Colours, type and radii come from
   tokens.css; this file is layout and components only. */

body { font-size: 15px; line-height: 1.5; }
h1 { font-size: 30px; line-height: 1.15; letter-spacing: -.5px; margin: 0; }
h2 { font-size: 19px; line-height: 1.25; margin: 0; }
p { margin: 0; }

/* Frame: sidebar, page, and an optional panel on the right. */
.app { display: grid; grid-template-columns: 248px minmax(0, 1fr) auto; min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; background: var(--rail); border-right: 1px solid var(--line); padding: 20px 14px; display: flex; flex-direction: column; gap: 4px; }
.sidebar .network { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 18px; padding: 0 8px 16px; overflow-wrap: anywhere; }
.sidebar .hire { height: 42px; margin-bottom: 14px; }
.sidebar > a:not(.button) { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius); color: var(--muted); text-decoration: none; }
.sidebar > a:not(.button):hover { background: var(--selected); color: var(--text); }
.sidebar > a.here { background: var(--tonal); color: var(--on-tonal); font-weight: 600; }
.sidebar .count { margin-left: auto; }
.me { margin-top: auto; display: flex; align-items: center; gap: 10px; padding: 8px 4px 0 6px; color: var(--muted); }
.me .who { display: flex; flex-direction: column; flex-grow: 1; min-width: 0; font-size: 14px; line-height: 1.3; overflow-wrap: anywhere; }
.me .who form { margin: 0; }
.me .who button.link { font-size: 13px; color: var(--faint); }

main { padding: 30px 32px 48px; display: flex; flex-direction: column; gap: 20px; max-width: 1100px; }

/* Avatars are rounded squares; agents' are tonal. */
.avatar { width: 38px; height: 38px; border-radius: var(--radius); background: var(--selected); color: var(--text); display: inline-flex; align-items: center; justify-content: center; font-weight: 700; flex-shrink: 0; }
.avatar.agent { background: var(--tonal); color: var(--on-tonal); }
.me .avatar { width: 32px; height: 32px; }
.avatar.big { width: 56px; height: 56px; font-size: 24px; border-radius: var(--radius-card); }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-card); padding: 20px; display: flex; flex-direction: column; gap: 14px; }

/* Lanes and the people in them. */
.lanes { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.lane header { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.lane .channel { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--faint); }
.people { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.people li { display: flex; align-items: center; gap: 12px; }
.people .name { font-weight: 500; }
.people .name a { color: var(--text); text-decoration: none; }
.people .name a:hover { color: var(--accent); text-decoration: underline; }
.people .role { color: var(--faint); font-size: 14px; }
.people .amount { margin-left: auto; font-family: var(--mono); font-size: 13px; color: var(--muted); }

/* Forms. */
.fields { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; align-items: end; }
.fields .wide { grid-column: 1 / -1; }
.fields button { justify-self: start; }
.danger-zone { border-color: var(--danger); flex-direction: row; align-items: end; flex-wrap: wrap; }
.danger-zone label { flex-grow: 1; }
.profile { display: flex; align-items: center; gap: 16px; }
.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 20px; margin: 0; }
.facts dt { color: var(--faint); }
.facts dd { margin: 0; }

/* Approvals: tonal banners with the decision right there. */
.waiting { width: 320px; background: var(--rail); border-left: 1px solid var(--line); padding: 28px 20px; display: flex; flex-direction: column; gap: 14px; }
.waiting h2 { font-size: 16px; }
.waiting > a { font-size: 14px; }
.banner { background: var(--tonal); color: var(--on-tonal); border-radius: var(--radius-card); padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; line-height: 1.45; }
.banner .small { font-size: 13px; opacity: .85; }
.banner .badge.ai { vertical-align: 1px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.actions form { margin: 0; display: flex; gap: 8px; }
.banner button { height: 36px; }
.banner button.outline { border-color: var(--on-tonal); color: var(--on-tonal); }
.deny input { height: 36px; min-width: 240px; }

/* Signed out: one card in the middle. */
.bare { display: flex; align-items: center; justify-content: space-between; padding: 20px clamp(16px, 5vw, 48px); }
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 20px; }
main.narrow { max-width: 440px; margin: 8vh auto; padding: 0 16px; }
.signin form { display: flex; flex-direction: column; gap: 14px; }
.signin h1 { font-size: 26px; }

@media (max-width: 1100px) {
  .app { grid-template-columns: 220px minmax(0, 1fr); }
  .waiting { grid-column: 2; width: auto; border-left: 0; border-top: 1px solid var(--line); background: transparent; padding: 0 32px 32px; }
}

@media (max-width: 760px) {
  .app { display: flex; flex-direction: column; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; gap: 4px 6px; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--line); }
  .sidebar .network { padding: 0 8px 0 0; }
  .sidebar .hire { order: 4; width: 100%; margin: 6px 0 0; height: 40px; }
  .sidebar > a:not(.button) { order: 3; gap: 6px; padding: 6px 8px; font-size: 14px; }
  .sidebar > a:not(.button) svg { display: none; }
  .me { order: 1; margin: 0 0 0 auto; padding: 0; }
  .me .avatar { display: none; }
  .me .who { flex-direction: row; align-items: center; gap: 10px; }
  .waiting { padding: 16px 16px 0; }
  main { order: 1; padding: 20px 16px 40px; }
  .lanes { grid-template-columns: 1fr; }
  .deny input { min-width: 0; flex-grow: 1; }
  h1 { font-size: 26px; }
}

/* Chat, docked beside every console page so it stays connected as you move
   between them: a column on the right where there's room, a panel over the
   page where there isn't, and a sheet from the bottom on a phone. Hidden, a
   button brings it back. The Chat page widens it to fill the page. The
   page's own parts sit directly in the .app grid (#page is only a wrapper
   for swapping). */
#page { display: contents; }
.app.with-chat { grid-template-columns: 248px minmax(0, 1fr) auto auto; }
.chat-dock { grid-column: -2; grid-row: 1; position: sticky; top: 0; height: 100vh; width: 400px; display: flex; flex-direction: column; background: var(--bg); border-left: 1px solid var(--line); z-index: 5; }
.chat-dock-bar { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--rail); }
.chat-dock-bar .title { display: flex; align-items: center; gap: 8px; font-weight: 700; }
.chat-app { display: block; width: 100%; flex: 1; min-height: 0; border: 0; background: var(--bg); }
.chat-open { display: none; position: fixed; right: 20px; bottom: 20px; z-index: 6; box-shadow: var(--shadow); border-radius: 999px; }
:root[data-chat="hidden"] .chat-dock { display: none; }
:root[data-chat="hidden"] .chat-open { display: inline-flex; }
.chat-missing { padding: 30px 32px; display: flex; flex-direction: column; gap: 12px; }

/* The Chat page: the dock fills the page, whether or not it's hidden. */
#page[data-chat="wide"] > main { display: none; }
.app:has(#page[data-chat="wide"]) .chat-dock { display: flex; grid-column: 2 / -1; width: auto; border-left: 0; }
.app:has(#page[data-chat="wide"]) .chat-dock-bar,
.app:has(#page[data-chat="wide"]) .chat-open { display: none; }

@media (max-width: 1100px) {
  .app.with-chat { grid-template-columns: 220px minmax(0, 1fr); }
  .chat-dock { position: fixed; top: 0; right: 0; bottom: 0; height: auto; width: min(400px, 92vw); box-shadow: var(--shadow); }
  .app:has(#page[data-chat="wide"]) .chat-dock { position: sticky; height: 100vh; width: auto; box-shadow: none; }
}
@media (max-width: 760px) {
  .chat-dock { top: auto; left: 0; width: auto; height: 70vh; border-left: 0; border-top: 1px solid var(--line); }
  .app:has(#page[data-chat="wide"]) { height: 100dvh; }
  .app:has(#page[data-chat="wide"]) .chat-dock { position: static; order: 2; flex: 1; height: auto; min-height: 0; }
}

/* The home page for people signed in with Google: their networks, and
   creating one. */
main.home { max-width: 720px; margin: 4vh auto 48px; padding: 0 16px; }
.bare .brand { color: var(--text); text-decoration: none; }
.bare .actions form { margin: 0; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.small { font-size: 13px; }
.button.google, .button.create, button.create { align-self: flex-start; }
.network-card { flex-direction: row; align-items: center; flex-wrap: wrap; gap: 6px 14px; color: var(--text); text-decoration: none; }
.network-card:hover { border-color: var(--accent); color: var(--text); }
.network-name { font-weight: 700; font-size: 18px; }
.status { margin-left: auto; font-size: 13px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: var(--selected); }
.status-ready { background: var(--tonal); color: var(--on-tonal); }
.status-failed { background: var(--danger-soft); color: var(--on-danger-soft); }
.create-network { display: flex; flex-direction: column; gap: 16px; }
.address { flex-direction: row; align-items: center; gap: 0; }
.address input { flex-grow: 1; min-width: 0; border-radius: var(--radius) 0 0 var(--radius); font-family: var(--mono); }
.address .suffix { height: 44px; display: inline-flex; align-items: center; padding: 0 12px; border: 1px solid var(--line); border-left: 0; border-radius: 0 var(--radius) var(--radius) 0; background: var(--rail); font-family: var(--mono); font-size: 14px; color: var(--muted); }
.templates { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.template { position: relative; border: 1px solid var(--line); border-radius: var(--radius-card); padding: 14px 14px 14px 42px; gap: 4px; color: var(--text); font-size: 14px; cursor: pointer; }
.template input { position: absolute; left: 14px; top: 14px; height: auto; margin: 2px 0 0; accent-color: var(--accent); }
.template .title { font-weight: 700; font-size: 15px; }
.template:has(input:checked) { border-color: var(--accent); background: var(--tonal); color: var(--on-tonal); }
.template:has(input:checked) .muted { color: inherit; opacity: .85; }
.template:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 2px; }
.setup.ready { border-color: var(--accent); }
.setup.failed { border-color: var(--danger); }
@media (max-width: 520px) {
  .bare .actions .muted { display: none; }
  .status { margin-left: 0; }
}
