/* OrderHub - panel de pedidos (by mayquiperu) */
:root {
	--oh-navy: #14315c;
	--oh-navy-dark: #0e2444;
	--oh-orange: #f4761f;
	--oh-orange-dark: #dd6412;
	--oh-bg: #f4f6f9;
	--oh-card: #ffffff;
	--oh-border: #e3e8ef;
	--oh-text: #1f2937;
	--oh-muted: #6b7280;
	--oh-radius: 10px;
}

.oh-wrap {
	max-width: 1240px;
	margin: 24px auto;
	padding: 0 16px;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
	color: var(--oh-text);
}

/* ---------- Topbar / marca ---------- */
.oh-topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	background: var(--oh-card);
	border: 1px solid var(--oh-border);
	border-radius: var(--oh-radius);
	padding: 12px 16px;
	margin-bottom: 16px;
}
.oh-logo { height: 40px; width: auto; display: block; }
.oh-topbar-right { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.oh-user { font-size: 14px; color: var(--oh-muted); }

/* ---------- Login ---------- */
.oh-login-wrap {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 72vh;
	padding: 40px 16px;
}
.oh-login-card {
	width: 100%;
	max-width: 400px;
	background: var(--oh-card);
	border: 1px solid var(--oh-border);
	border-radius: 14px;
	padding: 28px 26px 18px;
	box-shadow: 0 12px 32px rgba(14, 36, 68, .10);
}
.oh-login-brand { text-align: center; margin-bottom: 18px; }
.oh-login-brand .oh-logo { height: 58px; margin: 0 auto 8px; }
.oh-tagline { margin: 0; font-size: 13px; color: var(--oh-muted); text-transform: uppercase; letter-spacing: .6px; }

/* ---------- Formularios ---------- */
.oh-form p { margin: 0 0 14px; }
.oh-form label, .oh-field label, .oh-inline-form label, .oh-note-form label, .oh-bulk-label {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: var(--oh-navy);
	margin-bottom: 5px;
}
.oh-form input[type="text"],
.oh-form input[type="password"],
.oh-field input,
.oh-field select,
.oh-inline-form select,
.oh-note-form textarea,
.oh-bulk select {
	width: 100%;
	padding: 9px 11px;
	border: 1px solid #cfd6e0;
	border-radius: 7px;
	font-size: 14px;
	background: #fff;
	color: var(--oh-text);
}
.oh-form input:focus,
.oh-field input:focus,
.oh-field select:focus,
.oh-inline-form select:focus,
.oh-note-form textarea:focus,
.oh-bulk select:focus {
	outline: 2px solid rgba(244, 118, 31, .35);
	border-color: var(--oh-orange);
}
.oh-remember { font-size: 13px; color: var(--oh-muted); }
.oh-remember input { margin-right: 6px; }

/* ---------- Botones ---------- */
.oh-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 9px 15px;
	border-radius: 7px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid transparent;
	transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.oh-btn-primary { background: var(--oh-orange); border-color: var(--oh-orange); color: #fff; }
.oh-btn-primary:hover { background: var(--oh-orange-dark); border-color: var(--oh-orange-dark); color: #fff; }
.oh-btn-secondary { background: var(--oh-navy); border-color: var(--oh-navy); color: #fff; }
.oh-btn-secondary:hover { background: var(--oh-navy-dark); border-color: var(--oh-navy-dark); color: #fff; }
.oh-btn-ghost { background: #fff; border-color: #cfd6e0; color: var(--oh-navy); }
.oh-btn-ghost:hover { background: #f1f4f9; color: var(--oh-navy); }
.oh-btn-mini { padding: 5px 11px; font-size: 13px; background: #fff; border-color: #cfd6e0; color: var(--oh-navy); }
.oh-btn-mini:hover { background: var(--oh-navy); color: #fff; border-color: var(--oh-navy); }
.oh-btn-block { width: 100%; }

/* ---------- Avisos ---------- */
.oh-notice {
	padding: 11px 14px;
	border-radius: 8px;
	margin: 12px 0;
	font-size: 14px;
	background: #eaf1fd;
	color: var(--oh-navy);
	border: 1px solid #cdddf7;
}
.oh-success { background: #e8f7ee; color: #12703a; border-color: #b9e6ca; }
.oh-error { background: #fdecec; color: #9b1c1c; border-color: #f5c2c2; }

/* ---------- Filtros ---------- */
.oh-filters {
	background: var(--oh-card);
	border: 1px solid var(--oh-border);
	border-radius: var(--oh-radius);
	padding: 14px 16px;
	margin-bottom: 14px;
}
.oh-filter-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.oh-field { display: flex; flex-direction: column; min-width: 150px; }
.oh-field-search { flex: 1 1 260px; }
.oh-field-actions { flex-direction: row; align-items: flex-end; gap: 8px; }

/* ---------- Toolbar ---------- */
.oh-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	flex-wrap: wrap;
	margin: 14px 0;
}
.oh-count { font-size: 14px; color: var(--oh-muted); }
.oh-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Acción masiva ---------- */
.oh-bulk { margin-bottom: 14px; }
.oh-bulk-bar {
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
	background: #fff7ef;
	border: 1px solid #f6d9bd;
	border-radius: var(--oh-radius);
	padding: 10px 14px;
}
.oh-bulk-bar .oh-bulk-label { margin: 0; }
.oh-bulk select { width: auto; min-width: 190px; }
.oh-bulk-bottom { margin-top: 10px; }

/* ---------- Tablas ---------- */
.oh-table-wrap {
	overflow-x: auto;
	background: var(--oh-card);
	border: 1px solid var(--oh-border);
	border-radius: var(--oh-radius);
}
.oh-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.oh-table th, .oh-table td {
	padding: 11px 13px;
	border-bottom: 1px solid var(--oh-border);
	text-align: left;
	vertical-align: top;
}
.oh-table th {
	background: var(--oh-navy);
	color: #fff;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .5px;
	font-weight: 700;
	white-space: nowrap;
}
.oh-table tbody tr:nth-child(even) { background: #fafbfd; }
.oh-table tbody tr:hover { background: #fff4ea; }
.oh-table .oh-num { text-align: right; white-space: nowrap; }
.oh-col-check { width: 38px; }
.oh-products { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.oh-order-id { font-weight: 700; color: var(--oh-navy); text-decoration: none; }
.oh-order-id:hover { color: var(--oh-orange); }
.oh-mail { word-break: break-all; }
.oh-table input[type="checkbox"] { width: 16px; height: 16px; accent-color: var(--oh-orange); }

/* ---------- Badges de estado ---------- */
.oh-badge {
	display: inline-block;
	padding: 3px 10px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 700;
	background: #eef1f6;
	color: #44506a;
	white-space: nowrap;
}
.oh-badge-completed { background: #dcf5e5; color: #12703a; }
.oh-badge-processing { background: #e0ecff; color: #1c4fbf; }
.oh-badge-pending { background: #fff2cc; color: #8a6100; }
.oh-badge-on-hold { background: #fde2e2; color: #9b1c1c; }
.oh-badge-cancelled { background: #eceef2; color: #5b6472; }
.oh-badge-refunded { background: #efe3ff; color: #6b21a8; }
.oh-badge-failed { background: #ffd9d9; color: #a01818; }
.oh-badge-internal { background: #e6edf7; color: var(--oh-navy); }
.oh-badge-customer { background: #fff0e2; color: var(--oh-orange-dark); }

/* ---------- Paginación ---------- */
.oh-pagination { display: flex; gap: 6px; margin: 16px 0; flex-wrap: wrap; }
.oh-page {
	padding: 7px 12px;
	border: 1px solid #cfd6e0;
	border-radius: 7px;
	text-decoration: none;
	color: var(--oh-navy);
	font-size: 14px;
	background: #fff;
}
.oh-page:hover { border-color: var(--oh-navy); }
.oh-page.current { background: var(--oh-navy); border-color: var(--oh-navy); color: #fff; font-weight: 700; }

/* ---------- Detalle ---------- */
.oh-detail-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.oh-detail-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
	gap: 14px;
	margin-bottom: 14px;
}
.oh-card {
	background: var(--oh-card);
	border: 1px solid var(--oh-border);
	border-radius: var(--oh-radius);
	padding: 16px 18px;
	margin-bottom: 14px;
}
.oh-card h3 {
	margin: 0 0 12px;
	font-size: 16px;
	color: var(--oh-navy);
	display: flex;
	align-items: center;
	gap: 10px;
	flex-wrap: wrap;
}
.oh-card p { margin: 5px 0; font-size: 14px; }
.oh-card a { color: var(--oh-orange-dark); }
.oh-inline-form {
	display: flex;
	align-items: flex-end;
	gap: 10px;
	flex-wrap: wrap;
	margin-top: 14px;
	padding-top: 14px;
	border-top: 1px dashed var(--oh-border);
}
.oh-inline-form select { width: auto; min-width: 170px; }
.oh-totals { margin-top: 14px; margin-left: auto; max-width: 340px; text-align: right; }
.oh-totals p { display: flex; justify-content: space-between; gap: 16px; }
.oh-total { font-size: 16px; border-top: 2px solid var(--oh-navy); padding-top: 8px; margin-top: 8px; }

/* ---------- Notas ---------- */
.oh-note-form { margin-bottom: 16px; }
.oh-note-form textarea { resize: vertical; margin-bottom: 8px; }
.oh-notes { list-style: none; margin: 0; padding: 0; }
.oh-notes li { border: 1px solid var(--oh-border); border-left: 4px solid var(--oh-navy); border-radius: 8px; padding: 10px 13px; margin-bottom: 10px; background: #fbfcfe; }
.oh-notes li.oh-note-customer { border-left-color: var(--oh-orange); background: #fffaf5; }
.oh-note-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 5px; }
.oh-note-meta small { color: var(--oh-muted); }
.oh-notes p { margin: 0; font-size: 14px; }
.oh-muted { color: var(--oh-muted); font-size: 14px; }

/* ---------- Footer ---------- */
.oh-footer {
	display: flex;
	justify-content: space-between;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	margin-top: 22px;
	padding-top: 14px;
	border-top: 1px solid var(--oh-border);
	font-size: 13px;
	color: var(--oh-muted);
}
.oh-footer-by { color: var(--oh-orange-dark); font-weight: 700; }

/* ---------- Secciones del panel (pestañas) ---------- */
.oh-tabs {
	display: flex;
	gap: 6px;
	flex-wrap: wrap;
	background: var(--oh-card);
	border: 1px solid var(--oh-border);
	border-radius: var(--oh-radius);
	padding: 6px;
	margin-bottom: 16px;
}
.oh-tab {
	padding: 9px 16px;
	border-radius: 7px;
	font-size: 14px;
	font-weight: 600;
	color: var(--oh-navy);
	text-decoration: none;
	transition: background .15s ease, color .15s ease;
}
.oh-tab:hover { background: #f1f4f9; color: var(--oh-navy); }
.oh-tab.is-active { background: var(--oh-navy); color: #fff; }

.oh-section-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
	margin-bottom: 14px;
}
.oh-section-head h2 { margin: 0; font-size: 20px; color: var(--oh-navy); }
.oh-range-form { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.oh-range-form select { padding: 8px 10px; border: 1px solid #cfd6e0; border-radius: 7px; font-size: 14px; background: #fff; }

/* ---------- KPIs ---------- */
.oh-kpis {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 14px;
	margin-bottom: 14px;
}
.oh-kpi {
	background: var(--oh-card);
	border: 1px solid var(--oh-border);
	border-radius: var(--oh-radius);
	padding: 14px 16px;
	display: flex;
	flex-direction: column;
	gap: 4px;
}
.oh-kpi-label {
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: .5px;
	color: var(--oh-muted);
	font-weight: 700;
}
.oh-kpi-value { font-size: 24px; font-weight: 800; color: var(--oh-navy); line-height: 1.2; }
.oh-kpi small { font-size: 12px; color: var(--oh-muted); }
.oh-kpi-action { justify-content: center; }

/* ---------- Gráfico de barras ---------- */
.oh-chart {
	display: flex;
	align-items: flex-end;
	gap: 4px;
	height: 200px;
	padding-top: 10px;
	overflow-x: auto;
}
.oh-chart-col { flex: 1 0 18px; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 18px; }
.oh-chart-bar {
	width: 100%;
	max-width: 34px;
	background: linear-gradient(180deg, var(--oh-orange) 0%, var(--oh-orange-dark) 100%);
	border-radius: 4px 4px 0 0;
	min-height: 2px;
	transition: opacity .15s ease;
}
.oh-chart-bar:hover { opacity: .8; }
.oh-chart-label { font-size: 10px; color: var(--oh-muted); margin-top: 5px; white-space: nowrap; writing-mode: vertical-rl; text-orientation: mixed; }

/* ---------- Badges de etapa ---------- */
.oh-stage-recibido { background: #e0ecff; color: #1c4fbf; }
.oh-stage-preparacion { background: #fff2cc; color: #8a6100; }
.oh-stage-camino { background: #fff0e2; color: var(--oh-orange-dark); }
.oh-stage-entregado { background: #dcf5e5; color: #12703a; }

.oh-stage-inline { min-width: 150px; padding: 6px 8px; border: 1px solid #cfd6e0; border-radius: 7px; font-size: 13px; background: #fff; color: var(--oh-text); }

/* ---------- Secciones admin (usuarios / configuración) ---------- */
.oh-admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-bottom: 14px; }
.oh-role-help { margin: 0 0 14px; padding-left: 18px; font-size: 13px; color: var(--oh-muted); line-height: 1.7; }
.oh-help-list { margin: 0 0 12px; padding-left: 20px; font-size: 14px; line-height: 1.9; }
.oh-admin-info { margin: 10px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.9; list-style: disc; }
.oh-admin-info a { word-break: break-all; }
.oh-btn-danger { color: #b32d2e; border-color: #b32d2e; background: #fff; }
.oh-btn-danger:hover { background: #b32d2e; color: #fff; border-color: #b32d2e; }
.oh-form input[type="email"],
.oh-form input[type="number"],
.oh-form select { width: 100%; padding: 9px 11px; border: 1px solid #cfd6e0; border-radius: 7px; font-size: 14px; background: #fff; color: var(--oh-text); }
.oh-form input:focus, .oh-form select:focus { outline: 2px solid rgba(244, 118, 31, .35); border-color: var(--oh-orange); }

/* ---------- Admin ---------- */
.oh-admin .oh-admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; margin-top: 16px; }
.oh-admin-wrap { max-width: 1000px; }
.oh-admin-wrap h1 { display: flex; align-items: center; gap: 12px; font-weight: 700; }
.oh-admin-logo { height: 44px; width: auto; }
.oh-admin-version { font-size: 13px; font-weight: 600; color: var(--oh-muted); background: #eef1f6; border-radius: 999px; padding: 3px 10px; }
.oh-admin-lead { font-size: 14px; color: var(--oh-muted); margin: 4px 0 16px; }
.oh-admin-cta { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; background: var(--oh-card); border: 1px solid var(--oh-border); border-radius: var(--oh-radius); padding: 16px 18px; margin-bottom: 20px; }
.oh-btn-big { padding: 13px 24px; font-size: 15px; }
.oh-admin-url { font-size: 13px; color: var(--oh-muted); background: #f1f4f9; padding: 6px 10px; border-radius: 6px; word-break: break-all; }
.oh-admin-wrap h2 { font-size: 15px; text-transform: uppercase; letter-spacing: .5px; color: var(--oh-navy); margin: 0 0 10px; }
.oh-admin-sections { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 20px; }
.oh-admin-section {
	display: flex;
	flex-direction: column;
	gap: 4px;
	background: var(--oh-card);
	border: 1px solid var(--oh-border);
	border-radius: var(--oh-radius);
	padding: 14px 16px;
	text-decoration: none;
	color: var(--oh-text);
	transition: border-color .15s ease, transform .15s ease;
}
.oh-admin-section:hover { border-color: var(--oh-orange); transform: translateY(-2px); color: var(--oh-text); }
.oh-admin-section .dashicons { font-size: 24px; width: 24px; height: 24px; color: var(--oh-orange); }
.oh-admin-section strong { font-size: 14px; color: var(--oh-navy); }
.oh-admin-section small { font-size: 12px; color: var(--oh-muted); }
.oh-admin-wrap .oh-admin-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; margin-bottom: 16px; }
.oh-admin-note { font-size: 13px; color: var(--oh-muted); background: #fff7ef; border: 1px solid #f6d9bd; border-radius: 8px; padding: 10px 14px; }
.oh-admin-footer { border-top: 1px solid var(--oh-border); }
.oh-admin-card { background: #fff; border: 1px solid var(--oh-border); border-radius: var(--oh-radius); padding: 4px 18px 18px; margin-bottom: 16px; }
.oh-admin-card h2 { font-size: 15px; color: var(--oh-navy); border-bottom: 1px solid var(--oh-border); padding-bottom: 8px; }
.oh-admin-info { margin: 10px 0 0; padding-left: 18px; font-size: 13px; line-height: 1.9; }
.oh-admin-footer { font-size: 13px; color: var(--oh-muted); }
.oh-admin .button[data-confirm] { color: #b32d2e; border-color: #b32d2e; }

/* ---------- Responsive: tarjetas en móvil ---------- */
@media (max-width: 880px) {
	.oh-wrap { margin: 14px auto; padding: 0 10px; }
	.oh-filter-row { flex-direction: column; align-items: stretch; }
	.oh-field, .oh-field-actions { width: 100%; }
	.oh-field-actions .oh-btn { flex: 1; }
	.oh-topbar { flex-direction: column; align-items: flex-start; }

	.oh-table thead { display: none; }
	.oh-table, .oh-table tbody, .oh-table tr, .oh-table td { display: block; width: 100%; }
	.oh-table tr {
		border: 1px solid var(--oh-border);
		border-radius: 8px;
		margin-bottom: 10px;
		padding: 6px 4px;
		background: #fff;
	}
	.oh-table td {
		border-bottom: 1px dashed var(--oh-border);
		display: flex;
		justify-content: space-between;
		align-items: flex-start;
		gap: 14px;
		text-align: right;
		padding: 8px 12px;
	}
	.oh-table td:last-child { border-bottom: 0; }
	.oh-table td::before {
		content: attr(data-label);
		font-weight: 700;
		font-size: 12px;
		text-transform: uppercase;
		color: var(--oh-navy);
		text-align: left;
		flex: 0 0 auto;
	}
	.oh-table td.oh-col-check { justify-content: flex-end; }
	.oh-products { white-space: normal; max-width: none; text-align: right; }
	.oh-table-wrap { border: 0; background: transparent; overflow: visible; }
	.oh-detail-actions .oh-btn { flex: 1; }
	.oh-totals { max-width: none; }
	.oh-login-card { padding: 22px 18px 14px; }
}

@media print {
	.oh-topbar, .oh-tabs, .oh-filters, .oh-toolbar, .oh-bulk, .oh-footer, .oh-pagination, .oh-detail-actions, .oh-range-form { display: none !important; }
	.oh-wrap { margin: 0; padding: 0; }
}
