:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.86);
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --blue: #0071e3;
  --green: #1f8f5f;
  --orange: #b85c00;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.9), rgba(245,245,247,0.96)),
    var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", "Helvetica Neue", Arial, sans-serif;
  letter-spacing: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

.app-shell {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
  padding: 34px 0 42px;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-card {
  width: min(440px, 100%);
  display: grid;
  gap: 14px;
  padding: 28px;
  border: 1px solid rgba(210, 210, 215, 0.86);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 8px;
}

.login-card h1 {
  font-size: 36px;
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-end;
  margin-bottom: 22px;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

h1,
h2 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 44px;
  line-height: 1.05;
  font-weight: 750;
}

h2 {
  font-size: 22px;
  line-height: 1.2;
  font-weight: 700;
}

.subhead {
  max-width: 680px;
  margin: 14px 0 0;
  color: var(--muted);
  font-size: 17px;
  line-height: 1.65;
}

.status-card {
  min-width: 260px;
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 14px 16px;
  border: 1px solid var(--line);
  background: rgba(255,255,255,0.74);
  border-radius: 8px;
}

.mobile-tabs {
  display: none;
}

.mobile-action-grid {
  display: none;
}

.status-card strong,
.status-card span {
  display: block;
}

.status-card span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 2px;
}

.mini-btn {
  margin-left: auto;
  border: 0;
  border-radius: 8px;
  background: #f5f5f7;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  padding: 8px 10px;
  text-decoration: none;
  white-space: nowrap;
}

.status-card .mini-btn + .mini-btn {
  margin-left: 0;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(31,143,95,0.14);
}

.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.command-panel {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 14px;
  align-items: start;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid rgba(210, 210, 215, 0.86);
  border-radius: 8px;
  background: rgba(255,255,255,0.86);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.command-panel h2 {
  font-size: 24px;
}

.my-command-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 10px;
}

.my-command-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  background: rgba(255,255,255,0.72);
}

.my-command-card.urgent {
  border-color: rgba(184, 92, 0, 0.42);
  background: #fff8ef;
}

.my-command-card.completed {
  background: rgba(245,245,247,0.82);
}

.my-command-head,
.my-command-meta,
.my-command-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.my-command-head {
  justify-content: space-between;
}

.my-command-head strong {
  font-size: 16px;
}

.my-command-head span,
.my-command-meta span,
.my-command-done {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.my-command-head span,
.my-command-meta span {
  padding: 5px 8px;
  border-radius: 999px;
  background: #f5f5f7;
}

.my-command-card p {
  margin: 0;
  color: var(--text);
  line-height: 1.55;
}

.my-command-card textarea {
  min-height: 68px;
}

.my-command-actions button {
  min-height: 34px;
  border: 0;
  border-radius: 8px;
  background: #f5f5f7;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
}

.my-command-actions button:last-child {
  background: var(--text);
  color: white;
}

.kpi-row article,
.panel {
  border: 1px solid rgba(210, 210, 215, 0.86);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  border-radius: 8px;
}

.kpi-row article {
  padding: 18px;
}

.kpi-row span {
  font-size: 30px;
  font-weight: 760;
}

.kpi-row p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.mobile-action-grid a {
  min-height: 86px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 14px;
  border: 1px solid rgba(210, 210, 215, 0.86);
  border-radius: 8px;
  background: rgba(255,255,255,0.86);
  color: var(--text);
  text-decoration: none;
}

.mobile-action-grid strong {
  font-size: 17px;
  line-height: 1.2;
}

.mobile-action-grid span {
  color: var(--muted);
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(520px, 1.08fr) minmax(360px, 0.92fr);
  gap: 12px;
  align-items: start;
}

.input-panel {
  grid-row: span 2;
}

.records-panel {
  grid-column: 2;
}

.admin-panel {
  margin-bottom: 12px;
}

.admin-panel .panel-head {
  margin-bottom: 14px;
}

.diagnosis-panel {
  margin-bottom: 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
  align-items: end;
}

.check-row {
  min-height: 42px;
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.72);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.check-row input {
  width: auto;
  height: auto;
}

.users-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 14px;
  max-height: 320px;
  overflow: auto;
  padding-right: 2px;
}

.user-card {
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  background: rgba(255,255,255,0.72);
  padding: 13px;
}

.user-card.deleted {
  background: rgba(245,245,247,0.82);
  color: var(--muted);
}

.user-card strong,
.user-card span {
  display: block;
}

.user-card span {
  color: var(--muted);
  font-size: 13px;
  margin-top: 5px;
}

.delete-user-btn {
  margin-top: 10px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: #fff0f0;
  color: #b42318;
  cursor: pointer;
  font-weight: 800;
  padding: 9px 10px;
}

.user-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.user-actions button {
  flex: 1;
  min-width: 92px;
  border: 0;
  border-radius: 8px;
  background: #f5f5f7;
  color: var(--text);
  cursor: pointer;
  font-weight: 800;
  padding: 9px 10px;
}

.user-actions .danger {
  background: #fff0f0;
  color: #b42318;
}

.deleted-badge {
  display: inline-grid !important;
  width: fit-content;
  margin-top: 10px !important;
  padding: 6px 9px;
  border-radius: 999px;
  background: #f5f5f7;
  color: #86868b !important;
  font-weight: 800;
}

.diagnosis-actions {
  display: flex;
  gap: 10px;
  align-items: end;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.diagnosis-actions label {
  min-width: 210px;
}

.diagnosis-result {
  display: grid;
  gap: 12px;
}

.diagnosis-grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 12px;
}

.diagnosis-block {
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  background: rgba(255,255,255,0.72);
  padding: 14px;
}

.diagnosis-block h3 {
  margin: 0 0 10px;
  font-size: 16px;
}

.diagnosis-block p,
.diagnosis-block li {
  line-height: 1.65;
}

.diagnosis-block ul {
  margin: 0;
  padding-left: 18px;
}

.panel {
  padding: 20px;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: start;
  margin-bottom: 18px;
}

.panel-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.save-status {
  display: inline-grid;
  place-items: center;
  min-height: 34px;
  padding: 0 10px;
  border-radius: 999px;
  background: #f5f5f7;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
}

.save-status[data-state="saved"] {
  background: #eef8f3;
  color: #126c45;
}

.save-status[data-state="dirty"] {
  background: #fff7e8;
  color: #9a4b00;
}

.save-status[data-state="busy"] {
  background: #eef5ff;
  color: #0759ae;
}

.grid-two {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

.visit-flow-card {
  display: grid;
  gap: 12px;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  background: rgba(255,255,255,0.62);
}

.visit-flow-card.flow-collapsible {
  gap: 0;
  padding: 0;
  overflow: hidden;
}

.visit-flow-card.flow-collapsible .visit-section-title {
  min-height: 56px;
  padding: 14px;
  cursor: pointer;
}

.visit-section-body {
  display: grid;
  gap: 12px;
  padding: 0 14px 14px;
}

.visit-flow-card.is-collapsed .visit-section-body {
  display: none;
}

.visit-flow-card.is-collapsed {
  background: rgba(255,255,255,0.46);
}

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

.visit-section-title span {
  flex: 0 0 auto;
}

.visit-section-title strong {
  flex: 1;
}

.visit-section-title span,
.field-block > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.visit-section-title strong {
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  text-align: right;
}

.section-toggle {
  flex: 0 0 auto;
  min-width: 54px;
  min-height: 30px;
  border: 0;
  border-radius: 999px;
  background: #f5f5f7;
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 850;
}

.visit-flow-card:not(.is-collapsed) .section-toggle {
  background: #1d1d1f;
  color: white;
}

.mode-toggle {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f5f5f7;
}

.mode-toggle label,
.chip-grid label {
  cursor: pointer;
}

.mode-toggle input,
.chip-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.mode-toggle span {
  display: grid;
  place-items: center;
  min-height: 38px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 850;
}

.mode-toggle input:checked + span {
  background: #1d1d1f;
  color: white;
  box-shadow: 0 8px 24px rgba(0,0,0,0.12);
}

.field-block {
  display: grid;
  gap: 8px;
}

.chip-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.chip-grid span {
  display: grid;
  place-items: center;
  min-height: 38px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.8);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-align: center;
}

.chip-grid input:checked + span {
  border-color: rgba(0, 113, 227, 0.32);
  background: #eef5ff;
  color: #0759ae;
}

.visit-note-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.visit-note-grid textarea {
  min-height: 112px;
}

.visit-flow-card textarea {
  min-height: 82px;
}

.visit-result-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.visit-result-grid div {
  min-height: 72px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  background: rgba(255,255,255,0.66);
}

.visit-result-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.visit-result-grid strong {
  font-size: 16px;
  line-height: 1.35;
}

label {
  display: grid;
  gap: 7px;
}

label span,
.result-block span,
.copy-box span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.82);
  color: var(--text);
  outline: none;
}

input,
select {
  height: 42px;
  padding: 0 12px;
}

textarea {
  resize: vertical;
  min-height: 156px;
  padding: 12px;
  line-height: 1.6;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(0, 113, 227, 0.12);
}

.note-label {
  margin-top: 12px;
}

.actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.primary,
.icon-btn,
.filter,
.copy-box button {
  border: 0;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, opacity 0.15s ease;
}

.primary {
  height: 44px;
  border-radius: 8px;
  background: var(--blue);
  color: white;
  font-weight: 700;
}

.primary.ghost {
  background: #1d1d1f;
}

.primary.recording {
  background: #ff3b30;
  box-shadow: 0 0 0 6px rgba(255, 59, 48, 0.12);
  transform: scale(0.99);
}

.primary.voice-fallback {
  background: #242936;
}

#voiceBtn {
  -webkit-user-select: none;
  touch-action: none;
  user-select: none;
}

.primary.light {
  background: #e8e8ed;
  color: var(--text);
}

.primary.save-action {
  background: #1f8f5f;
}

.save-wide {
  width: 100%;
}

.primary:active,
.icon-btn:active,
.filter:active,
.copy-box button:active {
  transform: scale(0.98);
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  min-width: 38px;
  height: 38px;
  padding: 0 11px;
  border-radius: 8px;
  background: #f5f5f7;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.save-analysis-btn,
.records-toggle {
  width: auto;
  white-space: nowrap;
}

.hint {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.empty-state {
  min-height: 420px;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 26px;
}

.empty-state.compact {
  min-height: 120px;
  grid-column: 1 / -1;
}

.empty-state strong {
  color: var(--text);
  font-size: 19px;
}

.hidden {
  display: none !important;
}

.result-content {
  display: grid;
  gap: 14px;
}

.result-block,
.copy-box {
  border: 1px solid #e5e5ea;
  border-radius: 8px;
  background: rgba(255,255,255,0.66);
  padding: 14px;
}

.result-block p,
.copy-box p {
  margin: 8px 0 0;
  line-height: 1.65;
}

.tags-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.tag {
  padding: 7px 10px;
  background: #eef5ff;
  color: #0759ae;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
}

.service .tag {
  background: #eef8f3;
  color: #126c45;
}

.copy-box > div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.copy-box button,
.filter {
  border-radius: 999px;
  background: #f5f5f7;
  color: var(--text);
  padding: 7px 11px;
  font-size: 12px;
  font-weight: 800;
}

.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.filter.active {
  background: var(--text);
  color: white;
}

.records-list {
  display: grid;
  gap: 10px;
  max-height: 560px;
  overflow: auto;
  padding-right: 2px;
}

.records-panel .empty-state {
  min-height: 180px;
}

.records-footer {
  display: grid;
  margin-top: 10px;
}

.records-footer .records-toggle {
  width: 100%;
  height: 40px;
}

.export-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.export-menu {
  position: relative;
}

.export-menu summary {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--text);
  color: white;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.export-menu summary::-webkit-details-marker {
  display: none;
}

.export-menu > div {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 5;
  min-width: 150px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.98);
  box-shadow: var(--shadow);
}

.export-menu a {
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-weight: 800;
}

.export-menu a:hover {
  background: #f5f5f7;
}

.export-btn {
  display: inline-grid;
  place-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 8px;
  text-decoration: none;
}

.record-card {
  border: 1px solid #e5e5ea;
  background: rgba(255,255,255,0.72);
  border-radius: 8px;
  padding: 13px;
}

.record-card strong {
  display: block;
  font-size: 15px;
}

.record-card p {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
}

.record-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.record-meta span {
  color: var(--muted);
  background: #f5f5f7;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%) translateY(20px);
  opacity: 0;
  pointer-events: none;
  background: rgba(29,29,31,0.92);
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  transition: 0.18s ease;
}

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

.table-panel {
  margin-top: 12px;
}

.mobile-backend-list {
  display: none;
}

.table-scroll {
  width: 100%;
  overflow: auto;
  border: 1px solid #e5e5ea;
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 1220px;
  border-collapse: collapse;
  background: rgba(255,255,255,0.72);
}

th,
td {
  padding: 12px;
  border-bottom: 1px solid #e5e5ea;
  text-align: left;
  vertical-align: top;
  font-size: 13px;
  line-height: 1.45;
}

th {
  position: sticky;
  top: 0;
  background: #f5f5f7;
  color: var(--muted);
  font-weight: 800;
  z-index: 1;
}

td {
  color: var(--text);
}

tbody tr:last-child td {
  border-bottom: 0;
}

.table-actions {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.table-actions button {
  border: 0;
  border-radius: 8px;
  background: #f5f5f7;
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 800;
  padding: 7px 10px;
}

.table-actions .danger {
  background: #fff0f0;
  color: #b42318;
}

.record-dialog {
  width: min(760px, calc(100% - 28px));
  border: 1px solid rgba(210, 210, 215, 0.95);
  border-radius: 8px;
  background: rgba(255,255,255,0.96);
  box-shadow: 0 28px 80px rgba(0,0,0,0.18);
  padding: 20px;
}

.record-dialog::backdrop {
  background: rgba(0,0,0,0.18);
  backdrop-filter: blur(6px);
}

.record-dialog form {
  display: grid;
  gap: 12px;
}

.edit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.dialog-actions .primary {
  min-width: 118px;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: 1fr 1fr;
  }
  .records-panel {
    grid-column: 1 / -1;
  }
}

@media (max-width: 760px) {
  body {
    background: var(--bg);
  }
  .app-shell {
    width: 100%;
    padding: 14px 10px 28px;
  }
  .hero {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 12px;
  }
  h1 {
    font-size: 30px;
  }
  h2 {
    font-size: 20px;
  }
  .subhead {
    font-size: 15px;
    margin-top: 8px;
    line-height: 1.5;
  }
  .status-card {
    min-width: 0;
    width: 100%;
    padding: 12px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
  }
  .status-card > div {
    grid-column: 2 / -1;
    grid-row: 1;
    min-width: 0;
  }
  .status-dot {
    grid-column: 1;
    grid-row: 1;
    align-self: center;
    justify-self: center;
  }
  .mini-btn {
    margin-left: 0;
    width: 100%;
    padding: 8px 4px;
    white-space: nowrap;
    text-align: center;
    font-size: 13px;
  }
  .kpi-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }
  .command-panel {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 10px;
    padding: 14px;
    box-shadow: none;
  }
  .my-command-list {
    grid-template-columns: 1fr;
  }
  .my-command-card textarea {
    min-height: 78px;
  }
  .kpi-row article {
    padding: 12px 10px;
  }
  .kpi-row span {
    font-size: 23px;
  }
  .kpi-row p {
    font-size: 11px;
    white-space: nowrap;
  }
  .mobile-action-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    margin-bottom: 10px;
  }
  .mobile-tabs {
    position: sticky;
    top: 0;
    z-index: 8;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 6px;
    padding: 8px 0 10px;
    background: rgba(245,245,247,0.96);
    backdrop-filter: blur(18px);
  }
  .mobile-tabs a,
  .mobile-tabs button {
    display: grid;
    place-items: center;
    min-height: 38px;
    border: 0;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    font-weight: 800;
    font-size: 13px;
    font-family: inherit;
    cursor: pointer;
  }
  .app-shell.mobile-management-open .mobile-tabs button {
    background: #1d1d1f;
    color: #fff;
  }
  .app-shell.mobile-management-open .workspace,
  .app-shell.mobile-management-open .mobile-action-grid,
  .app-shell.mobile-management-open .kpi-row {
    display: none;
  }
  .kpi-row,
  .workspace,
  .grid-two,
  .admin-grid,
  .diagnosis-grid,
  .edit-grid,
  .permission-grid {
    grid-template-columns: 1fr;
  }
  .input-panel,
  .records-panel {
    grid-column: auto;
    grid-row: auto;
  }
  .diagnosis-actions,
  .dialog-actions {
    justify-content: stretch;
  }
  .visit-flow-card {
    gap: 11px;
    margin-top: 10px;
    padding: 12px;
  }
  .visit-flow-card.flow-collapsible {
    padding: 0;
  }
  .visit-flow-card.flow-collapsible .visit-section-title {
    align-items: center;
    flex-direction: row;
    gap: 8px;
  }
  .visit-section-title strong {
    text-align: left;
    font-size: 13px;
  }
  .section-toggle {
    min-width: 48px;
  }
  .mode-toggle,
  .visit-note-grid,
  .visit-result-grid {
    grid-template-columns: 1fr;
  }
  .chip-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .chip-grid span {
    min-height: 42px;
    font-size: 14px;
  }
  .visit-flow-card textarea,
  .visit-note-grid textarea {
    min-height: 120px;
  }
  .note-label textarea#rawNote {
    min-height: 160px;
  }
  .diagnosis-actions label,
  .dialog-actions .primary {
    width: 100%;
  }
  .panel {
    padding: 14px;
    box-shadow: none;
  }
  .panel.is-collapsible {
    padding: 0;
    overflow: hidden;
  }
  .panel.is-collapsible .panel-head {
    min-height: 76px;
    margin: 0;
    padding: 14px;
    cursor: pointer;
  }
  .panel.is-collapsible .panel-head > div {
    padding-right: 52px;
  }
  .panel.is-collapsible .panel-head::after {
    content: "展开";
    margin-left: auto;
    padding: 6px 9px;
    border-radius: 999px;
    background: #f5f5f7;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
  }
  .panel.is-collapsible.is-open .panel-head::after {
    content: "收起";
    background: #1d1d1f;
    color: #fff;
  }
  .panel.is-collapsible:not(.is-open) > :not(.panel-head) {
    display: none !important;
  }
  .panel.is-collapsible.is-open {
    padding-bottom: 14px;
  }
  .panel.is-collapsible.is-open > :not(.panel-head) {
    margin-left: 14px;
    margin-right: 14px;
  }
  .panel.is-collapsible.is-open > .panel-head {
    margin-bottom: 14px;
    border-bottom: 1px solid #e5e5ea;
  }
  .admin-panel,
  .diagnosis-panel,
  .table-panel {
    display: none;
    margin-top: 10px;
  }
  .app-shell.mobile-management-open .admin-panel:not(.hidden),
  .app-shell.mobile-management-open .diagnosis-panel:not(.hidden),
  .app-shell.mobile-management-open .table-panel:not(.hidden) {
    display: block;
  }
  .admin-panel .admin-grid,
  .diagnosis-panel .diagnosis-actions {
    display: none;
  }
  .admin-panel.is-open .admin-grid {
    display: grid;
  }
  .diagnosis-panel.is-open .diagnosis-actions {
    display: flex;
  }
  .admin-panel .users-list,
  .diagnosis-result {
    max-height: 260px;
    overflow: auto;
  }
  .panel-head {
    align-items: center;
    margin-bottom: 14px;
  }
  input,
  select {
    height: 46px;
    font-size: 16px;
  }
  textarea {
    min-height: 190px;
    font-size: 16px;
  }
  .actions {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 7px;
    position: sticky;
    bottom: 8px;
    z-index: 5;
    padding: 8px;
    border: 1px solid rgba(210, 210, 215, 0.82);
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.9);
    backdrop-filter: blur(18px);
  }
  .primary {
    height: 42px;
    padding: 0 6px;
    font-size: 13px;
    white-space: nowrap;
  }
  #voiceBtn {
    font-size: 12px;
  }
  .result-panel {
    order: 2;
  }
  .input-panel {
    order: 1;
  }
  .records-panel {
    order: 3;
  }
  .empty-state {
    min-height: 220px;
  }
  .records-list {
    max-height: none;
  }
  .table-scroll {
    display: none;
  }
  .table-panel {
    margin-top: 10px;
  }
  .table-panel .panel-head {
    align-items: center;
  }
  .mobile-backend-list {
    display: grid;
    gap: 10px;
  }
  .mobile-backend-card {
    display: grid;
    gap: 8px;
    padding: 13px;
    border: 1px solid #e5e5ea;
    border-radius: 8px;
    background: rgba(255,255,255,0.74);
  }
  .mobile-backend-card strong {
    font-size: 16px;
  }
  .mobile-backend-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
  }
  .mobile-backend-meta {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
  }
  .mobile-backend-meta span {
    padding: 5px 8px;
    border-radius: 999px;
    background: #f5f5f7;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
  }
  .export-menu {
    width: 100%;
  }
  .export-menu summary {
    width: 100%;
    min-height: 44px;
  }
  .export-menu > div {
    position: static;
    margin-top: 8px;
    box-shadow: none;
  }
  .export-actions {
    justify-content: flex-start;
  }
  .empty-state {
    min-height: 260px;
  }
}
