:root {
  color-scheme: light;
  --background: #ffffff;
  --foreground: #0a0a0a;
  --card: #ffffff;
  --primary: #171717;
  --primary-foreground: #fafafa;
  --secondary: #f5f5f5;
  --secondary-foreground: #171717;
  --muted: #f5f5f5;
  --muted-foreground: #737373;
  --accent: #f5f5f5;
  --accent-foreground: #171717;
  --destructive: #dc2626;
  --border: #e5e5e5;
  --input: #d4d4d4;
  --ring: #a3a3a3;
  --radius: 0.5rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 2px solid var(--ring);
  outline-offset: 2px;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--muted-foreground);
}

.error {
  min-height: 1.3rem;
  color: var(--destructive);
}

.eyebrow {
  margin: 0 0 0.25rem;
  color: var(--muted-foreground);
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
p {
  margin-top: 0;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
  font-weight: 600;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1.5rem;
  background: var(--muted);
}

.card {
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  background: var(--card);
}

.login-card {
  width: min(100%, 400px);
  padding: 2rem;
}

.login-card h1 {
  margin-bottom: 0.65rem;
  font-size: 1.5rem;
  letter-spacing: -0.025em;
}

.login-card label {
  display: block;
  margin: 1.5rem 0 0.5rem;
  font-size: 0.875rem;
  font-weight: 500;
}

.login-card input {
  width: 100%;
}

.login-card .primary {
  width: 100%;
  margin-top: 0.75rem;
}

.compat-note {
  margin: 0.75rem 0 0;
  color: var(--muted-foreground);
  font-size: 0.75rem;
  line-height: 1.5;
}

.brand-mark {
  width: 40px;
  height: 40px;
  margin-bottom: 1.25rem;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 700;
}

.brand-mark.small {
  width: 28px;
  height: 28px;
  margin: 0;
  border-radius: 6px;
  font-size: 0.75rem;
}

input,
select {
  min-height: 2.5rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  padding: 0.625rem 0.75rem;
}

input::placeholder {
  color: var(--muted-foreground);
}

input[type="checkbox"] {
  min-height: auto;
  accent-color: var(--primary);
}

button {
  border: 0;
}

.primary {
  min-height: 2.5rem;
  border-radius: var(--radius);
  padding: 0.625rem 1rem;
  background: var(--primary);
  color: var(--primary-foreground);
  font-weight: 500;
}

.primary:hover {
  background: #262626;
}

.ghost {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
}

.ghost:hover {
  background: var(--accent);
}

.app {
  min-height: 100vh;
  display: grid;
  grid-template-rows: 56px 1fr 80px;
}

.topbar {
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border);
  background: var(--background);
}

.brand,
.connection-state {
  display: flex;
  align-items: center;
  gap: 0.625rem;
}

.connection-state {
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.badge {
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.5rem;
  background: var(--secondary);
  color: var(--secondary-foreground);
  font-weight: 500;
}

.metric {
  padding-right: 0.625rem;
  border-right: 1px solid var(--border);
  font-variant-numeric: tabular-nums;
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--foreground);
}

.status-dot.offline {
  background: var(--destructive);
}

.workspace {
  min-height: 0;
  display: grid;
  grid-template-columns: 240px minmax(320px, 1fr) 260px;
}

.sidebar {
  min-height: 0;
  padding: 1rem;
  background: #fafafa;
  overflow: auto;
}

.channels-panel {
  border-right: 1px solid var(--border);
}

.users-panel {
  border-left: 1px solid var(--border);
}

.panel-heading,
.conversation-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.icon-button {
  width: 2rem;
  height: 2rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font-size: 1.125rem;
}

.icon-button:hover {
  background: var(--accent);
}

.compact-form {
  margin-bottom: 1rem;
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
}

.compact-form input[type="text"],
.compact-form > input {
  width: 100%;
}

.check {
  margin: 0.625rem 0;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.row {
  display: flex;
  gap: 0.5rem;
}

.small-button {
  min-height: 2rem;
  flex: 1;
  padding: 0.375rem 0.5rem;
  font-size: 0.75rem;
}

.channel-list,
.user-list {
  display: grid;
  gap: 0.25rem;
}

.channel {
  width: 100%;
  padding: 0.5rem 0.625rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius);
  background: transparent;
  color: var(--muted-foreground);
  text-align: left;
}

.channel:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.channel.active {
  background: var(--secondary);
  color: var(--secondary-foreground);
  font-weight: 500;
}

.channel-icon {
  opacity: 0.65;
  font-size: 0.75rem;
}

.channel-count {
  margin-left: auto;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: var(--background);
  color: var(--muted-foreground);
  font-size: 0.6875rem;
}

.count {
  min-width: 1.625rem;
  padding: 0.2rem 0.4rem;
  border-radius: 999px;
  background: var(--secondary);
  color: var(--muted-foreground);
  font-size: 0.75rem;
  text-align: center;
}

.user {
  padding: 0.5rem;
  display: grid;
  grid-template-columns: 30px 1fr auto;
  align-items: center;
  gap: 0.5rem;
  border-radius: var(--radius);
}

.user:hover {
  background: var(--accent);
}

.avatar {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--secondary);
  color: var(--secondary-foreground);
  font-size: 0.6875rem;
  font-weight: 600;
}

.avatar.speaking {
  outline: 2px solid var(--foreground);
  outline-offset: 2px;
}

.user-name {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 0.8125rem;
  font-weight: 500;
}

.user-meta {
  color: var(--muted-foreground);
  font-size: 0.6875rem;
}

.user-actions {
  display: flex;
  gap: 0.25rem;
}

.user-action {
  padding: 0.25rem;
  background: transparent;
  color: var(--muted-foreground);
  font-size: 0.6875rem;
}

.user-action:hover {
  color: var(--foreground);
}

.volume {
  width: 54px;
  min-height: auto;
  padding: 0;
  accent-color: var(--primary);
}

.conversation {
  min-height: 0;
  padding: 1.25rem;
  display: grid;
  grid-template-rows: auto 1fr auto;
  background: var(--background);
}

.conversation-heading {
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.conversation-heading .muted {
  margin: 0;
  font-size: 0.75rem;
}

.activity {
  min-height: 0;
  padding: 1rem 0.125rem;
  overflow: auto;
}

.event {
  margin: 0.625rem 0;
  display: flex;
  gap: 0.625rem;
  color: var(--muted-foreground);
  font-size: 0.8125rem;
  line-height: 1.5;
}

.event strong {
  color: var(--foreground);
  font-weight: 600;
}

.event.system {
  font-size: 0.75rem;
}

.event-time {
  flex: 0 0 auto;
  color: var(--muted-foreground);
  font-variant-numeric: tabular-nums;
}

.chat-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.5rem;
}

.voice-controls {
  padding: 0.75rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
  border-top: 1px solid var(--border);
  background: var(--background);
}

.control-group {
  display: grid;
  gap: 0.25rem;
}

.control-group label {
  color: var(--muted-foreground);
  font-size: 0.6875rem;
  font-weight: 500;
}

.control-group select {
  min-width: 145px;
  min-height: 2.25rem;
  padding: 0.45rem 0.625rem;
  font-size: 0.75rem;
}

.sensitivity-control {
  min-width: 155px;
}

.sensitivity-control label {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
}

.sensitivity-control output {
  color: var(--foreground);
  font-variant-numeric: tabular-nums;
}

.sensitivity-control input {
  width: 100%;
  min-height: auto;
  padding: 0;
  accent-color: var(--primary);
}

.ptt {
  min-width: 210px;
  height: 48px;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.625rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--foreground);
  font-weight: 500;
}

.ptt:hover {
  background: var(--accent);
}

.ptt.active {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
}

.mic-icon {
  font-size: 0.625rem;
}

kbd {
  margin-left: 0.125rem;
  padding: 0.125rem 0.3rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--muted);
  color: var(--muted-foreground);
  font-size: 0.625rem;
  font-weight: 400;
}

.ptt.active kbd {
  border-color: #525252;
  background: #262626;
  color: var(--primary-foreground);
}

.toggle-buttons {
  display: flex;
  gap: 0.375rem;
}

.toggle {
  min-width: 68px;
  padding: 0.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--background);
  color: var(--muted-foreground);
  font-size: 0.75rem;
}

.toggle:hover {
  background: var(--accent);
  color: var(--accent-foreground);
}

.toggle[aria-pressed="true"] {
  border-color: var(--primary);
  background: var(--primary);
  color: var(--primary-foreground);
}

.audio-meter {
  width: 62px;
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--muted);
}

.audio-meter span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--foreground);
  transition: width 80ms linear;
}

@media (max-width: 900px) {
  .workspace {
    grid-template-columns: 190px 1fr;
  }

  .users-panel {
    display: none;
  }

  .voice-controls {
    height: auto;
    flex-wrap: wrap;
  }

  .app {
    grid-template-rows: 56px 1fr auto;
  }

  .audio-meter {
    display: none;
  }
}

@media (max-width: 620px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .channels-panel {
    display: none;
  }

  .connection-state .badge,
  .metric {
    display: none;
  }

  .conversation {
    padding: 0.875rem;
  }

  .control-group {
    display: none;
  }

  .sensitivity-control {
    min-width: 120px;
    display: grid;
  }

  .ptt {
    min-width: 170px;
    flex: 1;
  }
}
