/* WERI TEXTILE admin — self-contained dark theme (no frameworks). */
:root {
	--bg: #0f1216;
	--bg-elev: #161b22;
	--bg-elev-2: #1c232c;
	--border: #262d38;
	--text: #e6e9ee;
	--text-muted: #96a0ad;
	--primary: #b8893c;
	--primary-strong: #d3a452;
	--danger: #c6533f;
	--success: #57a773;
	--info: #5b9bd5;
	--warn: #c9a227;
	--violet: #8e7cc3;
	--radius: 8px;
	--shadow: 0 10px 30px rgba(0, 0, 0, .35);
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
	background: var(--bg);
	color: var(--text);
	font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

a { color: var(--primary-strong); text-decoration: none; }
a:hover { text-decoration: underline; }

.muted { color: var(--text-muted); }

/* ---------- shared controls ---------- */
.btn {
	display: inline-block;
	padding: 8px 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-elev-2);
	color: var(--text);
	font: inherit;
	cursor: pointer;
	text-decoration: none;
	transition: background .15s, border-color .15s;
}
.btn:hover { border-color: var(--primary); text-decoration: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #16110a; font-weight: 600; }
.btn-primary:hover { background: var(--primary-strong); border-color: var(--primary-strong); }
.btn-danger:hover { border-color: var(--danger); color: var(--danger); }
.btn-small { padding: 5px 10px; font-size: 13px; }
.btn-ghost { background: transparent; }
.btn-block { width: 100%; }
.btn-link { background: transparent; border: none; color: var(--primary-strong); padding: 5px 0; cursor: pointer; }

input[type="text"], input[type="password"], input[type="number"], select, textarea {
	width: 100%;
	padding: 9px 11px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-elev);
	color: var(--text);
	font: inherit;
}
input:focus, select:focus, textarea:focus {
	outline: none;
	border-color: var(--primary);
}
textarea { min-height: 96px; resize: vertical; }

label { display: block; margin: 12px 0 5px; color: var(--text-muted); font-size: 13px; }

/* ---------- flash messages ---------- */
.flash-stack { margin-bottom: 16px; }
.flash {
	padding: 10px 14px;
	border-radius: var(--radius);
	border: 1px solid var(--border);
	margin-bottom: 8px;
}
.flash-success { border-color: var(--success); color: var(--success); background: rgba(87, 167, 115, .08); }
.flash-error { border-color: var(--danger); color: var(--danger); background: rgba(198, 83, 63, .08); }

/* ---------- auth (login / message pages) ---------- */
.auth-body {
	min-height: 100vh;
	display: flex;
	align-items: center;
	justify-content: center;
	background: radial-gradient(circle at 20% 0, #1a1510 0, var(--bg) 55%);
	padding: 24px;
}
.auth-body-inner { width: 100%; max-width: 400px; }
.auth-card {
	background: var(--bg-elev);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 32px;
	box-shadow: var(--shadow);
}
.auth-card-head { text-align: center; margin-bottom: 20px; }
.auth-card-head .auth-logo { height: 64px; width: auto; margin-bottom: 10px; }
.auth-card-head h1 { margin: 0; font-size: 22px; }
.auth-card-head p { margin: 4px 0 0; color: var(--text-muted); }
.auth-form .btn { margin-top: 18px; }
.auth-foot { margin-top: 18px; text-align: center; color: var(--text-muted); font-size: 13px; }
.auth-card-message .msg-body { color: var(--text-muted); text-align: center; margin: 4px 0 0; }

/* ---------- app shell ---------- */
.app-body { min-height: 100vh; }
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
	width: 230px;
	flex-shrink: 0;
	background: var(--bg-elev);
	border-right: 1px solid var(--border);
	display: flex;
	flex-direction: column;
}
.sidebar-brand {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 18px 16px;
	border-bottom: 1px solid var(--border);
	font-weight: 700;
	letter-spacing: .4px;
}
.sidebar-brand img { height: 30px; width: auto; }
.sidebar-nav { flex: 1; padding: 12px 8px; display: flex; flex-direction: column; gap: 2px; }
.nav-section {
	padding: 14px 12px 4px;
	font-size: 11px;
	text-transform: uppercase;
	letter-spacing: 1px;
	color: var(--text-muted);
}
.nav-item {
	display: block;
	padding: 9px 12px;
	border-radius: var(--radius);
	color: var(--text);
	font-size: 14px;
}
.nav-item:hover { background: var(--bg-elev-2); text-decoration: none; }
.nav-item.is-active { background: var(--bg-elev-2); color: var(--primary-strong); }
.sidebar-foot { padding: 14px 8px; border-top: 1px solid var(--border); }

.main { flex: 1; display: flex; flex-direction: column; min-width: 0; }

.topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 12px 22px;
	border-bottom: 1px solid var(--border);
	background: var(--bg-elev);
}
.topbar-user { display: flex; align-items: baseline; gap: 10px; }
.topbar-name { font-weight: 600; }
.topbar-role { color: var(--text-muted); text-transform: uppercase; font-size: 12px; }
.topbar-logout { margin: 0; }

.content { padding: 24px 22px 60px; }

.fake-footer {
	position: fixed;
	bottom: 0;
	left: 230px;
	right: 0;
	padding: 10px 22px;
	font-size: 12px;
	color: var(--text-muted);
	background: var(--bg-elev);
	border-top: 1px solid var(--border);
	z-index: 5;
}

/* ---------- headings / panels ---------- */
.page-head { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 20px; flex-wrap: wrap; }
.page-head h2 { margin: 0; font-size: 24px; }
.page-head p { margin: 0 0 2px; color: var(--text-muted); }
.page-head .btn { margin-left: auto; }

.panel {
	background: var(--bg-elev);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 20px;
	margin-bottom: 20px;
}
.panel-narrow { max-width: 520px; }
.panel h3 { margin: 0 0 14px; }

/* ---------- stat cards ---------- */
.stat-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
	gap: 14px;
	margin-bottom: 22px;
}
.stat-card {
	background: var(--bg-elev);
	border: 1px solid var(--border);
	border-radius: 12px;
	padding: 18px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.stat-label { color: var(--text-muted); font-size: 13px; }
.stat-value { font-size: 30px; font-weight: 700; }
.stat-sub { color: var(--text-muted); font-size: 12px; }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.table th { color: var(--text-muted); font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
.table tbody tr:hover { background: var(--bg-elev-2); }
.th-actions, .td-actions { text-align: right; }
.td-actions { white-space: nowrap; }

.badge {
	display: inline-block;
	padding: 2px 9px;
	border-radius: 999px;
	font-size: 12px;
	background: var(--bg-elev-2);
	border: 1px solid var(--border);
}
.badge-active { color: var(--success); border-color: var(--success); }
.badge-inactive { color: var(--text-muted); }
.badge-new { color: var(--primary-strong); border-color: var(--primary); }
.badge-contacted { color: var(--info); border-color: var(--info); }
.badge-quoted { color: var(--warn); border-color: var(--warn); }
.badge-confirmed { color: var(--success); border-color: var(--success); }
.badge-shipped { color: var(--violet); border-color: var(--violet); }
.badge-cancelled { color: var(--danger); border-color: var(--danger); }
.badge-role { text-transform: uppercase; }

/* ---------- inline actions ---------- */
.inline-form { display: inline-block; margin: 0 4px 4px 0; }
.reset-wrap { display: inline-block; margin: 0 4px 4px 0; }
.reset-wrap summary { list-style: none; cursor: pointer; }
.reset-wrap[open] .reset-form { display: flex; gap: 8px; margin-top: 8px; align-items: center; }
.reset-form { display: none; }
.reset-form input { width: 220px; }

.form-actions { margin-top: 18px; display: flex; gap: 10px; }
.form-row { margin-top: 14px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--text); margin: 0; }
.check input { width: auto; }

/* ---------- products (list filters, form, thumbnails, pagination) ---------- */
.filters-grid {
	display: grid;
	grid-template-columns: 2fr 1fr 1fr auto;
	gap: 14px;
	align-items: end;
}
.filters-grid label { margin-top: 0; }
.filters-actions { display: flex; gap: 10px; }

.hint { margin: -6px 0 12px; color: var(--text-muted); font-size: 13px; }

.form-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 0 16px;
}
.form-grid-action { display: flex; align-items: flex-end; }

.locale-block {
	background: var(--bg-elev-2);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	margin-top: 12px;
	padding: 4px 14px 14px;
}
.locale-block summary {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 0;
	font-weight: 600;
	cursor: pointer;
}
.locale-block summary::marker { color: var(--primary-strong); }

.table-form th, .table-form td { vertical-align: middle; }
.table-form input[type="text"], .table-form input[type="number"], .table-form select { min-width: 90px; }
.table-form .check { white-space: nowrap; }

.thumb {
	display: inline-block;
	vertical-align: middle;
	border: 1px solid var(--border);
	border-radius: 6px;
	background: var(--bg);
	object-fit: cover;
}
.thumb-empty {
	width: 44px;
	height: 44px;
	line-height: 42px;
	text-align: center;
	color: var(--text-muted);
}

.table-empty { padding: 26px 12px; text-align: center; color: var(--text-muted); }

.pagination {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 14px;
	margin-top: 16px;
}
.page-info, .page-current { color: var(--text-muted); font-size: 13px; }
.page-links { display: flex; align-items: center; gap: 10px; }
.btn.is-disabled { opacity: .45; cursor: not-allowed; }

.form-add-color { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.panel-meta { max-width: 520px; }
.meta-list { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.meta-list dt { color: var(--text-muted); font-size: 13px; }
.meta-list dd { margin: 0; }

/* ---------- orders / destinations / settings ---------- */
.status-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.status-tab {
	padding: 6px 12px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--bg-elev);
	color: var(--text);
	font-size: 13px;
}
.status-tab:hover { border-color: var(--primary); text-decoration: none; }
.status-tab.is-active { background: var(--bg-elev-2); border-color: var(--primary); color: var(--primary-strong); }
.status-tab .count { color: var(--text-muted); }
.status-tab.is-active .count { color: var(--primary-strong); }

/* ---------- language switcher (sidebar / login) ---------- */
/* It shares the pill look with .status-tabs but is centred, compact and
   carries no bottom margin so it sits naturally in both contexts. */
.lang-switcher {
	margin-bottom: 0;
	justify-content: center;
}
.lang-switcher .lang-option {
	padding: 5px 11px;
	font-size: 12px;
	line-height: 1;
	white-space: nowrap;
}
.sidebar-foot .lang-switcher {
	margin-bottom: 10px;
}
.auth-card .lang-switcher {
	margin: 0 0 18px;
}

.td-nowrap { white-space: nowrap; }
.td-note { font-size: 12px; margin-top: 4px; }
.detail-total { text-align: right; font-weight: 700; }

.form-inline-block { display: inline-block; vertical-align: top; margin: 0 22px 12px 0; }
.form-inline-block label { margin-top: 0; }
.form-inline-block .btn { margin-top: 10px; }

.fieldset {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 4px 16px 16px;
	margin: 0 0 18px;
}
.fieldset legend { padding: 0 8px; color: var(--primary-strong); font-weight: 600; }
.fieldset label:first-of-type { margin-top: 6px; }
.check-list { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.notice {
	padding: 10px 14px;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-elev-2);
	color: var(--text-muted);
	font-size: 13px;
}

/* ---------- responsive ---------- */
@media (max-width: 820px) {
	.app-shell { flex-direction: column; }
	.sidebar { width: 100%; border-right: none; border-bottom: 1px solid var(--border); }
	.sidebar-nav { flex-direction: row; flex-wrap: wrap; }
	.nav-section { display: none; }
	.fake-footer { left: 0; }
	.fake-footer { display: none; }
	.th-actions { display: none; }
	.td-actions { text-align: left; }
	.filters-grid { grid-template-columns: 1fr; }
	/* Wide lists (products has 9 columns) scroll inside their own panel
	   instead of stretching the whole page sideways on a phone. */
	.panel { overflow-x: auto; -webkit-overflow-scrolling: touch; }
	.content { padding-inline: 12px; }
}