/**
 * RNS Announcements table.
 *
 * Two modes set by the Style Manager:
 *  .rnsa--managed — a chosen preset/custom palette, plus an aggressive
 *                   theme-reset so no theme can restyle the widget
 *                   (!important is deliberate there).
 *  .rnsa--inherit — minimal structure only; the site theme's colours,
 *                   links and table styles show through.
 */

.rnsa {
	--rnsa-grid: #e1e0d9;
	--rnsa-plane: rgba(127, 127, 127, .07);
	--rnsa-ink2: #52514e;
	max-width: 100%;
	overflow-x: clip;
}

/* ------------------------------------------------------------ theme reset */

.rnsa--managed .rnsa-table a,
.rnsa--managed .rnsa-table a:visited {
	background: none !important;
	background-image: none !important;
	border: 0 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0 !important;
	display: inline !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	font-size: inherit !important;
	line-height: inherit !important;
	text-align: left !important;
	width: auto !important;
	min-width: 0 !important;
	color: var(--rnsa-navy, #1d2a5a) !important;
	text-decoration: none !important;
}
.rnsa--managed .rnsa-table a:hover { text-decoration: underline !important; }

.rnsa--managed .rnsa-table,
.rnsa--managed .rnsa-table tr,
.rnsa--managed .rnsa-table td,
.rnsa--managed .rnsa-table th {
	border-left: 0 !important;
	border-right: 0 !important;
	box-shadow: none !important;
	text-transform: none !important;
}

.rnsa--managed .rnsa-table {
	border-collapse: collapse !important;
	border: 1px solid var(--rnsa-grid) !important;
}

.rnsa--managed .rnsa-table td {
	background: var(--rnsa-rowbg, #fff) !important;
	color: var(--rnsa-ink, #1a1a19) !important;
	/* Themes love resetting td borders — force the row separators back on. */
	border-top: 0 !important;
	border-bottom: 1px solid var(--rnsa-grid) !important;
}
.rnsa--managed .rnsa-table tbody tr:last-child td { border-bottom: 0 !important; }
.rnsa--managed .rnsa-table thead th { border-top: 0 !important; border-bottom: 0 !important; }

.rnsa--managed button.rnsa-tab,
.rnsa--managed button.rnsa-page {
	background-image: none !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	text-transform: none !important;
	letter-spacing: normal !important;
	line-height: 1.4 !important;
	min-height: 0 !important;
	width: auto !important;
	margin: 0 !important;
}
.rnsa--managed button.rnsa-tab { border: 0 !important; color: #fff !important; }

.rnsa--managed .rnsa-controls label { display: inline-flex !important; margin: 0 !important; white-space: nowrap; font-weight: 400 !important; }
.rnsa--managed .rnsa-show select,
.rnsa--managed .rnsa-filter input {
	width: auto !important; min-height: 0 !important; box-shadow: none !important;
	background: #fff !important; color: #1a1a19 !important;
	display: inline-block !important; margin: 0 !important;
}
.rnsa--managed .rnsa-badge { color: #fff !important; border: 0 !important; }

/* ------------------------------------------------------------------ tabs */

.rnsa-tabs {
	display: flex; flex-wrap: wrap; gap: 2px;
	background: var(--rnsa-tabbar, #8f949f); border-radius: 6px; overflow: hidden; padding: 0;
}

.rnsa-tab {
	background: transparent; color: #fff; border: 0; cursor: pointer;
	padding: 12px 20px; font-size: 1em; font-weight: 500;
}
.rnsa-tab:hover { background: rgba(255,255,255,.15); }
.rnsa-tab.is-active { background: var(--rnsa-tabactive, #565b66); font-weight: 700; }

.rnsa--inherit .rnsa-tabs { background: transparent; gap: 6px; }
.rnsa--inherit .rnsa-tab { color: inherit; border: 1px solid currentColor; border-radius: 6px; }
.rnsa--inherit .rnsa-tab.is-active { font-weight: 700; background: var(--rnsa-plane); }

/* -------------------------------------------------------------- controls */

.rnsa-controls {
	display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
	margin: 16px 0 12px;
}

.rnsa-show { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.rnsa-show select { padding: 5px 8px; border: 2px solid var(--rnsa-navy, #1d2a5a); border-radius: 6px; }

.rnsa-filter { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.rnsa-filter input {
	padding: 8px 12px; border: 2px solid var(--rnsa-navy, #1d2a5a); border-radius: 6px; min-width: 220px;
}

.rnsa--inherit .rnsa-show select, .rnsa--inherit .rnsa-filter input { border-color: currentColor; }

.rnsa-status { display: inline-flex; align-items: center; gap: 6px; font-size: .85em; color: var(--rnsa-ink2); }
.rnsa-dot { width: 9px; height: 9px; border-radius: 50%; background: #c3c2b7; display: inline-block; }
.rnsa-dot.is-ok { background: #0ca30c; animation: rnsa-pulse 2s infinite; }
.rnsa-dot.is-err { background: #d03b3b; }
@keyframes rnsa-pulse { 50% { opacity: .4; } }

/* ----------------------------------------------------------------- table */

.rnsa-table-wrap { overflow-x: auto; }

.rnsa-table { width: 100%; border-collapse: collapse; }

.rnsa-table thead th {
	background: var(--rnsa-head, #9aa0ab); color: #fff; text-align: left;
	padding: 10px 14px; font-weight: 600; white-space: nowrap;
}
.rnsa-table thead th.rnsa-col-time { text-align: center; }
.rnsa--inherit .rnsa-table thead th { background: transparent; color: inherit; border-bottom: 2px solid currentColor; }

.rnsa-table td {
	padding: 12px 14px; border-bottom: 1px solid var(--rnsa-grid);
	vertical-align: middle;
}
.rnsa--managed .rnsa-table tbody tr:hover td { filter: brightness(.96); }

.rnsa-col-time { white-space: nowrap; width: 130px; }
td.rnsa-col-time { color: var(--rnsa-navy, #1d2a5a); font-weight: 600; font-size: .9em; }
.rnsa--managed td.rnsa-col-time { color: var(--rnsa-navy, #1d2a5a) !important; }
.rnsa--inherit td.rnsa-col-time { color: inherit; }
.rnsa-col-source { text-align: center; width: 70px; }

.rnsa-badge {
	display: inline-block; background: var(--rnsa-badge, #1c39bb); color: #fff;
	font-weight: 700; font-size: .8em; padding: 4px 9px; border-radius: 3px;
	letter-spacing: .02em; white-space: nowrap;
}

.rnsa-table a { color: var(--rnsa-navy, #1d2a5a); text-decoration: none; font-weight: 500; }
.rnsa-table a:hover { text-decoration: underline; }
.rnsa--inherit .rnsa-table a { color: inherit; }
.rnsa-headline { font-weight: 400; }

.rnsa-new td { animation: rnsa-flash 3s ease-out; }
@keyframes rnsa-flash { 0% { background: #fff3d6; } }

.rnsa-empty { text-align: center; color: var(--rnsa-ink2); padding: 26px !important; }

/* ------------------------------------------------------------ pagination */

.rnsa-foot {
	display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
	margin-top: 14px;
}

.rnsa-showing { font-size: .85em; color: var(--rnsa-ink2); }
.rnsa--inherit .rnsa-showing { color: inherit; opacity: .7; }

.rnsa-pager { margin-left: auto; display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }

.rnsa-page {
	background: var(--rnsa-rowbg, #fff); color: var(--rnsa-navy, #1d2a5a);
	border: 1px solid var(--rnsa-navy, #1d2a5a) !important; border-radius: 6px !important;
	padding: 6px 12px; font-size: .85em; font-weight: 600; cursor: pointer;
}
.rnsa-page:hover:not(:disabled):not(.is-current) { background: var(--rnsa-plane); }
.rnsa-page.is-current { background: var(--rnsa-navy, #1d2a5a); color: #fff; cursor: default; }
.rnsa-page:disabled { opacity: .4; cursor: default; }
.rnsa--inherit .rnsa-page { color: inherit; border-color: currentColor !important; background: transparent; }
.rnsa--inherit .rnsa-page.is-current { background: var(--rnsa-plane); }

.rnsa-ellipsis { color: var(--rnsa-ink2); padding: 0 2px; }

.rnsa-credit { font-size: .78em; color: var(--rnsa-ink2); margin-top: 8px; text-align: right; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 820px) {
	/* Tabs: swipeable strip instead of wrapping into a blob. */
	.rnsa-tabs { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
	.rnsa-tabs::-webkit-scrollbar { display: none; }
	.rnsa-tab { padding: 11px 14px; font-size: .92em; white-space: nowrap; flex: none; }

	.rnsa-filter { margin-left: 0; width: 100%; }
	.rnsa-filter input { flex: 1; min-width: 0; }
	.rnsa-status { order: 3; width: 100%; }
	.rnsa-pager { margin-left: 0; width: 100%; justify-content: center; }
}

@media (max-width: 620px) {
	/* Stack the filter: label text above a full-width input. Deterministic
	   on every theme, no reliance on flex wrapping. */
	.rnsa .rnsa-controls label.rnsa-filter,
	.rnsa--managed .rnsa-controls label.rnsa-filter {
		display: block !important;
		white-space: normal !important;
		width: 100%;
		font-size: .88em;
	}
	.rnsa .rnsa-filter input,
	.rnsa--managed .rnsa-filter input {
		display: block !important;
		width: 100% !important;
		min-width: 0 !important;
		margin-top: 6px !important;
	}
	.rnsa-table-wrap { overflow: visible; }

	/* Card layout: each announcement becomes a block —
	   time + badge on top, company, then the headline. */
	.rnsa-table thead { display: none; }
	.rnsa-table, .rnsa-table tbody { display: block; width: 100%; }
	.rnsa-table tbody tr { display: block; padding: 12px 14px; overflow: hidden; }

	.rnsa--managed .rnsa-table tbody tr {
		background: var(--rnsa-rowbg, #fff);
		border-bottom: 1px solid var(--rnsa-grid) !important;
	}
	.rnsa--inherit .rnsa-table tbody tr { border-bottom: 1px solid var(--rnsa-grid); }

	.rnsa-table td,
	.rnsa--managed .rnsa-table td,
	.rnsa--inherit .rnsa-table td {
		display: block; width: auto;
		padding: 0 !important;
		border: 0 !important;
	}

	.rnsa .rnsa-table td.rnsa-col-time,
	.rnsa--managed .rnsa-table td.rnsa-col-time {
		display: inline-block; width: auto; font-size: .82em; margin-bottom: 4px;
	}
	.rnsa .rnsa-table td.rnsa-col-source,
	.rnsa--managed .rnsa-table td.rnsa-col-source {
		display: inline-block; width: auto; float: right; text-align: right;
	}
	.rnsa-table td:nth-child(3) { font-weight: 600; margin: 2px 0; clear: left; }
	.rnsa-table td:nth-child(4) { margin-top: 2px; }
	.rnsa-headline { display: inline-block; line-height: 1.45; }

	.rnsa-empty { display: block; }

	/* Pager: compact touch targets, drop the word labels via wrapping order. */
	.rnsa-page { padding: 8px 11px; font-size: .82em; }
	.rnsa-foot { justify-content: center; }
	.rnsa-showing { width: 100%; text-align: center; }

	.rnsa-show { font-size: .9em; }
	.rnsa-credit { text-align: center; }
}
