/*
 * Styles written for Reconciler. Loaded after the base stylesheet and
 * glass.css, and uses their colours (--color-*, --g-*), so the light and
 * dark looks both work. Class names start with "r-".
 */

/* The page is exactly as wide as the header bar above it (glass.css:
   72rem, with 14px each side on a narrow screen). */
.r-main {
	max-width: calc(72rem + 28px);
	padding-left: 14px;
	padding-right: 14px;
}

/* Room for Cloudflare's sign-in check, so the form does not jump when it appears. */
.r-check {
	min-height: 65px;
	margin: 20px 0;
}

/* "Back" links above a page heading */
.r-crumbs {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 18px;
	margin-bottom: 18px;
	font-size: 0.875rem;
}
.r-crumbs:empty {
	display: none;
}
.r-crumbs a {
	color: var(--color-cocoa-soft);
	text-decoration: underline;
	text-underline-offset: 4px;
}
.r-crumbs a::before {
	content: '‹ ';
}

/* A quiet message box */
.r-note {
	border-left: 4px solid var(--color-gold);
	background: color-mix(in srgb, var(--color-gold) 9%, transparent);
	padding: 12px 16px;
	font-size: 0.9375rem;
	border-radius: 0 8px 8px 0;
}
.r-note-warn {
	border-left-color: var(--color-down);
	background: color-mix(in srgb, var(--color-down) 7%, transparent);
}

/* Step 1: one big button per line of business */
.r-zones {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 20px;
	max-width: 60rem;
}
.r-zone {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 16px;
	min-height: 200px;
	text-align: center;
	transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.r-zone:hover,
.r-store:hover {
	transform: translateY(-2px);
}
.r-zone img {
	max-width: 100%;
	max-height: 110px;
	object-fit: contain;
	border-radius: 6px;
}
.r-zone-name {
	font-family: 'Fraunces Variable', Georgia, serif;
	font-size: 1.75rem;
	font-weight: 600;
	line-height: 1.15;
}
.r-zone-count {
	color: var(--color-muted);
	font-size: 0.875rem;
}

/* Step 2: the stores */
.r-heading {
	display: flex;
	align-items: center;
	gap: 20px;
}
.r-heading-logo {
	height: 64px;
	max-width: 140px;
	object-fit: contain;
	border-radius: 6px;
}
.r-stores {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
	gap: 16px;
}
.r-store {
	display: flex;
	flex-direction: column;
	gap: 4px;
	transition: transform 0.15s ease;
}
.r-store-name {
	font-family: 'Fraunces Variable', Georgia, serif;
	font-size: 1.35rem;
	font-weight: 600;
	line-height: 1.2;
}
.r-store-meta {
	color: var(--color-muted);
	font-size: 0.8125rem;
}
.r-store-balance {
	margin-top: 12px;
	font-size: 1.25rem;
	font-weight: 600;
}
.r-store-balance small {
	font-size: 0.75rem;
	font-weight: 400;
	color: var(--color-muted);
}

/* Step 3: the four figures at the top of an account */
.r-tiles {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
	gap: 16px;
}
.r-tile {
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.r-tile-label {
	color: var(--color-gold);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
}
.r-tile-value {
	font-family: 'Fraunces Variable', Georgia, serif;
	font-size: 2rem;
	font-weight: 600;
	line-height: 1.15;
}
.r-tile-sub {
	color: var(--color-muted);
	font-size: 0.8125rem;
}

/* Tabs and the "how far back" choice */
.r-bar {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 14px 24px;
}
.r-tabs {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	padding: 4px;
	/* Round ends on one row, and still tidy when the tabs wrap on a phone. */
	border-radius: 26px;
	background: var(--g-pane, rgba(255, 255, 255, 0.5));
	border: 1px solid var(--g-pane-border, rgba(255, 255, 255, 0.78));
}
/* Two bars side by side: the GP account, then the POS figures. */
.r-tabgroups {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}
.r-tabs-name {
	align-self: center;
	padding: 0 4px 0 12px;
	color: var(--color-muted);
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.1em;
}
.r-tabs a {
	padding: 8px 16px;
	border-radius: 999px;
	font-size: 0.9375rem;
	white-space: nowrap;
}
.r-tabs a.r-on {
	background: var(--g-current, #fff);
	color: var(--g-current-text, #3b2416);
	font-weight: 650;
	box-shadow: 0 2px 8px -4px rgba(59, 36, 22, 0.3);
}
.r-count {
	margin-left: 4px;
	font-size: 0.75rem;
	opacity: 0.7;
}
.r-range {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 0.875rem;
}
.r-range .field {
	width: auto;
	padding: 6px 10px;
	font-size: 0.875rem;
}
.r-range .btn-quiet {
	padding: 6px 14px;
}
/* With the script running, choosing a period is enough. */
.r-js .r-range .btn-quiet {
	display: none;
}

.r-two {
	display: grid;
	gap: 16px;
}
@media (min-width: 860px) {
	.r-two {
		grid-template-columns: 1fr 1fr;
	}
}

/* Tables */
.r-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.9375rem;
	text-align: left;
}
.r-table-wide {
	min-width: 46rem;
}
.r-table th,
.r-table td {
	padding: 10px 14px 10px 0;
	vertical-align: top;
}
.r-table th:last-child,
.r-table td:last-child {
	padding-right: 0;
}
.r-table thead th {
	color: var(--color-muted);
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	border-bottom: 1px solid var(--color-line);
	white-space: nowrap;
}
.r-table tbody th {
	font-weight: 500;
	white-space: nowrap;
}
.r-table tbody tr {
	border-bottom: 1px solid var(--color-line);
}
.r-table tbody tr.r-has-sub {
	border-bottom: 0;
}
.r-table tbody tr.r-has-sub td {
	padding-bottom: 2px;
}
.r-table tfoot th,
.r-table tfoot td {
	font-weight: 650;
	border-top: 2px solid var(--color-line);
}
.r-table tbody tr:last-child {
	border-bottom: 0;
}
.r-table a {
	font-weight: 600;
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-color: color-mix(in srgb, currentColor 35%, transparent);
}
.r-table a:hover {
	text-decoration-color: currentColor;
}
.r-sub {
	display: block;
	color: var(--color-muted);
	font-size: 0.8125rem;
}
/* The line under a document saying what was applied to it */
.r-subrow td {
	padding-top: 0;
	padding-bottom: 12px;
	color: var(--color-cocoa-soft);
	font-size: 0.8438rem;
}
.r-applied {
	display: block;
	padding-left: 16px;
	position: relative;
}
.r-applied::before {
	content: '↳';
	position: absolute;
	left: 0;
	color: var(--color-gold);
}
.r-applied a {
	font-weight: 500;
}

/*
 * The line under a document is closed until its button is pressed
 * (reconciler.js). Without the script every line is simply shown.
 */
.r-toggle,
.r-toggle-all {
	display: none;
}
.r-js .r-toggle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: none;
	width: 22px;
	height: 22px;
	margin-right: 6px;
	padding: 0;
	border-radius: 999px;
	border: 1px solid var(--color-line);
	background: transparent;
	color: var(--color-cocoa-soft);
	cursor: pointer;
	vertical-align: middle;
}
.r-js .r-toggle-gap {
	border-color: transparent;
	cursor: default;
}
.r-js button.r-toggle:hover,
.r-js .r-toggle[aria-expanded='true'] {
	border-color: var(--color-gold);
	color: inherit;
}
.r-toggle-mark {
	width: 6px;
	height: 6px;
	margin-left: -2px;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(-45deg);
	transition: transform 0.15s ease;
}
.r-toggle[aria-expanded='true'] .r-toggle-mark {
	margin-left: 0;
	margin-top: -2px;
	transform: rotate(45deg);
}
/* One line per transaction: nothing in a row wraps, and the kind of
   document sits beside its number. Long names are cut with "...". */
.r-table-wide tbody tr:not(.r-subrow) td {
	white-space: nowrap;
	vertical-align: middle;
}
.r-table-wide td .r-sub {
	display: inline-block;
	max-width: 10.5rem;
	margin-left: 6px;
	overflow: hidden;
	text-overflow: ellipsis;
	vertical-align: middle;
}
.r-table-wide td .r-sub a {
	font-weight: 500;
}
.r-js .r-table tbody tr.r-subrow td {
	padding-left: 30px;
}
.r-js .r-table tbody tr.r-subrow:not(.r-open) {
	display: none;
}
.r-js .r-table tbody tr.r-has-sub:not(.r-open) {
	border-bottom: 1px solid var(--color-line);
}
.r-js .r-table tbody tr.r-has-sub:not(.r-open) td {
	padding-bottom: 10px;
}
/* Open | History | All */
.r-cardtools {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px 12px;
}
.r-seg {
	display: inline-flex;
	padding: 3px;
	border-radius: 999px;
	border: 1px solid var(--color-line);
}
.r-seg a {
	padding: 4px 12px;
	border-radius: 999px;
	font-size: 0.8125rem;
	white-space: nowrap;
}
.r-seg a.r-on {
	background: var(--g-current, #fff);
	color: var(--g-current-text, #3b2416);
	font-weight: 650;
	box-shadow: 0 2px 8px -4px rgba(59, 36, 22, 0.3);
}
.r-cardhead {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
}
.r-js .r-toggle-all {
	display: inline-block;
	padding: 6px 14px;
	font-size: 0.8125rem;
}
@media print {
	.r-toggle,
	.r-toggle-all {
		display: none !important;
	}
	.r-js .r-table tbody tr.r-subrow:not(.r-open) {
		display: table-row;
	}
}

/* A month's royalty statement, shown under it on the Royalty tab */
.r-statement {
	max-width: 38rem;
	margin: 6px 0 10px;
	font-size: 0.9375rem;
}
.r-statement > div {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	padding: 3px 0;
}
.r-statement dd {
	margin: 0;
	white-space: nowrap;
}
.r-st-head dt,
.r-st-total dt,
.r-st-due dt,
.r-st-total dd,
.r-st-due dd {
	font-weight: 650;
}
.r-st-less,
.r-st-info {
	padding-left: 1.5rem !important;
	color: var(--color-muted);
}
.r-st-total dt,
.r-st-due dt {
	padding-left: 1.5rem;
}
.r-st-total dd {
	border-top: 1px solid var(--color-line);
	padding-left: 2rem;
}
.r-st-note {
	color: var(--color-muted);
	font-size: 0.875rem;
}
.r-st-due + .r-st-note {
	margin-top: 10px;
	padding-top: 10px !important;
	border-top: 1px dashed var(--color-line);
}

/* The Options menu in the top bar */
.r-options {
	position: relative;
}
.r-options > summary {
	display: block;
	padding: 9px 18px;
	border: 1px solid transparent;
	color: var(--color-cocoa-soft);
	font-weight: 550;
	cursor: pointer;
	list-style: none;
	user-select: none;
}
.r-options > summary::-webkit-details-marker {
	display: none;
}
.r-options > summary span {
	position: relative;
	top: -3px;
	margin-left: 2px;
}
.r-options > summary:hover {
	background: var(--color-cream);
}
.r-options[open] > summary {
	border-color: var(--color-gold, #b9842f);
}
.r-options > summary.g-on {
	background: var(--g-current);
	color: var(--g-current-text);
	font-weight: 650;
	border: 1px solid rgba(255, 255, 255, 0.95);
	box-shadow: inset 0 1px 0 #fff, 0 2px 8px -4px rgba(59, 36, 22, 0.3);
}
.r-options-menu {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	z-index: 40;
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 12rem;
	padding: 6px;
	border: 1px solid var(--g-pill-border);
	border-radius: 16px;
	background: var(--r-menu-bg, #fffaf3);
	box-shadow: 0 18px 40px -18px rgba(59, 36, 22, 0.45);
}
html[data-theme='dark'] .r-options-menu {
	background: #2b1d14;
}
.r-options-menu a,
.r-options-menu button,
.g-header nav .r-options-menu a {
	display: block;
	width: 100%;
	padding: 9px 12px;
	border: 0;
	border-radius: 10px;
	background: none;
	color: inherit;
	font: inherit;
	font-weight: 550;
	text-align: left;
	white-space: nowrap;
	cursor: pointer;
}
.r-options-menu a:hover,
.r-options-menu button:hover,
.r-options-menu a[aria-current='page'],
.g-header nav .r-options-menu a:hover {
	background: var(--color-cream);
}

/* The collapsible top bar: a small button at its end shrinks it to a slim
   strip with a small logo and a Menu button (bar.js keeps the choice). */
.r-bar-close span {
	position: relative;
	top: 3px;
}
.r-bar-open {
	display: none;
	cursor: pointer;
}
.r-bar-open span {
	position: relative;
	top: -3px;
	margin-left: 2px;
}
html:not(.r-bar-js) .r-bar-close {
	display: none;
}
.r-bar-small .g-header {
	padding-top: 6px;
	padding-bottom: 6px;
	border-radius: 16px;
}
.r-bar-small .g-header nav,
.r-bar-small .g-header .r-bar-tools {
	display: none;
}
.r-bar-small .g-header .r-bar-open {
	display: inline-block;
	padding: 4px 12px;
}
.r-bar-small .g-header .r-logo {
	gap: 8px;
}
.r-bar-small .g-header .r-logo img {
	width: 1.6rem !important;
	height: 1.4rem !important;
}
.r-bar-small .g-header .r-logo .g-word {
	font-size: 1.125rem;
	letter-spacing: 0.06em;
}

/* The totals of a list, as its first line */
.r-table tbody tr.r-toprow {
	border-bottom: 2px solid var(--color-line);
}
.r-table tbody tr.r-toprow td {
	font-weight: 700;
}
.r-table tbody tr.r-toprow .r-sub {
	display: inline;
	margin-left: 6px;
	font-weight: 400;
}

/* Five tiles on one row (Delivery tab) */
.r-tiles.r-tiles-tight {
	grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
}

/* The days of a month, shown under it on the Delivery tab */
.r-table.r-days {
	margin: 4px 0 6px;
	min-width: 30rem;
	font-size: 0.875rem;
	color: inherit;
}
.r-table.r-days th,
.r-table.r-days td {
	padding-top: 5px;
	padding-bottom: 5px;
	white-space: nowrap;
}
.r-table.r-days thead th {
	font-size: 0.6875rem;
}
.r-table.r-days tbody tr {
	border-bottom: 1px solid color-mix(in srgb, var(--color-line) 55%, transparent);
}

/* Status badges */
.r-badge {
	display: inline-block;
	padding: 2px 10px;
	border-radius: 999px;
	font-family: 'Inter Variable', ui-sans-serif, system-ui, sans-serif;
	font-size: 0.75rem;
	font-weight: 600;
	letter-spacing: 0;
	line-height: 1.6;
	white-space: nowrap;
	vertical-align: middle;
	border: 1px solid transparent;
}
.r-badge-done {
	color: var(--color-up);
	background: color-mix(in srgb, var(--color-up) 12%, transparent);
	border-color: color-mix(in srgb, var(--color-up) 30%, transparent);
}
.r-badge-part {
	color: var(--color-gold);
	background: color-mix(in srgb, var(--color-gold) 14%, transparent);
	border-color: color-mix(in srgb, var(--color-gold) 38%, transparent);
}
.r-badge-open {
	color: var(--color-cocoa-soft);
	background: color-mix(in srgb, var(--color-cocoa-soft) 9%, transparent);
	border-color: color-mix(in srgb, var(--color-cocoa-soft) 28%, transparent);
}
.r-badge-late {
	color: var(--color-down);
	background: color-mix(in srgb, var(--color-down) 10%, transparent);
	border-color: color-mix(in srgb, var(--color-down) 32%, transparent);
}
/* A card title with its status beside it */
.r-titled {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
}

/* Being picked and packed: a clear yellow, apart from the gold of the steps before it */
.r-badge-pick {
	color: #6b4e00;
	background: #fde272;
	border-color: #e3b81f;
}
html[data-theme='dark'] .r-badge-pick {
	color: #2b2000;
	background: #f2cf4a;
	border-color: #f2cf4a;
}
/* Paperwork sent: blue, a step that is not about the goods */
.r-badge-docs {
	color: #2a6592;
	background: color-mix(in srgb, #2a6592 11%, transparent);
	border-color: color-mix(in srgb, #2a6592 32%, transparent);
}
html[data-theme='dark'] .r-badge-docs {
	color: #9cc8ea;
	background: color-mix(in srgb, #9cc8ea 14%, transparent);
	border-color: color-mix(in srgb, #9cc8ea 36%, transparent);
}

.r-badge + .r-badge {
	margin-left: 4px;
}

/* Aging bars */
.r-agebar {
	width: 45%;
	vertical-align: middle !important;
}
.r-agebar span {
	display: block;
	height: 10px;
	min-width: 2px;
	border-radius: 999px;
	background: var(--color-cocoa-soft);
}
.r-agebar span.r-agebar-late {
	background: var(--color-down);
}

/* Label and value pairs */
.r-facts > div {
	display: flex;
	justify-content: space-between;
	gap: 24px;
	padding: 9px 0;
	border-bottom: 1px solid var(--color-line);
	font-size: 0.9375rem;
}
.r-facts > div:last-child {
	border-bottom: 0;
}
.r-facts dt {
	color: var(--color-muted);
}
.r-facts dd {
	text-align: right;
	font-weight: 500;
}
.r-facts-count {
	display: block;
	color: var(--color-muted);
	font-size: 0.8125rem;
	font-weight: 400;
}
.r-facts a {
	text-decoration: underline;
	text-underline-offset: 3px;
}
.r-facts-total dt,
.r-facts-total dd {
	color: inherit;
	font-weight: 700;
}

/*
 * On a phone a wide table would scroll sideways and hide the amounts, so
 * each row becomes a card: the document on top, then one line per column
 * with its name (reconciler.js copies the names onto the cells). Without
 * the script the table simply scrolls.
 */
@media (max-width: 640px) {
	.r-js .r-table-wide {
		min-width: 0;
	}
	.r-js .r-table-wide thead {
		position: absolute;
		width: 1px;
		height: 1px;
		overflow: hidden;
		clip-path: inset(50%);
	}
	.r-js .r-table-wide tbody tr,
	.r-js .r-table-wide tfoot tr {
		display: block;
		padding: 12px 0;
	}
	.r-js .r-table-wide tbody tr.r-has-sub {
		padding-bottom: 4px;
	}
	.r-js .r-table-wide tbody tr.r-subrow {
		padding-top: 0;
	}
	.r-js .r-table-wide td,
	.r-js .r-table-wide tfoot th {
		display: flex;
		justify-content: space-between;
		gap: 16px;
		padding: 3px 0;
		text-align: right;
		white-space: normal;
		border: 0;
	}
	.r-js .r-table-wide td[data-label]::before {
		content: attr(data-label);
		color: var(--color-muted);
		font-size: 0.8125rem;
		font-weight: 400;
		text-align: left;
		white-space: nowrap;
	}
	.r-js .r-table-wide td:first-child {
		font-size: 1.0625rem;
	}
	.r-js .r-table-wide td:first-child::before {
		content: none;
	}
	.r-js .r-table-wide tbody tr:not(.r-subrow) td {
		white-space: normal;
	}
	.r-js .r-table tbody tr.r-subrow td {
		padding-left: 0;
	}
	.r-js .r-table-wide td:first-child,
	.r-js .r-table-wide tr.r-subrow td {
		display: block;
		text-align: left;
	}
	.r-js .r-table-wide tfoot td:empty,
	.r-js .r-table-wide tr.r-toprow td:empty {
		display: none;
	}
	.r-js .r-table-wide tfoot tr {
		display: flex;
		justify-content: space-between;
		border-top: 2px solid var(--color-line);
	}
	.r-js .r-table-wide tfoot th,
	.r-js .r-table-wide tfoot td {
		border: 0;
	}
	/* A table of months (Delivery): the total row is a card like the months above it. */
	.r-js .r-table-wide.r-months {
		display: block;
	}
	.r-js .r-table-wide.r-months > tbody,
	.r-js .r-table-wide.r-months > tfoot {
		display: block;
	}
	.r-js .r-table-wide.r-months > tfoot > tr {
		display: block;
	}
	.r-js .r-table-wide.r-months > tfoot th {
		font-size: 1.0625rem;
	}
	/* The days under a month stay a small table, which fits a phone. */
	.r-js .r-table-wide tr.r-subrow table.r-days {
		min-width: 0;
		width: 100%;
		font-size: 0.6875rem;
	}
	.r-js .r-table-wide .r-dow {
		display: none;
	}
	/* The month's card above already gives its tax; the days leave it out to fit. */
	.r-js .r-table-wide tr.r-subrow table.r-days th:last-child,
	.r-js .r-table-wide tr.r-subrow table.r-days td:last-child {
		display: none;
	}
	.r-js .r-table-wide tr.r-subrow table.r-days thead {
		position: static;
		width: auto;
		height: auto;
		clip-path: none;
	}
	.r-js .r-table-wide tr.r-subrow table.r-days thead tr,
	.r-js .r-table-wide tr.r-subrow table.r-days tbody tr {
		display: table-row;
		padding: 0;
	}
	.r-js .r-table-wide tr.r-subrow table.r-days th,
	.r-js .r-table-wide tr.r-subrow table.r-days td,
	.r-js .r-table-wide tr.r-subrow table.r-days td:first-child {
		display: table-cell;
		padding: 4px 0 4px 5px;
		font-size: inherit;
		text-align: right;
		white-space: nowrap;
	}
	.r-js .r-table-wide tr.r-subrow table.r-days th:first-child {
		padding-left: 0;
		text-align: left;
	}
	.r-js .r-table-wide tr.r-subrow table.r-days thead th {
		font-size: 0.625rem;
		white-space: normal;
		vertical-align: bottom;
	}
	.r-range {
		width: 100%;
	}
}

@media print {
	.r-table-wide {
		min-width: 0;
	}
}
