:root {
  --bg: #eef3f8;
  --ink: #172033;
  --muted: #687386;
  --line: #d8e0ea;
  --panel: #ffffff;
  --soft: #f7f9fc;
  --brand: #1d64d8;
  --brand-dark: #164ba4;
  --green: #1c8f68;
  --orange: #c96b1d;
  --red: #c24138;
  --gold: #a77512;
  --cyan: #177d92;
  --shadow: 0 18px 45px rgba(26, 44, 75, 0.16);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background:
    linear-gradient(120deg, rgba(29, 100, 216, 0.10), transparent 34%),
    linear-gradient(240deg, rgba(28, 143, 104, 0.11), transparent 32%),
    var(--bg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Microsoft YaHei", sans-serif;
}

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-layout {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(360px, 430px) minmax(420px, 760px);
  gap: 24px;
  justify-content: center;
  align-items: start;
  padding: 24px;
}

.phone-frame {
  width: 100%;
  max-width: 430px;
  min-height: 820px;
  background: #101622;
  border-radius: 28px;
  padding: 12px;
  box-shadow: var(--shadow);
  position: sticky;
  top: 18px;
}

.phone-screen {
  min-height: 796px;
  background: var(--bg);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.status-bar {
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 18px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.84);
  background: #111827;
}

.status-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #5ee2a0;
  margin-left: 5px;
}

.app-header {
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  padding: 14px 16px 12px;
}

.app-topline {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--brand), var(--cyan));
  color: white;
  font-weight: 600;
}

.brand-name {
  font-weight: 600;
  line-height: 1.2;
}

.brand-subtitle {
  margin-top: 2px;
  color: var(--muted);
  font-size: 12px;
}

.app-tag {
  padding: 5px 8px;
  border-radius: 6px;
  background: #eef7f2;
  color: var(--green);
  font-size: 12px;
  white-space: nowrap;
}

.screen-body {
  padding: 14px;
  flex: 1;
  overflow: auto;
}

.bottom-nav {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: var(--panel);
  border-top: 1px solid var(--line);
}

.nav-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 10px 4px 8px;
  display: grid;
  gap: 4px;
  justify-items: center;
  font-size: 12px;
}

.nav-btn.is-active {
  color: var(--brand);
  font-weight: 500;
}

.nav-icon {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  display: grid;
  place-items: center;
  border: 1px solid currentColor;
  font-size: 12px;
}

.hero-panel {
  background: linear-gradient(145deg, #1d64d8, #177d92);
  color: #fff;
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
}

.hero-panel h1,
.hero-panel h2 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.hero-panel p {
  margin: 8px 0 0;
  color: rgba(255, 255, 255, 0.88);
  line-height: 1.6;
}

.surface {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  margin-bottom: 12px;
}

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

.section-title h2,
.section-title h3 {
  margin: 0;
  font-size: 16px;
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
}

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

.service-card {
  min-height: 86px;
  border: 1px solid var(--line);
  background: var(--soft);
  border-radius: var(--radius);
  padding: 12px;
  text-align: left;
}

.service-card strong {
  display: block;
  margin-bottom: 6px;
}

.service-card small {
  display: block;
  color: var(--muted);
  line-height: 1.45;
}

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

.scenario-btn {
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 12px;
  text-align: left;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
}

.scenario-btn strong {
  display: block;
  margin-bottom: 5px;
}

.scenario-btn small {
  color: var(--muted);
  line-height: 1.45;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 6px;
  background: #eef3ff;
  color: var(--brand);
  font-size: 12px;
  white-space: nowrap;
}

.badge.green {
  background: #ebf8f2;
  color: var(--green);
}

.badge.orange {
  background: #fff3e8;
  color: var(--orange);
}

.badge.red {
  background: #fff0ef;
  color: var(--red);
}

.quick-row,
.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.btn {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--panel);
  color: var(--ink);
  padding: 9px 12px;
  min-height: 40px;
}

.btn.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.btn.green {
  background: var(--green);
  border-color: var(--green);
  color: #fff;
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  color: var(--red);
  border-color: #f0b8b2;
  background: #fff7f6;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.chat-wrap {
  display: grid;
  gap: 10px;
}

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

.message {
  max-width: 86%;
  padding: 10px 12px;
  border-radius: 8px;
  line-height: 1.58;
  font-size: 14px;
}

.message.assistant {
  background: var(--panel);
  border: 1px solid var(--line);
  justify-self: start;
}

.message.user {
  background: var(--brand);
  color: #fff;
  justify-self: end;
}

.message.system {
  max-width: 100%;
  background: #fff8e8;
  border: 1px solid #efd390;
  color: #70520f;
  justify-self: stretch;
  font-size: 13px;
}

.chat-input {
  display: grid;
  gap: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px;
}

.chat-input textarea {
  width: 100%;
  min-height: 72px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 10px;
  outline-color: var(--brand);
}

.matter-card {
  display: grid;
  gap: 10px;
}

.matter-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.matter-id {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.info-list {
  display: grid;
  gap: 8px;
  margin: 0;
}

.info-item {
  display: grid;
  grid-template-columns: 84px 1fr;
  gap: 8px;
  line-height: 1.5;
  font-size: 14px;
}

.info-item dt {
  color: var(--muted);
}

.info-item dd {
  margin: 0;
}

.check-list {
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
}

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

.path-item {
  border-left: 4px solid var(--brand);
  background: var(--soft);
  padding: 9px 10px;
  border-radius: 0 7px 7px 0;
}

.path-item:nth-child(2) {
  border-left-color: var(--green);
}

.path-item:nth-child(3) {
  border-left-color: var(--orange);
}

.path-item:nth-child(4) {
  border-left-color: var(--cyan);
}

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

.lawyer-row {
  display: grid;
  grid-template-columns: 46px 1fr;
  gap: 10px;
  align-items: start;
  border: 1px solid var(--line);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 10px;
}

.avatar {
  width: 46px;
  height: 46px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eef3ff;
  color: var(--brand);
  font-weight: 600;
}

.lawyer-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  margin: 4px 0 8px;
}

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

.metric {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px;
}

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

.metric strong {
  display: block;
  font-size: 24px;
  margin-top: 6px;
}

.split-bar {
  height: 12px;
  overflow: hidden;
  display: flex;
  border-radius: 6px;
  background: var(--line);
}

.split-bar span:nth-child(1) {
  background: var(--brand);
}

.split-bar span:nth-child(2) {
  background: var(--green);
}

.split-bar span:nth-child(3) {
  background: var(--orange);
}

.split-legend {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  font-size: 13px;
}

.dot {
  width: 9px;
  height: 9px;
  display: inline-block;
  border-radius: 50%;
  margin-right: 6px;
}

.dot.blue {
  background: var(--brand);
}

.dot.green {
  background: var(--green);
}

.dot.orange {
  background: var(--orange);
}

.side-panel {
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(216, 224, 234, 0.9);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  position: sticky;
  top: 18px;
}

.side-panel h1 {
  margin: 0;
  font-size: 26px;
  letter-spacing: 0;
}

.side-panel p {
  color: var(--muted);
  line-height: 1.7;
}

.flow-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.flow-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: start;
}

.flow-index {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #eef3ff;
  color: var(--brand);
  font-weight: 600;
}

.flow-item strong {
  display: block;
}

.flow-item small {
  color: var(--muted);
  line-height: 1.5;
}

.notice {
  background: #fff8e8;
  border: 1px solid #efd390;
  border-radius: var(--radius);
  color: #70520f;
  padding: 10px 12px;
  line-height: 1.6;
  font-size: 13px;
}

.empty {
  color: var(--muted);
  background: var(--soft);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  line-height: 1.6;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 18, 32, 0.42);
  display: grid;
  place-items: center;
  z-index: 20;
  padding: 18px;
}

.modal {
  width: min(420px, 100%);
  background: var(--panel);
  border-radius: var(--radius);
  padding: 18px;
  box-shadow: var(--shadow);
}

.modal h2 {
  margin: 0 0 8px;
  font-size: 18px;
}

.modal p {
  color: var(--muted);
  line-height: 1.7;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  background: #111827;
  color: white;
  padding: 10px 14px;
  border-radius: 8px;
  z-index: 30;
  box-shadow: var(--shadow);
}

@media (max-width: 920px) {
  .app-layout {
    display: block;
    padding: 0;
    background: var(--bg);
  }

  .phone-frame {
    max-width: none;
    min-height: 100vh;
    border-radius: 0;
    padding: 0;
    box-shadow: none;
    position: static;
  }

  .phone-screen {
    min-height: 100vh;
    border-radius: 0;
  }

  .side-panel {
    display: none;
  }
}

@media (max-width: 380px) {
  .service-grid,
  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .info-item {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .hero-panel h1,
  .hero-panel h2 {
    font-size: 21px;
  }
}
