:root {
	--bg: #f3f6f2;
	--bg-muted: #edf3ee;
	--surface: #ffffff;
	--surface-muted: #f7faf7;
	--surface-subtle: #eef5ee;
	--border: #d7e2d8;
	--border-strong: #bfcebf;
	--text: #172033;
	--text-muted: #62708a;
	--heading: #0f172a;
	--brand: #217a00;
	--brand-strong: #195d00;
	--brand-soft: #eef8e8;
	--success-soft: #eefbf3;
	--success-border: #c7edd5;
	--danger: #b42318;
	--shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
	--shadow-md: 0 12px 24px rgba(15, 23, 42, 0.06);
	--radius-xl: 18px;
	--radius-lg: 14px;
	--radius-md: 10px;
	--radius-sm: 8px;
	--transition: 160ms ease;
}

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

html {
	min-height: 100%;
	background: var(--bg);
}

body {
	margin: 0;
	min-height: 100vh;
	background:
		linear-gradient(180deg, #f9fcf8 0%, var(--bg) 132px, var(--bg) 100%);
	color: var(--text);
	font: 14px/1.5 "Inter", "Segoe UI Variable", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

a,
a:link,
a:visited {
	color: var(--brand);
	text-decoration: none;
	transition: color var(--transition), background-color var(--transition), border-color var(--transition), box-shadow var(--transition);
}

a:hover {
	color: var(--brand-strong);
}

img {
	max-width: 100%;
}

hr {
	border: 0;
	height: 1px;
	margin: 18px 0;
	background: var(--border);
}

.centertext {
	text-align: center;
}

#header {
	padding: 14px 18px 0;
}

#head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 18px;
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
	background: var(--surface);
	box-shadow: var(--shadow-sm);
	border-top: 3px solid var(--brand);
}

.brand_block {
	display: grid;
	gap: 4px;
	min-width: 0;
}

.brand_kicker {
	display: inline-flex;
	align-items: center;
	width: fit-content;
	padding: 3px 8px;
	border-radius: 999px;
	background: var(--brand-soft);
	color: var(--brand-strong);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

#head .logo {
	margin: 0;
	font-family: inherit;
	font-size: clamp(1.55rem, 2.5vw, 2.1rem);
	font-weight: 700;
	line-height: 1.1;
	letter-spacing: -0.03em;
}

#head .logo a,
#head .logo a:link,
#head .logo a:visited {
	color: var(--heading);
}

.brand_subtitle {
	color: var(--text-muted);
	font-size: 14px;
}

#head .right {
	display: grid;
	gap: 4px;
	min-width: 220px;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface-muted);
	text-align: right;
}

.user_badge {
	color: var(--heading);
	font-size: 13px;
}

.user_badge strong {
	font-weight: 700;
}

.user_meta {
	color: var(--text-muted);
	font-size: 12px;
}

.utility_links {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	justify-content: flex-end;
	font-size: 12px;
}

.divider {
	color: var(--border-strong);
}

#head .right a {
	color: var(--text-muted);
	font-weight: 600;
}

#head .right a:hover {
	color: var(--brand-strong);
}

#menu_tabs {
	margin-top: 8px;
	padding: 0;
}

ul#tabnav {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	margin: 0;
	padding: 0;
	list-style: none;
}

ul#tabnav li {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tabnav-utility--push {
	margin-left: auto;
}

div#menu_tabs a:link,
div#menu_tabs a:visited {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 34px;
	padding: 0 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text-muted);
	font-size: 12px;
	font-weight: 600;
	box-shadow: var(--shadow-sm);
}

#menu_tabs a:hover,
#menu_tabs a:focus {
	border-color: #b8d5b0;
	background: #f7fbf4;
	color: var(--brand-strong);
}

#menu_tabs ul#tabnav a:link.sel,
#menu_tabs ul#tabnav a:visited.sel,
.Right #categories a.sel:link,
.Right #categories a.sel:visited {
	border-color: #cfe5c8;
	background: var(--brand-soft);
	color: var(--brand-strong);
}

#menu_tabs li#AdminTab a:link,
#menu_tabs li#AdminTab a:visited,
#menu_tabs li#AdminTab a.sel {
	color: inherit;
	text-decoration: none;
}

#page {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 256px;
	gap: 14px;
	padding: 10px 18px 20px;
	align-items: start;
}

#main,
#menu .m_c {
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
	background: var(--surface);
	box-shadow: var(--shadow-sm);
}

#main {
	min-width: 0;
	padding: 16px;
}

.app_section_badge {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 14px;
	padding: 10px 12px;
	border: 1px solid var(--border);
	border-radius: var(--radius-md);
	background: var(--surface-muted);
}

.app_section_label {
	color: var(--brand-strong);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.app_section_note {
	color: var(--text-muted);
	font-size: 12px;
}

.section {
	padding: 0;
}

#menu {
	min-width: 0;
}

#menu .m_c {
	padding: 14px;
}

.menu_panel_title {
	color: var(--heading);
	font-size: 15px;
	font-weight: 700;
}

.menu_panel_subtitle {
	margin-top: 4px;
	color: var(--text-muted);
	font-size: 12px;
	line-height: 1.5;
}

#menu hr {
	width: 100%;
	margin: 14px 0;
}

.menuitems,
.submenuitems {
	list-style: none;
	margin: 0;
	padding: 0;
}

.menuitems {
	margin-top: 14px;
}

.menuitems > li {
	margin-bottom: 10px;
}

a:link.menuitem,
a:visited.menuitem {
	display: block;
	padding: 8px 10px;
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	background: var(--surface-muted);
	color: var(--heading);
	font-weight: 700;
	font-size: 13px;
}

a:hover.menuitem {
	border-color: #b8d5b0;
	background: #f7fbf4;
	color: var(--brand-strong);
}

.submenuitems {
	margin-top: 6px;
	padding-left: 4px;
}

.submenuitems li {
	margin-top: 2px;
}

.submenuitem,
.dubsubmenuitem {
	display: block;
	padding: 6px 8px;
	border-radius: var(--radius-sm);
	color: var(--text-muted);
	font-size: 12px;
}

.dubsubmenuitem {
	margin-left: 10px;
}

a:link.submenuitem,
a:link.dubsubmenuitem,
a:visited.submenuitem,
a:visited.dubsubmenuitem {
	color: var(--text-muted);
}

a:hover.submenuitem,
a:hover.dubsubmenuitem {
	background: #f5faf3;
	color: var(--brand-strong);
}

div.page_header {
	margin: 0 0 14px;
	padding: 12px 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface-muted);
}

div.page_header h1 {
	margin: 0;
	color: var(--heading);
	font-family: inherit;
	font-size: clamp(1.15rem, 2vw, 1.55rem);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: -0.02em;
}

div.page_header h1 a {
	white-space: normal;
}

div.page_header h1 span {
	display: inline-block;
	margin-left: 8px;
	color: var(--text-muted);
	font-size: 0.95rem;
	font-weight: 500;
}

div.sheet div.page_header h1 {
	font-size: 2rem;
}

div.page_header p {
	margin: 8px 0 0;
	color: var(--text-muted);
}

h1,
h2,
h3,
h4 {
	margin-top: 0;
	color: var(--heading);
	font-family: inherit;
	letter-spacing: -0.02em;
}

p {
	margin-top: 0;
}

table {
	width: 100%;
	border-collapse: collapse;
	border-spacing: 0;
	background: transparent;
}

th,
td {
	padding: 10px 12px;
	vertical-align: top;
}

th {
	color: var(--heading);
	font-size: 13px;
	font-weight: 700;
	text-align: left;
}

td {
	color: var(--text);
}

tr + tr td,
tr + tr th {
	border-top: 1px solid #e9eef6;
}

.listbox,
.listLeft,
.listCent {
	padding: 10px 12px;
	border-bottom: 1px solid #e9eef6;
	background: transparent;
}

.listbox,
.listCent {
	text-align: center;
}

.listLeft {
	text-align: left;
}

.listhead {
	padding: 10px 12px;
	background: #edf5ea;
	color: var(--brand-strong);
	text-align: center;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	border-bottom: 1px solid var(--border);
}

.logsheetcell {
	width: 310px;
	margin: 0;
	padding-top: 8px;
	padding-right: 12px;
	padding-left: 8px;
	border-right: 1px solid var(--border);
	border-bottom: 1px solid var(--border);
}

.key {
	color: var(--heading);
	font-weight: 700;
	white-space: nowrap;
}

input,
select,
textarea,
button {
	font: inherit;
}

input[type=text],
input[type=password],
input[type=email],
input[type=number],
input[type=search],
select,
textarea {
	width: auto;
	max-width: 100%;
	padding: 8px 10px;
	border: 1px solid var(--border-strong);
	border-radius: var(--radius-sm);
	background: var(--surface);
	color: var(--text);
	box-shadow: none;
	transition: border-color var(--transition), box-shadow var(--transition), background-color var(--transition);
}

input[type=text]:not([size]),
input[type=password]:not([size]),
input[type=email]:not([size]),
input[type=number]:not([size]),
input[type=search]:not([size]),
select {
	width: min(100%, 420px);
}

input[type=text]:focus,
input[type=password]:focus,
input[type=email]:focus,
input[type=number]:focus,
input[type=search]:focus,
select:focus,
textarea:focus {
	outline: none;
	border-color: #8bb47e;
	box-shadow: 0 0 0 3px rgba(33, 122, 0, 0.12);
	background: #fff;
}

input[type=checkbox],
input[type=radio] {
	accent-color: var(--brand);
}

textarea {
	width: 100%;
	min-height: 120px;
	resize: vertical;
}

.buttons,
button.buttons,
input.buttons {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 36px;
	padding: 0 14px;
	border: 1px solid var(--brand);
	border-radius: var(--radius-sm);
	background: var(--brand);
	color: #fff;
	cursor: pointer;
	font-weight: 600;
	box-shadow: none;
}

.buttons:hover,
button.buttons:hover,
input.buttons:hover {
	border-color: var(--brand-strong);
	background: var(--brand-strong);
	color: #fff;
}

.buttons-secondary {
	border-color: var(--border-strong);
	background: var(--surface);
	color: var(--text);
}

.buttons-secondary:hover {
	border-color: var(--border-strong);
	background: var(--surface-subtle);
	color: var(--heading);
}

#topBar {
	display: none;
}

#search_box {
	max-width: 640px;
	margin: 0 auto;
	padding: 16px 18px;
	border: 1px solid var(--border);
	border-radius: var(--radius-lg);
	background: var(--surface-muted);
	color: var(--text-muted);
}

#search_box h3 {
	margin: 0 0 12px;
	color: var(--heading);
	font-size: 18px;
	text-align: center;
}

#search_box label {
	display: block;
	margin: 0 0 6px;
	color: var(--heading);
	font-weight: 700;
}

#search_box input[type=text] {
	width: 100%;
}

#search_box > form > div + div {
	margin-top: 10px;
}

.login_shell {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 18px 8px 8px;
}

.login_card {
	width: min(100%, 420px);
	padding: 22px;
	border: 1px solid var(--border);
	border-radius: var(--radius-xl);
	background: var(--surface);
	box-shadow: var(--shadow-md);
}

.login_card-compact {
	text-align: center;
}

.login_eyebrow {
	display: inline-block;
	padding: 4px 8px;
	border-radius: 999px;
	background: var(--brand-soft);
	color: var(--brand-strong);
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

.login_card h1 {
	margin: 12px 0 6px;
	font-size: 28px;
	font-weight: 700;
	line-height: 1.1;
}

.login_card p {
	margin: 0 0 16px;
	color: var(--text-muted);
}

.login_form {
	display: grid;
	gap: 12px;
}

.form_row label {
	display: block;
	margin-bottom: 6px;
	color: var(--heading);
	font-size: 13px;
	font-weight: 700;
}

.login_actions {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	padding-top: 2px;
}

#client-ai-answer-wrap {
	border-radius: var(--radius-lg);
	border-color: var(--border) !important;
	background: var(--surface-muted) !important;
	box-shadow: none;
}

#client-ai-error {
	font-weight: 600;
	color: var(--danger);
}

@media (max-width: 1120px) {
	#page {
		grid-template-columns: 1fr;
	}

	#menu {
		order: -1;
	}
}

@media (max-width: 860px) {
	#header {
		padding: 16px 16px 0;
	}

	#head {
		padding: 16px;
		flex-direction: column;
		align-items: stretch;
	}

	#head .right {
		min-width: 0;
		text-align: left;
	}

	.utility_links {
		justify-content: flex-start;
	}

	.tabnav-utility--push {
		margin-left: 0;
	}

	#page {
		padding: 10px 16px 18px;
	}

	#main {
		padding: 14px;
	}
}

@media (max-width: 640px) {
	body {
		font-size: 14px;
	}

	#head .logo {
		font-size: 1.8rem;
	}

	div#menu_tabs a:link,
	div#menu_tabs a:visited,
	.buttons,
	button.buttons,
	input.buttons {
		width: 100%;
	}

	#tabnav li,
	#tabnav a {
		width: 100%;
	}

	.login_card {
		padding: 22px 18px;
	}

	.login_actions {
		flex-direction: column;
	}

	th,
	td {
		padding: 10px 8px;
	}
}

textarea.editor + .ck-editor .ck-editor__editable_inline {
	min-height: 26rem;
}
