:root {
  color-scheme: light;
  --bg: #111111;
  --bg-soft: #1a1a1a;
  --surface: #f6f0e6;
  --surface-strong: #fffaf0;
  --surface-muted: #ebe2d4;
  --text: #171717;
  --text-inverse: #f7f0e6;
  --muted: #6e6a62;
  --muted-inverse: #bbb3a7;
  --line: #d6cbb9;
  --line-dark: #33302b;
  --gold: #b8924a;
  --gold-dark: #7d622f;
  --danger: #9b332b;
  --shadow: 0 28px 80px rgba(0, 0, 0, 0.24);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(120deg, rgba(17, 17, 17, 0.96), rgba(34, 32, 29, 0.94)),
    var(--bg);
  color: var(--text);
  font-family:
    "Microsoft YaHei",
    "PingFang SC",
    "Noto Sans CJK SC",
    Arial,
    sans-serif;
}

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

.app-shell {
  width: min(1220px, calc(100% - 44px));
  margin: 0 auto;
  padding: 58px 0;
}

.intro {
  position: relative;
  max-width: 820px;
  margin-bottom: 34px;
  padding-left: 22px;
  color: var(--text-inverse);
}

.intro::before {
  position: absolute;
  left: 0;
  top: 4px;
  width: 3px;
  height: calc(100% - 8px);
  background: var(--gold);
  content: "";
}

.eyebrow {
  margin: 0 0 14px;
  color: var(--gold);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 14px;
  font-size: clamp(32px, 4.8vw, 56px);
  line-height: 1.12;
  font-weight: 700;
}

.intro-text {
  margin-bottom: 0;
  color: var(--muted-inverse);
  font-size: 16px;
  line-height: 1.8;
}

.auth-panel {
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid rgba(184, 146, 74, 0.42);
  background: rgba(17, 17, 17, 0.94);
  color: var(--text-inverse);
}

.auth-panel:not(.is-authenticated) {
  display: flex;
}

.auth-panel.is-authenticated {
  display: flex;
}

.auth-panel.is-authenticated .auth-form input,
.auth-panel.is-authenticated .auth-form button[type="submit"] {
  display: none;
}

.auth-panel:not(.is-authenticated) #logoutButton {
  display: none;
}

.auth-panel strong,
.auth-panel span {
  display: block;
}

.auth-panel span {
  margin-top: 4px;
  color: var(--muted-inverse);
  font-size: 13px;
}

.auth-form {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-form input {
  min-width: 220px;
  border-color: rgba(184, 146, 74, 0.45);
  background: #111;
  color: #fff;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(360px, 0.9fr);
  gap: 24px;
  align-items: start;
}

.form-panel,
.records-panel {
  border: 1px solid rgba(214, 203, 185, 0.8);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.form-panel {
  padding: 30px;
}

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

label,
.radio-group,
.followup-entry {
  display: grid;
  gap: 8px;
}

label span,
legend {
  color: var(--gold-dark);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
  color: var(--text);
  outline: none;
  transition:
    border-color 0.2s ease,
    box-shadow 0.2s ease,
    background 0.2s ease;
}

input,
select {
  height: 46px;
  padding: 0 14px;
}

textarea {
  min-height: 136px;
  padding: 13px 14px;
  resize: vertical;
  line-height: 1.65;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(184, 146, 74, 0.18);
  background: #fffdf8;
}

.full-row {
  grid-column: 1 / -1;
}

.radio-group {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
  padding: 0;
  border: 0;
}

.followup-entry {
  margin: 0;
  padding: 18px;
  border: 1px solid rgba(184, 146, 74, 0.34);
  border-radius: 8px;
  background: rgba(255, 250, 240, 0.55);
}

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

.radio-group legend {
  grid-column: 1 / -1;
  padding: 0;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-strong);
}

.radio-option input {
  width: 16px;
  height: 16px;
  accent-color: var(--gold-dark);
}

.radio-option span {
  color: var(--text);
  font-weight: 500;
}

.actions,
.export-actions,
.backup-actions,
.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.actions {
  margin-top: 24px;
}

button {
  min-height: 42px;
  padding: 0 17px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 700;
  transition:
    transform 0.2s ease,
    background 0.2s ease,
    border-color 0.2s ease,
    color 0.2s ease;
}

button:hover {
  transform: translateY(-1px);
}

button[type="submit"] {
  background: #151515;
  color: var(--text-inverse);
}

button[type="submit"]:hover {
  background: #000;
  border-color: var(--gold);
}

.secondary {
  background: var(--gold);
  color: #16120b;
}

.secondary:hover {
  background: #c7a45e;
}

.ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--text);
}

.ghost:hover {
  border-color: var(--gold);
  color: var(--gold-dark);
}

.status {
  min-height: 24px;
  margin: 16px 0 0;
  color: var(--gold-dark);
  font-size: 14px;
}

.records-panel {
  padding: 24px;
}

.records-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.records-heading h2 {
  margin: 0;
  font-size: 20px;
}

#recordCount {
  color: var(--muted);
  font-size: 14px;
  white-space: nowrap;
}

.records-tools {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 240, 0.36);
}

.search-field {
  gap: 7px;
}

.export-actions button,
.backup-actions button {
  flex: 1;
}

.backup-actions {
  padding-top: 12px;
  border-top: 1px solid rgba(214, 203, 185, 0.72);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  clip-path: inset(50%);
}

.records-list {
  display: grid;
  gap: 12px;
  max-height: 650px;
  overflow: auto;
  padding-right: 4px;
}

.dashboard-panel {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid rgba(184, 146, 74, 0.26);
  background: #f7f1e7;
}

.export-center-panel {
  margin: 18px 0;
  padding: 18px;
  border: 1px solid rgba(184, 146, 74, 0.26);
  background: #f7f1e7;
}

.dashboard-heading,
.dashboard-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.dashboard-heading {
  margin-bottom: 16px;
}

.dashboard-heading h3 {
  margin: 4px 0;
  color: var(--ink);
  font-size: 20px;
}

.dashboard-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.dashboard-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.dashboard-actions .is-active {
  border-color: var(--gold);
  color: var(--ink);
  background: rgba(184, 146, 74, 0.16);
}

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

.metric-card {
  padding: 14px;
  border: 1px solid rgba(23, 23, 23, 0.1);
  background: #fffaf2;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric-card strong {
  display: block;
  margin-top: 6px;
  color: var(--ink);
  font-size: 26px;
  line-height: 1;
}

.metric-card.danger strong {
  color: #9f2a20;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

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

.dashboard-box,
.dashboard-table-wrap {
  padding: 14px;
  border: 1px solid rgba(23, 23, 23, 0.1);
  background: #fffaf2;
}

.dashboard-box h4,
.dashboard-table-wrap h4 {
  margin: 0 0 10px;
  color: var(--ink);
  font-size: 15px;
}

.stats-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.stats-list li {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 13px;
}

.stats-list strong {
  color: var(--ink);
}

.reminder-list {
  display: grid;
  gap: 10px;
}

.reminder-item {
  display: grid;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(23, 23, 23, 0.08);
}

.reminder-item:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.reminder-item strong {
  color: var(--ink);
}

.reminder-item span,
.reminder-item small {
  color: var(--muted);
  font-size: 12px;
}

.dashboard-table-wrap {
  margin-top: 14px;
  overflow-x: auto;
}

.dashboard-table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  font-size: 12px;
}

.dashboard-table th,
.dashboard-table td {
  padding: 9px 8px;
  border-bottom: 1px solid rgba(23, 23, 23, 0.08);
  text-align: left;
  vertical-align: top;
}

.dashboard-table th {
  color: var(--ink);
  background: rgba(184, 146, 74, 0.12);
}

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

.export-range-box {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid rgba(23, 23, 23, 0.1);
  background: #fffaf2;
}

.export-range-box h4 {
  margin: 0 0 12px;
  color: var(--ink);
  font-size: 15px;
}

.export-range-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 12px;
}

.export-range-fields label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
}

.export-range-fields input {
  min-height: 40px;
}

.record-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-strong);
  padding: 16px;
}

.record-topline {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 11px;
}

.record-card h3 {
  margin: 6px 0 0;
  color: #111;
  font-size: 17px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  margin-right: 6px;
  padding: 0 10px;
  border: 1px solid rgba(184, 146, 74, 0.42);
  border-radius: 999px;
  background: rgba(184, 146, 74, 0.12);
  color: var(--gold-dark);
  font-size: 12px;
  font-weight: 700;
}

.status-badge.quiet {
  border-color: rgba(23, 23, 23, 0.14);
  background: rgba(23, 23, 23, 0.06);
  color: var(--muted);
}

.status-badge.alert {
  border-color: rgba(155, 51, 43, 0.28);
  background: rgba(155, 51, 43, 0.1);
  color: var(--danger);
}

.status-badge.archived {
  border-color: rgba(23, 23, 23, 0.18);
  background: rgba(23, 23, 23, 0.09);
  color: #2f2f2f;
}

.text-button {
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--gold-dark);
  font-size: 13px;
}

.text-button:hover {
  color: #111;
  transform: none;
}

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

.record-card dl {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 7px 10px;
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.55;
}

.record-card dt {
  color: var(--gold-dark);
  font-weight: 700;
}

.record-card dd {
  margin: 0;
  overflow-wrap: anywhere;
}

.followup-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding-left: 18px;
}

.followup-list li {
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(214, 203, 185, 0.64);
}

.followup-list li:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.followup-list strong {
  display: block;
  margin-bottom: 2px;
  color: var(--gold-dark);
  font-size: 12px;
}

.followup-list span {
  display: block;
}

.followup-list small,
.latest-followup small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
}

.latest-followup {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border-left: 3px solid var(--gold);
  background: rgba(184, 146, 74, 0.08);
}

.latest-followup strong {
  color: var(--gold-dark);
  font-size: 12px;
}

.empty {
  margin: 0;
  padding: 36px 18px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.data-note {
  margin: 22px 0 0;
  color: var(--muted-inverse);
  font-size: 13px;
  line-height: 1.7;
  text-align: center;
}

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

@media (max-width: 640px) {
  .app-shell {
    width: min(100% - 28px, 1220px);
    padding: 36px 0;
  }

  .intro {
    padding-left: 16px;
  }

  .form-panel,
  .records-panel {
    padding: 20px;
  }

  .dashboard-heading,
  .dashboard-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .dashboard-metrics,
  .dashboard-grid,
  .dashboard-grid.two,
  .export-center-grid,
  .export-range-fields {
    grid-template-columns: 1fr;
  }

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

  .followup-entry-grid {
    grid-template-columns: 1fr;
  }

  .actions button,
  .export-actions button,
  .backup-actions button {
    width: 100%;
  }

  .record-topline {
    display: grid;
  }
}
/* V1.3 employee page navigation and chat intake */
[hidden] {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
  background: radial-gradient(circle at top, #244f78, #0f172a 65%);
}

.login-card {
  width: min(100%, 420px);
  display: grid;
  gap: 16px;
  padding: clamp(26px, 6vw, 42px);
  border-radius: 24px;
  background: #fff;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.3);
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 1.65rem;
}

.login-card label {
  display: grid;
  gap: 7px;
}

.login-card input {
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 13px;
}

.demo-account-hint {
  padding: 12px;
  border-radius: 12px;
  background: #fffbeb;
  color: #92400e;
  font-size: 0.78rem;
  line-height: 1.6;
}

body {
  padding-bottom: 88px;
}

.app-view {
  max-width: 1180px;
  margin: 0 auto;
}

.view-heading span,
.form-page-heading span {
  color: #64748b;
  font-size: 0.78rem;
  letter-spacing: 0.08em;
}

.view-heading h2,
.form-page-heading h2 {
  margin: 3px 0 18px;
}

.with-back,
.form-page-heading {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.back-button {
  border: 0;
  background: transparent;
  color: #475569;
  padding: 5px 0;
}

.home-view {
  background: linear-gradient(145deg, #0f172a, #1e3a5f);
  color: #fff;
  border-radius: 24px;
  padding: clamp(24px, 5vw, 54px);
  box-shadow: 0 24px 55px rgba(15, 23, 42, 0.18);
}

.home-welcome span,
.home-welcome p {
  color: #bfdbfe;
}

.home-welcome h2 {
  font-size: clamp(1.8rem, 5vw, 3rem);
  margin: 8px 0;
}

.home-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 28px 0;
}

.home-stats button {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #fff;
  padding: 18px;
  border-radius: 16px;
}

.home-stats strong {
  font-size: 1.8rem;
}

.home-primary,
.full-primary {
  width: 100%;
  border: 0;
  border-radius: 14px;
  padding: 15px 18px;
  background: #f59e0b;
  color: #172033;
  font-weight: 800;
}

.bottom-nav {
  position: fixed;
  z-index: 50;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, minmax(74px, 120px));
  gap: 4px;
  padding: 7px;
  border: 1px solid #dbe3ee;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 16px 45px rgba(15, 23, 42, 0.2);
  backdrop-filter: blur(14px);
}

.bottom-nav button {
  border: 0;
  border-radius: 14px;
  background: transparent;
  color: #64748b;
  padding: 8px 10px;
  font-size: 0.76rem;
}

.bottom-nav button span {
  display: block;
  font-size: 1.2rem;
  line-height: 1.1;
}

.bottom-nav button.active {
  background: #0f172a;
  color: #fff;
}

.bottom-nav .intake-nav span {
  color: #f59e0b;
  font-weight: 900;
}

.intake-entry,
.chat-intake-panel,
.chat-review-panel,
.detail-view,
.mine-view {
  max-width: 760px;
  margin: 0 auto;
  padding: clamp(18px, 4vw, 32px);
  border: 1px solid #dbe3ee;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}

.entry-card {
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  margin-top: 14px;
  padding: 20px;
  border: 1px solid #dbe3ee;
  border-radius: 16px;
  background: #fff;
  color: #172033;
  text-align: left;
}

.entry-card span {
  color: #64748b;
}

.primary-entry {
  border-color: #f59e0b;
  background: #fffbeb;
}

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

.chat-source-field textarea,
.draft-field input,
.draft-field textarea {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 13px;
  background: #fff;
}

.privacy-hint {
  color: #64748b;
  font-size: 0.82rem;
  line-height: 1.6;
}

.recognition-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.draft-field {
  display: grid;
  gap: 7px;
  padding: 12px;
  border-radius: 14px;
  background: #f8fafc;
}

.draft-field > span {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.draft-field small {
  color: #64748b;
  font-weight: 500;
}

.draft-field.review,
.draft-field.missing {
  background: #fffbeb;
}

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

.form-page-heading,
.form-step-nav {
  grid-column: 1 / -1;
}

.form-step-nav {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin-bottom: 18px;
}

.form-step-nav button {
  border: 1px solid #dbe3ee;
  border-radius: 10px;
  padding: 10px 7px;
  background: #fff;
  color: #64748b;
}

.form-step-nav button.active {
  background: #0f172a;
  border-color: #0f172a;
  color: #fff;
}

.record-name-button,
.inline-link,
.detail-contact {
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
  cursor: pointer;
}

.inline-link {
  color: #0369a1;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.detail-hero {
  display: grid;
  gap: 10px;
  padding: 20px;
  border-radius: 18px;
  background: #f8fafc;
}

.detail-contact {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border-radius: 12px;
  background: #fff;
  color: #0369a1;
}

.detail-contact span {
  color: #64748b;
  font-size: 0.78rem;
}

.detail-menu {
  display: grid;
  gap: 12px;
  margin: 14px 0;
}

.detail-menu section {
  border: 1px solid #e2e8f0;
  border-radius: 15px;
  padding: 16px;
}

.detail-menu h3 {
  margin-top: 0;
}

.detail-menu dl {
  display: grid;
  grid-template-columns: 90px 1fr;
  gap: 8px;
  margin: 0;
}

.detail-menu dt {
  color: #64748b;
}

.detail-menu dd {
  margin: 0;
}

.detail-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.action-sheet {
  position: fixed;
  z-index: 100;
  left: 50%;
  bottom: 105px;
  transform: translateX(-50%);
  width: min(92vw, 420px);
  padding: 10px;
  border: 1px solid #dbe3ee;
  border-radius: 18px;
  background: #fff;
  box-shadow: 0 24px 60px rgba(15, 23, 42, 0.28);
}

.action-sheet button {
  width: 100%;
  margin: 4px 0;
}

.mine-tools .backup-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.current-account-card,
.staff-account-row,
.owner-transfer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 15px;
  margin-bottom: 14px;
}

.current-account-card div,
.staff-account-row > div:first-child {
  display: grid;
  gap: 3px;
}

.current-account-card span,
.staff-account-row span {
  color: #64748b;
  font-size: 0.8rem;
}

.staff-account-manager {
  margin: 22px 0;
  padding: 18px;
  border-radius: 18px;
  background: #f8fafc;
}

.create-staff-form {
  display: grid;
  grid-template-columns: repeat(3, 1fr) auto;
  gap: 8px;
  margin-bottom: 14px;
}

.change-password-form {
  display: grid;
  gap: 14px;
  max-width: 620px;
  margin-bottom: 22px;
  padding: 20px;
  border: 1px solid #e2e8f0;
  border-radius: 18px;
  background: #f8fafc;
}

.change-password-form h3 {
  margin: 0;
}

.change-password-form label {
  display: grid;
  gap: 7px;
}

.change-password-form input {
  width: 100%;
}

.turnstile-container {
  min-height: 65px;
}

.create-staff-form input,
.owner-transfer select {
  min-width: 0;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 10px;
  background: #fff;
}

.staff-account-list {
  display: grid;
  gap: 8px;
}

.staff-account-row {
  margin: 0;
  background: #fff;
}

.staff-account-row > div:last-child {
  display: flex;
  gap: 6px;
}

.owner-transfer label {
  display: grid;
  gap: 5px;
  flex: 1;
}

@media (max-width: 680px) {
  .intro {
    padding-bottom: 12px;
  }

  .intro-text {
    display: none;
  }

  .home-stats,
  .recognition-summary {
    grid-template-columns: 1fr;
  }

  .draft-field:last-child {
    grid-column: auto;
  }

  .bottom-nav {
    bottom: 8px;
    width: calc(100vw - 18px);
    grid-template-columns: repeat(4, 1fr);
  }

  .intake-entry,
  .chat-intake-panel,
  .chat-review-panel,
  .detail-view,
  .mine-view,
  .form-panel,
  .records-panel {
    border-radius: 18px;
    padding: 16px;
  }

  .detail-contact {
    flex-direction: column;
  }

  .create-staff-form {
    grid-template-columns: 1fr;
  }

  .current-account-card,
  .staff-account-row,
  .owner-transfer {
    align-items: stretch;
    flex-direction: column;
  }
}

/* V1.6 bilingual premium mobile system */
:root {
  --bg: #f4f5f7;
  --bg-soft: #eef1f5;
  --surface: #ffffff;
  --surface-strong: #ffffff;
  --surface-muted: #f7f8fa;
  --text: #172033;
  --text-inverse: #ffffff;
  --muted: #7b8494;
  --muted-inverse: #b9c2d2;
  --line: #dde2ea;
  --line-dark: #26334a;
  --gold: #c79a3b;
  --gold-dark: #8f6a22;
  --danger: #b6473e;
  --shadow: 0 10px 28px rgba(15, 26, 46, 0.07);
}

body {
  min-width: 320px;
  padding-bottom: 82px;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Noto Sans", "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

.app-shell {
  width: 100%;
  margin: 0;
  padding: 0 0 28px;
}

.intro {
  position: sticky;
  z-index: 45;
  top: 0;
  width: 100%;
  height: 76px;
  max-width: none;
  margin: 0;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  background: #0f1a2e;
  color: #fff;
  box-shadow: 0 4px 18px rgba(15, 26, 46, 0.14);
}

.intro::before {
  display: none;
}

.intro-copy {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.brand-name {
  flex: 0 0 auto;
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -0.02em;
}

.intro h1 {
  overflow: hidden;
  margin: 0;
  color: #fff;
  font-size: 19px;
  line-height: 1.2;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions,
.header-account {
  display: flex;
  align-items: center;
}

.header-actions {
  flex: 0 0 auto;
  gap: 9px;
}

.locale-toggle {
  min-height: 34px;
  padding: 6px 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  font-size: 13px;
  font-weight: 650;
}

.header-account {
  min-width: 0;
  gap: 8px;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.header-account small {
  display: none;
}

@media (max-width: 680px) {
  .home-stats {
    grid-template-columns: 1fr;
  }
}

.home-stats button {
  min-height: 76px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 12px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

.intro {
  width: 100%;
  max-width: none;
  margin: 0;
  background: #0f1a2e;
}

.home-stats button > span:not(.home-stat-icon) {
  color: var(--text);
  font-size: 15px;
}

.home-stats strong {
  font-size: 27px;
}

.home-stats button > b {
  color: #9aa3b2;
  font-size: 22px;
  font-weight: 400;
}

.home-stat-icon {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
}

.home-stat-icon svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.home-stat-icon.blue { background: #eaf1ff; color: #356edb; }
.home-stat-icon.orange { background: #fff0e8; color: #df6428; }
.home-stat-icon.green { background: #eaf5eb; color: #4f985b; }
.home-stat-icon.purple { background: #f0ecff; color: #6551c7; }

.data-note {
  display: none;
}

.form-panel label > span,
.form-panel fieldset > legend {
  color: #465268;
}

.header-account .account-avatar {
  width: 36px;
  height: 36px;
  background: #c79a3b;
  color: #fff;
  font-size: 14px;
}

.header-account strong {
  max-width: 90px;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-account small {
  display: none;
}

.app-view {
  width: min(920px, 100%);
  margin: 0 auto;
  padding: 24px 20px;
}

.home-view {
  max-width: 920px;
  padding: 28px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  box-shadow: none;
}

.home-welcome h2 {
  margin: 0 0 20px;
  color: var(--text);
  font-size: 27px;
  line-height: 1.2;
  letter-spacing: -0.03em;
}

.home-welcome > span,
.home-welcome > p {
  display: none;
}

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

.home-stats button {
  min-height: 92px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--text);
  box-shadow: 0 5px 16px rgba(15, 26, 46, 0.04);
  text-align: left;
}

.home-stats strong {
  font-size: 30px;
  line-height: 1;
  font-weight: 760;
}

.home-stats span {
  color: #596579;
  font-size: 14px;
  font-weight: 600;
}

.home-primary,
.full-primary {
  min-height: 50px;
  border-radius: 12px;
  background: #c79a3b;
  color: #fff;
  font-size: 15px;
  font-weight: 720;
}

#intakeView.workspace,
.detail-view,
.mine-view {
  max-width: 760px;
}

.form-panel,
.records-panel,
.detail-view,
.mine-view {
  padding: 24px 20px;
  border: 0;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.form-page-heading h2,
.records-heading h2,
.view-heading h2 {
  margin-bottom: 18px;
  font-size: 26px;
  line-height: 1.2;
  letter-spacing: -0.025em;
}

.inline-chat-assistant {
  border-color: #e3d3ac;
  border-radius: 13px;
  background: #fffdf7;
}

.form-step-nav {
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #eef1f5;
}

.form-step-nav button {
  border-radius: 9px;
  color: #6e7788;
  font-size: 13px;
}

.form-step-nav button.active {
  background: #fff;
  color: var(--text);
  box-shadow: 0 2px 8px rgba(15, 26, 46, 0.07);
}

input,
select,
textarea {
  border-color: var(--line);
  border-radius: 11px;
  background: #fff;
  color: var(--text);
}

.client-sticky-toolbar {
  top: 76px;
  margin: 0 -2px 14px;
  padding: 8px 2px;
  background: rgba(244, 245, 247, 0.95);
}

.client-search input,
.filter-button {
  height: 44px;
  border-radius: 11px;
  box-shadow: none;
}

.records-list {
  border-top: 1px solid var(--line);
}

.record-card {
  margin: 0;
  padding: 18px 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.record-topline {
  gap: 12px;
}

.record-card h3 {
  margin: 9px 0 4px;
}

.record-summary {
  padding-top: 12px;
}

.profile-card {
  gap: 12px;
  margin: 0 0 14px;
  padding: 14px 2px 18px;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

.profile-card .account-avatar.large {
  width: 48px;
  height: 48px;
  background: #c79a3b;
  color: #fff;
  font-size: 16px;
}

.profile-card span:not(.account-avatar) {
  color: var(--muted);
}

.mine-menu {
  gap: 0;
  border-top: 1px solid var(--line);
}

.mine-menu button {
  min-height: 58px;
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  font-size: 15px;
  font-weight: 620;
}

.bottom-nav {
  bottom: 0;
  width: 100%;
  max-width: none;
  height: 70px;
  grid-template-columns: repeat(4, 1fr);
  gap: 0;
  padding: 6px max(8px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(8px, env(safe-area-inset-left));
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0;
  background: rgba(255, 255, 255, 0.97);
  box-shadow: 0 -5px 20px rgba(15, 26, 46, 0.06);
}

.bottom-nav button {
  position: relative;
  min-width: 0;
  padding: 4px 3px;
  border-radius: 0;
  background: transparent;
  color: #7b8494;
  font-size: 11px;
  font-weight: 620;
}

.bottom-nav button svg {
  display: block;
  width: 22px;
  height: 22px;
  margin: 0 auto 3px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav button span {
  display: block;
  font-size: 11px;
  line-height: 1.2;
}

.bottom-nav button.active {
  background: transparent;
  color: #a87920;
}

.bottom-nav button.active::after {
  position: absolute;
  left: 50%;
  bottom: 0;
  width: 4px;
  height: 4px;
  transform: translateX(-50%);
  border-radius: 50%;
  background: #c79a3b;
  content: "";
}

.bottom-nav .intake-nav span {
  color: inherit;
}

.filter-sheet,
.action-sheet {
  border-color: var(--line);
  border-radius: 18px 18px 0 0;
  background: #fff;
}

@media (max-width: 680px) {
  .intro {
    height: 72px;
    padding: 0 14px;
  }

  .intro-copy {
    gap: 9px;
  }

  .brand-name {
    font-size: 14px;
  }

  .intro h1 {
    font-size: 17px;
  }

  .locale-toggle {
    padding-inline: 8px;
  }

  .header-account {
    padding: 0;
  }

  .header-account > span:last-child {
    display: block;
  }

  .header-account strong {
    max-width: 54px;
    font-size: 12px;
  }

  .app-view,
  .home-view,
  .form-panel,
  .records-panel,
  .detail-view,
  .mine-view {
    padding: 22px 16px;
  }

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

  .client-sticky-toolbar {
    top: 72px;
  }
}

.header-account small {
  display: none;
}

.home-stats {
  grid-template-columns: 1fr;
}

.home-stats button {
  min-height: 76px;
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) auto 12px;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
}

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

/* V1.5 compact mobile navigation */
.intro {
  max-width: 1180px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
}

.intro-text {
  grid-column: 1 / -1;
}

.header-account {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 150px;
  padding: 10px 12px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  text-align: left;
}

.header-account strong,
.header-account small {
  display: block;
}

.header-account small {
  margin-top: 3px;
  color: var(--muted-inverse);
}

.account-avatar {
  display: grid;
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(145deg, #d7b567, #8d692d);
  color: #111827;
  font-weight: 900;
}

.account-avatar.large {
  width: 62px;
  height: 62px;
  font-size: 1.35rem;
}

#intakeView.workspace {
  display: block;
  max-width: 780px;
}

.inline-chat-assistant {
  grid-column: 1 / -1;
  margin-bottom: 18px;
  border: 1px solid #e4c878;
  border-radius: 15px;
  background: #fffbeb;
}

.inline-chat-assistant summary {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 15px;
  cursor: pointer;
  list-style: none;
}

.inline-chat-assistant summary span {
  color: #92400e;
  font-size: 0.78rem;
}

.inline-chat-body {
  padding: 0 15px 15px;
}

.whatsapp-import-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
}

.whatsapp-import-row .ghost {
  width: auto;
  min-height: 44px;
}

.whatsapp-file-name {
  min-width: 0;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.client-sticky-toolbar {
  position: sticky;
  z-index: 35;
  top: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  margin: 0 -4px 16px;
  padding: 9px 4px;
  background: rgba(246, 240, 230, 0.96);
  backdrop-filter: blur(12px);
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.client-sticky-toolbar.toolbar-hidden {
  transform: translateY(-125%);
  opacity: 0;
  pointer-events: none;
}

.client-search input {
  height: 48px;
  border-radius: 13px;
}

.filter-button {
  min-width: 88px;
  border-color: var(--line);
  border-radius: 13px;
  background: #fff;
}

.filter-button #activeFilterCount:not(:empty),
.mine-menu em {
  display: inline-grid;
  min-width: 20px;
  height: 20px;
  place-items: center;
  border-radius: 999px;
  background: #dc2626;
  color: #fff;
  font-size: 0.72rem;
  font-style: normal;
}

.filter-sheet {
  position: fixed;
  z-index: 90;
  left: 50%;
  bottom: 92px;
  transform: translateX(-50%);
  width: min(92vw, 520px);
  display: grid;
  gap: 14px;
  padding: 20px;
  border: 1px solid #d6cbb9;
  border-radius: 20px;
  background: #fffaf0;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.32);
}

.sheet-heading,
.filter-actions {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.sheet-heading h3 {
  margin: 8px 0;
}

.filter-actions button {
  flex: 1;
}

.records-list {
  max-height: none;
  overflow: visible;
}

.record-open-button {
  border: 0;
  background: transparent;
  color: var(--gold-dark);
}

.record-summary {
  margin-bottom: 0;
}

.status-badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.profile-card {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 18px;
  padding: 18px;
  border-radius: 17px;
  background: #0f172a;
  color: #fff;
}

.profile-card div {
  display: grid;
  gap: 5px;
}

.profile-card strong {
  font-size: 1.2rem;
}

.profile-card span:not(.account-avatar) {
  color: #cbd5e1;
  font-size: 0.82rem;
}

.mine-menu {
  display: grid;
  gap: 9px;
}

.mine-menu button {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px;
  border-color: #e2e8f0;
  border-radius: 14px;
  background: #fff;
  color: #0f172a;
  text-align: left;
}

.mine-menu button b {
  color: #94a3b8;
  font-size: 1.4rem;
}

.mine-subpage {
  min-height: 320px;
}

.mine-tools,
.mine-tools .export-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.archive-review-panel,
.archive-review-card {
  display: grid;
  gap: 12px;
}

.archive-review-card,
.pending-review-note {
  padding: 16px;
  border: 1px solid #e2e8f0;
  border-radius: 15px;
  background: #fff;
}

.archive-review-card h3 {
  margin: 8px 0 0;
}

.archive-review-card dl {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 7px;
  margin: 0;
}

.archive-review-card dd {
  margin: 0;
}

.archive-review-card > div:last-child {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.pending-review-note {
  margin: 12px 0;
  background: #fffbeb;
}

.pending-review-note span,
.pending-review-note strong {
  display: block;
  margin-bottom: 5px;
}

.global-status {
  position: fixed;
  z-index: 120;
  left: 50%;
  bottom: 105px;
  transform: translate(-50%, 15px);
  max-width: min(88vw, 500px);
  margin: 0;
  padding: 11px 16px;
  border-radius: 999px;
  background: #0f172a;
  color: #fff;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

.global-status.visible {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (max-width: 680px) {
  .intro {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .intro h1 {
    font-size: clamp(25px, 7vw, 38px);
  }

  .header-account {
    min-width: 0;
    padding: 7px;
  }

  .header-account > span:last-child {
    display: none;
  }

  .inline-chat-assistant summary {
    align-items: flex-start;
    flex-direction: column;
  }

  .whatsapp-import-row .ghost {
    width: 100%;
  }
}

/* V1.6 final precedence over legacy V1.5 overrides */
.intro {
  display: flex;
  height: 76px;
  padding: 0 20px;
}

.header-account {
  min-width: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.account-avatar,
.profile-card .account-avatar.large {
  background: #c79a3b;
  color: #fff;
}

.client-sticky-toolbar {
  top: 76px;
  background: rgba(244, 245, 247, 0.95);
}

.filter-sheet {
  border-color: var(--line);
  background: #fff;
}

.profile-card {
  padding: 14px 2px 18px;
  border-radius: 0;
  background: transparent;
  color: var(--text);
}

.mine-menu {
  gap: 0;
}

.mine-menu button {
  padding: 0 2px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
}

@media (max-width: 680px) {
  .intro {
    display: flex;
    height: 72px;
    padding: 0 14px;
  }

  .intro h1 {
    font-size: 17px;
  }

  .header-account {
    padding: 0;
  }

  .header-account > span:last-child {
    display: block;
  }

  .client-sticky-toolbar {
    top: 72px;
  }
}

.header-account small {
  display: none;
}
