/* Shiv Honda — shared light theme. Loaded by every page; keep page-specific
   CSS minimal and additive, don't redefine these selectors per-page. */

:root {
	--bg: #f4f6fb;
	--surface: #ffffff;
	--border: #dfe4ec;
	--primary: #2563eb;
	--primary-dark: #1d4ed8;
	--primary-light: #e8eefc;
	--text: #1f2937;
	--text-muted: #6b7280;
	--success: #16a34a;
	--success-bg: #e8f7ee;
	--danger: #dc2626;
	--danger-bg: #fdecec;
	--header-bg: #f59e0b;
	--header-text: #451a03;
	--modal-bg: #fff7ed;
	--modal-header-bg: #ffedd5;
	--modal-border: #fcd9b0;
	--modal-title: #7c2d12;
	--radius: 8px;
	--shadow: 0 1px 3px rgba(16, 24, 40, 0.06);
}

* {
	box-sizing: border-box;
}

body {
	font-family: Arial, Helvetica, sans-serif;
	margin: 0;
	font-size: 14px;
	background: var(--bg);
	color: var(--text);
}

a {
	color: var(--primary);
}

a:hover {
	color: var(--primary-dark);
}

h2, h3, h4 {
	color: var(--text);
}

/* ---------- Layout ---------- */

.header {
	background: var(--header-bg);
	color: var(--header-text);
	padding: 14px 20px;
	border-bottom: 1px solid var(--header-bg);
	box-shadow: var(--shadow);
}

.header a {
	color: var(--header-text);
	text-decoration: none;
	font-weight: 600;
}

.header a:hover {
	text-decoration: underline;
}

.sidebar {
	width: 160px;
	background: var(--surface);
	height: 100vh;
	float: left;
	border-right: 1px solid var(--border);
}

.sidebar h3 {
	color: var(--text-muted);
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

.sidebar a {
	display: block;
	padding: 9px 14px;
	text-decoration: none;
	color: var(--text);
	border-left: 3px solid transparent;
}

.sidebar a:hover {
	background: var(--primary-light);
	color: var(--primary-dark);
	border-left-color: var(--primary);
}

.content {
	margin-left: 150px;
	padding: 20px;
}

/* ---------- Forms ---------- */

input, select, textarea {
	font-family: inherit;
	font-size: 14px;
	padding: 7px 9px;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: var(--surface);
	color: var(--text);
}

input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--primary);
	box-shadow: 0 0 0 3px var(--primary-light);
}

button {
	font-family: inherit;
	font-size: 14px;
	padding: 7px 14px;
	border: 1px solid var(--primary);
	border-radius: 6px;
	background: var(--primary);
	color: #fff;
	cursor: pointer;
}

button:hover {
	background: var(--primary-dark);
	border-color: var(--primary-dark);
}

button:disabled {
	background: var(--border);
	border-color: var(--border);
	color: var(--text-muted);
	cursor: not-allowed;
}

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

table {
	border-collapse: collapse;
	background: var(--surface);
}

table, table td, table th {
	border: 1px solid var(--border) !important;
}

th {
	text-align: left;
	color: var(--text);
}

td, th {
	font-size: 14px;
	padding: 7px;
}

/* Every page has used a different class name for the header row historically —
   support them all rather than renaming markup across every table. */
.rowheader, .rowhdr, .chdr {
	background: var(--primary-light) !important;
	color: #1e3a5f;
	font-weight: 600;
}

/* ---------- Status colors (support every naming convention already in use) ---------- */

.balanceDue, .debit, .text-danger, .negative {
	color: var(--danger) !important;
}

.balanceClear, .credit, .text-success, .positive {
	color: var(--success) !important;
}

/* ---------- Modals ---------- */

.modal {
	display: none;
	position: fixed;
	top: 0; left: 0;
	width: 100%; height: 100%;
	background: rgba(15, 23, 42, 0.45);
	justify-content: center;
	align-items: center;
	z-index: 1000;
	padding: 16px;
}

/* Popups run a size down from the page (12px vs 14px) on a light orange ground —
   compact and distinct from the white content behind them. */
.modal-content {
	background: var(--modal-bg);
	border: 1px solid var(--modal-border);
	border-radius: 12px;
	box-shadow: 0 18px 45px rgba(124, 45, 18, 0.22);
	position: relative;
	max-height: 90vh;
	overflow: auto;
	width: 100%;
	max-width: 400px;
	padding: 18px 20px 20px;
	font-size: 12px;
	animation: modalIn 0.16s ease-out;
}

@keyframes modalIn {
	from { opacity: 0; transform: translateY(10px) scale(0.99); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.modal-content { animation: none; }
}

/* The first heading becomes a title bar. Scoped to :first-of-type so a heading
   further down the popup body stays an ordinary heading. */
.modal-content > h3:first-of-type,
.modal-content > h4:first-of-type {
	margin: -18px -20px 14px;
	padding: 11px 42px 11px 20px;
	background: var(--modal-header-bg);
	border-bottom: 1px solid var(--modal-border);
	border-radius: 11px 11px 0 0;
	font-size: 14px;
	letter-spacing: 0.2px;
	color: var(--modal-title);
}

.modal-content h3, .modal-content h4 {
	margin-top: 0;
}

.modal-content label {
	display: inline-block;
	margin-bottom: 3px;
	color: var(--modal-title);
	font-weight: 600;
}

.modal-content input,
.modal-content select {
	width: 90%;
	margin-bottom: 10px;
	display: block;
}

.modal-content input,
.modal-content select,
.modal-content textarea,
.modal-content button,
.modal-content td,
.modal-content th {
	font-size: 12px;
}

.modal-content input,
.modal-content select,
.modal-content textarea {
	padding: 6px 8px;
}

.modal-content td, .modal-content th {
	padding: 5px 6px;
}

.modal-content button {
	padding: 6px 12px;
}

.modal-content button + button {
	margin-left: 6px;
}

/* Small helper line under a field — a step below body text, not above it, which is
   what an inline font-size on the <p> used to end up doing. */
.modal-content .hint, p.hint {
	color: var(--text-muted);
	font-size: 11px;
	line-height: 1.5;
	margin: 6px 0 0;
}

/* Restored-draft banner on the purchase popups. */
.draft-notice {
	background: #fffbeb;
	border: 1px solid var(--modal-border);
	border-left: 3px solid var(--header-bg);
	border-radius: 6px;
	padding: 7px 10px;
	margin-bottom: 12px;
	font-size: 11.5px;
	color: #78350f;
}

.draft-notice button {
	margin-left: 6px;
	padding: 3px 9px;
	font-size: 11px;
}

/* Sits inside the title bar; the bar reserves right padding so titles never run under it. */
.modal-close {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 24px;
	height: 24px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	font-size: 20px;
	line-height: 1;
	color: var(--modal-title);
	cursor: pointer;
	font-weight: bold;
	user-select: none;
}

.modal-close:hover {
	background: var(--modal-border);
	color: #431407;
}

/* ---------- Small helpers used across a few pages ---------- */

.summaryBox {
	display: flex;
	gap: 15px;
	flex-wrap: wrap;
	margin: 15px 0;
}

.summaryBox > div {
	background: var(--surface);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 10px 15px;
	min-width: 150px;
	box-shadow: var(--shadow);
}

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

.summaryBox .value {
	font-size: 18px;
	font-weight: bold;
}

.sub {
	font-size: 11px;
	color: var(--text-muted);
	line-height: 1.4;
}

.lineTable {
	width: 100%;
	border-collapse: collapse;
	margin-top: 10px;
}

.lineTable th, .lineTable td {
	border: 1px solid var(--border) !important;
	padding: 4px;
}

.lineTable input, .lineTable select {
	width: 100%;
	box-sizing: border-box;
	margin-bottom: 0;
}

.totalRow {
	font-weight: bold;
	text-align: right;
	margin-top: 10px;
}

/* Label/amount pairs below a line-item table. The fixed second column keeps every
   figure — including a typed-in one like Discount — in a single right-hand column,
   with the labels lined up against each other on the left. */
.totalSummary {
	display: grid;
	grid-template-columns: auto 130px;
	justify-content: end;
	align-items: center;
	gap: 8px 15px;
	margin-top: 10px;
	font-weight: bold;
}

.totalSummary .amount {
	text-align: right;
}

.totalSummary input {
	width: 100%;
	margin: 0;
	text-align: right;
}

.totalSummary .grand {
	border-top: 1px solid var(--border);
	padding-top: 8px;
}

/* ---------- Mobile ---------- */

@media (max-width: 768px) {

	.sidebar {
		position: fixed;
		left: -200px;
		top: 0;
		width: 200px;
		height: 100%;
		z-index: 1000;
	}

	.sidebar.active {
		left: 0;
	}

	.content {
		margin-left: 0;
	}
}
