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

:root {
  --bg: #fff;
  --bg2: #f9fafb;
  --border: #e5e7eb;
  --text: #111827;
  --text2: #6b7280;
  --text3: #9ca3af;
  --accent: #2563eb;
  --green: #22c55e;
  --amber: #eab308;
  --hover: #f3f4f6;
  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', 'Microsoft YaHei', sans-serif;
  --mono: 'SF Mono', Monaco, Consolas, 'Liberation Mono', monospace;
}

html { font: 13px/1.45 var(--font); color: var(--text); background: var(--bg); }
body { min-height: 100vh; }
a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.app { max-width: 1200px; margin: 0 auto; }

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  padding: 0 16px;
  border-bottom: 1px solid var(--border);
}

.topbar-title { font-size: 13px; letter-spacing: -0.01em; }

.topbar-right { display: flex; align-items: center; gap: 8px; }

.topbar-meta { font-size: 11px; color: var(--text3); font-family: var(--mono); }

.topbar-sep { width: 1px; height: 12px; background: var(--border); }

/* Toolbar */
.toolbar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
}

.toolbar input {
  width: 180px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg);
  color: var(--text);
  font-size: 12px;
  outline: none;
}

.toolbar input:focus { border-color: var(--accent); }
.toolbar input::placeholder { color: var(--text3); }

.tabs { display: flex; gap: 1px; }

.tabs button {
  height: 26px;
  padding: 0 10px;
  border: none;
  background: none;
  color: var(--text2);
  font-size: 12px;
  cursor: pointer;
  border-radius: 4px;
  white-space: nowrap;
}

.tabs button:hover { background: var(--hover); }
.tabs button.on { background: var(--text); color: #fff; }

/* Table */
.tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.tbl {
  width: 100%;
  min-width: 700px;
  border-collapse: collapse;
}

.tbl th {
  position: sticky;
  top: 0;
  z-index: 2;
  text-align: left;
  font-size: 11px;
  font-weight: 500;
  color: var(--text3);
  padding: 6px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--bg2);
  white-space: nowrap;
  user-select: none;
}

.tbl th[data-key] { cursor: pointer; }
.tbl th[data-key]:hover { color: var(--text2); }

.tbl td {
  padding: 5px 12px;
  border-bottom: 1px solid #f3f4f6;
  vertical-align: middle;
  font-size: 13px;
}

.tbl tbody tr { transition: background 0.08s; }
.tbl tbody tr:hover { background: var(--hover); }

/* Columns */
.col-status { width: 28px; text-align: center; }
.col-name { min-width: 100px; }
.col-group { width: 72px; }
.col-desc { min-width: 160px; }
.col-url { min-width: 180px; }
.col-type { width: 56px; }
.col-open { width: 40px; text-align: center; }

/* Dot */
.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

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

/* Name */
.name { font-weight: 600; white-space: nowrap; }

/* Group tag */
.grp {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  white-space: nowrap;
}

.grp-ai { background: #eef2ff; color: #4338ca; }
.grp-file { background: #ecfdf5; color: #15803d; }
.grp-tool { background: #fff7ed; color: #c2410c; }
.grp-ops { background: #fef9c3; color: #a16207; }

/* Desc */
.desc {
  color: var(--text2);
  max-width: 260px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* URL - clickable to copy */
.url {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
  display: block;
}

.url:hover { color: var(--accent); }

/* Type */
.type { font-size: 11px; color: var(--text3); white-space: nowrap; }

/* Open link */
.open-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border-radius: 4px;
  color: var(--text3);
}

.open-link:hover { background: var(--hover); color: var(--accent); }

.open-link svg { width: 14px; height: 14px; }

/* Empty */
.empty { text-align: center; padding: 40px; color: var(--text3); font-size: 12px; }

/* Toast */
.toast {
  position: fixed;
  bottom: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(60px);
  background: var(--text);
  color: #fff;
  padding: 5px 14px;
  border-radius: 4px;
  font-size: 12px;
  opacity: 0;
  transition: all 0.2s;
  z-index: 99;
  pointer-events: none;
}

.toast.show { transform: translateX(-50%) translateY(0); opacity: 1; }

/* Mobile list - hidden on desktop */
.mlist { display: none; }

/* === Mobile === */
@media (max-width: 740px) {
  .topbar { padding: 0 12px; }
  .toolbar { padding: 6px 12px; flex-wrap: wrap; }
  .toolbar input { width: 100%; order: -1; }
  .tabs { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; width: 100%; }
  .tabs::-webkit-scrollbar { display: none; }

  /* Hide table, show list */
  .tbl-wrap { display: none; }
  .mlist { display: block; }

  .mrow {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 9px 12px;
    border-bottom: 1px solid #f3f4f6;
    -webkit-tap-highlight-color: transparent;
  }

  .mrow:active { background: var(--hover); }

  .mrow-dot {
    flex-shrink: 0;
    width: 6px;
    height: 6px;
    border-radius: 50%;
  }

  .mrow-dot-g { background: var(--green); }
  .mrow-dot-y { background: var(--amber); }

  .mrow-body {
    flex: 1;
    min-width: 0;
  }

  .mrow-top {
    display: flex;
    align-items: center;
    gap: 6px;
  }

  .mrow-name {
    font-weight: 600;
    font-size: 13px;
    white-space: nowrap;
  }

  .mrow-grp {
    flex-shrink: 0;
    padding: 0 5px;
    border-radius: 3px;
    font-size: 10px;
    font-weight: 500;
    line-height: 18px;
  }

  .mrow-desc {
    font-size: 11px;
    color: var(--text3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-top: 1px;
  }

  .mrow-url {
    flex-shrink: 0;
    font-family: var(--mono);
    font-size: 10px;
    color: var(--text3);
    white-space: nowrap;
    cursor: pointer;
  }

  .mrow-url:active { color: var(--accent); }

  .mrow-go {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    color: var(--text3);
  }

  .mrow-go svg { width: 12px; height: 12px; }
  .mrow-go:active { color: var(--accent); }
}

@media (max-width: 480px) {
  .topbar { height: 36px; }
  .toolbar input { height: 30px; }
  .tabs button { font-size: 11px; height: 24px; padding: 0 8px; }
  .mrow { padding: 7px 10px; gap: 6px; }
  .mrow-name { font-size: 12px; }
  .mrow-grp { font-size: 9px; }
  .mrow-desc { font-size: 10px; }
  .mrow-url { font-size: 9px; }
}
