:root {
  color-scheme: light;
  --page: #f3f4f1;
  --surface: #ffffff;
  --surface-muted: #f7f8f6;
  --ink: #171916;
  --ink-soft: #59605a;
  --ink-faint: #858c85;
  --line: #dfe3de;
  --line-strong: #c8cec7;
  --green: #1f7a4c;
  --green-dark: #155f3a;
  --green-soft: #eaf5ee;
  --blue: #225ea8;
  --blue-soft: #eaf1fa;
  --amber: #8b5700;
  --amber-soft: #fff3d6;
  --red: #aa3028;
  --red-soft: #fcebea;
  --shadow: 0 10px 30px rgba(28, 35, 29, 0.08);
  --radius: 8px;
  --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

body {
  background: var(--page);
  color: var(--ink);
  font-family: var(--font);
  font-size: 14px;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
}

button,
input,
textarea,
select {
  font: inherit;
  letter-spacing: 0;
}

button,
label {
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid rgba(34, 94, 168, 0.28);
  outline-offset: 1px;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

.topbar {
  height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 0 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.brand,
.topbar-actions,
.topbar-status,
.topbar-commands,
.button-row,
.section-actions {
  display: flex;
  align-items: center;
}

.brand {
  min-width: 0;
  gap: 12px;
}

.brand-logo {
  width: 106px;
  height: 30px;
  object-fit: contain;
}

.brand-divider {
  width: 1px;
  height: 22px;
  background: var(--line-strong);
}

.brand strong {
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.topbar-actions {
  flex: 1 1 auto;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0;
  color: var(--ink-soft);
  font-size: 12px;
}

.topbar-status {
  min-width: 0;
  justify-content: flex-end;
  gap: 12px;
}

.topbar-commands {
  flex: 0 0 auto;
  gap: 8px;
  margin-left: auto;
}

.topbar-actions .button {
  height: 28px;
}

.privacy-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--green-dark);
}

.privacy-status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.progress {
  padding-left: 12px;
  border-left: 1px solid var(--line);
  white-space: nowrap;
}

.toast {
  width: 120px;
  overflow: hidden;
  color: var(--blue);
  text-align: right;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.workspace {
  height: calc(100% - 58px);
  display: grid;
  grid-template-columns: 292px minmax(0, 1fr);
  gap: 10px;
  padding: 10px;
}

.panel {
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.panel-header {
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
}

.panel-header h1,
.section-title-row h2,
.dialog-header h2 {
  margin: 2px 0 0;
  font-size: 14px;
  line-height: 1.3;
}

.current-title {
  min-width: 0;
  flex: 1 1 auto;
}

.meeting-title-button {
  max-width: 100%;
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 2px 0 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  text-align: left;
}

.meeting-title-button > span:first-child {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.title-disclosure {
  flex: 0 0 auto;
  color: var(--ink-faint);
  font-size: 13px;
}

.eyebrow {
  display: block;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 9px;
  font-weight: 700;
  line-height: 1;
}

.button-row {
  flex: 0 0 auto;
  gap: 6px;
}

.button,
.icon-button,
.filter-button,
.mobile-tab {
  height: 30px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
  white-space: nowrap;
}

.button:hover,
.icon-button:hover {
  border-color: #aeb6ae;
  background: var(--surface-muted);
}

.button-primary {
  border-color: var(--green);
  background: var(--green);
  color: #ffffff;
}

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

.button-quiet {
  color: var(--ink-soft);
}

.icon-button {
  width: 30px;
  padding: 0;
  font-size: 17px;
  line-height: 1;
}

.danger-quiet {
  color: var(--red);
}

.filter-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
}

.filter-button {
  height: 27px;
  border-color: transparent;
  background: transparent;
  color: var(--ink-soft);
}

.filter-button:hover {
  background: #ecefeb;
}

.filter-button.is-active {
  border-color: var(--line-strong);
  background: var(--surface);
  color: var(--ink);
}

.meeting-list,
.editor-scroll,
.reviewed-list {
  min-height: 0;
  overflow: auto;
  scrollbar-color: #c6ccc5 transparent;
  scrollbar-width: thin;
}

.meeting-list {
  flex: 1 1 auto;
  padding: 6px;
}

.meeting-item {
  width: 100%;
  display: grid;
  grid-template-columns: 7px minmax(0, 1fr);
  gap: 9px;
  padding: 9px 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.meeting-item + .meeting-item {
  margin-top: 2px;
}

.meeting-item:hover {
  background: var(--surface-muted);
}

.meeting-item.is-active {
  border-color: #b9d8c4;
  background: var(--green-soft);
}

.meeting-item.is-reviewed {
  color: var(--ink-soft);
}

.meeting-state {
  width: 7px;
  height: 7px;
  margin-top: 5px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: var(--surface);
}

.meeting-item.has-low .meeting-state {
  border-color: var(--amber);
  background: var(--amber-soft);
}

.meeting-item.is-reviewed .meeting-state {
  border-color: var(--green);
  background: var(--green);
}

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

.meeting-name {
  display: -webkit-box;
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.meeting-time {
  display: block;
  margin-top: 4px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
}

.meeting-note {
  display: block;
  overflow: hidden;
  margin-top: 5px;
  color: var(--ink-soft);
  font-size: 11px;
  line-height: 1.4;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.editor-scroll {
  flex: 1 1 auto;
}

.editor-panel {
  position: relative;
}

.empty-state {
  height: 100%;
  min-height: 260px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 24px;
  color: var(--ink-soft);
  text-align: center;
}

.empty-state strong {
  color: var(--ink);
}

.empty-state span {
  font-size: 12px;
}

.editor-content {
  padding: 12px;
}

.review-command-bar {
  flex: 0 0 auto;
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-muted);
}

.review-command-bar .button-primary {
  min-width: 132px;
}

.review-command-separator {
  width: 1px;
  height: 20px;
  margin: 0 2px;
  background: var(--line-strong);
}

.summary-peek,
.meeting-meta-popover {
  position: absolute;
  top: 110px;
  right: 12px;
  left: 12px;
  z-index: 24;
  padding: 10px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: 0 16px 38px rgba(22, 27, 23, 0.16);
}

.summary-peek {
  border-left: 3px solid var(--amber);
  background: #fffdf7;
}

.summary-peek textarea {
  min-height: 52px;
  resize: none;
  background: rgba(255, 255, 255, 0.86);
}

.peek-header {
  min-height: 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 7px;
  font-size: 11px;
}

.peek-close {
  width: 24px;
  height: 24px;
  border: 0;
}

.meeting-meta {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 146px 130px;
  gap: 8px;
  padding: 9px;
}

.field {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.field-wide {
  min-width: 0;
}

.field:last-child {
  grid-column: 1 / -1;
}

.field span,
.highlight-field > span {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 650;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
}

input,
select {
  height: 32px;
  padding: 0 8px;
}

textarea {
  min-height: 48px;
  padding: 7px 8px;
  line-height: 1.45;
  resize: vertical;
}

input:hover,
textarea:hover,
select:hover {
  border-color: #aeb6ae;
}

.mapping-section {
  margin-top: 0;
}

.section-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.section-title-row h2 {
  margin: 2px 0 0;
}

.section-meta {
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
}

.section-actions {
  gap: 8px;
}

.review-position {
  min-width: 34px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
}

.mapping-head,
.mapping-row {
  display: grid;
  grid-template-columns: 104px minmax(150px, 1fr) 112px 82px 52px 28px;
  gap: 6px;
  align-items: center;
}

.mapping-head {
  padding: 0 7px 6px;
  color: var(--ink-faint);
  font-size: 10px;
  font-weight: 650;
}

.mapping-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mapping-card {
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
}

.mapping-card.is-low {
  border-left: 3px solid var(--amber);
  padding-left: 5px;
}

.mapping-card.is-replaced {
  border-left: 3px solid var(--green);
  padding-left: 5px;
}

.mapping-row input,
.mapping-row select,
.mapping-row button {
  min-width: 0;
  height: 34px;
  background: var(--surface);
  font-size: 11px;
}

.mapping-name {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 0 9px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.mapping-name:hover,
.mapping-name[aria-expanded="true"] {
  border-color: var(--green);
  background: var(--green-soft);
}

.mapping-name-value {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.mapping-name-arrow {
  flex: 0 0 auto;
  color: var(--ink-faint);
}

.mapping-note-toggle {
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  color: var(--ink-soft);
  cursor: pointer;
}

.mapping-note-toggle:hover,
.mapping-note-toggle[aria-expanded="true"] {
  border-color: #b7c4b9;
  background: #eef3ee;
  color: var(--ink);
}

.mapping-note-editor {
  margin-top: 7px;
}

.mapping-note-editor .mapping-note {
  height: 34px;
  font-size: 11px;
}

.mobile-remove-mapping {
  display: none;
}

.mapping-row .remove-mapping {
  grid-column: 6;
}

.remove-mapping {
  width: 28px;
  height: 28px;
  border: 0;
  background: transparent;
  color: var(--ink-faint);
  cursor: pointer;
  font-size: 16px;
}

.remove-mapping:hover {
  color: var(--red);
}

.output-panel {
  position: fixed;
  top: 68px;
  right: 10px;
  bottom: 10px;
  z-index: 50;
  width: min(430px, calc(100vw - 20px));
  opacity: 0;
  pointer-events: none;
  transform: translateX(calc(100% + 18px));
  transition: transform 180ms ease, opacity 180ms ease;
}

.output-panel.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: translateX(0);
}

.output-close {
  display: inline-block;
}

.output-body {
  min-height: 0;
  flex: 1 1 auto;
  display: grid;
  grid-template-rows: auto minmax(190px, 1.2fr) minmax(160px, 0.8fr);
  padding: 10px;
}

.format-line {
  display: flex;
  justify-content: space-between;
  padding: 0 2px 7px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 10px;
}

.json-output {
  height: 100%;
  min-height: 0;
  resize: none;
  background: #20231f;
  color: #e7ebe6;
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.45;
  tab-size: 2;
}

.reviewed-section {
  min-height: 0;
  display: flex;
  flex-direction: column;
  padding-top: 12px;
}

.reviewed-list {
  flex: 1 1 auto;
}

.reviewed-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 28px;
  gap: 6px;
  align-items: center;
  padding: 7px 5px;
  border-top: 1px solid var(--line);
}

.reviewed-item:first-child {
  border-top: 0;
}

.reviewed-item button:first-child {
  min-width: 0;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
}

.reviewed-item strong,
.reviewed-item span {
  display: block;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.reviewed-item strong {
  font-size: 11px;
}

.reviewed-item span {
  margin-top: 3px;
  color: var(--ink-faint);
  font-family: var(--mono);
  font-size: 9px;
}

.empty-list {
  padding: 16px 8px;
  color: var(--ink-faint);
  font-size: 11px;
  text-align: center;
}

.mobile-tabs {
  display: none;
}

.import-dialog {
  width: min(680px, calc(100vw - 28px));
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 24px 70px rgba(22, 27, 23, 0.22);
}

.roster-dialog {
  width: min(620px, calc(100vw - 28px));
}

.name-picker-dialog {
  width: min(760px, calc(100vw - 28px));
  max-height: min(82vh, 720px);
}

.name-picker-shell {
  max-height: min(82vh, 720px);
  display: flex;
  flex-direction: column;
}

.name-picker-header {
  flex: 0 0 auto;
}

.picker-section {
  flex: 0 0 auto;
  min-height: 0;
  margin-top: 10px;
}

.picker-roster-section {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
}

.picker-section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.picker-section-title {
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 700;
}

.text-button {
  padding: 2px 0;
  border: 0;
  background: transparent;
  color: var(--blue);
  cursor: pointer;
  font-size: 11px;
}

.name-picker-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 6px;
  margin-top: 7px;
}

.picker-roster-section .name-picker-grid {
  max-height: 42vh;
  overflow: auto;
  padding-right: 3px;
}

.name-choice {
  min-width: 0;
  height: 40px;
  overflow: hidden;
  padding: 0 8px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  font-size: 12px;
  font-weight: 650;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.name-choice:hover,
.name-choice.is-current {
  border-color: var(--green);
  background: var(--green-soft);
  color: var(--green-dark);
}

.name-choice.is-current::after {
  content: " · 当前";
  color: var(--green-dark);
  font-size: 9px;
  font-weight: 500;
}

.picker-empty {
  padding: 20px 8px;
  color: var(--ink-faint);
  font-size: 11px;
  text-align: center;
}

.custom-name-row {
  flex: 0 0 auto;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.custom-name-row .button {
  height: 32px;
}

.roster-editor textarea {
  min-height: 330px;
  resize: vertical;
}

.roster-dialog-actions {
  display: flex;
  justify-content: flex-end;
}

.import-dialog::backdrop {
  background: rgba(20, 24, 21, 0.38);
}

.dialog-shell {
  padding: 14px;
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.dialog-header h2 {
  font-size: 16px;
}

.dialog-actions {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.file-button {
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.dialog-error {
  overflow: hidden;
  color: var(--red);
  font-size: 11px;
  white-space: nowrap;
  text-overflow: ellipsis;
}

@media (max-width: 1240px) {
  .workspace {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .mapping-head,
  .mapping-row {
    grid-template-columns: 92px minmax(130px, 1fr) 104px 74px 48px 28px;
  }
}

@media (max-width: 980px) {
  .topbar {
    height: 54px;
    padding: 0 12px;
  }

  .brand-logo {
    width: 88px;
  }

  .brand-divider,
  .privacy-status,
  .toast {
    display: none;
  }

  .topbar-status {
    overflow: hidden;
  }

  .topbar-commands {
    margin-left: auto;
  }

  .workspace {
    height: calc(100% - 106px);
    display: block;
    padding: 7px;
  }

  .panel {
    display: none;
    height: 100%;
    box-shadow: none;
  }

  .panel.is-mobile-active {
    display: flex;
  }

  .output-panel {
    position: static;
    width: auto;
    opacity: 1;
    pointer-events: auto;
    transform: none;
    transition: none;
  }

  .output-close {
    display: inline-block;
  }

  .mobile-tabs {
    height: 52px;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    padding: 7px;
    border-top: 1px solid var(--line);
    background: var(--surface);
  }

  .mobile-tab {
    height: 38px;
    border-color: transparent;
    background: transparent;
    color: var(--ink-soft);
  }

  .mobile-tab.is-active {
    border-color: #b9d8c4;
    background: var(--green-soft);
    color: var(--green-dark);
  }
}

@media (max-width: 660px) {
  .brand strong {
    display: none;
  }

  .panel-header {
    min-height: 54px;
    padding: 8px 9px;
  }

  .editor-content {
    padding: 9px;
  }

  .meeting-meta {
    grid-template-columns: 1fr 1fr;
  }

  .meeting-meta .field:first-child,
  .meeting-meta .field:last-child {
    grid-column: 1 / -1;
  }

  .mapping-head {
    display: none;
  }

  .mapping-row {
    grid-template-columns: 58px minmax(96px, 1fr) 84px 50px 42px;
    gap: 4px;
  }

  .mapping-card {
    overflow: visible;
  }

  .mapping-row input,
  .mapping-row select,
  .mapping-row button {
    height: 36px;
  }

  .mapping-label {
    padding: 0 4px;
    font-size: 10px !important;
  }

  .remove-mapping {
    position: static;
  }

  .mapping-row .remove-mapping {
    display: none;
  }

  .mapping-note-editor {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 6px;
  }

  .mobile-remove-mapping {
    display: inline-flex;
    height: 34px;
    border-color: #e2c5c5;
    color: var(--red);
  }

  .review-command-bar {
    min-height: 46px;
    gap: 4px;
    padding: 6px 8px;
  }

  .review-command-bar .button-primary {
    min-width: 116px;
  }

  .roster-editor textarea {
    min-height: 52vh;
  }

  .summary-peek,
  .meeting-meta-popover {
    top: 106px;
    right: 8px;
    left: 8px;
  }

  .name-picker-dialog {
    width: calc(100vw - 14px);
    max-height: 88vh;
  }

  .name-picker-shell {
    max-height: 88vh;
    padding: 12px;
  }

  .name-picker-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .picker-roster-section .name-picker-grid {
    max-height: 48vh;
  }

  .name-choice {
    height: 44px;
  }

  .dialog-actions {
    grid-template-columns: 1fr 1fr;
  }

  .dialog-error {
    grid-column: 1 / -1;
    grid-row: 1;
  }
}

@media (max-width: 420px) {
  .progress {
    display: none;
  }

  .review-position {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition: none !important;
  }
}
