/* table-kit.css — the ONE sitewide table layout.
 *
 * Structure (matches the standardized layout: summary tiles, toolbar,
 * bordered table card, checkbox selection, kebab row actions, pagination
 * footer). Every data table on the site migrates to these classes; page
 * CSS should only add page-specific cell content styles (pills, grades),
 * never its own table chrome.
 *
 *   <section class="tk-summary"> ... .tk-sum-tile ... </section>
 *   <div class="tk-card">
 *     <div class="tk-toolbar"> [add btn] .tk-search [selects] .tk-toolbar-right </div>
 *     <div class="tk-scroll">
 *       <table class="tk-table" data-sortable> ... </table>
 *     </div>
 *     <div class="tk-foot"> (built by TableKit.attach) </div>
 *   </div>
 *
 * Pairs with auth/table-kit.js (pagination, density, selection, kebabs)
 * and auth/table-sort.js (data-sortable headers).
 */

/* ── Summary tiles ──────────────────────────────────────────────── */
.tk-summary {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 12px;
    margin-bottom: 16px;
}
.tk-sum-tile {
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-1, var(--surface));
    border: 1px solid var(--line-2);
    border-radius: var(--r-md);
    padding: 14px 16px;
    text-align: left;
    cursor: default;
}
.tk-sum-tile.tk-clickable { cursor: pointer; transition: border-color 120ms; }
.tk-sum-tile.tk-clickable:hover { border-color: var(--line-3); }
.tk-sum-tile.tk-active { border-color: var(--accent-line); }
.tk-sum-icon {
    width: 38px;
    height: 38px;
    border-radius: var(--r-sm);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--ink-2);
    background: var(--surface-2);
}
.tk-sum-icon.info   { color: var(--info);   background: color-mix(in srgb, var(--info) 10%, var(--bg-1)); }
.tk-sum-icon.danger { color: var(--danger); background: color-mix(in srgb, var(--danger) 10%, var(--bg-1)); }
.tk-sum-icon.warn   { color: var(--warn);   background: color-mix(in srgb, var(--warn) 12%, var(--bg-1)); }
.tk-sum-icon.ok     { color: var(--ok);     background: color-mix(in srgb, var(--ok) 10%, var(--bg-1)); }
.tk-sum-val {
    font: 600 20px/1.1 var(--sans);
    color: var(--ink);
    letter-spacing: -0.01em;
    font-variant-numeric: tabular-nums;
}
.tk-sum-label {
    font-size: 12.5px;
    color: var(--ink-3);
    margin-top: 2px;
}
/* The icon span is OPTIONAL — iconless tiles are legal. .tk-sum-sub is
   the optional third text line; .tk-warn/.tk-danger are tile-level state
   modifiers (cohesion Wave 3d). */
.tk-sum-tile > div { min-width: 0; }
.tk-sum-sub {
    font-size: 11px;
    color: var(--ink-3);
    margin-top: 2px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.tk-sum-tile.tk-warn   { border-color: color-mix(in srgb, var(--warn) 36%, var(--line-2)); }
.tk-sum-tile.tk-danger { border-color: color-mix(in srgb, var(--danger) 42%, var(--line-2)); background: color-mix(in srgb, var(--danger) 8%, var(--bg-1)); }

/* ── Card + toolbar ─────────────────────────────────────────────── */
.tk-card {
    background: var(--bg-1, var(--surface));
    border: 1px solid var(--line-2);
    border-radius: var(--r-lg);
    overflow: hidden;
}
.tk-toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--line);
}
.tk-search {
    flex: 1 1 220px;
    min-width: 160px;
    max-width: 340px;
    padding: 8px 12px;
    font: 400 13.5px/1.3 var(--sans);
    color: var(--ink);
    background: var(--bg-1, var(--surface));
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
}
.tk-search:focus { outline: none; border-color: var(--accent-line); }
.tk-toolbar select {
    padding: 8px 10px;
    font: 400 13px/1.3 var(--sans);
    color: var(--ink-2);
    background: var(--bg-1, var(--surface));
    border: 1px solid var(--line-2);
    border-radius: var(--r-sm);
}
.tk-toolbar-right {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 10px;
}
.tk-count { font-size: 12.5px; color: var(--ink-3); white-space: nowrap; }

/* ── Table ──────────────────────────────────────────────────────── */
.tk-scroll { overflow-x: auto; }
.tk-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 13.5px;
}
.tk-table thead th {
    text-align: left;
    padding: 12px 14px;
    background: var(--bg-1, var(--surface));
    color: var(--ink-3);
    font: 500 13px/1.2 var(--sans);
    border-bottom: 1px solid var(--line-2);
    white-space: nowrap;
}
.tk-table tbody td {
    padding: 13px 14px;
    color: var(--ink-2);
    vertical-align: middle;
    border-bottom: 1px solid var(--line);
}
.tk-table tbody tr:last-child td { border-bottom: none; }
.tk-table tbody tr:hover { background: var(--surface-2); }
.tk-table tbody tr:focus-visible { outline: 2px solid var(--info); outline-offset: -2px; }
.tk-table tbody tr[data-href], .tk-table tbody tr[data-action] { cursor: pointer; }
/* Primary column: the entity name, rendered as a link */
.tk-table .tk-primary a, .tk-table a.tk-link {
    color: var(--link);
    text-decoration: none;
    font-weight: 500;
}
.tk-table .tk-primary a:hover, .tk-table a.tk-link:hover { text-decoration: underline; }
/* Long unbroken strings (domains, serials, fingerprints) must wrap */
.tk-table .tk-break { word-break: break-all; overflow-wrap: anywhere; }
/* Numeric cells */
.tk-table .tk-num { font-variant-numeric: tabular-nums; text-align: right; }

/* Checkbox column */
.tk-table .tk-check { width: 36px; padding-right: 4px; }
.tk-table .tk-check input { accent-color: var(--info); width: 15px; height: 15px; cursor: pointer; }

/* Density: compact rows */
.tk-card.tk-compact .tk-table thead th { padding-top: 8px; padding-bottom: 8px; }
.tk-card.tk-compact .tk-table tbody td { padding-top: 7px; padding-bottom: 7px; }

/* Sort arrows (shared contract with auth/table-sort.js) */
.tk-table thead th:not([data-nosort]) { cursor: pointer; user-select: none; }
.tk-table thead th.sort-asc::after  { content: ' \2191'; color: var(--ink-2); }
.tk-table thead th.sort-desc::after { content: ' \2193'; color: var(--ink-2); }

/* ── Kebab row actions ──────────────────────────────────────────── */
.tk-table .tk-actions { width: 44px; text-align: right; padding-right: 10px; }
.tk-kebab {
    width: 28px;
    height: 28px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: none;
    border-radius: var(--r-sm);
    color: var(--ink-3);
    font: 600 16px/1 var(--sans);
    letter-spacing: 1px;
    cursor: pointer;
}
.tk-kebab:hover { background: var(--surface-2); color: var(--ink); }
.tk-menu {
    position: absolute;
    z-index: 60;
    min-width: 168px;
    background: var(--bg-1, var(--surface));
    border: 1px solid var(--line-2);
    border-radius: var(--r-md);
    box-shadow: 0 8px 24px rgba(16, 24, 40, 0.14);
    padding: 5px;
}
.tk-menu button, .tk-menu a {
    display: block;
    width: 100%;
    text-align: left;
    padding: 8px 10px;
    font: 400 13px/1.3 var(--sans);
    color: var(--ink-2);
    background: none;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    text-decoration: none;
}
.tk-menu button:hover, .tk-menu a:hover { background: var(--surface-2); color: var(--ink); }
.tk-menu .tk-menu-danger { color: var(--danger); }

/* ── Pagination footer ──────────────────────────────────────────── */
.tk-foot {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 18px;
    padding: 10px 14px;
    border-top: 1px solid var(--line);
    font-size: 12.5px;
    color: var(--ink-3);
}
.tk-foot label { display: inline-flex; align-items: center; gap: 7px; }
.tk-foot select {
    padding: 4px 6px;
    font: 400 12.5px/1.2 var(--sans);
    color: var(--ink-2);
    background: var(--bg-1, var(--surface));
    border: 1px solid var(--line-2);
    border-radius: 6px;
}
.tk-foot .tk-page-btns { display: inline-flex; gap: 4px; }
.tk-foot .tk-page-btns button {
    width: 26px;
    height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: none;
    border: 1px solid var(--line-2);
    border-radius: 6px;
    color: var(--ink-2);
    cursor: pointer;
}
.tk-foot .tk-page-btns button:hover:not(:disabled) { background: var(--surface-2); }
.tk-foot .tk-page-btns button:disabled { opacity: 0.35; cursor: default; }

/* ── Empty state ────────────────────────────────────────────────── */
.tk-empty {
    padding: 44px 24px;
    text-align: center;
    color: var(--ink-3);
    font-size: 13.5px;
}
.tk-empty strong { display: block; color: var(--ink-2); font-size: 14.5px; margin-bottom: 4px; }
/* Non-table empty-state variants (cohesion Wave 3d): --slim for inline
   section placeholders, --card for standalone dashed cards, --ok for
   "all clear" tone. Link rule scoped :not([class]) so nested .btn-*
   anchors (e.g. takedowns' empty-state CTA) keep their own styling. */
.tk-empty--slim { padding: 16px 14px; font-size: 13px; }
.tk-empty--card { background: var(--bg-1); border: 1px dashed var(--line-2); border-radius: 8px; }
.tk-empty--ok { color: var(--ok); }
.tk-empty--ok.tk-empty--card { border-color: color-mix(in srgb, var(--ok) 35%, transparent); }
.tk-empty a:not([class]) { color: var(--link); text-decoration: none; }
.tk-empty a:not([class]):hover { text-decoration: underline; }

@media (max-width: 720px) {
    .tk-toolbar { padding: 10px; }
    .tk-search { max-width: none; }
    .tk-foot { justify-content: space-between; gap: 10px; }
}
