/* GoyMail Basic: server-rendered OldGui (gruvbox) theme, a faithful
   copy of frontend/src/themes/oldgui/oldgui.scss so the NoJS pages
   match the SPA: scrolling domain strip on top, a centered tan card
   with a floating "GoyMail" title and a hard offset shadow, in-card
   text-link navigation (never header buttons), Unifont, red accents. */

@font-face {
	font-family: 'Unifont';
	font-style: normal;
	font-weight: 400;
	font-display: swap;
	src: url('/static/fonts/unifont.woff2') format('woff2');
}

* { box-sizing: border-box; }

html, body {
	height: 100%;
	margin: 0;
	padding: 0;
	background-color: #458588;
}

body {
	min-height: 100vh;
	font-family: 'Unifont', monospace;
	font-size: 16px;
	line-height: normal;
	color: rgb(40, 40, 40);
	-webkit-font-smoothing: none;
	text-rendering: optimizeSpeed;
}

::selection { background-color: #cc241d; color: #fbf1c7; }

a { color: rgb(40, 40, 40); }

.gm-root {
	min-height: 100vh;
	display: grid;
	grid-template-rows: min-content 1fr min-content;
	width: 100%;
	background-color: #458588;
}

/* ---- Top row: scrolling domain marquee (navigation is NOT here) ---- */
.gm-oldgui-toprow {
	width: 100%;
	height: 28px;
	max-height: 28px;
	background-color: #282828;
	color: #e1e1e1;
	font-size: 16px;
	line-height: 28px;
	overflow: hidden;
	position: relative;
}

@keyframes gm-marquee-rtl { 0% { transform: translateX(0); } 100% { transform: translateX(-50%); } }
@keyframes gm-marquee-ltr { 0% { transform: translateX(-50%); } 100% { transform: translateX(0); } }

.gm-oldgui-toprow-track {
	display: inline-flex;
	white-space: nowrap;
	animation: gm-marquee-rtl 40s linear infinite;
}

.gm-oldgui-toprow-track--rtl { animation-name: gm-marquee-ltr; }
.gm-oldgui-toprow:hover .gm-oldgui-toprow-track { animation-play-state: paused; }

.gm-oldgui-toprow-set { display: inline-flex; }

.gm-oldgui-toprow-domain {
	padding: 0 12px;
	line-height: 28px;
	color: #d5c4a1;
	text-decoration: none;
	white-space: nowrap;
}

.gm-oldgui-toprow-domain:hover { background-color: #3c3836; color: #fbf1c7; text-decoration: none; }
.gm-oldgui-toprow-domain--current { background-color: #cc241d; color: #a89984; }
.gm-oldgui-toprow-domain--current:hover { background-color: #cc241d; color: #fbf1c7; }

/* ---- Main + card ---- */
.gm-main {
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
	min-height: 0;
	padding: 0.5rem;
}

.gm-oldgui-frame {
	position: relative;
	place-self: center;
	width: min(430px, calc(100% - 1rem));
	margin: 50px 0;
	background-color: #a89984;
	box-shadow: 11px 14px 0 #282828;
}

.gm-oldgui-frame--wide { width: min(1100px, calc(100% - 2rem)); }

.gm-oldgui-title {
	position: absolute;
	top: 5px;
	left: 50%;
	transform: translateX(-50%);
	background-color: #a89984;
	color: #cc241d;
	border-left: 1px solid #282828;
	border-right: 1px solid #282828;
	padding: 2px 10px;
	z-index: 1;
	font-size: 16px;
	font-weight: 400;
	text-align: center;
	white-space: nowrap;
}

.gm-oldgui-body {
	border: 1px solid #282828;
	margin: 15px 7px;
	padding: 15px 10px;
	overflow-wrap: break-word;
	color: rgb(40, 40, 40);
}

/* ---- In-card menu (authed): horizontal text links, red hover ---- */
.gm-oldgui-menubar {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	margin: 0 0 8px;
}

.gm-oldgui-menubar a {
	color: #282828;
	background: transparent;
	text-decoration: none;
	padding: 1px 8px;
	white-space: nowrap;
}

.gm-oldgui-menubar a:hover,
.gm-oldgui-menubar a[aria-current='page'],
.gm-oldgui-menubar a.gm-oldgui-menu-sel { background-color: #cc241d; color: #a89984; }

.gm-oldgui-menubar form { margin: 0; }

.gm-oldgui-menubar button {
	font: inherit;
	font-family: 'Unifont', monospace;
	color: #282828;
	background: transparent;
	border: none;
	text-decoration: none;
	padding: 1px 8px;
	cursor: pointer;
	white-space: nowrap;
}

.gm-oldgui-menubar button:hover { background-color: #cc241d; color: #a89984; }

/* ---- Landing (guest): blurb + vertical menu ---- */
.gm-oldgui-land {
	display: flex;
	flex-direction: column;
	align-items: center;
	margin: 0;
	padding: 0;
}

.gm-oldgui-land p { margin: 0 0 6px; text-align: center; }
.gm-oldgui-inlinea { color: #cc241d; }

.gm-oldgui-land-divider {
	width: min(220px, 100%);
	margin: 10px 0;
	border-top: 1px solid #282828;
	opacity: 0.45;
}

.gm-oldgui-land-menu {
	display: inline-flex;
	flex-direction: column;
	align-self: center;
	margin: 0 auto;
}

.gm-oldgui-land-menu a {
	display: block;
	width: 100%;
	text-align: left;
	color: #282828;
	text-decoration: none;
	padding: 1px 16px 1px 3px;
	white-space: nowrap;
}

.gm-oldgui-land-menu a:hover,
.gm-oldgui-land-menu a.gm-oldgui-menu-sel { background-color: #cc241d; color: #a89984; }

/* ---- Footer ---- */
.gm-oldgui-foot {
	width: 100%;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	padding: 1px 8px;
	background-color: #282828;
	color: #e1e1e1;
	min-height: 24px;
	font-size: 16px;
	line-height: 1.2;
}

.gm-oldgui-foot a { color: #cc241d; text-decoration: none; }
.gm-oldgui-foot a:hover { text-decoration: underline; }
.gm-oldgui-foot-left { flex: 1 1 auto; min-width: 0; }
.gm-oldgui-foot-right { flex: 0 0 auto; }
.gm-oldgui-foot-creator { font-weight: 400; }
.gm-oldgui-foot-tg {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	vertical-align: middle;
	line-height: 0;
	margin: 0 1px;
	padding: 0 1px;
	text-decoration: none;
}
.gm-oldgui-foot-tg:hover { text-decoration: none; }
.gm-oldgui-foot-tg-svg { display: block; width: 13px; height: 13px; fill: currentColor; }
.gm-oldgui-foot-tg:hover .gm-oldgui-foot-tg-svg { fill: #fabd2f; }

h1, h2, h3 {
	margin: 0 0 0.5rem;
	font-size: 16px;
	font-weight: 700;
	color: rgb(40, 40, 40);
}

p { margin: 0 0 8px; }

hr { border: none; border-top: 1px solid #282828; opacity: 0.45; margin: 8px 0; }

/* Bulletin strip (donations / SMTP notice), matching gm-oldgui-in */
.gm-oldgui-in {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	margin: 0 0 12px;
	padding: 8px 10px;
	border: 2px solid #282828;
	background: #ebdbb2;
	box-shadow: inset 0 1px 0 #fbf1c7, 2px 2px 0 #1d2021;
}

.gm-oldgui-in-mark {
	flex: 0 0 auto;
	font-weight: 700;
	font-size: 14px;
	letter-spacing: 0.12em;
	padding: 4px 8px;
	margin-top: 1px;
	background: #282828;
	color: #fbf1c7;
	border: 1px solid #1d2021;
}

.gm-oldgui-in-body { flex: 1; min-width: 0; font-size: 15px; line-height: 1.45; }
.gm-oldgui-in-body p { margin: 0 0 6px; }
.gm-oldgui-in-body p:last-child { margin-bottom: 0; }

/* Flash messages */
.flash {
	margin: 0 0 12px;
	padding: 8px 10px;
	border: 2px solid #282828;
	background: #ebdbb2;
	box-shadow: inset 0 1px 0 #fbf1c7, 2px 2px 0 #1d2021;
}

.flash.err { color: #9d0006; border-color: #cc241d; font-weight: 700; }
.flash.ok { color: #3c3836; border-left: 6px solid #98971a; }

/* Cards / grid */
.card { border: 1px solid #282828; padding: 12px; background: rgba(40, 40, 40, 0.05); }
.card h2 { margin-top: 0; }

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

fieldset { border: 1px solid #282828; margin: 8px 0 12px; padding: 10px; min-width: 0; }
legend { padding: 0 4px; font-weight: 700; }

/* Forms */
.stack { display: flex; flex-direction: column; gap: 0.75rem; }
label.field { display: flex; flex-direction: column; gap: 0.25rem; }
.hint { font-size: 13px; color: #3c3836; opacity: 0.85; }
.muted { color: rgb(40, 40, 40); opacity: 0.8; }
.small { font-size: 13px; }

/* select.sel is scoped to real <select> elements so the caret and input
   chrome never bleed onto other elements that reuse the "sel" class
   (the active mailbox folder link uses class="sel" for its red state). */
.inp, .ta, select.sel {
	font: inherit;
	font-family: 'Unifont', monospace;
	font-size: 16px;
	width: 100%;
	background-color: #282828;
	outline: none;
	color: #c4c4c4;
	border: none;
	box-shadow: inset 5px 5px 0 #000;
	padding: 4px 12px;
	margin: 4px 0;
}

.inp { height: 31px; }
.ta { min-height: 10rem; resize: vertical; }

select.sel {
	height: 31px;
	appearance: none;
	-webkit-appearance: none;
	background-image: linear-gradient(45deg, transparent 50%, #928374 50%), linear-gradient(135deg, #928374 50%, transparent 50%);
	background-position: calc(100% - 16px) calc(50% - 2px), calc(100% - 10px) calc(50% - 2px);
	background-size: 6px 6px, 6px 6px;
	background-repeat: no-repeat;
	padding-right: 28px;
}

.inp:focus, .ta:focus, select.sel:focus { color: #fbf1c7; }

.checkline { display: flex; align-items: flex-start; gap: 6px; cursor: pointer; }
.checkline input { margin-top: 3px; }

/* Buttons: the SPA reserves solid buttons for primary actions
   (gm-plan-action) and uses text links elsewhere. */
.btn {
	font: inherit;
	font-family: 'Unifont', monospace;
	font-size: 16px;
	line-height: 1.15;
	display: inline-block;
	min-height: 34px;
	padding: 5px 12px;
	color: #fbf1c7;
	background: #cc241d;
	border: 2px solid #282828;
	box-shadow: 3px 3px 0 #1d2021;
	cursor: pointer;
	text-decoration: none;
	text-align: center;
}

.btn:hover { background: #9d0006; color: #fbf1c7; }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 #1d2021; }

/* Secondary chip buttons for toolbars (dark) and neutral actions (beige). */
.btn-dark {
	font: inherit;
	font-family: 'Unifont', monospace;
	font-size: 14px;
	display: inline-block;
	padding: 4px 9px;
	color: #fbf1c7;
	background: #282828;
	border: 1px solid #1d2021;
	box-shadow: 2px 2px 0 #665c54;
	cursor: pointer;
	text-decoration: none;
	text-align: center;
}

.btn-dark:hover { background: #cc241d; color: #fbf1c7; }
.btn-dark:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 #665c54; }

.btn-plain {
	font: inherit;
	font-family: 'Unifont', monospace;
	font-size: 16px;
	display: inline-block;
	padding: 2px 10px;
	background: #d5c4a1;
	color: #282828;
	border: 1px solid #7c6f64;
	box-shadow: 1px 1px 0 #504945;
	cursor: pointer;
	text-decoration: none;
}

.btn-plain:hover { color: #fbf1c7; background: #458588; }

.linklike { background: none; border: 0; color: inherit; padding: 0; font: inherit; cursor: pointer; text-decoration: underline; }

/* Text-link action row, like gm-row */
.gm-row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.35rem;
	align-items: center;
	margin: 8px 0 0;
}

.gm-row a, .gm-row button {
	font: inherit;
	font-family: 'Unifont', monospace;
	font-size: 16px;
	display: inline-block;
	text-decoration: none;
	padding: 1px 10px 1px 3px;
	background: transparent;
	color: rgb(40, 40, 40);
	border: 1px solid transparent;
	cursor: pointer;
}

.gm-row a:hover, .gm-row button:hover { background-color: #cc241d; color: #a89984; }

.btn-danger {
	font: inherit;
	font-family: 'Unifont', monospace;
	font-size: 14px;
	padding: 3px 10px;
	cursor: pointer;
	color: #fbf1c7;
	background: #9d0006;
	border: 1px solid #cc241d;
	box-shadow: 1px 1px 0 #1d2021;
}

.btn-danger:hover { background: #cc241d; }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.toolbar .spacer { flex: 1; }

/* Key/value list */
.kv { display: grid; grid-template-columns: max-content 1fr; row-gap: 4px; column-gap: 12px; margin: 6px 0; }
.kv dt { opacity: 0.7; font-weight: 400; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Tables */
.tbl-wrap { width: 100%; overflow-x: auto; border-top: 1px solid #282828; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; line-height: 1.25; }
.tbl th, .tbl td { padding: 4px 7px; border-bottom: 1px solid #bdae93; text-align: left; vertical-align: middle; }
.tbl th { color: #1d2021; background: #d5c4a1; border-bottom-color: #282828; font-weight: 700; white-space: nowrap; }
.tbl tbody tr:hover td { background: rgba(204, 36, 29, 0.08); }
.tbl .num { text-align: right; white-space: nowrap; }

/* Token display */
.token-box {
	display: block;
	margin: 8px 0;
	padding: 8px 10px;
	text-align: center;
	font-size: 1.05rem;
	letter-spacing: 0.06em;
	background-color: #282828;
	color: #fbf1c7;
	box-shadow: inset 5px 5px 0 #000;
	word-break: break-all;
	user-select: all;
}

.mono { font-family: 'Unifont', monospace; word-break: break-all; }

/* Quota meter */
.meter { width: 100%; height: 14px; border: 1px solid #282828; background: #ebdbb2; box-shadow: inset 0 1px 0 #fbf1c7; }
.meter > span { display: block; height: 100%; background: #458588; box-shadow: inset 0 -2px 0 #076678; }

/* ------------- Webmail ------------- */
.mail-wrap { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 14px; align-items: start; }
.mail-side { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.mail-side .btn { width: 100%; }
/* right pane must be allowed to shrink inside the grid or wide content
   (long subjects, addresses) pushes past the card and clips. */
.mail-wrap > section { min-width: 0; }

.mail-folders {
	list-style: none;
	margin: 0;
	padding: 0;
	border: 2px solid #282828;
	background: #ebdbb2;
	box-shadow: 3px 3px 0 #1d2021;
}

.mail-folders a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	min-height: 34px;
	padding: 7px 12px;
	text-decoration: none;
	color: #282828;
	border-bottom: 1px solid #bdae93;
}

.mail-folders li:last-child a { border-bottom: none; }
.mail-folders a:hover, .mail-folders a.sel { background-color: #cc241d; color: #a89984; }
.mail-folders a.sel { font-weight: 700; }

.mail-count {
	font-size: 12px;
	min-width: 20px;
	text-align: center;
	padding: 0 6px;
	background: #282828;
	color: #fbf1c7;
	align-self: center;
}

.mail-folders a.sel .mail-count, .mail-folders a:hover .mail-count { background: #282828; color: #fbf1c7; }
.mail-quota { font-size: 13px; }

.mail-list { border: 1px solid #282828; background: #fbf1c7; box-shadow: 3px 3px 0 #1d2021; overflow-x: auto; }
.mail-list .tbl { font-size: 14px; table-layout: fixed; }
.mail-list .tbl td { border-bottom-color: #d5c4a1; overflow-wrap: anywhere; }
/* Keep the checkbox/dot/date/size columns tight; let From + Subject flex. */
.mail-list .tbl td:first-child, .mail-list .tbl th:first-child { width: 26px; }
.mail-list .tbl td:nth-child(2), .mail-list .tbl th:nth-child(2) { width: 16px; }
.mail-list .tbl .num { width: 5.5rem; }

tr.unread td { font-weight: 700; }
.unread-dot { display: inline-block; width: 8px; height: 8px; background: #cc241d; border: 1px solid #9d0006; vertical-align: middle; }
.mail-empty { padding: 2rem 1rem; text-align: center; color: #504945; }

.pager { display: flex; gap: 12px; align-items: center; justify-content: center; padding: 6px; }

.msg-head { border: 1px solid #282828; background: #ebdbb2; box-shadow: inset 0 1px 0 #fbf1c7; padding: 10px 12px; margin-bottom: 10px; }
.msg-head h1 { margin: 0 0 8px; font-size: 18px; }

.mailbody {
	white-space: pre-wrap;
	word-wrap: break-word;
	overflow-wrap: anywhere;
	background: #fbf1c7;
	border: 1px solid #282828;
	box-shadow: 3px 3px 0 #1d2021;
	padding: 12px;
	font-size: 15px;
	line-height: 1.45;
	margin: 0;
	max-width: 100%;
	overflow-x: auto;
}

.att-chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 10px; }

.att-chips a {
	display: inline-block;
	padding: 3px 9px;
	border: 1px solid #282828;
	background: #d5c4a1;
	color: #282828;
	text-decoration: none;
	font-size: 13px;
	white-space: nowrap;
}

.att-chips a:hover { background-color: #cc241d; color: #a89984; }

/* ------------- Payments ------------- */
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; align-items: stretch; }

.plan-card {
	display: flex;
	flex-direction: column;
	min-width: 0;
	gap: 10px;
	border: 2px solid #282828;
	background: #fbf1c7;
	box-shadow: 4px 4px 0 #1d2021;
	overflow: hidden;
	padding-bottom: 12px;
}

.plan-card--current { background: #ebdbb2; box-shadow: 4px 4px 0 #9d0006; }

.plan-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; padding: 8px 10px; background: #282828; color: #fbf1c7; }
.plan-head h2 { margin: 0; font-size: 18px; color: inherit; }

.badge { display: inline-block; padding: 1px 7px; font-size: 13px; border: 1px solid #282828; background: #d5c4a1; color: #282828; white-space: nowrap; }
.badge--on { background: #98971a; border-color: #79740e; color: #fbf1c7; }

.plan-price { display: flex; flex-direction: column; gap: 3px; margin: 0 12px; padding: 8px 10px; border: 1px solid #282828; background: #d5c4a1; }
.plan-price strong { font-size: 22px; line-height: 1.1; }
.plan-price .small { color: #3c3836; }

.plan-metrics { margin: 0 12px; border-top: 1px solid #282828; }
.plan-metrics div { display: grid; grid-template-columns: minmax(88px, auto) minmax(0, 1fr); gap: 8px; padding: 5px 0; border-bottom: 1px solid #bdae93; align-items: baseline; }
.plan-metrics dt { opacity: 0.72; }
.plan-metrics dd { margin: 0; font-weight: 700; text-align: right; overflow-wrap: anywhere; }

.plan-card form { margin: auto 12px 0; }
.plan-card .btn { width: 100%; }

.pay-grid { display: grid; grid-template-columns: minmax(0, 1fr) 210px; gap: 14px; align-items: start; }
.pay-field { padding: 10px 12px; border: 1px solid #282828; background: #fbf1c7; box-shadow: inset 0 1px 0 #fff; margin-bottom: 10px; }
.pay-field--amount { background: #d5c4a1; }
.pay-label { display: block; margin-bottom: 5px; font-size: 13px; color: #3c3836; }
.pay-amount { font-size: 22px; line-height: 1.15; word-break: break-all; }
.pay-addr { font-size: 13px; line-height: 1.35; word-break: break-all; padding: 8px 10px; background: #f2e5bc; border: 1px dashed #665c54; user-select: all; }
.pay-status { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 10px; align-items: baseline; padding: 8px 10px; border: 1px solid #282828; background: #ebdbb2; margin-bottom: 10px; }
.pay-status strong { text-transform: capitalize; }
.pay-note { margin: 0 0 10px; padding: 8px 10px; border-left: 4px solid #98971a; background: #f2e5bc; color: #3c3836; line-height: 1.35; }
.pay-note--warn { border-left-color: #cc241d; }
.qr-panel { display: flex; flex-direction: column; gap: 8px; }
.qr-box { display: flex; align-items: center; justify-content: center; padding: 10px; background: #fbf1c7; border: 2px solid #282828; box-shadow: 3px 3px 0 #1d2021; }
.qr-box img { display: block; max-width: 100%; height: auto; image-rendering: pixelated; }
.rail-forms { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; }

/* Responsive */
@media (max-width: 860px) {
	.plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.pay-grid { grid-template-columns: 1fr; }
	.mail-wrap { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
	.gm-oldgui-frame { width: min(100% - 1rem, 94vw); margin: 28px 0; box-shadow: 6px 7px 0 #282828; }
	.gm-oldgui-frame--wide { width: min(1100px, calc(100% - 1.25rem)); margin: 28px 0; box-shadow: 6px 7px 0 #282828; }
	.gm-oldgui-menubar a, .gm-oldgui-menubar button { padding: 6px 10px; min-height: 40px; display: inline-flex; align-items: center; }
	.gm-oldgui-land-menu a { padding: 6px 12px; min-height: 40px; }
	.gm-oldgui-foot { height: auto; padding: 6px 8px; }
	.kv { grid-template-columns: 1fr; }
	.kv dt { margin-top: 8px; }
	.kv dt:first-of-type { margin-top: 0; }
}

@media (max-width: 620px) {
	.plan-grid { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
	.gm-oldgui-body { margin: 12px 4px; padding: 12px 8px; }
	.card { padding: 10px; }
}
