/* VVN Command Centre — view styles: assistant, PC control, agent team,
   activity and settings. Tokens and shared components live in base.css. */

/* ============================================================ assistant */
.view-assistant { max-width: 860px; display: flex; flex-direction: column; min-height: calc(100dvh - 64px); padding-bottom: 0; }
.assistant { flex: 1; display: flex; flex-direction: column; min-height: 0; min-width: 0; }
/* minmax(0, 1fr): without it a long unbroken action label sets the grid track's
   minimum width, and the whole conversation overflows a phone screen. */
.thread { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr); align-content: start; gap: 22px; min-width: 0; padding-bottom: 20px; }

.hero { display: grid; justify-items: center; gap: 14px; padding: 7vh 8px 24px; text-align: center; }
.hero-orb {
  position: relative; display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%;
  background: var(--grad); color: #fff; box-shadow: 0 20px 50px -12px rgba(79, 70, 229, 0.7);
}
.hero-orb .i { width: 36px; height: 36px; }
.hero-orb::after { content: ""; position: absolute; inset: -10px; border-radius: 50%; border: 1px solid rgba(129, 140, 248, 0.35); animation: orbit 3s ease-in-out infinite; }
@keyframes orbit { 50% { transform: scale(1.08); opacity: 0.4; } }
.hero h2 { font-size: 28px; letter-spacing: -0.025em; }
.hero p { max-width: 520px; color: var(--text-2); }
.hero .chips { max-width: 640px; margin-top: 8px; }

.exchange { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; }
.turn { display: flex; flex-direction: column; min-width: 0; }
.turn-user { align-items: flex-end; }
.turn-bot { align-items: flex-start; }
.bubble {
  max-width: min(560px, 85%); padding: 11px 16px; border-radius: 18px 18px 4px 18px;
  background: var(--grad); color: #fff; font-size: 15px; overflow-wrap: anywhere;
  box-shadow: 0 10px 26px -14px rgba(79, 70, 229, 0.8);
}
.turn-meta { display: flex; align-items: center; gap: 5px; margin-top: 5px; font-size: 11.5px; color: var(--text-3); }
.reply { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; min-width: 0; max-width: min(640px, 100%); padding: 14px 16px; border-radius: 18px 18px 18px 4px; }
.reply-head { display: flex; align-items: center; gap: 8px; }
.reply-text { font-size: 15px; }
.reply-pending { display: flex; align-items: center; gap: 12px; }
.reply-error { display: flex; align-items: center; gap: 10px; color: var(--err); background: var(--err-soft); border-color: transparent; }

.acts { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.act {
  display: grid; grid-template-columns: 26px minmax(0, 1fr) auto; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: var(--r-sm); background: var(--surface-2); border: 1px solid var(--border); font-size: 14px;
}
.act-ic { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: var(--surface-3); color: var(--text-2); }
.act-label { min-width: 0; overflow: hidden; font-weight: 550; text-overflow: ellipsis; white-space: nowrap; }
.act-msg { max-width: 240px; overflow: hidden; font-size: 12.5px; color: var(--text-3); text-overflow: ellipsis; white-space: nowrap; }
.act-done .act-ic { background: var(--ok-soft); color: var(--ok); }
.act-delivered .act-ic { background: var(--info-soft); color: var(--info); }
.act-failed .act-ic, .act-expired .act-ic { background: var(--err-soft); color: var(--err); }
.act-failed .act-msg, .act-expired .act-msg { color: var(--err); }
.act-skipped .act-ic { background: var(--warn-soft); color: var(--warn); }

.composer-wrap { position: sticky; bottom: 0; z-index: 5; padding: 14px 0 calc(22px + var(--safe-bottom)); background: linear-gradient(to top, var(--bg) 72%, transparent); }
.composer {
  display: flex; align-items: center; gap: 8px; padding: 8px; border-radius: 24px;
  background: var(--surface); border: 1px solid var(--border-2); box-shadow: var(--shadow-pop);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.composer:focus-within { border-color: var(--accent); box-shadow: var(--ring), var(--shadow-pop); }
.composer input { flex: 1; min-width: 0; min-height: 44px; padding: 0 8px; border: 0; background: transparent; box-shadow: none; font-size: 16px; }
.composer input:focus { background: transparent; box-shadow: none; }
.lang {
  flex: none; min-width: 46px; height: 38px; padding: 0 10px; border-radius: 14px; border: 1px solid var(--border-2);
  background: var(--surface-2); color: var(--text-2); font-size: 13px; font-weight: 700;
}
.lang:hover { color: var(--text); }
.mic, .send { display: grid; place-items: center; flex: none; width: 46px; height: 46px; border: 0; border-radius: 50%; transition: transform 0.12s, background-color 0.2s; }
.mic { background: var(--grad); color: #fff; box-shadow: 0 10px 24px -10px rgba(79, 70, 229, 0.9); }
.mic:active { transform: scale(0.94); }
.mic.listening { background: #ef4444; animation: mic-pulse 1.3s infinite; }
@keyframes mic-pulse {
  0% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.55); }
  70% { box-shadow: 0 0 0 16px rgba(239, 68, 68, 0); }
  100% { box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}
.send { background: var(--surface-3); color: var(--text-2); }
.send:hover { color: var(--text); }
.listening-hint { display: flex; align-items: center; justify-content: center; gap: 10px; margin-bottom: 10px; font-size: 13px; font-weight: 600; color: #ef4444; }
.wave { display: inline-flex; align-items: center; gap: 3px; height: 18px; }
.wave i { width: 3px; height: 8px; border-radius: 2px; background: currentColor; animation: wave 0.9s ease-in-out infinite; }
.wave i:nth-child(2) { animation-delay: 0.1s; }
.wave i:nth-child(3) { animation-delay: 0.2s; }
.wave i:nth-child(4) { animation-delay: 0.3s; }
.wave i:nth-child(5) { animation-delay: 0.4s; }
@keyframes wave { 50% { transform: scaleY(2); } }

@media (max-width: 959px) {
  .view-assistant { min-height: calc(100dvh - 58px - var(--safe-top)); padding-bottom: 0; }
  .composer-wrap { bottom: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: 12px; }
  .hero { padding-top: 4vh; }
  .hero h2 { font-size: 24px; }
}
@media (max-width: 600px) {
  .act { grid-template-columns: 26px minmax(0, 1fr); }
  .act-label { white-space: normal; overflow-wrap: anywhere; }
  .act-msg { grid-column: 2; max-width: none; white-space: normal; }
  .bubble { max-width: 88%; }
  .lang { min-width: 40px; padding: 0 8px; }
}

/* =========================================================== PC control */
.stack { display: grid; gap: 18px; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
@media (max-width: 860px) { .grid-2 { grid-template-columns: minmax(0, 1fr); } }

.hero-device { position: relative; overflow: hidden; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: 22px; }
.hero-device::before { content: ""; position: absolute; inset: 0; pointer-events: none; background: radial-gradient(640px 220px at 0% 0%, rgba(99, 102, 241, 0.16), transparent 70%); }
.hero-device.is-offline::before { background: radial-gradient(640px 220px at 0% 0%, rgba(148, 163, 184, 0.08), transparent 70%); }
.hero-device-main { position: relative; display: flex; align-items: center; gap: 16px; min-width: 0; }
.hero-device-icon { display: grid; place-items: center; flex: none; width: 56px; height: 56px; border-radius: 16px; background: var(--accent-soft); color: var(--accent); }
.hero-device-icon .i { width: 28px; height: 28px; }
.is-offline .hero-device-icon { background: var(--surface-3); color: var(--text-3); }
.hero-device-name { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.hero-device-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 13.5px; color: var(--text-2); }
.hero-stats { position: relative; display: flex; flex-wrap: wrap; gap: 10px; }
.stat { display: grid; gap: 2px; min-width: 104px; padding: 10px 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.stat-label { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.stat-value { font-size: 15px; font-weight: 650; font-variant-numeric: tabular-nums; white-space: nowrap; }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(100px, 1fr)); gap: 10px; }
.tile {
  display: grid; justify-items: center; gap: 8px; padding: 14px 8px 12px; border-radius: var(--r);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text);
  font-size: 12.5px; font-weight: 600; text-align: center; line-height: 1.25;
  transition: transform 0.12s, border-color 0.15s, background-color 0.15s;
}
.tile:hover { border-color: var(--border-2); background: var(--surface-3); }
.tile:active { transform: scale(0.97); }
.tile:disabled { opacity: 0.5; cursor: not-allowed; }
.tile-ic { --c: var(--accent); display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; background: color-mix(in srgb, var(--c) 17%, transparent); color: var(--c); }
.tile-ic .i { width: 22px; height: 22px; }
.c-blue { --c: #4f8cff; } .c-sky { --c: #22b8e8; } .c-green { --c: #22c55e; } .c-red { --c: #ff4d4f; }
.c-amber { --c: #f5a524; } .c-pink { --c: #ec4899; } .c-orange { --c: #fb923c; } .c-slate { --c: #94a3b8; } .c-violet { --c: #8b5cf6; }

.media-row { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 4px 0 18px; }
.media-btn { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); transition: transform 0.12s, background-color 0.15s; }
.media-btn:hover { background: var(--surface-3); }
.media-btn:active { transform: scale(0.94); }
.media-btn.big { width: 72px; height: 72px; border: 0; background: var(--grad); color: #fff; box-shadow: 0 14px 30px -12px rgba(79, 70, 229, 0.85); }
.media-btn.big .i { width: 28px; height: 28px; }
.vol-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 12px; }
.vol-row .btn { height: 48px; }
.section-note { margin-top: 10px; font-size: 12.5px; color: var(--text-3); }
.inline-form .input-row input { min-height: 46px; }

/* =========================================================== agent team */
.team { display: grid; gap: 18px; }
.team-intro { display: flex; align-items: center; gap: 16px; }
.team-intro-ic { display: grid; place-items: center; flex: none; width: 48px; height: 48px; border-radius: 14px; background: var(--accent-soft); color: var(--accent); }
.team-intro h3 { margin-bottom: 3px; font-size: 16px; }
.brief-form { display: grid; gap: 12px; }
.brief-form textarea { min-height: 110px; font-size: 15px; }
.brief-form-foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; }
.team-grid { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 18px; align-items: start; }
@media (max-width: 960px) { .team-grid { grid-template-columns: minmax(0, 1fr); } }

.brief-list { display: grid; gap: 4px; max-height: 70vh; overflow-y: auto; padding: 8px; }
.list-head { padding: 10px 10px 6px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.brief-item { display: grid; gap: 6px; width: 100%; padding: 12px; border: 1px solid transparent; border-radius: var(--r-sm); background: transparent; color: var(--text); text-align: left; }
.brief-item:hover { background: var(--hover); }
.brief-item.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 35%, transparent); }
.brief-item-text { display: -webkit-box; overflow: hidden; font-size: 14px; font-weight: 550; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.brief-item-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }

.brief-view { display: grid; align-content: start; gap: 16px; min-height: 320px; padding: 22px; }
.brief-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.brief-prompt { margin: 8px 0 4px; font-size: 17px; line-height: 1.4; overflow-wrap: anywhere; }
.brief-actions { display: flex; flex: none; gap: 8px; }
.worklog { border: 1px solid var(--border); border-radius: var(--r); background: var(--surface-2); }
.worklog summary { display: flex; align-items: center; gap: 8px; padding: 11px 14px; font-size: 13.5px; font-weight: 600; list-style: none; cursor: pointer; }
.worklog summary::-webkit-details-marker { display: none; }
.log { display: grid; gap: 2px; max-height: 340px; overflow-y: auto; margin: 0; padding: 2px 14px 12px; list-style: none; }
.log-row { display: grid; grid-template-columns: 18px minmax(0, 1fr); gap: 10px; padding: 5px 0; font-size: 13px; color: var(--text-2); overflow-wrap: anywhere; }
.log-row .i { margin-top: 2px; color: var(--text-3); }
.log-tool .i { color: var(--info); }
.log-status .i { color: var(--ok); }
.log-text { color: var(--text); }
.log-agent { color: var(--text-3); }
.log-live { color: var(--info); font-weight: 600; }
@media (max-width: 600px) {
  .brief-head { flex-direction: column; }
  .brief-view { padding: 16px; }
}

/* ============================================================= activity */
.activity { display: grid; gap: 10px; max-width: 860px; }
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 4px; }
.day { margin: 18px 0 4px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.day:first-child { margin-top: 0; }
.timeline { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.tl-item { display: grid; grid-template-columns: 76px minmax(0, 1fr); gap: 14px; padding: 14px 16px; border-radius: var(--r); background: var(--surface); border: 1px solid var(--border); }
.tl-time { padding-top: 2px; font-size: 12.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.tl-body { display: grid; gap: 8px; min-width: 0; }
.tl-text { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-weight: 550; overflow-wrap: anywhere; }
.acts-compact .act { padding: 6px 10px; background: transparent; }
@media (max-width: 600px) { .tl-item { grid-template-columns: minmax(0, 1fr); gap: 6px; } }

/* ============================================================= settings */
.settings { display: grid; gap: 18px; max-width: 900px; }
.device-list { display: grid; gap: 10px; }
.device-row { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r); background: var(--surface-2); border: 1px solid var(--border); }
.device-row-ic { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px; background: var(--surface-3); color: var(--text-2); }
.device-row.is-online .device-row-ic { background: var(--ok-soft); color: var(--ok); }
.device-row-name { font-weight: 650; overflow-wrap: anywhere; }
.device-row-sub { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--text-3); }
.pair-form { display: flex; gap: 10px; flex-wrap: wrap; }
.pair-form input { flex: 1; min-width: 180px; }
.pair-box { display: grid; gap: 14px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.pair-code { padding: 14px; border-radius: var(--r); background: var(--bg-2); border: 1px dashed var(--border-2); font-family: var(--mono); font-size: clamp(28px, 7vw, 40px); font-weight: 700; letter-spacing: 0.14em; text-align: center; }
.howto { display: grid; gap: 6px; margin: 0; padding-left: 20px; font-size: 14px; color: var(--text-2); }
.pref { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--border); }
.pref:first-child { padding-top: 0; }
.pref:last-child { padding-bottom: 0; border-bottom: 0; }
.pref-text { min-width: 0; }
.pref-text b { display: block; font-weight: 600; }
.pref-text span { font-size: 13px; color: var(--text-3); }
.segmented { display: inline-flex; flex: none; padding: 3px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--border); }
.segmented button { height: 32px; padding: 0 14px; border: 0; border-radius: 9px; background: transparent; color: var(--text-2); font-size: 13px; font-weight: 600; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25); }
.switch { position: relative; flex: none; width: 46px; height: 28px; border: 0; border-radius: 999px; background: var(--surface-3); transition: background-color 0.2s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 22px; height: 22px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.2s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { transform: translateX(18px); }
@media (max-width: 600px) {
  .device-row { grid-template-columns: 44px minmax(0, 1fr); }
  .device-row > .btn { grid-column: 1 / -1; }
  .pref { flex-wrap: wrap; }
}
