/* Laundry Management Suite — frontend portal styles.
   Deliberately self-contained (no reliance on the active theme) — this page
   loads with NO theme stylesheet at all, so this file supplies everything,
   including a baseline reset.

   Theming: ALL color variables live on :root as the single source of truth.
   [data-lm-theme="dark"] is applied to <body> and overrides them there —
   because it sits on body (an ancestor of everything), the overrides cascade
   to every descendant with nothing lower in the tree re-declaring (and so
   shadowing) the light defaults. A custom accent color (Premium) is injected
   as a small inline <style> that also targets :root, for the same reason. */

:root {
	--lm-accent: #028090;
	--lm-accent-dark: #023436;
	--lm-surface: #ffffff;
	--lm-surface-tint: #f1f7f6;
	--lm-surface-hover: #eef5f4;
	--lm-text: #16302e;
	--lm-text-muted: #64748b;
	--lm-text-faint: #94a3b8;
	--lm-border: #e2e8f0;
	--lm-page-bg: #ffffff;
	--lm-sidebar-width: 220px;
}

[data-lm-theme="dark"] {
	--lm-surface: #16211f;
	--lm-surface-tint: #1c2a28;
	--lm-surface-hover: #223330;
	--lm-text: #e6f1ef;
	--lm-text-muted: #a9bdba;
	--lm-text-faint: #7d9490;
	--lm-border: #2b3d3a;
	--lm-page-bg: #0e1615;
}

html, body {
	margin: 0;
	padding: 0;
	background: var(--lm-page-bg);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
*, *::before, *::after {
	box-sizing: border-box;
}

/* ---- Login screen ---- */
.lm-login-wrap {
	display: flex;
	justify-content: center;
	padding: 4rem 1rem;
	min-height: 100vh;
}
.lm-login-card {
	width: 100%;
	max-width: 360px;
	background: var(--lm-surface);
	border: 1px solid var(--lm-border);
	border-radius: 12px;
	padding: 2rem 1.75rem;
	color: var(--lm-text);
	align-self: flex-start;
	margin-top: 2rem;
}
.lm-login-card h2 { margin: 0 0 4px; font-size: 18px; }
.lm-login-card .lm-sub { margin: 0 0 20px; color: var(--lm-text-muted); font-size: 13px; }
.lm-login-card label { display: block; font-size: 13px; color: var(--lm-text-muted); margin-bottom: 4px; }
.lm-login-card input[type="text"],
.lm-login-card input[type="password"] {
	width: 100%; box-sizing: border-box; padding: 9px 10px; margin-bottom: 14px;
	border: 1px solid var(--lm-border); border-radius: 6px; font-size: 16px;
	background: var(--lm-surface); color: var(--lm-text);
}
.lm-remember { display: flex; align-items: center; gap: 6px; font-size: 13px; margin-bottom: 16px; color: var(--lm-text); }
.lm-remember input { width: auto; margin: 0; }
.lm-error {
	background: #fcebeb; color: #791f1f; padding: 8px 10px; border-radius: 6px;
	font-size: 12px; margin-bottom: 14px;
}
.lm-note { font-size: 11px; color: var(--lm-text-faint); margin: 14px 0 0; }

.lm-btn {
	display: inline-block; border: none; border-radius: 6px; padding: 10px 16px;
	font-size: 14px; cursor: pointer; background: var(--lm-surface-tint); color: var(--lm-text);
	text-decoration: none;
}
.lm-btn-primary { background: var(--lm-accent-dark); color: #ffffff; width: 100%; }
.lm-btn-small { padding: 6px 10px; font-size: 12px; }
.lm-btn[disabled] { opacity: 0.5; cursor: not-allowed; }

/* ---- Shell: sidebar + main content ---- */
.lm-portal-shell {
	display: flex;
	align-items: stretch;
	min-height: 100vh;
}

.lm-hamburger {
	display: none;
	position: fixed; top: 10px; left: 10px; z-index: 1001;
	width: 42px; height: 42px; border-radius: 8px; border: none;
	background: var(--lm-accent-dark); color: #ffffff; font-size: 20px; cursor: pointer;
	align-items: center; justify-content: center;
}
.lm-sidebar-overlay { display: none; }

.lm-sidebar {
	width: var(--lm-sidebar-width);
	flex-shrink: 0;
	position: sticky;
	top: 0;
	height: 100vh;
	overflow-y: auto;
	background: var(--lm-accent-dark);
	color: #ffffff;
	display: flex;
	flex-direction: column;
	padding: 20px 0;
}
.lm-sidebar-brand { font-weight: 600; font-size: 17px; padding: 0 20px 20px; }
.lm-sidebar-nav { display: flex; flex-direction: column; flex: 1; }
.lm-sidebar-nav a {
	color: #cfe8e4; text-decoration: none; font-size: 14px;
	padding: 11px 20px; border-left: 3px solid transparent;
}
.lm-sidebar-nav a:hover { color: #ffffff; background: rgba(255,255,255,0.06); }
.lm-sidebar-nav a.lm-active {
	color: #ffffff; background: rgba(255,255,255,0.1); border-left-color: #02c39a; font-weight: 600;
}
.lm-sidebar-footer {
	display: flex; flex-direction: column; gap: 8px; padding: 16px 20px 0;
	border-top: 1px solid rgba(255,255,255,0.12); margin-top: 12px;
}
.lm-sidebar-footer a { color: #cfe8e4; text-decoration: none; font-size: 13px; }
.lm-sidebar-footer a:hover { color: #ffffff; }
.lm-theme-toggle {
	background: transparent; border: 1px solid #2f5250; color: #cfe8e4 !important;
	border-radius: 6px; padding: 6px 10px; font-size: 12px; cursor: pointer; text-align: center;
}

.lm-main { flex: 1; min-width: 0; }
.lm-portal-content { max-width: 1000px; margin: 0 auto; padding: 32px 28px; color: var(--lm-text); }
.lm-portal-content h1 { margin: 0 0 4px; font-size: 24px; color: var(--lm-text); }
.lm-portal-content .lm-sub { color: var(--lm-text-muted); margin: 0 0 24px; }

.lm-card {
	background: var(--lm-surface-tint); border-radius: 10px; padding: 20px 24px; margin-bottom: 20px;
}
.lm-card h2 { font-size: 16px; margin: 0 0 12px; color: var(--lm-text); }
.lm-two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.lm-inline-form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.lm-inline-form input[type="text"] {
	padding: 8px 10px; border: 1px solid var(--lm-border); border-radius: 6px;
	background: var(--lm-surface); color: var(--lm-text);
}
.lm-grid-form { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.lm-grid-form input, .lm-grid-form select, .lm-grid-form textarea {
	padding: 8px 10px; border: 1px solid var(--lm-border); border-radius: 6px;
	background: var(--lm-surface); color: var(--lm-text); width: 100%; font-size: 14px;
}
.lm-grid-form button { grid-column: span 2; width: max-content; }

.lm-group-block { margin-bottom: 16px; }
.lm-group-block h3 { font-size: 14px; margin: 0 0 6px; color: var(--lm-text); }
.lm-store-list { list-style: none; margin: 0; padding: 0; }
.lm-store-list li {
	display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px; background: var(--lm-surface);
	padding: 8px 12px; border-radius: 6px; margin-bottom: 6px; font-size: 13px; color: var(--lm-text);
}
.lm-store-code { color: var(--lm-text-muted); }

.lm-table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 8px; }
.lm-pricing-table { width: 100%; min-width: 480px; border-collapse: collapse; background: var(--lm-surface); color: var(--lm-text); }
.lm-pricing-table th, .lm-pricing-table td { padding: 10px 12px; border-bottom: 1px solid var(--lm-border); font-size: 13px; text-align: left; }
.lm-pricing-table thead th { background: var(--lm-accent); color: #ffffff; }
.lm-pricing-table td input[type="number"] { width: 84px; padding: 4px 6px; border: 1px solid var(--lm-border); border-radius: 4px; background: var(--lm-surface); color: var(--lm-text); }
.lm-woo-toggle { font-size: 10px; color: var(--lm-text-muted); display: flex; align-items: center; gap: 4px; }

.lm-notice { background: #fdf3d9; color: #854f0b; padding: 12px 16px; border-radius: 8px; font-size: 13px; }
.lm-empty { color: var(--lm-text-faint); font-size: 13px; }

.lm-status-buttons { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.lm-status-row {
	display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
	background: var(--lm-surface); padding: 10px 12px; border-radius: 6px; margin-bottom: 8px; font-size: 13px; color: var(--lm-text);
}
.lm-status-inline-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.lm-status-inline-form select { padding: 4px 6px; border: 1px solid var(--lm-border); border-radius: 4px; font-size: 12px; background: var(--lm-surface); color: var(--lm-text); }

.lm-back-link { display: inline-block; margin-bottom: 10px; font-size: 13px; color: var(--lm-text-muted); text-decoration: none; }
.lm-back-link:hover { color: var(--lm-accent-dark); }

.lm-stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 20px; }
.lm-stat-card { background: var(--lm-surface-tint); border-radius: 8px; padding: 14px 16px; position: relative; }
.lm-stat-icon {
	position: absolute; top: 12px; right: 12px; width: 30px; height: 30px; border-radius: 8px;
	display: flex; align-items: center; justify-content: center; font-size: 14px; font-weight: 700;
	background: var(--lm-accent); color: #ffffff;
}
.lm-stat-icon.lm-tone-warn { background: #b8860b; }
.lm-stat-icon.lm-tone-danger { background: #c0392b; }
.lm-stat-label { font-size: 12px; color: var(--lm-text-muted); margin: 0 0 4px; padding-right: 36px; }
.lm-stat-value { font-size: 22px; font-weight: 600; margin: 0; color: var(--lm-text); }
.lm-tone-warn .lm-stat-value { color: #b8860b; }
.lm-tone-danger .lm-stat-value { color: #c0392b; }

.lm-chart-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 20px; }
.lm-chart-card svg { max-width: 100%; height: auto; color: var(--lm-text); }
.lm-chart-row { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.lm-legend { display: flex; flex-direction: column; gap: 6px; }
.lm-legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--lm-text); }
.lm-legend-item i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }

.lm-clickable-list li { padding: 0; }
.lm-clickable-list a {
	display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 4px;
	padding: 10px 12px; text-decoration: none; color: inherit; width: 100%; box-sizing: border-box;
}
.lm-clickable-list a:hover { background: var(--lm-surface-hover); border-radius: 6px; }
.lm-row-sublabel { display: block; font-size: 11px; color: var(--lm-text-faint); margin-top: 2px; }

.lm-alert-row { padding: 8px 12px; border-radius: 6px; font-size: 13px; margin-bottom: 6px; }
.lm-tone-warn.lm-alert-row { background: #fdf3d9; color: #854f0b; }
.lm-tone-danger.lm-alert-row { background: #fcebeb; color: #791f1f; }

.lm-color-swatch { width: 32px; height: 32px; border-radius: 6px; border: 1px solid var(--lm-border); display: inline-block; vertical-align: middle; margin-right: 8px; }

.lm-store-row-detail { background: var(--lm-surface); border-radius: 6px; margin-bottom: 6px; padding: 8px 12px; }
.lm-store-summary { display: flex; justify-content: space-between; cursor: pointer; font-size: 13px; list-style: none; }
.lm-store-summary::-webkit-details-marker { display: none; }

/* ---- QR scan panel ---- */
.lm-scan-panel { display: flex; gap: 20px; flex-wrap: wrap; align-items: flex-start; }
.lm-scan-input-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.lm-scan-input-form input[type="text"] {
	padding: 10px 12px; border: 1px solid var(--lm-border); border-radius: 6px; font-size: 14px;
	background: var(--lm-surface); color: var(--lm-text); min-width: 220px;
}
.lm-camera-wrap { display: none; margin-top: 12px; }
.lm-camera-wrap.lm-camera-active { display: block; }
.lm-camera-wrap video { width: 100%; max-width: 360px; border-radius: 10px; background: #000; }
.lm-bulk-bar {
	display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 12px;
	background: var(--lm-surface); padding: 10px 12px; border-radius: 6px;
}
.lm-bulk-bar select { padding: 6px 8px; border: 1px solid var(--lm-border); border-radius: 4px; background: var(--lm-surface); color: var(--lm-text); }
.lm-check-row { display: flex; align-items: center; gap: 10px; }

/* ---- Invoice template preview ---- */
.lm-template-options { display: flex; gap: 12px; flex-wrap: wrap; }
.lm-template-card {
	border: 2px solid var(--lm-border); border-radius: 8px; padding: 10px 14px; cursor: pointer;
	font-size: 13px; background: var(--lm-surface);
}
.lm-template-card.lm-selected { border-color: var(--lm-accent); }

/* ---- Mobile ---- */
@media (max-width: 860px) {
	.lm-hamburger { display: flex; }
	.lm-sidebar {
		position: fixed; top: 0; left: 0; height: 100vh; width: 260px;
		transform: translateX(-100%); transition: transform 0.25s ease; z-index: 1000;
	}
	.lm-sidebar.lm-sidebar-open { transform: translateX(0); }
	.lm-sidebar-overlay {
		display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 999;
	}
	.lm-sidebar-overlay.lm-sidebar-open { display: block; }
	.lm-portal-content { padding: 76px 16px 32px; }
	.lm-two-col { grid-template-columns: 1fr; gap: 12px; }
	.lm-chart-grid { grid-template-columns: 1fr; }
	.lm-grid-form { grid-template-columns: 1fr; }
	.lm-grid-form button { grid-column: 1; width: 100%; }
	.lm-stat-grid { grid-template-columns: repeat(2, 1fr); }
	.lm-login-wrap { padding: 2rem 1rem; }
	.lm-status-row { flex-direction: column; align-items: flex-start; }
	.lm-status-inline-form { width: 100%; }
	.lm-status-inline-form select { flex: 1; }
	.lm-scan-input-form input[type="text"] { min-width: 0; flex: 1; width: 100%; }
}
@media (max-width: 480px) {
	.lm-stat-grid { grid-template-columns: 1fr 1fr; }
	.lm-portal-content h1 { font-size: 20px; }
}
