:root {
  --bg: #f5f6f8;
  --panel: #ffffff;
  --border: #e3e5ea;
  --text: #1f2328;
  --muted: #6b7280;
  --accent: #2f6feb;
  --accent-soft: #e8f0fe;
  --shadow: 0 1px 3px rgba(0,0,0,.04), 0 4px 12px rgba(0,0,0,.04);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }
code { background: #eef0f3; padding: 1px 6px; border-radius: 4px; font-size: .92em; }

/* 顶部条 */
.topbar {
  height: 52px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 20px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { font-weight: 600; font-size: 16px; }
.topbar .crumb { color: var(--muted); font-size: 14px; }

/* 主页网格 */
.home .grid-wrap { padding: 28px 24px; }
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 16px;
}
.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 20px 16px;
  text-align: center;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
  display: block;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow);
  border-color: var(--accent);
}
.card-icon { font-size: 36px; line-height: 1; margin-bottom: 10px; }
.card-name { font-weight: 600; font-size: 15px; }
.card-desc { color: var(--muted); font-size: 12.5px; margin-top: 6px; }

.empty {
  text-align: center;
  color: var(--muted);
  padding: 80px 20px;
}
.empty h2 { color: var(--text); margin-bottom: 8px; }

/* 工具页 layout */
.frame { height: 100vh; display: flex; flex-direction: column; }
.layout {
  flex: 1;
  display: flex;
  min-height: 0;
}
.sidebar {
  width: 220px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 12px 8px;
  overflow-y: auto;
  flex-shrink: 0;
  transition: width 0.2s ease;
}
/* 折叠后侧边栏只留图标 */
.layout.collapsed .sidebar {
  width: 56px;
  padding: 12px 4px;
}
.layout.collapsed .side-text {
  display: none;
}
.layout.collapsed .side-item {
  justify-content: center;
  padding: 8px 4px;
}
.layout.collapsed .home-link {
  font-size: 18px;
}
/* 顶部按钮 */
.toggle-btn {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 6px;
  width: 32px;
  height: 32px;
  cursor: pointer;
  font-size: 16px;
  margin-right: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.toggle-btn:hover { background: #eef0f3; }
.side-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.side-item:hover { background: #eef0f3; }
.side-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.side-icon { font-size: 16px; }
.home-link {
  color: var(--muted);
  margin-bottom: 8px;
  border-bottom: 1px solid var(--border);
  border-radius: 0;
  padding-bottom: 12px;
}

.content { flex: 1; min-width: 0; background: #fff; }
.content iframe {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
}

/* 占位页 */
.placeholder { background: #fafbfc; }
.placeholder-box {
  max-width: 480px;
  margin: 80px auto;
  padding: 40px 32px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: center;
}
.ph-icon { font-size: 56px; margin-bottom: 12px; }
.placeholder-box h1 { margin: 0 0 12px; font-size: 22px; }
.placeholder-box p { color: var(--muted); margin: 8px 0; }
