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

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
                 "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
    background: #f0f2f5;
    color: #333;
    min-height: 100vh;
}

.app-container {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* 顶部栏 */
.top-bar {
    height: 56px;
    background: #fff;
    display: flex;
    align-items: center;
    padding: 0 24px;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
    z-index: 100;
}

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

.logo-icon {
    font-size: 24px;
}

.logo-text {
    font-size: 18px;
    font-weight: 600;
    color: #1a1a2e;
}

/* 主体布局 */
.main-body {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* 侧边栏 */
.sidebar {
    width: 240px;
    background: #fff;
    border-right: 1px solid #e8e8e8;
    overflow-y: auto;
    flex-shrink: 0;
}

.menu {
    padding: 12px 0;
}

.sidebar-footer {
    padding: 12px 16px;
    font-size: 11px;
    color: #bbb;
    border-top: 1px solid #f0f0f0;
    text-align: center;
}

/* 页面底部备案号 */
.app-footer {
    text-align: center;
    padding: 10px 0;
    font-size: 12px;
    color: #999;
    background: #fff;
    border-top: 1px solid #f0f0f0;
    margin-top: auto;
    flex-shrink: 0;
}

/* 方案复制关系：竖向卡片 */
.copy-log-table-wrap {
    width: 100%;
}
.copy-log-card {
    background: #fff;
    border: 1px solid #f0f0f0;
    border-radius: 8px;
    padding: 16px 20px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,.04);
}
.copy-log-card-num {
    font-size: 12px;
    color: #1677FF;
    font-weight: 600;
    margin-bottom: 10px;
    background: #e6f4ff;
    display: inline-block;
    padding: 2px 10px;
    border-radius: 3px;
}
.copy-log-section-title {
    font-size: 13px;
    font-weight: 600;
    color: #555;
    margin: 10px 0 6px 0;
    padding-bottom: 4px;
    border-bottom: 1px dashed #e8e8e8;
}
.copy-log-row {
    display: flex;
    padding: 4px 0;
    font-size: 13px;
}
.copy-log-label {
    color: #999;
    min-width: 140px;
    flex-shrink: 0;
}
.copy-log-val {
    color: #333;
    word-break: break-all;
}
.uid-val {
    font-family: "Consolas", "Courier New", monospace;
    font-size: 12px;
}

.view-toggle {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-left: auto;
    margin-right: 12px;
}
.btn-sm {
    height: 28px;
    padding: 0 12px;
    font-size: 12px;
}
.btn-link {
    background: none;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    color: #1677FF;
    cursor: pointer;
}
.btn-link:hover {
    border-color: #1677FF;
    background: #e6f4ff;
}

.menu-group {
    border-bottom: 1px solid #f5f5f5;
}

.menu-group-title {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    color: #333;
    gap: 8px;
    transition: background 0.2s;
    user-select: none;
}

.menu-group-title:hover {
    background: #f5f7fa;
}

.menu-group-title.active {
    color: #1677ff;
    background: #e6f4ff;
}

.menu-icon {
    font-size: 16px;
}

.arrow {
    margin-left: auto;
    font-size: 10px;
    transition: transform 0.2s;
}

.menu-group-title.open .arrow {
    transform: rotate(90deg);
}

.menu-group-items {
    display: none;
    background: #fafafa;
}

.menu-group-items.show {
    display: block;
}

.menu-item {
    display: block;
    padding: 10px 20px 10px 44px;
    font-size: 13px;
    color: #555;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 3px solid transparent;
}

.menu-item:hover {
    background: #e6f4ff;
    color: #1677ff;
}

.menu-item.active {
    background: #e6f4ff;
    color: #1677ff;
    border-left-color: #1677ff;
    font-weight: 500;
}

.menu-empty {
    display: block;
    padding: 10px 20px 10px 44px;
    font-size: 12px;
    color: #bbb;
    font-style: italic;
}

/* 二级子目录 */
.sub-group {
    border-top: 1px solid #f0f0f0;
}
.sub-group-title {
    padding: 6px 20px 6px 44px;
    font-size: 11px;
    color: #999;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0.5px;
}
.sub-group-items {
    /* container for sub-items */
}
.sub-item {
    padding-left: 56px !important;
    font-size: 12px !important;
}
.lock-icon {
    color: #faad14;
    margin-left: 2px;
}

/* 密码弹窗 */
.modal-overlay {
    display: none;
    position: fixed; z-index: 9999;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.45);
    justify-content: center; align-items: center;
}
.modal-overlay.show { display: flex; }
.modal-box {
    background: #fff; border-radius: 8px; padding: 24px 28px;
    width: 360px; box-shadow: 0 8px 24px rgba(0,0,0,.15);
}
.modal-box h3 { font-size: 16px; color: #333; margin-bottom: 8px; }
.modal-box .modal-hint { font-size: 12px; color: #999; margin-bottom: 16px; }
.modal-box .modal-error { font-size: 12px; color: #ff4d4f; margin-top: 8px; display: none; }
.modal-box .modal-error.show { display: block; }
.modal-box input {
    width: 100%; height: 36px; border: 1px solid #d9d9d9;
    border-radius: 6px; padding: 0 12px; font-size: 14px; outline: none;
}
.modal-box input:focus { border-color: #1677ff; box-shadow: 0 0 0 2px rgba(22,119,255,.1); }
.modal-actions { margin-top: 16px; display: flex; gap: 10px; justify-content: flex-end; }

/* 内容区 */
.content {
    flex: 1;
    padding: 24px;
    overflow-y: auto;
    background: #f0f2f5;
}

.content-header {
    margin-bottom: 24px;
}

.content-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: #1a1a2e;
    margin-bottom: 4px;
}

.content-header p {
    font-size: 13px;
    color: #999;
}

/* 表单面板 */
.form-panel {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.form-panel h3 {
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 16px;
    color: #1a1a2e;
}

.form-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.form-group {
    display: flex;
    align-items: center;
    gap: 12px;
}

.form-group label {
    width: 80px;
    font-size: 13px;
    color: #555;
    text-align: right;
    flex-shrink: 0;
}

.form-group input,
.form-group select {
    flex: 1;
    max-width: 400px;
    height: 36px;
    padding: 0 12px;
    border: 1px solid #d9d9d9;
    border-radius: 6px;
    font-size: 14px;
    outline: none;
    transition: border-color 0.2s;
    background: #fff;
}

.form-group input:focus,
.form-group select:focus {
    border-color: #1677ff;
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
}

/* 输入历史下拉 */
.input-history-wrap {
    flex: 1;
    max-width: 400px;
    position: relative;
}
.input-history-wrap input {
    width: 100%;
    max-width: 100%;
}
.history-dropdown {
    display: none;
    position: absolute;
    top: 38px;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d9d9d9;
    border-radius: 0 0 6px 6px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 999;
    max-height: 200px;
    overflow-y: auto;
}
.history-item {
    padding: 8px 12px;
    font-size: 13px;
    color: #555;
    cursor: pointer;
    transition: background 0.15s;
    border-bottom: 1px solid #f5f5f5;
}
.history-item:last-child {
    border-bottom: none;
}
.history-item:hover {
    background: #e6f4ff;
    color: #1677ff;
}

.form-actions {
    margin-top: 20px;
    display: flex;
    gap: 12px;
}

/* 按钮 */
.btn {
    height: 36px;
    padding: 0 20px;
    border: none;
    border-radius: 6px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.btn-primary {
    background: #1677ff;
    color: #fff;
}

.btn-primary:hover {
    background: #4096ff;
}

.btn-primary:disabled {
    background: #91caff;
    cursor: not-allowed;
}

.btn-sm {
    height: 28px;
    padding: 0 12px;
    font-size: 12px;
}

.btn-default {
    background: #fff;
    color: #333;
    border: 1px solid #d9d9d9;
}

.btn-default:hover {
    color: #1677ff;
    border-color: #1677ff;
}

/* 加载动画 */
.loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 40px;
    gap: 12px;
    color: #999;
    font-size: 13px;
}

.spinner {
    width: 32px;
    height: 32px;
    border: 3px solid #e8e8e8;
    border-top-color: #1677ff;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

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

/* 结果面板 */
.result-panel {
    background: #fff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

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

.result-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: #1a1a2e;
}

.result-status {
    font-size: 12px;
    padding: 2px 10px;
    border-radius: 10px;
}

.result-status.success {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.result-status.error {
    background: #fff2f0;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
}

/* 数据量提示横幅 */
.more-data-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: #fffbe6;
    border: 1px solid #ffe58f;
    border-radius: 6px;
    padding: 10px 16px;
    margin-bottom: 12px;
    font-size: 13px;
    color: #8c6e00;
}
.more-data-banner .btn {
    flex-shrink: 0;
}

.result-body {
    background: #f8f9fa;
    color: #333;
    padding: 20px;
    border-radius: 6px;
    border: 1px solid #e8e8e8;
    font-size: 13px;
    line-height: 1.7;
    overflow-x: auto;
    word-break: break-all;
    max-height: 500px;
    overflow-y: auto;
    font-family: "SF Mono", "Monaco", "Menlo", "Consolas", "Courier New", monospace;
}

/* 普通 JSON 高亮（保持 pre-wrap） */
.result-body.pre-wrap {
    white-space: pre-wrap;
}

/* 折叠式 JSON */
.json-tree {
    white-space: normal;
}
.json-toggle {
    display: inline-block;
    width: 16px;
    height: 16px;
    cursor: pointer;
    position: relative;
    vertical-align: middle;
    margin-right: 2px;
    user-select: none;
    color: #999;
    font-size: 12px;
    text-align: center;
    line-height: 16px;
}
.json-toggle::before {
    content: '▼';
}
.json-toggle.collapsed::before {
    content: '▶';
}
.json-toggle:hover {
    color: #1677ff;
}
.json-children {
    padding-left: 20px;
    border-left: 1px solid #e0e0e0;
    margin-left: 4px;
    display: block;
}
.json-children.hidden {
    display: none;
}
.json-line {
    line-height: 1.6;
}
.json-index {
    color: #1677ff;
    font-weight: 500;
}
.json-key-wrap {
    white-space: nowrap;
}
.json-count {
    color: #aaa;
    font-size: 11px;
}
.json-punct {
    color: #555;
}
.json-close {
    /* closing bracket - no extra styling needed */
}

/* 结果元信息 */
.result-meta {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.result-meta-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
}

.result-meta-label {
    color: #999;
}

.result-meta-value {
    font-weight: 500;
    color: #333;
}

.result-code-badge {
    display: inline-block;
    padding: 2px 10px;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
}

.result-code-badge.ok {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.result-code-badge.err {
    background: #fff2f0;
    color: #ff4d4f;
    border: 1px solid #ffccc7;
}

/* JSON 键值高亮 */
.json-key {
    color: #881391;
}

.json-string {
    color: #1a6f3c;
}

.json-number {
    color: #1c6bb8;
}

.json-boolean {
    color: #ab5c00;
}

.json-null {
    color: #999;
    font-style: italic;
}

/* 结果工具栏 */
.result-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 12px;
    padding-bottom: 12px;
    border-bottom: 1px solid #f0f0f0;
}

.search-box {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
}

.search-box input {
    flex: 1;
    max-width: 300px;
    height: 30px;
    padding: 0 10px;
    border: 1px solid #d9d9d9;
    border-radius: 4px;
    font-size: 13px;
    outline: none;
    transition: border-color 0.2s;
}

.search-box input:focus {
    border-color: #1677ff;
    box-shadow: 0 0 0 2px rgba(22, 119, 255, 0.1);
}

.search-count {
    font-size: 12px;
    color: #999;
    white-space: nowrap;
    min-width: 50px;
}

.search-count.has-match {
    color: #1677ff;
}

.btn-xs {
    height: 28px;
    padding: 0 12px;
    font-size: 12px;
}

/* 搜索高亮 */
.search-highlight {
    background: #ffd54a;
    color: #1a1a2e;
    border-radius: 2px;
    padding: 0 2px;
}

.search-highlight.current {
    background: #ff9800;
    color: #fff;
}

/* ====== 手机端适配 ====== */
.hamburger {
  display: none;
  font-size: 22px;
  cursor: pointer;
  background: none;
  border: none;
  color: #333;
  padding: 4px 8px;
  line-height: 1;
}
.sidebar-overlay {
  display: none;
}

@media (max-width: 768px) {
  .hamburger { display: block; }

  .top-bar { padding: 0 12px; height: 48px; }
  .top-bar .logo-icon { font-size: 20px; }
  .top-bar .logo-text { font-size: 15px; }

  .sidebar {
    position: fixed;
    top: 48px; left: 0; bottom: 0;
    z-index: 200;
    transform: translateX(-100%);
    transition: transform .25s;
    width: 260px;
    box-shadow: 2px 0 8px rgba(0,0,0,.15);
  }
  .sidebar.mobile-open { transform: translateX(0); }

  .sidebar-overlay {
    display: none;
    position: fixed;
    top: 48px; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.4);
    z-index: 199;
  }
  .sidebar-overlay.show { display: block; }

  .content { padding: 10px; }

  .content-header { margin-bottom: 12px; }
  .content-header h2 { font-size: 16px; }

  .form-panel, .result-panel { padding: 14px; }
  .form-panel h3 { font-size: 14px; margin-bottom: 10px; }

  .form-group {
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
  }
  .form-group label { width: auto; text-align: left; }
  .form-group input,
  .form-group select { max-width: 100%; flex: none; }
  .input-history-wrap { max-width: 100%; }

  .form-actions { flex-wrap: wrap; }
  .form-actions .btn { flex: 1; min-width: 80px; }

  .result-header { flex-direction: column; gap: 8px; align-items: flex-start; }
  .result-toolbar { flex-direction: column; align-items: stretch; }
  .search-box { flex-direction: column; }
  .search-box input { max-width: none; }

  .result-body { font-size: 11px; max-height: 350px; padding: 12px; }

  .modal-box { width: 90vw; padding: 20px; }

  .more-data-banner { flex-direction: column; gap: 8px; align-items: stretch; text-align: center; }

  .btn { height: 38px; font-size: 14px; }

  .app-footer { font-size: 11px; padding: 8px; }

  .config-bar {
    padding: 8px 10px !important;
    flex-direction: column !important;
    gap: 8px !important;
    align-items: stretch !important;
  }
  .config-bar > span[style*="flex:1"] { display: none; }

  .csv-upload-box { height: 36px; justify-content: center; }

  .settings-panel {
    padding: 8px 10px !important;
    gap: 6px !important;
  }
  .settings-panel input { width: 100% !important; }

  .check-inline { gap: 8px; font-size: 11px; flex-wrap: wrap; }

  .tab-bar { overflow-x: auto; padding: 4px 6px 0; gap: 2px; }
  .tab-btn { font-size: 11px; padding: 6px 10px; }
  .tab-add { font-size: 14px; padding: 6px 8px; }

  .btn-row { flex-wrap: wrap; gap: 6px; }
  .btn-row .m-btn { height: 36px; font-size: 13px; flex: 1 1 auto; }

  .log-container { height: 200px; font-size: 11px; padding: 10px; }

  .stats-bar { gap: 12px; }
  .stat-item .num { font-size: 20px; }

  .page-header { padding: 8px 12px; }
  .page-header h2 { font-size: 14px; }

  .copy-log-row { flex-direction: column; gap: 2px; }
  .copy-log-label { min-width: auto; }

  .form-group select,
  .form-group input[type="text"] { width: 100%; }

  .input-history-wrap input { width: 100%; }
}
