/* web/components/SmartTable/SmartTable.css
 * Component-scoped styles for SmartTable. Uses ONLY the global design tokens
 * declared on :root in web/index.html (--bg, --bg-elev, --border, --text,
 * --text-dim, --accent, --accent-strong, --bad). No new tokens introduced.
 *
 * NOTE: index.html sets global `button { width:100% }` and `input { width:100% }`.
 * Every control here uses a scoped .st-* class that resets width/margin so the
 * toolbar and pager don't inherit the full-width login-form styling.
 */

.smart-table { display: flex; flex-direction: column; gap: 0.75rem; }

/* ---- toolbar ---- */
.st-toolbar { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.st-toolbar .st-spacer { flex: 1 1 auto; }
.st-count { color: var(--text-dim); font-size: 0.85rem; }

.st-btn,
.st-select {
  width: auto; margin: 0;
  padding: 0.4rem 0.7rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
}
.st-btn:hover:not(:disabled) { background: var(--border); }
.st-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.st-btn-primary { background: var(--accent-strong); border-color: transparent; color: #fff; }
.st-btn-primary:hover:not(:disabled) { background: var(--accent); }

.st-num {
  width: 3.5rem; margin: 0;
  padding: 0.35rem 0.45rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.85rem;
  text-align: center;
}

/* ---- column show/hide menu ---- */
.st-colmenu { position: relative; }
.st-colmenu-panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 20;
  min-width: 180px; max-height: 320px; overflow: auto;
  padding: 0.4rem;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}
.st-colmenu-item {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.3rem 0.4rem;
  font-size: 0.85rem; color: var(--text);
  border-radius: 6px; cursor: pointer;
}
.st-colmenu-item:hover { background: var(--bg); }
.st-colmenu-item input { width: auto; margin: 0; }
.st-colmenu-item.st-dragging { opacity: 0.5; }
.st-drag-grip { cursor: grab; color: var(--text-dim); user-select: none; line-height: 1; }
.st-colmenu-item:active .st-drag-grip { cursor: grabbing; }

/* ---- table ---- */
.st-scroll {
  overflow: auto; max-height: 60vh;
  border: 1px solid var(--border);
  border-radius: 10px;
}
table.st-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }

.st-table thead th {
  position: sticky; top: 0; z-index: 1;
  background: var(--bg-elev);
  color: var(--text-dim);
  text-align: left; font-weight: 600; white-space: nowrap;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid var(--border);
}
.st-table th.st-sortable { cursor: pointer; user-select: none; }
.st-table th.st-sortable:hover { color: var(--text); }
.st-sort-ind { margin-left: 0.35rem; color: var(--accent); }
.st-sort-ind.st-dim { color: var(--border); }

.st-table tbody td {
  padding: 0.55rem 0.8rem;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.st-table tbody tr:last-child td { border-bottom: none; }
.st-table tbody tr:hover td { background: rgba(148, 163, 184, 0.06); }

.st-align-right { text-align: right; }
.st-align-center { text-align: center; }
.st-empty { padding: 2rem; text-align: center; color: var(--text-dim); }

/* ---- pager ---- */
.st-pager { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; }
.st-pageinfo { color: var(--text-dim); font-size: 0.85rem; margin: 0 0.25rem; }
