:root {
  color-scheme: light;
  --bg: #f5f6f8;
  --surface: #ffffff;
  --surface-muted: #f7f8fa;
  --text: #1f2329;
  --text-secondary: #646a73;
  --text-tertiary: #8f959e;
  --line: #e5e6eb;
  --line-strong: #d8dadd;
  --accent: #3370ff;
  --accent-hover: #245bdb;
  --accent-soft: #edf3ff;
  --green: #2f9e66;
  --green-soft: #eaf7f0;
  --amber: #c17c18;
  --amber-soft: #fff6e6;
  --radius: 14px;
  --shadow: 0 18px 50px rgba(31, 35, 41, 0.11);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "PingFang SC", "Microsoft YaHei", sans-serif;
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  min-height: 100dvh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at 12% -5%, rgba(51, 112, 255, 0.08), transparent 28rem),
    var(--bg);
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid rgba(51, 112, 255, 0.22);
  outline-offset: 2px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 68px;
  padding: 10px max(24px, calc((100vw - 1160px) / 2));
  border-bottom: 1px solid rgba(229, 230, 235, 0.85);
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
}

.brand-mark {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border-radius: 11px;
  color: #fff;
  background: var(--accent);
  box-shadow: 0 6px 15px rgba(51, 112, 255, 0.25);
  font-size: 17px;
  font-weight: 700;
}

.brand > span:last-child {
  display: grid;
  gap: 1px;
}

.brand strong {
  font-size: 16px;
  letter-spacing: -0.02em;
}

.brand small {
  color: var(--text-tertiary);
  font-size: 11px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.viewer-switch {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--text-secondary);
  font-size: 12px;
}

.viewer-switch select {
  height: 34px;
  padding: 0 28px 0 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface);
}

.integration-badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  color: var(--text-secondary);
  background: var(--surface-muted);
  font-size: 12px;
  white-space: nowrap;
}

.integration-badge.live {
  color: #237a4b;
  background: var(--green-soft);
}

.text-button {
  padding: 6px 4px;
  border: 0;
  color: var(--text-secondary);
  background: transparent;
  font-size: 12px;
}

.text-button:hover {
  color: var(--text);
}

.main-content {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
  padding: 52px 0 64px;
}

.hero-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: end;
  gap: 48px;
  margin-bottom: 30px;
}

.eyebrow {
  margin: 0 0 9px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.08em;
}

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

h1 {
  max-width: 720px;
  margin-bottom: 12px;
  font-size: clamp(36px, 4vw, 50px);
  line-height: 1.08;
  letter-spacing: -0.055em;
}

.hero-copy {
  max-width: 620px;
  margin-bottom: 0;
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.7;
}

.my-presence {
  width: 330px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.82);
}

.my-presence > span {
  display: block;
  margin: 0 0 9px 2px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.my-presence small {
  display: block;
  margin: 9px 2px 0;
  color: var(--text-tertiary);
  font-size: 11px;
  line-height: 1.45;
}

.presence-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  border-radius: 10px;
  background: #eef0f3;
}

.presence-control button {
  min-height: 34px;
  border: 0;
  border-radius: 7px;
  color: var(--text-secondary);
  background: transparent;
  font-size: 13px;
}

.presence-control button.active {
  color: var(--text);
  background: var(--surface);
  box-shadow: 0 1px 5px rgba(31, 35, 41, 0.1);
  font-weight: 600;
}

.incoming-zone:empty {
  display: none;
}

.incoming-zone {
  display: grid;
  gap: 10px;
  margin-bottom: 18px;
}

.incoming-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border: 1px solid #bad0ff;
  border-radius: var(--radius);
  background: linear-gradient(110deg, #edf3ff 0%, #f8faff 72%);
  box-shadow: 0 8px 28px rgba(51, 112, 255, 0.08);
}

.incoming-copy strong {
  display: block;
  margin-bottom: 3px;
  font-size: 14px;
}

.incoming-copy p {
  margin: 0;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.5;
}

.incoming-actions {
  display: flex;
  gap: 8px;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  align-items: start;
  gap: 18px;
}

.directory,
.rail-section {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.directory {
  min-width: 0;
  overflow: hidden;
}

.directory-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 20px 22px 12px;
}

.directory-toolbar h2,
.rail-heading h2 {
  margin-bottom: 4px;
  font-size: 15px;
  letter-spacing: -0.015em;
}

.directory-toolbar p {
  margin-bottom: 0;
  color: var(--text-tertiary);
  font-size: 12px;
}

.search-box input {
  width: 210px;
  height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 9px;
  color: var(--text);
  background: var(--surface-muted);
}

.search-box input::placeholder {
  color: #9aa0a9;
}

.search-box input:focus {
  border-color: #9cb9ff;
  background: #fff;
}

.filter-row {
  display: flex;
  gap: 6px;
  padding: 0 22px 13px;
  border-bottom: 1px solid var(--line);
}

.filter-row button {
  min-height: 30px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  color: var(--text-secondary);
  background: transparent;
  font-size: 12px;
}

.filter-row button:hover,
.filter-row button.active {
  color: var(--accent);
  background: var(--accent-soft);
}

.member-list {
  min-height: 260px;
}

.member-row {
  display: grid;
  grid-template-columns: auto minmax(170px, 0.9fr) minmax(180px, 1.3fr) auto;
  align-items: center;
  gap: 13px;
  min-height: 76px;
  padding: 12px 22px;
  border-bottom: 1px solid #f0f1f3;
  transition: background 160ms ease;
}

.member-row:last-child {
  border-bottom: 0;
}

.member-row:hover {
  background: #fafbfc;
}

.avatar {
  position: relative;
  display: grid;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  border-radius: 50%;
  color: #315cbe;
  background: #eaf0ff;
  font-size: 13px;
  font-weight: 700;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.small {
  width: 34px;
  height: 34px;
  font-size: 11px;
}

.avatar::after {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 9px;
  height: 9px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: #b5bac2;
  content: "";
}

.avatar.available::after {
  background: var(--green);
}

.avatar.busy::after {
  background: var(--amber);
}

.member-name {
  min-width: 0;
}

.member-name strong {
  display: block;
  overflow: hidden;
  margin-bottom: 4px;
  font-size: 14px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.member-name span {
  color: var(--text-tertiary);
  font-size: 11px;
}

.status-copy {
  min-width: 0;
}

.status-line {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 3px;
}

.status-label {
  display: inline-flex;
  align-items: center;
  min-height: 23px;
  padding: 0 8px;
  border-radius: 999px;
  color: var(--text-secondary);
  background: #f0f1f3;
  font-size: 11px;
  font-weight: 600;
}

.status-label.available {
  color: #237a4b;
  background: var(--green-soft);
}

.status-label.busy {
  color: #8a5a15;
  background: var(--amber-soft);
}

.status-note {
  overflow: hidden;
  color: var(--text-tertiary);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.knock-button,
.primary-button,
.secondary-button,
.quiet-button {
  min-height: 36px;
  padding: 0 14px;
  border-radius: 9px;
  font-weight: 600;
  white-space: nowrap;
  transition: transform 100ms ease, background 140ms ease, border-color 140ms ease;
}

.knock-button,
.secondary-button,
.quiet-button {
  border: 1px solid var(--line-strong);
  color: var(--text);
  background: var(--surface);
}

.knock-button:hover,
.secondary-button:hover,
.quiet-button:hover {
  border-color: #a8bded;
  color: var(--accent);
  background: #f7faff;
}

.knock-button:active,
.primary-button:active,
.secondary-button:active,
.quiet-button:active {
  transform: scale(0.98);
}

.knock-button[disabled] {
  cursor: not-allowed;
  opacity: 0.55;
}

.primary-button {
  border: 1px solid var(--accent);
  color: #fff;
  background: var(--accent);
}

.primary-button:hover {
  border-color: var(--accent-hover);
  background: var(--accent-hover);
}

.quiet-button {
  min-height: 34px;
  padding: 0 11px;
  color: var(--text-secondary);
  font-size: 12px;
}

.side-rail {
  display: grid;
  gap: 14px;
}

.rail-section {
  overflow: hidden;
}

.rail-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 17px 18px 12px;
}

.rail-heading h2 {
  margin: 0;
}

.rail-heading span {
  display: grid;
  min-width: 22px;
  height: 22px;
  place-items: center;
  border-radius: 999px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 700;
}

.rail-list {
  padding: 0 12px 12px;
}

.rail-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 10px;
  padding: 11px 6px;
  border-top: 1px solid #f0f1f3;
}

.rail-item-copy {
  min-width: 0;
}

.rail-item-copy strong {
  display: block;
  margin-bottom: 2px;
  font-size: 13px;
}

.rail-item-copy p {
  overflow: hidden;
  margin-bottom: 5px;
  color: var(--text-secondary);
  font-size: 11px;
  line-height: 1.45;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rail-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  color: var(--text-tertiary);
  font-size: 10px;
}

.rail-action {
  padding: 3px 0;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-size: 11px;
}

.empty-state {
  padding: 24px 10px 28px;
  color: var(--text-tertiary);
  text-align: center;
  font-size: 12px;
  line-height: 1.6;
}

.member-list .empty-state {
  padding: 52px 20px;
}

.skeleton-row {
  height: 76px;
  border-bottom: 1px solid #f0f1f3;
  background: linear-gradient(90deg, #fff 0%, #f6f7f9 40%, #fff 75%);
  background-size: 220% 100%;
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  to { background-position: -220% 0; }
}

.knock-dialog {
  width: min(520px, calc(100% - 28px));
  max-height: calc(100dvh - 28px);
  padding: 0;
  overflow: visible;
  border: 0;
  border-radius: 18px;
  background: transparent;
  box-shadow: var(--shadow);
}

.knock-dialog::backdrop {
  background: rgba(31, 35, 41, 0.35);
  backdrop-filter: blur(3px);
}

.dialog-card {
  position: relative;
  max-height: calc(100dvh - 28px);
  padding: 28px;
  overflow-y: auto;
  border-radius: 18px;
  background: var(--surface);
}

.dialog-close {
  position: absolute;
  top: 17px;
  right: 18px;
  padding: 5px;
  border: 0;
  color: var(--text-tertiary);
  background: transparent;
  font-size: 12px;
}

.dialog-person {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 18px;
  padding-right: 60px;
  font-size: 13px;
  font-weight: 600;
}

.dialog-card h2 {
  margin-bottom: 7px;
  font-size: 24px;
  letter-spacing: -0.035em;
}

.dialog-card > p {
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 13px;
  line-height: 1.6;
}

.message-options {
  display: grid;
  gap: 8px;
}

.message-options label {
  display: block;
  cursor: pointer;
}

.message-options input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.message-options span {
  display: flex;
  min-height: 44px;
  align-items: center;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text-secondary);
  background: var(--surface);
  font-size: 13px;
}

.message-options input:checked + span {
  border-color: #99b6ff;
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

.custom-message {
  display: grid;
  gap: 7px;
  margin-top: 17px;
}

.custom-message span {
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.custom-message input {
  width: 100%;
  height: 43px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  background: #fafbfc;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 24px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: max(24px, env(safe-area-inset-bottom));
  z-index: 40;
  max-width: min(440px, calc(100% - 28px));
  padding: 11px 15px;
  border-radius: 10px;
  color: #fff;
  background: rgba(31, 35, 41, 0.94);
  box-shadow: 0 8px 30px rgba(31, 35, 41, 0.2);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 12px);
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (max-width: 900px) {
  .main-content {
    width: min(100% - 32px, 760px);
    padding-top: 36px;
  }

  .hero-row {
    grid-template-columns: 1fr;
    align-items: start;
    gap: 24px;
  }

  .my-presence {
    width: 100%;
  }

  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .side-rail {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .topbar {
    min-height: 62px;
    padding: 9px 16px;
  }

  .brand small,
  .viewer-switch > span,
  .integration-badge,
  #reset-demo {
    display: none;
  }

  .viewer-switch select {
    max-width: 118px;
  }

  .main-content {
    width: min(100% - 24px, 560px);
    padding: 28px 0 40px;
  }

  h1 {
    font-size: 36px;
  }

  .hero-copy {
    max-width: 34ch;
    font-size: 14px;
  }

  .incoming-card {
    grid-template-columns: auto minmax(0, 1fr);
  }

  .incoming-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .incoming-actions .primary-button {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  .directory-toolbar {
    display: grid;
    gap: 14px;
    padding: 18px 16px 12px;
  }

  .search-box input {
    width: 100%;
  }

  .filter-row {
    padding: 0 16px 12px;
  }

  .member-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 11px;
    min-height: 82px;
    padding: 13px 16px;
  }

  .status-copy {
    grid-column: 2;
  }

  .status-line {
    margin-top: -8px;
  }

  .member-row .knock-button {
    grid-column: 3;
    grid-row: 1 / span 2;
    min-height: 34px;
    padding: 0 11px;
    font-size: 12px;
  }

  .side-rail {
    grid-template-columns: 1fr;
  }

  .dialog-card {
    padding: 24px 18px 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
/* Author styles such as `.viewer-switch { display: flex }` must never override
   the native hidden state. Production authentication relies on this to keep
   development-only identity controls out of the real Feishu app. */
[hidden] {
  display: none !important;
}
