:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --primary: #1890ff;
  --primary-hover: #40a9ff;
  --primary-soft: #e6f7ff;
  --primary-soft-hover: #bae7ff;
  --text: #262626;
  --text-secondary: #8c8c8c;
  --border: #f0f0f0;
  --success-bg: #f6ffed;
  --success-border: #b7eb8f;
  --success-text: #389e0d;
  --error-bg: #fff2f0;
  --error-border: #ffccc7;
  --error-text: #cf1322;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.03), 0 1px 6px -1px rgba(0, 0, 0, 0.02);
  --radius: 8px;
  --nav: #001529;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--nav);
  color: rgba(255, 255, 255, 0.85);
  padding: 20px 14px;
}

.brand {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  padding: 8px 12px 20px;
  letter-spacing: 0.02em;
}

.nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.75);
  transition: background 0.15s ease, color 0.15s ease;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.nav a.active {
  background: var(--primary);
  color: #fff;
}

.main {
  padding: 28px 24px 48px;
}

.page {
  max-width: 860px;
  margin: 0 auto;
}

.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.header h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.status-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  border: 1px solid var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
  white-space: nowrap;
}

.status-tag.error {
  border-color: var(--error-border);
  background: var(--error-bg);
  color: var(--error-text);
}

.status-tag.loading {
  border-color: #91d5ff;
  background: var(--primary-soft);
  color: var(--primary);
}

.status-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.btn {
  appearance: none;
  border: none;
  cursor: pointer;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 16px;
  transition: background 0.2s ease, color 0.2s ease, opacity 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

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

.btn-refresh,
.btn-soft {
  background: var(--primary-soft);
  color: var(--primary);
}

.btn-refresh:hover:not(:disabled),
.btn-soft:hover:not(:disabled) {
  background: var(--primary-soft-hover);
}

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

.btn-primary:hover:not(:disabled) {
  background: var(--primary-hover);
}

.btn-danger {
  background: var(--error-bg);
  color: var(--error-text);
  border: 1px solid var(--error-border);
}

.btn-danger:hover:not(:disabled) {
  background: #ffccc7;
}

.btn-visit {
  background: var(--primary);
  color: #fff;
  min-width: 72px;
}

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

.btn-visit.disabled {
  background: #d9d9d9;
  color: #fff;
  pointer-events: none;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  padding: 20px 22px;
}

.card + .card {
  margin-top: 16px;
}

.card-title {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.card-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
}

.tile {
  display: block;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  box-shadow: var(--shadow);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.tile:hover {
  border-color: #91d5ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.08);
}

.tile h2 {
  font-size: 16px;
  margin-bottom: 6px;
}

.tile p {
  font-size: 13px;
  color: var(--text-secondary);
}

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

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.row:hover {
  border-color: #91d5ff;
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.08);
}

.row-info {
  min-width: 0;
  flex: 1;
}

.row-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
  align-items: center;
}

.domain-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}

.domain,
.note-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  word-break: break-all;
}

.desc,
.note-preview {
  font-size: 14px;
  font-weight: 400;
  color: #262626;
}

.note-preview {
  margin-top: 4px;
  color: var(--text-secondary);
  white-space: pre-wrap;
  word-break: break-word;
}

.resolved {
  margin-top: 4px;
  font-size: 13px;
  color: var(--primary);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  word-break: break-all;
}

.resolved.pending {
  color: var(--text-secondary);
}

.resolved.fail {
  color: var(--error-text);
}

.meta {
  margin-top: 16px;
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.form {
  display: grid;
  gap: 12px;
  margin-bottom: 18px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 10px;
}

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

input,
textarea,
select {
  width: 100%;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: #fff;
  outline: none;
  box-shadow: none;
}

select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238c8c8c' d='M1.4 1.4L6 6l4.6-4.6L12 2.8 6 8.8 0 2.8z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  background-size: 10px 7px;
  padding-right: 28px;
  cursor: pointer;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(24, 144, 255, 0.15);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.empty {
  text-align: center;
  padding: 36px 12px;
  color: var(--text-secondary);
  font-size: 14px;
}

.tag-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}

.tag-chip {
  appearance: none;
  border: 1px solid #d9d9d9;
  background: #fff;
  color: var(--text-secondary);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tag-chip:hover {
  border-color: #91d5ff;
  color: var(--primary);
}

.tag-chip.active {
  background: var(--primary-soft);
  border-color: #91d5ff;
  color: var(--primary);
  font-weight: 500;
}

.note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.note-tag {
  display: inline-block;
  font-size: 11px;
  line-height: 1.4;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
}

.note-tag.muted {
  background: #f5f5f5;
  color: var(--text-secondary);
}

.row.note-compact {
  padding: 10px 12px;
  gap: 10px;
}

.row.note-compact .note-title {
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row.note-compact .note-preview {
  margin-top: 2px;
  font-size: 12px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.row.note-compact .note-meta {
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-secondary);
}

.row.note-compact .row-actions .btn {
  padding: 4px 10px;
  font-size: 12px;
  min-width: auto;
}

.list.compact {
  gap: 8px;
}

.modal-mask {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-mask.open {
  display: flex;
}

.modal {
  width: min(560px, 100%);
  max-height: min(80vh, 720px);
  overflow: auto;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  padding: 20px 22px;
}

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

.modal-header h2 {
  font-size: 18px;
  font-weight: 600;
  word-break: break-word;
}

.modal-close {
  appearance: none;
  border: none;
  background: transparent;
  color: var(--text-secondary);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.modal-close:hover {
  color: var(--text);
}

.modal-body {
  font-size: 14px;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
  line-height: 1.7;
}

.modal-footer {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.modal-footer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-bar {
  display: grid;
  grid-template-columns: 1.4fr 110px 120px 1fr 1fr auto;
  gap: 8px;
  margin-bottom: 14px;
  align-items: center;
}

.search-bar select,
.search-bar input {
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  background-color: #fff;
  color: var(--text);
  box-shadow: none;
}

.search-bar select {
  padding-right: 28px;
}

.modal .form {
  margin-bottom: 0;
}

.modal .form-row.notes {
  margin-top: 4px;
}

@media (max-width: 960px) {
  .search-bar {
    grid-template-columns: 1fr 1fr;
  }
}

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: linear-gradient(160deg, #f0f2f5 0%, #e6f4ff 100%);
}

.login-card {
  width: min(400px, 100%);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 28px 24px;
}

.login-card h1 {
  font-size: 22px;
  margin-bottom: 8px;
}

.login-desc {
  font-size: 13px;
  color: var(--text-secondary);
  margin-bottom: 18px;
}

.login-remember {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-secondary);
  user-select: none;
}

.login-remember input {
  width: auto;
}

.login-msg {
  margin-top: 12px;
  font-size: 13px;
  color: var(--text-secondary);
  min-height: 1.2em;
}

.login-msg.error {
  color: var(--error-text);
}

.nav-order-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-order-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  font-size: 14px;
}

.nav-order-item input {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  padding: 6px 10px;
}

.nav-order-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.nav-order-actions .btn {
  padding: 4px 10px;
  font-size: 12px;
}

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

  .sidebar {
    padding: 14px;
  }

  .nav {
    flex-direction: row;
    flex-wrap: wrap;
  }

  .brand {
    padding-bottom: 12px;
  }

  .main {
    padding: 20px 14px 36px;
  }

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

  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .row-actions {
    width: 100%;
  }

  .row-actions .btn,
  .btn-visit {
    flex: 1;
  }
}
