/* 7SOW Hub — frontend admin portal */

.sow-portal {
	--charcoal: #36454F;
	--light-charcoal: #4A5D68;
	--gold: #C4A24D;
	--gold-soft: #b3923f;
	--cream: #FAF8F4;
	--snow: #FFFFFF;
	--muted: #8A9AA5;
	--border: #E8E4DC;
	--green: #4d7a52;
	--amber: #9a7b2d;
	--red: #a05441;

	font-family: 'Jost', -apple-system, sans-serif;
	background: var(--cream);
	color: var(--charcoal);
	min-height: 100vh;
	-webkit-font-smoothing: antialiased;
}
.sow-portal.sow-breakout {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}
.sow-portal *,
.sow-portal *::before,
.sow-portal *::after { box-sizing: border-box; }
.sow-portal h1, .sow-portal h2, .sow-portal p, .sow-portal ul { margin: 0; }
.sow-portal button { font: inherit; }
.sow-portal a { color: inherit; }

/* ── Brand mark ─────────────────────────────────────────────────────── */

.portal-brand { display: flex; align-items: baseline; gap: 8px; }
.portal-brand-7 {
	font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
	font-weight: 700;
	font-size: 30px;
	color: var(--gold);
	line-height: 1;
}
.portal-brand-name {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 4px;
	text-transform: uppercase;
}

/* ── Login wall ─────────────────────────────────────────────────────── */

.portal-wall {
	min-height: 70vh;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 60px 24px;
}
.portal-wall-card {
	background: var(--snow);
	border: 1px solid var(--border);
	padding: 52px 48px;
	max-width: 440px;
	text-align: center;
}
.portal-wall-card .portal-brand { justify-content: center; margin-bottom: 26px; }
.portal-wall-card h1 {
	font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
	font-weight: 400;
	font-size: 30px;
	margin-bottom: 12px;
}
.portal-wall-card p { font-size: 14.5px; line-height: 1.7; color: var(--muted); margin-bottom: 26px; }

/* ── Buttons / pills ────────────────────────────────────────────────── */

.portal-btn {
	display: inline-block;
	font-weight: 600;
	font-size: 12px;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	background: var(--snow);
	border: 1.5px solid var(--charcoal);
	color: var(--charcoal);
	padding: 10px 20px;
	cursor: pointer;
	text-decoration: none;
	transition: background 0.25s, color 0.25s;
}
.portal-btn:hover { background: var(--charcoal); color: var(--snow); }
.portal-btn-gold { background: var(--gold); border-color: var(--gold); color: var(--charcoal); }
.portal-btn-gold:hover { background: #d4b05a; border-color: #d4b05a; color: var(--charcoal); }
.portal-btn:disabled { opacity: 0.6; cursor: wait; }

.ppill {
	display: inline-block;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 1.2px;
	text-transform: uppercase;
	border: 1px solid var(--border);
	background: var(--cream);
	color: var(--light-charcoal);
	padding: 3px 9px;
}
.ppill-gold { background: #faf6ec; border-color: #e6d7ae; color: var(--amber); }
.ppill-green { background: #eef5ef; border-color: #c4dbc7; color: var(--green); }
.ppill-amber { background: #faf3e3; border-color: #e8d6a8; color: var(--amber); }

/* ── Shell layout ───────────────────────────────────────────────────── */

.portal-shell {
	display: grid;
	grid-template-columns: 230px minmax(0, 1fr);
	max-width: 1280px;
	margin: 0 auto;
	min-height: 88vh;
}
.portal-side {
	background: var(--charcoal);
	color: var(--snow);
	padding: 36px 24px;
	display: flex;
	flex-direction: column;
	gap: 36px;
}
.portal-side .portal-brand-name { color: var(--snow); }
.portal-nav { display: flex; flex-direction: column; gap: 4px; }
.portal-nav-btn {
	text-align: left;
	background: none;
	border: 0;
	border-left: 2px solid transparent;
	color: var(--muted);
	font-size: 13.5px;
	font-weight: 500;
	letter-spacing: 1px;
	text-transform: uppercase;
	padding: 11px 14px;
	cursor: pointer;
	transition: color 0.2s, border-color 0.2s, background 0.2s;
}
.portal-nav-btn:hover { color: var(--snow); }
.portal-nav-btn.is-active {
	color: var(--gold);
	border-left-color: var(--gold);
	background: rgba(255, 255, 255, 0.04);
}
.portal-side-foot {
	margin-top: auto;
	display: flex;
	flex-direction: column;
	gap: 9px;
}
.portal-side-foot a {
	font-size: 12px;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--muted);
	text-decoration: none;
}
.portal-side-foot a:hover { color: var(--gold); }

.portal-main { padding: 36px 40px 64px; min-width: 0; }
.portal-top {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding-bottom: 22px;
	margin-bottom: 26px;
	border-bottom: 1px solid var(--border);
}
.portal-top h1 {
	font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
	font-weight: 400;
	font-size: 32px;
}
.portal-user { font-size: 13px; color: var(--muted); }

.portal-toast {
	position: fixed;
	bottom: 26px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 9999;
	background: var(--charcoal);
	color: var(--snow);
	font-size: 13.5px;
	letter-spacing: 0.5px;
	padding: 12px 22px;
	box-shadow: 0 8px 26px rgba(54, 69, 79, 0.35);
}
.portal-toast.is-error { background: var(--red); }

.portal-tab[hidden] { display: none; }

/* ── Overview ───────────────────────────────────────────────────────── */

.portal-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
	gap: 14px;
	margin-bottom: 26px;
}
.pstat {
	background: var(--snow);
	border: 1px solid var(--border);
	padding: 22px 22px 18px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.pstat-gold { border-top: 2px solid var(--gold); }
.pstat-num {
	font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
	font-weight: 700;
	font-size: 30px;
	line-height: 1.1;
}
.pstat-label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: var(--muted);
}
.pstat-go {
	margin-top: 10px;
	align-self: flex-start;
	background: none;
	border: 0;
	padding: 0;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--gold-soft);
	cursor: pointer;
	text-decoration: none;
}
.pstat-go:hover { color: var(--charcoal); }

.portal-cols {
	display: grid;
	grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
	gap: 18px;
	align-items: start;
}
.pcard {
	background: var(--snow);
	border: 1px solid var(--border);
	padding: 26px 28px;
}
.pcard h2 {
	font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
	font-weight: 400;
	font-size: 20px;
	margin-bottom: 14px;
}
.pcard-sub { margin-top: 26px; }
.pquick { display: flex; flex-wrap: wrap; gap: 10px; }
.plinks { list-style: none; padding: 0; }
.plinks li { margin-bottom: 8px; }
.plinks a { font-size: 14px; color: var(--light-charcoal); text-decoration: none; }
.plinks a:hover { color: var(--gold-soft); }
.pmuted { font-size: 13px; color: var(--muted); line-height: 1.6; }
.pstatusline { margin-top: 14px; display: flex; gap: 8px; }

.pcopy-row { display: flex; gap: 8px; margin-top: 10px; }
.pcopy-src {
	flex: 1;
	min-width: 0;
	font-family: ui-monospace, Menlo, monospace;
	font-size: 12.5px;
	border: 1px solid var(--border);
	background: var(--cream);
	color: var(--charcoal);
	padding: 10px 12px;
}

/* ── Lists ──────────────────────────────────────────────────────────── */

.portal-toolbar {
	display: flex;
	gap: 12px;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
	flex-wrap: wrap;
}
.portal-toolbar-tight { margin-bottom: 12px; }
.plist-search {
	flex: 1;
	min-width: 180px;
	max-width: 360px;
	font-family: inherit;
	font-size: 14px;
	border: 1px solid var(--border);
	background: var(--snow);
	padding: 10px 14px;
	color: var(--charcoal);
}
.plist-search:focus { outline: none; border-color: var(--gold); }

.plist { display: flex; flex-direction: column; gap: 8px; }
.prow {
	background: var(--snow);
	border: 1px solid var(--border);
	padding: 14px 18px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 18px;
	transition: border-color 0.2s;
}
.prow:hover { border-color: var(--gold); }
.prow-main { min-width: 0; }
.prow-main strong {
	display: block;
	font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
	font-weight: 700;
	font-size: 16px;
	margin-bottom: 6px;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}
.prow-meta { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.prow-date { font-size: 11.5px; color: var(--muted); }
.prow-actions { display: flex; gap: 14px; flex-shrink: 0; }
.prow-actions a,
.prow-actions button {
	background: none;
	border: 0;
	padding: 0;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--muted);
	cursor: pointer;
	text-decoration: none;
	transition: color 0.2s;
}
.prow-actions a:hover,
.prow-actions button:hover { color: var(--gold-soft); }
.prow-actions .prow-del:hover,
.prow-actions .porder-del:hover { color: var(--red); }
.pempty { font-style: italic; color: var(--muted); padding: 18px 4px; }
.pmore-wrap { text-align: center; margin-top: 16px; }

/* ── Forms ──────────────────────────────────────────────────────────── */

.portal-form,
.pbook-form {
	background: var(--snow);
	border: 1px solid var(--border);
	border-top: 2px solid var(--gold);
	padding: 26px 28px;
	margin-bottom: 22px;
}
.pform-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 18px;
}
.pform-title {
	font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
	font-weight: 400;
	font-size: 22px;
}
.pform-close {
	background: none;
	border: 0;
	font-size: 26px;
	line-height: 1;
	color: var(--muted);
	cursor: pointer;
}
.pform-close:hover { color: var(--charcoal); }

.pfield { display: block; margin-bottom: 16px; }
.pfield > span {
	display: block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 1.5px;
	text-transform: uppercase;
	color: var(--light-charcoal);
	margin-bottom: 7px;
}
.pfield input[type="text"],
.pfield input[type="url"],
.pfield input[type="number"],
.pfield input[type="password"],
.pfield input[type="search"],
.pfield select,
.pfield textarea {
	width: 100%;
	font-family: inherit;
	font-size: 14.5px;
	color: var(--charcoal);
	background: var(--cream);
	border: 1px solid var(--border);
	padding: 11px 13px;
}
.pfield input:focus,
.pfield select:focus,
.pfield textarea:focus { outline: none; border-color: var(--gold); background: var(--snow); }
.pfield textarea { resize: vertical; line-height: 1.6; }
.pfield small { display: block; font-size: 12px; color: var(--muted); margin-top: 6px; line-height: 1.5; }
.pfield-sm { max-width: 240px; }
.pfield-row { display: flex; flex-wrap: wrap; gap: 18px; align-items: flex-end; }
.pfield-row .pfield { margin-bottom: 16px; }

.pcheck { display: flex; align-items: center; gap: 10px; cursor: pointer; }
.pcheck input { width: 16px; height: 16px; accent-color: var(--gold); }
.pcheck span { font-size: 14px; text-transform: none; letter-spacing: 0; font-weight: 500; color: var(--charcoal); margin: 0; }

.pradio-row { display: flex; gap: 20px; font-size: 14px; }
.pradio-row input { accent-color: var(--gold); margin-right: 5px; }

.ptype-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.ptype {
	border: 1.5px solid var(--border);
	background: var(--snow);
	padding: 8px 16px;
	font-size: 13px;
	font-weight: 500;
	cursor: pointer;
	transition: all 0.15s;
}
.ptype input { position: absolute; opacity: 0; pointer-events: none; }
.ptype:hover { border-color: var(--gold); }
.ptype.is-on { background: var(--charcoal); border-color: var(--charcoal); color: var(--snow); }

.ppills { display: flex; flex-wrap: wrap; gap: 8px; }
.ppill-check {
	position: relative;
	border: 1.5px solid var(--border);
	background: var(--snow);
	border-radius: 14px;
	padding: 5px 13px;
	font-size: 12.5px;
	cursor: pointer;
	user-select: none;
	transition: all 0.15s;
}
.ppill-check input { position: absolute; opacity: 0; pointer-events: none; }
.ppill-check em { font-style: normal; font-weight: 700; color: var(--gold); margin-right: 5px; }
.ppill-check:hover { border-color: var(--gold); }
.ppill-check.is-on { background: var(--charcoal); border-color: var(--charcoal); color: var(--snow); }

.pcond { display: none; }
.pcond.is-visible { display: block; }

.pmedia-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pmedia-name { font-size: 13px; font-style: italic; color: var(--muted); }
.pmedia-clear {
	background: none;
	border: 0;
	padding: 0;
	font-size: 12px;
	color: var(--red);
	cursor: pointer;
	text-decoration: underline;
}

.pform-foot {
	display: flex;
	align-items: center;
	gap: 16px;
	margin-top: 8px;
	padding-top: 18px;
	border-top: 1px solid var(--border);
}
.pstatus-toggle select {
	font-family: inherit;
	font-size: 13px;
	border: 1px solid var(--border);
	background: var(--cream);
	padding: 9px 12px;
	color: var(--charcoal);
}
.pform-wplink { font-size: 12.5px; color: var(--muted); }
.pform-wplink:hover { color: var(--gold-soft); }
.pform-save { margin-left: auto; }

.pbook-side { display: flex; flex-direction: column; gap: 18px; }

/* ── Mobile ─────────────────────────────────────────────────────────── */

@media (max-width: 920px) {
	.portal-shell { grid-template-columns: 1fr; }
	.portal-side {
		flex-direction: row;
		align-items: center;
		gap: 18px;
		padding: 16px 18px;
		overflow-x: auto;
	}
	.portal-side .portal-brand { flex-shrink: 0; }
	.portal-brand-name { display: none; }
	.portal-nav { flex-direction: row; gap: 2px; }
	.portal-nav-btn {
		border-left: 0;
		border-bottom: 2px solid transparent;
		padding: 9px 11px;
		font-size: 12px;
		white-space: nowrap;
	}
	.portal-nav-btn.is-active { border-bottom-color: var(--gold); background: none; }
	.portal-side-foot { flex-direction: row; margin: 0 0 0 auto; gap: 14px; }
	.portal-side-foot a:not(:last-child) { display: none; }
	.portal-main { padding: 22px 18px 56px; }
	.portal-cols { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
	.portal-top h1 { font-size: 25px; }
	.prow { flex-direction: column; align-items: flex-start; gap: 10px; }
	.prow-main strong { white-space: normal; }
	.prow-actions { width: 100%; justify-content: flex-end; }
	.pfield-sm { max-width: none; }
	.pform-foot { flex-wrap: wrap; }
	.pform-save { width: 100%; margin-left: 0; text-align: center; }
	.pcopy-row { flex-direction: column; }
}

/* ═══════════════════════════════════════════════════════════════════
   v1.2.1 — Structured nav, grouped settings, design polish
   ═══════════════════════════════════════════════════════════════════ */

/* Sidebar: sticky, grouped */
@media (min-width: 921px) {
	.portal-side {
		position: sticky;
		top: 0;
		align-self: start;
		min-height: 88vh;
		max-height: 100vh;
		overflow-y: auto;
	}
	body.admin-bar .portal-side { top: 32px; }
}
.portal-nav-group {
	display: block;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: 2.5px;
	text-transform: uppercase;
	color: rgba(255, 255, 255, 0.32);
	margin: 22px 14px 6px;
}
.portal-nav-btn { border-radius: 2px; }
.portal-nav-btn.is-active { font-weight: 600; }

/* Tab intro notes */
.ptab-note {
	font-size: 13.5px;
	color: var(--muted);
	line-height: 1.65;
	margin: -6px 0 20px;
	max-width: 640px;
}

/* Stat cards: lift on hover, tabular numbers */
.pstat { transition: border-color 0.2s, box-shadow 0.2s; }
.pstat:hover { border-color: var(--gold); box-shadow: 0 6px 18px -12px rgba(54, 69, 79, 0.35); }
.pstat-num { font-variant-numeric: tabular-nums; }

/* Buy-link card: pills inline with the heading, tidy input */
.pstore-link-head {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 4px;
}
.pstore-link-head h2 { margin-bottom: 0; }
.pcopy-src { text-overflow: ellipsis; }
.plink {
	background: none;
	border: 0;
	padding: 0;
	font: inherit;
	color: var(--gold-soft);
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}
.plink:hover { color: var(--charcoal); }

/* Grouped settings */
.pgroup {
	border: 0;
	border-top: 1px solid var(--border);
	margin: 0 0 10px;
	padding: 22px 0 8px;
}
.pgroup:first-of-type { border-top: 0; padding-top: 4px; }
.pgroup legend {
	font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;
	font-size: 19px;
	color: var(--charcoal);
	padding: 0 12px 0 0;
	margin-bottom: 14px;
}
.pgroup .pfield-row .pfield { flex: 1; min-width: 220px; }
.pgroup .pfield-row .pfield-sm { flex: 0 1 220px; min-width: 170px; }
.pgroup .pfield-row .pcheck { flex: 0 0 auto; min-width: 0; }

/* Rows: gold edge on hover, smoother density */
.prow { border-left: 2px solid transparent; transition: border-color 0.2s, box-shadow 0.2s; }
.prow:hover { border-color: var(--gold); border-left-color: var(--gold); box-shadow: 0 4px 14px -10px rgba(54, 69, 79, 0.3); }

/* Empty states */
.pempty {
	background: var(--snow);
	border: 1px dashed var(--border);
	text-align: center;
	padding: 30px 18px;
}

/* Recent activity */
.pactivity { margin-top: 18px; }
.pactivity-cols {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 26px;
}
.pactivity h3 {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: var(--muted);
	margin: 0 0 12px;
}
.pmini { list-style: none; margin: 0; padding: 0; }
.pmini li {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 14px;
	padding: 9px 0;
	border-bottom: 1px solid var(--border);
	font-size: 13.5px;
}
.pmini li:last-child { border-bottom: 0; }
.pmini strong { font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pmini span { color: var(--muted); font-size: 12px; flex-shrink: 0; }

/* Toolbar with heading + search + button (Store / Subscribers) */
.portal-toolbar h2 { margin-bottom: 0; margin-right: auto; }

@media (max-width: 920px) {
	.portal-nav-group { display: none; }
}
@media (max-width: 640px) {
	.pactivity-cols { grid-template-columns: 1fr; }
	.portal-toolbar h2 { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════════
   v1.3.1 — Sidebar pinned via JS follower (sticky retired)
   The charcoal column is painted by .portal-shell::before for full
   height; .portal-side itself is content-height and translates with
   scroll, so it works inside any theme wrapper.
   ═══════════════════════════════════════════════════════════════════ */

@media (min-width: 921px) {
	.portal-shell { position: relative; }
	.portal-shell::before {
		content: '';
		position: absolute;
		top: 0;
		bottom: 0;
		left: 0;
		width: 230px;
		background: var(--charcoal);
	}
	.portal-side {
		position: relative;
		top: auto;
		z-index: 2;
		background: transparent;
		align-self: start;
		min-height: 0;
		max-height: none;
		overflow: visible;
		will-change: transform;
	}
	body.admin-bar .portal-side { top: auto; }
	.portal-side .portal-side-foot { margin-top: 34px; }
}

/* ═══════════════════════════════════════════════════════════════════
   v1.3.2 — Fixed sidebar holder (desktop)
   ═══════════════════════════════════════════════════════════════════ */

.sow-portal.portal-side-holder {
	position: fixed;
	z-index: 99400;
	width: 230px;
	min-height: 0;
	padding: 0;
	margin: 0;
	background: var(--charcoal);
	overflow-y: auto;
	overflow-x: hidden;
}
.sow-portal.portal-side-holder .portal-side {
	position: static;
	top: auto;
	transform: none;
	will-change: auto;
	align-self: auto;
	min-height: 100%;
	width: 230px;
	background: transparent;
}

/* ═══════════════════════════════════════════════════════════════════
   v1.3.5 — Sidebar simplified: a plain static column, no pinning,
   no scripts. It scrolls with the page like any normal sidebar.
   ═══════════════════════════════════════════════════════════════════ */

@media (min-width: 921px) {
	.portal-shell::before { display: none; }
	.portal-side {
		position: static;
		align-self: stretch;
		background: var(--charcoal);
		min-height: 0;
		max-height: none;
		overflow: visible;
		will-change: auto;
		transform: none;
	}
}
.sow-portal.portal-side-holder { display: none; }
