/*
	Design tokens — "organic ledger": a deep bottle-green brand against a
	warm greige ground, sparing turmeric accent, receipt-style hairline
	tables with tabular figures. Built for a counter tablet used all day,
	not a marketing page — quiet, legible, fast to scan.
*/
:root {
	--bg: #f0efe4;
	--surface: #fbfaf4;
	--surface-alt: #eae7d8;
	--ink: #22261e;
	--ink-soft: #5b6156;
	--line: #d8d4c2;
	--primary: #2f4a3b;
	--primary-strong: #1f332a;
	--primary-contrast: #f4f2e6;
	--accent: #b6742a;
	--success: #1e7a5f;
	--success-bg: #e4f1ea;
	--danger: #a8402f;
	--danger-bg: #f7e9e6;
	--whatsapp: #25d366;
	--shadow: 0 1px 2px rgba(34, 38, 30, 0.06);
	--font-display: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
	--font-body: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
	:root {
		--bg: #171b15;
		--surface: #1f251c;
		--surface-alt: #262c22;
		--ink: #edebdd;
		--ink-soft: #a8ad9c;
		--line: #333a2c;
		--primary: #7db99a;
		--primary-strong: #97cbad;
		--primary-contrast: #12180f;
		--accent: #d79a4c;
		--success: #5cc4a2;
		--success-bg: #1b3129;
		--danger: #e2897a;
		--danger-bg: #35211d;
		--shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
	}
}
:root[data-theme="dark"] {
	--bg: #171b15;
	--surface: #1f251c;
	--surface-alt: #262c22;
	--ink: #edebdd;
	--ink-soft: #a8ad9c;
	--line: #333a2c;
	--primary: #7db99a;
	--primary-strong: #97cbad;
	--primary-contrast: #12180f;
	--accent: #d79a4c;
	--success: #5cc4a2;
	--success-bg: #1b3129;
	--danger: #e2897a;
	--danger-bg: #35211d;
	--shadow: 0 1px 2px rgba(0, 0, 0, 0.4);
}
:root[data-theme="light"] {
	--bg: #f0efe4;
	--surface: #fbfaf4;
	--surface-alt: #eae7d8;
	--ink: #22261e;
	--ink-soft: #5b6156;
	--line: #d8d4c2;
	--primary: #2f4a3b;
	--primary-strong: #1f332a;
	--primary-contrast: #f4f2e6;
	--accent: #b6742a;
	--success: #1e7a5f;
	--success-bg: #e4f1ea;
	--danger: #a8402f;
	--danger-bg: #f7e9e6;
}

* { box-sizing: border-box; }

body.ob-app-body {
	margin: 0;
	font-family: var(--font-body);
	background: var(--bg);
	color: var(--ink);
	-webkit-font-smoothing: antialiased;
}

.ob-app-wrap { max-width: 920px; margin: 0 auto; padding: 28px 18px 72px; }

/* Topbar / brand mark */
.ob-app-topbar {
	display: flex; align-items: center; justify-content: space-between;
	margin-bottom: 24px; padding-bottom: 16px; border-bottom: 1px solid var(--line);
}
.ob-app-brand { display: flex; align-items: center; gap: 10px; }
.ob-app-brand svg { flex-shrink: 0; color: var(--primary); }
.ob-app-topbar h1 {
	font-family: var(--font-display); font-size: 21px; font-weight: 600; margin: 0;
	letter-spacing: 0.01em; text-wrap: balance;
}
.ob-app-eyebrow {
	display: block; font-family: var(--font-body); font-size: 11px; font-weight: 600;
	color: var(--ink-soft); text-transform: uppercase; letter-spacing: 0.08em; margin-bottom: 2px;
}
.ob-app-nav { display: flex; align-items: center; gap: 18px; }
.ob-app-nav a:not(.ob-btn) {
	color: var(--ink-soft); text-decoration: none; font-size: 13.5px; font-weight: 500;
	border-bottom: 1px solid transparent; padding-bottom: 2px;
}
.ob-app-nav a:not(.ob-btn):hover { color: var(--primary); border-color: var(--primary); }
.ob-app-staff {
	margin-right: 2px; color: var(--ink-soft); font-size: 13px;
	padding: 3px 10px; background: var(--surface-alt); border-radius: 20px;
}

/* Cards */
.ob-app-card {
	background: var(--surface);
	border: 1px solid var(--line);
	border-radius: 10px;
	padding: 22px;
	margin-bottom: 18px;
	box-shadow: var(--shadow);
}
.ob-app-form .ob-section-title {
	font-family: var(--font-display); font-size: 16px; font-weight: 600;
	margin: 0 0 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
}

/* Forms */
.ob-field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-bottom: 18px; }
.ob-field-wide { grid-column: 1 / -1; }
.ob-field label {
	display: block; font-size: 12px; font-weight: 600; color: var(--ink-soft);
	margin-bottom: 5px; letter-spacing: 0.01em;
}
.ob-field input, .ob-field textarea {
	width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 7px;
	font-size: 14px; font-family: inherit; background: var(--surface); color: var(--ink);
}
.ob-field input:focus, .ob-field textarea:focus,
.ob-items-table input:focus, #ob-product-search:focus {
	outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}

/* Item search */
.ob-item-search { position: relative; margin-bottom: 14px; }
.ob-item-search input {
	width: 100%; padding: 11px 14px; border: 1px solid var(--line); border-radius: 7px;
	font-size: 14px; font-family: inherit; background: var(--surface); color: var(--ink);
}
.ob-product-results {
	position: absolute; left: 0; right: 0; top: 100%; z-index: 10;
	background: var(--surface); border: 1px solid var(--line); border-top: none;
	border-radius: 0 0 8px 8px; max-height: 260px; overflow-y: auto; display: none;
	box-shadow: 0 6px 16px rgba(34, 38, 30, 0.12);
}
.ob-product-results.is-open { display: block; }
.ob-product-result { padding: 10px 14px; cursor: pointer; border-bottom: 1px solid var(--line); font-size: 14px; }
.ob-product-result:last-child { border-bottom: none; }
.ob-product-result:hover { background: var(--surface-alt); }

/* Ledger-style items table: hairline rules, not boxed cells */
.ob-items-table { width: 100%; border-collapse: collapse; margin-bottom: 14px; font-variant-numeric: tabular-nums; }
.ob-items-table th {
	text-align: left; font-size: 11px; font-weight: 600; color: var(--ink-soft);
	text-transform: uppercase; letter-spacing: 0.06em; padding: 0 8px 8px; border-bottom: 1px solid var(--line);
}
.ob-items-table td {
	padding: 8px; font-size: 13.5px; border-bottom: 1px solid var(--line); vertical-align: middle;
}
.ob-items-table tbody tr:last-child td { border-bottom: 1px solid var(--line); }
.ob-items-table input {
	width: 100%; border: 1px solid transparent; border-radius: 5px; padding: 5px 6px;
	font-size: 13.5px; font-family: inherit; background: transparent; color: var(--ink);
	font-variant-numeric: tabular-nums;
}
.ob-items-table input:hover { border-color: var(--line); }
.ob-items-table .ob-amount { text-align: right; font-weight: 600; }

.ob-total {
	text-align: right; font-family: var(--font-display); font-size: 20px; font-weight: 600;
	margin: 14px 0; padding-top: 12px; border-top: 1px solid var(--line);
	font-variant-numeric: tabular-nums;
}

.ob-form-footer { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }

/* Buttons */
.ob-btn {
	display: inline-block; padding: 9px 18px; border-radius: 7px; border: 1px solid var(--line);
	background: var(--surface-alt); color: var(--ink); text-decoration: none; font-size: 14px;
	font-family: inherit; font-weight: 500; cursor: pointer; transition: background-color 0.12s ease, border-color 0.12s ease;
}
.ob-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.ob-btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-contrast); }
.ob-btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.ob-btn-outline { background: var(--surface); }
.ob-btn-outline:hover { background: var(--surface-alt); }
.ob-btn-whatsapp { background: var(--whatsapp); border-color: var(--whatsapp); color: #06210f; font-weight: 600; }
.ob-btn-large { padding: 13px 22px; font-size: 15.5px; }
.ob-btn-block { width: 100%; text-align: center; }

/* Alerts */
.ob-alert { padding: 11px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13.5px; }
.ob-alert-error { background: var(--danger-bg); color: var(--danger); border: 1px solid var(--danger); }
.ob-alert-success { background: var(--success-bg); color: var(--success); border: 1px solid var(--success); }

/* Status badges — encode state in form, not just color */
.ob-badge {
	display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px 3px 8px;
	border-radius: 20px; font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums;
}
.ob-badge-success { background: var(--success-bg); color: var(--success); }
.ob-badge-success::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--success); }

/* Auth screens */
.ob-app-centered { display: flex; align-items: center; justify-content: center; min-height: 100vh; padding: 20px; }
.ob-app-card h1 { font-family: var(--font-display); margin-top: 0; }
.ob-app-subtitle { color: var(--ink-soft); font-size: 13.5px; margin-top: -10px; margin-bottom: 18px; }

.ob-pin-display {
	text-align: center; font-size: 30px; letter-spacing: 10px; min-height: 46px;
	margin: 4px 0 20px; border: 1px solid var(--line); border-radius: 8px; padding: 8px;
	background: var(--surface-alt); color: var(--ink); font-variant-numeric: tabular-nums;
}
.ob-pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 18px; }
.ob-pin-key {
	padding: 18px 0; font-size: 20px; font-family: inherit; border-radius: 8px;
	border: 1px solid var(--line); background: var(--surface-alt); color: var(--ink); cursor: pointer;
	transition: background-color 0.1s ease;
}
.ob-pin-key:hover { background: var(--line); }
.ob-pin-key:active { background: var(--primary); color: var(--primary-contrast); }
