/**
 * IPO Hub — front-end styles.
 * Scoped under .ih-wrap so nothing leaks into the host theme.
 */

.ih-wrap {
	--ih-bg: #ffffff;
	--ih-fg: #16202c;
	--ih-muted: #64748b;
	--ih-border: #e2e8f0;
	--ih-accent: #1668dc;
	--ih-accent-fg: #ffffff;
	--ih-green: #0f9d58;
	--ih-red: #d93025;
	--ih-amber: #b45309;
	--ih-radius: 10px;
	--ih-shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);

	color: var(--ih-fg);
	font-size: 15px;
	line-height: 1.5;
	margin: 1.5rem 0;
}

@media (prefers-color-scheme: dark) {
	.ih-wrap {
		--ih-bg: #0f172a;
		--ih-fg: #e2e8f0;
		--ih-muted: #94a3b8;
		--ih-border: #1e293b;
		--ih-shadow: none;
	}
}

.ih-wrap *,
.ih-wrap *::before,
.ih-wrap *::after {
	box-sizing: border-box;
}

.ih-heading {
	font-size: 1.15rem;
	margin: 0 0 .75rem;
	font-weight: 700;
}

.ih-muted {
	color: var(--ih-muted);
}

/* ---------- Toolbar --------------------------------------------------- */

.ih-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: .6rem;
	align-items: center;
	justify-content: space-between;
	margin-bottom: .85rem;
}

.ih-search {
	flex: 1 1 220px;
	min-width: 0;
	padding: .55rem .8rem;
	border: 1px solid var(--ih-border);
	border-radius: var(--ih-radius);
	background: var(--ih-bg);
	color: var(--ih-fg);
	font-size: .92rem;
}

.ih-search:focus {
	outline: 2px solid var(--ih-accent);
	outline-offset: 1px;
}

.ih-filters {
	display: flex;
	gap: .3rem;
	flex-wrap: wrap;
}

.ih-filter {
	padding: .45rem .85rem;
	border: 1px solid var(--ih-border);
	border-radius: 999px;
	background: transparent;
	color: var(--ih-muted);
	font-size: .85rem;
	font-weight: 600;
	cursor: pointer;
	transition: all .15s ease;
}

.ih-filter:hover {
	border-color: var(--ih-accent);
	color: var(--ih-accent);
}

.ih-filter.is-active {
	background: var(--ih-accent);
	border-color: var(--ih-accent);
	color: var(--ih-accent-fg);
}

/* ---------- Tables ----------------------------------------------------- */

.ih-table-scroll {
	overflow-x: auto;
	border: 1px solid var(--ih-border);
	border-radius: var(--ih-radius);
	box-shadow: var(--ih-shadow);
	background: var(--ih-bg);
}

.ih-table {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
	font-size: .9rem;
}

.ih-table th,
.ih-table td {
	padding: .7rem .85rem;
	text-align: left;
	border-bottom: 1px solid var(--ih-border);
	vertical-align: middle;
}

.ih-table thead th {
	background: rgba(148, 163, 184, .1);
	font-size: .78rem;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--ih-muted);
	white-space: nowrap;
}

.ih-table tbody tr:last-child th,
.ih-table tbody tr:last-child td {
	border-bottom: 0;
}

.ih-table tbody tr:hover {
	background: rgba(22, 104, 220, .04);
}

.ih-table--compact th,
.ih-table--compact td {
	padding: .5rem .7rem;
	font-size: .86rem;
}

.ih-table--kv th {
	width: 38%;
	background: rgba(148, 163, 184, .06);
	font-weight: 600;
	white-space: nowrap;
}

.ih-table--compare th[scope="row"] {
	font-weight: 600;
	background: rgba(148, 163, 184, .06);
	white-space: nowrap;
}

.ih-table--compare thead th {
	text-align: center;
	text-transform: none;
	font-size: .9rem;
	color: var(--ih-fg);
}

.ih-table--compare tbody td {
	text-align: center;
}

.ih-row--total {
	font-weight: 700;
	background: rgba(22, 104, 220, .06);
}

.ih-company {
	font-weight: 600;
	text-decoration: none;
	color: var(--ih-accent);
}

.ih-company:hover {
	text-decoration: underline;
}

/* ---------- Chips, status, numbers -------------------------------------- */

.ih-chip {
	display: inline-block;
	padding: .12rem .5rem;
	border-radius: 999px;
	font-size: .7rem;
	font-weight: 700;
	letter-spacing: .03em;
	text-transform: uppercase;
	background: rgba(148, 163, 184, .18);
	color: var(--ih-muted);
	white-space: nowrap;
}

.ih-chip--sme {
	background: rgba(180, 83, 9, .14);
	color: var(--ih-amber);
}

.ih-chip--mainboard {
	background: rgba(22, 104, 220, .12);
	color: var(--ih-accent);
}

.ih-status {
	display: inline-block;
	padding: .16rem .55rem;
	border-radius: 6px;
	font-size: .74rem;
	font-weight: 700;
	white-space: nowrap;
}

.ih-status--open {
	background: rgba(15, 157, 88, .14);
	color: var(--ih-green);
}

.ih-status--upcoming {
	background: rgba(22, 104, 220, .12);
	color: var(--ih-accent);
}

.ih-status--closed {
	background: rgba(100, 116, 139, .16);
	color: var(--ih-muted);
}

.ih-status--listed {
	background: rgba(180, 83, 9, .14);
	color: var(--ih-amber);
}

.ih-x {
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.ih-x.is-over {
	color: var(--ih-green);
}

.ih-x.is-under {
	color: var(--ih-muted);
}

.ih-sub {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	transition: background-color .6s ease;
}

.ih-sub.is-flashing {
	background: rgba(15, 157, 88, .18);
}

/* ---------- GMP -------------------------------------------------------- */

.ih-gmp {
	display: inline-flex;
	align-items: baseline;
	gap: .3rem;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ih-gmp.is-positive strong {
	color: var(--ih-green);
}

.ih-gmp.is-negative strong {
	color: var(--ih-red);
}

.ih-gmp--up {
	color: var(--ih-green);
}

.ih-gmp--down {
	color: var(--ih-red);
}

.ih-gmp--empty {
	color: var(--ih-muted);
}

.ih-gmp__gain {
	font-style: normal;
	font-size: .8rem;
	color: var(--ih-muted);
}

/* ---------- Cards / grid ------------------------------------------------ */

.ih-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
	gap: 1rem;
}

.ih-card {
	border: 1px solid var(--ih-border);
	border-radius: var(--ih-radius);
	padding: 1rem;
	background: var(--ih-bg);
	box-shadow: var(--ih-shadow);
	display: flex;
	flex-direction: column;
	gap: .8rem;
}

.ih-card__head {
	display: flex;
	gap: .7rem;
	align-items: flex-start;
}

.ih-card__logo img {
	width: 44px;
	height: 44px;
	object-fit: contain;
	border-radius: 6px;
}

.ih-card__title {
	font-size: 1rem;
	margin: 0 0 .35rem;
	line-height: 1.3;
}

.ih-card__title a {
	color: inherit;
	text-decoration: none;
}

.ih-card__title a:hover {
	color: var(--ih-accent);
}

.ih-card__head .ih-chip,
.ih-card__head .ih-status {
	margin-right: .25rem;
}

.ih-card__stats {
	display: grid;
	grid-template-columns: repeat(2, 1fr);
	gap: .55rem .8rem;
	margin: 0;
}

.ih-card__stats div {
	min-width: 0;
}

.ih-card__stats dt {
	font-size: .7rem;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--ih-muted);
	font-weight: 700;
	margin: 0 0 .1rem;
}

.ih-card__stats dd {
	margin: 0;
	font-size: .9rem;
	font-weight: 600;
}

/* ---------- Stats strip on detail pages --------------------------------- */

.ih-detail__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: .8rem;
	margin-bottom: 1.4rem;
}

.ih-stat {
	border: 1px solid var(--ih-border);
	border-radius: var(--ih-radius);
	padding: .8rem .9rem;
	background: var(--ih-bg);
	box-shadow: var(--ih-shadow);
}

.ih-stat__label {
	display: block;
	font-size: .72rem;
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--ih-muted);
	font-weight: 700;
	margin-bottom: .25rem;
}

.ih-stat__value {
	display: block;
	font-size: 1.05rem;
	font-weight: 700;
}

/* ---------- Calendar ---------------------------------------------------- */

.ih-calendar__list {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 1px solid var(--ih-border);
	border-radius: var(--ih-radius);
	overflow: hidden;
	background: var(--ih-bg);
}

.ih-calendar__item {
	display: flex;
	gap: .9rem;
	align-items: center;
	padding: .75rem .9rem;
	border-bottom: 1px solid var(--ih-border);
}

.ih-calendar__item:last-child {
	border-bottom: 0;
}

.ih-calendar__date {
	flex: 0 0 46px;
	text-align: center;
	background: rgba(22, 104, 220, .08);
	border-radius: 8px;
	padding: .35rem 0;
}

.ih-calendar__day {
	display: block;
	font-size: 1.15rem;
	font-weight: 800;
	line-height: 1;
	color: var(--ih-accent);
}

.ih-calendar__mon {
	display: block;
	font-size: .68rem;
	text-transform: uppercase;
	font-weight: 700;
	color: var(--ih-muted);
}

.ih-calendar__body a {
	font-weight: 600;
	text-decoration: none;
	color: inherit;
	display: block;
}

.ih-calendar__body a:hover {
	color: var(--ih-accent);
}

.ih-calendar__body small {
	color: var(--ih-muted);
	font-size: .8rem;
}

/* ---------- Buttons ----------------------------------------------------- */

.ih-btn {
	display: inline-block;
	padding: .5rem .9rem;
	border-radius: 8px;
	font-size: .85rem;
	font-weight: 700;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid transparent;
	transition: all .15s ease;
	white-space: nowrap;
}

.ih-btn--primary {
	background: var(--ih-accent);
	color: var(--ih-accent-fg);
}

.ih-btn--primary:hover {
	filter: brightness(1.08);
	color: var(--ih-accent-fg);
}

.ih-btn--ghost {
	border-color: var(--ih-border);
	color: var(--ih-accent);
	background: transparent;
}

.ih-btn--ghost:hover {
	border-color: var(--ih-accent);
}

.ih-btn--small {
	padding: .35rem .7rem;
	font-size: .78rem;
}

.ih-actions {
	display: flex;
	gap: .6rem;
	flex-wrap: wrap;
	margin: 1.2rem 0;
}

/* ---------- Brokers ----------------------------------------------------- */

.ih-broker__cell {
	display: flex;
	align-items: center;
	gap: .6rem;
}

.ih-broker__logo {
	width: 60px;
	height: auto;
	object-fit: contain;
	flex: 0 0 auto;
}

.ih-stars {
	color: #f5a623;
	white-space: nowrap;
	font-size: .9rem;
}

.ih-stars em {
	font-style: normal;
	color: var(--ih-muted);
	font-size: .8rem;
	margin-left: .2rem;
}

/* ---------- Notices ----------------------------------------------------- */

.ih-notice {
	padding: .9rem 1rem;
	border: 1px dashed var(--ih-border);
	border-radius: var(--ih-radius);
	color: var(--ih-muted);
	margin: 0;
	font-size: .9rem;
}

.ih-stamp,
.ih-disclaimer {
	font-size: .78rem;
	color: var(--ih-muted);
	margin: .6rem 0 0;
	line-height: 1.45;
}

.ih-disclaimer {
	padding: .6rem .75rem;
	background: rgba(148, 163, 184, .08);
	border-radius: 8px;
	border-left: 3px solid var(--ih-amber);
}

.ih-empty-search {
	padding: 1.2rem;
	text-align: center;
	color: var(--ih-muted);
}

/* ---------- Responsive: stacked table rows ------------------------------ */

@media (max-width: 720px) {
	.ih-dashboard .ih-table,
	.ih-gmp-table .ih-table,
	.ih-allotment .ih-table,
	.ih-brokers .ih-table,
	.ih-subscription .ih-table {
		display: block;
	}

	.ih-dashboard .ih-table thead,
	.ih-gmp-table .ih-table thead,
	.ih-allotment .ih-table thead,
	.ih-brokers .ih-table thead,
	.ih-subscription .ih-table thead {
		display: none;
	}

	.ih-dashboard .ih-table tbody,
	.ih-gmp-table .ih-table tbody,
	.ih-allotment .ih-table tbody,
	.ih-brokers .ih-table tbody,
	.ih-subscription .ih-table tbody {
		display: block;
	}

	.ih-dashboard .ih-table tr,
	.ih-gmp-table .ih-table tr,
	.ih-allotment .ih-table tr,
	.ih-brokers .ih-table tr,
	.ih-subscription .ih-table tr {
		display: block;
		padding: .6rem .2rem;
		border-bottom: 1px solid var(--ih-border);
	}

	.ih-dashboard .ih-table td,
	.ih-gmp-table .ih-table td,
	.ih-allotment .ih-table td,
	.ih-brokers .ih-table td,
	.ih-subscription .ih-table td {
		display: flex;
		justify-content: space-between;
		gap: 1rem;
		border: 0;
		padding: .28rem .7rem;
	}

	.ih-dashboard .ih-table td::before,
	.ih-gmp-table .ih-table td::before,
	.ih-allotment .ih-table td::before,
	.ih-brokers .ih-table td::before,
	.ih-subscription .ih-table td::before {
		content: attr(data-label);
		font-size: .74rem;
		font-weight: 700;
		text-transform: uppercase;
		letter-spacing: .03em;
		color: var(--ih-muted);
		flex: 0 0 auto;
	}

	.ih-card__stats {
		grid-template-columns: 1fr 1fr;
	}
}
