:root {
  color-scheme: light;
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-muted: #eef3f2;
  --line: #d9e2df;
  --text: #17201d;
  --muted: #63736e;
  --accent: #0aa66a;
  --accent-dark: #078052;
  --warning: #9b5c00;
  --danger: #a43a3a;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
textarea {
  font: inherit;
}

.app-shell {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 24px;
  overflow: auto;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 24px;
}

.mark {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: #fff;
  font-weight: 800;
  background: linear-gradient(135deg, #0cc96f, #098f62);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
}

.brand p,
.toolbar p,
.hint,
.meta,
.detail-empty,
.empty-state span {
  color: var(--muted);
}

.panel {
  border-top: 1px solid var(--line);
  padding: 18px 0;
}

.panel-head,
.toolbar,
.button-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.panel h2,
.toolbar h2 {
  font-size: 16px;
}

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

.status-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: var(--surface-muted);
}

.status-item strong {
  display: block;
  margin-bottom: 4px;
}

.path {
  overflow-wrap: anywhere;
  font-size: 12px;
  color: var(--muted);
}

.icon-btn,
.primary-btn,
.secondary-btn,
.secondary-full-btn,
.file-btn {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
}

.icon-btn {
  width: 34px;
  height: 34px;
}

.primary-btn,
.secondary-btn,
.secondary-full-btn,
.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 14px;
  width: 100%;
}

.primary-btn {
  color: white;
  border-color: var(--accent);
  background: var(--accent);
  margin-bottom: 10px;
}

.secondary-full-btn {
  margin-bottom: 10px;
}

.primary-btn:hover {
  background: var(--accent-dark);
}

.secondary-btn {
  width: 50%;
}

.file-btn input {
  display: none;
}

.hint {
  margin-top: 10px;
  font-size: 13px;
  line-height: 1.5;
}

.log-box {
  max-height: 220px;
  overflow: auto;
  margin: 12px 0 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111916;
  color: #d8efe6;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.toolbar {
  min-height: 72px;
  margin-bottom: 18px;
}

.filters {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 420px;
}

.filters input[type="search"] {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: var(--surface);
}

.check {
  white-space: nowrap;
  color: var(--muted);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(360px, 1fr) 380px;
  gap: 18px;
  align-items: start;
}

.contact-list-wrap,
.detail-panel {
  min-height: calc(100vh - 132px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.contact-list {
  display: grid;
}

.contact-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  background: transparent;
}

.contact-row:hover,
.contact-row.active {
  background: #edf8f3;
}

.contact-row.archived {
  opacity: 0.58;
}

.name {
  font-weight: 700;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.meta {
  margin-top: 4px;
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.tag {
  border-radius: 999px;
  padding: 3px 8px;
  background: #dcefeb;
  color: #16604d;
  font-size: 12px;
  line-height: 1.5;
}

.empty-state,
.detail-empty {
  display: grid;
  place-items: center;
  align-content: center;
  min-height: 260px;
  gap: 8px;
  text-align: center;
  padding: 24px;
}

.detail-panel {
  padding: 18px;
  position: sticky;
  top: 24px;
}

.detail-title {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.detail-title h3 {
  margin: 0 0 6px;
  font-size: 22px;
}

.form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  font-size: 13px;
  color: var(--muted);
}

.field input,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fff;
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.save-state {
  min-height: 20px;
  color: var(--accent-dark);
  font-size: 13px;
}

@media (max-width: 960px) {
  .app-shell,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .sidebar {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .toolbar,
  .filters {
    align-items: stretch;
    flex-direction: column;
    min-width: 0;
  }

  .detail-panel {
    position: static;
  }
}
